@mdspl/mds-shared-ui 0.8.4 → 0.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -7,4 +7,4 @@ React keys must be passed directly to JSX without using spread:
7
7
  To pick up a draggable item, press the space bar.
8
8
  While dragging, use the arrow keys to move the item.
9
9
  Press space again to drop the item in its new position, or press escape to cancel.
10
- `},ho={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 go(e){let{announcements:t=ho,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=fo}=e;const{announce:s,announcement:c}=co(),a=tt("DndLiveRegion"),[u,d]=f.useState(!1);if(f.useEffect(()=>{d(!0)},[]),lo(f.useMemo(()=>({onDragStart(h){let{active:x}=h;s(t.onDragStart({active:x}))},onDragMove(h){let{active:x,over:p}=h;t.onDragMove&&s(t.onDragMove({active:x,over:p}))},onDragOver(h){let{active:x,over:p}=h;s(t.onDragOver({active:x,over:p}))},onDragEnd(h){let{active:x,over:p}=h;s(t.onDragEnd({active:x,over:p}))},onDragCancel(h){let{active:x,over:p}=h;s(t.onDragCancel({active:x,over:p}))}}),[s,t])),!u)return null;const g=f.createElement(f.Fragment,null,f.createElement(io,{id:r,value:o.draggable}),f.createElement(ao,{id:a,announcement:c}));return n?Ue.createPortal(g,n):g}var Q;(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"})(Q||(Q={}));function yt(){}function po(e,t){return f.useMemo(()=>({sensor:e,options:{}}),[e,t])}function vo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return f.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const pe=Object.freeze({x:0,y:0});function mo(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function bo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function xo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function yo(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function wn(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 Zn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=wn(t,t.left,t.top),s=[];for(const c of r){const{id:a}=c,u=n.get(a);if(u){const d=mo(wn(u),o);s.push({id:a,data:{droppableContainer:c,value:d}})}}return s.sort(bo)};function So(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),c=o-r,a=s-n;if(r<o&&n<s){const u=t.width*t.height,d=e.width*e.height,g=c*a,h=g/(u+d-g);return Number(h.toFixed(4))}return 0}const wo=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const s of r){const{id:c}=s,a=n.get(c);if(a){const u=So(a,t);u>0&&o.push({id:c,data:{droppableContainer:s,value:u}})}}return o.sort(xo)};function Co(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Qn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:pe}function Do(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];return o.reduce((c,a)=>({...c,top:c.top+e*a.y,bottom:c.bottom+e*a.y,left:c.left+e*a.x,right:c.right+e*a.x}),{...n})}}const jo=Do(1);function Ro(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 Eo(e,t,n){const r=Ro(t);if(!r)return e;const{scaleX:o,scaleY:s,x:c,y:a}=r,u=e.left-c-(1-o)*parseFloat(n),d=e.top-a-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),g=o?e.width/o:e.width,h=s?e.height/s:e.height;return{width:g,height:h,top:d,right:u+g,bottom:d+h,left:u}}const To={ignoreTransform:!1};function Ne(e,t){t===void 0&&(t=To);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:g}=ae(e).getComputedStyle(e);d&&(n=Eo(n,d,g))}const{top:r,left:o,width:s,height:c,bottom:a,right:u}=n;return{top:r,left:o,width:s,height:c,bottom:a,right:u}}function Cn(e){return Ne(e,{ignoreTransform:!0})}function Mo(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Oo(e,t){return t===void 0&&(t=ae(e).getComputedStyle(e)),t.position==="fixed"}function _o(e,t){t===void 0&&(t=ae(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const s=t[o];return typeof s=="string"?n.test(s):!1})}function on(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(tn(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Qe(o)||Xn(o)||n.includes(o))return n;const s=ae(e).getComputedStyle(o);return o!==e&&_o(o,s)&&n.push(o),Oo(o,s)?n:r(o.parentNode)}return e?r(e):n}function er(e){const[t]=on(e,1);return t??null}function It(e){return!Dt||!e?null:Ae(e)?e:en(e)?tn(e)||e===Le(e).scrollingElement?window:Qe(e)?e:null:null}function tr(e){return Ae(e)?e.scrollX:e.scrollLeft}function nr(e){return Ae(e)?e.scrollY:e.scrollTop}function Ut(e){return{x:tr(e),y:nr(e)}}var ee;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ee||(ee={}));function rr(e){return!Dt||!e?!1:e===document.scrollingElement}function or(e){const t={x:0,y:0},n=rr(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,c=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:o,isLeft:s,isBottom:c,isRight:a,maxScroll:r,minScroll:t}}const ko={x:.2,y:.2};function $o(e,t,n,r,o){let{top:s,left:c,right:a,bottom:u}=n;r===void 0&&(r=10),o===void 0&&(o=ko);const{isTop:d,isBottom:g,isLeft:h,isRight:x}=or(e),p={x:0,y:0},b={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!d&&s<=t.top+v.height?(p.y=ee.Backward,b.y=r*Math.abs((t.top+v.height-s)/v.height)):!g&&u>=t.bottom-v.height&&(p.y=ee.Forward,b.y=r*Math.abs((t.bottom-v.height-u)/v.height)),!x&&a>=t.right-v.width?(p.x=ee.Forward,b.x=r*Math.abs((t.right-v.width-a)/v.width)):!h&&c<=t.left+v.width&&(p.x=ee.Backward,b.x=r*Math.abs((t.left+v.width-c)/v.width)),{direction:p,speed:b}}function Io(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:c}=window;return{top:0,left:0,right:s,bottom:c,width:s,height:c}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function sr(e){return e.reduce((t,n)=>$e(t,Ut(n)),pe)}function Ao(e){return e.reduce((t,n)=>t+tr(n),0)}function Lo(e){return e.reduce((t,n)=>t+nr(n),0)}function No(e,t){if(t===void 0&&(t=Ne),!e)return;const{top:n,left:r,bottom:o,right:s}=t(e);er(e)&&(o<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Po=[["x",["left","right"],Ao],["y",["top","bottom"],Lo]];class sn{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=on(n),o=sr(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,c,a]of Po)for(const u of c)Object.defineProperty(this,u,{get:()=>{const d=a(r),g=o[s]-d;return this.rect[u]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ge{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 o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function zo(e){const{EventTarget:t}=ae(e);return e instanceof t?e:Le(e)}function At(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 fe;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(fe||(fe={}));function Dn(e){e.preventDefault()}function Yo(e){e.stopPropagation()}var W;(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"})(W||(W={}));const ir={start:[W.Space,W.Enter],cancel:[W.Esc],end:[W.Space,W.Enter,W.Tab]},Fo=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case W.Right:return{...n,x:n.x+25};case W.Left:return{...n,x:n.x-25};case W.Down:return{...n,y:n.y+25};case W.Up:return{...n,y:n.y-25}}};class ar{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 Ge(Le(n)),this.windowListeners=new Ge(ae(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(fe.Resize,this.handleCancel),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(fe.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&No(r),n(pe)}handleKeyDown(t){if(rn(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=ir,coordinateGetter:c=Fo,scrollBehavior:a="smooth"}=o,{code:u}=t;if(s.end.includes(u)){this.handleEnd(t);return}if(s.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:d}=r.current,g=d?{x:d.left,y:d.top}:pe;this.referenceCoordinates||(this.referenceCoordinates=g);const h=c(t,{active:n,context:r.current,currentCoordinates:g});if(h){const x=xt(h,g),p={x:0,y:0},{scrollableAncestors:b}=r.current;for(const v of b){const y=t.code,{isTop:w,isRight:E,isLeft:T,isBottom:I,maxScroll:k,minScroll:M}=or(v),A=Io(v),L={x:Math.min(y===W.Right?A.right-A.width/2:A.right,Math.max(y===W.Right?A.left:A.left+A.width/2,h.x)),y:Math.min(y===W.Down?A.bottom-A.height/2:A.bottom,Math.max(y===W.Down?A.top:A.top+A.height/2,h.y))},V=y===W.Right&&!E||y===W.Left&&!T,F=y===W.Down&&!I||y===W.Up&&!w;if(V&&L.x!==h.x){const D=v.scrollLeft+x.x,U=y===W.Right&&D<=k.x||y===W.Left&&D>=M.x;if(U&&!x.y){v.scrollTo({left:D,behavior:a});return}U?p.x=v.scrollLeft-D:p.x=y===W.Right?v.scrollLeft-k.x:v.scrollLeft-M.x,p.x&&v.scrollBy({left:-p.x,behavior:a});break}else if(F&&L.y!==h.y){const D=v.scrollTop+x.y,U=y===W.Down&&D<=k.y||y===W.Up&&D>=M.y;if(U&&!x.x){v.scrollTo({top:D,behavior:a});return}U?p.y=v.scrollTop-D:p.y=y===W.Down?v.scrollTop-k.y:v.scrollTop-M.y,p.y&&v.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(t,$e(xt(h,this.referenceCoordinates),p))}}}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()}}ar.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=ir,onActivation:o}=t,{active:s}=n;const{code:c}=e.nativeEvent;if(r.start.includes(c)){const a=s.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function jn(e){return!!(e&&"distance"in e)}function Rn(e){return!!(e&&"delay"in e)}class an{constructor(t,n,r){var o;r===void 0&&(r=zo(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:s}=t,{target:c}=s;this.props=t,this.events=n,this.document=Le(c),this.documentListeners=new Ge(this.document),this.listeners=new Ge(r),this.windowListeners=new Ge(ae(c)),this.initialCoordinates=(o=Wt(s))!=null?o:pe,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(fe.Resize,this.handleCancel),this.windowListeners.add(fe.DragStart,Dn),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),this.windowListeners.add(fe.ContextMenu,Dn),this.documentListeners.add(fe.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Rn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(jn(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:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(fe.Click,Yo,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(fe.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:s}=this,{onMove:c,options:{activationConstraint:a}}=s;if(!o)return;const u=(n=Wt(t))!=null?n:pe,d=xt(o,u);if(!r&&a){if(jn(a)){if(a.tolerance!=null&&At(d,a.tolerance))return this.handleCancel();if(At(d,a.distance))return this.handleStart()}if(Rn(a)&&At(d,a.tolerance))return this.handleCancel();this.handlePending(a,d);return}t.cancelable&&t.preventDefault(),c(u)}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===W.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Bo={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class cn extends an{constructor(t){const{event:n}=t,r=Le(n.target);super(t,Bo,r)}}cn.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 Vo={move:{name:"mousemove"},end:{name:"mouseup"}};var Gt;(function(e){e[e.RightClick=2]="RightClick"})(Gt||(Gt={}));class Ho extends an{constructor(t){super(t,Vo,Le(t.event.target))}}Ho.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Gt.RightClick?!1:(r?.({event:n}),!0)}}];const Lt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Wo extends an{constructor(t){super(t,Lt)}static setup(){return window.addEventListener(Lt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Lt.move.name,t)};function t(){}}}Wo.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var qe;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(qe||(qe={}));var St;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(St||(St={}));function Uo(e){let{acceleration:t,activator:n=qe.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:c=5,order:a=St.TreeOrder,pointerCoordinates:u,scrollableAncestors:d,scrollableAncestorRects:g,delta:h,threshold:x}=e;const p=qo({delta:h,disabled:!s}),[b,v]=to(),y=f.useRef({x:0,y:0}),w=f.useRef({x:0,y:0}),E=f.useMemo(()=>{switch(n){case qe.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case qe.DraggableRect:return o}},[n,o,u]),T=f.useRef(null),I=f.useCallback(()=>{const M=T.current;if(!M)return;const A=y.current.x*w.current.x,L=y.current.y*w.current.y;M.scrollBy(A,L)},[]),k=f.useMemo(()=>a===St.TreeOrder?[...d].reverse():d,[a,d]);f.useEffect(()=>{if(!s||!d.length||!E){v();return}for(const M of k){if(r?.(M)===!1)continue;const A=d.indexOf(M),L=g[A];if(!L)continue;const{direction:V,speed:F}=$o(M,L,E,t,x);for(const D of["x","y"])p[D][V[D]]||(F[D]=0,V[D]=0);if(F.x>0||F.y>0){v(),T.current=M,b(I,c),y.current=F,w.current=V;return}}y.current={x:0,y:0},w.current={x:0,y:0},v()},[t,I,r,v,s,c,JSON.stringify(E),JSON.stringify(p),b,d,k,g,JSON.stringify(x)])}const Go={x:{[ee.Backward]:!1,[ee.Forward]:!1},y:{[ee.Backward]:!1,[ee.Forward]:!1}};function qo(e){let{delta:t,disabled:n}=e;const r=Ht(t);return et(o=>{if(n||!r||!o)return Go;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ee.Backward]:o.x[ee.Backward]||s.x===-1,[ee.Forward]:o.x[ee.Forward]||s.x===1},y:{[ee.Backward]:o.y[ee.Backward]||s.y===-1,[ee.Forward]:o.y[ee.Forward]||s.y===1}}},[n,t,r])}function Xo(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return et(o=>{var s;return t==null?null:(s=r??o)!=null?s:null},[r,t])}function Ko(e,t){return f.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,s=o.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,r)}));return[...n,...s]},[]),[e,t])}var Je;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Je||(Je={}));var qt;(function(e){e.Optimized="optimized"})(qt||(qt={}));const En=new Map;function Jo(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,c]=f.useState(null),{frequency:a,measure:u,strategy:d}=o,g=f.useRef(e),h=y(),x=Ke(h),p=f.useCallback(function(w){w===void 0&&(w=[]),!x.current&&c(E=>E===null?w:E.concat(w.filter(T=>!E.includes(T))))},[x]),b=f.useRef(null),v=et(w=>{if(h&&!n)return En;if(!w||w===En||g.current!==e||s!=null){const E=new Map;for(let T of e){if(!T)continue;if(s&&s.length>0&&!s.includes(T.id)&&T.rect.current){E.set(T.id,T.rect.current);continue}const I=T.node.current,k=I?new sn(u(I),I):null;T.rect.current=k,k&&E.set(T.id,k)}return E}return w},[e,s,n,h,u]);return f.useEffect(()=>{g.current=e},[e]),f.useEffect(()=>{h||p()},[n,h]),f.useEffect(()=>{s&&s.length>0&&c(null)},[JSON.stringify(s)]),f.useEffect(()=>{h||typeof a!="number"||b.current!==null||(b.current=setTimeout(()=>{p(),b.current=null},a))},[a,h,p,...r]),{droppableRects:v,measureDroppableContainers:p,measuringScheduled:s!=null};function y(){switch(d){case Je.Always:return!1;case Je.BeforeDragging:return n;default:return!n}}}function cr(e,t){return et(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Zo(e,t){return cr(e,t)}function Qo(e){let{callback:t,disabled:n}=e;const r=nn(t),o=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return f.useEffect(()=>()=>o?.disconnect(),[o]),o}function jt(e){let{callback:t,disabled:n}=e;const r=nn(t),o=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return f.useEffect(()=>()=>o?.disconnect(),[o]),o}function es(e){return new sn(Ne(e),e)}function Tn(e,t,n){t===void 0&&(t=es);const[r,o]=f.useState(null);function s(){o(u=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=u??n)!=null?d:null}const g=t(e);return JSON.stringify(u)===JSON.stringify(g)?u:g})}const c=Qo({callback(u){if(e)for(const d of u){const{type:g,target:h}=d;if(g==="childList"&&h instanceof HTMLElement&&h.contains(e)){s();break}}}}),a=jt({callback:s});return be(()=>{s(),e?(a?.observe(e),c?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),c?.disconnect())},[e]),r}function ts(e){const t=cr(e);return Qn(e,t)}const Mn=[];function ns(e){const t=f.useRef(e),n=et(r=>e?r&&r!==Mn&&e&&t.current&&e.parentNode===t.current.parentNode?r:on(e):Mn,[e]);return f.useEffect(()=>{t.current=e},[e]),n}function rs(e){const[t,n]=f.useState(null),r=f.useRef(e),o=f.useCallback(s=>{const c=It(s.target);c&&n(a=>a?(a.set(c,Ut(c)),new Map(a)):null)},[]);return f.useEffect(()=>{const s=r.current;if(e!==s){c(s);const a=e.map(u=>{const d=It(u);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,Ut(d)]):null}).filter(u=>u!=null);n(a.length?new Map(a):null),r.current=e}return()=>{c(e),c(s)};function c(a){a.forEach(u=>{const d=It(u);d?.removeEventListener("scroll",o)})}},[o,e]),f.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,c)=>$e(s,c),pe):sr(e):pe,[e,t])}function On(e,t){t===void 0&&(t=[]);const n=f.useRef(null);return f.useEffect(()=>{n.current=null},t),f.useEffect(()=>{const r=e!==pe;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?xt(e,n.current):pe}function os(e){f.useEffect(()=>{if(!Dt)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 ss(e,t){return f.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:s}=r;return n[o]=c=>{s(c,t)},n},{}),[e,t])}function lr(e){return f.useMemo(()=>e?Mo(e):null,[e])}const _n=[];function is(e,t){t===void 0&&(t=Ne);const[n]=e,r=lr(n?ae(n):null),[o,s]=f.useState(_n);function c(){s(()=>e.length?e.map(u=>rr(u)?r:new sn(t(u),u)):_n)}const a=jt({callback:c});return be(()=>{a?.disconnect(),c(),e.forEach(u=>a?.observe(u))},[e]),o}function as(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Qe(t)?t:e}function cs(e){let{measure:t}=e;const[n,r]=f.useState(null),o=f.useCallback(d=>{for(const{target:g}of d)if(Qe(g)){r(h=>{const x=t(g);return h?{...h,width:x.width,height:x.height}:x});break}},[t]),s=jt({callback:o}),c=f.useCallback(d=>{const g=as(d);s?.disconnect(),g&&s?.observe(g),r(g?t(g):null)},[t,s]),[a,u]=bt(c);return f.useMemo(()=>({nodeRef:a,rect:n,setRef:u}),[n,a,u])}const ls=[{sensor:cn,options:{}},{sensor:ar,options:{}}],us={current:{}},ht={draggable:{measure:Cn},droppable:{measure:Cn,strategy:Je.WhileDragging,frequency:qt.Optimized},dragOverlay:{measure:Ne}};class Xe 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 ds={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Xe,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:yt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ht,measureDroppableContainers:yt,windowRect:null,measuringScheduled:!1},fs={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:yt,draggableNodes:new Map,over:null,measureDroppableContainers:yt},Rt=f.createContext(fs),ur=f.createContext(ds);function hs(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Xe}}}function gs(e,t){switch(t.type){case Q.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Q.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 Q.DragEnd:case Q.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Q.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Xe(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case Q.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const c=new Xe(e.droppable.containers);return c.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:c}}}case Q.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Xe(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function ps(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=f.useContext(Rt),s=Ht(r),c=Ht(n?.id);return f.useEffect(()=>{if(!t&&!r&&s&&c!=null){if(!rn(s)||document.activeElement===s.target)return;const a=o.get(c);if(!a)return;const{activatorNode:u,node:d}=a;if(!u.current&&!d.current)return;requestAnimationFrame(()=>{for(const g of[u.current,d.current]){if(!g)continue;const h=oo(g);if(h){h.focus();break}}})}},[r,t,o,c,s]),null}function vs(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,s)=>s({transform:o,...r}),n):n}function ms(e){return f.useMemo(()=>({draggable:{...ht.draggable,...e?.draggable},droppable:{...ht.droppable,...e?.droppable},dragOverlay:{...ht.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function bs(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const s=f.useRef(!1),{x:c,y:a}=typeof o=="boolean"?{x:o,y:o}:o;be(()=>{if(!c&&!a||!t){s.current=!1;return}if(s.current||!r)return;const d=t?.node.current;if(!d||d.isConnected===!1)return;const g=n(d),h=Qn(g,r);if(c||(h.x=0),a||(h.y=0),s.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const x=er(d);x&&x.scrollBy({top:h.y,left:h.x})}},[t,c,a,r,n])}const dr=f.createContext({...pe,scaleX:1,scaleY:1});var Re;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Re||(Re={}));const fr=f.memo(function(t){var n,r,o,s;let{id:c,accessibility:a,autoScroll:u=!0,children:d,sensors:g=ls,collisionDetection:h=wo,measuring:x,modifiers:p,...b}=t;const v=f.useReducer(gs,void 0,hs),[y,w]=v,[E,T]=uo(),[I,k]=f.useState(Re.Uninitialized),M=I===Re.Initialized,{draggable:{active:A,nodes:L,translate:V},droppable:{containers:F}}=y,D=A!=null?L.get(A):null,U=f.useRef({initial:null,translated:null}),G=f.useMemo(()=>{var re;return A!=null?{id:A,data:(re=D?.data)!=null?re:us,rect:U}:null},[A,D]),$=f.useRef(null),[j,C]=f.useState(null),[O,_]=f.useState(null),N=Ke(b,Object.values(b)),z=tt("DndDescribedBy",c),m=f.useMemo(()=>F.getEnabled(),[F]),R=ms(x),{droppableRects:P,measureDroppableContainers:B,measuringScheduled:q}=Jo(m,{dragging:M,dependencies:[V.x,V.y],config:R.droppable}),X=Xo(L,A),H=f.useMemo(()=>O?Wt(O):null,[O]),K=Kr(),J=Zo(X,R.draggable.measure);bs({activeNode:A!=null?L.get(A):null,config:K.layoutShiftCompensation,initialRect:J,measure:R.draggable.measure});const Y=Tn(X,R.draggable.measure,J),se=Tn(X?X.parentElement:null),ne=f.useRef({activatorEvent:null,active:null,activeNode:X,collisionRect:null,collisions:null,droppableRects:P,draggableNodes:L,draggingNode:null,draggingNodeRect:null,droppableContainers:F,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),he=F.getNodeFor((n=ne.current.over)==null?void 0:n.id),xe=cs({measure:R.dragOverlay.measure}),Te=(r=xe.nodeRef.current)!=null?r:X,Me=M?(o=xe.rect)!=null?o:Y:null,un=!!(xe.nodeRef.current&&xe.rect),dn=ts(un?null:Y),Ot=lr(Te?ae(Te):null),Se=ns(M?he??X:null),ot=is(Se),st=vs(p,{transform:{x:V.x-dn.x,y:V.y-dn.y,scaleX:1,scaleY:1},activatorEvent:O,active:G,activeNodeRect:Y,containerNodeRect:se,draggingNodeRect:Me,over:ne.current.over,overlayNodeRect:xe.rect,scrollableAncestors:Se,scrollableAncestorRects:ot,windowRect:Ot}),fn=H?$e(H,V):null,hn=rs(Se),Vr=On(hn),Hr=On(hn,[Y]),Oe=$e(st,Vr),_e=Me?jo(Me,st):null,Pe=G&&_e?h({active:G,collisionRect:_e,droppableRects:P,droppableContainers:m,pointerCoordinates:fn}):null,gn=yo(Pe,"id"),[we,pn]=f.useState(null),Wr=un?st:$e(st,Hr),Ur=Co(Wr,(s=we?.rect)!=null?s:null,Y),_t=f.useRef(null),vn=f.useCallback((re,ce)=>{let{sensor:le,options:Ce}=ce;if($.current==null)return;const de=L.get($.current);if(!de)return;const ue=re.nativeEvent,ve=new le({active:$.current,activeNode:de,event:ue,options:Ce,context:ne,onAbort(te){if(!L.get(te))return;const{onDragAbort:me}=N.current,ye={id:te};me?.(ye),E({type:"onDragAbort",event:ye})},onPending(te,De,me,ye){if(!L.get(te))return;const{onDragPending:Ye}=N.current,je={id:te,constraint:De,initialCoordinates:me,offset:ye};Ye?.(je),E({type:"onDragPending",event:je})},onStart(te){const De=$.current;if(De==null)return;const me=L.get(De);if(!me)return;const{onDragStart:ye}=N.current,ze={activatorEvent:ue,active:{id:De,data:me.data,rect:U}};Ue.unstable_batchedUpdates(()=>{ye?.(ze),k(Re.Initializing),w({type:Q.DragStart,initialCoordinates:te,active:De}),E({type:"onDragStart",event:ze}),C(_t.current),_(ue)})},onMove(te){w({type:Q.DragMove,coordinates:te})},onEnd:ke(Q.DragEnd),onCancel:ke(Q.DragCancel)});_t.current=ve;function ke(te){return async function(){const{active:me,collisions:ye,over:ze,scrollAdjustedTranslate:Ye}=ne.current;let je=null;if(me&&Ye){const{cancelDrop:Fe}=N.current;je={activatorEvent:ue,active:me,collisions:ye,delta:Ye,over:ze},te===Q.DragEnd&&typeof Fe=="function"&&await Promise.resolve(Fe(je))&&(te=Q.DragCancel)}$.current=null,Ue.unstable_batchedUpdates(()=>{w({type:te}),k(Re.Uninitialized),pn(null),C(null),_(null),_t.current=null;const Fe=te===Q.DragEnd?"onDragEnd":"onDragCancel";if(je){const kt=N.current[Fe];kt?.(je),E({type:Fe,event:je})}})}}},[L]),Gr=f.useCallback((re,ce)=>(le,Ce)=>{const de=le.nativeEvent,ue=L.get(Ce);if($.current!==null||!ue||de.dndKit||de.defaultPrevented)return;const ve={active:ue};re(le,ce.options,ve)===!0&&(de.dndKit={capturedBy:ce.sensor},$.current=Ce,vn(le,ce))},[L,vn]),mn=Ko(g,Gr);os(g),be(()=>{Y&&I===Re.Initializing&&k(Re.Initialized)},[Y,I]),f.useEffect(()=>{const{onDragMove:re}=N.current,{active:ce,activatorEvent:le,collisions:Ce,over:de}=ne.current;if(!ce||!le)return;const ue={active:ce,activatorEvent:le,collisions:Ce,delta:{x:Oe.x,y:Oe.y},over:de};Ue.unstable_batchedUpdates(()=>{re?.(ue),E({type:"onDragMove",event:ue})})},[Oe.x,Oe.y]),f.useEffect(()=>{const{active:re,activatorEvent:ce,collisions:le,droppableContainers:Ce,scrollAdjustedTranslate:de}=ne.current;if(!re||$.current==null||!ce||!de)return;const{onDragOver:ue}=N.current,ve=Ce.get(gn),ke=ve&&ve.rect.current?{id:ve.id,rect:ve.rect.current,data:ve.data,disabled:ve.disabled}:null,te={active:re,activatorEvent:ce,collisions:le,delta:{x:de.x,y:de.y},over:ke};Ue.unstable_batchedUpdates(()=>{pn(ke),ue?.(te),E({type:"onDragOver",event:te})})},[gn]),be(()=>{ne.current={activatorEvent:O,active:G,activeNode:X,collisionRect:_e,collisions:Pe,droppableRects:P,draggableNodes:L,draggingNode:Te,draggingNodeRect:Me,droppableContainers:F,over:we,scrollableAncestors:Se,scrollAdjustedTranslate:Oe},U.current={initial:Me,translated:_e}},[G,X,Pe,_e,L,Te,Me,P,F,we,Se,Oe]),Uo({...K,delta:V,draggingRect:_e,pointerCoordinates:fn,scrollableAncestors:Se,scrollableAncestorRects:ot});const qr=f.useMemo(()=>({active:G,activeNode:X,activeNodeRect:Y,activatorEvent:O,collisions:Pe,containerNodeRect:se,dragOverlay:xe,draggableNodes:L,droppableContainers:F,droppableRects:P,over:we,measureDroppableContainers:B,scrollableAncestors:Se,scrollableAncestorRects:ot,measuringConfiguration:R,measuringScheduled:q,windowRect:Ot}),[G,X,Y,O,Pe,se,xe,L,F,P,we,B,Se,ot,R,q,Ot]),Xr=f.useMemo(()=>({activatorEvent:O,activators:mn,active:G,activeNodeRect:Y,ariaDescribedById:{draggable:z},dispatch:w,draggableNodes:L,over:we,measureDroppableContainers:B}),[O,mn,G,Y,w,z,L,we,B]);return f.createElement(Jn.Provider,{value:T},f.createElement(Rt.Provider,{value:Xr},f.createElement(ur.Provider,{value:qr},f.createElement(dr.Provider,{value:Ur},d)),f.createElement(ps,{disabled:a?.restoreFocus===!1})),f.createElement(go,{...a,hiddenTextDescribedById:z}));function Kr(){const re=j?.autoScrollEnabled===!1,ce=typeof u=="object"?u.enabled===!1:u===!1,le=M&&!re&&!ce;return typeof u=="object"?{...u,enabled:le}:{enabled:le}}}),xs=f.createContext(null),kn="button",ys="Draggable";function Ss(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=tt(ys),{activators:c,activatorEvent:a,active:u,activeNodeRect:d,ariaDescribedById:g,draggableNodes:h,over:x}=f.useContext(Rt),{role:p=kn,roleDescription:b="draggable",tabIndex:v=0}=o??{},y=u?.id===t,w=f.useContext(y?dr:xs),[E,T]=bt(),[I,k]=bt(),M=ss(c,t),A=Ke(n);be(()=>(h.set(t,{id:t,key:s,node:E,activatorNode:I,data:A}),()=>{const V=h.get(t);V&&V.key===s&&h.delete(t)}),[h,t]);const L=f.useMemo(()=>({role:p,tabIndex:v,"aria-disabled":r,"aria-pressed":y&&p===kn?!0:void 0,"aria-roledescription":b,"aria-describedby":g.draggable}),[r,p,v,y,b,g.draggable]);return{active:u,activatorEvent:a,activeNodeRect:d,attributes:L,isDragging:y,listeners:r?void 0:M,node:E,over:x,setNodeRef:T,setActivatorNodeRef:k,transform:w}}function ws(){return f.useContext(ur)}const Cs="Droppable",Ds={timeout:25};function js(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=tt(Cs),{active:c,dispatch:a,over:u,measureDroppableContainers:d}=f.useContext(Rt),g=f.useRef({disabled:n}),h=f.useRef(!1),x=f.useRef(null),p=f.useRef(null),{disabled:b,updateMeasurementsFor:v,timeout:y}={...Ds,...o},w=Ke(v??r),E=f.useCallback(()=>{if(!h.current){h.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{d(Array.isArray(w.current)?w.current:[w.current]),p.current=null},y)},[y]),T=jt({callback:E,disabled:b||!c}),I=f.useCallback((L,V)=>{T&&(V&&(T.unobserve(V),h.current=!1),L&&T.observe(L))},[T]),[k,M]=bt(I),A=Ke(t);return f.useEffect(()=>{!T||!k.current||(T.disconnect(),h.current=!1,T.observe(k.current))},[k,T]),f.useEffect(()=>(a({type:Q.RegisterDroppable,element:{id:r,key:s,disabled:n,node:k,rect:x,data:A}}),()=>a({type:Q.UnregisterDroppable,key:s,id:r})),[r]),f.useEffect(()=>{n!==g.current.disabled&&(a({type:Q.SetDroppableDisabled,id:r,key:s,disabled:n}),g.current.disabled=n)},[r,s,n,a]),{active:c,rect:x,isOver:u?.id===r,node:k,over:u,setNodeRef:M}}function Et(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Rs(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function at(e){return e!==null&&e>=0}function Es(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 Ts(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const ct={scaleX:1,scaleY:1},Ms=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:s,index:c}=e;const a=(t=n[o])!=null?t:r;if(!a)return null;const u=Os(n,c,o);if(c===o){const d=n[s];return d?{x:o<s?d.left+d.width-(a.left+a.width):d.left-a.left,y:0,...ct}:null}return c>o&&c<=s?{x:-a.width-u,y:0,...ct}:c<o&&c>=s?{x:a.width+u,y:0,...ct}:{x:0,y:0,...ct}};function Os(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return!r||!o&&!s?0:n<t?o?r.left-(o.left+o.width):s.left-(r.left+r.width):s?s.left-(r.left+r.width):r.left-(o.left+o.width)}const hr=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const s=Et(t,r,n),c=t[o],a=s[o];return!a||!c?null:{x:a.left-c.left,y:a.top-c.top,scaleX:a.width/c.width,scaleY:a.height/c.height}},lt={scaleX:1,scaleY:1},_s=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:s,overIndex:c}=e;const a=(t=s[n])!=null?t:r;if(!a)return null;if(o===n){const d=s[c];return d?{x:0,y:n<c?d.top+d.height-(a.top+a.height):d.top-a.top,...lt}:null}const u=ks(s,o,n);return o>n&&o<=c?{x:0,y:-a.height-u,...lt}:o<n&&o>=c?{x:0,y:a.height+u,...lt}:{x:0,y:0,...lt}};function ks(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return r?n<t?o?r.top-(o.top+o.height):s?s.top-(r.top+r.height):0:s?s.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const gr="Sortable",pr=f.createContext({activeIndex:-1,containerId:gr,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:hr,disabled:{draggable:!1,droppable:!1}});function vr(e){let{children:t,id:n,items:r,strategy:o=hr,disabled:s=!1}=e;const{active:c,dragOverlay:a,droppableRects:u,over:d,measureDroppableContainers:g}=ws(),h=tt(gr,n),x=a.rect!==null,p=f.useMemo(()=>r.map(M=>typeof M=="object"&&"id"in M?M.id:M),[r]),b=c!=null,v=c?p.indexOf(c.id):-1,y=d?p.indexOf(d.id):-1,w=f.useRef(p),E=!Es(p,w.current),T=y!==-1&&v===-1||E,I=Ts(s);be(()=>{E&&b&&g(p)},[E,p,b,g]),f.useEffect(()=>{w.current=p},[p]);const k=f.useMemo(()=>({activeIndex:v,containerId:h,disabled:I,disableTransforms:T,items:p,overIndex:y,useDragOverlay:x,sortedRects:Rs(p,u),strategy:o}),[v,h,I.draggable,I.droppable,T,p,y,u,x,o]);return f.createElement(pr.Provider,{value:k},t)}const $s=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Et(n,r,o).indexOf(t)},Is=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:s,newIndex:c,previousItems:a,previousContainerId:u,transition:d}=e;return!d||!r||a!==s&&o===c?!1:n?!0:c!==o&&t===u},As={duration:200,easing:"ease"},mr="transform",Ls=Ie.Transition.toString({property:mr,duration:0,easing:"linear"}),Ns={roleDescription:"sortable"};function Ps(e){let{disabled:t,index:n,node:r,rect:o}=e;const[s,c]=f.useState(null),a=f.useRef(n);return be(()=>{if(!t&&n!==a.current&&r.current){const u=o.current;if(u){const d=Ne(r.current,{ignoreTransform:!0}),g={x:u.left-d.left,y:u.top-d.top,scaleX:u.width/d.width,scaleY:u.height/d.height};(g.x||g.y)&&c(g)}}n!==a.current&&(a.current=n)},[t,n,r,o]),f.useEffect(()=>{s&&c(null)},[s]),s}function br(e){let{animateLayoutChanges:t=Is,attributes:n,disabled:r,data:o,getNewIndex:s=$s,id:c,strategy:a,resizeObserverConfig:u,transition:d=As}=e;const{items:g,containerId:h,activeIndex:x,disabled:p,disableTransforms:b,sortedRects:v,overIndex:y,useDragOverlay:w,strategy:E}=f.useContext(pr),T=zs(r,p),I=g.indexOf(c),k=f.useMemo(()=>({sortable:{containerId:h,index:I,items:g},...o}),[h,o,I,g]),M=f.useMemo(()=>g.slice(g.indexOf(c)),[g,c]),{rect:A,node:L,isOver:V,setNodeRef:F}=js({id:c,data:k,disabled:T.droppable,resizeObserverConfig:{updateMeasurementsFor:M,...u}}),{active:D,activatorEvent:U,activeNodeRect:G,attributes:$,setNodeRef:j,listeners:C,isDragging:O,over:_,setActivatorNodeRef:N,transform:z}=Ss({id:c,data:k,attributes:{...Ns,...n},disabled:T.draggable}),m=eo(F,j),R=!!D,P=R&&!b&&at(x)&&at(y),B=!w&&O,q=B&&P?z:null,H=P?q??(a??E)({rects:v,activeNodeRect:G,activeIndex:x,overIndex:y,index:I}):null,K=at(x)&&at(y)?s({id:c,items:g,activeIndex:x,overIndex:y}):I,J=D?.id,Y=f.useRef({activeId:J,items:g,newIndex:K,containerId:h}),se=g!==Y.current.items,ne=t({active:D,containerId:h,isDragging:O,isSorting:R,id:c,index:I,items:g,newIndex:Y.current.newIndex,previousItems:Y.current.items,previousContainerId:Y.current.containerId,transition:d,wasDragging:Y.current.activeId!=null}),he=Ps({disabled:!ne,index:I,node:L,rect:A});return f.useEffect(()=>{R&&Y.current.newIndex!==K&&(Y.current.newIndex=K),h!==Y.current.containerId&&(Y.current.containerId=h),g!==Y.current.items&&(Y.current.items=g)},[R,K,h,g]),f.useEffect(()=>{if(J===Y.current.activeId)return;if(J!=null&&Y.current.activeId==null){Y.current.activeId=J;return}const Te=setTimeout(()=>{Y.current.activeId=J},50);return()=>clearTimeout(Te)},[J]),{active:D,activeIndex:x,attributes:$,data:k,rect:A,index:I,newIndex:K,items:g,isOver:V,isSorting:R,isDragging:O,listeners:C,node:L,overIndex:y,over:_,setNodeRef:m,setActivatorNodeRef:N,setDroppableNodeRef:F,setDraggableNodeRef:j,transform:he??H,transition:xe()};function xe(){if(he||se&&Y.current.newIndex===I)return Ls;if(!(B&&!rn(U)||!d)&&(R||ne))return Ie.Transition.toString({...d,property:mr})}}function zs(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}}W.Down,W.Right,W.Up,W.Left;var ut={exports:{}},Nt={},dt={exports:{}},Pt={};var $n;function Ys(){if($n)return Pt;$n=1;var e=f;function t(h,x){return h===x&&(h!==0||1/h===1/x)||h!==h&&x!==x}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,c=e.useDebugValue;function a(h,x){var p=x(),b=r({inst:{value:p,getSnapshot:x}}),v=b[0].inst,y=b[1];return s(function(){v.value=p,v.getSnapshot=x,u(v)&&y({inst:v})},[h,p,x]),o(function(){return u(v)&&y({inst:v}),h(function(){u(v)&&y({inst:v})})},[h]),c(p),p}function u(h){var x=h.getSnapshot;h=h.value;try{var p=x();return!n(h,p)}catch{return!0}}function d(h,x){return x()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:a;return Pt.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,Pt}var zt={};var In;function Fs(){return In||(In=1,process.env.NODE_ENV!=="production"&&(function(){function e(p,b){return p===b&&(p!==0||1/p===1/b)||p!==p&&b!==b}function t(p,b){g||o.startTransition===void 0||(g=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var v=b();if(!h){var y=b();s(v,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),h=!0)}y=c({inst:{value:v,getSnapshot:b}});var w=y[0].inst,E=y[1];return u(function(){w.value=v,w.getSnapshot=b,n(w)&&E({inst:w})},[p,v,b]),a(function(){return n(w)&&E({inst:w}),p(function(){n(w)&&E({inst:w})})},[p]),d(v),v}function n(p){var b=p.getSnapshot;p=p.value;try{var v=b();return!s(p,v)}catch{return!0}}function r(p,b){return b()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=f,s=typeof Object.is=="function"?Object.is:e,c=o.useState,a=o.useEffect,u=o.useLayoutEffect,d=o.useDebugValue,g=!1,h=!1,x=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;zt.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:x,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),zt}var An;function xr(){return An||(An=1,process.env.NODE_ENV==="production"?dt.exports=Ys():dt.exports=Fs()),dt.exports}var Ln;function Bs(){if(Ln)return Nt;Ln=1;var e=f,t=xr();function n(d,g){return d===g&&(d!==0||1/d===1/g)||d!==d&&g!==g}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,c=e.useEffect,a=e.useMemo,u=e.useDebugValue;return Nt.useSyncExternalStoreWithSelector=function(d,g,h,x,p){var b=s(null);if(b.current===null){var v={hasValue:!1,value:null};b.current=v}else v=b.current;b=a(function(){function w(M){if(!E){if(E=!0,T=M,M=x(M),p!==void 0&&v.hasValue){var A=v.value;if(p(A,M))return I=A}return I=M}if(A=I,r(T,M))return A;var L=x(M);return p!==void 0&&p(A,L)?(T=M,A):(T=M,I=L)}var E=!1,T,I,k=h===void 0?null:h;return[function(){return w(g())},k===null?void 0:function(){return w(k())}]},[g,h,x,p]);var y=o(d,b[0],b[1]);return c(function(){v.hasValue=!0,v.value=y},[y]),u(y),y},Nt}var Yt={};var Nn;function Vs(){return Nn||(Nn=1,process.env.NODE_ENV!=="production"&&(function(){function e(d,g){return d===g&&(d!==0||1/d===1/g)||d!==d&&g!==g}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=f,n=xr(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,c=t.useEffect,a=t.useMemo,u=t.useDebugValue;Yt.useSyncExternalStoreWithSelector=function(d,g,h,x,p){var b=s(null);if(b.current===null){var v={hasValue:!1,value:null};b.current=v}else v=b.current;b=a(function(){function w(M){if(!E){if(E=!0,T=M,M=x(M),p!==void 0&&v.hasValue){var A=v.value;if(p(A,M))return I=A}return I=M}if(A=I,r(T,M))return A;var L=x(M);return p!==void 0&&p(A,L)?(T=M,A):(T=M,I=L)}var E=!1,T,I,k=h===void 0?null:h;return[function(){return w(g())},k===null?void 0:function(){return w(k())}]},[g,h,x,p]);var y=o(d,b[0],b[1]);return c(function(){v.hasValue=!0,v.value=y},[y]),u(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Yt}var Pn;function Hs(){return Pn||(Pn=1,process.env.NODE_ENV==="production"?ut.exports=Bs():ut.exports=Vs()),ut.exports}var Ws=Hs();const Xt=new WeakMap,Us=new WeakMap,wt={current:[]};let Ft=!1;const ft=new Set,zn=new Map;function yr(e){for(const t of e){if(wt.current.includes(t))continue;wt.current.push(t),t.recompute();const n=Us.get(t);if(n)for(const r of n){const o=Xt.get(r);o?.length&&yr(o)}}}function Gs(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function qs(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Xs(e){if(ft.add(e),!Ft)try{for(Ft=!0;ft.size>0;){const t=Array.from(ft);ft.clear();for(const n of t){const r=zn.get(n)??n.prevState;n.prevState=r,Gs(n)}for(const n of t){const r=Xt.get(n);r&&(wt.current.push(n),yr(r))}for(const n of t){const r=Xt.get(n);if(r)for(const o of r)qs(o)}}}finally{Ft=!1,wt.current=[],zn.clear()}}function Ks(e){return typeof e=="function"}class Sr{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var o,s;this.listeners.add(r);const c=(s=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:s.call(o,r,this);return()=>{this.listeners.delete(r),c?.()}},this.prevState=t,this.state=t,this.options=n}setState(t){var n,r,o;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(t):Ks(t)?this.state=t(this.prevState):this.state=t,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),Xs(this)}}function nt(e,t=r=>r,n={}){const r=n.equal??Js;return Ws.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,r)}function Js(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=Yn(e);if(n.length!==Yn(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function Yn(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}const ie=new Sr({tableId:"",sortColumn:null,sortDirection:"asc",visibility:{},columnOrder:[],data:[],sortableColumns:[],actionsConfig:{showActionColumn:!0,showColumnVisibilityMenu:!0,children:"Actions",width:"100px"}});function wr(e,t){const n=e[0]??{},o=(t&&t.length?t:Object.keys(n).map(g=>({id:g,label:g}))).filter(g=>Object.prototype.hasOwnProperty.call(n,g.id)),{tableId:s}=ie.state,c=JSON.parse(localStorage.getItem(jr(s))||"[]"),a=[...c.map(g=>o.find(h=>h.id===g)).filter(Boolean),...o.filter(g=>!c.includes(g.id))],u=JSON.parse(localStorage.getItem(Rr(s))||"{}"),d=a.reduce((g,h)=>(g[h.id]=u[h.id]??!0,g),{});ie.setState(g=>({...g,data:e,columnOrder:a,visibility:d,sortableColumns:a.map(h=>({id:h.id,label:h.label,sortable:!0,backgroundColor:h.backgroundColor}))}))}function Cr(e){ie.setState(t=>({...t,tableId:e,sortColumn:null,sortDirection:"asc",columnOrder:[],visibility:{}}))}const Dr=e=>{ie.setState(t=>({...t,actionsConfig:e}))},jr=e=>`table_column_order_v1:${e}`,Rr=e=>`table_column_visibility_v1:${e}`,Zs=e=>{const{tableId:t}=ie.state;localStorage.setItem(jr(t),JSON.stringify(e.map(n=>n.id))),ie.setState(n=>({...n,columnOrder:e})),ie.setState(n=>({...n,columnOrder:e}))};function Qs(e){ie.setState(t=>t.sortColumn===e?{...t,sortDirection:t.sortDirection==="asc"?"desc":"asc"}:{...t,sortColumn:e,sortDirection:"asc"})}const ei=e=>{ie.setState(t=>{const n={...t.visibility,[e]:!t.visibility[e]};return t.tableId&&localStorage.setItem(Rr(t.tableId),JSON.stringify(n)),{...t,visibility:n}})};const ti=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ni=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Fn=e=>{const t=ni(e);return t.charAt(0).toUpperCase()+t.slice(1)},Er=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),ri=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var oi={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const si=f.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:c,...a},u)=>f.createElement("svg",{ref:u,...oi,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Er("lucide",o),...!s&&!ri(a)&&{"aria-hidden":"true"},...a},[...c.map(([d,g])=>f.createElement(d,g)),...Array.isArray(s)?s:[s]]));const oe=(e,t)=>{const n=f.forwardRef(({className:r,...o},s)=>f.createElement(si,{ref:s,iconNode:t,className:Er(`lucide-${ti(Fn(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Fn(e),n};const ii=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ai=oe("arrow-down",ii);const ci=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],li=oe("arrow-up-down",ci);const ui=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],di=oe("arrow-up",ui);const fi=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],hi=oe("bookmark",fi);const gi=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Bn=oe("calendar",gi);const pi=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],vi=oe("chevron-left",pi);const mi=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],bi=oe("chevron-right",mi);const xi=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],yi=oe("columns-2",xi);const Si=[["path",{d:"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z",key:"1yo7s0"}],["path",{d:"m12 9 6 6",key:"anjzzh"}],["path",{d:"m18 9-6 6",key:"1fp51s"}]],wi=oe("delete",Si);const Ci=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Di=oe("ellipsis",Ci);const ji=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Ri=oe("funnel",ji);const Ei=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Tr=oe("grip-vertical",Ei);const Ti=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],Mi=oe("pen",Ti);const Oi=[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]],_i=oe("refresh-ccw",Oi);const ki=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],$i=oe("settings",ki);const Ii=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Mr=oe("triangle-alert",Ii);function S(e){return f.forwardRef((t,n)=>{const{children:r,...o}=t;return i.jsx(e,{ref:n,...o,children:r})})}const Ai=S(l.Menu.Trigger),Li=S(l.Menu.Positioner),Ni=S(l.Menu.Content),Pi=S(l.Menu.Item),zi=S(l.Checkbox.Label),Yi=S(l.Checkbox.HiddenInput),Fi=S(l.Checkbox.Control);function Bi({visibility:e,onToggle:t}){const{sortableColumns:n}=nt(ie);return i.jsxs(l.Menu.Root,{closeOnSelect:!1,children:[i.jsx(Ai,{asChild:!0,children:i.jsx(l.IconButton,{"aria-label":"Toggle columns",variant:"ghost",ml:"1",size:"xs",children:i.jsx(yi,{size:18})})}),i.jsx(l.Portal,{children:i.jsx(Li,{children:i.jsx(Ni,{minW:"220px",children:n.map(r=>{const o=!!e[r.id];return i.jsx(Pi,{value:r.id,closeOnSelect:!1,children:i.jsxs(l.Checkbox.Root,{checked:o,onCheckedChange:()=>t(r.id),children:[i.jsx(Yi,{}),i.jsx(Fi,{}),i.jsx(zi,{children:r.label})]})},r.id)})})})})]})}function Vi({id:e,children:t,onClick:n,cursor:r,borderRight:o,borderRightColor:s,backgroundColor:c}){const{setNodeRef:a,attributes:u,listeners:d,transform:g,transition:h}=br({id:e});return i.jsx(l.Table.ColumnHeader,{ref:a,onClick:n,backgroundColor:c,w:e==="id"||e==="row_number"?"80px":void 0,style:{transform:Ie.Transform.toString(g),transition:h,cursor:r,borderRight:o,borderRightColor:s},...u,children:i.jsxs(l.HStack,{justify:"space-between",children:[t,i.jsx("span",{...d,children:i.jsx(Tr,{size:12})})]})})}function Hi(){const{columnOrder:e,visibility:t,sortColumn:n,sortDirection:r,sortableColumns:o,actionsConfig:s}=nt(ie),c=e.map(a=>o.find(u=>u.id===a.id)).filter(a=>a!==void 0).filter(a=>t[a.id]);return i.jsx(l.Table.Header,{background:"blue.200",position:"sticky",top:0,p:"0",zIndex:1,children:i.jsxs(l.Table.Row,{height:"28px",children:[c.map(a=>{const u=n===a?.id;return i.jsx(Vi,{id:a?.id,onClick:()=>a?.sortable&&Qs(a?.id),cursor:a?.sortable?"pointer":"default",borderRight:"2px solid #dcdcdc",backgroundColor:a?.backgroundColor,children:i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,userSelect:"none"},children:[a?.label,a?.sortable&&(u?r==="asc"?i.jsx(di,{size:14}):i.jsx(ai,{size:14}):i.jsx(li,{size:14,opacity:.4}))]})},a?.id)}),s?.showActionColumn&&i.jsx(l.Table.ColumnHeader,{width:s.width,backgroundColor:s.backgroundColor,borderRight:"2px solid #dcdcdc",children:s.children}),s?.showColumnVisibilityMenu&&i.jsx(l.Table.ColumnHeader,{boxSize:"0.5",backgroundColor:s.backgroundColorColumnVisibilityMenu,children:i.jsx(Bi,{visibility:t,onToggle:ei})})]})})}const Wi=[10,20,50,100],Ui=S(l.Select.Positioner),Gi=S(l.Select.Content),qi=S(l.Select.Item),Xi=S(l.Pagination.PrevTrigger),Ki=S(l.Pagination.NextTrigger),Ji=S(l.Select.HiddenSelect),Zi=S(l.Select.Control),Qi=S(l.Select.Trigger),ea=S(l.Select.ValueText),ta=S(l.Select.IndicatorGroup),na=S(l.Select.Indicator);function ra({totalCount:e,pageSize:t,currentPage:n,onPageChange:r,onPageSizeChange:o,siblingCount:s=2,pageSizeOptions:c=Wi}){const a=l.createListCollection({items:c.map(u=>({label:String(u),value:String(u)}))});return i.jsx(l.Box,{width:"100%",children:i.jsxs(l.HStack,{justify:"space-between",mx:"auto",flexWrap:"wrap",children:[i.jsxs(l.HStack,{children:[i.jsx(l.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:"Rows per page:"}),i.jsxs(l.Select.Root,{collection:a,size:"sm",width:"60px",onValueChange:u=>o?.(Number(u.items[0].value)),value:[String(t)],children:[i.jsx(Ji,{}),i.jsxs(Zi,{children:[i.jsx(Qi,{children:i.jsx(ea,{placeholder:""})}),i.jsx(ta,{children:i.jsx(na,{})})]}),i.jsx(l.Portal,{children:i.jsx(Ui,{children:i.jsx(Gi,{children:a.items.map(u=>i.jsxs(qi,{item:u.value,children:[u.label,i.jsx(l.Select.ItemIndicator,{})]},u.value))})})})]})]}),i.jsx(l.Pagination.Root,{count:e,pageSize:t,page:n,siblingCount:s,onPageChange:u=>r&&r(u.page),children:i.jsxs(l.ButtonGroup,{size:"sm",variant:"ghost",children:[i.jsx(Xi,{asChild:!0,children:i.jsx(l.IconButton,{"aria-label":"Previous page",children:i.jsx(vi,{size:18})})}),i.jsx(l.Pagination.Items,{render:u=>i.jsx(l.IconButton,{variant:u.type==="page"&&u.value===n?"outline":"ghost","aria-current":u.type==="page"&&u.value===n?"page":void 0,children:u.type==="page"?u.value:"…"},u.value??u.type)}),i.jsx(Ki,{asChild:!0,children:i.jsx(l.IconButton,{"aria-label":"Next page",children:i.jsx(bi,{size:18})})})]})})]})})}const oa=S(l.Menu.Item),sa=S(l.Menu.Content),ia=S(l.Menu.Positioner),aa=S(l.Menu.Trigger);function ca({data:e=[],actions:t=[],actionConfig:n,onRowSelect:r}){const{columnOrder:o,visibility:s}=nt(ie);return i.jsx(l.Table.Body,{children:e.map(c=>i.jsxs(l.Table.Row,{onClick:()=>r?.(c.__raw),_hover:{bg:"blue.50"},children:[o.filter(a=>s[a.id]).map(a=>i.jsx(l.Table.Cell,{children:c[a.id]},a.id)),n?.showActionColumn&&i.jsx(l.Table.Cell,{textAlign:"center",display:"flex",gap:2,children:i.jsxs(l.Menu.Root,{children:[i.jsx(aa,{asChild:!0,children:i.jsx(l.IconButton,{"aria-label":"Open",variant:"ghost",size:"sm",children:i.jsx(Di,{size:16})})}),i.jsx(l.Portal,{children:i.jsx(ia,{children:i.jsx(sa,{children:t.filter(a=>typeof a.visible=="function"?a.visible(c.__raw):a.visible!==!1).map(a=>i.jsxs(oa,{onClick:()=>a.onClick(c.__raw),colorScheme:a.colorScheme,value:a.label,children:[a.icon,a.label]},a.label))})})})]})}),n?.showColumnVisibilityMenu&&i.jsx(l.Table.Cell,{})]},c.__key||c.id))})}function la({rows:e=6,columns:t}){return i.jsx(l.Table.Body,{children:Array.from({length:e}).map((n,r)=>i.jsx(l.Table.Row,{children:Array.from({length:t}).map((o,s)=>i.jsx(l.Table.Cell,{children:i.jsx(l.Skeleton,{height:"25px"})},s))},r))})}function ua({tableId:e,data:t=[],headers:n=[],loading:r=!1,loadingChildren:o,skeletonLoading:s=!1,emptyMessage:c="No data",actions:a,page:u=1,pageSize:d=10,onPageChange:g,onPageSizeChange:h,density:x="sm",totalCount:p=0,paginationMode:b="client",actionConfig:v,pageSizeOptions:y,onRowSelect:w}){f.useEffect(()=>{Cr(e)},[e]),f.useEffect(()=>{wr(t,n)},[t,n]),f.useEffect(()=>{v&&Dr(v)},[v]);const{sortColumn:E,sortDirection:T,data:I,columnOrder:k}=nt(ie),M=f.useMemo(()=>{const D=[...I],U=Math.max(1,u||1);if(E&&D.sort((G,$)=>T==="asc"?String(G[E]).localeCompare(String($[E])):String($[E]).localeCompare(String(G[E]))),b==="client"){const G=(U-1)*d;return D.slice(G,G+d)}return D},[I,E,T,u,d,b]);f.useEffect(()=>{u<1&&g&&g(1)},[u,g]);const A=D=>{const{active:U,over:G}=D;if(!G||U.id===G.id)return;const $=k.findIndex(O=>O.id===U.id),j=k.findIndex(O=>O.id===G.id),C=Et(k,$,j);Zs(C)},L=r&&!s,V=s&&!r,F=!r&&!s&&M.length===0;return i.jsx(fr,{collisionDetection:Zn,onDragEnd:A,children:i.jsx(vr,{items:k.map(D=>D.id),strategy:Ms,children:i.jsxs(l.Box,{flex:"1",minH:0,display:"flex",flexDirection:"column",p:2,children:[i.jsxs(l.Box,{flex:"1",minH:0,position:"relative",overflow:"auto",children:[L&&i.jsx(l.Box,{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,bg:"whiteAlpha.600",children:o??i.jsx(l.Spinner,{})}),i.jsxs(l.Table.Root,{variant:"outline",w:"100%",size:x,children:[i.jsx(Hi,{}),V?i.jsx(la,{rows:d,columns:n.length+(a?2:0)}):F?i.jsx(l.Table.Body,{children:i.jsx(l.Table.Row,{children:i.jsx(l.Table.Cell,{colSpan:n.length+(a?1:0),children:i.jsx(l.Box,{display:"flex",alignItems:"center",justifyContent:"center",minH:"200px",color:"gray.500",children:c})})})}):i.jsx(ca,{data:M,actions:a,actionConfig:v,onRowSelect:w})]})]}),i.jsx(l.Box,{mt:.5,children:i.jsx(ra,{totalCount:p,pageSize:d,currentPage:u,onPageChange:g,onPageSizeChange:D=>{h?.(D),u>1&&g?.(1)},pageSizeOptions:y})})]})})})}const da=S(l.Checkbox.Root),fa=S(l.Checkbox.HiddenInput),ha=S(l.Checkbox.Control),ga=S(l.Checkbox.Label),Or=({value:e,onChange:t,size:n="sm",label:r,helperText:o,isDisabled:s,required:c,errorText:a})=>i.jsxs(da,{value:e,onChange:t,size:n,children:[i.jsx(fa,{}),i.jsx(ha,{disabled:s,required:c,errorText:a,helperText:o}),r&&i.jsx(ga,{children:r})]}),pa=S(l.Combobox.Root),va=S(l.Combobox.Control),ma=S(l.Combobox.Input),ba=S(l.Combobox.IndicatorGroup),xa=S(l.Combobox.ClearTrigger),ya=S(l.Combobox.Trigger),Sa=S(l.Combobox.Positioner),wa=S(l.Combobox.Content);function _r({label:e,size:t="sm",width:n="100%",variant:r="outline",items:o=[],itemToString:s,itemToValue:c,renderItem:a,value:u,loading:d,error:g,errorMessage:h,placeholder:x,helpText:p,onInputChange:b,onSelect:v,visible:y=!0,rootProps:w,inputProps:E,controlProps:T,contentProps:I,itemProps:k}){const[M,A]=f.useState(""),{collection:L,set:V}=l.useListCollection({initialItems:o,itemToString:s,itemToValue:c}),F=f.useMemo(()=>{if(!M)return o;const D=M.toLowerCase();return o.filter(U=>s(U).toLowerCase().includes(D))},[o,M,s]);return f.useEffect(()=>{V(F)},[F,V]),f.useEffect(()=>{u&&A(s(u))},[u,s]),i.jsxs(pa,{width:n,size:t,variant:r,collection:L,placeholder:x,onInputValueChange:D=>{b?.(D.inputValue),A(D.inputValue)},value:u?[c(u)]:[],onValueChange:D=>{const U=D.value?.[0];if(!U)return;const G=L.items.find($=>c($)===U);G&&v?.(G)},positioning:{sameWidth:!1,placement:"bottom-start"},...w,children:[y&&e&&i.jsx(l.Text,{fontSize:"sm",children:e}),i.jsxs(va,{...T,children:[i.jsx(ma,{placeholder:x??"Type to search",...E}),i.jsxs(ba,{children:[i.jsx(xa,{}),i.jsx(ya,{})]})]}),i.jsx(Sa,{children:i.jsxs(wa,{minW:"sm",...I,children:[d?i.jsxs(l.HStack,{p:"2",children:[i.jsx(l.Spinner,{size:"xs",borderWidth:"1px"}),i.jsx(l.Span,{children:"Loading..."})]}):g?i.jsx(l.Text,{p:"2",color:"red.500",fontSize:"sm",children:h||"Something went wrong"}):L.items.map(D=>i.jsxs(l.Combobox.Item,{item:D,...k,children:[a(D),i.jsx(l.Combobox.ItemIndicator,{})]},c(D))),p&&!g&&!d&&i.jsx(l.Text,{p:"2",color:"fg.muted",fontSize:"sm",children:p})]})})]})}const Z=" to ",Vn=10,Ee={DAY_MAX:31,MONTH_MAX:12,YEAR_MIN:1900,YEAR_MAX:2100},ln=()=>{const e=new Date;return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}},Hn=()=>{const{year:e,month:t,day:n}=ln();return`${String(n).padStart(2,"0")}-${String(t).padStart(2,"0")}-${e}`},Ca=()=>{const{year:e,month:t,day:n}=ln();return`${e}-${String(t).padStart(2,"0")}-${String(n).padStart(2,"0")}`},Da=(e,t)=>{const n=e.length,r=parseInt(e);if(!e||isNaN(r))return t;if(n===4)return r>=Ee.YEAR_MIN&&r<=Ee.YEAR_MAX?r:t;if(n>0&&n<4){const o=t.toString(),s=4-n,c=o.substring(0,s);return parseInt(c+e)}return t},He=e=>{if(!e?.trim())return null;const n=e.replace(/[^\d-]/g,"").split("-").filter(d=>d!=="");if(n.length===0)return null;const{year:r,month:o,day:s}=ln();let c,a,u;return n.length===1?(c=parseInt(n[0])||s,a=o,u=r):n.length===2?(c=parseInt(n[0])||s,a=parseInt(n[1])||o,u=r):(c=parseInt(n[0])||s,a=parseInt(n[1])||o,u=Da(n[2],r)),a=Math.max(1,Math.min(Ee.MONTH_MAX,a)),c=Math.max(1,Math.min(Ee.DAY_MAX,c)),`${u}-${String(a).padStart(2,"0")}-${String(c).padStart(2,"0")}`},ge=e=>{if(!e)return"";const[t,n,r]=e.split("-");return`${r}-${n}-${t}`},ja=(e,t)=>{if(e[0]?.length>0){const n=parseInt(e[0]);if(isNaN(n)||n===0||e[0].length===2&&n>Ee.DAY_MAX)return t}if(e[1]?.length>0){const n=parseInt(e[1]);if(isNaN(n)||n===0||e[1].length===2&&n>Ee.MONTH_MAX)return t}if(e[2]?.length>0){const n=parseInt(e[2]),r=e[2].length===4;if(isNaN(n)||n===0||r&&(n<Ee.YEAR_MIN||n>Ee.YEAR_MAX))return t}return null},We=e=>{let t=e.replace(/[^\d-]/g,"").substring(0,Vn);if(t.length>=3&&t[2]!=="-"&&(t=t.substring(0,2)+"-"+t.substring(2).replace(/-/g,"")),t.length>=6&&t[5]!=="-"){const o=t.split("-");o.length>=2&&(t=`${o[0]}-${o[1].substring(0,2)}-${o[1].substring(2)}${o[2]||""}`)}const n=t.split("-");return n[0]=n[0]?.substring(0,2)||"",n[1]=n[1]?.substring(0,2)||"",n[2]=n[2]?.substring(0,4)||"",t=n.filter(o=>o!=="").join("-"),t=t.substring(0,Vn),ja(n,e)||t},Ra=S(l.Popover.Root),Ea=S(l.Popover.Trigger),Ta=S(l.Popover.Content),Ma=S(l.Popover.Positioner);function Oa({value:e,onChange:t,disabled:n=!1}){const[r="",o=""]=e?e.split("|"):[],[s,c]=f.useState(()=>r&&o?`${ge(r)}${Z}${ge(o)}`:r?ge(r):""),[a,u]=f.useState(!1),d=f.useRef(null);f.useEffect(()=>{const b=v=>{v.ctrlKey&&v.key==="d"&&!v.shiftKey&&!v.metaKey&&(v.preventDefault(),d.current?.focus())};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[]);const g=b=>{let v=b;if(v.includes(Z)){const[y,w=""]=v.split(Z);v=`${We(y.trim())}${Z}${We(w.trim())}`}else if(v.toLowerCase().includes(" to ")){const[y,w=""]=v.split(/\s+to\s+/i);v=`${We(y.trim())} to ${We(w.trim())}`}else v=We(v);c(v)},h=()=>{const b=s.trim();if(!b){t(void 0);return}if(b.includes(Z)){const[v,y=""]=b.split(Z).map(T=>T.trim()),w=He(v),E=y?He(y):null;if(w&&E){const[T,I]=E<w?[E,w]:[w,E],k=`${ge(T)}${Z}${ge(I)}`;c(k),t(`${T}|${I}`)}else if(w&&!y)c(`${ge(w)}${Z}`),t(void 0);else if(w&&y){const T=Ca(),[I,k]=T<w?[T,w]:[w,T],M=`${ge(I)}${Z}${ge(k)}`;c(M),t(`${I}|${k}`)}else c(""),t(void 0)}else{const v=He(b);v?(c(`${ge(v)}${Z}`),t(void 0)):(c(""),t(void 0))}},x=b=>{if(b.key!=="Enter")return;b.preventDefault();const v=d.current?.selectionStart||0,y=s.indexOf(Z);if(!s.trim()){c(`${Hn()}${Z}`);return}if(y===-1){const E=He(s.trim());E&&c(`${ge(E)}${Z}`);return}if(v<=y+Z.length){const E=s.substring(0,y).trim(),T=s.substring(y+Z.length),I=He(E);I&&c(`${ge(I)}${Z}${T}`);return}if(s.substring(y+Z.length).trim())h(),d.current?.blur();else{const E=s.substring(0,y+Z.length)+Hn();c(E),setTimeout(()=>{h(),d.current?.blur()},0)}},p=()=>{c(""),t(void 0)};return i.jsx(l.InputGroup,{children:i.jsx(i.Fragment,{children:i.jsxs(l.InputElement,{position:"revert",children:[i.jsxs(Ra,{open:a,onEscapeKeyDown:()=>{u(!1)},children:[i.jsx(Ea,{asChild:!0,children:i.jsx(l.IconButton,{size:"sm",variant:"ghost","aria-label":"Date range help",onClick:()=>u(b=>!b),children:i.jsx(Bn,{size:16})})}),i.jsx(l.Portal,{children:i.jsx(Ma,{children:i.jsxs(Ta,{p:4,children:[i.jsx(l.PopoverArrow,{}),i.jsxs(l.VStack,{align:"start",gap:4,children:[i.jsxs(l.HStack,{children:[i.jsx(Bn,{size:16}),i.jsx(l.Text,{fontWeight:"semibold",fontSize:"sm",children:"Date Range Filter"})]}),i.jsxs(l.VStack,{align:"start",gap:1,children:[i.jsx(l.Text,{fontSize:"sm",fontWeight:"medium",children:"Format:"}),i.jsxs(l.Text,{fontSize:"xs",color:"gray.600",children:["DD-MM-YYYY",Z,"DD-MM-YYYY"]})]}),i.jsxs(l.VStack,{align:"start",gap:1,children:[i.jsx(l.Text,{fontSize:"sm",fontWeight:"medium",children:"Tips:"}),i.jsx(l.Text,{fontSize:"xs",children:'• "15 to 20" → assumes current month/year'}),i.jsx(l.Text,{fontSize:"xs",children:"• Leave end blank → up to today"}),i.jsx(l.Text,{fontSize:"xs",children:"• Dates auto-swapped if reversed"}),i.jsx(l.Text,{fontSize:"xs",children:"• Press Enter on empty end → fills today"})]}),i.jsxs(l.VStack,{align:"start",gap:1,children:[i.jsx(l.Text,{fontSize:"sm",fontWeight:"medium",children:"Shortcut:"}),i.jsxs(l.HStack,{children:[i.jsx(l.Kbd,{children:"Ctrl"}),i.jsx(l.Text,{children:"+"}),i.jsx(l.Kbd,{children:"D"})]})]})]})]})})})]}),i.jsx(l.Input,{ref:d,placeholder:"15-06-2025 to 20-06-2025",value:s,size:"sm",disabled:n,onChange:b=>g(b.target.value),onBlur:h,onKeyDown:x,pr:s?"10":void 0,w:"100%"}),s&&i.jsx(l.InputElement,{children:i.jsx(l.IconButton,{size:"sm",variant:"ghost","aria-label":"Clear date range",onClick:p,w:"100%"})})]})})})}const _a=S(l.Field.Root),ka=S(l.Field.Label),$a=S(l.Field.HelperText),Ia=S(l.Field.ErrorText),Kt=({icon:e,value:t,onChange:n,placeholder:r,size:o="xs",variant:s="outline",width:c="100%",label:a,helperText:u,isDisabled:d=!1,required:g=!1,errorText:h,visible:x})=>i.jsxs(_a,{width:c,children:[x&&i.jsx(ka,{children:a}),i.jsx(l.InputGroup,{startElement:e,children:i.jsx(l.Input,{value:t,onChange:p=>n?.(p.target.value),placeholder:r,size:o,variant:s,disabled:d,required:g})}),h&&i.jsx(Ia,{fontSize:"xs",children:h}),u&&i.jsx($a,{fontSize:"xs",children:u})]}),Aa=S(l.Field.Root),La=S(l.Field.HelperText),Na=S(l.Field.ErrorText),Pa=S(l.Select.Root),za=S(l.Select.Label),Ya=S(l.Select.Control),Fa=S(l.Select.Trigger),Ba=S(l.Select.ValueText),Va=S(l.Select.IndicatorGroup),Ha=S(l.Select.Indicator),Wa=S(l.Select.Content),Ua=S(l.Select.Item),Ga=S(l.Select.ItemIndicator),qa=S(l.Select.HiddenSelect),Xa=S(l.Select.Positioner),kr=({options:e=[],label:t,value:n,onChange:r,placeholder:o,size:s="xs",width:c="100%",variant:a="outline",helperText:u,isDisabled:d,required:g,errorText:h,visible:x})=>{const p=l.createListCollection({items:e});return i.jsxs(Aa,{disabled:d,required:g,children:[i.jsxs(Pa,{collection:p,variant:a,size:s,width:c,value:n?[n]:[],onValueChange:b=>r?.(b.value[0]),children:[i.jsx(qa,{}),x&&i.jsx(za,{children:t}),i.jsxs(Ya,{children:[i.jsx(Fa,{children:i.jsx(Ba,{placeholder:o})}),i.jsx(Va,{children:i.jsx(Ha,{})})]}),i.jsx(Xa,{children:i.jsx(Wa,{children:p.items.map(b=>i.jsxs(Ua,{item:b,children:[b.label,i.jsx(Ga,{})]},b.value))})})]}),u&&i.jsx(La,{children:u}),h&&i.jsx(Na,{children:h})]})},$r=(e="default")=>`FILTER_PRESETS_${e}`,Ka=e=>{if(!e)return[];try{return JSON.parse(e)}catch{return[]}},Ja=e=>typeof window>"u"?[]:Ka(localStorage.getItem($r(e))),Ze=new Sr({}),rt=e=>{const t=Ze.state;if(e in t)return t[e];const n=Ja(e);return Ze.setState(r=>({...r,[e]:n})),n},Tt=(e,t)=>{Ze.setState(n=>({...n,[e]:t})),typeof window<"u"&&localStorage.setItem($r(e),JSON.stringify(t))},Ir=(e,t)=>{const n=[t,...rt(e)];Tt(e,n)},Ar=(e,t)=>{const n=rt(e).filter(r=>r.id!==t);Tt(e,n)},Za=(e,t,n)=>{const r=rt(e).map(o=>o.id===t?n(o):o);Tt(e,r)},Qa=S(l.Checkbox.Root),ec=S(l.Checkbox.HiddenInput),tc=S(l.Checkbox.Control),nc=S(l.Slider.Root),rc=S(l.Slider.Track),oc=S(l.Slider.Range),sc=S(l.Slider.Thumbs),ic=S(l.Slider.Control),ac=({filter:e,onVisibilityChange:t,onSizeChange:n})=>{const{attributes:r,listeners:o,setNodeRef:s,transform:c,transition:a}=br({id:e.id}),u={transform:Ie.Transform.toString(c),transition:a};return i.jsxs(l.VStack,{ref:s,style:u,align:"stretch",border:"1px solid",borderColor:"gray.200",rounded:"md",p:3,mb:3,bg:"white",children:[i.jsxs(l.HStack,{...r,...o,cursor:"grab",userSelect:"none",gap:2,children:[i.jsx(Tr,{size:16}),i.jsx(l.Text,{fontWeight:"bold",fontSize:"sm",children:e.label||e.id})]}),i.jsxs(l.HStack,{justify:"space-between",children:[i.jsx(l.Text,{fontSize:"sm",children:"Visible"}),i.jsxs(Qa,{checked:e.visible,size:"sm",onCheckedChange:d=>t?.(e.id,!!d.checked),children:[i.jsx(ec,{}),i.jsx(tc,{})]})]}),i.jsxs(l.VStack,{align:"stretch",gap:1,children:[i.jsx(l.Text,{fontSize:"sm",children:"Size"}),i.jsx(nc,{min:1,max:5,step:.5,value:[e.size??1],onValueChange:d=>n?.(e.id,d.value[0]),children:i.jsxs(ic,{children:[i.jsx(rc,{children:i.jsx(oc,{})}),i.jsx(sc,{})]})})]})]})},cc=S(l.Drawer.Root),lc=S(l.Drawer.Trigger),uc=S(l.Drawer.Backdrop),dc=S(l.Drawer.Positioner),fc=S(l.Drawer.Content),hc=S(l.Drawer.Header),gc=S(l.Drawer.Title),pc=S(l.Drawer.Body),vc=S(l.Drawer.Footer),mc=S(l.Drawer.CloseTrigger),bc=S(l.Tabs.Root),xc=S(l.Tabs.List),Bt=S(l.Tabs.Trigger),Vt=S(l.Tabs.Content),Lr=(e,t)=>{if(e.customComponent)return e.customComponent;switch(e.type){case"text":return i.jsx(Kt,{placeholder:e.label,value:e.value,onChange:e.onChange,label:e.label,visible:t});case"number":return i.jsx(Kt,{label:e.label,value:e.value,onChange:e.onChange});case"checkbox":return i.jsx(Or,{label:e.label,value:e.value,onChange:e.onChange});case"select":return i.jsx(kr,{label:e.label,value:e.value,onChange:e.onChange,options:e.options??[],visible:t,placeholder:e.placeholder});case"date":return i.jsx(Oa,{value:e.value,onChange:e.onChange});case"combobox":return i.jsx(_r,{visible:!0,label:e.label,items:e.options,itemToString:n=>n.label,itemToValue:n=>n.value,renderItem:n=>i.jsx("span",{children:n.label})});default:return null}},yc=({filterDrawerSize:e="sm",onVisibilityChange:t,onSizeChange:n,onClear:r,filters:o,pageKey:s="default",onLoadPreset:c,activePresetName:a,onReorder:u,open:d,onOpenChange:g})=>{const x=nt(Ze)[s]??rt(s),p=()=>{const b=prompt("Preset name?");if(!b)return;const v=o.reduce((y,w)=>(y[w.id]=w.value,y),{});Ir(s,{id:crypto.randomUUID(),name:b,date:new Date().toISOString(),values:v})};return i.jsx(l.HStack,{wrap:"wrap",children:i.jsxs(cc,{size:e,open:d,onOpenChange:g,children:[i.jsx(lc,{asChild:!0,children:i.jsxs(l.IconButton,{"aria-label":"Open filters",variant:"outline",size:"xs",ml:2,p:2,children:[i.jsx(Ri,{size:16}),"Filters"]})}),i.jsxs(l.Portal,{children:[i.jsx(uc,{}),i.jsx(dc,{children:i.jsxs(fc,{children:[i.jsx(hc,{children:i.jsx(gc,{children:"Filters"})}),i.jsx(pc,{overflowY:"auto",pt:1,children:i.jsxs(bc,{defaultValue:"view",children:[i.jsxs(xc,{mb:4,children:[i.jsxs(Bt,{value:"view",children:[i.jsx(Mi,{size:16}),"Edit"]}),i.jsxs(Bt,{value:"settings",children:[i.jsx($i,{size:16}),"Settings"]}),i.jsxs(Bt,{value:"presets",children:[i.jsx(hi,{size:16}),"Presets"]})]}),i.jsx(Vt,{value:"view",children:o.filter(b=>b.visible).map(b=>i.jsx(l.VStack,{align:"stretch",border:"1px solid",borderColor:"gray.200",flex:b.size??1,minW:`${(b.size??1)*100}px`,rounded:"md",p:3,mb:3,children:Lr(b,d)},b.id))}),i.jsx(Vt,{value:"settings",children:i.jsx(fr,{sensors:vo(po(cn)),collisionDetection:Zn,onDragEnd:({active:b,over:v})=>{if(!v||b.id===v.id)return;const y=o.findIndex(T=>T.id===b.id),w=o.findIndex(T=>T.id===v.id),E=Et(o,y,w);u?.(E)},children:i.jsx(vr,{items:o.map(b=>b.id),strategy:_s,children:o.map(b=>i.jsx(ac,{filter:b,onVisibilityChange:t,onSizeChange:n},b.id))})})}),i.jsx(Vt,{value:"presets",children:i.jsxs(l.VStack,{align:"stretch",mb:3,children:[x.length===0&&i.jsx(l.Text,{fontSize:"xs",color:"gray.500",children:"No presets saved yet."}),x.map(b=>i.jsxs(l.HStack,{justify:"space-between",border:"1px solid",borderColor:a===b.name?"blue.300":"gray.200",rounded:"md",p:2,children:[i.jsxs(l.VStack,{align:"start",gap:0,children:[i.jsx(l.Text,{fontWeight:"bold",fontSize:"sm",children:b.name}),i.jsx(l.Text,{fontSize:"xs",color:"gray.500",children:new Date(b.date).toLocaleDateString()})]}),i.jsxs(l.HStack,{children:[i.jsx(l.Button,{size:"xs",variant:"ghost",onClick:()=>{const v=o.map(y=>({...y,value:b.values[y.id]??y.value}));c?.(v,b.name)},children:"Load"}),i.jsx(l.IconButton,{size:"xs","aria-label":"Delete preset",variant:"ghost",onClick:()=>Ar(s,b.id),children:i.jsx(wi,{size:14})})]})]},b.id)),i.jsx(l.Button,{size:"sm",colorScheme:"blue",onClick:p,children:"Save Current Filters"})]})})]})}),i.jsx(vc,{justify:"space-between",children:i.jsx(mc,{asChild:!0,children:i.jsx(l.CloseButton,{})})})]})})]})]})})},Sc=({title:e,filters:t,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:c,pageKey:a,onLoadPreset:u,activePresetName:d,filterDrawerSize:g="sm"})=>{const[h,x]=f.useState(!1);return i.jsxs(l.HStack,{wrap:"wrap",pl:2,pr:2,width:"100%",justify:"space-between",children:[e,i.jsxs(l.HStack,{gapX:1,children:[t.filter(p=>p.visible!==!1).map(p=>i.jsx(l.HStack,{flex:p.size??1,minW:`${(p.size??1)*100}px`,alignItems:"center",children:Lr(p)},p.id)),i.jsx(yc,{filterDrawerSize:g,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:c,pageKey:a,filters:t,onLoadPreset:u,activePresetName:d,open:h,onOpenChange:p=>{x(p.open)}})]})]})},wc=(e,t)=>{localStorage.setItem(`FILTER_ORDER_${e}`,JSON.stringify(t))},Cc=e=>{try{return JSON.parse(localStorage.getItem(`FILTER_ORDER_${e}`)||"[]")}catch{return[]}},Dc=({onClick:e,size:t="xs",variant:n="solid",label:r,leftIcon:o,rightIcon:s,isDisabled:c,colorScheme:a,loading:u,loadingText:d,rounded:g,type:h="button"})=>i.jsx(l.Button,{onClick:e,size:t,variant:n,disabled:c,colorPalette:a,loading:u,loadingText:d,rounded:g,type:h,children:i.jsxs(l.HStack,{gap:1,children:[o,r,s]})}),jc=S(l.Dialog.Root),Rc=S(l.Dialog.Backdrop),Ec=S(l.Dialog.Positioner),Tc=S(l.Dialog.Content),Mc=S(l.Dialog.Header),Oc=S(l.Dialog.Body),_c=S(l.Dialog.Footer),kc=S(l.Dialog.Title),$c=S(l.Dialog.CloseTrigger);function Ic({open:e,onClose:t,onConfirm:n,title:r="Confirm Action",description:o="Are you sure you want to continue?",confirmLabel:s="Confirm",cancelLabel:c="Cancel",icon:a,isLoading:u=!1,confirmButtonColorScheme:d="#4169e1"}){return i.jsx(jc,{open:e,placement:"center",onOpenChange:g=>!g.open&&t(),children:i.jsxs(l.Portal,{children:[i.jsx(Rc,{}),i.jsx(Ec,{children:i.jsxs(Tc,{maxW:"480px",children:[i.jsx(Mc,{borderBottom:"1px solid",borderColor:"gray.200",children:i.jsx(kc,{children:r})}),i.jsx(Oc,{p:6,children:i.jsxs(l.Stack,{gap:4,align:"center",textAlign:"center",children:[i.jsx(l.Box,{color:"orange.500",children:a??i.jsx(Mr,{size:40})}),i.jsx(l.Text,{fontSize:"sm",color:"gray.600",children:o})]})}),i.jsxs(_c,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"gray.200",children:[i.jsx(l.Button,{variant:"outline",size:"sm",onClick:t,children:c}),i.jsx(l.Button,{size:"sm",style:{backgroundColor:d},loading:u,onClick:n,children:s})]}),i.jsx($c,{asChild:!0,children:i.jsx(l.CloseButton,{size:"sm"})})]})})]})})}const Ac=S(l.Dialog.Root),Lc=S(l.Dialog.Backdrop),Nc=S(l.Dialog.Positioner),Pc=S(l.Dialog.Content),zc=S(l.Dialog.Header),Yc=S(l.Dialog.Body),Fc=S(l.Dialog.Footer),Bc=S(l.Dialog.Title),Vc=S(l.Dialog.CloseTrigger);function Hc({open:e,onClose:t,onConfirm:n,title:r="Delete Company",entityName:o,confirmText:s="DELETE",confirmLabel:c="Delete",isLoading:a=!1}){const[u,d]=f.useState(""),g=u===s;return i.jsx(Ac,{open:e,placement:"center",onOpenChange:h=>{!h.open&&t(),d("")},children:i.jsxs(l.Portal,{children:[i.jsx(Lc,{}),i.jsx(Nc,{children:i.jsxs(Pc,{maxW:"550px",children:[i.jsx(zc,{borderBottom:"1px solid",borderColor:"#d3d3d3",children:i.jsx(Bc,{color:"red.600",children:r})}),i.jsx(Yc,{p:2,style:{padding:"16px"},children:i.jsxs(l.Stack,{gap:4,borderRadius:"md",p:4,bg:"white",children:[i.jsx(l.Box,{border:"1px solid",borderColor:"red.200",bg:"red.50",borderRadius:"md",p:4,children:i.jsxs(l.Stack,{direction:"row",gap:3,align:"flex-start",children:[i.jsx(l.Box,{color:"red.600",mt:"2px",children:i.jsx(Mr,{size:20})}),i.jsxs(l.Box,{children:[i.jsx(l.Text,{fontWeight:"semibold",color:"red.700",children:"Are you sure?"}),i.jsxs(l.Text,{fontSize:"sm",color:"red.600",children:["All the data of ",i.jsx("b",{children:o})," will permanently be deleted."]})]})]})}),i.jsx(l.Text,{fontSize:"sm",color:"gray.600",children:"You can’t undo this action afterwards."}),i.jsxs(l.Box,{children:[i.jsxs(l.Text,{fontSize:"sm",mb:2,children:["Type ",i.jsx("b",{children:s})," to continue"]}),i.jsx(l.Input,{placeholder:`Type ${s} here`,value:u,onChange:h=>d(h.target.value),size:"xs"})]})]})}),i.jsxs(Fc,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"#d3d3d3",children:[i.jsx(l.Button,{variant:"outline",size:"sm",onClick:()=>{t(),d("")},children:"Cancel"}),i.jsx(l.Button,{size:"sm",disabled:!g,style:{backgroundColor:"#FF0000"},loading:a,onClick:n,children:c})]}),i.jsx(Vc,{asChild:!0,children:i.jsx(l.CloseButton,{size:"sm"})})]})})]})})}const Nr=({children:e})=>i.jsx(i.Fragment,{children:e}),Pr=({children:e})=>i.jsx(i.Fragment,{children:e}),Wc=l.Button,Uc=S(l.Dialog.Title),Gc=S(l.Dialog.Content);function qc(e){let t=null,n=null;return f.Children.forEach(e,r=>{f.isValidElement(r)&&(r.type===Nr&&(t=r.props.children),r.type===Pr&&(n=r.props.children))}),{body:t,actions:n}}const Xc=({open:e,onClose:t,title:n,children:r,size:o="md"})=>{const{body:s,actions:c}=qc(r);return i.jsxs(l.Dialog.Root,{open:e,onOpenChange:()=>t(),children:[i.jsx(l.DialogBackdrop,{}),i.jsxs(Gc,{maxW:o,borderRadius:"12px",p:"0",children:[i.jsx(l.DialogHeader,{px:"20px",py:"16px",borderBottom:"1px solid",borderColor:"gray.200",children:i.jsxs(l.Flex,{justify:"space-between",align:"center",children:[i.jsx(Uc,{fontSize:"16px",fontWeight:"600",children:n}),i.jsx(l.DialogCloseTrigger,{})]})}),s&&i.jsx(l.DialogBody,{px:"20px",py:"16px",children:s}),c&&i.jsx(l.DialogFooter,{px:"20px",py:"16px",borderTop:"1px solid",borderColor:"gray.200",children:i.jsx(l.Flex,{ml:"auto",gap:"12px",children:c})})]})]})};function zr({refetch:e,isLoading:t=!1,label:n="Refresh"}){const[r,o]=f.useState(!1),s=async()=>{o(!0);try{await e()}finally{setTimeout(()=>o(!1),300)}};return i.jsx(l.IconButton,{"aria-label":n,size:"xs",variant:"outline",disabled:t||r,onClick:s,ml:2,children:i.jsx(_i,{size:14,style:{animation:r?"spin 0.6s linear infinite":void 0}})})}var gt={exports:{}},Kc=gt.exports,Wn;function Jc(){return Wn||(Wn=1,(function(e,t){(function(n,r){e.exports=r()})(Kc,(function(){var n=1e3,r=6e4,o=36e5,s="millisecond",c="second",a="minute",u="hour",d="day",g="week",h="month",x="quarter",p="year",b="date",v="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,w=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,E={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function($){var j=["th","st","nd","rd"],C=$%100;return"["+$+(j[(C-20)%10]||j[C]||j[0])+"]"}},T=function($,j,C){var O=String($);return!O||O.length>=j?$:""+Array(j+1-O.length).join(C)+$},I={s:T,z:function($){var j=-$.utcOffset(),C=Math.abs(j),O=Math.floor(C/60),_=C%60;return(j<=0?"+":"-")+T(O,2,"0")+":"+T(_,2,"0")},m:function $(j,C){if(j.date()<C.date())return-$(C,j);var O=12*(C.year()-j.year())+(C.month()-j.month()),_=j.clone().add(O,h),N=C-_<0,z=j.clone().add(O+(N?-1:1),h);return+(-(O+(C-_)/(N?_-z:z-_))||0)},a:function($){return $<0?Math.ceil($)||0:Math.floor($)},p:function($){return{M:h,y:p,w:g,d,D:b,h:u,m:a,s:c,ms:s,Q:x}[$]||String($||"").toLowerCase().replace(/s$/,"")},u:function($){return $===void 0}},k="en",M={};M[k]=E;var A="$isDayjsObject",L=function($){return $ instanceof U||!(!$||!$[A])},V=function $(j,C,O){var _;if(!j)return k;if(typeof j=="string"){var N=j.toLowerCase();M[N]&&(_=N),C&&(M[N]=C,_=N);var z=j.split("-");if(!_&&z.length>1)return $(z[0])}else{var m=j.name;M[m]=j,_=m}return!O&&_&&(k=_),_||!O&&k},F=function($,j){if(L($))return $.clone();var C=typeof j=="object"?j:{};return C.date=$,C.args=arguments,new U(C)},D=I;D.l=V,D.i=L,D.w=function($,j){return F($,{locale:j.$L,utc:j.$u,x:j.$x,$offset:j.$offset})};var U=(function(){function $(C){this.$L=V(C.locale,null,!0),this.parse(C),this.$x=this.$x||C.x||{},this[A]=!0}var j=$.prototype;return j.parse=function(C){this.$d=(function(O){var _=O.date,N=O.utc;if(_===null)return new Date(NaN);if(D.u(_))return new Date;if(_ instanceof Date)return new Date(_);if(typeof _=="string"&&!/Z$/i.test(_)){var z=_.match(y);if(z){var m=z[2]-1||0,R=(z[7]||"0").substring(0,3);return N?new Date(Date.UTC(z[1],m,z[3]||1,z[4]||0,z[5]||0,z[6]||0,R)):new Date(z[1],m,z[3]||1,z[4]||0,z[5]||0,z[6]||0,R)}}return new Date(_)})(C),this.init()},j.init=function(){var C=this.$d;this.$y=C.getFullYear(),this.$M=C.getMonth(),this.$D=C.getDate(),this.$W=C.getDay(),this.$H=C.getHours(),this.$m=C.getMinutes(),this.$s=C.getSeconds(),this.$ms=C.getMilliseconds()},j.$utils=function(){return D},j.isValid=function(){return this.$d.toString()!==v},j.isSame=function(C,O){var _=F(C);return this.startOf(O)<=_&&_<=this.endOf(O)},j.isAfter=function(C,O){return F(C)<this.startOf(O)},j.isBefore=function(C,O){return this.endOf(O)<F(C)},j.$g=function(C,O,_){return D.u(C)?this[O]:this.set(_,C)},j.unix=function(){return Math.floor(this.valueOf()/1e3)},j.valueOf=function(){return this.$d.getTime()},j.startOf=function(C,O){var _=this,N=!!D.u(O)||O,z=D.p(C),m=function(J,Y){var se=D.w(_.$u?Date.UTC(_.$y,Y,J):new Date(_.$y,Y,J),_);return N?se:se.endOf(d)},R=function(J,Y){return D.w(_.toDate()[J].apply(_.toDate("s"),(N?[0,0,0,0]:[23,59,59,999]).slice(Y)),_)},P=this.$W,B=this.$M,q=this.$D,X="set"+(this.$u?"UTC":"");switch(z){case p:return N?m(1,0):m(31,11);case h:return N?m(1,B):m(0,B+1);case g:var H=this.$locale().weekStart||0,K=(P<H?P+7:P)-H;return m(N?q-K:q+(6-K),B);case d:case b:return R(X+"Hours",0);case u:return R(X+"Minutes",1);case a:return R(X+"Seconds",2);case c:return R(X+"Milliseconds",3);default:return this.clone()}},j.endOf=function(C){return this.startOf(C,!1)},j.$set=function(C,O){var _,N=D.p(C),z="set"+(this.$u?"UTC":""),m=(_={},_[d]=z+"Date",_[b]=z+"Date",_[h]=z+"Month",_[p]=z+"FullYear",_[u]=z+"Hours",_[a]=z+"Minutes",_[c]=z+"Seconds",_[s]=z+"Milliseconds",_)[N],R=N===d?this.$D+(O-this.$W):O;if(N===h||N===p){var P=this.clone().set(b,1);P.$d[m](R),P.init(),this.$d=P.set(b,Math.min(this.$D,P.daysInMonth())).$d}else m&&this.$d[m](R);return this.init(),this},j.set=function(C,O){return this.clone().$set(C,O)},j.get=function(C){return this[D.p(C)]()},j.add=function(C,O){var _,N=this;C=Number(C);var z=D.p(O),m=function(B){var q=F(N);return D.w(q.date(q.date()+Math.round(B*C)),N)};if(z===h)return this.set(h,this.$M+C);if(z===p)return this.set(p,this.$y+C);if(z===d)return m(1);if(z===g)return m(7);var R=(_={},_[a]=r,_[u]=o,_[c]=n,_)[z]||1,P=this.$d.getTime()+C*R;return D.w(P,this)},j.subtract=function(C,O){return this.add(-1*C,O)},j.format=function(C){var O=this,_=this.$locale();if(!this.isValid())return _.invalidDate||v;var N=C||"YYYY-MM-DDTHH:mm:ssZ",z=D.z(this),m=this.$H,R=this.$m,P=this.$M,B=_.weekdays,q=_.months,X=_.meridiem,H=function(Y,se,ne,he){return Y&&(Y[se]||Y(O,N))||ne[se].slice(0,he)},K=function(Y){return D.s(m%12||12,Y,"0")},J=X||function(Y,se,ne){var he=Y<12?"AM":"PM";return ne?he.toLowerCase():he};return N.replace(w,(function(Y,se){return se||(function(ne){switch(ne){case"YY":return String(O.$y).slice(-2);case"YYYY":return D.s(O.$y,4,"0");case"M":return P+1;case"MM":return D.s(P+1,2,"0");case"MMM":return H(_.monthsShort,P,q,3);case"MMMM":return H(q,P);case"D":return O.$D;case"DD":return D.s(O.$D,2,"0");case"d":return String(O.$W);case"dd":return H(_.weekdaysMin,O.$W,B,2);case"ddd":return H(_.weekdaysShort,O.$W,B,3);case"dddd":return B[O.$W];case"H":return String(m);case"HH":return D.s(m,2,"0");case"h":return K(1);case"hh":return K(2);case"a":return J(m,R,!0);case"A":return J(m,R,!1);case"m":return String(R);case"mm":return D.s(R,2,"0");case"s":return String(O.$s);case"ss":return D.s(O.$s,2,"0");case"SSS":return D.s(O.$ms,3,"0");case"Z":return z}return null})(Y)||z.replace(":","")}))},j.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},j.diff=function(C,O,_){var N,z=this,m=D.p(O),R=F(C),P=(R.utcOffset()-this.utcOffset())*r,B=this-R,q=function(){return D.m(z,R)};switch(m){case p:N=q()/12;break;case h:N=q();break;case x:N=q()/3;break;case g:N=(B-P)/6048e5;break;case d:N=(B-P)/864e5;break;case u:N=B/o;break;case a:N=B/r;break;case c:N=B/n;break;default:N=B}return _?N:D.a(N)},j.daysInMonth=function(){return this.endOf(h).$D},j.$locale=function(){return M[this.$L]},j.locale=function(C,O){if(!C)return this.$L;var _=this.clone(),N=V(C,O,!0);return N&&(_.$L=N),_},j.clone=function(){return D.w(this.$d,this)},j.toDate=function(){return new Date(this.valueOf())},j.toJSON=function(){return this.isValid()?this.toISOString():null},j.toISOString=function(){return this.$d.toISOString()},j.toString=function(){return this.$d.toUTCString()},$})(),G=U.prototype;return F.prototype=G,[["$ms",s],["$s",c],["$m",a],["$H",u],["$W",d],["$M",h],["$y",p],["$D",b]].forEach((function($){G[$[1]]=function(j){return this.$g(j,$[0],$[1])}})),F.extend=function($,j){return $.$i||($(j,U,F),$.$i=!0),F},F.locale=V,F.isDayjs=L,F.unix=function($){return F(1e3*$)},F.en=M[k],F.Ls=M,F.p={},F}))})(gt)),gt.exports}var Zc=Jc();const Mt=Ct(Zc);var pt={exports:{}},Qc=pt.exports,Un;function el(){return Un||(Un=1,(function(e,t){(function(n,r){e.exports=r()})(Qc,(function(){return function(n,r,o){n=n||{};var s=r.prototype,c={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function a(d,g,h,x){return s.fromToBase(d,g,h,x)}o.en.relativeTime=c,s.fromToBase=function(d,g,h,x,p){for(var b,v,y,w=h.$locale().relativeTime||c,E=n.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],T=E.length,I=0;I<T;I+=1){var k=E[I];k.d&&(b=x?o(d).diff(h,k.d,!0):h.diff(d,k.d,!0));var M=(n.rounding||Math.round)(Math.abs(b));if(y=b>0,M<=k.r||!k.r){M<=1&&I>0&&(k=E[I-1]);var A=w[k.l];p&&(M=p(""+M)),v=typeof A=="string"?A.replace("%d",M):A(M,g,k.l,y);break}}if(g)return v;var L=y?w.future:w.past;return typeof L=="function"?L(v):L.replace("%s",v)},s.to=function(d,g){return a(d,g,this,!0)},s.from=function(d,g){return a(d,g,this)};var u=function(d){return d.$u?o.utc():o()};s.toNow=function(d){return this.to(u(this),d)},s.fromNow=function(d){return this.from(u(this),d)}}}))})(pt)),pt.exports}var tl=el();const nl=Ct(tl);var vt={exports:{}},rl=vt.exports,Gn;function ol(){return Gn||(Gn=1,(function(e,t){(function(n,r){e.exports=r()})(rl,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,o,s){var c=o.prototype,a=c.format;s.en.formats=n,c.format=function(u){u===void 0&&(u="YYYY-MM-DDTHH:mm:ssZ");var d=this.$locale().formats,g=(function(h,x){return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(p,b,v){var y=v&&v.toUpperCase();return b||x[v]||n[v]||x[y].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(w,E,T){return E||T.slice(1)}))}))})(u,d===void 0?{}:d);return a.call(this,g)}}}))})(vt)),vt.exports}var sl=ol();const il=Ct(sl);var mt={exports:{}},al=mt.exports,qn;function cl(){return qn||(qn=1,(function(e,t){(function(n,r){e.exports=r()})(al,(function(){return function(n,r){var o=r.prototype,s=o.format;o.format=function(c){var a=this,u=this.$locale();if(!this.isValid())return s.bind(this)(c);var d=this.$utils(),g=(c||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(h){switch(h){case"Q":return Math.ceil((a.$M+1)/3);case"Do":return u.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return u.ordinal(a.week(),"W");case"w":case"ww":return d.s(a.week(),h==="w"?1:2,"0");case"W":case"WW":return d.s(a.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return d.s(String(a.$H===0?24:a.$H),h==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return h}}));return s.bind(this)(g)}}}))})(mt)),mt.exports}var ll=cl();const ul=Ct(ll);Mt.extend(nl);Mt.extend(il);Mt.extend(ul);const dl={date:"DD MMM YYYY",time:"hh:mm A",dateTime:"DD MMM YYYY, hh:mm A",full:"dddd, DD MMM YYYY, hh:mm A",short:"DD/MM/YY",relative:""};function Jt({value:e,variant:t="dateTime",format:n,fallback:r="--"}){if(!e)return r;const o=Mt(e);return o.isValid()?t==="relative"?o.fromNow():o.format(n??dl[t]):r}function fl({value:e,dateVariant:t="date",timeVariant:n="time",dateFormat:r,timeFormat:o,align:s="start",dateColor:c="gray.700",dateFontSize:a="16px",dateFontWeight:u="500",timeColor:d="gray.500",timeFontSize:g="12px",timeFontWeight:h="400"}){return i.jsxs(l.Stack,{gap:.5,align:s,children:[i.jsx(l.Text,{fontSize:a,fontWeight:u,color:c,children:Jt({value:e,variant:t,format:r})}),i.jsx(l.Text,{fontSize:g,fontWeight:h,color:d,children:Jt({value:e,variant:n,format:o})})]})}class Yr{state=new Map;listeners=new Map;get(t){return this.state.get(t)}set(t){this.state.set(t.key,t),this.notify(t.key)}setMany(t){t.forEach(n=>this.set(n))}subscribe(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),n(this.state.get(t)),()=>{this.listeners.get(t)?.delete(n)}}notify(t){this.listeners.get(t)?.forEach(n=>n(this.state.get(t)))}clear(){this.state.clear()}}class Zt{constructor(t){this.baseUrl=t}async fetchLatest(t){const n=new URLSearchParams;return n.set("keys",t.join(",")),(await(await fetch(`${this.baseUrl}/options?${n}`)).json()).data}}class Qt{constructor(t){this.api=t}store=new Yr;inflight=new Map;getRaw(t){return this.store.get(t)}async getKey(t){const n=this.store.get(t);return n?n.value:(await this.fetchMissing([t]),this.store.get(t)?.value)}async getMultiKey(t){const n={},r=[];for(const o of t){const s=this.store.get(o);s?n[o]=s.value:r.push(o)}return r.length&&(await this.fetchMissing(r),r.forEach(o=>{const s=this.store.get(o);s&&(n[o]=s.value)})),n}subscribe(t,n){return this.store.subscribe(t,n)}hydrate(t){this.store.setMany(t)}clear(){this.store.clear()}async fetchMissing(t){const n=t.filter(o=>!this.inflight.has(o));if(!n.length)return;const r=this.api.fetchLatest(n).then(o=>{this.store.setMany(o),n.forEach(s=>this.inflight.delete(s))});n.forEach(o=>this.inflight.set(o,r)),await r}}const Fr=f.createContext(null);function Br(){const e=f.useContext(Fr);if(!e)throw new Error("OptionsProvider is missing. Wrap your app with <OptionsProvider />");return e}function hl({client:{apiUrl:e},children:t}){const n=f.useRef(new Qt(new Zt(e)));return n.current||(n.current=new Qt(new Zt(e))),i.jsx(Fr.Provider,{value:n.current,children:t})}function gl(e){const t=Br(),[n,r]=f.useState(t.getRaw(e)?.value);return f.useEffect(()=>{let o=!0;t.getKey(e).then(c=>{o&&r(c)});const s=t.subscribe(e,c=>{r(c?.value)});return()=>{o=!1,s()}},[e,t]),n}function pl(e){const t=Br(),[n,r]=f.useState({});return f.useEffect(()=>{let o=!0;t.getMultiKey(e).then(c=>{o&&r(c)});const s=e.map(c=>t.subscribe(c,a=>{r(u=>({...u,[c]:a?.value}))}));return()=>{o=!1,s.forEach(c=>c())}},[e.join("|"),t]),n}async function vl(e,t){return e.getKey(t)}async function ml(e,t){await e.getMultiKey(t)}function bl(e={}){const{initialPage:t=1,initialLimit:n=20}=e,[r,o]=f.useState(t),[s,c]=f.useState(n),a=f.useCallback(x=>{o(Math.max(1,x))},[]),u=f.useCallback(x=>{c(Math.max(1,x)),o(1)},[]),d=f.useCallback(()=>{o(x=>x+1)},[]),g=f.useCallback(()=>{o(x=>Math.max(1,x-1))},[]),h=f.useCallback(()=>{o(t),c(n)},[t,n]);return{page:r,limit:s,setPage:a,setLimit:u,nextPage:d,prevPage:g,reset:h}}function xl(e={}){const{initialValue:t="",delay:n=300}=e,[r,o]=f.useState(t),s=yl(r,n),c=f.useCallback(u=>{o(u)},[]),a=f.useCallback(()=>{o(t)},[t]);return{search:r,debouncedSearch:s,onSearchChange:c,reset:a}}function yl(e,t=300){const[n,r]=f.useState(e);return f.useEffect(()=>{const o=setTimeout(()=>{r(e)},t);return()=>clearTimeout(o)},[e,t]),n}exports.DataTable=ua;exports.Filters=Sc;exports.HttpOptionsApi=Zt;exports.MDSButton=Dc;exports.MDSCheckbox=Or;exports.MDSCombobox=_r;exports.MDSConfirmActionDialog=Ic;exports.MDSConfirmDeleteDialog=Hc;exports.MDSDialogAction=Wc;exports.MDSDialogActions=Pr;exports.MDSDialogBody=Nr;exports.MDSDialogWrapper=Xc;exports.MDSInput=Kt;exports.MDSRefreshButton=zr;exports.MDSSelectBox=kr;exports.OptionsClientImpl=Qt;exports.OptionsProvider=hl;exports.OptionsStore=Yr;exports.RefreshButton=zr;exports.StackedDateTime=fl;exports.addPreset=Ir;exports.deletePreset=Ar;exports.formatDateTime=Jt;exports.getOption=vl;exports.getPresets=rt;exports.loadOrder=Cc;exports.prefetchOptions=ml;exports.presetStore=Ze;exports.saveOrder=wc;exports.savePresets=Tt;exports.setActionsConfig=Dr;exports.setData=wr;exports.setTableId=Cr;exports.tableStore=ie;exports.updatePreset=Za;exports.useDebouncedSearch=xl;exports.useOption=gl;exports.useOptions=pl;exports.usePagination=bl;exports.withChildren=S;
10
+ `},ho={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 go(e){let{announcements:t=ho,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=fo}=e;const{announce:s,announcement:c}=co(),a=tt("DndLiveRegion"),[u,d]=f.useState(!1);if(f.useEffect(()=>{d(!0)},[]),lo(f.useMemo(()=>({onDragStart(h){let{active:x}=h;s(t.onDragStart({active:x}))},onDragMove(h){let{active:x,over:p}=h;t.onDragMove&&s(t.onDragMove({active:x,over:p}))},onDragOver(h){let{active:x,over:p}=h;s(t.onDragOver({active:x,over:p}))},onDragEnd(h){let{active:x,over:p}=h;s(t.onDragEnd({active:x,over:p}))},onDragCancel(h){let{active:x,over:p}=h;s(t.onDragCancel({active:x,over:p}))}}),[s,t])),!u)return null;const g=f.createElement(f.Fragment,null,f.createElement(io,{id:r,value:o.draggable}),f.createElement(ao,{id:a,announcement:c}));return n?Ue.createPortal(g,n):g}var Q;(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"})(Q||(Q={}));function yt(){}function po(e,t){return f.useMemo(()=>({sensor:e,options:{}}),[e,t])}function vo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return f.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const pe=Object.freeze({x:0,y:0});function mo(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function bo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function xo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function yo(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function wn(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 Zn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=wn(t,t.left,t.top),s=[];for(const c of r){const{id:a}=c,u=n.get(a);if(u){const d=mo(wn(u),o);s.push({id:a,data:{droppableContainer:c,value:d}})}}return s.sort(bo)};function So(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),c=o-r,a=s-n;if(r<o&&n<s){const u=t.width*t.height,d=e.width*e.height,g=c*a,h=g/(u+d-g);return Number(h.toFixed(4))}return 0}const wo=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const s of r){const{id:c}=s,a=n.get(c);if(a){const u=So(a,t);u>0&&o.push({id:c,data:{droppableContainer:s,value:u}})}}return o.sort(xo)};function Co(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Qn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:pe}function Do(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];return o.reduce((c,a)=>({...c,top:c.top+e*a.y,bottom:c.bottom+e*a.y,left:c.left+e*a.x,right:c.right+e*a.x}),{...n})}}const jo=Do(1);function Ro(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 Eo(e,t,n){const r=Ro(t);if(!r)return e;const{scaleX:o,scaleY:s,x:c,y:a}=r,u=e.left-c-(1-o)*parseFloat(n),d=e.top-a-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),g=o?e.width/o:e.width,h=s?e.height/s:e.height;return{width:g,height:h,top:d,right:u+g,bottom:d+h,left:u}}const To={ignoreTransform:!1};function Ne(e,t){t===void 0&&(t=To);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:g}=ae(e).getComputedStyle(e);d&&(n=Eo(n,d,g))}const{top:r,left:o,width:s,height:c,bottom:a,right:u}=n;return{top:r,left:o,width:s,height:c,bottom:a,right:u}}function Cn(e){return Ne(e,{ignoreTransform:!0})}function Mo(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Oo(e,t){return t===void 0&&(t=ae(e).getComputedStyle(e)),t.position==="fixed"}function _o(e,t){t===void 0&&(t=ae(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const s=t[o];return typeof s=="string"?n.test(s):!1})}function on(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(tn(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Qe(o)||Xn(o)||n.includes(o))return n;const s=ae(e).getComputedStyle(o);return o!==e&&_o(o,s)&&n.push(o),Oo(o,s)?n:r(o.parentNode)}return e?r(e):n}function er(e){const[t]=on(e,1);return t??null}function It(e){return!Dt||!e?null:Ae(e)?e:en(e)?tn(e)||e===Le(e).scrollingElement?window:Qe(e)?e:null:null}function tr(e){return Ae(e)?e.scrollX:e.scrollLeft}function nr(e){return Ae(e)?e.scrollY:e.scrollTop}function Ut(e){return{x:tr(e),y:nr(e)}}var ee;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ee||(ee={}));function rr(e){return!Dt||!e?!1:e===document.scrollingElement}function or(e){const t={x:0,y:0},n=rr(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,c=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:o,isLeft:s,isBottom:c,isRight:a,maxScroll:r,minScroll:t}}const ko={x:.2,y:.2};function $o(e,t,n,r,o){let{top:s,left:c,right:a,bottom:u}=n;r===void 0&&(r=10),o===void 0&&(o=ko);const{isTop:d,isBottom:g,isLeft:h,isRight:x}=or(e),p={x:0,y:0},b={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!d&&s<=t.top+v.height?(p.y=ee.Backward,b.y=r*Math.abs((t.top+v.height-s)/v.height)):!g&&u>=t.bottom-v.height&&(p.y=ee.Forward,b.y=r*Math.abs((t.bottom-v.height-u)/v.height)),!x&&a>=t.right-v.width?(p.x=ee.Forward,b.x=r*Math.abs((t.right-v.width-a)/v.width)):!h&&c<=t.left+v.width&&(p.x=ee.Backward,b.x=r*Math.abs((t.left+v.width-c)/v.width)),{direction:p,speed:b}}function Io(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:c}=window;return{top:0,left:0,right:s,bottom:c,width:s,height:c}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function sr(e){return e.reduce((t,n)=>$e(t,Ut(n)),pe)}function Ao(e){return e.reduce((t,n)=>t+tr(n),0)}function Lo(e){return e.reduce((t,n)=>t+nr(n),0)}function No(e,t){if(t===void 0&&(t=Ne),!e)return;const{top:n,left:r,bottom:o,right:s}=t(e);er(e)&&(o<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Po=[["x",["left","right"],Ao],["y",["top","bottom"],Lo]];class sn{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=on(n),o=sr(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,c,a]of Po)for(const u of c)Object.defineProperty(this,u,{get:()=>{const d=a(r),g=o[s]-d;return this.rect[u]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ge{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 o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function zo(e){const{EventTarget:t}=ae(e);return e instanceof t?e:Le(e)}function At(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 fe;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(fe||(fe={}));function Dn(e){e.preventDefault()}function Yo(e){e.stopPropagation()}var W;(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"})(W||(W={}));const ir={start:[W.Space,W.Enter],cancel:[W.Esc],end:[W.Space,W.Enter,W.Tab]},Fo=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case W.Right:return{...n,x:n.x+25};case W.Left:return{...n,x:n.x-25};case W.Down:return{...n,y:n.y+25};case W.Up:return{...n,y:n.y-25}}};class ar{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 Ge(Le(n)),this.windowListeners=new Ge(ae(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(fe.Resize,this.handleCancel),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(fe.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&No(r),n(pe)}handleKeyDown(t){if(rn(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=ir,coordinateGetter:c=Fo,scrollBehavior:a="smooth"}=o,{code:u}=t;if(s.end.includes(u)){this.handleEnd(t);return}if(s.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:d}=r.current,g=d?{x:d.left,y:d.top}:pe;this.referenceCoordinates||(this.referenceCoordinates=g);const h=c(t,{active:n,context:r.current,currentCoordinates:g});if(h){const x=xt(h,g),p={x:0,y:0},{scrollableAncestors:b}=r.current;for(const v of b){const y=t.code,{isTop:w,isRight:E,isLeft:T,isBottom:I,maxScroll:k,minScroll:M}=or(v),A=Io(v),L={x:Math.min(y===W.Right?A.right-A.width/2:A.right,Math.max(y===W.Right?A.left:A.left+A.width/2,h.x)),y:Math.min(y===W.Down?A.bottom-A.height/2:A.bottom,Math.max(y===W.Down?A.top:A.top+A.height/2,h.y))},V=y===W.Right&&!E||y===W.Left&&!T,F=y===W.Down&&!I||y===W.Up&&!w;if(V&&L.x!==h.x){const D=v.scrollLeft+x.x,U=y===W.Right&&D<=k.x||y===W.Left&&D>=M.x;if(U&&!x.y){v.scrollTo({left:D,behavior:a});return}U?p.x=v.scrollLeft-D:p.x=y===W.Right?v.scrollLeft-k.x:v.scrollLeft-M.x,p.x&&v.scrollBy({left:-p.x,behavior:a});break}else if(F&&L.y!==h.y){const D=v.scrollTop+x.y,U=y===W.Down&&D<=k.y||y===W.Up&&D>=M.y;if(U&&!x.x){v.scrollTo({top:D,behavior:a});return}U?p.y=v.scrollTop-D:p.y=y===W.Down?v.scrollTop-k.y:v.scrollTop-M.y,p.y&&v.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(t,$e(xt(h,this.referenceCoordinates),p))}}}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()}}ar.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=ir,onActivation:o}=t,{active:s}=n;const{code:c}=e.nativeEvent;if(r.start.includes(c)){const a=s.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function jn(e){return!!(e&&"distance"in e)}function Rn(e){return!!(e&&"delay"in e)}class an{constructor(t,n,r){var o;r===void 0&&(r=zo(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:s}=t,{target:c}=s;this.props=t,this.events=n,this.document=Le(c),this.documentListeners=new Ge(this.document),this.listeners=new Ge(r),this.windowListeners=new Ge(ae(c)),this.initialCoordinates=(o=Wt(s))!=null?o:pe,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(fe.Resize,this.handleCancel),this.windowListeners.add(fe.DragStart,Dn),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),this.windowListeners.add(fe.ContextMenu,Dn),this.documentListeners.add(fe.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Rn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(jn(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:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(fe.Click,Yo,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(fe.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:s}=this,{onMove:c,options:{activationConstraint:a}}=s;if(!o)return;const u=(n=Wt(t))!=null?n:pe,d=xt(o,u);if(!r&&a){if(jn(a)){if(a.tolerance!=null&&At(d,a.tolerance))return this.handleCancel();if(At(d,a.distance))return this.handleStart()}if(Rn(a)&&At(d,a.tolerance))return this.handleCancel();this.handlePending(a,d);return}t.cancelable&&t.preventDefault(),c(u)}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===W.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Bo={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class cn extends an{constructor(t){const{event:n}=t,r=Le(n.target);super(t,Bo,r)}}cn.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 Vo={move:{name:"mousemove"},end:{name:"mouseup"}};var Gt;(function(e){e[e.RightClick=2]="RightClick"})(Gt||(Gt={}));class Ho extends an{constructor(t){super(t,Vo,Le(t.event.target))}}Ho.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Gt.RightClick?!1:(r?.({event:n}),!0)}}];const Lt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Wo extends an{constructor(t){super(t,Lt)}static setup(){return window.addEventListener(Lt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Lt.move.name,t)};function t(){}}}Wo.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var qe;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(qe||(qe={}));var St;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(St||(St={}));function Uo(e){let{acceleration:t,activator:n=qe.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:c=5,order:a=St.TreeOrder,pointerCoordinates:u,scrollableAncestors:d,scrollableAncestorRects:g,delta:h,threshold:x}=e;const p=qo({delta:h,disabled:!s}),[b,v]=to(),y=f.useRef({x:0,y:0}),w=f.useRef({x:0,y:0}),E=f.useMemo(()=>{switch(n){case qe.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case qe.DraggableRect:return o}},[n,o,u]),T=f.useRef(null),I=f.useCallback(()=>{const M=T.current;if(!M)return;const A=y.current.x*w.current.x,L=y.current.y*w.current.y;M.scrollBy(A,L)},[]),k=f.useMemo(()=>a===St.TreeOrder?[...d].reverse():d,[a,d]);f.useEffect(()=>{if(!s||!d.length||!E){v();return}for(const M of k){if(r?.(M)===!1)continue;const A=d.indexOf(M),L=g[A];if(!L)continue;const{direction:V,speed:F}=$o(M,L,E,t,x);for(const D of["x","y"])p[D][V[D]]||(F[D]=0,V[D]=0);if(F.x>0||F.y>0){v(),T.current=M,b(I,c),y.current=F,w.current=V;return}}y.current={x:0,y:0},w.current={x:0,y:0},v()},[t,I,r,v,s,c,JSON.stringify(E),JSON.stringify(p),b,d,k,g,JSON.stringify(x)])}const Go={x:{[ee.Backward]:!1,[ee.Forward]:!1},y:{[ee.Backward]:!1,[ee.Forward]:!1}};function qo(e){let{delta:t,disabled:n}=e;const r=Ht(t);return et(o=>{if(n||!r||!o)return Go;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ee.Backward]:o.x[ee.Backward]||s.x===-1,[ee.Forward]:o.x[ee.Forward]||s.x===1},y:{[ee.Backward]:o.y[ee.Backward]||s.y===-1,[ee.Forward]:o.y[ee.Forward]||s.y===1}}},[n,t,r])}function Xo(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return et(o=>{var s;return t==null?null:(s=r??o)!=null?s:null},[r,t])}function Ko(e,t){return f.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,s=o.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,r)}));return[...n,...s]},[]),[e,t])}var Je;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Je||(Je={}));var qt;(function(e){e.Optimized="optimized"})(qt||(qt={}));const En=new Map;function Jo(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,c]=f.useState(null),{frequency:a,measure:u,strategy:d}=o,g=f.useRef(e),h=y(),x=Ke(h),p=f.useCallback(function(w){w===void 0&&(w=[]),!x.current&&c(E=>E===null?w:E.concat(w.filter(T=>!E.includes(T))))},[x]),b=f.useRef(null),v=et(w=>{if(h&&!n)return En;if(!w||w===En||g.current!==e||s!=null){const E=new Map;for(let T of e){if(!T)continue;if(s&&s.length>0&&!s.includes(T.id)&&T.rect.current){E.set(T.id,T.rect.current);continue}const I=T.node.current,k=I?new sn(u(I),I):null;T.rect.current=k,k&&E.set(T.id,k)}return E}return w},[e,s,n,h,u]);return f.useEffect(()=>{g.current=e},[e]),f.useEffect(()=>{h||p()},[n,h]),f.useEffect(()=>{s&&s.length>0&&c(null)},[JSON.stringify(s)]),f.useEffect(()=>{h||typeof a!="number"||b.current!==null||(b.current=setTimeout(()=>{p(),b.current=null},a))},[a,h,p,...r]),{droppableRects:v,measureDroppableContainers:p,measuringScheduled:s!=null};function y(){switch(d){case Je.Always:return!1;case Je.BeforeDragging:return n;default:return!n}}}function cr(e,t){return et(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Zo(e,t){return cr(e,t)}function Qo(e){let{callback:t,disabled:n}=e;const r=nn(t),o=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return f.useEffect(()=>()=>o?.disconnect(),[o]),o}function jt(e){let{callback:t,disabled:n}=e;const r=nn(t),o=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return f.useEffect(()=>()=>o?.disconnect(),[o]),o}function es(e){return new sn(Ne(e),e)}function Tn(e,t,n){t===void 0&&(t=es);const[r,o]=f.useState(null);function s(){o(u=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=u??n)!=null?d:null}const g=t(e);return JSON.stringify(u)===JSON.stringify(g)?u:g})}const c=Qo({callback(u){if(e)for(const d of u){const{type:g,target:h}=d;if(g==="childList"&&h instanceof HTMLElement&&h.contains(e)){s();break}}}}),a=jt({callback:s});return be(()=>{s(),e?(a?.observe(e),c?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),c?.disconnect())},[e]),r}function ts(e){const t=cr(e);return Qn(e,t)}const Mn=[];function ns(e){const t=f.useRef(e),n=et(r=>e?r&&r!==Mn&&e&&t.current&&e.parentNode===t.current.parentNode?r:on(e):Mn,[e]);return f.useEffect(()=>{t.current=e},[e]),n}function rs(e){const[t,n]=f.useState(null),r=f.useRef(e),o=f.useCallback(s=>{const c=It(s.target);c&&n(a=>a?(a.set(c,Ut(c)),new Map(a)):null)},[]);return f.useEffect(()=>{const s=r.current;if(e!==s){c(s);const a=e.map(u=>{const d=It(u);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,Ut(d)]):null}).filter(u=>u!=null);n(a.length?new Map(a):null),r.current=e}return()=>{c(e),c(s)};function c(a){a.forEach(u=>{const d=It(u);d?.removeEventListener("scroll",o)})}},[o,e]),f.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,c)=>$e(s,c),pe):sr(e):pe,[e,t])}function On(e,t){t===void 0&&(t=[]);const n=f.useRef(null);return f.useEffect(()=>{n.current=null},t),f.useEffect(()=>{const r=e!==pe;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?xt(e,n.current):pe}function os(e){f.useEffect(()=>{if(!Dt)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 ss(e,t){return f.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:s}=r;return n[o]=c=>{s(c,t)},n},{}),[e,t])}function lr(e){return f.useMemo(()=>e?Mo(e):null,[e])}const _n=[];function is(e,t){t===void 0&&(t=Ne);const[n]=e,r=lr(n?ae(n):null),[o,s]=f.useState(_n);function c(){s(()=>e.length?e.map(u=>rr(u)?r:new sn(t(u),u)):_n)}const a=jt({callback:c});return be(()=>{a?.disconnect(),c(),e.forEach(u=>a?.observe(u))},[e]),o}function as(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Qe(t)?t:e}function cs(e){let{measure:t}=e;const[n,r]=f.useState(null),o=f.useCallback(d=>{for(const{target:g}of d)if(Qe(g)){r(h=>{const x=t(g);return h?{...h,width:x.width,height:x.height}:x});break}},[t]),s=jt({callback:o}),c=f.useCallback(d=>{const g=as(d);s?.disconnect(),g&&s?.observe(g),r(g?t(g):null)},[t,s]),[a,u]=bt(c);return f.useMemo(()=>({nodeRef:a,rect:n,setRef:u}),[n,a,u])}const ls=[{sensor:cn,options:{}},{sensor:ar,options:{}}],us={current:{}},ht={draggable:{measure:Cn},droppable:{measure:Cn,strategy:Je.WhileDragging,frequency:qt.Optimized},dragOverlay:{measure:Ne}};class Xe 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 ds={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Xe,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:yt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ht,measureDroppableContainers:yt,windowRect:null,measuringScheduled:!1},fs={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:yt,draggableNodes:new Map,over:null,measureDroppableContainers:yt},Rt=f.createContext(fs),ur=f.createContext(ds);function hs(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Xe}}}function gs(e,t){switch(t.type){case Q.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Q.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 Q.DragEnd:case Q.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Q.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Xe(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case Q.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const c=new Xe(e.droppable.containers);return c.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:c}}}case Q.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Xe(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function ps(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=f.useContext(Rt),s=Ht(r),c=Ht(n?.id);return f.useEffect(()=>{if(!t&&!r&&s&&c!=null){if(!rn(s)||document.activeElement===s.target)return;const a=o.get(c);if(!a)return;const{activatorNode:u,node:d}=a;if(!u.current&&!d.current)return;requestAnimationFrame(()=>{for(const g of[u.current,d.current]){if(!g)continue;const h=oo(g);if(h){h.focus();break}}})}},[r,t,o,c,s]),null}function vs(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,s)=>s({transform:o,...r}),n):n}function ms(e){return f.useMemo(()=>({draggable:{...ht.draggable,...e?.draggable},droppable:{...ht.droppable,...e?.droppable},dragOverlay:{...ht.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function bs(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const s=f.useRef(!1),{x:c,y:a}=typeof o=="boolean"?{x:o,y:o}:o;be(()=>{if(!c&&!a||!t){s.current=!1;return}if(s.current||!r)return;const d=t?.node.current;if(!d||d.isConnected===!1)return;const g=n(d),h=Qn(g,r);if(c||(h.x=0),a||(h.y=0),s.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const x=er(d);x&&x.scrollBy({top:h.y,left:h.x})}},[t,c,a,r,n])}const dr=f.createContext({...pe,scaleX:1,scaleY:1});var Re;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Re||(Re={}));const fr=f.memo(function(t){var n,r,o,s;let{id:c,accessibility:a,autoScroll:u=!0,children:d,sensors:g=ls,collisionDetection:h=wo,measuring:x,modifiers:p,...b}=t;const v=f.useReducer(gs,void 0,hs),[y,w]=v,[E,T]=uo(),[I,k]=f.useState(Re.Uninitialized),M=I===Re.Initialized,{draggable:{active:A,nodes:L,translate:V},droppable:{containers:F}}=y,D=A!=null?L.get(A):null,U=f.useRef({initial:null,translated:null}),G=f.useMemo(()=>{var re;return A!=null?{id:A,data:(re=D?.data)!=null?re:us,rect:U}:null},[A,D]),$=f.useRef(null),[j,C]=f.useState(null),[O,_]=f.useState(null),N=Ke(b,Object.values(b)),z=tt("DndDescribedBy",c),m=f.useMemo(()=>F.getEnabled(),[F]),R=ms(x),{droppableRects:P,measureDroppableContainers:B,measuringScheduled:q}=Jo(m,{dragging:M,dependencies:[V.x,V.y],config:R.droppable}),X=Xo(L,A),H=f.useMemo(()=>O?Wt(O):null,[O]),K=Kr(),J=Zo(X,R.draggable.measure);bs({activeNode:A!=null?L.get(A):null,config:K.layoutShiftCompensation,initialRect:J,measure:R.draggable.measure});const Y=Tn(X,R.draggable.measure,J),se=Tn(X?X.parentElement:null),ne=f.useRef({activatorEvent:null,active:null,activeNode:X,collisionRect:null,collisions:null,droppableRects:P,draggableNodes:L,draggingNode:null,draggingNodeRect:null,droppableContainers:F,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),he=F.getNodeFor((n=ne.current.over)==null?void 0:n.id),xe=cs({measure:R.dragOverlay.measure}),Te=(r=xe.nodeRef.current)!=null?r:X,Me=M?(o=xe.rect)!=null?o:Y:null,un=!!(xe.nodeRef.current&&xe.rect),dn=ts(un?null:Y),Ot=lr(Te?ae(Te):null),Se=ns(M?he??X:null),ot=is(Se),st=vs(p,{transform:{x:V.x-dn.x,y:V.y-dn.y,scaleX:1,scaleY:1},activatorEvent:O,active:G,activeNodeRect:Y,containerNodeRect:se,draggingNodeRect:Me,over:ne.current.over,overlayNodeRect:xe.rect,scrollableAncestors:Se,scrollableAncestorRects:ot,windowRect:Ot}),fn=H?$e(H,V):null,hn=rs(Se),Vr=On(hn),Hr=On(hn,[Y]),Oe=$e(st,Vr),_e=Me?jo(Me,st):null,Pe=G&&_e?h({active:G,collisionRect:_e,droppableRects:P,droppableContainers:m,pointerCoordinates:fn}):null,gn=yo(Pe,"id"),[we,pn]=f.useState(null),Wr=un?st:$e(st,Hr),Ur=Co(Wr,(s=we?.rect)!=null?s:null,Y),_t=f.useRef(null),vn=f.useCallback((re,ce)=>{let{sensor:le,options:Ce}=ce;if($.current==null)return;const de=L.get($.current);if(!de)return;const ue=re.nativeEvent,ve=new le({active:$.current,activeNode:de,event:ue,options:Ce,context:ne,onAbort(te){if(!L.get(te))return;const{onDragAbort:me}=N.current,ye={id:te};me?.(ye),E({type:"onDragAbort",event:ye})},onPending(te,De,me,ye){if(!L.get(te))return;const{onDragPending:Ye}=N.current,je={id:te,constraint:De,initialCoordinates:me,offset:ye};Ye?.(je),E({type:"onDragPending",event:je})},onStart(te){const De=$.current;if(De==null)return;const me=L.get(De);if(!me)return;const{onDragStart:ye}=N.current,ze={activatorEvent:ue,active:{id:De,data:me.data,rect:U}};Ue.unstable_batchedUpdates(()=>{ye?.(ze),k(Re.Initializing),w({type:Q.DragStart,initialCoordinates:te,active:De}),E({type:"onDragStart",event:ze}),C(_t.current),_(ue)})},onMove(te){w({type:Q.DragMove,coordinates:te})},onEnd:ke(Q.DragEnd),onCancel:ke(Q.DragCancel)});_t.current=ve;function ke(te){return async function(){const{active:me,collisions:ye,over:ze,scrollAdjustedTranslate:Ye}=ne.current;let je=null;if(me&&Ye){const{cancelDrop:Fe}=N.current;je={activatorEvent:ue,active:me,collisions:ye,delta:Ye,over:ze},te===Q.DragEnd&&typeof Fe=="function"&&await Promise.resolve(Fe(je))&&(te=Q.DragCancel)}$.current=null,Ue.unstable_batchedUpdates(()=>{w({type:te}),k(Re.Uninitialized),pn(null),C(null),_(null),_t.current=null;const Fe=te===Q.DragEnd?"onDragEnd":"onDragCancel";if(je){const kt=N.current[Fe];kt?.(je),E({type:Fe,event:je})}})}}},[L]),Gr=f.useCallback((re,ce)=>(le,Ce)=>{const de=le.nativeEvent,ue=L.get(Ce);if($.current!==null||!ue||de.dndKit||de.defaultPrevented)return;const ve={active:ue};re(le,ce.options,ve)===!0&&(de.dndKit={capturedBy:ce.sensor},$.current=Ce,vn(le,ce))},[L,vn]),mn=Ko(g,Gr);os(g),be(()=>{Y&&I===Re.Initializing&&k(Re.Initialized)},[Y,I]),f.useEffect(()=>{const{onDragMove:re}=N.current,{active:ce,activatorEvent:le,collisions:Ce,over:de}=ne.current;if(!ce||!le)return;const ue={active:ce,activatorEvent:le,collisions:Ce,delta:{x:Oe.x,y:Oe.y},over:de};Ue.unstable_batchedUpdates(()=>{re?.(ue),E({type:"onDragMove",event:ue})})},[Oe.x,Oe.y]),f.useEffect(()=>{const{active:re,activatorEvent:ce,collisions:le,droppableContainers:Ce,scrollAdjustedTranslate:de}=ne.current;if(!re||$.current==null||!ce||!de)return;const{onDragOver:ue}=N.current,ve=Ce.get(gn),ke=ve&&ve.rect.current?{id:ve.id,rect:ve.rect.current,data:ve.data,disabled:ve.disabled}:null,te={active:re,activatorEvent:ce,collisions:le,delta:{x:de.x,y:de.y},over:ke};Ue.unstable_batchedUpdates(()=>{pn(ke),ue?.(te),E({type:"onDragOver",event:te})})},[gn]),be(()=>{ne.current={activatorEvent:O,active:G,activeNode:X,collisionRect:_e,collisions:Pe,droppableRects:P,draggableNodes:L,draggingNode:Te,draggingNodeRect:Me,droppableContainers:F,over:we,scrollableAncestors:Se,scrollAdjustedTranslate:Oe},U.current={initial:Me,translated:_e}},[G,X,Pe,_e,L,Te,Me,P,F,we,Se,Oe]),Uo({...K,delta:V,draggingRect:_e,pointerCoordinates:fn,scrollableAncestors:Se,scrollableAncestorRects:ot});const qr=f.useMemo(()=>({active:G,activeNode:X,activeNodeRect:Y,activatorEvent:O,collisions:Pe,containerNodeRect:se,dragOverlay:xe,draggableNodes:L,droppableContainers:F,droppableRects:P,over:we,measureDroppableContainers:B,scrollableAncestors:Se,scrollableAncestorRects:ot,measuringConfiguration:R,measuringScheduled:q,windowRect:Ot}),[G,X,Y,O,Pe,se,xe,L,F,P,we,B,Se,ot,R,q,Ot]),Xr=f.useMemo(()=>({activatorEvent:O,activators:mn,active:G,activeNodeRect:Y,ariaDescribedById:{draggable:z},dispatch:w,draggableNodes:L,over:we,measureDroppableContainers:B}),[O,mn,G,Y,w,z,L,we,B]);return f.createElement(Jn.Provider,{value:T},f.createElement(Rt.Provider,{value:Xr},f.createElement(ur.Provider,{value:qr},f.createElement(dr.Provider,{value:Ur},d)),f.createElement(ps,{disabled:a?.restoreFocus===!1})),f.createElement(go,{...a,hiddenTextDescribedById:z}));function Kr(){const re=j?.autoScrollEnabled===!1,ce=typeof u=="object"?u.enabled===!1:u===!1,le=M&&!re&&!ce;return typeof u=="object"?{...u,enabled:le}:{enabled:le}}}),xs=f.createContext(null),kn="button",ys="Draggable";function Ss(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=tt(ys),{activators:c,activatorEvent:a,active:u,activeNodeRect:d,ariaDescribedById:g,draggableNodes:h,over:x}=f.useContext(Rt),{role:p=kn,roleDescription:b="draggable",tabIndex:v=0}=o??{},y=u?.id===t,w=f.useContext(y?dr:xs),[E,T]=bt(),[I,k]=bt(),M=ss(c,t),A=Ke(n);be(()=>(h.set(t,{id:t,key:s,node:E,activatorNode:I,data:A}),()=>{const V=h.get(t);V&&V.key===s&&h.delete(t)}),[h,t]);const L=f.useMemo(()=>({role:p,tabIndex:v,"aria-disabled":r,"aria-pressed":y&&p===kn?!0:void 0,"aria-roledescription":b,"aria-describedby":g.draggable}),[r,p,v,y,b,g.draggable]);return{active:u,activatorEvent:a,activeNodeRect:d,attributes:L,isDragging:y,listeners:r?void 0:M,node:E,over:x,setNodeRef:T,setActivatorNodeRef:k,transform:w}}function ws(){return f.useContext(ur)}const Cs="Droppable",Ds={timeout:25};function js(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=tt(Cs),{active:c,dispatch:a,over:u,measureDroppableContainers:d}=f.useContext(Rt),g=f.useRef({disabled:n}),h=f.useRef(!1),x=f.useRef(null),p=f.useRef(null),{disabled:b,updateMeasurementsFor:v,timeout:y}={...Ds,...o},w=Ke(v??r),E=f.useCallback(()=>{if(!h.current){h.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{d(Array.isArray(w.current)?w.current:[w.current]),p.current=null},y)},[y]),T=jt({callback:E,disabled:b||!c}),I=f.useCallback((L,V)=>{T&&(V&&(T.unobserve(V),h.current=!1),L&&T.observe(L))},[T]),[k,M]=bt(I),A=Ke(t);return f.useEffect(()=>{!T||!k.current||(T.disconnect(),h.current=!1,T.observe(k.current))},[k,T]),f.useEffect(()=>(a({type:Q.RegisterDroppable,element:{id:r,key:s,disabled:n,node:k,rect:x,data:A}}),()=>a({type:Q.UnregisterDroppable,key:s,id:r})),[r]),f.useEffect(()=>{n!==g.current.disabled&&(a({type:Q.SetDroppableDisabled,id:r,key:s,disabled:n}),g.current.disabled=n)},[r,s,n,a]),{active:c,rect:x,isOver:u?.id===r,node:k,over:u,setNodeRef:M}}function Et(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Rs(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function at(e){return e!==null&&e>=0}function Es(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 Ts(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const ct={scaleX:1,scaleY:1},Ms=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:s,index:c}=e;const a=(t=n[o])!=null?t:r;if(!a)return null;const u=Os(n,c,o);if(c===o){const d=n[s];return d?{x:o<s?d.left+d.width-(a.left+a.width):d.left-a.left,y:0,...ct}:null}return c>o&&c<=s?{x:-a.width-u,y:0,...ct}:c<o&&c>=s?{x:a.width+u,y:0,...ct}:{x:0,y:0,...ct}};function Os(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return!r||!o&&!s?0:n<t?o?r.left-(o.left+o.width):s.left-(r.left+r.width):s?s.left-(r.left+r.width):r.left-(o.left+o.width)}const hr=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const s=Et(t,r,n),c=t[o],a=s[o];return!a||!c?null:{x:a.left-c.left,y:a.top-c.top,scaleX:a.width/c.width,scaleY:a.height/c.height}},lt={scaleX:1,scaleY:1},_s=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:s,overIndex:c}=e;const a=(t=s[n])!=null?t:r;if(!a)return null;if(o===n){const d=s[c];return d?{x:0,y:n<c?d.top+d.height-(a.top+a.height):d.top-a.top,...lt}:null}const u=ks(s,o,n);return o>n&&o<=c?{x:0,y:-a.height-u,...lt}:o<n&&o>=c?{x:0,y:a.height+u,...lt}:{x:0,y:0,...lt}};function ks(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return r?n<t?o?r.top-(o.top+o.height):s?s.top-(r.top+r.height):0:s?s.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const gr="Sortable",pr=f.createContext({activeIndex:-1,containerId:gr,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:hr,disabled:{draggable:!1,droppable:!1}});function vr(e){let{children:t,id:n,items:r,strategy:o=hr,disabled:s=!1}=e;const{active:c,dragOverlay:a,droppableRects:u,over:d,measureDroppableContainers:g}=ws(),h=tt(gr,n),x=a.rect!==null,p=f.useMemo(()=>r.map(M=>typeof M=="object"&&"id"in M?M.id:M),[r]),b=c!=null,v=c?p.indexOf(c.id):-1,y=d?p.indexOf(d.id):-1,w=f.useRef(p),E=!Es(p,w.current),T=y!==-1&&v===-1||E,I=Ts(s);be(()=>{E&&b&&g(p)},[E,p,b,g]),f.useEffect(()=>{w.current=p},[p]);const k=f.useMemo(()=>({activeIndex:v,containerId:h,disabled:I,disableTransforms:T,items:p,overIndex:y,useDragOverlay:x,sortedRects:Rs(p,u),strategy:o}),[v,h,I.draggable,I.droppable,T,p,y,u,x,o]);return f.createElement(pr.Provider,{value:k},t)}const $s=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Et(n,r,o).indexOf(t)},Is=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:s,newIndex:c,previousItems:a,previousContainerId:u,transition:d}=e;return!d||!r||a!==s&&o===c?!1:n?!0:c!==o&&t===u},As={duration:200,easing:"ease"},mr="transform",Ls=Ie.Transition.toString({property:mr,duration:0,easing:"linear"}),Ns={roleDescription:"sortable"};function Ps(e){let{disabled:t,index:n,node:r,rect:o}=e;const[s,c]=f.useState(null),a=f.useRef(n);return be(()=>{if(!t&&n!==a.current&&r.current){const u=o.current;if(u){const d=Ne(r.current,{ignoreTransform:!0}),g={x:u.left-d.left,y:u.top-d.top,scaleX:u.width/d.width,scaleY:u.height/d.height};(g.x||g.y)&&c(g)}}n!==a.current&&(a.current=n)},[t,n,r,o]),f.useEffect(()=>{s&&c(null)},[s]),s}function br(e){let{animateLayoutChanges:t=Is,attributes:n,disabled:r,data:o,getNewIndex:s=$s,id:c,strategy:a,resizeObserverConfig:u,transition:d=As}=e;const{items:g,containerId:h,activeIndex:x,disabled:p,disableTransforms:b,sortedRects:v,overIndex:y,useDragOverlay:w,strategy:E}=f.useContext(pr),T=zs(r,p),I=g.indexOf(c),k=f.useMemo(()=>({sortable:{containerId:h,index:I,items:g},...o}),[h,o,I,g]),M=f.useMemo(()=>g.slice(g.indexOf(c)),[g,c]),{rect:A,node:L,isOver:V,setNodeRef:F}=js({id:c,data:k,disabled:T.droppable,resizeObserverConfig:{updateMeasurementsFor:M,...u}}),{active:D,activatorEvent:U,activeNodeRect:G,attributes:$,setNodeRef:j,listeners:C,isDragging:O,over:_,setActivatorNodeRef:N,transform:z}=Ss({id:c,data:k,attributes:{...Ns,...n},disabled:T.draggable}),m=eo(F,j),R=!!D,P=R&&!b&&at(x)&&at(y),B=!w&&O,q=B&&P?z:null,H=P?q??(a??E)({rects:v,activeNodeRect:G,activeIndex:x,overIndex:y,index:I}):null,K=at(x)&&at(y)?s({id:c,items:g,activeIndex:x,overIndex:y}):I,J=D?.id,Y=f.useRef({activeId:J,items:g,newIndex:K,containerId:h}),se=g!==Y.current.items,ne=t({active:D,containerId:h,isDragging:O,isSorting:R,id:c,index:I,items:g,newIndex:Y.current.newIndex,previousItems:Y.current.items,previousContainerId:Y.current.containerId,transition:d,wasDragging:Y.current.activeId!=null}),he=Ps({disabled:!ne,index:I,node:L,rect:A});return f.useEffect(()=>{R&&Y.current.newIndex!==K&&(Y.current.newIndex=K),h!==Y.current.containerId&&(Y.current.containerId=h),g!==Y.current.items&&(Y.current.items=g)},[R,K,h,g]),f.useEffect(()=>{if(J===Y.current.activeId)return;if(J!=null&&Y.current.activeId==null){Y.current.activeId=J;return}const Te=setTimeout(()=>{Y.current.activeId=J},50);return()=>clearTimeout(Te)},[J]),{active:D,activeIndex:x,attributes:$,data:k,rect:A,index:I,newIndex:K,items:g,isOver:V,isSorting:R,isDragging:O,listeners:C,node:L,overIndex:y,over:_,setNodeRef:m,setActivatorNodeRef:N,setDroppableNodeRef:F,setDraggableNodeRef:j,transform:he??H,transition:xe()};function xe(){if(he||se&&Y.current.newIndex===I)return Ls;if(!(B&&!rn(U)||!d)&&(R||ne))return Ie.Transition.toString({...d,property:mr})}}function zs(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}}W.Down,W.Right,W.Up,W.Left;var ut={exports:{}},Nt={},dt={exports:{}},Pt={};var $n;function Ys(){if($n)return Pt;$n=1;var e=f;function t(h,x){return h===x&&(h!==0||1/h===1/x)||h!==h&&x!==x}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,c=e.useDebugValue;function a(h,x){var p=x(),b=r({inst:{value:p,getSnapshot:x}}),v=b[0].inst,y=b[1];return s(function(){v.value=p,v.getSnapshot=x,u(v)&&y({inst:v})},[h,p,x]),o(function(){return u(v)&&y({inst:v}),h(function(){u(v)&&y({inst:v})})},[h]),c(p),p}function u(h){var x=h.getSnapshot;h=h.value;try{var p=x();return!n(h,p)}catch{return!0}}function d(h,x){return x()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:a;return Pt.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,Pt}var zt={};var In;function Fs(){return In||(In=1,process.env.NODE_ENV!=="production"&&(function(){function e(p,b){return p===b&&(p!==0||1/p===1/b)||p!==p&&b!==b}function t(p,b){g||o.startTransition===void 0||(g=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var v=b();if(!h){var y=b();s(v,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),h=!0)}y=c({inst:{value:v,getSnapshot:b}});var w=y[0].inst,E=y[1];return u(function(){w.value=v,w.getSnapshot=b,n(w)&&E({inst:w})},[p,v,b]),a(function(){return n(w)&&E({inst:w}),p(function(){n(w)&&E({inst:w})})},[p]),d(v),v}function n(p){var b=p.getSnapshot;p=p.value;try{var v=b();return!s(p,v)}catch{return!0}}function r(p,b){return b()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=f,s=typeof Object.is=="function"?Object.is:e,c=o.useState,a=o.useEffect,u=o.useLayoutEffect,d=o.useDebugValue,g=!1,h=!1,x=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;zt.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:x,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),zt}var An;function xr(){return An||(An=1,process.env.NODE_ENV==="production"?dt.exports=Ys():dt.exports=Fs()),dt.exports}var Ln;function Bs(){if(Ln)return Nt;Ln=1;var e=f,t=xr();function n(d,g){return d===g&&(d!==0||1/d===1/g)||d!==d&&g!==g}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,c=e.useEffect,a=e.useMemo,u=e.useDebugValue;return Nt.useSyncExternalStoreWithSelector=function(d,g,h,x,p){var b=s(null);if(b.current===null){var v={hasValue:!1,value:null};b.current=v}else v=b.current;b=a(function(){function w(M){if(!E){if(E=!0,T=M,M=x(M),p!==void 0&&v.hasValue){var A=v.value;if(p(A,M))return I=A}return I=M}if(A=I,r(T,M))return A;var L=x(M);return p!==void 0&&p(A,L)?(T=M,A):(T=M,I=L)}var E=!1,T,I,k=h===void 0?null:h;return[function(){return w(g())},k===null?void 0:function(){return w(k())}]},[g,h,x,p]);var y=o(d,b[0],b[1]);return c(function(){v.hasValue=!0,v.value=y},[y]),u(y),y},Nt}var Yt={};var Nn;function Vs(){return Nn||(Nn=1,process.env.NODE_ENV!=="production"&&(function(){function e(d,g){return d===g&&(d!==0||1/d===1/g)||d!==d&&g!==g}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=f,n=xr(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,c=t.useEffect,a=t.useMemo,u=t.useDebugValue;Yt.useSyncExternalStoreWithSelector=function(d,g,h,x,p){var b=s(null);if(b.current===null){var v={hasValue:!1,value:null};b.current=v}else v=b.current;b=a(function(){function w(M){if(!E){if(E=!0,T=M,M=x(M),p!==void 0&&v.hasValue){var A=v.value;if(p(A,M))return I=A}return I=M}if(A=I,r(T,M))return A;var L=x(M);return p!==void 0&&p(A,L)?(T=M,A):(T=M,I=L)}var E=!1,T,I,k=h===void 0?null:h;return[function(){return w(g())},k===null?void 0:function(){return w(k())}]},[g,h,x,p]);var y=o(d,b[0],b[1]);return c(function(){v.hasValue=!0,v.value=y},[y]),u(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Yt}var Pn;function Hs(){return Pn||(Pn=1,process.env.NODE_ENV==="production"?ut.exports=Bs():ut.exports=Vs()),ut.exports}var Ws=Hs();const Xt=new WeakMap,Us=new WeakMap,wt={current:[]};let Ft=!1;const ft=new Set,zn=new Map;function yr(e){for(const t of e){if(wt.current.includes(t))continue;wt.current.push(t),t.recompute();const n=Us.get(t);if(n)for(const r of n){const o=Xt.get(r);o?.length&&yr(o)}}}function Gs(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function qs(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Xs(e){if(ft.add(e),!Ft)try{for(Ft=!0;ft.size>0;){const t=Array.from(ft);ft.clear();for(const n of t){const r=zn.get(n)??n.prevState;n.prevState=r,Gs(n)}for(const n of t){const r=Xt.get(n);r&&(wt.current.push(n),yr(r))}for(const n of t){const r=Xt.get(n);if(r)for(const o of r)qs(o)}}}finally{Ft=!1,wt.current=[],zn.clear()}}function Ks(e){return typeof e=="function"}class Sr{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var o,s;this.listeners.add(r);const c=(s=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:s.call(o,r,this);return()=>{this.listeners.delete(r),c?.()}},this.prevState=t,this.state=t,this.options=n}setState(t){var n,r,o;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(t):Ks(t)?this.state=t(this.prevState):this.state=t,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),Xs(this)}}function nt(e,t=r=>r,n={}){const r=n.equal??Js;return Ws.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,r)}function Js(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=Yn(e);if(n.length!==Yn(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function Yn(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}const ie=new Sr({tableId:"",sortColumn:null,sortDirection:"asc",visibility:{},columnOrder:[],data:[],sortableColumns:[],actionsConfig:{showActionColumn:!0,showColumnVisibilityMenu:!0,children:"Actions",width:"100px"}});function wr(e,t){const n=e[0]??{},o=(t&&t.length?t:Object.keys(n).map(g=>({id:g,label:g}))).filter(g=>Object.prototype.hasOwnProperty.call(n,g.id)),{tableId:s}=ie.state,c=JSON.parse(localStorage.getItem(jr(s))||"[]"),a=[...c.map(g=>o.find(h=>h.id===g)).filter(Boolean),...o.filter(g=>!c.includes(g.id))],u=JSON.parse(localStorage.getItem(Rr(s))||"{}"),d=a.reduce((g,h)=>(g[h.id]=u[h.id]??!0,g),{});ie.setState(g=>({...g,data:e,columnOrder:a,visibility:d,sortableColumns:a.map(h=>({id:h.id,label:h.label,sortable:!0,backgroundColor:h.backgroundColor}))}))}function Cr(e){ie.setState(t=>({...t,tableId:e,sortColumn:null,sortDirection:"asc",columnOrder:[],visibility:{}}))}const Dr=e=>{ie.setState(t=>({...t,actionsConfig:e}))},jr=e=>`table_column_order_v1:${e}`,Rr=e=>`table_column_visibility_v1:${e}`,Zs=e=>{const{tableId:t}=ie.state;localStorage.setItem(jr(t),JSON.stringify(e.map(n=>n.id))),ie.setState(n=>({...n,columnOrder:e})),ie.setState(n=>({...n,columnOrder:e}))};function Qs(e){ie.setState(t=>t.sortColumn===e?{...t,sortDirection:t.sortDirection==="asc"?"desc":"asc"}:{...t,sortColumn:e,sortDirection:"asc"})}const ei=e=>{ie.setState(t=>{const n={...t.visibility,[e]:!t.visibility[e]};return t.tableId&&localStorage.setItem(Rr(t.tableId),JSON.stringify(n)),{...t,visibility:n}})};const ti=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ni=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Fn=e=>{const t=ni(e);return t.charAt(0).toUpperCase()+t.slice(1)},Er=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),ri=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var oi={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const si=f.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:c,...a},u)=>f.createElement("svg",{ref:u,...oi,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Er("lucide",o),...!s&&!ri(a)&&{"aria-hidden":"true"},...a},[...c.map(([d,g])=>f.createElement(d,g)),...Array.isArray(s)?s:[s]]));const oe=(e,t)=>{const n=f.forwardRef(({className:r,...o},s)=>f.createElement(si,{ref:s,iconNode:t,className:Er(`lucide-${ti(Fn(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Fn(e),n};const ii=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ai=oe("arrow-down",ii);const ci=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],li=oe("arrow-up-down",ci);const ui=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],di=oe("arrow-up",ui);const fi=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],hi=oe("bookmark",fi);const gi=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Bn=oe("calendar",gi);const pi=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],vi=oe("chevron-left",pi);const mi=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],bi=oe("chevron-right",mi);const xi=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],yi=oe("columns-2",xi);const Si=[["path",{d:"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z",key:"1yo7s0"}],["path",{d:"m12 9 6 6",key:"anjzzh"}],["path",{d:"m18 9-6 6",key:"1fp51s"}]],wi=oe("delete",Si);const Ci=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Di=oe("ellipsis",Ci);const ji=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Ri=oe("funnel",ji);const Ei=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Tr=oe("grip-vertical",Ei);const Ti=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],Mi=oe("pen",Ti);const Oi=[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]],_i=oe("refresh-ccw",Oi);const ki=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],$i=oe("settings",ki);const Ii=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Mr=oe("triangle-alert",Ii);function S(e){return f.forwardRef((t,n)=>{const{children:r,...o}=t;return i.jsx(e,{ref:n,...o,children:r})})}const Ai=S(l.Menu.Trigger),Li=S(l.Menu.Positioner),Ni=S(l.Menu.Content),Pi=S(l.Menu.Item),zi=S(l.Checkbox.Label),Yi=S(l.Checkbox.HiddenInput),Fi=S(l.Checkbox.Control);function Bi({visibility:e,onToggle:t}){const{sortableColumns:n}=nt(ie);return i.jsxs(l.Menu.Root,{closeOnSelect:!1,children:[i.jsx(Ai,{asChild:!0,children:i.jsx(l.IconButton,{"aria-label":"Toggle columns",variant:"ghost",ml:"1",size:"xs",children:i.jsx(yi,{size:18})})}),i.jsx(l.Portal,{children:i.jsx(Li,{children:i.jsx(Ni,{minW:"220px",children:n.map(r=>{const o=!!e[r.id];return i.jsx(Pi,{value:r.id,closeOnSelect:!1,children:i.jsxs(l.Checkbox.Root,{checked:o,onCheckedChange:()=>t(r.id),children:[i.jsx(Yi,{}),i.jsx(Fi,{}),i.jsx(zi,{children:r.label})]})},r.id)})})})})]})}function Vi({id:e,children:t,onClick:n,cursor:r,borderRight:o,borderRightColor:s,backgroundColor:c}){const{setNodeRef:a,attributes:u,listeners:d,transform:g,transition:h}=br({id:e});return i.jsx(l.Table.ColumnHeader,{ref:a,onClick:n,backgroundColor:c,w:e==="id"||e==="row_number"?"80px":void 0,style:{transform:Ie.Transform.toString(g),transition:h,cursor:r,borderRight:o,borderRightColor:s},...u,children:i.jsxs(l.HStack,{justify:"space-between",children:[t,i.jsx("span",{...d,children:i.jsx(Tr,{size:12})})]})})}function Hi(){const{columnOrder:e,visibility:t,sortColumn:n,sortDirection:r,sortableColumns:o,actionsConfig:s}=nt(ie),c=e.map(a=>o.find(u=>u.id===a.id)).filter(a=>a!==void 0).filter(a=>t[a.id]);return i.jsx(l.Table.Header,{background:"blue.200",position:"sticky",top:0,p:"0",zIndex:1,children:i.jsxs(l.Table.Row,{height:"28px",children:[c.map(a=>{const u=n===a?.id;return i.jsx(Vi,{id:a?.id,onClick:()=>a?.sortable&&Qs(a?.id),cursor:a?.sortable?"pointer":"default",borderRight:"2px solid #dcdcdc",backgroundColor:a?.backgroundColor,children:i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,userSelect:"none"},children:[a?.label,a?.sortable&&(u?r==="asc"?i.jsx(di,{size:14}):i.jsx(ai,{size:14}):i.jsx(li,{size:14,opacity:.4}))]})},a?.id)}),s?.showActionColumn&&i.jsx(l.Table.ColumnHeader,{width:s.width,backgroundColor:s.backgroundColor,borderRight:"2px solid #dcdcdc",children:s.children}),s?.showColumnVisibilityMenu&&i.jsx(l.Table.ColumnHeader,{boxSize:"0.5",backgroundColor:s.backgroundColorColumnVisibilityMenu,children:i.jsx(Bi,{visibility:t,onToggle:ei})})]})})}const Wi=[10,20,50,100],Ui=S(l.Select.Positioner),Gi=S(l.Select.Content),qi=S(l.Select.Item),Xi=S(l.Pagination.PrevTrigger),Ki=S(l.Pagination.NextTrigger),Ji=S(l.Select.HiddenSelect),Zi=S(l.Select.Control),Qi=S(l.Select.Trigger),ea=S(l.Select.ValueText),ta=S(l.Select.IndicatorGroup),na=S(l.Select.Indicator);function ra({totalCount:e,pageSize:t,currentPage:n,onPageChange:r,onPageSizeChange:o,siblingCount:s=2,pageSizeOptions:c=Wi}){const a=l.createListCollection({items:c.map(u=>({label:String(u),value:String(u)}))});return i.jsx(l.Box,{width:"100%",children:i.jsxs(l.HStack,{justify:"space-between",mx:"auto",flexWrap:"wrap",children:[i.jsxs(l.HStack,{children:[i.jsx(l.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:"Rows per page:"}),i.jsxs(l.Select.Root,{collection:a,size:"sm",width:"60px",onValueChange:u=>o?.(Number(u.items[0].value)),value:[String(t)],children:[i.jsx(Ji,{}),i.jsxs(Zi,{children:[i.jsx(Qi,{children:i.jsx(ea,{placeholder:""})}),i.jsx(ta,{children:i.jsx(na,{})})]}),i.jsx(l.Portal,{children:i.jsx(Ui,{children:i.jsx(Gi,{children:a.items.map(u=>i.jsxs(qi,{item:u.value,children:[u.label,i.jsx(l.Select.ItemIndicator,{})]},u.value))})})})]})]}),i.jsx(l.Pagination.Root,{count:e,pageSize:t,page:n,siblingCount:s,onPageChange:u=>r&&r(u.page),children:i.jsxs(l.ButtonGroup,{size:"sm",variant:"ghost",children:[i.jsx(Xi,{asChild:!0,children:i.jsx(l.IconButton,{"aria-label":"Previous page",children:i.jsx(vi,{size:18})})}),i.jsx(l.Pagination.Items,{render:u=>i.jsx(l.IconButton,{variant:u.type==="page"&&u.value===n?"outline":"ghost","aria-current":u.type==="page"&&u.value===n?"page":void 0,children:u.type==="page"?u.value:"…"},u.value??u.type)}),i.jsx(Ki,{asChild:!0,children:i.jsx(l.IconButton,{"aria-label":"Next page",children:i.jsx(bi,{size:18})})})]})})]})})}const oa=S(l.Menu.Item),sa=S(l.Menu.Content),ia=S(l.Menu.Positioner),aa=S(l.Menu.Trigger);function ca({data:e=[],actions:t=[],actionConfig:n,onRowSelect:r}){const{columnOrder:o,visibility:s}=nt(ie);return i.jsx(l.Table.Body,{children:e.map(c=>i.jsxs(l.Table.Row,{onClick:()=>r?.(c.__raw),_hover:{bg:"blue.50"},children:[o.filter(a=>s[a.id]).map(a=>i.jsx(l.Table.Cell,{children:c[a.id]},a.id)),n?.showActionColumn&&i.jsx(l.Table.Cell,{textAlign:"center",display:"flex",gap:2,children:i.jsxs(l.Menu.Root,{children:[i.jsx(aa,{asChild:!0,children:i.jsx(l.IconButton,{"aria-label":"Open",variant:"ghost",size:"sm",children:i.jsx(Di,{size:16})})}),i.jsx(l.Portal,{children:i.jsx(ia,{children:i.jsx(sa,{children:t.filter(a=>typeof a.visible=="function"?a.visible(c.__raw):a.visible!==!1).map(a=>i.jsxs(oa,{onClick:()=>a.onClick(c.__raw),colorScheme:a.colorScheme,value:a.label,children:[a.icon,a.label]},a.label))})})})]})}),n?.showColumnVisibilityMenu&&i.jsx(l.Table.Cell,{})]},c.__key||c.id))})}function la({rows:e=6,columns:t}){return i.jsx(l.Table.Body,{children:Array.from({length:e}).map((n,r)=>i.jsx(l.Table.Row,{children:Array.from({length:t}).map((o,s)=>i.jsx(l.Table.Cell,{children:i.jsx(l.Skeleton,{height:"25px"})},s))},r))})}function ua({tableId:e,data:t=[],headers:n=[],loading:r=!1,loadingChildren:o,skeletonLoading:s=!1,emptyMessage:c="No data",actions:a,page:u=1,pageSize:d=10,onPageChange:g,onPageSizeChange:h,density:x="sm",totalCount:p=0,paginationMode:b="client",actionConfig:v,pageSizeOptions:y,onRowSelect:w}){f.useEffect(()=>{Cr(e)},[e]),f.useEffect(()=>{wr(t,n)},[t,n]),f.useEffect(()=>{v&&Dr(v)},[v]);const{sortColumn:E,sortDirection:T,data:I,columnOrder:k}=nt(ie),M=f.useMemo(()=>{const D=[...I],U=Math.max(1,u||1);if(E&&D.sort((G,$)=>T==="asc"?String(G[E]).localeCompare(String($[E])):String($[E]).localeCompare(String(G[E]))),b==="client"){const G=(U-1)*d;return D.slice(G,G+d)}return D},[I,E,T,u,d,b]);f.useEffect(()=>{u<1&&g&&g(1)},[u,g]);const A=D=>{const{active:U,over:G}=D;if(!G||U.id===G.id)return;const $=k.findIndex(O=>O.id===U.id),j=k.findIndex(O=>O.id===G.id),C=Et(k,$,j);Zs(C)},L=r&&!s,V=s&&!r,F=!r&&!s&&M.length===0;return i.jsx(fr,{collisionDetection:Zn,onDragEnd:A,children:i.jsx(vr,{items:k.map(D=>D.id),strategy:Ms,children:i.jsxs(l.Box,{flex:"1",minH:0,display:"flex",flexDirection:"column",p:2,children:[i.jsxs(l.Box,{flex:"1",minH:0,position:"relative",overflow:"auto",children:[L&&i.jsx(l.Box,{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,bg:"whiteAlpha.600",children:o??i.jsx(l.Spinner,{})}),i.jsxs(l.Table.Root,{variant:"outline",w:"100%",size:x,children:[i.jsx(Hi,{}),V?i.jsx(la,{rows:d,columns:n.length+(a?2:0)}):F?i.jsx(l.Table.Body,{children:i.jsx(l.Table.Row,{children:i.jsx(l.Table.Cell,{colSpan:n.length+(a?1:0),children:i.jsx(l.Box,{display:"flex",alignItems:"center",justifyContent:"center",minH:"200px",color:"gray.500",children:c})})})}):i.jsx(ca,{data:M,actions:a,actionConfig:v,onRowSelect:w})]})]}),i.jsx(l.Box,{mt:.5,children:i.jsx(ra,{totalCount:p,pageSize:d,currentPage:u,onPageChange:g,onPageSizeChange:D=>{h?.(D),u>1&&g?.(1)},pageSizeOptions:y})})]})})})}const da=S(l.Checkbox.Root),fa=S(l.Checkbox.HiddenInput),ha=S(l.Checkbox.Control),ga=S(l.Checkbox.Label),Or=({value:e,onChange:t,size:n="sm",label:r,helperText:o,isDisabled:s,required:c,errorText:a})=>i.jsxs(da,{value:e,onChange:t,size:n,children:[i.jsx(fa,{}),i.jsx(ha,{disabled:s,required:c,errorText:a,helperText:o}),r&&i.jsx(ga,{children:r})]}),pa=S(l.Combobox.Root),va=S(l.Combobox.Control),ma=S(l.Combobox.Input),ba=S(l.Combobox.IndicatorGroup),xa=S(l.Combobox.ClearTrigger),ya=S(l.Combobox.Trigger),Sa=S(l.Combobox.Positioner),wa=S(l.Combobox.Content);function _r({label:e,size:t="sm",width:n="100%",variant:r="outline",items:o=[],itemToString:s,itemToValue:c,renderItem:a,value:u,loading:d,error:g,errorMessage:h,placeholder:x,helpText:p,onInputChange:b,onSelect:v,visible:y=!0,rootProps:w,inputProps:E,controlProps:T,contentProps:I,itemProps:k}){const[M,A]=f.useState(""),{collection:L,set:V}=l.useListCollection({initialItems:o,itemToString:s,itemToValue:c}),F=f.useMemo(()=>{if(!M)return o;const D=M.toLowerCase();return o.filter(U=>s(U).toLowerCase().includes(D))},[o,M,s]);return f.useEffect(()=>{V(F)},[F,V]),f.useEffect(()=>{u&&A(s(u))},[u,s]),i.jsxs(pa,{width:n,size:t,variant:r,collection:L,placeholder:x,onInputValueChange:D=>{b?.(D.inputValue),A(D.inputValue)},value:u?[c(u)]:[],onValueChange:D=>{const U=D.value?.[0];if(!U)return;const G=L.items.find($=>c($)===U);G&&v?.(G)},positioning:{sameWidth:!1,placement:"bottom-start"},...w,children:[y&&e&&i.jsx(l.Text,{fontSize:"sm",children:e}),i.jsxs(va,{...T,children:[i.jsx(ma,{placeholder:x??"Type to search",...E}),i.jsxs(ba,{children:[i.jsx(xa,{}),i.jsx(ya,{})]})]}),i.jsx(Sa,{children:i.jsxs(wa,{minW:"sm",...I,children:[d?i.jsxs(l.HStack,{p:"2",children:[i.jsx(l.Spinner,{size:"xs",borderWidth:"1px"}),i.jsx(l.Span,{children:"Loading..."})]}):g?i.jsx(l.Text,{p:"2",color:"red.500",fontSize:"sm",children:h||"Something went wrong"}):L.items.map(D=>i.jsxs(l.Combobox.Item,{item:D,...k,children:[a(D),i.jsx(l.Combobox.ItemIndicator,{})]},c(D))),p&&!g&&!d&&i.jsx(l.Text,{p:"2",color:"fg.muted",fontSize:"sm",children:p})]})})]})}const Z=" to ",Vn=10,Ee={DAY_MAX:31,MONTH_MAX:12,YEAR_MIN:1900,YEAR_MAX:2100},ln=()=>{const e=new Date;return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}},Hn=()=>{const{year:e,month:t,day:n}=ln();return`${String(n).padStart(2,"0")}-${String(t).padStart(2,"0")}-${e}`},Ca=()=>{const{year:e,month:t,day:n}=ln();return`${e}-${String(t).padStart(2,"0")}-${String(n).padStart(2,"0")}`},Da=(e,t)=>{const n=e.length,r=parseInt(e);if(!e||isNaN(r))return t;if(n===4)return r>=Ee.YEAR_MIN&&r<=Ee.YEAR_MAX?r:t;if(n>0&&n<4){const o=t.toString(),s=4-n,c=o.substring(0,s);return parseInt(c+e)}return t},He=e=>{if(!e?.trim())return null;const n=e.replace(/[^\d-]/g,"").split("-").filter(d=>d!=="");if(n.length===0)return null;const{year:r,month:o,day:s}=ln();let c,a,u;return n.length===1?(c=parseInt(n[0])||s,a=o,u=r):n.length===2?(c=parseInt(n[0])||s,a=parseInt(n[1])||o,u=r):(c=parseInt(n[0])||s,a=parseInt(n[1])||o,u=Da(n[2],r)),a=Math.max(1,Math.min(Ee.MONTH_MAX,a)),c=Math.max(1,Math.min(Ee.DAY_MAX,c)),`${u}-${String(a).padStart(2,"0")}-${String(c).padStart(2,"0")}`},ge=e=>{if(!e)return"";const[t,n,r]=e.split("-");return`${r}-${n}-${t}`},ja=(e,t)=>{if(e[0]?.length>0){const n=parseInt(e[0]);if(isNaN(n)||n===0||e[0].length===2&&n>Ee.DAY_MAX)return t}if(e[1]?.length>0){const n=parseInt(e[1]);if(isNaN(n)||n===0||e[1].length===2&&n>Ee.MONTH_MAX)return t}if(e[2]?.length>0){const n=parseInt(e[2]),r=e[2].length===4;if(isNaN(n)||n===0||r&&(n<Ee.YEAR_MIN||n>Ee.YEAR_MAX))return t}return null},We=e=>{let t=e.replace(/[^\d-]/g,"").substring(0,Vn);if(t.length>=3&&t[2]!=="-"&&(t=t.substring(0,2)+"-"+t.substring(2).replace(/-/g,"")),t.length>=6&&t[5]!=="-"){const o=t.split("-");o.length>=2&&(t=`${o[0]}-${o[1].substring(0,2)}-${o[1].substring(2)}${o[2]||""}`)}const n=t.split("-");return n[0]=n[0]?.substring(0,2)||"",n[1]=n[1]?.substring(0,2)||"",n[2]=n[2]?.substring(0,4)||"",t=n.filter(o=>o!=="").join("-"),t=t.substring(0,Vn),ja(n,e)||t},Ra=S(l.Popover.Root),Ea=S(l.Popover.Trigger),Ta=S(l.Popover.Content),Ma=S(l.Popover.Positioner);function Oa({value:e,onChange:t,disabled:n=!1}){const[r="",o=""]=e?e.split("|"):[],[s,c]=f.useState(()=>r&&o?`${ge(r)}${Z}${ge(o)}`:r?ge(r):""),[a,u]=f.useState(!1),d=f.useRef(null);f.useEffect(()=>{const b=v=>{v.ctrlKey&&v.key==="d"&&!v.shiftKey&&!v.metaKey&&(v.preventDefault(),d.current?.focus())};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[]);const g=b=>{let v=b;if(v.includes(Z)){const[y,w=""]=v.split(Z);v=`${We(y.trim())}${Z}${We(w.trim())}`}else if(v.toLowerCase().includes(" to ")){const[y,w=""]=v.split(/\s+to\s+/i);v=`${We(y.trim())} to ${We(w.trim())}`}else v=We(v);c(v)},h=()=>{const b=s.trim();if(!b){t(void 0);return}if(b.includes(Z)){const[v,y=""]=b.split(Z).map(T=>T.trim()),w=He(v),E=y?He(y):null;if(w&&E){const[T,I]=E<w?[E,w]:[w,E],k=`${ge(T)}${Z}${ge(I)}`;c(k),t(`${T}|${I}`)}else if(w&&!y)c(`${ge(w)}${Z}`),t(void 0);else if(w&&y){const T=Ca(),[I,k]=T<w?[T,w]:[w,T],M=`${ge(I)}${Z}${ge(k)}`;c(M),t(`${I}|${k}`)}else c(""),t(void 0)}else{const v=He(b);v?(c(`${ge(v)}${Z}`),t(void 0)):(c(""),t(void 0))}},x=b=>{if(b.key!=="Enter")return;b.preventDefault();const v=d.current?.selectionStart||0,y=s.indexOf(Z);if(!s.trim()){c(`${Hn()}${Z}`);return}if(y===-1){const E=He(s.trim());E&&c(`${ge(E)}${Z}`);return}if(v<=y+Z.length){const E=s.substring(0,y).trim(),T=s.substring(y+Z.length),I=He(E);I&&c(`${ge(I)}${Z}${T}`);return}if(s.substring(y+Z.length).trim())h(),d.current?.blur();else{const E=s.substring(0,y+Z.length)+Hn();c(E),setTimeout(()=>{h(),d.current?.blur()},0)}},p=()=>{c(""),t(void 0)};return i.jsx(l.InputGroup,{children:i.jsx(i.Fragment,{children:i.jsxs(l.InputElement,{position:"revert",children:[i.jsxs(Ra,{open:a,onEscapeKeyDown:()=>{u(!1)},children:[i.jsx(Ea,{asChild:!0,children:i.jsx(l.IconButton,{size:"sm",variant:"ghost","aria-label":"Date range help",onClick:()=>u(b=>!b),children:i.jsx(Bn,{size:16})})}),i.jsx(l.Portal,{children:i.jsx(Ma,{children:i.jsxs(Ta,{p:4,children:[i.jsx(l.PopoverArrow,{}),i.jsxs(l.VStack,{align:"start",gap:4,children:[i.jsxs(l.HStack,{children:[i.jsx(Bn,{size:16}),i.jsx(l.Text,{fontWeight:"semibold",fontSize:"sm",children:"Date Range Filter"})]}),i.jsxs(l.VStack,{align:"start",gap:1,children:[i.jsx(l.Text,{fontSize:"sm",fontWeight:"medium",children:"Format:"}),i.jsxs(l.Text,{fontSize:"xs",color:"gray.600",children:["DD-MM-YYYY",Z,"DD-MM-YYYY"]})]}),i.jsxs(l.VStack,{align:"start",gap:1,children:[i.jsx(l.Text,{fontSize:"sm",fontWeight:"medium",children:"Tips:"}),i.jsx(l.Text,{fontSize:"xs",children:'• "15 to 20" → assumes current month/year'}),i.jsx(l.Text,{fontSize:"xs",children:"• Leave end blank → up to today"}),i.jsx(l.Text,{fontSize:"xs",children:"• Dates auto-swapped if reversed"}),i.jsx(l.Text,{fontSize:"xs",children:"• Press Enter on empty end → fills today"})]}),i.jsxs(l.VStack,{align:"start",gap:1,children:[i.jsx(l.Text,{fontSize:"sm",fontWeight:"medium",children:"Shortcut:"}),i.jsxs(l.HStack,{children:[i.jsx(l.Kbd,{children:"Ctrl"}),i.jsx(l.Text,{children:"+"}),i.jsx(l.Kbd,{children:"D"})]})]})]})]})})})]}),i.jsx(l.Input,{ref:d,placeholder:"15-06-2025 to 20-06-2025",value:s,size:"sm",disabled:n,onChange:b=>g(b.target.value),onBlur:h,onKeyDown:x,pr:s?"10":void 0,w:"100%"}),s&&i.jsx(l.InputElement,{children:i.jsx(l.IconButton,{size:"sm",variant:"ghost","aria-label":"Clear date range",onClick:p,w:"100%"})})]})})})}const _a=S(l.Field.Root),ka=S(l.Field.Label),$a=S(l.Field.HelperText),Ia=S(l.Field.ErrorText),Kt=({icon:e,value:t,onChange:n,placeholder:r,size:o="xs",variant:s="outline",width:c="100%",label:a,helperText:u,isDisabled:d=!1,required:g=!1,errorText:h,visible:x})=>i.jsxs(_a,{width:c,children:[x&&i.jsx(ka,{children:a}),i.jsx(l.InputGroup,{startElement:e,children:i.jsx(l.Input,{value:t,onChange:p=>n?.(p.target.value),placeholder:r,size:o,variant:s,disabled:d,required:g})}),h&&i.jsx(Ia,{fontSize:"xs",children:h}),u&&i.jsx($a,{fontSize:"xs",children:u})]}),Aa=S(l.Field.Root),La=S(l.Field.HelperText),Na=S(l.Field.ErrorText),Pa=S(l.Select.Root),za=S(l.Select.Label),Ya=S(l.Select.Control),Fa=S(l.Select.Trigger),Ba=S(l.Select.ValueText),Va=S(l.Select.IndicatorGroup),Ha=S(l.Select.Indicator),Wa=S(l.Select.Content),Ua=S(l.Select.Item),Ga=S(l.Select.ItemIndicator),qa=S(l.Select.HiddenSelect),Xa=S(l.Select.Positioner),kr=({options:e=[],label:t,value:n,onChange:r,placeholder:o,size:s="xs",width:c="100%",variant:a="outline",helperText:u,isDisabled:d,required:g,errorText:h,visible:x})=>{const p=l.createListCollection({items:e});return i.jsxs(Aa,{disabled:d,required:g,children:[i.jsxs(Pa,{collection:p,variant:a,size:s,width:c,value:n?[n]:[],onValueChange:b=>r?.(b.value[0]),children:[i.jsx(qa,{}),x&&i.jsx(za,{children:t}),i.jsxs(Ya,{children:[i.jsx(Fa,{children:i.jsx(Ba,{placeholder:o})}),i.jsx(Va,{children:i.jsx(Ha,{})})]}),i.jsx(Xa,{children:i.jsx(Wa,{children:p.items.map(b=>i.jsxs(Ua,{item:b,children:[b.label,i.jsx(Ga,{})]},b.value))})})]}),u&&i.jsx(La,{children:u}),h&&i.jsx(Na,{children:h})]})},$r=(e="default")=>`FILTER_PRESETS_${e}`,Ka=e=>{if(!e)return[];try{return JSON.parse(e)}catch{return[]}},Ja=e=>typeof window>"u"?[]:Ka(localStorage.getItem($r(e))),Ze=new Sr({}),rt=e=>{const t=Ze.state;if(e in t)return t[e];const n=Ja(e);return Ze.setState(r=>({...r,[e]:n})),n},Tt=(e,t)=>{Ze.setState(n=>({...n,[e]:t})),typeof window<"u"&&localStorage.setItem($r(e),JSON.stringify(t))},Ir=(e,t)=>{const n=[t,...rt(e)];Tt(e,n)},Ar=(e,t)=>{const n=rt(e).filter(r=>r.id!==t);Tt(e,n)},Za=(e,t,n)=>{const r=rt(e).map(o=>o.id===t?n(o):o);Tt(e,r)},Qa=S(l.Checkbox.Root),ec=S(l.Checkbox.HiddenInput),tc=S(l.Checkbox.Control),nc=S(l.Slider.Root),rc=S(l.Slider.Track),oc=S(l.Slider.Range),sc=S(l.Slider.Thumbs),ic=S(l.Slider.Control),ac=({filter:e,onVisibilityChange:t,onSizeChange:n})=>{const{attributes:r,listeners:o,setNodeRef:s,transform:c,transition:a}=br({id:e.id}),u={transform:Ie.Transform.toString(c),transition:a};return i.jsxs(l.VStack,{ref:s,style:u,align:"stretch",border:"1px solid",borderColor:"gray.200",rounded:"md",p:3,mb:3,bg:"white",children:[i.jsxs(l.HStack,{...r,...o,cursor:"grab",userSelect:"none",gap:2,children:[i.jsx(Tr,{size:16}),i.jsx(l.Text,{fontWeight:"bold",fontSize:"sm",children:e.label||e.id})]}),i.jsxs(l.HStack,{justify:"space-between",children:[i.jsx(l.Text,{fontSize:"sm",children:"Visible"}),i.jsxs(Qa,{checked:e.visible,size:"sm",onCheckedChange:d=>t?.(e.id,!!d.checked),children:[i.jsx(ec,{}),i.jsx(tc,{})]})]}),i.jsxs(l.VStack,{align:"stretch",gap:1,children:[i.jsx(l.Text,{fontSize:"sm",children:"Size"}),i.jsx(nc,{min:1,max:5,step:.5,value:[e.size??1],onValueChange:d=>n?.(e.id,d.value[0]),children:i.jsxs(ic,{children:[i.jsx(rc,{children:i.jsx(oc,{})}),i.jsx(sc,{})]})})]})]})},cc=S(l.Drawer.Root),lc=S(l.Drawer.Trigger),uc=S(l.Drawer.Backdrop),dc=S(l.Drawer.Positioner),fc=S(l.Drawer.Content),hc=S(l.Drawer.Header),gc=S(l.Drawer.Title),pc=S(l.Drawer.Body),vc=S(l.Drawer.Footer),mc=S(l.Drawer.CloseTrigger),bc=S(l.Tabs.Root),xc=S(l.Tabs.List),Bt=S(l.Tabs.Trigger),Vt=S(l.Tabs.Content),Lr=(e,t)=>{if(e.customComponent)return e.customComponent;switch(e.type){case"text":return i.jsx(Kt,{placeholder:e.label,value:e.value,onChange:e.onChange,label:e.label,visible:t});case"number":return i.jsx(Kt,{label:e.label,value:e.value,onChange:e.onChange});case"checkbox":return i.jsx(Or,{label:e.label,value:e.value,onChange:e.onChange});case"select":return i.jsx(kr,{label:e.label,value:e.value,onChange:e.onChange,options:e.options??[],visible:t,placeholder:e.placeholder});case"date":return i.jsx(Oa,{value:e.value,onChange:e.onChange});case"combobox":return i.jsx(_r,{visible:!0,label:e.label,items:e.options,itemToString:n=>n.label,itemToValue:n=>n.value,renderItem:n=>i.jsx("span",{children:n.label})});default:return null}},yc=({filterDrawerSize:e="sm",onVisibilityChange:t,onSizeChange:n,onClear:r,filters:o,pageKey:s="default",onLoadPreset:c,activePresetName:a,onReorder:u,open:d,onOpenChange:g})=>{const x=nt(Ze)[s]??rt(s),p=()=>{const b=prompt("Preset name?");if(!b)return;const v=o.reduce((y,w)=>(y[w.id]=w.value,y),{});Ir(s,{id:crypto.randomUUID(),name:b,date:new Date().toISOString(),values:v})};return i.jsx(l.HStack,{wrap:"wrap",children:i.jsxs(cc,{size:e,open:d,onOpenChange:g,children:[i.jsx(lc,{asChild:!0,children:i.jsxs(l.IconButton,{"aria-label":"Open filters",variant:"outline",size:"xs",ml:2,p:2,children:[i.jsx(Ri,{size:16}),"Filters"]})}),i.jsxs(l.Portal,{children:[i.jsx(uc,{}),i.jsx(dc,{children:i.jsxs(fc,{children:[i.jsx(hc,{children:i.jsx(gc,{children:"Filters"})}),i.jsx(pc,{overflowY:"auto",pt:1,children:i.jsxs(bc,{defaultValue:"view",children:[i.jsxs(xc,{mb:4,children:[i.jsxs(Bt,{value:"view",children:[i.jsx(Mi,{size:16}),"Edit"]}),i.jsxs(Bt,{value:"settings",children:[i.jsx($i,{size:16}),"Settings"]}),i.jsxs(Bt,{value:"presets",children:[i.jsx(hi,{size:16}),"Presets"]})]}),i.jsx(Vt,{value:"view",children:o.filter(b=>b.visible).map(b=>i.jsx(l.VStack,{align:"stretch",border:"1px solid",borderColor:"gray.200",flex:b.size??1,minW:`${(b.size??1)*100}px`,rounded:"md",p:3,mb:3,children:Lr(b,d)},b.id))}),i.jsx(Vt,{value:"settings",children:i.jsx(fr,{sensors:vo(po(cn)),collisionDetection:Zn,onDragEnd:({active:b,over:v})=>{if(!v||b.id===v.id)return;const y=o.findIndex(T=>T.id===b.id),w=o.findIndex(T=>T.id===v.id),E=Et(o,y,w);u?.(E)},children:i.jsx(vr,{items:o.map(b=>b.id),strategy:_s,children:o.map(b=>i.jsx(ac,{filter:b,onVisibilityChange:t,onSizeChange:n},b.id))})})}),i.jsx(Vt,{value:"presets",children:i.jsxs(l.VStack,{align:"stretch",mb:3,children:[x.length===0&&i.jsx(l.Text,{fontSize:"xs",color:"gray.500",children:"No presets saved yet."}),x.map(b=>i.jsxs(l.HStack,{justify:"space-between",border:"1px solid",borderColor:a===b.name?"blue.300":"gray.200",rounded:"md",p:2,children:[i.jsxs(l.VStack,{align:"start",gap:0,children:[i.jsx(l.Text,{fontWeight:"bold",fontSize:"sm",children:b.name}),i.jsx(l.Text,{fontSize:"xs",color:"gray.500",children:new Date(b.date).toLocaleDateString()})]}),i.jsxs(l.HStack,{children:[i.jsx(l.Button,{size:"xs",variant:"ghost",onClick:()=>{const v=o.map(y=>({...y,value:b.values[y.id]??y.value}));c?.(v,b.name)},children:"Load"}),i.jsx(l.IconButton,{size:"xs","aria-label":"Delete preset",variant:"ghost",onClick:()=>Ar(s,b.id),children:i.jsx(wi,{size:14})})]})]},b.id)),i.jsx(l.Button,{size:"sm",colorScheme:"blue",onClick:p,children:"Save Current Filters"})]})})]})}),i.jsx(vc,{justify:"space-between",children:i.jsx(mc,{asChild:!0,children:i.jsx(l.CloseButton,{})})})]})})]})]})})},Sc=({title:e,filters:t,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:c,pageKey:a,onLoadPreset:u,activePresetName:d,filterDrawerSize:g="sm"})=>{const[h,x]=f.useState(!1);return i.jsxs(l.HStack,{wrap:"wrap",pl:2,pr:2,width:"100%",justify:"space-between",children:[e,i.jsxs(l.HStack,{gapX:1,children:[t.filter(p=>p.visible!==!1).map(p=>i.jsx(l.HStack,{flex:p.size??1,minW:`${(p.size??1)*100}px`,alignItems:"center",children:Lr(p)},p.id)),i.jsx(yc,{filterDrawerSize:g,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:c,pageKey:a,filters:t,onLoadPreset:u,activePresetName:d,open:h,onOpenChange:p=>{x(p.open)}})]})]})},wc=(e,t)=>{localStorage.setItem(`FILTER_ORDER_${e}`,JSON.stringify(t))},Cc=e=>{try{return JSON.parse(localStorage.getItem(`FILTER_ORDER_${e}`)||"[]")}catch{return[]}},Dc=({onClick:e,size:t="xs",variant:n="solid",label:r,leftIcon:o,rightIcon:s,isDisabled:c,colorScheme:a,loading:u,loadingText:d,rounded:g,type:h="button"})=>i.jsx(l.Button,{onClick:e,size:t,variant:n,disabled:c,colorPalette:a,loading:u,loadingText:d,rounded:g,type:h,children:i.jsxs(l.HStack,{gap:1,children:[o,r,s]})}),jc=S(l.Dialog.Root),Rc=S(l.Dialog.Backdrop),Ec=S(l.Dialog.Positioner),Tc=S(l.Dialog.Content),Mc=S(l.Dialog.Header),Oc=S(l.Dialog.Body),_c=S(l.Dialog.Footer),kc=S(l.Dialog.Title),$c=S(l.Dialog.CloseTrigger);function Ic({open:e,onClose:t,onConfirm:n,title:r="Confirm Action",description:o="Are you sure you want to continue?",confirmLabel:s="Confirm",cancelLabel:c="Cancel",icon:a,isLoading:u=!1,confirmButtonColorScheme:d="#4169e1"}){return i.jsx(jc,{open:e,placement:"center",onOpenChange:g=>!g.open&&t(),children:i.jsxs(l.Portal,{children:[i.jsx(Rc,{}),i.jsx(Ec,{children:i.jsxs(Tc,{maxW:"480px",children:[i.jsx(Mc,{borderBottom:"1px solid",borderColor:"gray.200",children:i.jsx(kc,{children:r})}),i.jsx(Oc,{p:6,children:i.jsxs(l.Stack,{gap:4,align:"center",textAlign:"center",children:[i.jsx(l.Box,{color:"orange.500",children:a??i.jsx(Mr,{size:40})}),i.jsx(l.Text,{fontSize:"sm",color:"gray.600",children:o})]})}),i.jsxs(_c,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"gray.200",children:[i.jsx(l.Button,{variant:"outline",size:"sm",onClick:t,children:c}),i.jsx(l.Button,{size:"sm",style:{backgroundColor:d},loading:u,onClick:n,children:s})]}),i.jsx($c,{asChild:!0,children:i.jsx(l.CloseButton,{size:"sm"})})]})})]})})}const Ac=S(l.Dialog.Root),Lc=S(l.Dialog.Backdrop),Nc=S(l.Dialog.Positioner),Pc=S(l.Dialog.Content),zc=S(l.Dialog.Header),Yc=S(l.Dialog.Body),Fc=S(l.Dialog.Footer),Bc=S(l.Dialog.Title),Vc=S(l.Dialog.CloseTrigger);function Hc({open:e,onClose:t,onConfirm:n,title:r="Delete Company",entityName:o,confirmText:s="DELETE",confirmLabel:c="Delete",isLoading:a=!1}){const[u,d]=f.useState(""),g=u===s;return i.jsx(Ac,{open:e,placement:"center",onOpenChange:h=>{!h.open&&t(),d("")},children:i.jsxs(l.Portal,{children:[i.jsx(Lc,{}),i.jsx(Nc,{children:i.jsxs(Pc,{maxW:"550px",children:[i.jsx(zc,{borderBottom:"1px solid",borderColor:"#d3d3d3",children:i.jsx(Bc,{color:"red.600",children:r})}),i.jsx(Yc,{p:2,style:{padding:"16px"},children:i.jsxs(l.Stack,{gap:4,borderRadius:"md",p:4,bg:"white",children:[i.jsx(l.Box,{border:"1px solid",borderColor:"red.200",bg:"red.50",borderRadius:"md",p:4,children:i.jsxs(l.Stack,{direction:"row",gap:3,align:"flex-start",children:[i.jsx(l.Box,{color:"red.600",mt:"2px",children:i.jsx(Mr,{size:20})}),i.jsxs(l.Box,{children:[i.jsx(l.Text,{fontWeight:"semibold",color:"red.700",children:"Are you sure?"}),i.jsxs(l.Text,{fontSize:"sm",color:"red.600",children:["All the data of ",i.jsx("b",{children:o})," will permanently be deleted."]})]})]})}),i.jsx(l.Text,{fontSize:"sm",color:"gray.600",children:"You can’t undo this action afterwards."}),i.jsxs(l.Box,{children:[i.jsxs(l.Text,{fontSize:"sm",mb:2,children:["Type ",i.jsx("b",{children:s})," to continue"]}),i.jsx(l.Input,{placeholder:`Type ${s} here`,value:u,onChange:h=>d(h.target.value),size:"xs"})]})]})}),i.jsxs(Fc,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"#d3d3d3",children:[i.jsx(l.Button,{variant:"outline",size:"sm",onClick:()=>{t(),d("")},children:"Cancel"}),i.jsx(l.Button,{size:"sm",disabled:!g,style:{backgroundColor:"#FF0000"},loading:a,onClick:n,children:c})]}),i.jsx(Vc,{asChild:!0,children:i.jsx(l.CloseButton,{size:"sm"})})]})})]})})}const Nr=({children:e})=>i.jsx(i.Fragment,{children:e}),Pr=({children:e})=>i.jsx(i.Fragment,{children:e}),Wc=l.Button,Uc=S(l.Dialog.Root),Gc=S(l.Dialog.Title),qc=S(l.Dialog.Content);function Xc(e){let t=null,n=null;return f.Children.forEach(e,r=>{f.isValidElement(r)&&(r.type===Nr&&(t=r.props.children),r.type===Pr&&(n=r.props.children))}),{body:t,actions:n}}const Kc=({open:e,onClose:t,title:n,children:r,size:o="md"})=>{const{body:s,actions:c}=Xc(r);return i.jsxs(Uc,{open:e,onOpenChange:()=>t(),children:[i.jsx(l.DialogBackdrop,{}),i.jsxs(qc,{maxW:o,borderRadius:"12px",p:"0",children:[i.jsx(l.DialogHeader,{px:"20px",py:"16px",borderBottom:"1px solid",borderColor:"gray.200",children:i.jsxs(l.Flex,{justify:"space-between",align:"center",children:[i.jsx(Gc,{fontSize:"16px",fontWeight:"600",children:n}),i.jsx(l.DialogCloseTrigger,{})]})}),s&&i.jsx(l.DialogBody,{px:"20px",py:"16px",children:s}),c&&i.jsx(l.DialogFooter,{px:"20px",py:"16px",borderTop:"1px solid",borderColor:"gray.200",children:i.jsx(l.Flex,{ml:"auto",gap:"12px",children:c})})]})]})};function zr({refetch:e,isLoading:t=!1,label:n="Refresh"}){const[r,o]=f.useState(!1),s=async()=>{o(!0);try{await e()}finally{setTimeout(()=>o(!1),300)}};return i.jsx(l.IconButton,{"aria-label":n,size:"xs",variant:"outline",disabled:t||r,onClick:s,ml:2,children:i.jsx(_i,{size:14,style:{animation:r?"spin 0.6s linear infinite":void 0}})})}var gt={exports:{}},Jc=gt.exports,Wn;function Zc(){return Wn||(Wn=1,(function(e,t){(function(n,r){e.exports=r()})(Jc,(function(){var n=1e3,r=6e4,o=36e5,s="millisecond",c="second",a="minute",u="hour",d="day",g="week",h="month",x="quarter",p="year",b="date",v="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,w=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,E={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function($){var j=["th","st","nd","rd"],C=$%100;return"["+$+(j[(C-20)%10]||j[C]||j[0])+"]"}},T=function($,j,C){var O=String($);return!O||O.length>=j?$:""+Array(j+1-O.length).join(C)+$},I={s:T,z:function($){var j=-$.utcOffset(),C=Math.abs(j),O=Math.floor(C/60),_=C%60;return(j<=0?"+":"-")+T(O,2,"0")+":"+T(_,2,"0")},m:function $(j,C){if(j.date()<C.date())return-$(C,j);var O=12*(C.year()-j.year())+(C.month()-j.month()),_=j.clone().add(O,h),N=C-_<0,z=j.clone().add(O+(N?-1:1),h);return+(-(O+(C-_)/(N?_-z:z-_))||0)},a:function($){return $<0?Math.ceil($)||0:Math.floor($)},p:function($){return{M:h,y:p,w:g,d,D:b,h:u,m:a,s:c,ms:s,Q:x}[$]||String($||"").toLowerCase().replace(/s$/,"")},u:function($){return $===void 0}},k="en",M={};M[k]=E;var A="$isDayjsObject",L=function($){return $ instanceof U||!(!$||!$[A])},V=function $(j,C,O){var _;if(!j)return k;if(typeof j=="string"){var N=j.toLowerCase();M[N]&&(_=N),C&&(M[N]=C,_=N);var z=j.split("-");if(!_&&z.length>1)return $(z[0])}else{var m=j.name;M[m]=j,_=m}return!O&&_&&(k=_),_||!O&&k},F=function($,j){if(L($))return $.clone();var C=typeof j=="object"?j:{};return C.date=$,C.args=arguments,new U(C)},D=I;D.l=V,D.i=L,D.w=function($,j){return F($,{locale:j.$L,utc:j.$u,x:j.$x,$offset:j.$offset})};var U=(function(){function $(C){this.$L=V(C.locale,null,!0),this.parse(C),this.$x=this.$x||C.x||{},this[A]=!0}var j=$.prototype;return j.parse=function(C){this.$d=(function(O){var _=O.date,N=O.utc;if(_===null)return new Date(NaN);if(D.u(_))return new Date;if(_ instanceof Date)return new Date(_);if(typeof _=="string"&&!/Z$/i.test(_)){var z=_.match(y);if(z){var m=z[2]-1||0,R=(z[7]||"0").substring(0,3);return N?new Date(Date.UTC(z[1],m,z[3]||1,z[4]||0,z[5]||0,z[6]||0,R)):new Date(z[1],m,z[3]||1,z[4]||0,z[5]||0,z[6]||0,R)}}return new Date(_)})(C),this.init()},j.init=function(){var C=this.$d;this.$y=C.getFullYear(),this.$M=C.getMonth(),this.$D=C.getDate(),this.$W=C.getDay(),this.$H=C.getHours(),this.$m=C.getMinutes(),this.$s=C.getSeconds(),this.$ms=C.getMilliseconds()},j.$utils=function(){return D},j.isValid=function(){return this.$d.toString()!==v},j.isSame=function(C,O){var _=F(C);return this.startOf(O)<=_&&_<=this.endOf(O)},j.isAfter=function(C,O){return F(C)<this.startOf(O)},j.isBefore=function(C,O){return this.endOf(O)<F(C)},j.$g=function(C,O,_){return D.u(C)?this[O]:this.set(_,C)},j.unix=function(){return Math.floor(this.valueOf()/1e3)},j.valueOf=function(){return this.$d.getTime()},j.startOf=function(C,O){var _=this,N=!!D.u(O)||O,z=D.p(C),m=function(J,Y){var se=D.w(_.$u?Date.UTC(_.$y,Y,J):new Date(_.$y,Y,J),_);return N?se:se.endOf(d)},R=function(J,Y){return D.w(_.toDate()[J].apply(_.toDate("s"),(N?[0,0,0,0]:[23,59,59,999]).slice(Y)),_)},P=this.$W,B=this.$M,q=this.$D,X="set"+(this.$u?"UTC":"");switch(z){case p:return N?m(1,0):m(31,11);case h:return N?m(1,B):m(0,B+1);case g:var H=this.$locale().weekStart||0,K=(P<H?P+7:P)-H;return m(N?q-K:q+(6-K),B);case d:case b:return R(X+"Hours",0);case u:return R(X+"Minutes",1);case a:return R(X+"Seconds",2);case c:return R(X+"Milliseconds",3);default:return this.clone()}},j.endOf=function(C){return this.startOf(C,!1)},j.$set=function(C,O){var _,N=D.p(C),z="set"+(this.$u?"UTC":""),m=(_={},_[d]=z+"Date",_[b]=z+"Date",_[h]=z+"Month",_[p]=z+"FullYear",_[u]=z+"Hours",_[a]=z+"Minutes",_[c]=z+"Seconds",_[s]=z+"Milliseconds",_)[N],R=N===d?this.$D+(O-this.$W):O;if(N===h||N===p){var P=this.clone().set(b,1);P.$d[m](R),P.init(),this.$d=P.set(b,Math.min(this.$D,P.daysInMonth())).$d}else m&&this.$d[m](R);return this.init(),this},j.set=function(C,O){return this.clone().$set(C,O)},j.get=function(C){return this[D.p(C)]()},j.add=function(C,O){var _,N=this;C=Number(C);var z=D.p(O),m=function(B){var q=F(N);return D.w(q.date(q.date()+Math.round(B*C)),N)};if(z===h)return this.set(h,this.$M+C);if(z===p)return this.set(p,this.$y+C);if(z===d)return m(1);if(z===g)return m(7);var R=(_={},_[a]=r,_[u]=o,_[c]=n,_)[z]||1,P=this.$d.getTime()+C*R;return D.w(P,this)},j.subtract=function(C,O){return this.add(-1*C,O)},j.format=function(C){var O=this,_=this.$locale();if(!this.isValid())return _.invalidDate||v;var N=C||"YYYY-MM-DDTHH:mm:ssZ",z=D.z(this),m=this.$H,R=this.$m,P=this.$M,B=_.weekdays,q=_.months,X=_.meridiem,H=function(Y,se,ne,he){return Y&&(Y[se]||Y(O,N))||ne[se].slice(0,he)},K=function(Y){return D.s(m%12||12,Y,"0")},J=X||function(Y,se,ne){var he=Y<12?"AM":"PM";return ne?he.toLowerCase():he};return N.replace(w,(function(Y,se){return se||(function(ne){switch(ne){case"YY":return String(O.$y).slice(-2);case"YYYY":return D.s(O.$y,4,"0");case"M":return P+1;case"MM":return D.s(P+1,2,"0");case"MMM":return H(_.monthsShort,P,q,3);case"MMMM":return H(q,P);case"D":return O.$D;case"DD":return D.s(O.$D,2,"0");case"d":return String(O.$W);case"dd":return H(_.weekdaysMin,O.$W,B,2);case"ddd":return H(_.weekdaysShort,O.$W,B,3);case"dddd":return B[O.$W];case"H":return String(m);case"HH":return D.s(m,2,"0");case"h":return K(1);case"hh":return K(2);case"a":return J(m,R,!0);case"A":return J(m,R,!1);case"m":return String(R);case"mm":return D.s(R,2,"0");case"s":return String(O.$s);case"ss":return D.s(O.$s,2,"0");case"SSS":return D.s(O.$ms,3,"0");case"Z":return z}return null})(Y)||z.replace(":","")}))},j.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},j.diff=function(C,O,_){var N,z=this,m=D.p(O),R=F(C),P=(R.utcOffset()-this.utcOffset())*r,B=this-R,q=function(){return D.m(z,R)};switch(m){case p:N=q()/12;break;case h:N=q();break;case x:N=q()/3;break;case g:N=(B-P)/6048e5;break;case d:N=(B-P)/864e5;break;case u:N=B/o;break;case a:N=B/r;break;case c:N=B/n;break;default:N=B}return _?N:D.a(N)},j.daysInMonth=function(){return this.endOf(h).$D},j.$locale=function(){return M[this.$L]},j.locale=function(C,O){if(!C)return this.$L;var _=this.clone(),N=V(C,O,!0);return N&&(_.$L=N),_},j.clone=function(){return D.w(this.$d,this)},j.toDate=function(){return new Date(this.valueOf())},j.toJSON=function(){return this.isValid()?this.toISOString():null},j.toISOString=function(){return this.$d.toISOString()},j.toString=function(){return this.$d.toUTCString()},$})(),G=U.prototype;return F.prototype=G,[["$ms",s],["$s",c],["$m",a],["$H",u],["$W",d],["$M",h],["$y",p],["$D",b]].forEach((function($){G[$[1]]=function(j){return this.$g(j,$[0],$[1])}})),F.extend=function($,j){return $.$i||($(j,U,F),$.$i=!0),F},F.locale=V,F.isDayjs=L,F.unix=function($){return F(1e3*$)},F.en=M[k],F.Ls=M,F.p={},F}))})(gt)),gt.exports}var Qc=Zc();const Mt=Ct(Qc);var pt={exports:{}},el=pt.exports,Un;function tl(){return Un||(Un=1,(function(e,t){(function(n,r){e.exports=r()})(el,(function(){return function(n,r,o){n=n||{};var s=r.prototype,c={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function a(d,g,h,x){return s.fromToBase(d,g,h,x)}o.en.relativeTime=c,s.fromToBase=function(d,g,h,x,p){for(var b,v,y,w=h.$locale().relativeTime||c,E=n.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],T=E.length,I=0;I<T;I+=1){var k=E[I];k.d&&(b=x?o(d).diff(h,k.d,!0):h.diff(d,k.d,!0));var M=(n.rounding||Math.round)(Math.abs(b));if(y=b>0,M<=k.r||!k.r){M<=1&&I>0&&(k=E[I-1]);var A=w[k.l];p&&(M=p(""+M)),v=typeof A=="string"?A.replace("%d",M):A(M,g,k.l,y);break}}if(g)return v;var L=y?w.future:w.past;return typeof L=="function"?L(v):L.replace("%s",v)},s.to=function(d,g){return a(d,g,this,!0)},s.from=function(d,g){return a(d,g,this)};var u=function(d){return d.$u?o.utc():o()};s.toNow=function(d){return this.to(u(this),d)},s.fromNow=function(d){return this.from(u(this),d)}}}))})(pt)),pt.exports}var nl=tl();const rl=Ct(nl);var vt={exports:{}},ol=vt.exports,Gn;function sl(){return Gn||(Gn=1,(function(e,t){(function(n,r){e.exports=r()})(ol,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,o,s){var c=o.prototype,a=c.format;s.en.formats=n,c.format=function(u){u===void 0&&(u="YYYY-MM-DDTHH:mm:ssZ");var d=this.$locale().formats,g=(function(h,x){return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(p,b,v){var y=v&&v.toUpperCase();return b||x[v]||n[v]||x[y].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(w,E,T){return E||T.slice(1)}))}))})(u,d===void 0?{}:d);return a.call(this,g)}}}))})(vt)),vt.exports}var il=sl();const al=Ct(il);var mt={exports:{}},cl=mt.exports,qn;function ll(){return qn||(qn=1,(function(e,t){(function(n,r){e.exports=r()})(cl,(function(){return function(n,r){var o=r.prototype,s=o.format;o.format=function(c){var a=this,u=this.$locale();if(!this.isValid())return s.bind(this)(c);var d=this.$utils(),g=(c||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(h){switch(h){case"Q":return Math.ceil((a.$M+1)/3);case"Do":return u.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return u.ordinal(a.week(),"W");case"w":case"ww":return d.s(a.week(),h==="w"?1:2,"0");case"W":case"WW":return d.s(a.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return d.s(String(a.$H===0?24:a.$H),h==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return h}}));return s.bind(this)(g)}}}))})(mt)),mt.exports}var ul=ll();const dl=Ct(ul);Mt.extend(rl);Mt.extend(al);Mt.extend(dl);const fl={date:"DD MMM YYYY",time:"hh:mm A",dateTime:"DD MMM YYYY, hh:mm A",full:"dddd, DD MMM YYYY, hh:mm A",short:"DD/MM/YY",relative:""};function Jt({value:e,variant:t="dateTime",format:n,fallback:r="--"}){if(!e)return r;const o=Mt(e);return o.isValid()?t==="relative"?o.fromNow():o.format(n??fl[t]):r}function hl({value:e,dateVariant:t="date",timeVariant:n="time",dateFormat:r,timeFormat:o,align:s="start",dateColor:c="gray.700",dateFontSize:a="16px",dateFontWeight:u="500",timeColor:d="gray.500",timeFontSize:g="12px",timeFontWeight:h="400"}){return i.jsxs(l.Stack,{gap:.5,align:s,children:[i.jsx(l.Text,{fontSize:a,fontWeight:u,color:c,children:Jt({value:e,variant:t,format:r})}),i.jsx(l.Text,{fontSize:g,fontWeight:h,color:d,children:Jt({value:e,variant:n,format:o})})]})}class Yr{state=new Map;listeners=new Map;get(t){return this.state.get(t)}set(t){this.state.set(t.key,t),this.notify(t.key)}setMany(t){t.forEach(n=>this.set(n))}subscribe(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),n(this.state.get(t)),()=>{this.listeners.get(t)?.delete(n)}}notify(t){this.listeners.get(t)?.forEach(n=>n(this.state.get(t)))}clear(){this.state.clear()}}class Zt{constructor(t){this.baseUrl=t}async fetchLatest(t){const n=new URLSearchParams;return n.set("keys",t.join(",")),(await(await fetch(`${this.baseUrl}/options?${n}`)).json()).data}}class Qt{constructor(t){this.api=t}store=new Yr;inflight=new Map;getRaw(t){return this.store.get(t)}async getKey(t){const n=this.store.get(t);return n?n.value:(await this.fetchMissing([t]),this.store.get(t)?.value)}async getMultiKey(t){const n={},r=[];for(const o of t){const s=this.store.get(o);s?n[o]=s.value:r.push(o)}return r.length&&(await this.fetchMissing(r),r.forEach(o=>{const s=this.store.get(o);s&&(n[o]=s.value)})),n}subscribe(t,n){return this.store.subscribe(t,n)}hydrate(t){this.store.setMany(t)}clear(){this.store.clear()}async fetchMissing(t){const n=t.filter(o=>!this.inflight.has(o));if(!n.length)return;const r=this.api.fetchLatest(n).then(o=>{this.store.setMany(o),n.forEach(s=>this.inflight.delete(s))});n.forEach(o=>this.inflight.set(o,r)),await r}}const Fr=f.createContext(null);function Br(){const e=f.useContext(Fr);if(!e)throw new Error("OptionsProvider is missing. Wrap your app with <OptionsProvider />");return e}function gl({client:{apiUrl:e},children:t}){const n=f.useRef(new Qt(new Zt(e)));return n.current||(n.current=new Qt(new Zt(e))),i.jsx(Fr.Provider,{value:n.current,children:t})}function pl(e){const t=Br(),[n,r]=f.useState(t.getRaw(e)?.value);return f.useEffect(()=>{let o=!0;t.getKey(e).then(c=>{o&&r(c)});const s=t.subscribe(e,c=>{r(c?.value)});return()=>{o=!1,s()}},[e,t]),n}function vl(e){const t=Br(),[n,r]=f.useState({});return f.useEffect(()=>{let o=!0;t.getMultiKey(e).then(c=>{o&&r(c)});const s=e.map(c=>t.subscribe(c,a=>{r(u=>({...u,[c]:a?.value}))}));return()=>{o=!1,s.forEach(c=>c())}},[e.join("|"),t]),n}async function ml(e,t){return e.getKey(t)}async function bl(e,t){await e.getMultiKey(t)}function xl(e={}){const{initialPage:t=1,initialLimit:n=20}=e,[r,o]=f.useState(t),[s,c]=f.useState(n),a=f.useCallback(x=>{o(Math.max(1,x))},[]),u=f.useCallback(x=>{c(Math.max(1,x)),o(1)},[]),d=f.useCallback(()=>{o(x=>x+1)},[]),g=f.useCallback(()=>{o(x=>Math.max(1,x-1))},[]),h=f.useCallback(()=>{o(t),c(n)},[t,n]);return{page:r,limit:s,setPage:a,setLimit:u,nextPage:d,prevPage:g,reset:h}}function yl(e={}){const{initialValue:t="",delay:n=300}=e,[r,o]=f.useState(t),s=Sl(r,n),c=f.useCallback(u=>{o(u)},[]),a=f.useCallback(()=>{o(t)},[t]);return{search:r,debouncedSearch:s,onSearchChange:c,reset:a}}function Sl(e,t=300){const[n,r]=f.useState(e);return f.useEffect(()=>{const o=setTimeout(()=>{r(e)},t);return()=>clearTimeout(o)},[e,t]),n}exports.DataTable=ua;exports.Filters=Sc;exports.HttpOptionsApi=Zt;exports.MDSButton=Dc;exports.MDSCheckbox=Or;exports.MDSCombobox=_r;exports.MDSConfirmActionDialog=Ic;exports.MDSConfirmDeleteDialog=Hc;exports.MDSDialogAction=Wc;exports.MDSDialogActions=Pr;exports.MDSDialogBody=Nr;exports.MDSDialogWrapper=Kc;exports.MDSInput=Kt;exports.MDSRefreshButton=zr;exports.MDSSelectBox=kr;exports.OptionsClientImpl=Qt;exports.OptionsProvider=gl;exports.OptionsStore=Yr;exports.RefreshButton=zr;exports.StackedDateTime=hl;exports.addPreset=Ir;exports.deletePreset=Ar;exports.formatDateTime=Jt;exports.getOption=ml;exports.getPresets=rt;exports.loadOrder=Cc;exports.prefetchOptions=bl;exports.presetStore=Ze;exports.saveOrder=wc;exports.savePresets=Tt;exports.setActionsConfig=Dr;exports.setData=wr;exports.setTableId=Cr;exports.tableStore=ie;exports.updatePreset=Za;exports.useDebouncedSearch=yl;exports.useOption=pl;exports.useOptions=vl;exports.usePagination=xl;exports.withChildren=S;
package/dist/index.js CHANGED
@@ -3986,7 +3986,7 @@ function Ka({
3986
3986
  }) {
3987
3987
  return /* @__PURE__ */ i.jsx(le.Body, { children: Array.from({ length: e }).map((n, r) => /* @__PURE__ */ i.jsx(le.Row, { children: Array.from({ length: t }).map((o, s) => /* @__PURE__ */ i.jsx(le.Cell, { children: /* @__PURE__ */ i.jsx(Ro, { height: "25px" }) }, s)) }, r)) });
3988
3988
  }
3989
- function tu({
3989
+ function nu({
3990
3990
  tableId: e,
3991
3991
  data: t = [],
3992
3992
  headers: n = [],
@@ -4523,7 +4523,7 @@ const bc = b(Ge.Root), yc = b(Ge.Label), wc = b(Ge.HelperText), Sc = b(Ge.ErrorT
4523
4523
  }, Vc = (e, t) => {
4524
4524
  const n = Qt(e).filter((r) => r.id !== t);
4525
4525
  kn(e, n);
4526
- }, nu = (e, t, n) => {
4526
+ }, ru = (e, t, n) => {
4527
4527
  const r = Qt(e).map(
4528
4528
  (o) => o.id === t ? n(o) : o
4529
4529
  );
@@ -4792,7 +4792,7 @@ const bc = b(Ge.Root), yc = b(Ge.Label), wc = b(Ge.HelperText), Sc = b(Ge.ErrorT
4792
4792
  ] }) })
4793
4793
  ] })
4794
4794
  ] }) });
4795
- }, ru = ({
4795
+ }, ou = ({
4796
4796
  title: e,
4797
4797
  filters: t,
4798
4798
  onVisibilityChange: n,
@@ -4840,15 +4840,15 @@ const bc = b(Ge.Root), yc = b(Ge.Label), wc = b(Ge.HelperText), Sc = b(Ge.ErrorT
4840
4840
  )
4841
4841
  ] })
4842
4842
  ] });
4843
- }, ou = (e, t) => {
4843
+ }, su = (e, t) => {
4844
4844
  localStorage.setItem(`FILTER_ORDER_${e}`, JSON.stringify(t));
4845
- }, su = (e) => {
4845
+ }, iu = (e) => {
4846
4846
  try {
4847
4847
  return JSON.parse(localStorage.getItem(`FILTER_ORDER_${e}`) || "[]");
4848
4848
  } catch {
4849
4849
  return [];
4850
4850
  }
4851
- }, iu = ({
4851
+ }, au = ({
4852
4852
  onClick: e,
4853
4853
  size: t = "xs",
4854
4854
  variant: n = "solid",
@@ -4880,7 +4880,7 @@ const bc = b(Ge.Root), yc = b(Ge.Label), wc = b(Ge.HelperText), Sc = b(Ge.ErrorT
4880
4880
  ] })
4881
4881
  }
4882
4882
  ), dl = b(oe.Root), fl = b(oe.Backdrop), hl = b(oe.Positioner), gl = b(oe.Content), pl = b(oe.Header), vl = b(oe.Body), ml = b(oe.Footer), xl = b(oe.Title), bl = b(oe.CloseTrigger);
4883
- function au({
4883
+ function cu({
4884
4884
  open: e,
4885
4885
  onClose: t,
4886
4886
  onConfirm: n,
@@ -4929,7 +4929,7 @@ function au({
4929
4929
  ] }) });
4930
4930
  }
4931
4931
  const yl = b(oe.Root), wl = b(oe.Backdrop), Sl = b(oe.Positioner), Dl = b(oe.Content), Cl = b(oe.Header), jl = b(oe.Body), Rl = b(oe.Footer), El = b(oe.Title), _l = b(oe.CloseTrigger);
4932
- function cu({
4932
+ function lu({
4933
4933
  open: e,
4934
4934
  onClose: t,
4935
4935
  onConfirm: n,
@@ -5032,26 +5032,26 @@ function cu({
5032
5032
  }
5033
5033
  );
5034
5034
  }
5035
- const Ol = ({ children: e }) => /* @__PURE__ */ i.jsx(i.Fragment, { children: e }), Tl = ({ children: e }) => /* @__PURE__ */ i.jsx(i.Fragment, { children: e }), lu = Be, Ml = b(oe.Title), $l = b(oe.Content);
5036
- function Il(e) {
5035
+ const Ol = ({ children: e }) => /* @__PURE__ */ i.jsx(i.Fragment, { children: e }), Tl = ({ children: e }) => /* @__PURE__ */ i.jsx(i.Fragment, { children: e }), uu = Be, Ml = b(oe.Root), $l = b(oe.Title), Il = b(oe.Content);
5036
+ function Al(e) {
5037
5037
  let t = null, n = null;
5038
5038
  return re.Children.forEach(e, (r) => {
5039
5039
  re.isValidElement(r) && (r.type === Ol && (t = r.props.children), r.type === Tl && (n = r.props.children));
5040
5040
  }), { body: t, actions: n };
5041
5041
  }
5042
- const uu = ({
5042
+ const du = ({
5043
5043
  open: e,
5044
5044
  onClose: t,
5045
5045
  title: n,
5046
5046
  children: r,
5047
5047
  size: o = "md"
5048
5048
  }) => {
5049
- const { body: s, actions: c } = Il(r);
5050
- return /* @__PURE__ */ i.jsxs(oe.Root, { open: e, onOpenChange: () => t(), children: [
5049
+ const { body: s, actions: c } = Al(r);
5050
+ return /* @__PURE__ */ i.jsxs(Ml, { open: e, onOpenChange: () => t(), children: [
5051
5051
  /* @__PURE__ */ i.jsx(To, {}),
5052
- /* @__PURE__ */ i.jsxs($l, { maxW: o, borderRadius: "12px", p: "0", children: [
5052
+ /* @__PURE__ */ i.jsxs(Il, { maxW: o, borderRadius: "12px", p: "0", children: [
5053
5053
  /* @__PURE__ */ i.jsx(Mo, { px: "20px", py: "16px", borderBottom: "1px solid", borderColor: "gray.200", children: /* @__PURE__ */ i.jsxs(Un, { justify: "space-between", align: "center", children: [
5054
- /* @__PURE__ */ i.jsx(Ml, { fontSize: "16px", fontWeight: "600", children: n }),
5054
+ /* @__PURE__ */ i.jsx($l, { fontSize: "16px", fontWeight: "600", children: n }),
5055
5055
  /* @__PURE__ */ i.jsx($o, {})
5056
5056
  ] }) }),
5057
5057
  s && /* @__PURE__ */ i.jsx(Io, { px: "20px", py: "16px", children: s }),
@@ -5059,7 +5059,7 @@ const uu = ({
5059
5059
  ] })
5060
5060
  ] });
5061
5061
  };
5062
- function du({
5062
+ function fu({
5063
5063
  refetch: e,
5064
5064
  isLoading: t = !1,
5065
5065
  label: n = "Refresh"
@@ -5093,12 +5093,12 @@ function du({
5093
5093
  }
5094
5094
  );
5095
5095
  }
5096
- var At = { exports: {} }, Al = At.exports, wr;
5097
- function kl() {
5096
+ var At = { exports: {} }, kl = At.exports, wr;
5097
+ function Ll() {
5098
5098
  return wr || (wr = 1, (function(e, t) {
5099
5099
  (function(n, r) {
5100
5100
  e.exports = r();
5101
- })(Al, (function() {
5101
+ })(kl, (function() {
5102
5102
  var n = 1e3, r = 6e4, o = 36e5, s = "millisecond", c = "second", a = "minute", l = "hour", u = "day", f = "week", d = "month", m = "quarter", h = "year", v = "date", g = "Invalid Date", x = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, j = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(M) {
5103
5103
  var D = ["th", "st", "nd", "rd"], w = M % 100;
5104
5104
  return "[" + M + (D[(w - 20) % 10] || D[w] || D[0]) + "]";
@@ -5371,14 +5371,14 @@ function kl() {
5371
5371
  }));
5372
5372
  })(At)), At.exports;
5373
5373
  }
5374
- var Ll = kl();
5375
- const en = /* @__PURE__ */ Xt(Ll);
5376
- var kt = { exports: {} }, Nl = kt.exports, Sr;
5377
- function zl() {
5374
+ var Nl = Ll();
5375
+ const en = /* @__PURE__ */ Xt(Nl);
5376
+ var kt = { exports: {} }, zl = kt.exports, Sr;
5377
+ function Pl() {
5378
5378
  return Sr || (Sr = 1, (function(e, t) {
5379
5379
  (function(n, r) {
5380
5380
  e.exports = r();
5381
- })(Nl, (function() {
5381
+ })(zl, (function() {
5382
5382
  return function(n, r, o) {
5383
5383
  n = n || {};
5384
5384
  var s = r.prototype, c = { future: "in %s", past: "%s ago", s: "a few seconds", m: "a minute", mm: "%d minutes", h: "an hour", hh: "%d hours", d: "a day", dd: "%d days", M: "a month", MM: "%d months", y: "a year", yy: "%d years" };
@@ -5417,14 +5417,14 @@ function zl() {
5417
5417
  }));
5418
5418
  })(kt)), kt.exports;
5419
5419
  }
5420
- var Pl = zl();
5421
- const Yl = /* @__PURE__ */ Xt(Pl);
5422
- var Lt = { exports: {} }, Fl = Lt.exports, Dr;
5423
- function Vl() {
5420
+ var Yl = Pl();
5421
+ const Fl = /* @__PURE__ */ Xt(Yl);
5422
+ var Lt = { exports: {} }, Vl = Lt.exports, Dr;
5423
+ function Hl() {
5424
5424
  return Dr || (Dr = 1, (function(e, t) {
5425
5425
  (function(n, r) {
5426
5426
  e.exports = r();
5427
- })(Fl, (function() {
5427
+ })(Vl, (function() {
5428
5428
  var n = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" };
5429
5429
  return function(r, o, s) {
5430
5430
  var c = o.prototype, a = c.format;
@@ -5444,14 +5444,14 @@ function Vl() {
5444
5444
  }));
5445
5445
  })(Lt)), Lt.exports;
5446
5446
  }
5447
- var Hl = Vl();
5448
- const Wl = /* @__PURE__ */ Xt(Hl);
5449
- var Nt = { exports: {} }, Bl = Nt.exports, Cr;
5450
- function Ul() {
5447
+ var Wl = Hl();
5448
+ const Bl = /* @__PURE__ */ Xt(Wl);
5449
+ var Nt = { exports: {} }, Ul = Nt.exports, Cr;
5450
+ function Gl() {
5451
5451
  return Cr || (Cr = 1, (function(e, t) {
5452
5452
  (function(n, r) {
5453
5453
  e.exports = r();
5454
- })(Bl, (function() {
5454
+ })(Ul, (function() {
5455
5455
  return function(n, r) {
5456
5456
  var o = r.prototype, s = o.format;
5457
5457
  o.format = function(c) {
@@ -5496,12 +5496,12 @@ function Ul() {
5496
5496
  }));
5497
5497
  })(Nt)), Nt.exports;
5498
5498
  }
5499
- var Gl = Ul();
5500
- const Xl = /* @__PURE__ */ Xt(Gl);
5501
- en.extend(Yl);
5502
- en.extend(Wl);
5503
- en.extend(Xl);
5504
- const ql = {
5499
+ var Xl = Gl();
5500
+ const ql = /* @__PURE__ */ Xt(Xl);
5501
+ en.extend(Fl);
5502
+ en.extend(Bl);
5503
+ en.extend(ql);
5504
+ const Kl = {
5505
5505
  date: "DD MMM YYYY",
5506
5506
  time: "hh:mm A",
5507
5507
  dateTime: "DD MMM YYYY, hh:mm A",
@@ -5517,9 +5517,9 @@ function jr({
5517
5517
  }) {
5518
5518
  if (!e) return r;
5519
5519
  const o = en(e);
5520
- return o.isValid() ? t === "relative" ? o.fromNow() : o.format(n ?? ql[t]) : r;
5520
+ return o.isValid() ? t === "relative" ? o.fromNow() : o.format(n ?? Kl[t]) : r;
5521
5521
  }
5522
- function fu({
5522
+ function hu({
5523
5523
  value: e,
5524
5524
  dateVariant: t = "date",
5525
5525
  timeVariant: n = "time",
@@ -5546,7 +5546,7 @@ function fu({
5546
5546
  }) })
5547
5547
  ] });
5548
5548
  }
5549
- class Kl {
5549
+ class Jl {
5550
5550
  state = /* @__PURE__ */ new Map();
5551
5551
  listeners = /* @__PURE__ */ new Map();
5552
5552
  get(t) {
@@ -5583,7 +5583,7 @@ class Er {
5583
5583
  constructor(t) {
5584
5584
  this.api = t;
5585
5585
  }
5586
- store = new Kl();
5586
+ store = new Jl();
5587
5587
  inflight = /* @__PURE__ */ new Map();
5588
5588
  getRaw(t) {
5589
5589
  return this.store.get(t);
@@ -5628,14 +5628,14 @@ function ho() {
5628
5628
  throw new Error("OptionsProvider is missing. Wrap your app with <OptionsProvider />");
5629
5629
  return e;
5630
5630
  }
5631
- function hu({
5631
+ function gu({
5632
5632
  client: { apiUrl: e },
5633
5633
  children: t
5634
5634
  }) {
5635
5635
  const n = X(new Er(new Rr(e)));
5636
5636
  return n.current || (n.current = new Er(new Rr(e))), /* @__PURE__ */ i.jsx(fo.Provider, { value: n.current, children: t });
5637
5637
  }
5638
- function gu(e) {
5638
+ function pu(e) {
5639
5639
  const t = ho(), [n, r] = K(t.getRaw(e)?.value);
5640
5640
  return F(() => {
5641
5641
  let o = !0;
@@ -5650,7 +5650,7 @@ function gu(e) {
5650
5650
  };
5651
5651
  }, [e, t]), n;
5652
5652
  }
5653
- function pu(e) {
5653
+ function vu(e) {
5654
5654
  const t = ho(), [n, r] = K({});
5655
5655
  return F(() => {
5656
5656
  let o = !0;
@@ -5670,13 +5670,13 @@ function pu(e) {
5670
5670
  };
5671
5671
  }, [e.join("|"), t]), n;
5672
5672
  }
5673
- async function vu(e, t) {
5673
+ async function mu(e, t) {
5674
5674
  return e.getKey(t);
5675
5675
  }
5676
- async function mu(e, t) {
5676
+ async function xu(e, t) {
5677
5677
  await e.getMultiKey(t);
5678
5678
  }
5679
- function xu(e = {}) {
5679
+ function bu(e = {}) {
5680
5680
  const { initialPage: t = 1, initialLimit: n = 20 } = e, [r, o] = K(t), [s, c] = K(n), a = Q((m) => {
5681
5681
  o(Math.max(1, m));
5682
5682
  }, []), l = Q((m) => {
@@ -5698,8 +5698,8 @@ function xu(e = {}) {
5698
5698
  reset: d
5699
5699
  };
5700
5700
  }
5701
- function bu(e = {}) {
5702
- const { initialValue: t = "", delay: n = 300 } = e, [r, o] = K(t), s = Jl(r, n), c = Q((l) => {
5701
+ function yu(e = {}) {
5702
+ const { initialValue: t = "", delay: n = 300 } = e, [r, o] = K(t), s = Zl(r, n), c = Q((l) => {
5703
5703
  o(l);
5704
5704
  }, []), a = Q(() => {
5705
5705
  o(t);
@@ -5711,7 +5711,7 @@ function bu(e = {}) {
5711
5711
  reset: a
5712
5712
  };
5713
5713
  }
5714
- function Jl(e, t = 300) {
5714
+ function Zl(e, t = 300) {
5715
5715
  const [n, r] = K(e);
5716
5716
  return F(() => {
5717
5717
  const o = setTimeout(() => {
@@ -5721,44 +5721,44 @@ function Jl(e, t = 300) {
5721
5721
  }, [e, t]), n;
5722
5722
  }
5723
5723
  export {
5724
- tu as DataTable,
5725
- ru as Filters,
5724
+ nu as DataTable,
5725
+ ou as Filters,
5726
5726
  Rr as HttpOptionsApi,
5727
- iu as MDSButton,
5727
+ au as MDSButton,
5728
5728
  tc as MDSCheckbox,
5729
5729
  uc as MDSCombobox,
5730
- au as MDSConfirmActionDialog,
5731
- cu as MDSConfirmDeleteDialog,
5732
- lu as MDSDialogAction,
5730
+ cu as MDSConfirmActionDialog,
5731
+ lu as MDSConfirmDeleteDialog,
5732
+ uu as MDSDialogAction,
5733
5733
  Tl as MDSDialogActions,
5734
5734
  Ol as MDSDialogBody,
5735
- uu as MDSDialogWrapper,
5735
+ du as MDSDialogWrapper,
5736
5736
  yr as MDSInput,
5737
- du as MDSRefreshButton,
5737
+ fu as MDSRefreshButton,
5738
5738
  zc as MDSSelectBox,
5739
5739
  Er as OptionsClientImpl,
5740
- hu as OptionsProvider,
5741
- Kl as OptionsStore,
5742
- du as RefreshButton,
5743
- fu as StackedDateTime,
5740
+ gu as OptionsProvider,
5741
+ Jl as OptionsStore,
5742
+ fu as RefreshButton,
5743
+ hu as StackedDateTime,
5744
5744
  Fc as addPreset,
5745
5745
  Vc as deletePreset,
5746
5746
  jr as formatDateTime,
5747
- vu as getOption,
5747
+ mu as getOption,
5748
5748
  Qt as getPresets,
5749
- su as loadOrder,
5750
- mu as prefetchOptions,
5749
+ iu as loadOrder,
5750
+ xu as prefetchOptions,
5751
5751
  Bt as presetStore,
5752
- ou as saveOrder,
5752
+ su as saveOrder,
5753
5753
  kn as savePresets,
5754
5754
  zi as setActionsConfig,
5755
5755
  Li as setData,
5756
5756
  Ni as setTableId,
5757
5757
  be as tableStore,
5758
- nu as updatePreset,
5759
- bu as useDebouncedSearch,
5760
- gu as useOption,
5761
- pu as useOptions,
5762
- xu as usePagination,
5758
+ ru as updatePreset,
5759
+ yu as useDebouncedSearch,
5760
+ pu as useOption,
5761
+ vu as useOptions,
5762
+ bu as usePagination,
5763
5763
  b as withChildren
5764
5764
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mdspl/mds-shared-ui",
3
- "version": "0.8.4",
3
+ "version": "0.8.5",
4
4
  "description": "Chakra UI v3 DataTable with sorting, pagination, column visibility & drag reorder",
5
5
  "author": "magadh",
6
6
  "license": "MIT",