@mdspl/mds-shared-ui 1.0.5 → 1.0.6
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 +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +4 -2
- package/package.json +1 -1
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
|
-
`},uo={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 fo(e){let{announcements:t=uo,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=co}=e;const{announce:i,announcement:c}=io(),l=Ze("DndLiveRegion"),[u,d]=h.useState(!1);if(h.useEffect(()=>{d(!0)},[]),ao(h.useMemo(()=>({onDragStart(f){let{active:x}=f;i(t.onDragStart({active:x}))},onDragMove(f){let{active:x,over:p}=f;t.onDragMove&&i(t.onDragMove({active:x,over:p}))},onDragOver(f){let{active:x,over:p}=f;i(t.onDragOver({active:x,over:p}))},onDragEnd(f){let{active:x,over:p}=f;i(t.onDragEnd({active:x,over:p}))},onDragCancel(f){let{active:x,over:p}=f;i(t.onDragCancel({active:x,over:p}))}}),[i,t])),!u)return null;const g=h.createElement(h.Fragment,null,h.createElement(oo,{id:r,value:o.draggable}),h.createElement(so,{id:l,announcement:c}));return n?We.createPortal(g,n):g}var Z;(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"})(Z||(Z={}));function vt(){}function ho(e,t){return h.useMemo(()=>({sensor:e,options:{}}),[e,t])}function go(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return h.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const he=Object.freeze({x:0,y:0});function po(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function vo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function mo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function xo(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function bn(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 qn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=bn(t,t.left,t.top),i=[];for(const c of r){const{id:l}=c,u=n.get(l);if(u){const d=po(bn(u),o);i.push({id:l,data:{droppableContainer:c,value:d}})}}return i.sort(vo)};function bo(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),i=Math.min(t.top+t.height,e.top+e.height),c=o-r,l=i-n;if(r<o&&n<i){const u=t.width*t.height,d=e.width*e.height,g=c*l,f=g/(u+d-g);return Number(f.toFixed(4))}return 0}const yo=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:c}=i,l=n.get(c);if(l){const u=bo(l,t);u>0&&o.push({id:c,data:{droppableContainer:i,value:u}})}}return o.sort(mo)};function So(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Xn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:he}function wo(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.reduce((c,l)=>({...c,top:c.top+e*l.y,bottom:c.bottom+e*l.y,left:c.left+e*l.x,right:c.right+e*l.x}),{...n})}}const Co=wo(1);function Do(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 jo(e,t,n){const r=Do(t);if(!r)return e;const{scaleX:o,scaleY:i,x:c,y:l}=r,u=e.left-c-(1-o)*parseFloat(n),d=e.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),g=o?e.width/o:e.width,f=i?e.height/i:e.height;return{width:g,height:f,top:d,right:u+g,bottom:d+f,left:u}}const Ro={ignoreTransform:!1};function Ae(e,t){t===void 0&&(t=Ro);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:g}=ie(e).getComputedStyle(e);d&&(n=jo(n,d,g))}const{top:r,left:o,width:i,height:c,bottom:l,right:u}=n;return{top:r,left:o,width:i,height:c,bottom:l,right:u}}function yn(e){return Ae(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 To(e,t){return t===void 0&&(t=ie(e).getComputedStyle(e)),t.position==="fixed"}function Eo(e,t){t===void 0&&(t=ie(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function tn(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(Zt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Ke(o)||Hn(o)||n.includes(o))return n;const i=ie(e).getComputedStyle(o);return o!==e&&Eo(o,i)&&n.push(o),To(o,i)?n:r(o.parentNode)}return e?r(e):n}function Kn(e){const[t]=tn(e,1);return t??null}function Ot(e){return!yt||!e?null:Ie(e)?e:Jt(e)?Zt(e)||e===$e(e).scrollingElement?window:Ke(e)?e:null:null}function Jn(e){return Ie(e)?e.scrollX:e.scrollLeft}function Zn(e){return Ie(e)?e.scrollY:e.scrollTop}function Wt(e){return{x:Jn(e),y:Zn(e)}}var Q;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Q||(Q={}));function Qn(e){return!yt||!e?!1:e===document.scrollingElement}function er(e){const t={x:0,y:0},n=Qn(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,i=e.scrollLeft<=t.x,c=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:c,isRight:l,maxScroll:r,minScroll:t}}const _o={x:.2,y:.2};function Oo(e,t,n,r,o){let{top:i,left:c,right:l,bottom:u}=n;r===void 0&&(r=10),o===void 0&&(o=_o);const{isTop:d,isBottom:g,isLeft:f,isRight:x}=er(e),p={x:0,y:0},m={x:0,y:0},y={height:t.height*o.y,width:t.width*o.x};return!d&&i<=t.top+y.height?(p.y=Q.Backward,m.y=r*Math.abs((t.top+y.height-i)/y.height)):!g&&u>=t.bottom-y.height&&(p.y=Q.Forward,m.y=r*Math.abs((t.bottom-y.height-u)/y.height)),!x&&l>=t.right-y.width?(p.x=Q.Forward,m.x=r*Math.abs((t.right-y.width-l)/y.width)):!f&&c<=t.left+y.width&&(p.x=Q.Backward,m.x=r*Math.abs((t.left+y.width-c)/y.width)),{direction:p,speed:m}}function ko(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:c}=window;return{top:0,left:0,right:i,bottom:c,width:i,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 tr(e){return e.reduce((t,n)=>Oe(t,Wt(n)),he)}function Io(e){return e.reduce((t,n)=>t+Jn(n),0)}function $o(e){return e.reduce((t,n)=>t+Zn(n),0)}function Ao(e,t){if(t===void 0&&(t=Ae),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);Kn(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Lo=[["x",["left","right"],Io],["y",["top","bottom"],$o]];class nn{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=tn(n),o=tr(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,c,l]of Lo)for(const u of c)Object.defineProperty(this,u,{get:()=>{const d=l(r),g=o[i]-d;return this.rect[u]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ve{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 Po(e){const{EventTarget:t}=ie(e);return e instanceof t?e:$e(e)}function kt(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 de;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(de||(de={}));function Sn(e){e.preventDefault()}function No(e){e.stopPropagation()}var G;(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"})(G||(G={}));const nr={start:[G.Space,G.Enter],cancel:[G.Esc],end:[G.Space,G.Enter,G.Tab]},zo=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case G.Right:return{...n,x:n.x+25};case G.Left:return{...n,x:n.x-25};case G.Down:return{...n,y:n.y+25};case G.Up:return{...n,y:n.y-25}}};class rr{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 Ve($e(n)),this.windowListeners=new Ve(ie(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(de.Resize,this.handleCancel),this.windowListeners.add(de.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(de.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Ao(r),n(he)}handleKeyDown(t){if(en(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=nr,coordinateGetter:c=zo,scrollBehavior:l="smooth"}=o,{code:u}=t;if(i.end.includes(u)){this.handleEnd(t);return}if(i.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:d}=r.current,g=d?{x:d.left,y:d.top}:he;this.referenceCoordinates||(this.referenceCoordinates=g);const f=c(t,{active:n,context:r.current,currentCoordinates:g});if(f){const x=pt(f,g),p={x:0,y:0},{scrollableAncestors:m}=r.current;for(const y of m){const S=t.code,{isTop:R,isRight:T,isLeft:E,isBottom:A,maxScroll:$,minScroll:O}=er(y),I=ko(y),P={x:Math.min(S===G.Right?I.right-I.width/2:I.right,Math.max(S===G.Right?I.left:I.left+I.width/2,f.x)),y:Math.min(S===G.Down?I.bottom-I.height/2:I.bottom,Math.max(S===G.Down?I.top:I.top+I.height/2,f.y))},H=S===G.Right&&!T||S===G.Left&&!E,B=S===G.Down&&!A||S===G.Up&&!R;if(H&&P.x!==f.x){const k=y.scrollLeft+x.x,F=S===G.Right&&k<=$.x||S===G.Left&&k>=O.x;if(F&&!x.y){y.scrollTo({left:k,behavior:l});return}F?p.x=y.scrollLeft-k:p.x=S===G.Right?y.scrollLeft-$.x:y.scrollLeft-O.x,p.x&&y.scrollBy({left:-p.x,behavior:l});break}else if(B&&P.y!==f.y){const k=y.scrollTop+x.y,F=S===G.Down&&k<=$.y||S===G.Up&&k>=O.y;if(F&&!x.x){y.scrollTo({top:k,behavior:l});return}F?p.y=y.scrollTop-k:p.y=S===G.Down?y.scrollTop-$.y:y.scrollTop-O.y,p.y&&y.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(t,Oe(pt(f,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()}}rr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=nr,onActivation:o}=t,{active:i}=n;const{code:c}=e.nativeEvent;if(r.start.includes(c)){const l=i.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function wn(e){return!!(e&&"distance"in e)}function Cn(e){return!!(e&&"delay"in e)}class rn{constructor(t,n,r){var o;r===void 0&&(r=Po(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:i}=t,{target:c}=i;this.props=t,this.events=n,this.document=$e(c),this.documentListeners=new Ve(this.document),this.listeners=new Ve(r),this.windowListeners=new Ve(ie(c)),this.initialCoordinates=(o=Bt(i))!=null?o:he,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(de.Resize,this.handleCancel),this.windowListeners.add(de.DragStart,Sn),this.windowListeners.add(de.VisibilityChange,this.handleCancel),this.windowListeners.add(de.ContextMenu,Sn),this.documentListeners.add(de.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Cn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(wn(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(de.Click,No,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(de.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:c,options:{activationConstraint:l}}=i;if(!o)return;const u=(n=Bt(t))!=null?n:he,d=pt(o,u);if(!r&&l){if(wn(l)){if(l.tolerance!=null&&kt(d,l.tolerance))return this.handleCancel();if(kt(d,l.distance))return this.handleStart()}if(Cn(l)&&kt(d,l.tolerance))return this.handleCancel();this.handlePending(l,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===G.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Fo={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class on extends rn{constructor(t){const{event:n}=t,r=$e(n.target);super(t,Fo,r)}}on.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 Yo={move:{name:"mousemove"},end:{name:"mouseup"}};var Vt;(function(e){e[e.RightClick=2]="RightClick"})(Vt||(Vt={}));class Bo extends rn{constructor(t){super(t,Yo,$e(t.event.target))}}Bo.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Vt.RightClick?!1:(r?.({event:n}),!0)}}];const It={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Wo extends rn{constructor(t){super(t,It)}static setup(){return window.addEventListener(It.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(It.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 He;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(He||(He={}));var mt;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(mt||(mt={}));function Vo(e){let{acceleration:t,activator:n=He.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:c=5,order:l=mt.TreeOrder,pointerCoordinates:u,scrollableAncestors:d,scrollableAncestorRects:g,delta:f,threshold:x}=e;const p=Uo({delta:f,disabled:!i}),[m,y]=Qr(),S=h.useRef({x:0,y:0}),R=h.useRef({x:0,y:0}),T=h.useMemo(()=>{switch(n){case He.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case He.DraggableRect:return o}},[n,o,u]),E=h.useRef(null),A=h.useCallback(()=>{const O=E.current;if(!O)return;const I=S.current.x*R.current.x,P=S.current.y*R.current.y;O.scrollBy(I,P)},[]),$=h.useMemo(()=>l===mt.TreeOrder?[...d].reverse():d,[l,d]);h.useEffect(()=>{if(!i||!d.length||!T){y();return}for(const O of $){if(r?.(O)===!1)continue;const I=d.indexOf(O),P=g[I];if(!P)continue;const{direction:H,speed:B}=Oo(O,P,T,t,x);for(const k of["x","y"])p[k][H[k]]||(B[k]=0,H[k]=0);if(B.x>0||B.y>0){y(),E.current=O,m(A,c),S.current=B,R.current=H;return}}S.current={x:0,y:0},R.current={x:0,y:0},y()},[t,A,r,y,i,c,JSON.stringify(T),JSON.stringify(p),m,d,$,g,JSON.stringify(x)])}const Ho={x:{[Q.Backward]:!1,[Q.Forward]:!1},y:{[Q.Backward]:!1,[Q.Forward]:!1}};function Uo(e){let{delta:t,disabled:n}=e;const r=Yt(t);return Je(o=>{if(n||!r||!o)return Ho;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Q.Backward]:o.x[Q.Backward]||i.x===-1,[Q.Forward]:o.x[Q.Forward]||i.x===1},y:{[Q.Backward]:o.y[Q.Backward]||i.y===-1,[Q.Forward]:o.y[Q.Forward]||i.y===1}}},[n,t,r])}function Go(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Je(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function qo(e,t){return h.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,r)}));return[...n,...i]},[]),[e,t])}var qe;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(qe||(qe={}));var Ht;(function(e){e.Optimized="optimized"})(Ht||(Ht={}));const Dn=new Map;function Xo(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,c]=h.useState(null),{frequency:l,measure:u,strategy:d}=o,g=h.useRef(e),f=S(),x=Ge(f),p=h.useCallback(function(R){R===void 0&&(R=[]),!x.current&&c(T=>T===null?R:T.concat(R.filter(E=>!T.includes(E))))},[x]),m=h.useRef(null),y=Je(R=>{if(f&&!n)return Dn;if(!R||R===Dn||g.current!==e||i!=null){const T=new Map;for(let E of e){if(!E)continue;if(i&&i.length>0&&!i.includes(E.id)&&E.rect.current){T.set(E.id,E.rect.current);continue}const A=E.node.current,$=A?new nn(u(A),A):null;E.rect.current=$,$&&T.set(E.id,$)}return T}return R},[e,i,n,f,u]);return h.useEffect(()=>{g.current=e},[e]),h.useEffect(()=>{f||p()},[n,f]),h.useEffect(()=>{i&&i.length>0&&c(null)},[JSON.stringify(i)]),h.useEffect(()=>{f||typeof l!="number"||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},l))},[l,f,p,...r]),{droppableRects:y,measureDroppableContainers:p,measuringScheduled:i!=null};function S(){switch(d){case qe.Always:return!1;case qe.BeforeDragging:return n;default:return!n}}}function or(e,t){return Je(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Ko(e,t){return or(e,t)}function Jo(e){let{callback:t,disabled:n}=e;const r=Qt(t),o=h.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return h.useEffect(()=>()=>o?.disconnect(),[o]),o}function St(e){let{callback:t,disabled:n}=e;const r=Qt(t),o=h.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return h.useEffect(()=>()=>o?.disconnect(),[o]),o}function Zo(e){return new nn(Ae(e),e)}function jn(e,t,n){t===void 0&&(t=Zo);const[r,o]=h.useState(null);function i(){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=Jo({callback(u){if(e)for(const d of u){const{type:g,target:f}=d;if(g==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),l=St({callback:i});return ve(()=>{i(),e?(l?.observe(e),c?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),c?.disconnect())},[e]),r}function Qo(e){const t=or(e);return Xn(e,t)}const Rn=[];function es(e){const t=h.useRef(e),n=Je(r=>e?r&&r!==Rn&&e&&t.current&&e.parentNode===t.current.parentNode?r:tn(e):Rn,[e]);return h.useEffect(()=>{t.current=e},[e]),n}function ts(e){const[t,n]=h.useState(null),r=h.useRef(e),o=h.useCallback(i=>{const c=Ot(i.target);c&&n(l=>l?(l.set(c,Wt(c)),new Map(l)):null)},[]);return h.useEffect(()=>{const i=r.current;if(e!==i){c(i);const l=e.map(u=>{const d=Ot(u);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,Wt(d)]):null}).filter(u=>u!=null);n(l.length?new Map(l):null),r.current=e}return()=>{c(e),c(i)};function c(l){l.forEach(u=>{const d=Ot(u);d?.removeEventListener("scroll",o)})}},[o,e]),h.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,c)=>Oe(i,c),he):tr(e):he,[e,t])}function Mn(e,t){t===void 0&&(t=[]);const n=h.useRef(null);return h.useEffect(()=>{n.current=null},t),h.useEffect(()=>{const r=e!==he;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?pt(e,n.current):he}function ns(e){h.useEffect(()=>{if(!yt)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 rs(e,t){return h.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=c=>{i(c,t)},n},{}),[e,t])}function sr(e){return h.useMemo(()=>e?Mo(e):null,[e])}const Tn=[];function os(e,t){t===void 0&&(t=Ae);const[n]=e,r=sr(n?ie(n):null),[o,i]=h.useState(Tn);function c(){i(()=>e.length?e.map(u=>Qn(u)?r:new nn(t(u),u)):Tn)}const l=St({callback:c});return ve(()=>{l?.disconnect(),c(),e.forEach(u=>l?.observe(u))},[e]),o}function ss(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ke(t)?t:e}function is(e){let{measure:t}=e;const[n,r]=h.useState(null),o=h.useCallback(d=>{for(const{target:g}of d)if(Ke(g)){r(f=>{const x=t(g);return f?{...f,width:x.width,height:x.height}:x});break}},[t]),i=St({callback:o}),c=h.useCallback(d=>{const g=ss(d);i?.disconnect(),g&&i?.observe(g),r(g?t(g):null)},[t,i]),[l,u]=gt(c);return h.useMemo(()=>({nodeRef:l,rect:n,setRef:u}),[n,l,u])}const as=[{sensor:on,options:{}},{sensor:rr,options:{}}],ls={current:{}},ct={draggable:{measure:yn},droppable:{measure:yn,strategy:qe.WhileDragging,frequency:Ht.Optimized},dragOverlay:{measure:Ae}};class Ue 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 cs={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ue,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:vt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ct,measureDroppableContainers:vt,windowRect:null,measuringScheduled:!1},us={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:vt,draggableNodes:new Map,over:null,measureDroppableContainers:vt},wt=h.createContext(us),ir=h.createContext(cs);function ds(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ue}}}function fs(e,t){switch(t.type){case Z.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Z.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 Z.DragEnd:case Z.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Z.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Ue(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case Z.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const c=new Ue(e.droppable.containers);return c.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:c}}}case Z.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Ue(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function hs(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=h.useContext(wt),i=Yt(r),c=Yt(n?.id);return h.useEffect(()=>{if(!t&&!r&&i&&c!=null){if(!en(i)||document.activeElement===i.target)return;const l=o.get(c);if(!l)return;const{activatorNode:u,node:d}=l;if(!u.current&&!d.current)return;requestAnimationFrame(()=>{for(const g of[u.current,d.current]){if(!g)continue;const f=no(g);if(f){f.focus();break}}})}},[r,t,o,c,i]),null}function gs(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function ps(e){return h.useMemo(()=>({draggable:{...ct.draggable,...e?.draggable},droppable:{...ct.droppable,...e?.droppable},dragOverlay:{...ct.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function vs(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=h.useRef(!1),{x:c,y:l}=typeof o=="boolean"?{x:o,y:o}:o;ve(()=>{if(!c&&!l||!t){i.current=!1;return}if(i.current||!r)return;const d=t?.node.current;if(!d||d.isConnected===!1)return;const g=n(d),f=Xn(g,r);if(c||(f.x=0),l||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const x=Kn(d);x&&x.scrollBy({top:f.y,left:f.x})}},[t,c,l,r,n])}const ar=h.createContext({...he,scaleX:1,scaleY:1});var De;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(De||(De={}));const lr=h.memo(function(t){var n,r,o,i;let{id:c,accessibility:l,autoScroll:u=!0,children:d,sensors:g=as,collisionDetection:f=yo,measuring:x,modifiers:p,...m}=t;const y=h.useReducer(fs,void 0,ds),[S,R]=y,[T,E]=lo(),[A,$]=h.useState(De.Uninitialized),O=A===De.Initialized,{draggable:{active:I,nodes:P,translate:H},droppable:{containers:B}}=S,k=I!=null?P.get(I):null,F=h.useRef({initial:null,translated:null}),N=h.useMemo(()=>{var oe;return I!=null?{id:I,data:(oe=k?.data)!=null?oe:ls,rect:F}:null},[I,k]),D=h.useRef(null),[C,w]=h.useState(null),[j,M]=h.useState(null),L=Ge(m,Object.values(m)),Y=Ze("DndDescribedBy",c),v=h.useMemo(()=>B.getEnabled(),[B]),_=ps(x),{droppableRects:z,measureDroppableContainers:W,measuringScheduled:q}=Xo(v,{dragging:O,dependencies:[H.x,H.y],config:_.droppable}),X=Go(P,I),U=h.useMemo(()=>j?Bt(j):null,[j]),K=qr(),J=Ko(X,_.draggable.measure);vs({activeNode:I!=null?P.get(I):null,config:K.layoutShiftCompensation,initialRect:J,measure:_.draggable.measure});const V=jn(X,_.draggable.measure,J),se=jn(X?X.parentElement:null),re=h.useRef({activatorEvent:null,active:null,activeNode:X,collisionRect:null,collisions:null,droppableRects:z,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:B,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),fe=B.getNodeFor((n=re.current.over)==null?void 0:n.id),me=is({measure:_.dragOverlay.measure}),Re=(r=me.nodeRef.current)!=null?r:X,Me=O?(o=me.rect)!=null?o:V:null,an=!!(me.nodeRef.current&&me.rect),ln=Qo(an?null:V),Mt=sr(Re?ie(Re):null),be=es(O?fe??X:null),et=os(be),tt=gs(p,{transform:{x:H.x-ln.x,y:H.y-ln.y,scaleX:1,scaleY:1},activatorEvent:j,active:N,activeNodeRect:V,containerNodeRect:se,draggingNodeRect:Me,over:re.current.over,overlayNodeRect:me.rect,scrollableAncestors:be,scrollableAncestorRects:et,windowRect:Mt}),cn=U?Oe(U,H):null,un=ts(be),Yr=Mn(un),Br=Mn(un,[V]),Te=Oe(tt,Yr),Ee=Me?Co(Me,tt):null,Pe=N&&Ee?f({active:N,collisionRect:Ee,droppableRects:z,droppableContainers:v,pointerCoordinates:cn}):null,dn=xo(Pe,"id"),[ye,fn]=h.useState(null),Wr=an?tt:Oe(tt,Br),Vr=So(Wr,(i=ye?.rect)!=null?i:null,V),Tt=h.useRef(null),hn=h.useCallback((oe,ae)=>{let{sensor:le,options:Se}=ae;if(D.current==null)return;const ue=P.get(D.current);if(!ue)return;const ce=oe.nativeEvent,ge=new le({active:D.current,activeNode:ue,event:ce,options:Se,context:re,onAbort(ee){if(!P.get(ee))return;const{onDragAbort:pe}=L.current,xe={id:ee};pe?.(xe),T({type:"onDragAbort",event:xe})},onPending(ee,we,pe,xe){if(!P.get(ee))return;const{onDragPending:ze}=L.current,Ce={id:ee,constraint:we,initialCoordinates:pe,offset:xe};ze?.(Ce),T({type:"onDragPending",event:Ce})},onStart(ee){const we=D.current;if(we==null)return;const pe=P.get(we);if(!pe)return;const{onDragStart:xe}=L.current,Ne={activatorEvent:ce,active:{id:we,data:pe.data,rect:F}};We.unstable_batchedUpdates(()=>{xe?.(Ne),$(De.Initializing),R({type:Z.DragStart,initialCoordinates:ee,active:we}),T({type:"onDragStart",event:Ne}),w(Tt.current),M(ce)})},onMove(ee){R({type:Z.DragMove,coordinates:ee})},onEnd:_e(Z.DragEnd),onCancel:_e(Z.DragCancel)});Tt.current=ge;function _e(ee){return async function(){const{active:pe,collisions:xe,over:Ne,scrollAdjustedTranslate:ze}=re.current;let Ce=null;if(pe&&ze){const{cancelDrop:Fe}=L.current;Ce={activatorEvent:ce,active:pe,collisions:xe,delta:ze,over:Ne},ee===Z.DragEnd&&typeof Fe=="function"&&await Promise.resolve(Fe(Ce))&&(ee=Z.DragCancel)}D.current=null,We.unstable_batchedUpdates(()=>{R({type:ee}),$(De.Uninitialized),fn(null),w(null),M(null),Tt.current=null;const Fe=ee===Z.DragEnd?"onDragEnd":"onDragCancel";if(Ce){const Et=L.current[Fe];Et?.(Ce),T({type:Fe,event:Ce})}})}}},[P]),Hr=h.useCallback((oe,ae)=>(le,Se)=>{const ue=le.nativeEvent,ce=P.get(Se);if(D.current!==null||!ce||ue.dndKit||ue.defaultPrevented)return;const ge={active:ce};oe(le,ae.options,ge)===!0&&(ue.dndKit={capturedBy:ae.sensor},D.current=Se,hn(le,ae))},[P,hn]),gn=qo(g,Hr);ns(g),ve(()=>{V&&A===De.Initializing&&$(De.Initialized)},[V,A]),h.useEffect(()=>{const{onDragMove:oe}=L.current,{active:ae,activatorEvent:le,collisions:Se,over:ue}=re.current;if(!ae||!le)return;const ce={active:ae,activatorEvent:le,collisions:Se,delta:{x:Te.x,y:Te.y},over:ue};We.unstable_batchedUpdates(()=>{oe?.(ce),T({type:"onDragMove",event:ce})})},[Te.x,Te.y]),h.useEffect(()=>{const{active:oe,activatorEvent:ae,collisions:le,droppableContainers:Se,scrollAdjustedTranslate:ue}=re.current;if(!oe||D.current==null||!ae||!ue)return;const{onDragOver:ce}=L.current,ge=Se.get(dn),_e=ge&&ge.rect.current?{id:ge.id,rect:ge.rect.current,data:ge.data,disabled:ge.disabled}:null,ee={active:oe,activatorEvent:ae,collisions:le,delta:{x:ue.x,y:ue.y},over:_e};We.unstable_batchedUpdates(()=>{fn(_e),ce?.(ee),T({type:"onDragOver",event:ee})})},[dn]),ve(()=>{re.current={activatorEvent:j,active:N,activeNode:X,collisionRect:Ee,collisions:Pe,droppableRects:z,draggableNodes:P,draggingNode:Re,draggingNodeRect:Me,droppableContainers:B,over:ye,scrollableAncestors:be,scrollAdjustedTranslate:Te},F.current={initial:Me,translated:Ee}},[N,X,Pe,Ee,P,Re,Me,z,B,ye,be,Te]),Vo({...K,delta:H,draggingRect:Ee,pointerCoordinates:cn,scrollableAncestors:be,scrollableAncestorRects:et});const Ur=h.useMemo(()=>({active:N,activeNode:X,activeNodeRect:V,activatorEvent:j,collisions:Pe,containerNodeRect:se,dragOverlay:me,draggableNodes:P,droppableContainers:B,droppableRects:z,over:ye,measureDroppableContainers:W,scrollableAncestors:be,scrollableAncestorRects:et,measuringConfiguration:_,measuringScheduled:q,windowRect:Mt}),[N,X,V,j,Pe,se,me,P,B,z,ye,W,be,et,_,q,Mt]),Gr=h.useMemo(()=>({activatorEvent:j,activators:gn,active:N,activeNodeRect:V,ariaDescribedById:{draggable:Y},dispatch:R,draggableNodes:P,over:ye,measureDroppableContainers:W}),[j,gn,N,V,R,Y,P,ye,W]);return h.createElement(Gn.Provider,{value:E},h.createElement(wt.Provider,{value:Gr},h.createElement(ir.Provider,{value:Ur},h.createElement(ar.Provider,{value:Vr},d)),h.createElement(hs,{disabled:l?.restoreFocus===!1})),h.createElement(fo,{...l,hiddenTextDescribedById:Y}));function qr(){const oe=C?.autoScrollEnabled===!1,ae=typeof u=="object"?u.enabled===!1:u===!1,le=O&&!oe&&!ae;return typeof u=="object"?{...u,enabled:le}:{enabled:le}}}),ms=h.createContext(null),En="button",xs="Draggable";function bs(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=Ze(xs),{activators:c,activatorEvent:l,active:u,activeNodeRect:d,ariaDescribedById:g,draggableNodes:f,over:x}=h.useContext(wt),{role:p=En,roleDescription:m="draggable",tabIndex:y=0}=o??{},S=u?.id===t,R=h.useContext(S?ar:ms),[T,E]=gt(),[A,$]=gt(),O=rs(c,t),I=Ge(n);ve(()=>(f.set(t,{id:t,key:i,node:T,activatorNode:A,data:I}),()=>{const H=f.get(t);H&&H.key===i&&f.delete(t)}),[f,t]);const P=h.useMemo(()=>({role:p,tabIndex:y,"aria-disabled":r,"aria-pressed":S&&p===En?!0:void 0,"aria-roledescription":m,"aria-describedby":g.draggable}),[r,p,y,S,m,g.draggable]);return{active:u,activatorEvent:l,activeNodeRect:d,attributes:P,isDragging:S,listeners:r?void 0:O,node:T,over:x,setNodeRef:E,setActivatorNodeRef:$,transform:R}}function ys(){return h.useContext(ir)}const Ss="Droppable",ws={timeout:25};function Cs(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=Ze(Ss),{active:c,dispatch:l,over:u,measureDroppableContainers:d}=h.useContext(wt),g=h.useRef({disabled:n}),f=h.useRef(!1),x=h.useRef(null),p=h.useRef(null),{disabled:m,updateMeasurementsFor:y,timeout:S}={...ws,...o},R=Ge(y??r),T=h.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{d(Array.isArray(R.current)?R.current:[R.current]),p.current=null},S)},[S]),E=St({callback:T,disabled:m||!c}),A=h.useCallback((P,H)=>{E&&(H&&(E.unobserve(H),f.current=!1),P&&E.observe(P))},[E]),[$,O]=gt(A),I=Ge(t);return h.useEffect(()=>{!E||!$.current||(E.disconnect(),f.current=!1,E.observe($.current))},[$,E]),h.useEffect(()=>(l({type:Z.RegisterDroppable,element:{id:r,key:i,disabled:n,node:$,rect:x,data:I}}),()=>l({type:Z.UnregisterDroppable,key:i,id:r})),[r]),h.useEffect(()=>{n!==g.current.disabled&&(l({type:Z.SetDroppableDisabled,id:r,key:i,disabled:n}),g.current.disabled=n)},[r,i,n,l]),{active:c,rect:x,isOver:u?.id===r,node:$,over:u,setNodeRef:O}}function Ct(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Ds(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function rt(e){return e!==null&&e>=0}function js(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 Rs(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const ot={scaleX:1,scaleY:1},Ms=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:i,index:c}=e;const l=(t=n[o])!=null?t:r;if(!l)return null;const u=Ts(n,c,o);if(c===o){const d=n[i];return d?{x:o<i?d.left+d.width-(l.left+l.width):d.left-l.left,y:0,...ot}:null}return c>o&&c<=i?{x:-l.width-u,y:0,...ot}:c<o&&c>=i?{x:l.width+u,y:0,...ot}:{x:0,y:0,...ot}};function Ts(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return!r||!o&&!i?0:n<t?o?r.left-(o.left+o.width):i.left-(r.left+r.width):i?i.left-(r.left+r.width):r.left-(o.left+o.width)}const cr=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=Ct(t,r,n),c=t[o],l=i[o];return!l||!c?null:{x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height}},st={scaleX:1,scaleY:1},Es=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:c}=e;const l=(t=i[n])!=null?t:r;if(!l)return null;if(o===n){const d=i[c];return d?{x:0,y:n<c?d.top+d.height-(l.top+l.height):d.top-l.top,...st}:null}const u=_s(i,o,n);return o>n&&o<=c?{x:0,y:-l.height-u,...st}:o<n&&o>=c?{x:0,y:l.height+u,...st}:{x:0,y:0,...st}};function _s(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return r?n<t?o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const ur="Sortable",dr=h.createContext({activeIndex:-1,containerId:ur,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:cr,disabled:{draggable:!1,droppable:!1}});function fr(e){let{children:t,id:n,items:r,strategy:o=cr,disabled:i=!1}=e;const{active:c,dragOverlay:l,droppableRects:u,over:d,measureDroppableContainers:g}=ys(),f=Ze(ur,n),x=l.rect!==null,p=h.useMemo(()=>r.map(O=>typeof O=="object"&&"id"in O?O.id:O),[r]),m=c!=null,y=c?p.indexOf(c.id):-1,S=d?p.indexOf(d.id):-1,R=h.useRef(p),T=!js(p,R.current),E=S!==-1&&y===-1||T,A=Rs(i);ve(()=>{T&&m&&g(p)},[T,p,m,g]),h.useEffect(()=>{R.current=p},[p]);const $=h.useMemo(()=>({activeIndex:y,containerId:f,disabled:A,disableTransforms:E,items:p,overIndex:S,useDragOverlay:x,sortedRects:Ds(p,u),strategy:o}),[y,f,A.draggable,A.droppable,E,p,S,u,x,o]);return h.createElement(dr.Provider,{value:$},t)}const Os=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Ct(n,r,o).indexOf(t)},ks=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:c,previousItems:l,previousContainerId:u,transition:d}=e;return!d||!r||l!==i&&o===c?!1:n?!0:c!==o&&t===u},Is={duration:200,easing:"ease"},hr="transform",$s=ke.Transition.toString({property:hr,duration:0,easing:"linear"}),As={roleDescription:"sortable"};function Ls(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,c]=h.useState(null),l=h.useRef(n);return ve(()=>{if(!t&&n!==l.current&&r.current){const u=o.current;if(u){const d=Ae(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!==l.current&&(l.current=n)},[t,n,r,o]),h.useEffect(()=>{i&&c(null)},[i]),i}function gr(e){let{animateLayoutChanges:t=ks,attributes:n,disabled:r,data:o,getNewIndex:i=Os,id:c,strategy:l,resizeObserverConfig:u,transition:d=Is}=e;const{items:g,containerId:f,activeIndex:x,disabled:p,disableTransforms:m,sortedRects:y,overIndex:S,useDragOverlay:R,strategy:T}=h.useContext(dr),E=Ps(r,p),A=g.indexOf(c),$=h.useMemo(()=>({sortable:{containerId:f,index:A,items:g},...o}),[f,o,A,g]),O=h.useMemo(()=>g.slice(g.indexOf(c)),[g,c]),{rect:I,node:P,isOver:H,setNodeRef:B}=Cs({id:c,data:$,disabled:E.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...u}}),{active:k,activatorEvent:F,activeNodeRect:N,attributes:D,setNodeRef:C,listeners:w,isDragging:j,over:M,setActivatorNodeRef:L,transform:Y}=bs({id:c,data:$,attributes:{...As,...n},disabled:E.draggable}),v=Zr(B,C),_=!!k,z=_&&!m&&rt(x)&&rt(S),W=!R&&j,q=W&&z?Y:null,U=z?q??(l??T)({rects:y,activeNodeRect:N,activeIndex:x,overIndex:S,index:A}):null,K=rt(x)&&rt(S)?i({id:c,items:g,activeIndex:x,overIndex:S}):A,J=k?.id,V=h.useRef({activeId:J,items:g,newIndex:K,containerId:f}),se=g!==V.current.items,re=t({active:k,containerId:f,isDragging:j,isSorting:_,id:c,index:A,items:g,newIndex:V.current.newIndex,previousItems:V.current.items,previousContainerId:V.current.containerId,transition:d,wasDragging:V.current.activeId!=null}),fe=Ls({disabled:!re,index:A,node:P,rect:I});return h.useEffect(()=>{_&&V.current.newIndex!==K&&(V.current.newIndex=K),f!==V.current.containerId&&(V.current.containerId=f),g!==V.current.items&&(V.current.items=g)},[_,K,f,g]),h.useEffect(()=>{if(J===V.current.activeId)return;if(J!=null&&V.current.activeId==null){V.current.activeId=J;return}const Re=setTimeout(()=>{V.current.activeId=J},50);return()=>clearTimeout(Re)},[J]),{active:k,activeIndex:x,attributes:D,data:$,rect:I,index:A,newIndex:K,items:g,isOver:H,isSorting:_,isDragging:j,listeners:w,node:P,overIndex:S,over:M,setNodeRef:v,setActivatorNodeRef:L,setDroppableNodeRef:B,setDraggableNodeRef:C,transform:fe??U,transition:me()};function me(){if(fe||se&&V.current.newIndex===A)return $s;if(!(W&&!en(F)||!d)&&(_||re))return ke.Transition.toString({...d,property:hr})}}function Ps(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}}G.Down,G.Right,G.Up,G.Left;var it={exports:{}},$t={},at={exports:{}},At={};var _n;function Ns(){if(_n)return At;_n=1;var e=h;function t(f,x){return f===x&&(f!==0||1/f===1/x)||f!==f&&x!==x}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,i=e.useLayoutEffect,c=e.useDebugValue;function l(f,x){var p=x(),m=r({inst:{value:p,getSnapshot:x}}),y=m[0].inst,S=m[1];return i(function(){y.value=p,y.getSnapshot=x,u(y)&&S({inst:y})},[f,p,x]),o(function(){return u(y)&&S({inst:y}),f(function(){u(y)&&S({inst:y})})},[f]),c(p),p}function u(f){var x=f.getSnapshot;f=f.value;try{var p=x();return!n(f,p)}catch{return!0}}function d(f,x){return x()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:l;return At.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,At}var Lt={};var On;function zs(){return On||(On=1,process.env.NODE_ENV!=="production"&&(function(){function e(p,m){return p===m&&(p!==0||1/p===1/m)||p!==p&&m!==m}function t(p,m){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 y=m();if(!f){var S=m();i(y,S)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}S=c({inst:{value:y,getSnapshot:m}});var R=S[0].inst,T=S[1];return u(function(){R.value=y,R.getSnapshot=m,n(R)&&T({inst:R})},[p,y,m]),l(function(){return n(R)&&T({inst:R}),p(function(){n(R)&&T({inst:R})})},[p]),d(y),y}function n(p){var m=p.getSnapshot;p=p.value;try{var y=m();return!i(p,y)}catch{return!0}}function r(p,m){return m()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=h,i=typeof Object.is=="function"?Object.is:e,c=o.useState,l=o.useEffect,u=o.useLayoutEffect,d=o.useDebugValue,g=!1,f=!1,x=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;Lt.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())})()),Lt}var kn;function pr(){return kn||(kn=1,process.env.NODE_ENV==="production"?at.exports=Ns():at.exports=zs()),at.exports}var In;function Fs(){if(In)return $t;In=1;var e=h,t=pr();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,i=e.useRef,c=e.useEffect,l=e.useMemo,u=e.useDebugValue;return $t.useSyncExternalStoreWithSelector=function(d,g,f,x,p){var m=i(null);if(m.current===null){var y={hasValue:!1,value:null};m.current=y}else y=m.current;m=l(function(){function R(O){if(!T){if(T=!0,E=O,O=x(O),p!==void 0&&y.hasValue){var I=y.value;if(p(I,O))return A=I}return A=O}if(I=A,r(E,O))return I;var P=x(O);return p!==void 0&&p(I,P)?(E=O,I):(E=O,A=P)}var T=!1,E,A,$=f===void 0?null:f;return[function(){return R(g())},$===null?void 0:function(){return R($())}]},[g,f,x,p]);var S=o(d,m[0],m[1]);return c(function(){y.hasValue=!0,y.value=S},[S]),u(S),S},$t}var Pt={};var $n;function Ys(){return $n||($n=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=h,n=pr(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,i=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;Pt.useSyncExternalStoreWithSelector=function(d,g,f,x,p){var m=i(null);if(m.current===null){var y={hasValue:!1,value:null};m.current=y}else y=m.current;m=l(function(){function R(O){if(!T){if(T=!0,E=O,O=x(O),p!==void 0&&y.hasValue){var I=y.value;if(p(I,O))return A=I}return A=O}if(I=A,r(E,O))return I;var P=x(O);return p!==void 0&&p(I,P)?(E=O,I):(E=O,A=P)}var T=!1,E,A,$=f===void 0?null:f;return[function(){return R(g())},$===null?void 0:function(){return R($())}]},[g,f,x,p]);var S=o(d,m[0],m[1]);return c(function(){y.hasValue=!0,y.value=S},[S]),u(S),S},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Pt}var An;function Bs(){return An||(An=1,process.env.NODE_ENV==="production"?it.exports=Fs():it.exports=Ys()),it.exports}var Ws=Bs();const Ut=new WeakMap,Vs=new WeakMap,xt={current:[]};let Nt=!1;const lt=new Set,Ln=new Map;function vr(e){for(const t of e){if(xt.current.includes(t))continue;xt.current.push(t),t.recompute();const n=Vs.get(t);if(n)for(const r of n){const o=Ut.get(r);o?.length&&vr(o)}}}function Hs(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Us(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Gs(e){if(lt.add(e),!Nt)try{for(Nt=!0;lt.size>0;){const t=Array.from(lt);lt.clear();for(const n of t){const r=Ln.get(n)??n.prevState;n.prevState=r,Hs(n)}for(const n of t){const r=Ut.get(n);r&&(xt.current.push(n),vr(r))}for(const n of t){const r=Ut.get(n);if(r)for(const o of r)Us(o)}}}finally{Nt=!1,xt.current=[],Ln.clear()}}function qs(e){return typeof e=="function"}class mr{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var o,i;this.listeners.add(r);const c=(i=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:i.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):qs(t)?this.state=t(this.prevState):this.state=t,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),Gs(this)}}function Le(e,t=r=>r,n={}){const r=n.equal??Xs;return Ws.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,r)}function Xs(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=Pn(e);if(n.length!==Pn(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 Pn(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}const te=new mr({tableId:"",sortColumn:null,sortDirection:"asc",visibility:{},columnOrder:[],columnWidths:{},data:[],sortableColumns:[],actionsConfig:{showActionColumn:!0,showColumnVisibilityMenu:!0,children:"Actions",width:"100px"}}),Dt=e=>`datatable:${e}:column-widths`;function xr(e,t){const n=e[0]??{},o=(t&&t.length?t:Object.keys(n).map(f=>({id:f,label:f}))).filter(f=>Object.prototype.hasOwnProperty.call(n,f.id)),{tableId:i}=te.state,c=JSON.parse(localStorage.getItem(Sr(i))||"[]"),l=[...c.map(f=>o.find(x=>x.id===f)).filter(Boolean),...o.filter(f=>!c.includes(f.id))],u=JSON.parse(localStorage.getItem(wr(i))||"{}"),d=l.reduce((f,x)=>(f[x.id]=u[x.id]??!0,f),{}),g=JSON.parse(localStorage.getItem(Dt(i))||"{}");te.setState(f=>({...f,data:e,columnOrder:l,visibility:d,columnWidths:g,sortableColumns:l.map(x=>({id:x.id,label:x.label,sortable:!0,backgroundColor:x.backgroundColor}))}))}function br(e){te.setState(t=>({...t,tableId:e,sortColumn:null,sortDirection:"asc",columnOrder:[],visibility:{}}))}const yr=e=>{te.setState(t=>({...t,actionsConfig:e}))};function Ks(e,t){te.setState(n=>{const r={...n.columnWidths,[e]:Math.max(60,t)};return localStorage.setItem(Dt(n.tableId),JSON.stringify(r)),{...n,columnWidths:r}})}const Sr=e=>`table_column_order_v1:${e}`,wr=e=>`table_column_visibility_v1:${e}`,Js=e=>{const{tableId:t}=te.state;localStorage.setItem(Sr(t),JSON.stringify(e.map(n=>n.id))),te.setState(n=>({...n,columnOrder:e})),te.setState(n=>({...n,columnOrder:e}))};function Zs(e){te.setState(t=>t.sortColumn===e?{...t,sortDirection:t.sortDirection==="asc"?"desc":"asc"}:{...t,sortColumn:e,sortDirection:"asc"})}const Qs=e=>{te.setState(t=>{const n={...t.visibility,[e]:!t.visibility[e]};return t.tableId&&localStorage.setItem(wr(t.tableId),JSON.stringify(n)),{...t,visibility:n}})};function ei(e,t){te.setState(n=>{const r={...n.columnWidths,[e]:Math.max(60,t)};return localStorage.setItem(Dt(n.tableId),JSON.stringify(r)),{...n,columnWidths:r}})}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()),Nn=e=>{const t=ni(e);return t.charAt(0).toUpperCase()+t.slice(1)},Cr=(...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=h.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:c,...l},u)=>h.createElement("svg",{ref:u,...oi,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Cr("lucide",o),...!i&&!ri(l)&&{"aria-hidden":"true"},...l},[...c.map(([d,g])=>h.createElement(d,g)),...Array.isArray(i)?i:[i]]));const ne=(e,t)=>{const n=h.forwardRef(({className:r,...o},i)=>h.createElement(si,{ref:i,iconNode:t,className:Cr(`lucide-${ti(Nn(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Nn(e),n};const ii=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ai=ne("arrow-down",ii);const li=[["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"}]],ci=ne("arrow-up-down",li);const ui=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],di=ne("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=ne("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"}]],Dr=ne("calendar",gi);const pi=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],vi=ne("chevron-left",pi);const mi=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],xi=ne("chevron-right",mi);const bi=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],yi=ne("columns-2",bi);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=ne("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=ne("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=ne("funnel",ji);const Mi=[["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"}]],jr=ne("grip-vertical",Mi);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"}]],Ei=ne("pen",Ti);const _i=[["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"}]],Oi=ne("refresh-ccw",_i);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"}]],Ii=ne("settings",ki);const $i=[["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"}]],Rr=ne("triangle-alert",$i);const Ai=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Li=ne("x",Ai);function b(e){return h.forwardRef((t,n)=>{const{children:r,...o}=t;return s.jsx(e,{ref:n,...o,children:r})})}const Pi=b(a.Menu.Trigger),Ni=b(a.Menu.Positioner),zi=b(a.Menu.Content),Fi=b(a.Menu.Item),Yi=b(a.Checkbox.Label),Bi=b(a.Checkbox.HiddenInput),Wi=b(a.Checkbox.Control);function Vi({visibility:e,onToggle:t}){const{sortableColumns:n}=Le(te);return s.jsxs(a.Menu.Root,{closeOnSelect:!1,children:[s.jsx(Pi,{asChild:!0,children:s.jsx(a.IconButton,{"aria-label":"Toggle columns",variant:"ghost",ml:"1",size:"xs",children:s.jsx(yi,{size:18})})}),s.jsx(a.Portal,{children:s.jsx(Ni,{children:s.jsx(zi,{minW:"220px",children:n.map(r=>{const o=!!e[r.id];return s.jsx(Fi,{value:r.id,closeOnSelect:!1,children:s.jsxs(a.Checkbox.Root,{checked:o,onCheckedChange:()=>t(r.id),children:[s.jsx(Bi,{}),s.jsx(Wi,{}),s.jsx(Yi,{children:r.label})]})},r.id)})})})})]})}function Hi({id:e,children:t,onClick:n,cursor:r,borderRight:o,backgroundColor:i}){const{columnWidths:c}=Le(te),l=c[e],u=h.useRef(0),d=h.useRef(0),{setNodeRef:g,attributes:f,listeners:x,transform:p,transition:m}=gr({id:e}),y=S=>{S.stopPropagation(),u.current=S.clientX,d.current=l??150;const R=E=>{ei(e,d.current+(E.clientX-u.current))},T=()=>{document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",T)};document.addEventListener("mousemove",R),document.addEventListener("mouseup",T)};return s.jsx(a.Table.ColumnHeader,{ref:g,onClick:n,backgroundColor:i,w:l?`${l}px`:void 0,minW:"60px",style:{transform:ke.Transform.toString(p),transition:m,cursor:r,borderRight:o},...f,children:s.jsxs(a.HStack,{position:"relative",children:[s.jsx("span",{...x,children:s.jsx(jr,{size:12,style:{cursor:"grab"}})}),t,s.jsx(a.Box,{position:"absolute",right:0,top:0,h:"100%",w:"5px",cursor:"col-resize",background:"gray.400",onMouseDown:y,_hover:{bg:"gray.600"}})]})})}function Ui(){const{columnOrder:e,visibility:t,sortColumn:n,sortDirection:r,sortableColumns:o,actionsConfig:i}=Le(te),c=e.map(l=>o.find(u=>u.id===l.id)).filter(l=>l!==void 0).filter(l=>t[l.id]);return s.jsx(a.Table.Header,{background:"blue.200",position:"sticky",top:0,p:"0",zIndex:1,children:s.jsxs(a.Table.Row,{height:"28px",children:[i?.showSNo&&s.jsx(a.Table.ColumnHeader,{width:"20px",textAlign:"center",backgroundColor:i.backgroundColor,borderRight:"2px solid #dcdcdc",children:i.indexChildren||"S.No"}),c.map(l=>{const u=n===l?.id;return s.jsx(Hi,{id:l?.id,onClick:()=>l?.sortable&&Zs(l?.id),borderRight:"2px solid #dcdcdc",backgroundColor:l?.backgroundColor,children:s.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,userSelect:"none"},children:[l?.label,l?.sortable&&(u?r==="asc"?s.jsx(di,{size:14}):s.jsx(ai,{size:14}):s.jsx(ci,{size:14,opacity:.4}))]})},l?.id)}),i?.showActionColumn&&s.jsx(a.Table.ColumnHeader,{width:i.width,backgroundColor:i.backgroundColor,borderRight:"2px solid #dcdcdc",children:i.children||"Actions"}),i?.showColumnVisibilityMenu&&s.jsx(a.Table.ColumnHeader,{boxSize:"0.5",backgroundColor:i.backgroundColorColumnVisibilityMenu,children:s.jsx(Vi,{visibility:t,onToggle:Qs})})]})})}const Gi=[10,20,50,100],qi=b(a.Select.Positioner),Xi=b(a.Select.Content),Ki=b(a.Select.Item),Ji=b(a.Pagination.PrevTrigger),Zi=b(a.Pagination.NextTrigger),Qi=b(a.Select.HiddenSelect),ea=b(a.Select.Control),ta=b(a.Select.Trigger),na=b(a.Select.ValueText),ra=b(a.Select.IndicatorGroup),oa=b(a.Select.Indicator);function sa({totalCount:e,pageSize:t,currentPage:n,onPageChange:r,onPageSizeChange:o,siblingCount:i=2,pageSizeOptions:c=Gi}){const l=a.createListCollection({items:c.map(u=>({label:String(u),value:String(u)}))});return s.jsx(a.Box,{width:"100%",children:s.jsxs(a.HStack,{justify:"space-between",mx:"auto",flexWrap:"wrap",children:[s.jsxs(a.HStack,{children:[s.jsx(a.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:"Rows per page:"}),s.jsxs(a.Select.Root,{collection:l,size:"sm",width:"60px",onValueChange:u=>o?.(Number(u.items[0].value)),value:[String(t)],children:[s.jsx(Qi,{}),s.jsxs(ea,{children:[s.jsx(ta,{children:s.jsx(na,{placeholder:""})}),s.jsx(ra,{children:s.jsx(oa,{})})]}),s.jsx(a.Portal,{children:s.jsx(qi,{children:s.jsx(Xi,{children:l.items.map(u=>s.jsxs(Ki,{item:u.value,children:[u.label,s.jsx(a.Select.ItemIndicator,{})]},u.value))})})})]}),s.jsxs(a.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:["of ",e]})]}),s.jsx(a.Pagination.Root,{count:e,pageSize:t,page:n,siblingCount:i,onPageChange:u=>r&&r(u.page),children:s.jsxs(a.ButtonGroup,{size:"sm",variant:"ghost",children:[s.jsx(Ji,{asChild:!0,children:s.jsx(a.IconButton,{"aria-label":"Previous page",children:s.jsx(vi,{size:18})})}),s.jsx(a.Pagination.Items,{render:u=>s.jsx(a.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)}),s.jsx(Zi,{asChild:!0,children:s.jsx(a.IconButton,{"aria-label":"Next page",children:s.jsx(xi,{size:18})})})]})})]})})}const ia=b(a.Menu.Item),aa=b(a.Menu.Content),la=b(a.Menu.Positioner),ca=b(a.Menu.Trigger);function ua({data:e=[],actions:t=[],actionConfig:n,onRowSelect:r,onRowSelectEvent:o="left",startIndex:i=0}){const{columnOrder:c,visibility:l,columnWidths:u}=Le(te);return s.jsx(a.Table.Body,{children:e.map((d,g)=>s.jsxs(a.Table.Row,{onClick:()=>o==="left"&&r?.(d.__raw),_hover:{bg:"blue.50"},onContextMenu:o==="right"?f=>{f.preventDefault(),r?.(d.__raw,f)}:void 0,children:[n?.showSNo&&s.jsx(a.Table.Cell,{textAlign:"center",fontWeight:"medium",children:i+g+1}),c.filter(f=>l[f.id]).map(f=>s.jsx(a.Table.Cell,{w:u[f.id]?u[f.id]+"px":void 0,children:d[f.id]},f.id)),n?.showActionColumn&&s.jsx(a.Table.Cell,{textAlign:"center",display:"flex",gap:2,children:s.jsxs(a.Menu.Root,{children:[s.jsx(ca,{asChild:!0,children:s.jsx(a.IconButton,{"aria-label":"Open",variant:"ghost",size:"sm",children:s.jsx(Di,{size:16})})}),s.jsx(a.Portal,{children:s.jsx(la,{children:s.jsx(aa,{children:t.filter(f=>typeof f.visible=="function"?f.visible(d.__raw):f.visible!==!1).map(f=>s.jsxs(ia,{onClick:()=>f.onClick(d.__raw),colorScheme:f.colorScheme,value:f.label,children:[f.icon,f.label]},f.label))})})})]})}),n?.showColumnVisibilityMenu&&s.jsx(a.Table.Cell,{})]},d.__key||d.id))})}function da({rows:e=6,columns:t}){return s.jsx(a.Table.Body,{children:Array.from({length:e}).map((n,r)=>s.jsx(a.Table.Row,{children:Array.from({length:t}).map((o,i)=>s.jsx(a.Table.Cell,{children:s.jsx(a.Skeleton,{height:"25px"})},i))},r))})}function fa({tableId:e,data:t=[],headers:n=[],loading:r=!1,loadingChildren:o,skeletonLoading:i=!1,emptyMessage:c="No data",actions:l,page:u=1,pageSize:d=10,onPageChange:g,onPageSizeChange:f,density:x="sm",totalCount:p=0,actionConfig:m,pageSizeOptions:y,onRowSelect:S,onRowSelectEvent:R="left"}){h.useEffect(()=>{br(e)},[e]),h.useEffect(()=>{xr(t,n)},[t,n]),h.useEffect(()=>{m&&yr(m)},[m]);const{sortColumn:T,sortDirection:E,data:A,columnOrder:$}=Le(te),O=h.useMemo(()=>{const F=[...A];return T&&F.sort((N,D)=>E==="asc"?String(N[T]).localeCompare(String(D[T])):String(D[T]).localeCompare(String(N[T]))),F},[A,T,E,u,d]),I=h.useMemo(()=>(Math.max(1,u||1)-1)*d,[u,d]);h.useEffect(()=>{u<1&&g&&g(1)},[u,g]);const P=F=>{const{active:N,over:D}=F;if(!D||N.id===D.id)return;const C=$.findIndex(M=>M.id===N.id),w=$.findIndex(M=>M.id===D.id),j=Ct($,C,w);Js(j)},H=r&&!i,B=i&&!r,k=!r&&!i&&O.length===0;return s.jsx(lr,{collisionDetection:qn,onDragEnd:P,children:s.jsx(fr,{items:$.map(F=>F.id),strategy:Ms,children:s.jsxs(a.Box,{flex:"1",minH:0,display:"flex",flexDirection:"column",p:2,children:[s.jsxs(a.Box,{flex:"1",minH:0,position:"relative",overflow:"auto",children:[H&&s.jsx(a.Box,{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,bg:"whiteAlpha.600",children:o??s.jsx(a.Spinner,{})}),s.jsxs(a.Table.Root,{variant:"outline",w:"100%",size:x,children:[s.jsx(Ui,{}),B?s.jsx(da,{rows:d,columns:n.length+(l?2:0)}):k?s.jsx(a.Table.Body,{children:s.jsx(a.Table.Row,{children:s.jsx(a.Table.Cell,{colSpan:n.length+(l?1:0),children:s.jsx(a.Box,{display:"flex",alignItems:"center",justifyContent:"center",minH:"200px",color:"gray.500",children:c})})})}):s.jsx(ua,{data:O,actions:l,actionConfig:m,onRowSelect:S,startIndex:I,onRowSelectEvent:R})]})]}),s.jsx(a.Box,{mt:.5,children:s.jsx(sa,{totalCount:p,pageSize:d,currentPage:u,onPageChange:g,onPageSizeChange:F=>{f?.(F),u>1&&g?.(1)},pageSizeOptions:y})})]})})})}const ha=b(a.Checkbox.Root),ga=b(a.Checkbox.HiddenInput),pa=b(a.Checkbox.Control),va=b(a.Checkbox.Label),Mr=({value:e,onChange:t,size:n="sm",label:r,helperText:o,isDisabled:i,required:c,errorText:l})=>s.jsxs(ha,{value:e,onChange:t,size:n,children:[s.jsx(ga,{}),s.jsx(pa,{disabled:i,required:c,errorText:l,helperText:o}),r&&s.jsx(va,{children:r})]}),ma=b(a.Combobox.Root),xa=b(a.Combobox.Control),ba=b(a.Combobox.Input),ya=b(a.Combobox.IndicatorGroup),Sa=b(a.Combobox.ClearTrigger),wa=b(a.Combobox.Trigger),Ca=b(a.Combobox.Positioner),Da=b(a.Combobox.Content);function Tr({label:e,size:t="sm",width:n="100%",variant:r="outline",items:o=[],itemToString:i,itemToValue:c,renderItem:l,value:u,loading:d,error:g,errorMessage:f,placeholder:x,helpText:p,onInputChange:m,onSelect:y,visible:S=!0,rootProps:R,inputProps:T,controlProps:E,contentProps:A,itemProps:$}){const[O,I]=h.useState(""),{collection:P,set:H}=a.useListCollection({initialItems:o,itemToString:i,itemToValue:c}),B=h.useMemo(()=>{if(!O)return o;const k=O.toLowerCase();return o.filter(F=>i(F).toLowerCase().includes(k))},[o,O,i]);return h.useEffect(()=>{H(B)},[B,H]),h.useEffect(()=>{u&&I(i(u))},[u,i]),s.jsxs(ma,{width:n,size:t,variant:r,collection:P,placeholder:x,onInputValueChange:k=>{m?.(k.inputValue),I(k.inputValue)},value:u?[c(u)]:[],onValueChange:k=>{const F=k.value?.[0];if(!F)return;const N=P.items.find(D=>c(D)===F);N&&y?.(N)},positioning:{sameWidth:!1,placement:"bottom-start"},...R,children:[S&&e&&s.jsx(a.Text,{fontSize:"sm",children:e}),s.jsxs(xa,{...E,children:[s.jsx(ba,{placeholder:x??"Type to search",...T}),s.jsxs(ya,{children:[s.jsx(Sa,{}),s.jsx(wa,{})]})]}),s.jsx(Ca,{children:s.jsxs(Da,{minW:"sm",...A,children:[d?s.jsxs(a.HStack,{p:"2",children:[s.jsx(a.Spinner,{size:"xs",borderWidth:"1px"}),s.jsx(a.Span,{children:"Loading..."})]}):g?s.jsx(a.Text,{p:"2",color:"red.500",fontSize:"sm",children:f||"Something went wrong"}):P.items.map(k=>s.jsxs(a.Combobox.Item,{item:k,...$,children:[l(k),s.jsx(a.Combobox.ItemIndicator,{})]},c(k))),p&&!g&&!d&&s.jsx(a.Text,{p:"2",color:"fg.muted",fontSize:"sm",children:p})]})})]})}const ja=b(a.Popover.Root),Ra=b(a.Popover.Content),Ma=b(a.Popover.Arrow),Ta=b(a.Popover.Trigger),Ea=b(a.Popover.Positioner);function je(e){if(!e)return"";const t=String(e.getDate()).padStart(2,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=e.getFullYear();return`${t}-${n}-${r}`}function zn(e){const t=e.split(/\s+to\s+/i),n=t[0],r=t[1],o=l=>{if(!l)return null;const u=l.trim().split("-");if(u.length!==3)return null;const[d,g,f]=u,x=parseInt(d),p=parseInt(g)-1,m=parseInt(f);if(isNaN(x)||isNaN(p)||isNaN(m)||f.length!==4)return null;const y=new Date(m,p,x);return y.getDate()===x&&y.getMonth()===p?y:null},i=o(n),c=o(r);return{start:i,end:c}}function Er({startDate:e,endDate:t,onChange:n,width:r="280px",showLabel:o=!0,label:i="Select date range",visible:c=!0}){const[l,u]=h.useState(!1),[d,g]=h.useState(e||new Date),[f,x]=h.useState(null),[p,m]=h.useState(e||null),[y,S]=h.useState(t||null),R=(F,N)=>F&&N?`${je(F)} to ${je(N)}`:F?`${je(F)}`:"",[T,E]=h.useState(R(e,t));h.useEffect(()=>{m(e||null),S(t||null)},[e,t]);const A=new Date(d.getFullYear(),d.getMonth()+1,0).getDate(),$=new Date(d.getFullYear(),d.getMonth(),1).getDay(),O=()=>{g(new Date(d.getFullYear(),d.getMonth()-1,1))},I=()=>{g(new Date(d.getFullYear(),d.getMonth()+1,1))},P=F=>{const N=new Date(d.getFullYear(),d.getMonth(),F);if(!p||p&&y){m(N),S(null),n(N,null),E(je(N));return}if(p&&!y){const D=N<p?N:p,C=N<p?p:N;m(D),S(C),n(D,C),E(`${je(D)} to ${je(C)}`),u(!1)}},H=F=>{const N=F.target.value;E(N);const{start:D,end:C}=zn(N);if(D&&C){const w=D<C?D:C,j=D<C?C:D;n(w,j),g(w)}else D&&!N.toLowerCase().includes("to")&&n(D,null)},B=F=>{if(F.key!=="Enter")return;const{start:N,end:D}=zn(T);if(N&&!D&&!T.toLowerCase().includes("to")){const C=`${je(N)} to `;E(C),m(N),S(null),n(N,null),requestAnimationFrame(()=>{F.target.setSelectionRange(C.length,C.length)});return}if(N&&D){const C=N<D?N:D,w=N<D?D:N;m(C),S(w),n(C,w),u(!1)}},k=()=>{m(null),S(null),E(""),n(null,null)};return s.jsxs(a.Box,{width:r,onKeyDown:B,children:[o&&!c&&s.jsx(a.Text,{fontSize:"xs",color:"fg.muted",mb:1,fontWeight:"medium",children:i}),s.jsxs(ja,{open:l,onOpenChange:F=>u(F.open),positioning:{placement:"bottom-start",gutter:4},children:[s.jsxs(a.Group,{attached:!0,w:"full",position:"relative",children:[s.jsx(a.Input,{placeholder:"DD-MM-YYYY to DD-MM-YYYY",value:T,onChange:H,size:"sm",autoComplete:"off"}),T&&s.jsx(a.IconButton,{size:"xs",variant:"ghost","aria-label":"Clear date",onClick:k,position:"absolute",right:"32px",top:"50%",transform:"translateY(-50%)",children:s.jsx(Li,{size:14})}),s.jsx(Ta,{asChild:!0,children:s.jsx(a.InputAddon,{cursor:"pointer",px:2,_hover:{bg:"gray.100"},transition:"background 0.2s",children:s.jsx(Dr,{size:16})})})]}),s.jsx(Ea,{children:s.jsxs(Ra,{width:"300px",p:4,boxShadow:"xl",zIndex:1e3,borderRadius:"md",outline:"none",children:[s.jsx(Ma,{}),s.jsxs(a.HStack,{justify:"space-between",mb:4,children:[s.jsx(a.IconButton,{size:"xs",variant:"ghost",onClick:O,"aria-label":"Previous month",children:"‹"}),s.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:d.toLocaleString("default",{month:"long",year:"numeric"})}),s.jsx(a.IconButton,{size:"xs",variant:"ghost",onClick:I,"aria-label":"Next month",children:"›"})]}),s.jsxs(a.Grid,{templateColumns:"repeat(7, 1fr)",gap:1,textAlign:"center",children:[["S","M","T","W","T","F","S"].map((F,N)=>s.jsx(a.Text,{fontSize:"xs",fontWeight:"bold",color:"fg.subtle",py:1,children:F},`${F}-${N}`)),Array($).fill(null).map((F,N)=>s.jsx(a.Box,{},`empty-${N}`)),Array.from({length:A},(F,N)=>{const D=N+1,C=new Date(d.getFullYear(),d.getMonth(),D);let w=e,j=t;if(w&&j&&f)if(e&&t){const W=e.getTime()+(t.getTime()-e.getTime())/2;f.getTime()<=W?w=f:j=f,w>j&&([w,j]=[j,w])}else e&&!t&&(w=f<e?f:e,j=f<e?e:f);const M=w&&C.getTime()===w.getTime(),L=j&&C.getTime()===j.getTime(),Y=w&&j&&C>w&&C<j;let v="transparent",_="gray";M||L?_="blue":Y&&(v="blue.100");let z="md";return Y&&(z="0"),M&&j&&(z=L?"md":"md 0 0 md"),L&&w&&(z=M?"md":"0 md md 0"),s.jsx(a.Button,{size:"xs",variant:"ghost",colorPalette:_,bg:v!=="transparent"?v:void 0,onClick:()=>P(D),onMouseEnter:()=>x(C),onMouseLeave:()=>x(null),minW:"32px",h:"32px",fontSize:"xs",borderRadius:z,_hover:{bg:M||L?void 0:"gray.100"},children:D},D)})]}),s.jsx(a.Text,{fontSize:"10px",color:"fg.muted",mt:3,textAlign:"center",children:"Select Start Date then End Date"})]})})]})]})}const _a=b(a.Popover.Root),Oa=b(a.Popover.Content),ka=b(a.Popover.Arrow),Ia=b(a.Popover.Trigger),$a=b(a.Popover.Positioner);function Fn(e){if(!e)return"";const t=String(e.getDate()).padStart(2,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=e.getFullYear();return`${t}-${n}-${r}`}function Aa(e){const t=e.split("-");if(t.length!==3)return null;const[n,r,o]=t,i=parseInt(n),c=parseInt(r)-1,l=parseInt(o);if(isNaN(i)||isNaN(c)||isNaN(l)||o.length!==4)return null;const u=new Date(l,c,i);return u.getDate()===i&&u.getMonth()===c?u:null}function _r({value:e,onChange:t,width:n="220px",visible:r=!0,label:o="Select date"}){const[i,c]=h.useState(!1),[l,u]=h.useState(e||new Date),[d,g]=h.useState(Fn(e));h.useEffect(()=>{g(Fn(e))},[e]);const f=new Date(l.getFullYear(),l.getMonth()+1,0).getDate(),x=new Date(l.getFullYear(),l.getMonth(),1).getDay(),p=()=>{u(new Date(l.getFullYear(),l.getMonth()-1,1))},m=()=>{u(new Date(l.getFullYear(),l.getMonth()+1,1))},y=R=>{const T=new Date(l.getFullYear(),l.getMonth(),R);t(T),c(!1)},S=R=>{if(i)switch(R.key){case"ArrowLeft":p();break;case"ArrowRight":m();break;case"Escape":c(!1);break}};return s.jsxs(a.Box,{width:n,onKeyDown:S,children:[!r&&s.jsx(a.Text,{fontSize:"xs",color:"fg.muted",mb:1,fontWeight:"medium",children:o}),s.jsxs(_a,{open:i,onOpenChange:R=>c(R.open),positioning:{placement:"bottom-start",gutter:4},children:[s.jsxs(a.Group,{attached:!0,w:"full",children:[s.jsx(a.Input,{placeholder:"DD-MM-YYYY",value:d,onChange:R=>{const T=R.target.value;g(T);const E=Aa(T);E&&(t(E),u(E))},size:"sm",autoComplete:"off"}),s.jsx(Ia,{asChild:!0,children:s.jsx(a.InputAddon,{cursor:"pointer",px:2,_hover:{bg:"gray.100"},transition:"background 0.2s",children:s.jsx(Dr,{size:16})})})]}),s.jsx($a,{children:s.jsxs(Oa,{width:"300px",p:4,boxShadow:"xl",zIndex:1e3,borderRadius:"md",outline:"none",children:[s.jsx(ka,{}),s.jsxs(a.HStack,{justify:"space-between",mb:4,children:[s.jsx(a.IconButton,{size:"xs",variant:"ghost",onClick:p,"aria-label":"Previous month",children:"‹"}),s.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:l.toLocaleString("default",{month:"long",year:"numeric"})}),s.jsx(a.IconButton,{size:"xs",variant:"ghost",onClick:m,"aria-label":"Next month",children:"›"})]}),s.jsxs(a.Grid,{templateColumns:"repeat(7, 1fr)",gap:1,textAlign:"center",children:[["S","M","T","W","T","F","S"].map((R,T)=>s.jsx(a.Text,{fontSize:"xs",fontWeight:"bold",color:"fg.subtle",py:1,children:R},`${R}-${T}`)),Array(x).fill(null).map((R,T)=>s.jsx(a.Box,{},`empty-${T}`)),Array.from({length:f},(R,T)=>{const E=T+1,A=e&&e.getDate()===E&&e.getMonth()===l.getMonth()&&e.getFullYear()===l.getFullYear();return s.jsx(a.Button,{size:"xs",variant:A?"solid":"ghost",colorPalette:A?"blue":"gray",onClick:()=>y(E),minW:"32px",h:"32px",fontSize:"xs",borderRadius:"md",children:E},E)})]}),s.jsx(a.Text,{fontSize:"10px",color:"fg.muted",mt:3,textAlign:"center",children:"Use Arrow Keys to change months • Esc to close"})]})})]})]})}const La=b(a.Field.Root),Pa=b(a.Field.Label),Na=b(a.Field.HelperText),za=b(a.Field.ErrorText),Gt=({icon:e,value:t,onChange:n,placeholder:r,size:o="xs",variant:i="outline",width:c="100%",label:l,helperText:u,isDisabled:d=!1,required:g=!1,errorText:f,visible:x,type:p="text",min:m=0,max:y=100,step:S=1})=>s.jsxs(La,{width:c,children:[x&&s.jsx(Pa,{children:l}),s.jsx(a.InputGroup,{startElement:e,children:s.jsx(a.Input,{value:t,onChange:R=>n?.(R.target.value),placeholder:r,size:o,type:p,variant:i,disabled:d,required:g,min:m,max:y,step:S})}),f&&s.jsx(za,{fontSize:"xs",children:f}),u&&s.jsx(Na,{fontSize:"xs",children:u})]}),Fa=b(a.Field.Root),Ya=b(a.Field.HelperText),Ba=b(a.Field.ErrorText),Wa=b(a.Select.Root),Va=b(a.Select.Label),Ha=b(a.Select.Control),Ua=b(a.Select.Trigger),Ga=b(a.Select.ValueText),qa=b(a.Select.IndicatorGroup),Xa=b(a.Select.Indicator),Ka=b(a.Select.Content),Ja=b(a.Select.Item),Za=b(a.Select.ItemIndicator),Qa=b(a.Select.HiddenSelect),el=b(a.Select.Positioner),Or=({options:e=[],label:t,value:n,onChange:r,placeholder:o,size:i="xs",width:c="100%",variant:l="outline",helperText:u,isDisabled:d,required:g,errorText:f,visible:x})=>{const p=a.createListCollection({items:e});return s.jsxs(Fa,{disabled:d,required:g,children:[s.jsxs(Wa,{collection:p,variant:l,size:i,width:c,value:n?[n]:[],onValueChange:m=>r?.(m.value[0]),children:[s.jsx(Qa,{}),x&&s.jsx(Va,{children:t}),s.jsxs(Ha,{children:[s.jsx(Ua,{children:s.jsx(Ga,{placeholder:o})}),s.jsx(qa,{children:s.jsx(Xa,{})})]}),s.jsx(el,{children:s.jsx(Ka,{children:p.items.map(m=>s.jsxs(Ja,{item:m,children:[m.label,s.jsx(Za,{})]},m.value))})})]}),u&&s.jsx(Ya,{children:u}),f&&s.jsx(Ba,{children:f})]})},kr=(e="default")=>`FILTER_PRESETS_${e}`,tl=e=>{if(!e)return[];try{return JSON.parse(e)}catch{return[]}},nl=e=>typeof window>"u"?[]:tl(localStorage.getItem(kr(e))),Xe=new mr({}),Qe=e=>{const t=Xe.state;if(e in t)return t[e];const n=nl(e);return Xe.setState(r=>({...r,[e]:n})),n},jt=(e,t)=>{Xe.setState(n=>({...n,[e]:t})),typeof window<"u"&&localStorage.setItem(kr(e),JSON.stringify(t))},Ir=(e,t)=>{const n=[t,...Qe(e)];jt(e,n)},$r=(e,t)=>{const n=Qe(e).filter(r=>r.id!==t);jt(e,n)},rl=(e,t,n)=>{const r=Qe(e).map(o=>o.id===t?n(o):o);jt(e,r)},ol=b(a.Checkbox.Root),sl=b(a.Checkbox.HiddenInput),il=b(a.Checkbox.Control),al=b(a.Slider.Root),ll=b(a.Slider.Track),cl=b(a.Slider.Range),ul=b(a.Slider.Thumbs),dl=b(a.Slider.Control),fl=({filter:e,onVisibilityChange:t,onSizeChange:n})=>{const{attributes:r,listeners:o,setNodeRef:i,transform:c,transition:l}=gr({id:e.id}),u={transform:ke.Transform.toString(c),transition:l};return s.jsxs(a.VStack,{ref:i,style:u,align:"stretch",border:"1px solid",borderColor:"gray.200",rounded:"md",p:3,mb:3,bg:"white",children:[s.jsxs(a.HStack,{...r,...o,cursor:"grab",userSelect:"none",gap:2,children:[s.jsx(jr,{size:16}),s.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:e.label||e.id})]}),s.jsxs(a.HStack,{justify:"space-between",children:[s.jsx(a.Text,{fontSize:"sm",children:"Visible"}),s.jsxs(ol,{checked:e.visible,size:"sm",onCheckedChange:d=>t?.(e.id,!!d.checked),children:[s.jsx(sl,{}),s.jsx(il,{})]})]}),s.jsxs(a.VStack,{align:"stretch",gap:1,children:[s.jsx(a.Text,{fontSize:"sm",children:"Size"}),s.jsx(al,{min:1,max:5,step:.5,value:[e.size??1],onValueChange:d=>n?.(e.id,d.value[0]),children:s.jsxs(dl,{children:[s.jsx(ll,{children:s.jsx(cl,{})}),s.jsx(ul,{})]})})]})]})},hl=b(a.Drawer.Root),gl=b(a.Drawer.Trigger),pl=b(a.Drawer.Backdrop),vl=b(a.Drawer.Positioner),ml=b(a.Drawer.Content),xl=b(a.Drawer.Header),bl=b(a.Drawer.Title),yl=b(a.Drawer.Body),Sl=b(a.Drawer.Footer),wl=b(a.Drawer.CloseTrigger),Cl=b(a.Tabs.Root),Dl=b(a.Tabs.List),zt=b(a.Tabs.Trigger),Ft=b(a.Tabs.Content),Ar=(e,t)=>{if(e.customComponent)return e.customComponent;switch(console.log(e.type),e.type){case"text":return s.jsx(Gt,{placeholder:e.label,value:e.value,onChange:e.onChange,label:e.label,visible:t});case"number":return s.jsx(Gt,{label:e.label,value:e.value,onChange:e.onChange});case"checkbox":return s.jsx(Mr,{label:e.label,value:e.value,onChange:e.onChange});case"select":return s.jsx(Or,{label:e.label,value:e.value,onChange:e.onChange,options:e.options??[],visible:t,placeholder:e.placeholder});case"date":return s.jsx(_r,{value:e.value,onChange:e.onChange,visible:t,label:e.label});case"date-range":return s.jsx(Er,{startDate:e.startDate?new Date(e.startDate):void 0,endDate:e.endDate?new Date(e.endDate):void 0,onChange:e.onChange,visible:t,label:e.label});case"combobox":return s.jsx(Tr,{visible:!0,label:e.label,items:e.options,itemToString:n=>n.label,itemToValue:n=>n.value,renderItem:n=>s.jsx("span",{children:n.label})});default:return null}},jl=({filterDrawerSize:e="sm",onVisibilityChange:t,onSizeChange:n,onClear:r,filters:o,pageKey:i="default",onLoadPreset:c,activePresetName:l,onReorder:u,open:d,onOpenChange:g})=>{const x=Le(Xe)[i]??Qe(i),p=()=>{const m=prompt("Preset name?");if(!m)return;const y=o.reduce((S,R)=>(S[R.id]=R.value,S),{});Ir(i,{id:crypto.randomUUID(),name:m,date:new Date().toISOString(),values:y})};return s.jsx(a.HStack,{wrap:"wrap",children:s.jsxs(hl,{size:e,open:d,onOpenChange:g,children:[s.jsx(gl,{asChild:!0,children:s.jsxs(a.IconButton,{"aria-label":"Open filters",variant:"outline",size:"xs",ml:2,p:2,children:[s.jsx(Ri,{size:16}),"Filters"]})}),s.jsxs(a.Portal,{children:[s.jsx(pl,{}),s.jsx(vl,{children:s.jsxs(ml,{children:[s.jsx(xl,{children:s.jsx(bl,{children:"Filters"})}),s.jsx(yl,{overflowY:"auto",pt:1,children:s.jsxs(Cl,{defaultValue:"view",children:[s.jsxs(Dl,{mb:4,children:[s.jsxs(zt,{value:"view",children:[s.jsx(Ei,{size:16}),"Edit"]}),s.jsxs(zt,{value:"settings",children:[s.jsx(Ii,{size:16}),"Settings"]}),s.jsxs(zt,{value:"presets",children:[s.jsx(hi,{size:16}),"Presets"]})]}),s.jsx(Ft,{value:"view",children:o.filter(m=>m.visible).map(m=>s.jsx(a.VStack,{align:"stretch",border:"1px solid",borderColor:"gray.200",flex:m.size??1,minW:`${(m.size??1)*100}px`,rounded:"md",p:3,mb:3,children:Ar(m,d)},m.id))}),s.jsx(Ft,{value:"settings",children:s.jsx(lr,{sensors:go(ho(on)),collisionDetection:qn,onDragEnd:({active:m,over:y})=>{if(!y||m.id===y.id)return;const S=o.findIndex(E=>E.id===m.id),R=o.findIndex(E=>E.id===y.id),T=Ct(o,S,R);u?.(T)},children:s.jsx(fr,{items:o.map(m=>m.id),strategy:Es,children:o.map(m=>s.jsx(fl,{filter:m,onVisibilityChange:t,onSizeChange:n},m.id))})})}),s.jsx(Ft,{value:"presets",children:s.jsxs(a.VStack,{align:"stretch",mb:3,children:[x.length===0&&s.jsx(a.Text,{fontSize:"xs",color:"gray.500",children:"No presets saved yet."}),x.map(m=>s.jsxs(a.HStack,{justify:"space-between",border:"1px solid",borderColor:l===m.name?"blue.300":"gray.200",rounded:"md",p:2,children:[s.jsxs(a.VStack,{align:"start",gap:0,children:[s.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:m.name}),s.jsx(a.Text,{fontSize:"xs",color:"gray.500",children:new Date(m.date).toLocaleDateString()})]}),s.jsxs(a.HStack,{children:[s.jsx(a.Button,{size:"xs",variant:"ghost",onClick:()=>{const y=o.map(S=>({...S,value:m.values[S.id]??S.value}));c?.(y,m.name)},children:"Load"}),s.jsx(a.IconButton,{size:"xs","aria-label":"Delete preset",variant:"ghost",onClick:()=>$r(i,m.id),children:s.jsx(wi,{size:14})})]})]},m.id)),s.jsx(a.Button,{size:"sm",colorScheme:"blue",onClick:p,children:"Save Current Filters"})]})})]})}),s.jsx(Sl,{justify:"space-between",children:s.jsx(wl,{asChild:!0,children:s.jsx(a.CloseButton,{})})})]})})]})]})})},Rl=({title:e,filters:t,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:i,maxToolbarUnits:c,pageKey:l,onLoadPreset:u,activePresetName:d,filterDrawerSize:g="sm"})=>{const[f,x]=h.useState(!1);return s.jsxs(a.HStack,{wrap:"wrap",pl:2,pr:2,width:"100%",justify:"space-between",children:[e,s.jsxs(a.HStack,{gapX:1,children:[t.filter(p=>p.visible!==!1).map(p=>s.jsx(a.HStack,{flex:p.size??1,minW:`${(p.size??1)*100}px`,alignItems:"center",children:Ar(p)},p.id)),s.jsx(jl,{filterDrawerSize:g,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:i,maxToolbarUnits:c,pageKey:l,filters:t,onLoadPreset:u,activePresetName:d,open:f,onOpenChange:p=>{x(p.open)}})]})]})},Ml=(e,t)=>{localStorage.setItem(`FILTER_ORDER_${e}`,JSON.stringify(t))},Tl=e=>{try{return JSON.parse(localStorage.getItem(`FILTER_ORDER_${e}`)||"[]")}catch{return[]}},El=({onClick:e,size:t="xs",variant:n="solid",label:r,leftIcon:o,rightIcon:i,isDisabled:c,colorScheme:l,loading:u,loadingText:d,rounded:g,type:f="button"})=>s.jsx(a.Button,{onClick:e,size:t,variant:n,disabled:c,colorPalette:l,loading:u,loadingText:d,rounded:g,type:f,children:s.jsxs(a.HStack,{gap:1,children:[o,r,i]})}),_l=b(a.Dialog.Root),Ol=b(a.Dialog.Backdrop),kl=b(a.Dialog.Positioner),Il=b(a.Dialog.Content),$l=b(a.Dialog.Header),Al=b(a.Dialog.Body),Ll=b(a.Dialog.Footer),Pl=b(a.Dialog.Title),Nl=b(a.Dialog.CloseTrigger);function zl({open:e,onClose:t,onConfirm:n,title:r="Confirm Action",description:o="Are you sure you want to continue?",confirmLabel:i="Confirm",cancelLabel:c="Cancel",icon:l,isLoading:u=!1,confirmButtonColorScheme:d="#4169e1"}){return s.jsx(_l,{open:e,placement:"center",onOpenChange:g=>!g.open&&t(),children:s.jsxs(a.Portal,{children:[s.jsx(Ol,{}),s.jsx(kl,{children:s.jsxs(Il,{maxW:"480px",children:[s.jsx($l,{borderBottom:"1px solid",borderColor:"gray.200",children:s.jsx(Pl,{children:r})}),s.jsx(Al,{p:6,children:s.jsxs(a.Stack,{gap:4,align:"center",textAlign:"center",children:[s.jsx(a.Box,{color:"orange.500",children:l??s.jsx(Rr,{size:40})}),s.jsx(a.Text,{fontSize:"sm",color:"gray.600",children:o})]})}),s.jsxs(Ll,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"gray.200",children:[s.jsx(a.Button,{variant:"outline",size:"sm",onClick:t,children:c}),s.jsx(a.Button,{size:"sm",style:{backgroundColor:d},loading:u,onClick:n,children:i})]}),s.jsx(Nl,{asChild:!0,children:s.jsx(a.CloseButton,{size:"sm"})})]})})]})})}const Fl=b(a.Dialog.Root),Yl=b(a.Dialog.Backdrop),Bl=b(a.Dialog.Positioner),Wl=b(a.Dialog.Content),Vl=b(a.Dialog.Header),Hl=b(a.Dialog.Body),Ul=b(a.Dialog.Footer),Gl=b(a.Dialog.Title),ql=b(a.Dialog.CloseTrigger);function Xl({open:e,onClose:t,onConfirm:n,title:r="Delete Company",entityName:o,confirmText:i="DELETE",confirmLabel:c="Delete",isLoading:l=!1}){const[u,d]=h.useState(""),g=u===i;return s.jsx(Fl,{open:e,placement:"center",onOpenChange:f=>{!f.open&&t(),d("")},children:s.jsxs(a.Portal,{children:[s.jsx(Yl,{}),s.jsx(Bl,{children:s.jsxs(Wl,{maxW:"550px",children:[s.jsx(Vl,{borderBottom:"1px solid",borderColor:"#d3d3d3",children:s.jsx(Gl,{color:"red.600",children:r})}),s.jsx(Hl,{p:2,style:{padding:"16px"},children:s.jsxs(a.Stack,{gap:4,borderRadius:"md",p:4,bg:"white",children:[s.jsx(a.Box,{border:"1px solid",borderColor:"red.200",bg:"red.50",borderRadius:"md",p:4,children:s.jsxs(a.Stack,{direction:"row",gap:3,align:"flex-start",children:[s.jsx(a.Box,{color:"red.600",mt:"2px",children:s.jsx(Rr,{size:20})}),s.jsxs(a.Box,{children:[s.jsx(a.Text,{fontWeight:"semibold",color:"red.700",children:"Are you sure?"}),s.jsxs(a.Text,{fontSize:"sm",color:"red.600",children:["All the data of ",s.jsx("b",{children:o})," will permanently be deleted."]})]})]})}),s.jsx(a.Text,{fontSize:"sm",color:"gray.600",children:"You can’t undo this action afterwards."}),s.jsxs(a.Box,{children:[s.jsxs(a.Text,{fontSize:"sm",mb:2,children:["Type ",s.jsx("b",{children:i})," to continue"]}),s.jsx(a.Input,{placeholder:`Type ${i} here`,value:u,onChange:f=>d(f.target.value),size:"xs"})]})]})}),s.jsxs(Ul,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"#d3d3d3",children:[s.jsx(a.Button,{variant:"outline",size:"sm",onClick:()=>{t(),d("")},children:"Cancel"}),s.jsx(a.Button,{size:"sm",disabled:!g,style:{backgroundColor:"#FF0000"},loading:l,onClick:n,children:c})]}),s.jsx(ql,{asChild:!0,children:s.jsx(a.CloseButton,{size:"sm"})})]})})]})})}const Lr=({children:e})=>s.jsx(s.Fragment,{children:e}),Pr=({children:e})=>s.jsx(s.Fragment,{children:e}),Kl=a.Button,Jl=b(a.Dialog.Root),Zl=b(a.Dialog.Backdrop),Ql=b(a.Dialog.Positioner),ec=b(a.Dialog.Content),tc=b(a.Dialog.Header),nc=b(a.Dialog.Body),rc=b(a.Dialog.Footer),oc=b(a.Dialog.Title),sc=b(a.Dialog.CloseTrigger);function ic(e){let t=null,n=null;return h.Children.forEach(e,r=>{h.isValidElement(r)&&(r.type===Lr&&(t=r.props.children),r.type===Pr&&(n=r.props.children))}),{body:t,actions:n}}const ac=({open:e,onClose:t,title:n,children:r,width:o,position:i,refetch:c,loading:l=!1})=>{const{body:u,actions:d}=ic(r);return s.jsx(Jl,{open:e,onOpenChange:g=>!g.open&&t(),placement:i??"center",children:s.jsxs(a.Portal,{children:[s.jsx(Zl,{bg:"blackAlpha.400"}),s.jsx(Ql,{children:s.jsxs(ec,{w:o??"560px",maxW:o??"560px",borderRadius:"6px",overflow:"hidden",boxShadow:"lg",children:[s.jsx(tc,{px:"20px",py:"16px",bg:"white",borderBottom:"1px solid",borderColor:"gray.200",children:s.jsxs(a.Flex,{align:"center",justify:"space-between",children:[s.jsx(oc,{fontSize:"16px",fontWeight:"600",children:n}),s.jsx(sc,{asChild:!0,children:s.jsx(a.CloseButton,{size:"sm"})}),c&&s.jsx(sn,{label:"Refresh",refetch:c,isLoading:l})]})}),u&&s.jsx(nc,{px:"20px",py:"16px",bg:"#F8FAFC",type:"submit",children:s.jsx(a.Flex,{direction:"column",gap:"16px",children:u})}),d&&s.jsx(rc,{px:"20px",py:"16px",bg:"white",borderTop:"1px solid",borderColor:"gray.200",children:s.jsx(a.Flex,{ml:"auto",gap:"12px",children:d})})]})})]})})},lc=b(a.Field.Root),cc=b(a.Field.Label),uc=b(a.Field.HelperText),dc=b(a.Field.ErrorText),fc=b(a.PinInput.Input),hc=b(a.PinInput.Control),gc=b(a.PinInput.HiddenInput),pc=b(a.PinInput.Root),vc=({value:e,onChange:t,length:n=4,size:r="xs",isDisabled:o=!1,label:i,helperText:c,errorText:l,required:u=!1,visible:d=!0})=>{const g=Array.from({length:n}).map((f,x)=>e?.[x]??"");return s.jsxs(lc,{children:[d&&i&&s.jsxs(cc,{children:[i,u&&" *"]}),s.jsxs(pc,{value:g,onValueChange:f=>t?.(f.value.join("")),disabled:o,size:r,children:[s.jsx(gc,{}),s.jsx(hc,{children:s.jsx(a.HStack,{children:Array.from({length:n}).map((f,x)=>s.jsx(fc,{index:x},x))})})]}),l&&s.jsx(dc,{fontSize:"xs",children:l}),c&&!l&&s.jsx(uc,{fontSize:"xs",children:c})]})};function sn({refetch:e,isLoading:t=!1,label:n="Refresh"}){const[r,o]=h.useState(!1),i=async()=>{o(!0);try{await e()}finally{setTimeout(()=>o(!1),300)}};return s.jsx(a.IconButton,{"aria-label":n,size:"xs",variant:"outline",disabled:t||r,onClick:i,ml:2,children:s.jsx(Oi,{size:14,style:{animation:r?"spin 0.6s linear infinite":void 0}})})}var ut={exports:{}},mc=ut.exports,Yn;function xc(){return Yn||(Yn=1,(function(e,t){(function(n,r){e.exports=r()})(mc,(function(){var n=1e3,r=6e4,o=36e5,i="millisecond",c="second",l="minute",u="hour",d="day",g="week",f="month",x="quarter",p="year",m="date",y="Invalid Date",S=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,R=/\[([^\]]+)]|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,T={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(D){var C=["th","st","nd","rd"],w=D%100;return"["+D+(C[(w-20)%10]||C[w]||C[0])+"]"}},E=function(D,C,w){var j=String(D);return!j||j.length>=C?D:""+Array(C+1-j.length).join(w)+D},A={s:E,z:function(D){var C=-D.utcOffset(),w=Math.abs(C),j=Math.floor(w/60),M=w%60;return(C<=0?"+":"-")+E(j,2,"0")+":"+E(M,2,"0")},m:function D(C,w){if(C.date()<w.date())return-D(w,C);var j=12*(w.year()-C.year())+(w.month()-C.month()),M=C.clone().add(j,f),L=w-M<0,Y=C.clone().add(j+(L?-1:1),f);return+(-(j+(w-M)/(L?M-Y:Y-M))||0)},a:function(D){return D<0?Math.ceil(D)||0:Math.floor(D)},p:function(D){return{M:f,y:p,w:g,d,D:m,h:u,m:l,s:c,ms:i,Q:x}[D]||String(D||"").toLowerCase().replace(/s$/,"")},u:function(D){return D===void 0}},$="en",O={};O[$]=T;var I="$isDayjsObject",P=function(D){return D instanceof F||!(!D||!D[I])},H=function D(C,w,j){var M;if(!C)return $;if(typeof C=="string"){var L=C.toLowerCase();O[L]&&(M=L),w&&(O[L]=w,M=L);var Y=C.split("-");if(!M&&Y.length>1)return D(Y[0])}else{var v=C.name;O[v]=C,M=v}return!j&&M&&($=M),M||!j&&$},B=function(D,C){if(P(D))return D.clone();var w=typeof C=="object"?C:{};return w.date=D,w.args=arguments,new F(w)},k=A;k.l=H,k.i=P,k.w=function(D,C){return B(D,{locale:C.$L,utc:C.$u,x:C.$x,$offset:C.$offset})};var F=(function(){function D(w){this.$L=H(w.locale,null,!0),this.parse(w),this.$x=this.$x||w.x||{},this[I]=!0}var C=D.prototype;return C.parse=function(w){this.$d=(function(j){var M=j.date,L=j.utc;if(M===null)return new Date(NaN);if(k.u(M))return new Date;if(M instanceof Date)return new Date(M);if(typeof M=="string"&&!/Z$/i.test(M)){var Y=M.match(S);if(Y){var v=Y[2]-1||0,_=(Y[7]||"0").substring(0,3);return L?new Date(Date.UTC(Y[1],v,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,_)):new Date(Y[1],v,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,_)}}return new Date(M)})(w),this.init()},C.init=function(){var w=this.$d;this.$y=w.getFullYear(),this.$M=w.getMonth(),this.$D=w.getDate(),this.$W=w.getDay(),this.$H=w.getHours(),this.$m=w.getMinutes(),this.$s=w.getSeconds(),this.$ms=w.getMilliseconds()},C.$utils=function(){return k},C.isValid=function(){return this.$d.toString()!==y},C.isSame=function(w,j){var M=B(w);return this.startOf(j)<=M&&M<=this.endOf(j)},C.isAfter=function(w,j){return B(w)<this.startOf(j)},C.isBefore=function(w,j){return this.endOf(j)<B(w)},C.$g=function(w,j,M){return k.u(w)?this[j]:this.set(M,w)},C.unix=function(){return Math.floor(this.valueOf()/1e3)},C.valueOf=function(){return this.$d.getTime()},C.startOf=function(w,j){var M=this,L=!!k.u(j)||j,Y=k.p(w),v=function(J,V){var se=k.w(M.$u?Date.UTC(M.$y,V,J):new Date(M.$y,V,J),M);return L?se:se.endOf(d)},_=function(J,V){return k.w(M.toDate()[J].apply(M.toDate("s"),(L?[0,0,0,0]:[23,59,59,999]).slice(V)),M)},z=this.$W,W=this.$M,q=this.$D,X="set"+(this.$u?"UTC":"");switch(Y){case p:return L?v(1,0):v(31,11);case f:return L?v(1,W):v(0,W+1);case g:var U=this.$locale().weekStart||0,K=(z<U?z+7:z)-U;return v(L?q-K:q+(6-K),W);case d:case m:return _(X+"Hours",0);case u:return _(X+"Minutes",1);case l:return _(X+"Seconds",2);case c:return _(X+"Milliseconds",3);default:return this.clone()}},C.endOf=function(w){return this.startOf(w,!1)},C.$set=function(w,j){var M,L=k.p(w),Y="set"+(this.$u?"UTC":""),v=(M={},M[d]=Y+"Date",M[m]=Y+"Date",M[f]=Y+"Month",M[p]=Y+"FullYear",M[u]=Y+"Hours",M[l]=Y+"Minutes",M[c]=Y+"Seconds",M[i]=Y+"Milliseconds",M)[L],_=L===d?this.$D+(j-this.$W):j;if(L===f||L===p){var z=this.clone().set(m,1);z.$d[v](_),z.init(),this.$d=z.set(m,Math.min(this.$D,z.daysInMonth())).$d}else v&&this.$d[v](_);return this.init(),this},C.set=function(w,j){return this.clone().$set(w,j)},C.get=function(w){return this[k.p(w)]()},C.add=function(w,j){var M,L=this;w=Number(w);var Y=k.p(j),v=function(W){var q=B(L);return k.w(q.date(q.date()+Math.round(W*w)),L)};if(Y===f)return this.set(f,this.$M+w);if(Y===p)return this.set(p,this.$y+w);if(Y===d)return v(1);if(Y===g)return v(7);var _=(M={},M[l]=r,M[u]=o,M[c]=n,M)[Y]||1,z=this.$d.getTime()+w*_;return k.w(z,this)},C.subtract=function(w,j){return this.add(-1*w,j)},C.format=function(w){var j=this,M=this.$locale();if(!this.isValid())return M.invalidDate||y;var L=w||"YYYY-MM-DDTHH:mm:ssZ",Y=k.z(this),v=this.$H,_=this.$m,z=this.$M,W=M.weekdays,q=M.months,X=M.meridiem,U=function(V,se,re,fe){return V&&(V[se]||V(j,L))||re[se].slice(0,fe)},K=function(V){return k.s(v%12||12,V,"0")},J=X||function(V,se,re){var fe=V<12?"AM":"PM";return re?fe.toLowerCase():fe};return L.replace(R,(function(V,se){return se||(function(re){switch(re){case"YY":return String(j.$y).slice(-2);case"YYYY":return k.s(j.$y,4,"0");case"M":return z+1;case"MM":return k.s(z+1,2,"0");case"MMM":return U(M.monthsShort,z,q,3);case"MMMM":return U(q,z);case"D":return j.$D;case"DD":return k.s(j.$D,2,"0");case"d":return String(j.$W);case"dd":return U(M.weekdaysMin,j.$W,W,2);case"ddd":return U(M.weekdaysShort,j.$W,W,3);case"dddd":return W[j.$W];case"H":return String(v);case"HH":return k.s(v,2,"0");case"h":return K(1);case"hh":return K(2);case"a":return J(v,_,!0);case"A":return J(v,_,!1);case"m":return String(_);case"mm":return k.s(_,2,"0");case"s":return String(j.$s);case"ss":return k.s(j.$s,2,"0");case"SSS":return k.s(j.$ms,3,"0");case"Z":return Y}return null})(V)||Y.replace(":","")}))},C.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},C.diff=function(w,j,M){var L,Y=this,v=k.p(j),_=B(w),z=(_.utcOffset()-this.utcOffset())*r,W=this-_,q=function(){return k.m(Y,_)};switch(v){case p:L=q()/12;break;case f:L=q();break;case x:L=q()/3;break;case g:L=(W-z)/6048e5;break;case d:L=(W-z)/864e5;break;case u:L=W/o;break;case l:L=W/r;break;case c:L=W/n;break;default:L=W}return M?L:k.a(L)},C.daysInMonth=function(){return this.endOf(f).$D},C.$locale=function(){return O[this.$L]},C.locale=function(w,j){if(!w)return this.$L;var M=this.clone(),L=H(w,j,!0);return L&&(M.$L=L),M},C.clone=function(){return k.w(this.$d,this)},C.toDate=function(){return new Date(this.valueOf())},C.toJSON=function(){return this.isValid()?this.toISOString():null},C.toISOString=function(){return this.$d.toISOString()},C.toString=function(){return this.$d.toUTCString()},D})(),N=F.prototype;return B.prototype=N,[["$ms",i],["$s",c],["$m",l],["$H",u],["$W",d],["$M",f],["$y",p],["$D",m]].forEach((function(D){N[D[1]]=function(C){return this.$g(C,D[0],D[1])}})),B.extend=function(D,C){return D.$i||(D(C,F,B),D.$i=!0),B},B.locale=H,B.isDayjs=P,B.unix=function(D){return B(1e3*D)},B.en=O[$],B.Ls=O,B.p={},B}))})(ut)),ut.exports}var bc=xc();const Rt=bt(bc);var dt={exports:{}},yc=dt.exports,Bn;function Sc(){return Bn||(Bn=1,(function(e,t){(function(n,r){e.exports=r()})(yc,(function(){return function(n,r,o){n=n||{};var i=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 l(d,g,f,x){return i.fromToBase(d,g,f,x)}o.en.relativeTime=c,i.fromToBase=function(d,g,f,x,p){for(var m,y,S,R=f.$locale().relativeTime||c,T=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"}],E=T.length,A=0;A<E;A+=1){var $=T[A];$.d&&(m=x?o(d).diff(f,$.d,!0):f.diff(d,$.d,!0));var O=(n.rounding||Math.round)(Math.abs(m));if(S=m>0,O<=$.r||!$.r){O<=1&&A>0&&($=T[A-1]);var I=R[$.l];p&&(O=p(""+O)),y=typeof I=="string"?I.replace("%d",O):I(O,g,$.l,S);break}}if(g)return y;var P=S?R.future:R.past;return typeof P=="function"?P(y):P.replace("%s",y)},i.to=function(d,g){return l(d,g,this,!0)},i.from=function(d,g){return l(d,g,this)};var u=function(d){return d.$u?o.utc():o()};i.toNow=function(d){return this.to(u(this),d)},i.fromNow=function(d){return this.from(u(this),d)}}}))})(dt)),dt.exports}var wc=Sc();const Cc=bt(wc);var ft={exports:{}},Dc=ft.exports,Wn;function jc(){return Wn||(Wn=1,(function(e,t){(function(n,r){e.exports=r()})(Dc,(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,i){var c=o.prototype,l=c.format;i.en.formats=n,c.format=function(u){u===void 0&&(u="YYYY-MM-DDTHH:mm:ssZ");var d=this.$locale().formats,g=(function(f,x){return f.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(p,m,y){var S=y&&y.toUpperCase();return m||x[y]||n[y]||x[S].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(R,T,E){return T||E.slice(1)}))}))})(u,d===void 0?{}:d);return l.call(this,g)}}}))})(ft)),ft.exports}var Rc=jc();const Mc=bt(Rc);var ht={exports:{}},Tc=ht.exports,Vn;function Ec(){return Vn||(Vn=1,(function(e,t){(function(n,r){e.exports=r()})(Tc,(function(){return function(n,r){var o=r.prototype,i=o.format;o.format=function(c){var l=this,u=this.$locale();if(!this.isValid())return i.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(f){switch(f){case"Q":return Math.ceil((l.$M+1)/3);case"Do":return u.ordinal(l.$D);case"gggg":return l.weekYear();case"GGGG":return l.isoWeekYear();case"wo":return u.ordinal(l.week(),"W");case"w":case"ww":return d.s(l.week(),f==="w"?1:2,"0");case"W":case"WW":return d.s(l.isoWeek(),f==="W"?1:2,"0");case"k":case"kk":return d.s(String(l.$H===0?24:l.$H),f==="k"?1:2,"0");case"X":return Math.floor(l.$d.getTime()/1e3);case"x":return l.$d.getTime();case"z":return"["+l.offsetName()+"]";case"zzz":return"["+l.offsetName("long")+"]";default:return f}}));return i.bind(this)(g)}}}))})(ht)),ht.exports}var _c=Ec();const Oc=bt(_c);Rt.extend(Cc);Rt.extend(Mc);Rt.extend(Oc);const kc={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 qt({value:e,variant:t="dateTime",format:n,fallback:r="--"}){if(!e)return r;const o=Rt(e);return o.isValid()?t==="relative"?o.fromNow():o.format(n??kc[t]):r}function Ic({value:e,dateVariant:t="date",timeVariant:n="time",dateFormat:r,timeFormat:o,align:i="start",dateColor:c="gray.700",dateFontSize:l="16px",dateFontWeight:u="500",timeColor:d="gray.500",timeFontSize:g="12px",timeFontWeight:f="400"}){return s.jsxs(a.Stack,{gap:.5,align:i,children:[s.jsx(a.Text,{fontSize:l,fontWeight:u,color:c,children:qt({value:e,variant:t,format:r})}),s.jsx(a.Text,{fontSize:g,fontWeight:f,color:d,children:qt({value:e,variant:n,format:o})})]})}class Nr{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 Xt{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 Kt{constructor(t){this.api=t}store=new Nr;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 i=this.store.get(o);i?n[o]=i.value:r.push(o)}return r.length&&(await this.fetchMissing(r),r.forEach(o=>{const i=this.store.get(o);i&&(n[o]=i.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(i=>this.inflight.delete(i))});n.forEach(o=>this.inflight.set(o,r)),await r}}const zr=h.createContext(null);function Fr(){const e=h.useContext(zr);if(!e)throw new Error("OptionsProvider is missing. Wrap your app with <OptionsProvider />");return e}function $c({client:{apiUrl:e},children:t}){const n=h.useRef(new Kt(new Xt(e)));return n.current||(n.current=new Kt(new Xt(e))),s.jsx(zr.Provider,{value:n.current,children:t})}function Ac(e){const t=Fr(),[n,r]=h.useState(t.getRaw(e)?.value);return h.useEffect(()=>{let o=!0;t.getKey(e).then(c=>{o&&r(c)});const i=t.subscribe(e,c=>{r(c?.value)});return()=>{o=!1,i()}},[e,t]),n}function Lc(e){const t=Fr(),[n,r]=h.useState({});return h.useEffect(()=>{let o=!0;t.getMultiKey(e).then(c=>{o&&r(c)});const i=e.map(c=>t.subscribe(c,l=>{r(u=>({...u,[c]:l?.value}))}));return()=>{o=!1,i.forEach(c=>c())}},[e.join("|"),t]),n}async function Pc(e,t){return e.getKey(t)}async function Nc(e,t){await e.getMultiKey(t)}function zc(e={}){const{initialPage:t=1,initialLimit:n=20}=e,[r,o]=h.useState(t),[i,c]=h.useState(n),l=h.useCallback(x=>{o(Math.max(1,x))},[]),u=h.useCallback(x=>{c(Math.max(1,x)),o(1)},[]),d=h.useCallback(()=>{o(x=>x+1)},[]),g=h.useCallback(()=>{o(x=>Math.max(1,x-1))},[]),f=h.useCallback(()=>{o(t),c(n)},[t,n]);return{page:r,limit:i,setPage:l,setLimit:u,nextPage:d,prevPage:g,reset:f}}function Fc(e={}){const{initialValue:t="",delay:n=300}=e,[r,o]=h.useState(t),i=Yc(r,n),c=h.useCallback(u=>{o(u)},[]),l=h.useCallback(()=>{o(t)},[t]);return{search:r,debouncedSearch:i,onSearchChange:c,reset:l}}function Yc(e,t=300){const[n,r]=h.useState(e);return h.useEffect(()=>{const o=setTimeout(()=>{r(e)},t);return()=>clearTimeout(o)},[e,t]),n}exports.DataTable=fa;exports.Filters=Rl;exports.HttpOptionsApi=Xt;exports.MDSButton=El;exports.MDSCheckbox=Mr;exports.MDSCombobox=Tr;exports.MDSConfirmActionDialog=zl;exports.MDSConfirmDeleteDialog=Xl;exports.MDSDatePicker=_r;exports.MDSDateRangePicker=Er;exports.MDSDialogAction=Kl;exports.MDSDialogActions=Pr;exports.MDSDialogBody=Lr;exports.MDSDialogWrapper=ac;exports.MDSInput=Gt;exports.MDSPinInput=vc;exports.MDSRefreshButton=sn;exports.MDSSelectBox=Or;exports.OptionsClientImpl=Kt;exports.OptionsProvider=$c;exports.OptionsStore=Nr;exports.RefreshButton=sn;exports.StackedDateTime=Ic;exports.addPreset=Ir;exports.deletePreset=$r;exports.formatDateTime=qt;exports.getColumnWidthKey=Dt;exports.getOption=Pc;exports.getPresets=Qe;exports.loadOrder=Tl;exports.prefetchOptions=Nc;exports.presetStore=Xe;exports.saveOrder=Ml;exports.savePresets=jt;exports.setActionsConfig=yr;exports.setColumnWidth=Ks;exports.setData=xr;exports.setTableId=br;exports.tableStore=te;exports.updatePreset=rl;exports.useDebouncedSearch=Fc;exports.useOption=Ac;exports.useOptions=Lc;exports.usePagination=zc;exports.withChildren=b;
|
|
10
|
+
`},uo={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 fo(e){let{announcements:t=uo,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=co}=e;const{announce:i,announcement:c}=io(),l=Ze("DndLiveRegion"),[u,d]=h.useState(!1);if(h.useEffect(()=>{d(!0)},[]),ao(h.useMemo(()=>({onDragStart(f){let{active:x}=f;i(t.onDragStart({active:x}))},onDragMove(f){let{active:x,over:p}=f;t.onDragMove&&i(t.onDragMove({active:x,over:p}))},onDragOver(f){let{active:x,over:p}=f;i(t.onDragOver({active:x,over:p}))},onDragEnd(f){let{active:x,over:p}=f;i(t.onDragEnd({active:x,over:p}))},onDragCancel(f){let{active:x,over:p}=f;i(t.onDragCancel({active:x,over:p}))}}),[i,t])),!u)return null;const g=h.createElement(h.Fragment,null,h.createElement(oo,{id:r,value:o.draggable}),h.createElement(so,{id:l,announcement:c}));return n?We.createPortal(g,n):g}var Z;(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"})(Z||(Z={}));function vt(){}function ho(e,t){return h.useMemo(()=>({sensor:e,options:{}}),[e,t])}function go(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return h.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const he=Object.freeze({x:0,y:0});function po(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function vo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function mo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function xo(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function bn(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 qn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=bn(t,t.left,t.top),i=[];for(const c of r){const{id:l}=c,u=n.get(l);if(u){const d=po(bn(u),o);i.push({id:l,data:{droppableContainer:c,value:d}})}}return i.sort(vo)};function bo(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),i=Math.min(t.top+t.height,e.top+e.height),c=o-r,l=i-n;if(r<o&&n<i){const u=t.width*t.height,d=e.width*e.height,g=c*l,f=g/(u+d-g);return Number(f.toFixed(4))}return 0}const yo=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:c}=i,l=n.get(c);if(l){const u=bo(l,t);u>0&&o.push({id:c,data:{droppableContainer:i,value:u}})}}return o.sort(mo)};function So(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Xn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:he}function wo(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.reduce((c,l)=>({...c,top:c.top+e*l.y,bottom:c.bottom+e*l.y,left:c.left+e*l.x,right:c.right+e*l.x}),{...n})}}const Co=wo(1);function Do(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 jo(e,t,n){const r=Do(t);if(!r)return e;const{scaleX:o,scaleY:i,x:c,y:l}=r,u=e.left-c-(1-o)*parseFloat(n),d=e.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),g=o?e.width/o:e.width,f=i?e.height/i:e.height;return{width:g,height:f,top:d,right:u+g,bottom:d+f,left:u}}const Ro={ignoreTransform:!1};function Ae(e,t){t===void 0&&(t=Ro);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:g}=ie(e).getComputedStyle(e);d&&(n=jo(n,d,g))}const{top:r,left:o,width:i,height:c,bottom:l,right:u}=n;return{top:r,left:o,width:i,height:c,bottom:l,right:u}}function yn(e){return Ae(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 To(e,t){return t===void 0&&(t=ie(e).getComputedStyle(e)),t.position==="fixed"}function Eo(e,t){t===void 0&&(t=ie(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function tn(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(Zt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Ke(o)||Hn(o)||n.includes(o))return n;const i=ie(e).getComputedStyle(o);return o!==e&&Eo(o,i)&&n.push(o),To(o,i)?n:r(o.parentNode)}return e?r(e):n}function Kn(e){const[t]=tn(e,1);return t??null}function Ot(e){return!yt||!e?null:Ie(e)?e:Jt(e)?Zt(e)||e===$e(e).scrollingElement?window:Ke(e)?e:null:null}function Jn(e){return Ie(e)?e.scrollX:e.scrollLeft}function Zn(e){return Ie(e)?e.scrollY:e.scrollTop}function Wt(e){return{x:Jn(e),y:Zn(e)}}var Q;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Q||(Q={}));function Qn(e){return!yt||!e?!1:e===document.scrollingElement}function er(e){const t={x:0,y:0},n=Qn(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,i=e.scrollLeft<=t.x,c=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:c,isRight:l,maxScroll:r,minScroll:t}}const _o={x:.2,y:.2};function Oo(e,t,n,r,o){let{top:i,left:c,right:l,bottom:u}=n;r===void 0&&(r=10),o===void 0&&(o=_o);const{isTop:d,isBottom:g,isLeft:f,isRight:x}=er(e),p={x:0,y:0},m={x:0,y:0},y={height:t.height*o.y,width:t.width*o.x};return!d&&i<=t.top+y.height?(p.y=Q.Backward,m.y=r*Math.abs((t.top+y.height-i)/y.height)):!g&&u>=t.bottom-y.height&&(p.y=Q.Forward,m.y=r*Math.abs((t.bottom-y.height-u)/y.height)),!x&&l>=t.right-y.width?(p.x=Q.Forward,m.x=r*Math.abs((t.right-y.width-l)/y.width)):!f&&c<=t.left+y.width&&(p.x=Q.Backward,m.x=r*Math.abs((t.left+y.width-c)/y.width)),{direction:p,speed:m}}function ko(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:c}=window;return{top:0,left:0,right:i,bottom:c,width:i,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 tr(e){return e.reduce((t,n)=>Oe(t,Wt(n)),he)}function Io(e){return e.reduce((t,n)=>t+Jn(n),0)}function $o(e){return e.reduce((t,n)=>t+Zn(n),0)}function Ao(e,t){if(t===void 0&&(t=Ae),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);Kn(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Lo=[["x",["left","right"],Io],["y",["top","bottom"],$o]];class nn{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=tn(n),o=tr(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,c,l]of Lo)for(const u of c)Object.defineProperty(this,u,{get:()=>{const d=l(r),g=o[i]-d;return this.rect[u]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ve{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 Po(e){const{EventTarget:t}=ie(e);return e instanceof t?e:$e(e)}function kt(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 de;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(de||(de={}));function Sn(e){e.preventDefault()}function No(e){e.stopPropagation()}var G;(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"})(G||(G={}));const nr={start:[G.Space,G.Enter],cancel:[G.Esc],end:[G.Space,G.Enter,G.Tab]},zo=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case G.Right:return{...n,x:n.x+25};case G.Left:return{...n,x:n.x-25};case G.Down:return{...n,y:n.y+25};case G.Up:return{...n,y:n.y-25}}};class rr{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 Ve($e(n)),this.windowListeners=new Ve(ie(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(de.Resize,this.handleCancel),this.windowListeners.add(de.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(de.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Ao(r),n(he)}handleKeyDown(t){if(en(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=nr,coordinateGetter:c=zo,scrollBehavior:l="smooth"}=o,{code:u}=t;if(i.end.includes(u)){this.handleEnd(t);return}if(i.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:d}=r.current,g=d?{x:d.left,y:d.top}:he;this.referenceCoordinates||(this.referenceCoordinates=g);const f=c(t,{active:n,context:r.current,currentCoordinates:g});if(f){const x=pt(f,g),p={x:0,y:0},{scrollableAncestors:m}=r.current;for(const y of m){const S=t.code,{isTop:R,isRight:T,isLeft:E,isBottom:A,maxScroll:$,minScroll:O}=er(y),I=ko(y),P={x:Math.min(S===G.Right?I.right-I.width/2:I.right,Math.max(S===G.Right?I.left:I.left+I.width/2,f.x)),y:Math.min(S===G.Down?I.bottom-I.height/2:I.bottom,Math.max(S===G.Down?I.top:I.top+I.height/2,f.y))},H=S===G.Right&&!T||S===G.Left&&!E,B=S===G.Down&&!A||S===G.Up&&!R;if(H&&P.x!==f.x){const k=y.scrollLeft+x.x,F=S===G.Right&&k<=$.x||S===G.Left&&k>=O.x;if(F&&!x.y){y.scrollTo({left:k,behavior:l});return}F?p.x=y.scrollLeft-k:p.x=S===G.Right?y.scrollLeft-$.x:y.scrollLeft-O.x,p.x&&y.scrollBy({left:-p.x,behavior:l});break}else if(B&&P.y!==f.y){const k=y.scrollTop+x.y,F=S===G.Down&&k<=$.y||S===G.Up&&k>=O.y;if(F&&!x.x){y.scrollTo({top:k,behavior:l});return}F?p.y=y.scrollTop-k:p.y=S===G.Down?y.scrollTop-$.y:y.scrollTop-O.y,p.y&&y.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(t,Oe(pt(f,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()}}rr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=nr,onActivation:o}=t,{active:i}=n;const{code:c}=e.nativeEvent;if(r.start.includes(c)){const l=i.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function wn(e){return!!(e&&"distance"in e)}function Cn(e){return!!(e&&"delay"in e)}class rn{constructor(t,n,r){var o;r===void 0&&(r=Po(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:i}=t,{target:c}=i;this.props=t,this.events=n,this.document=$e(c),this.documentListeners=new Ve(this.document),this.listeners=new Ve(r),this.windowListeners=new Ve(ie(c)),this.initialCoordinates=(o=Bt(i))!=null?o:he,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(de.Resize,this.handleCancel),this.windowListeners.add(de.DragStart,Sn),this.windowListeners.add(de.VisibilityChange,this.handleCancel),this.windowListeners.add(de.ContextMenu,Sn),this.documentListeners.add(de.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Cn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(wn(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(de.Click,No,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(de.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:c,options:{activationConstraint:l}}=i;if(!o)return;const u=(n=Bt(t))!=null?n:he,d=pt(o,u);if(!r&&l){if(wn(l)){if(l.tolerance!=null&&kt(d,l.tolerance))return this.handleCancel();if(kt(d,l.distance))return this.handleStart()}if(Cn(l)&&kt(d,l.tolerance))return this.handleCancel();this.handlePending(l,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===G.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Fo={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class on extends rn{constructor(t){const{event:n}=t,r=$e(n.target);super(t,Fo,r)}}on.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 Yo={move:{name:"mousemove"},end:{name:"mouseup"}};var Vt;(function(e){e[e.RightClick=2]="RightClick"})(Vt||(Vt={}));class Bo extends rn{constructor(t){super(t,Yo,$e(t.event.target))}}Bo.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Vt.RightClick?!1:(r?.({event:n}),!0)}}];const It={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Wo extends rn{constructor(t){super(t,It)}static setup(){return window.addEventListener(It.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(It.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 He;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(He||(He={}));var mt;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(mt||(mt={}));function Vo(e){let{acceleration:t,activator:n=He.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:c=5,order:l=mt.TreeOrder,pointerCoordinates:u,scrollableAncestors:d,scrollableAncestorRects:g,delta:f,threshold:x}=e;const p=Uo({delta:f,disabled:!i}),[m,y]=Qr(),S=h.useRef({x:0,y:0}),R=h.useRef({x:0,y:0}),T=h.useMemo(()=>{switch(n){case He.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case He.DraggableRect:return o}},[n,o,u]),E=h.useRef(null),A=h.useCallback(()=>{const O=E.current;if(!O)return;const I=S.current.x*R.current.x,P=S.current.y*R.current.y;O.scrollBy(I,P)},[]),$=h.useMemo(()=>l===mt.TreeOrder?[...d].reverse():d,[l,d]);h.useEffect(()=>{if(!i||!d.length||!T){y();return}for(const O of $){if(r?.(O)===!1)continue;const I=d.indexOf(O),P=g[I];if(!P)continue;const{direction:H,speed:B}=Oo(O,P,T,t,x);for(const k of["x","y"])p[k][H[k]]||(B[k]=0,H[k]=0);if(B.x>0||B.y>0){y(),E.current=O,m(A,c),S.current=B,R.current=H;return}}S.current={x:0,y:0},R.current={x:0,y:0},y()},[t,A,r,y,i,c,JSON.stringify(T),JSON.stringify(p),m,d,$,g,JSON.stringify(x)])}const Ho={x:{[Q.Backward]:!1,[Q.Forward]:!1},y:{[Q.Backward]:!1,[Q.Forward]:!1}};function Uo(e){let{delta:t,disabled:n}=e;const r=Yt(t);return Je(o=>{if(n||!r||!o)return Ho;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Q.Backward]:o.x[Q.Backward]||i.x===-1,[Q.Forward]:o.x[Q.Forward]||i.x===1},y:{[Q.Backward]:o.y[Q.Backward]||i.y===-1,[Q.Forward]:o.y[Q.Forward]||i.y===1}}},[n,t,r])}function Go(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Je(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function qo(e,t){return h.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,r)}));return[...n,...i]},[]),[e,t])}var qe;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(qe||(qe={}));var Ht;(function(e){e.Optimized="optimized"})(Ht||(Ht={}));const Dn=new Map;function Xo(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,c]=h.useState(null),{frequency:l,measure:u,strategy:d}=o,g=h.useRef(e),f=S(),x=Ge(f),p=h.useCallback(function(R){R===void 0&&(R=[]),!x.current&&c(T=>T===null?R:T.concat(R.filter(E=>!T.includes(E))))},[x]),m=h.useRef(null),y=Je(R=>{if(f&&!n)return Dn;if(!R||R===Dn||g.current!==e||i!=null){const T=new Map;for(let E of e){if(!E)continue;if(i&&i.length>0&&!i.includes(E.id)&&E.rect.current){T.set(E.id,E.rect.current);continue}const A=E.node.current,$=A?new nn(u(A),A):null;E.rect.current=$,$&&T.set(E.id,$)}return T}return R},[e,i,n,f,u]);return h.useEffect(()=>{g.current=e},[e]),h.useEffect(()=>{f||p()},[n,f]),h.useEffect(()=>{i&&i.length>0&&c(null)},[JSON.stringify(i)]),h.useEffect(()=>{f||typeof l!="number"||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},l))},[l,f,p,...r]),{droppableRects:y,measureDroppableContainers:p,measuringScheduled:i!=null};function S(){switch(d){case qe.Always:return!1;case qe.BeforeDragging:return n;default:return!n}}}function or(e,t){return Je(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Ko(e,t){return or(e,t)}function Jo(e){let{callback:t,disabled:n}=e;const r=Qt(t),o=h.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return h.useEffect(()=>()=>o?.disconnect(),[o]),o}function St(e){let{callback:t,disabled:n}=e;const r=Qt(t),o=h.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return h.useEffect(()=>()=>o?.disconnect(),[o]),o}function Zo(e){return new nn(Ae(e),e)}function jn(e,t,n){t===void 0&&(t=Zo);const[r,o]=h.useState(null);function i(){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=Jo({callback(u){if(e)for(const d of u){const{type:g,target:f}=d;if(g==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),l=St({callback:i});return ve(()=>{i(),e?(l?.observe(e),c?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),c?.disconnect())},[e]),r}function Qo(e){const t=or(e);return Xn(e,t)}const Rn=[];function es(e){const t=h.useRef(e),n=Je(r=>e?r&&r!==Rn&&e&&t.current&&e.parentNode===t.current.parentNode?r:tn(e):Rn,[e]);return h.useEffect(()=>{t.current=e},[e]),n}function ts(e){const[t,n]=h.useState(null),r=h.useRef(e),o=h.useCallback(i=>{const c=Ot(i.target);c&&n(l=>l?(l.set(c,Wt(c)),new Map(l)):null)},[]);return h.useEffect(()=>{const i=r.current;if(e!==i){c(i);const l=e.map(u=>{const d=Ot(u);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,Wt(d)]):null}).filter(u=>u!=null);n(l.length?new Map(l):null),r.current=e}return()=>{c(e),c(i)};function c(l){l.forEach(u=>{const d=Ot(u);d?.removeEventListener("scroll",o)})}},[o,e]),h.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,c)=>Oe(i,c),he):tr(e):he,[e,t])}function Mn(e,t){t===void 0&&(t=[]);const n=h.useRef(null);return h.useEffect(()=>{n.current=null},t),h.useEffect(()=>{const r=e!==he;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?pt(e,n.current):he}function ns(e){h.useEffect(()=>{if(!yt)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 rs(e,t){return h.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=c=>{i(c,t)},n},{}),[e,t])}function sr(e){return h.useMemo(()=>e?Mo(e):null,[e])}const Tn=[];function os(e,t){t===void 0&&(t=Ae);const[n]=e,r=sr(n?ie(n):null),[o,i]=h.useState(Tn);function c(){i(()=>e.length?e.map(u=>Qn(u)?r:new nn(t(u),u)):Tn)}const l=St({callback:c});return ve(()=>{l?.disconnect(),c(),e.forEach(u=>l?.observe(u))},[e]),o}function ss(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ke(t)?t:e}function is(e){let{measure:t}=e;const[n,r]=h.useState(null),o=h.useCallback(d=>{for(const{target:g}of d)if(Ke(g)){r(f=>{const x=t(g);return f?{...f,width:x.width,height:x.height}:x});break}},[t]),i=St({callback:o}),c=h.useCallback(d=>{const g=ss(d);i?.disconnect(),g&&i?.observe(g),r(g?t(g):null)},[t,i]),[l,u]=gt(c);return h.useMemo(()=>({nodeRef:l,rect:n,setRef:u}),[n,l,u])}const as=[{sensor:on,options:{}},{sensor:rr,options:{}}],ls={current:{}},ct={draggable:{measure:yn},droppable:{measure:yn,strategy:qe.WhileDragging,frequency:Ht.Optimized},dragOverlay:{measure:Ae}};class Ue 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 cs={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ue,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:vt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ct,measureDroppableContainers:vt,windowRect:null,measuringScheduled:!1},us={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:vt,draggableNodes:new Map,over:null,measureDroppableContainers:vt},wt=h.createContext(us),ir=h.createContext(cs);function ds(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ue}}}function fs(e,t){switch(t.type){case Z.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Z.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 Z.DragEnd:case Z.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Z.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Ue(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case Z.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const c=new Ue(e.droppable.containers);return c.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:c}}}case Z.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Ue(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function hs(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=h.useContext(wt),i=Yt(r),c=Yt(n?.id);return h.useEffect(()=>{if(!t&&!r&&i&&c!=null){if(!en(i)||document.activeElement===i.target)return;const l=o.get(c);if(!l)return;const{activatorNode:u,node:d}=l;if(!u.current&&!d.current)return;requestAnimationFrame(()=>{for(const g of[u.current,d.current]){if(!g)continue;const f=no(g);if(f){f.focus();break}}})}},[r,t,o,c,i]),null}function gs(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function ps(e){return h.useMemo(()=>({draggable:{...ct.draggable,...e?.draggable},droppable:{...ct.droppable,...e?.droppable},dragOverlay:{...ct.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function vs(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=h.useRef(!1),{x:c,y:l}=typeof o=="boolean"?{x:o,y:o}:o;ve(()=>{if(!c&&!l||!t){i.current=!1;return}if(i.current||!r)return;const d=t?.node.current;if(!d||d.isConnected===!1)return;const g=n(d),f=Xn(g,r);if(c||(f.x=0),l||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const x=Kn(d);x&&x.scrollBy({top:f.y,left:f.x})}},[t,c,l,r,n])}const ar=h.createContext({...he,scaleX:1,scaleY:1});var De;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(De||(De={}));const lr=h.memo(function(t){var n,r,o,i;let{id:c,accessibility:l,autoScroll:u=!0,children:d,sensors:g=as,collisionDetection:f=yo,measuring:x,modifiers:p,...m}=t;const y=h.useReducer(fs,void 0,ds),[S,R]=y,[T,E]=lo(),[A,$]=h.useState(De.Uninitialized),O=A===De.Initialized,{draggable:{active:I,nodes:P,translate:H},droppable:{containers:B}}=S,k=I!=null?P.get(I):null,F=h.useRef({initial:null,translated:null}),N=h.useMemo(()=>{var oe;return I!=null?{id:I,data:(oe=k?.data)!=null?oe:ls,rect:F}:null},[I,k]),D=h.useRef(null),[C,w]=h.useState(null),[j,M]=h.useState(null),L=Ge(m,Object.values(m)),Y=Ze("DndDescribedBy",c),v=h.useMemo(()=>B.getEnabled(),[B]),_=ps(x),{droppableRects:z,measureDroppableContainers:W,measuringScheduled:q}=Xo(v,{dragging:O,dependencies:[H.x,H.y],config:_.droppable}),X=Go(P,I),U=h.useMemo(()=>j?Bt(j):null,[j]),K=qr(),J=Ko(X,_.draggable.measure);vs({activeNode:I!=null?P.get(I):null,config:K.layoutShiftCompensation,initialRect:J,measure:_.draggable.measure});const V=jn(X,_.draggable.measure,J),se=jn(X?X.parentElement:null),re=h.useRef({activatorEvent:null,active:null,activeNode:X,collisionRect:null,collisions:null,droppableRects:z,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:B,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),fe=B.getNodeFor((n=re.current.over)==null?void 0:n.id),me=is({measure:_.dragOverlay.measure}),Re=(r=me.nodeRef.current)!=null?r:X,Me=O?(o=me.rect)!=null?o:V:null,an=!!(me.nodeRef.current&&me.rect),ln=Qo(an?null:V),Mt=sr(Re?ie(Re):null),be=es(O?fe??X:null),et=os(be),tt=gs(p,{transform:{x:H.x-ln.x,y:H.y-ln.y,scaleX:1,scaleY:1},activatorEvent:j,active:N,activeNodeRect:V,containerNodeRect:se,draggingNodeRect:Me,over:re.current.over,overlayNodeRect:me.rect,scrollableAncestors:be,scrollableAncestorRects:et,windowRect:Mt}),cn=U?Oe(U,H):null,un=ts(be),Yr=Mn(un),Br=Mn(un,[V]),Te=Oe(tt,Yr),Ee=Me?Co(Me,tt):null,Pe=N&&Ee?f({active:N,collisionRect:Ee,droppableRects:z,droppableContainers:v,pointerCoordinates:cn}):null,dn=xo(Pe,"id"),[ye,fn]=h.useState(null),Wr=an?tt:Oe(tt,Br),Vr=So(Wr,(i=ye?.rect)!=null?i:null,V),Tt=h.useRef(null),hn=h.useCallback((oe,ae)=>{let{sensor:le,options:Se}=ae;if(D.current==null)return;const ue=P.get(D.current);if(!ue)return;const ce=oe.nativeEvent,ge=new le({active:D.current,activeNode:ue,event:ce,options:Se,context:re,onAbort(ee){if(!P.get(ee))return;const{onDragAbort:pe}=L.current,xe={id:ee};pe?.(xe),T({type:"onDragAbort",event:xe})},onPending(ee,we,pe,xe){if(!P.get(ee))return;const{onDragPending:ze}=L.current,Ce={id:ee,constraint:we,initialCoordinates:pe,offset:xe};ze?.(Ce),T({type:"onDragPending",event:Ce})},onStart(ee){const we=D.current;if(we==null)return;const pe=P.get(we);if(!pe)return;const{onDragStart:xe}=L.current,Ne={activatorEvent:ce,active:{id:we,data:pe.data,rect:F}};We.unstable_batchedUpdates(()=>{xe?.(Ne),$(De.Initializing),R({type:Z.DragStart,initialCoordinates:ee,active:we}),T({type:"onDragStart",event:Ne}),w(Tt.current),M(ce)})},onMove(ee){R({type:Z.DragMove,coordinates:ee})},onEnd:_e(Z.DragEnd),onCancel:_e(Z.DragCancel)});Tt.current=ge;function _e(ee){return async function(){const{active:pe,collisions:xe,over:Ne,scrollAdjustedTranslate:ze}=re.current;let Ce=null;if(pe&&ze){const{cancelDrop:Fe}=L.current;Ce={activatorEvent:ce,active:pe,collisions:xe,delta:ze,over:Ne},ee===Z.DragEnd&&typeof Fe=="function"&&await Promise.resolve(Fe(Ce))&&(ee=Z.DragCancel)}D.current=null,We.unstable_batchedUpdates(()=>{R({type:ee}),$(De.Uninitialized),fn(null),w(null),M(null),Tt.current=null;const Fe=ee===Z.DragEnd?"onDragEnd":"onDragCancel";if(Ce){const Et=L.current[Fe];Et?.(Ce),T({type:Fe,event:Ce})}})}}},[P]),Hr=h.useCallback((oe,ae)=>(le,Se)=>{const ue=le.nativeEvent,ce=P.get(Se);if(D.current!==null||!ce||ue.dndKit||ue.defaultPrevented)return;const ge={active:ce};oe(le,ae.options,ge)===!0&&(ue.dndKit={capturedBy:ae.sensor},D.current=Se,hn(le,ae))},[P,hn]),gn=qo(g,Hr);ns(g),ve(()=>{V&&A===De.Initializing&&$(De.Initialized)},[V,A]),h.useEffect(()=>{const{onDragMove:oe}=L.current,{active:ae,activatorEvent:le,collisions:Se,over:ue}=re.current;if(!ae||!le)return;const ce={active:ae,activatorEvent:le,collisions:Se,delta:{x:Te.x,y:Te.y},over:ue};We.unstable_batchedUpdates(()=>{oe?.(ce),T({type:"onDragMove",event:ce})})},[Te.x,Te.y]),h.useEffect(()=>{const{active:oe,activatorEvent:ae,collisions:le,droppableContainers:Se,scrollAdjustedTranslate:ue}=re.current;if(!oe||D.current==null||!ae||!ue)return;const{onDragOver:ce}=L.current,ge=Se.get(dn),_e=ge&&ge.rect.current?{id:ge.id,rect:ge.rect.current,data:ge.data,disabled:ge.disabled}:null,ee={active:oe,activatorEvent:ae,collisions:le,delta:{x:ue.x,y:ue.y},over:_e};We.unstable_batchedUpdates(()=>{fn(_e),ce?.(ee),T({type:"onDragOver",event:ee})})},[dn]),ve(()=>{re.current={activatorEvent:j,active:N,activeNode:X,collisionRect:Ee,collisions:Pe,droppableRects:z,draggableNodes:P,draggingNode:Re,draggingNodeRect:Me,droppableContainers:B,over:ye,scrollableAncestors:be,scrollAdjustedTranslate:Te},F.current={initial:Me,translated:Ee}},[N,X,Pe,Ee,P,Re,Me,z,B,ye,be,Te]),Vo({...K,delta:H,draggingRect:Ee,pointerCoordinates:cn,scrollableAncestors:be,scrollableAncestorRects:et});const Ur=h.useMemo(()=>({active:N,activeNode:X,activeNodeRect:V,activatorEvent:j,collisions:Pe,containerNodeRect:se,dragOverlay:me,draggableNodes:P,droppableContainers:B,droppableRects:z,over:ye,measureDroppableContainers:W,scrollableAncestors:be,scrollableAncestorRects:et,measuringConfiguration:_,measuringScheduled:q,windowRect:Mt}),[N,X,V,j,Pe,se,me,P,B,z,ye,W,be,et,_,q,Mt]),Gr=h.useMemo(()=>({activatorEvent:j,activators:gn,active:N,activeNodeRect:V,ariaDescribedById:{draggable:Y},dispatch:R,draggableNodes:P,over:ye,measureDroppableContainers:W}),[j,gn,N,V,R,Y,P,ye,W]);return h.createElement(Gn.Provider,{value:E},h.createElement(wt.Provider,{value:Gr},h.createElement(ir.Provider,{value:Ur},h.createElement(ar.Provider,{value:Vr},d)),h.createElement(hs,{disabled:l?.restoreFocus===!1})),h.createElement(fo,{...l,hiddenTextDescribedById:Y}));function qr(){const oe=C?.autoScrollEnabled===!1,ae=typeof u=="object"?u.enabled===!1:u===!1,le=O&&!oe&&!ae;return typeof u=="object"?{...u,enabled:le}:{enabled:le}}}),ms=h.createContext(null),En="button",xs="Draggable";function bs(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=Ze(xs),{activators:c,activatorEvent:l,active:u,activeNodeRect:d,ariaDescribedById:g,draggableNodes:f,over:x}=h.useContext(wt),{role:p=En,roleDescription:m="draggable",tabIndex:y=0}=o??{},S=u?.id===t,R=h.useContext(S?ar:ms),[T,E]=gt(),[A,$]=gt(),O=rs(c,t),I=Ge(n);ve(()=>(f.set(t,{id:t,key:i,node:T,activatorNode:A,data:I}),()=>{const H=f.get(t);H&&H.key===i&&f.delete(t)}),[f,t]);const P=h.useMemo(()=>({role:p,tabIndex:y,"aria-disabled":r,"aria-pressed":S&&p===En?!0:void 0,"aria-roledescription":m,"aria-describedby":g.draggable}),[r,p,y,S,m,g.draggable]);return{active:u,activatorEvent:l,activeNodeRect:d,attributes:P,isDragging:S,listeners:r?void 0:O,node:T,over:x,setNodeRef:E,setActivatorNodeRef:$,transform:R}}function ys(){return h.useContext(ir)}const Ss="Droppable",ws={timeout:25};function Cs(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=Ze(Ss),{active:c,dispatch:l,over:u,measureDroppableContainers:d}=h.useContext(wt),g=h.useRef({disabled:n}),f=h.useRef(!1),x=h.useRef(null),p=h.useRef(null),{disabled:m,updateMeasurementsFor:y,timeout:S}={...ws,...o},R=Ge(y??r),T=h.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{d(Array.isArray(R.current)?R.current:[R.current]),p.current=null},S)},[S]),E=St({callback:T,disabled:m||!c}),A=h.useCallback((P,H)=>{E&&(H&&(E.unobserve(H),f.current=!1),P&&E.observe(P))},[E]),[$,O]=gt(A),I=Ge(t);return h.useEffect(()=>{!E||!$.current||(E.disconnect(),f.current=!1,E.observe($.current))},[$,E]),h.useEffect(()=>(l({type:Z.RegisterDroppable,element:{id:r,key:i,disabled:n,node:$,rect:x,data:I}}),()=>l({type:Z.UnregisterDroppable,key:i,id:r})),[r]),h.useEffect(()=>{n!==g.current.disabled&&(l({type:Z.SetDroppableDisabled,id:r,key:i,disabled:n}),g.current.disabled=n)},[r,i,n,l]),{active:c,rect:x,isOver:u?.id===r,node:$,over:u,setNodeRef:O}}function Ct(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Ds(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function rt(e){return e!==null&&e>=0}function js(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 Rs(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const ot={scaleX:1,scaleY:1},Ms=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:i,index:c}=e;const l=(t=n[o])!=null?t:r;if(!l)return null;const u=Ts(n,c,o);if(c===o){const d=n[i];return d?{x:o<i?d.left+d.width-(l.left+l.width):d.left-l.left,y:0,...ot}:null}return c>o&&c<=i?{x:-l.width-u,y:0,...ot}:c<o&&c>=i?{x:l.width+u,y:0,...ot}:{x:0,y:0,...ot}};function Ts(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return!r||!o&&!i?0:n<t?o?r.left-(o.left+o.width):i.left-(r.left+r.width):i?i.left-(r.left+r.width):r.left-(o.left+o.width)}const cr=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=Ct(t,r,n),c=t[o],l=i[o];return!l||!c?null:{x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height}},st={scaleX:1,scaleY:1},Es=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:c}=e;const l=(t=i[n])!=null?t:r;if(!l)return null;if(o===n){const d=i[c];return d?{x:0,y:n<c?d.top+d.height-(l.top+l.height):d.top-l.top,...st}:null}const u=_s(i,o,n);return o>n&&o<=c?{x:0,y:-l.height-u,...st}:o<n&&o>=c?{x:0,y:l.height+u,...st}:{x:0,y:0,...st}};function _s(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return r?n<t?o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const ur="Sortable",dr=h.createContext({activeIndex:-1,containerId:ur,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:cr,disabled:{draggable:!1,droppable:!1}});function fr(e){let{children:t,id:n,items:r,strategy:o=cr,disabled:i=!1}=e;const{active:c,dragOverlay:l,droppableRects:u,over:d,measureDroppableContainers:g}=ys(),f=Ze(ur,n),x=l.rect!==null,p=h.useMemo(()=>r.map(O=>typeof O=="object"&&"id"in O?O.id:O),[r]),m=c!=null,y=c?p.indexOf(c.id):-1,S=d?p.indexOf(d.id):-1,R=h.useRef(p),T=!js(p,R.current),E=S!==-1&&y===-1||T,A=Rs(i);ve(()=>{T&&m&&g(p)},[T,p,m,g]),h.useEffect(()=>{R.current=p},[p]);const $=h.useMemo(()=>({activeIndex:y,containerId:f,disabled:A,disableTransforms:E,items:p,overIndex:S,useDragOverlay:x,sortedRects:Ds(p,u),strategy:o}),[y,f,A.draggable,A.droppable,E,p,S,u,x,o]);return h.createElement(dr.Provider,{value:$},t)}const Os=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Ct(n,r,o).indexOf(t)},ks=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:c,previousItems:l,previousContainerId:u,transition:d}=e;return!d||!r||l!==i&&o===c?!1:n?!0:c!==o&&t===u},Is={duration:200,easing:"ease"},hr="transform",$s=ke.Transition.toString({property:hr,duration:0,easing:"linear"}),As={roleDescription:"sortable"};function Ls(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,c]=h.useState(null),l=h.useRef(n);return ve(()=>{if(!t&&n!==l.current&&r.current){const u=o.current;if(u){const d=Ae(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!==l.current&&(l.current=n)},[t,n,r,o]),h.useEffect(()=>{i&&c(null)},[i]),i}function gr(e){let{animateLayoutChanges:t=ks,attributes:n,disabled:r,data:o,getNewIndex:i=Os,id:c,strategy:l,resizeObserverConfig:u,transition:d=Is}=e;const{items:g,containerId:f,activeIndex:x,disabled:p,disableTransforms:m,sortedRects:y,overIndex:S,useDragOverlay:R,strategy:T}=h.useContext(dr),E=Ps(r,p),A=g.indexOf(c),$=h.useMemo(()=>({sortable:{containerId:f,index:A,items:g},...o}),[f,o,A,g]),O=h.useMemo(()=>g.slice(g.indexOf(c)),[g,c]),{rect:I,node:P,isOver:H,setNodeRef:B}=Cs({id:c,data:$,disabled:E.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...u}}),{active:k,activatorEvent:F,activeNodeRect:N,attributes:D,setNodeRef:C,listeners:w,isDragging:j,over:M,setActivatorNodeRef:L,transform:Y}=bs({id:c,data:$,attributes:{...As,...n},disabled:E.draggable}),v=Zr(B,C),_=!!k,z=_&&!m&&rt(x)&&rt(S),W=!R&&j,q=W&&z?Y:null,U=z?q??(l??T)({rects:y,activeNodeRect:N,activeIndex:x,overIndex:S,index:A}):null,K=rt(x)&&rt(S)?i({id:c,items:g,activeIndex:x,overIndex:S}):A,J=k?.id,V=h.useRef({activeId:J,items:g,newIndex:K,containerId:f}),se=g!==V.current.items,re=t({active:k,containerId:f,isDragging:j,isSorting:_,id:c,index:A,items:g,newIndex:V.current.newIndex,previousItems:V.current.items,previousContainerId:V.current.containerId,transition:d,wasDragging:V.current.activeId!=null}),fe=Ls({disabled:!re,index:A,node:P,rect:I});return h.useEffect(()=>{_&&V.current.newIndex!==K&&(V.current.newIndex=K),f!==V.current.containerId&&(V.current.containerId=f),g!==V.current.items&&(V.current.items=g)},[_,K,f,g]),h.useEffect(()=>{if(J===V.current.activeId)return;if(J!=null&&V.current.activeId==null){V.current.activeId=J;return}const Re=setTimeout(()=>{V.current.activeId=J},50);return()=>clearTimeout(Re)},[J]),{active:k,activeIndex:x,attributes:D,data:$,rect:I,index:A,newIndex:K,items:g,isOver:H,isSorting:_,isDragging:j,listeners:w,node:P,overIndex:S,over:M,setNodeRef:v,setActivatorNodeRef:L,setDroppableNodeRef:B,setDraggableNodeRef:C,transform:fe??U,transition:me()};function me(){if(fe||se&&V.current.newIndex===A)return $s;if(!(W&&!en(F)||!d)&&(_||re))return ke.Transition.toString({...d,property:hr})}}function Ps(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}}G.Down,G.Right,G.Up,G.Left;var it={exports:{}},$t={},at={exports:{}},At={};var _n;function Ns(){if(_n)return At;_n=1;var e=h;function t(f,x){return f===x&&(f!==0||1/f===1/x)||f!==f&&x!==x}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,i=e.useLayoutEffect,c=e.useDebugValue;function l(f,x){var p=x(),m=r({inst:{value:p,getSnapshot:x}}),y=m[0].inst,S=m[1];return i(function(){y.value=p,y.getSnapshot=x,u(y)&&S({inst:y})},[f,p,x]),o(function(){return u(y)&&S({inst:y}),f(function(){u(y)&&S({inst:y})})},[f]),c(p),p}function u(f){var x=f.getSnapshot;f=f.value;try{var p=x();return!n(f,p)}catch{return!0}}function d(f,x){return x()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:l;return At.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,At}var Lt={};var On;function zs(){return On||(On=1,process.env.NODE_ENV!=="production"&&(function(){function e(p,m){return p===m&&(p!==0||1/p===1/m)||p!==p&&m!==m}function t(p,m){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 y=m();if(!f){var S=m();i(y,S)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}S=c({inst:{value:y,getSnapshot:m}});var R=S[0].inst,T=S[1];return u(function(){R.value=y,R.getSnapshot=m,n(R)&&T({inst:R})},[p,y,m]),l(function(){return n(R)&&T({inst:R}),p(function(){n(R)&&T({inst:R})})},[p]),d(y),y}function n(p){var m=p.getSnapshot;p=p.value;try{var y=m();return!i(p,y)}catch{return!0}}function r(p,m){return m()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=h,i=typeof Object.is=="function"?Object.is:e,c=o.useState,l=o.useEffect,u=o.useLayoutEffect,d=o.useDebugValue,g=!1,f=!1,x=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;Lt.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())})()),Lt}var kn;function pr(){return kn||(kn=1,process.env.NODE_ENV==="production"?at.exports=Ns():at.exports=zs()),at.exports}var In;function Fs(){if(In)return $t;In=1;var e=h,t=pr();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,i=e.useRef,c=e.useEffect,l=e.useMemo,u=e.useDebugValue;return $t.useSyncExternalStoreWithSelector=function(d,g,f,x,p){var m=i(null);if(m.current===null){var y={hasValue:!1,value:null};m.current=y}else y=m.current;m=l(function(){function R(O){if(!T){if(T=!0,E=O,O=x(O),p!==void 0&&y.hasValue){var I=y.value;if(p(I,O))return A=I}return A=O}if(I=A,r(E,O))return I;var P=x(O);return p!==void 0&&p(I,P)?(E=O,I):(E=O,A=P)}var T=!1,E,A,$=f===void 0?null:f;return[function(){return R(g())},$===null?void 0:function(){return R($())}]},[g,f,x,p]);var S=o(d,m[0],m[1]);return c(function(){y.hasValue=!0,y.value=S},[S]),u(S),S},$t}var Pt={};var $n;function Ys(){return $n||($n=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=h,n=pr(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,i=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;Pt.useSyncExternalStoreWithSelector=function(d,g,f,x,p){var m=i(null);if(m.current===null){var y={hasValue:!1,value:null};m.current=y}else y=m.current;m=l(function(){function R(O){if(!T){if(T=!0,E=O,O=x(O),p!==void 0&&y.hasValue){var I=y.value;if(p(I,O))return A=I}return A=O}if(I=A,r(E,O))return I;var P=x(O);return p!==void 0&&p(I,P)?(E=O,I):(E=O,A=P)}var T=!1,E,A,$=f===void 0?null:f;return[function(){return R(g())},$===null?void 0:function(){return R($())}]},[g,f,x,p]);var S=o(d,m[0],m[1]);return c(function(){y.hasValue=!0,y.value=S},[S]),u(S),S},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Pt}var An;function Bs(){return An||(An=1,process.env.NODE_ENV==="production"?it.exports=Fs():it.exports=Ys()),it.exports}var Ws=Bs();const Ut=new WeakMap,Vs=new WeakMap,xt={current:[]};let Nt=!1;const lt=new Set,Ln=new Map;function vr(e){for(const t of e){if(xt.current.includes(t))continue;xt.current.push(t),t.recompute();const n=Vs.get(t);if(n)for(const r of n){const o=Ut.get(r);o?.length&&vr(o)}}}function Hs(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Us(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Gs(e){if(lt.add(e),!Nt)try{for(Nt=!0;lt.size>0;){const t=Array.from(lt);lt.clear();for(const n of t){const r=Ln.get(n)??n.prevState;n.prevState=r,Hs(n)}for(const n of t){const r=Ut.get(n);r&&(xt.current.push(n),vr(r))}for(const n of t){const r=Ut.get(n);if(r)for(const o of r)Us(o)}}}finally{Nt=!1,xt.current=[],Ln.clear()}}function qs(e){return typeof e=="function"}class mr{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var o,i;this.listeners.add(r);const c=(i=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:i.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):qs(t)?this.state=t(this.prevState):this.state=t,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),Gs(this)}}function Le(e,t=r=>r,n={}){const r=n.equal??Xs;return Ws.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,r)}function Xs(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=Pn(e);if(n.length!==Pn(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 Pn(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}const te=new mr({tableId:"",sortColumn:null,sortDirection:"asc",visibility:{},columnOrder:[],columnWidths:{},data:[],sortableColumns:[],actionsConfig:{showActionColumn:!0,showColumnVisibilityMenu:!0,children:"Actions",width:"100px"}}),Dt=e=>`datatable:${e}:column-widths`;function xr(e,t){const n=e[0]??{},o=(t&&t.length?t:Object.keys(n).map(f=>({id:f,label:f}))).filter(f=>Object.prototype.hasOwnProperty.call(n,f.id)),{tableId:i}=te.state,c=JSON.parse(localStorage.getItem(Sr(i))||"[]"),l=[...c.map(f=>o.find(x=>x.id===f)).filter(Boolean),...o.filter(f=>!c.includes(f.id))],u=JSON.parse(localStorage.getItem(wr(i))||"{}"),d=l.reduce((f,x)=>(f[x.id]=u[x.id]??!0,f),{}),g=JSON.parse(localStorage.getItem(Dt(i))||"{}");te.setState(f=>({...f,data:e,columnOrder:l,visibility:d,columnWidths:g,sortableColumns:l.map(x=>({id:x.id,label:x.label,sortable:!0,backgroundColor:x.backgroundColor}))}))}function br(e){te.setState(t=>({...t,tableId:e,sortColumn:null,sortDirection:"asc",columnOrder:[],visibility:{}}))}const yr=e=>{te.setState(t=>({...t,actionsConfig:e}))};function Ks(e,t){te.setState(n=>{const r={...n.columnWidths,[e]:Math.max(60,t)};return localStorage.setItem(Dt(n.tableId),JSON.stringify(r)),{...n,columnWidths:r}})}const Sr=e=>`table_column_order_v1:${e}`,wr=e=>`table_column_visibility_v1:${e}`,Js=e=>{const{tableId:t}=te.state;localStorage.setItem(Sr(t),JSON.stringify(e.map(n=>n.id))),te.setState(n=>({...n,columnOrder:e})),te.setState(n=>({...n,columnOrder:e}))};function Zs(e){te.setState(t=>t.sortColumn===e?{...t,sortDirection:t.sortDirection==="asc"?"desc":"asc"}:{...t,sortColumn:e,sortDirection:"asc"})}const Qs=e=>{te.setState(t=>{const n={...t.visibility,[e]:!t.visibility[e]};return t.tableId&&localStorage.setItem(wr(t.tableId),JSON.stringify(n)),{...t,visibility:n}})};function ei(e,t){te.setState(n=>{const r={...n.columnWidths,[e]:Math.max(60,t)};return localStorage.setItem(Dt(n.tableId),JSON.stringify(r)),{...n,columnWidths:r}})}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()),Nn=e=>{const t=ni(e);return t.charAt(0).toUpperCase()+t.slice(1)},Cr=(...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=h.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:c,...l},u)=>h.createElement("svg",{ref:u,...oi,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Cr("lucide",o),...!i&&!ri(l)&&{"aria-hidden":"true"},...l},[...c.map(([d,g])=>h.createElement(d,g)),...Array.isArray(i)?i:[i]]));const ne=(e,t)=>{const n=h.forwardRef(({className:r,...o},i)=>h.createElement(si,{ref:i,iconNode:t,className:Cr(`lucide-${ti(Nn(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Nn(e),n};const ii=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ai=ne("arrow-down",ii);const li=[["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"}]],ci=ne("arrow-up-down",li);const ui=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],di=ne("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=ne("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"}]],Dr=ne("calendar",gi);const pi=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],vi=ne("chevron-left",pi);const mi=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],xi=ne("chevron-right",mi);const bi=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],yi=ne("columns-2",bi);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=ne("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=ne("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=ne("funnel",ji);const Mi=[["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"}]],jr=ne("grip-vertical",Mi);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"}]],Ei=ne("pen",Ti);const _i=[["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"}]],Oi=ne("refresh-ccw",_i);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"}]],Ii=ne("settings",ki);const $i=[["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"}]],Rr=ne("triangle-alert",$i);const Ai=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Li=ne("x",Ai);function b(e){return h.forwardRef((t,n)=>{const{children:r,...o}=t;return s.jsx(e,{ref:n,...o,children:r})})}const Pi=b(a.Menu.Trigger),Ni=b(a.Menu.Positioner),zi=b(a.Menu.Content),Fi=b(a.Menu.Item),Yi=b(a.Checkbox.Label),Bi=b(a.Checkbox.HiddenInput),Wi=b(a.Checkbox.Control);function Vi({visibility:e,onToggle:t}){const{sortableColumns:n}=Le(te);return s.jsxs(a.Menu.Root,{closeOnSelect:!1,children:[s.jsx(Pi,{asChild:!0,children:s.jsx(a.IconButton,{"aria-label":"Toggle columns",variant:"ghost",ml:"1",size:"xs",children:s.jsx(yi,{size:18})})}),s.jsx(a.Portal,{children:s.jsx(Ni,{children:s.jsx(zi,{minW:"220px",children:n.map(r=>{const o=!!e[r.id];return s.jsx(Fi,{value:r.id,closeOnSelect:!1,children:s.jsxs(a.Checkbox.Root,{checked:o,onCheckedChange:()=>t(r.id),children:[s.jsx(Bi,{}),s.jsx(Wi,{}),s.jsx(Yi,{children:r.label})]})},r.id)})})})})]})}function Hi({id:e,children:t,onClick:n,cursor:r,borderRight:o,backgroundColor:i}){const{columnWidths:c}=Le(te),l=c[e],u=h.useRef(0),d=h.useRef(0),{setNodeRef:g,attributes:f,listeners:x,transform:p,transition:m}=gr({id:e}),y=S=>{S.stopPropagation(),u.current=S.clientX,d.current=l??150;const R=E=>{ei(e,d.current+(E.clientX-u.current))},T=()=>{document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",T)};document.addEventListener("mousemove",R),document.addEventListener("mouseup",T)};return s.jsx(a.Table.ColumnHeader,{ref:g,onClick:n,backgroundColor:i,w:l?`${l}px`:void 0,minW:"60px",style:{transform:ke.Transform.toString(p),transition:m,cursor:r,borderRight:o},...f,children:s.jsxs(a.HStack,{position:"relative",children:[s.jsx("span",{...x,children:s.jsx(jr,{size:12,style:{cursor:"grab"}})}),t,s.jsx(a.Box,{position:"absolute",right:0,top:0,h:"100%",w:"5px",cursor:"col-resize",background:"gray.400",onMouseDown:y,_hover:{bg:"gray.600"}})]})})}function Ui(){const{columnOrder:e,visibility:t,sortColumn:n,sortDirection:r,sortableColumns:o,actionsConfig:i}=Le(te),c=e.map(l=>o.find(u=>u.id===l.id)).filter(l=>l!==void 0).filter(l=>t[l.id]);return s.jsx(a.Table.Header,{background:"blue.200",position:"sticky",top:0,p:"0",zIndex:1,children:s.jsxs(a.Table.Row,{height:"28px",children:[i?.showSNo&&s.jsx(a.Table.ColumnHeader,{width:"20px",textAlign:"center",backgroundColor:i.backgroundColor,borderRight:"2px solid #dcdcdc",children:i.indexChildren||"S.No"}),c.map(l=>{const u=n===l?.id;return s.jsx(Hi,{id:l?.id,onClick:()=>l?.sortable&&Zs(l?.id),borderRight:"2px solid #dcdcdc",backgroundColor:l?.backgroundColor,children:s.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,userSelect:"none"},children:[l?.label,l?.sortable&&(u?r==="asc"?s.jsx(di,{size:14}):s.jsx(ai,{size:14}):s.jsx(ci,{size:14,opacity:.4}))]})},l?.id)}),i?.showActionColumn&&s.jsx(a.Table.ColumnHeader,{width:i.width,backgroundColor:i.backgroundColor,borderRight:"2px solid #dcdcdc",children:i.children||"Actions"}),i?.showColumnVisibilityMenu&&s.jsx(a.Table.ColumnHeader,{boxSize:"0.5",backgroundColor:i.backgroundColorColumnVisibilityMenu,children:s.jsx(Vi,{visibility:t,onToggle:Qs})})]})})}const Gi=[10,20,50,100],qi=b(a.Select.Positioner),Xi=b(a.Select.Content),Ki=b(a.Select.Item),Ji=b(a.Pagination.PrevTrigger),Zi=b(a.Pagination.NextTrigger),Qi=b(a.Select.HiddenSelect),ea=b(a.Select.Control),ta=b(a.Select.Trigger),na=b(a.Select.ValueText),ra=b(a.Select.IndicatorGroup),oa=b(a.Select.Indicator);function sa({totalCount:e,pageSize:t,currentPage:n,onPageChange:r,onPageSizeChange:o,siblingCount:i=2,pageSizeOptions:c=Gi}){const l=a.createListCollection({items:c.map(u=>({label:String(u),value:String(u)}))});return s.jsx(a.Box,{width:"100%",children:s.jsxs(a.HStack,{justify:"space-between",mx:"auto",flexWrap:"wrap",children:[s.jsxs(a.HStack,{children:[s.jsx(a.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:"Rows per page:"}),s.jsxs(a.Select.Root,{collection:l,size:"sm",width:"60px",onValueChange:u=>o?.(Number(u.items[0].value)),value:[String(t)],children:[s.jsx(Qi,{}),s.jsxs(ea,{children:[s.jsx(ta,{children:s.jsx(na,{placeholder:""})}),s.jsx(ra,{children:s.jsx(oa,{})})]}),s.jsx(a.Portal,{children:s.jsx(qi,{children:s.jsx(Xi,{children:l.items.map(u=>s.jsxs(Ki,{item:u.value,children:[u.label,s.jsx(a.Select.ItemIndicator,{})]},u.value))})})})]}),s.jsxs(a.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:["of ",e]})]}),s.jsx(a.Pagination.Root,{count:e,pageSize:t,page:n,siblingCount:i,onPageChange:u=>r&&r(u.page),children:s.jsxs(a.ButtonGroup,{size:"sm",variant:"ghost",children:[s.jsx(Ji,{asChild:!0,children:s.jsx(a.IconButton,{"aria-label":"Previous page",children:s.jsx(vi,{size:18})})}),s.jsx(a.Pagination.Items,{render:u=>s.jsx(a.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)}),s.jsx(Zi,{asChild:!0,children:s.jsx(a.IconButton,{"aria-label":"Next page",children:s.jsx(xi,{size:18})})})]})})]})})}const ia=b(a.Menu.Item),aa=b(a.Menu.Content),la=b(a.Menu.Positioner),ca=b(a.Menu.Trigger);function ua({data:e=[],actions:t=[],actionConfig:n,onRowSelect:r,onRowSelectEvent:o="left",startIndex:i=0}){const{columnOrder:c,visibility:l,columnWidths:u}=Le(te);return s.jsx(a.Table.Body,{children:e.map((d,g)=>s.jsxs(a.Table.Row,{onClick:()=>o==="left"&&r?.(d.__raw),_hover:{bg:"blue.50"},onContextMenu:o==="right"?f=>{f.preventDefault(),r?.(d.__raw,f)}:void 0,children:[n?.showSNo&&s.jsx(a.Table.Cell,{textAlign:"center",fontWeight:"medium",children:i+g+1}),c.filter(f=>l[f.id]).map(f=>s.jsx(a.Table.Cell,{w:u[f.id]?u[f.id]+"px":void 0,children:d[f.id]},f.id)),n?.showActionColumn&&s.jsx(a.Table.Cell,{textAlign:"center",display:"flex",gap:2,children:s.jsxs(a.Menu.Root,{children:[s.jsx(ca,{asChild:!0,children:s.jsx(a.IconButton,{"aria-label":"Open",variant:"ghost",size:"sm",children:s.jsx(Di,{size:16})})}),s.jsx(a.Portal,{children:s.jsx(la,{children:s.jsx(aa,{children:t.filter(f=>typeof f.visible=="function"?f.visible(d.__raw):f.visible!==!1).map(f=>s.jsxs(ia,{onClick:()=>f.onClick(d.__raw),colorScheme:f.colorScheme,value:f.label,children:[f.icon,f.label]},f.label))})})})]})}),n?.showColumnVisibilityMenu&&s.jsx(a.Table.Cell,{})]},d.__key||d.id))})}function da({rows:e=6,columns:t}){return s.jsx(a.Table.Body,{children:Array.from({length:e}).map((n,r)=>s.jsx(a.Table.Row,{children:Array.from({length:t}).map((o,i)=>s.jsx(a.Table.Cell,{children:s.jsx(a.Skeleton,{height:"25px"})},i))},r))})}function fa({tableId:e,data:t=[],headers:n=[],loading:r=!1,loadingChildren:o,skeletonLoading:i=!1,emptyMessage:c="No data",actions:l,page:u=1,pageSize:d=10,onPageChange:g,onPageSizeChange:f,density:x="sm",totalCount:p=0,actionConfig:m,pageSizeOptions:y,onRowSelect:S,onRowSelectEvent:R="left"}){h.useEffect(()=>{br(e)},[e]),h.useEffect(()=>{xr(t,n)},[t,n]),h.useEffect(()=>{m&&yr(m)},[m]);const{sortColumn:T,sortDirection:E,data:A,columnOrder:$}=Le(te),O=h.useMemo(()=>{const F=[...A];return T&&F.sort((N,D)=>E==="asc"?String(N[T]).localeCompare(String(D[T])):String(D[T]).localeCompare(String(N[T]))),F},[A,T,E,u,d]),I=h.useMemo(()=>(Math.max(1,u||1)-1)*d,[u,d]);h.useEffect(()=>{u<1&&g&&g(1)},[u,g]);const P=F=>{const{active:N,over:D}=F;if(!D||N.id===D.id)return;const C=$.findIndex(M=>M.id===N.id),w=$.findIndex(M=>M.id===D.id),j=Ct($,C,w);Js(j)},H=r&&!i,B=i&&!r,k=!r&&!i&&O.length===0;return s.jsx(lr,{collisionDetection:qn,onDragEnd:P,children:s.jsx(fr,{items:$.map(F=>F.id),strategy:Ms,children:s.jsxs(a.Box,{flex:"1",minH:0,display:"flex",flexDirection:"column",p:2,children:[s.jsxs(a.Box,{flex:"1",minH:0,position:"relative",overflow:"auto",children:[H&&s.jsx(a.Box,{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,bg:"whiteAlpha.600",children:o??s.jsx(a.Spinner,{})}),s.jsxs(a.Table.Root,{variant:"outline",w:"100%",size:x,children:[s.jsx(Ui,{}),B?s.jsx(da,{rows:d,columns:n.length+(l?2:0)}):k?s.jsx(a.Table.Body,{children:s.jsx(a.Table.Row,{children:s.jsx(a.Table.Cell,{colSpan:n.length+(l?1:0),children:s.jsx(a.Box,{display:"flex",alignItems:"center",justifyContent:"center",minH:"200px",color:"gray.500",children:c})})})}):s.jsx(ua,{data:O,actions:l,actionConfig:m,onRowSelect:S,startIndex:I,onRowSelectEvent:R})]})]}),s.jsx(a.Box,{mt:.5,children:s.jsx(sa,{totalCount:p,pageSize:d,currentPage:u,onPageChange:g,onPageSizeChange:F=>{f?.(F),u>1&&g?.(1)},pageSizeOptions:y})})]})})})}const ha=b(a.Checkbox.Root),ga=b(a.Checkbox.HiddenInput),pa=b(a.Checkbox.Control),va=b(a.Checkbox.Label),Mr=({value:e,onChange:t,size:n="sm",label:r,helperText:o,isDisabled:i,required:c,errorText:l})=>s.jsxs(ha,{value:e,onChange:t,size:n,children:[s.jsx(ga,{}),s.jsx(pa,{disabled:i,required:c,errorText:l,helperText:o}),r&&s.jsx(va,{children:r})]}),ma=b(a.Combobox.Root),xa=b(a.Combobox.Control),ba=b(a.Combobox.Input),ya=b(a.Combobox.IndicatorGroup),Sa=b(a.Combobox.ClearTrigger),wa=b(a.Combobox.Trigger),Ca=b(a.Combobox.Positioner),Da=b(a.Combobox.Content);function Tr({label:e,size:t="sm",width:n="100%",variant:r="outline",items:o=[],itemToString:i,itemToValue:c,renderItem:l,value:u,loading:d,error:g,errorMessage:f,placeholder:x,helpText:p,onInputChange:m,onSelect:y,visible:S=!0,rootProps:R,inputProps:T,controlProps:E,contentProps:A,itemProps:$}){const[O,I]=h.useState(""),{collection:P,set:H}=a.useListCollection({initialItems:o,itemToString:i,itemToValue:c}),B=h.useMemo(()=>{if(!O)return o;const k=O.toLowerCase();return o.filter(F=>i(F).toLowerCase().includes(k))},[o,O,i]);return h.useEffect(()=>{H(B)},[B,H]),h.useEffect(()=>{u&&I(i(u))},[u,i]),s.jsxs(ma,{width:n,size:t,variant:r,collection:P,placeholder:x,onInputValueChange:k=>{m?.(k.inputValue),I(k.inputValue)},value:u?[c(u)]:[],onValueChange:k=>{const F=k.value?.[0];if(!F)return;const N=P.items.find(D=>c(D)===F);N&&y?.(N)},positioning:{sameWidth:!1,placement:"bottom-start"},...R,children:[S&&e&&s.jsx(a.Text,{fontSize:"sm",children:e}),s.jsxs(xa,{...E,children:[s.jsx(ba,{placeholder:x??"Type to search",...T}),s.jsxs(ya,{children:[s.jsx(Sa,{}),s.jsx(wa,{})]})]}),s.jsx(Ca,{children:s.jsxs(Da,{minW:"sm",...A,children:[d?s.jsxs(a.HStack,{p:"2",children:[s.jsx(a.Spinner,{size:"xs",borderWidth:"1px"}),s.jsx(a.Span,{children:"Loading..."})]}):g?s.jsx(a.Text,{p:"2",color:"red.500",fontSize:"sm",children:f||"Something went wrong"}):P.items.map(k=>s.jsxs(a.Combobox.Item,{item:k,...$,children:[l(k),s.jsx(a.Combobox.ItemIndicator,{})]},c(k))),p&&!g&&!d&&s.jsx(a.Text,{p:"2",color:"fg.muted",fontSize:"sm",children:p})]})})]})}const ja=b(a.Popover.Root),Ra=b(a.Popover.Content),Ma=b(a.Popover.Arrow),Ta=b(a.Popover.Trigger),Ea=b(a.Popover.Positioner);function je(e){if(!e)return"";const t=String(e.getDate()).padStart(2,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=e.getFullYear();return`${t}-${n}-${r}`}function zn(e){const t=e.split(/\s+to\s+/i),n=t[0],r=t[1],o=l=>{if(!l)return null;const u=l.trim().split("-");if(u.length!==3)return null;const[d,g,f]=u,x=parseInt(d),p=parseInt(g)-1,m=parseInt(f);if(isNaN(x)||isNaN(p)||isNaN(m)||f.length!==4)return null;const y=new Date(m,p,x);return y.getDate()===x&&y.getMonth()===p?y:null},i=o(n),c=o(r);return{start:i,end:c}}function Er({startDate:e,endDate:t,onChange:n,width:r="280px",showLabel:o=!0,label:i="Select date range",visible:c=!0}){const[l,u]=h.useState(!1),[d,g]=h.useState(e||new Date),[f,x]=h.useState(null),[p,m]=h.useState(e||null),[y,S]=h.useState(t||null),R=(F,N)=>F&&N?`${je(F)} to ${je(N)}`:F?`${je(F)}`:"",[T,E]=h.useState(R(e,t));h.useEffect(()=>{m(e||null),S(t||null)},[e,t]);const A=new Date(d.getFullYear(),d.getMonth()+1,0).getDate(),$=new Date(d.getFullYear(),d.getMonth(),1).getDay(),O=()=>{g(new Date(d.getFullYear(),d.getMonth()-1,1))},I=()=>{g(new Date(d.getFullYear(),d.getMonth()+1,1))},P=F=>{const N=new Date(d.getFullYear(),d.getMonth(),F);if(!p||p&&y){m(N),S(null),n(N,null),E(je(N));return}if(p&&!y){const D=N<p?N:p,C=N<p?p:N;m(D),S(C),n(D,C),E(`${je(D)} to ${je(C)}`),u(!1)}},H=F=>{const N=F.target.value;E(N);const{start:D,end:C}=zn(N);if(D&&C){const w=D<C?D:C,j=D<C?C:D;n(w,j),g(w)}else D&&!N.toLowerCase().includes("to")&&n(D,null)},B=F=>{if(F.key!=="Enter")return;const{start:N,end:D}=zn(T);if(N&&!D&&!T.toLowerCase().includes("to")){const C=`${je(N)} to `;E(C),m(N),S(null),n(N,null),requestAnimationFrame(()=>{F.target.setSelectionRange(C.length,C.length)});return}if(N&&D){const C=N<D?N:D,w=N<D?D:N;m(C),S(w),n(C,w),u(!1)}},k=()=>{m(null),S(null),E(""),n(null,null)};return s.jsxs(a.Box,{width:r,onKeyDown:B,children:[o&&!c&&s.jsx(a.Text,{fontSize:"xs",color:"fg.muted",mb:1,fontWeight:"medium",children:i}),s.jsxs(ja,{open:l,onOpenChange:F=>u(F.open),positioning:{placement:"bottom-start",gutter:4},children:[s.jsxs(a.Group,{attached:!0,w:"full",position:"relative",children:[s.jsx(a.Input,{placeholder:"DD-MM-YYYY to DD-MM-YYYY",value:T,onChange:H,size:"sm",autoComplete:"off"}),T&&s.jsx(a.IconButton,{size:"xs",variant:"ghost","aria-label":"Clear date",onClick:k,position:"absolute",right:"32px",top:"50%",transform:"translateY(-50%)",children:s.jsx(Li,{size:14})}),s.jsx(Ta,{asChild:!0,children:s.jsx(a.InputAddon,{cursor:"pointer",px:2,_hover:{bg:"gray.100"},transition:"background 0.2s",children:s.jsx(Dr,{size:16})})})]}),s.jsx(Ea,{children:s.jsxs(Ra,{width:"300px",p:4,boxShadow:"xl",zIndex:1e3,borderRadius:"md",outline:"none",children:[s.jsx(Ma,{}),s.jsxs(a.HStack,{justify:"space-between",mb:4,children:[s.jsx(a.IconButton,{size:"xs",variant:"ghost",onClick:O,"aria-label":"Previous month",children:"‹"}),s.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:d.toLocaleString("default",{month:"long",year:"numeric"})}),s.jsx(a.IconButton,{size:"xs",variant:"ghost",onClick:I,"aria-label":"Next month",children:"›"})]}),s.jsxs(a.Grid,{templateColumns:"repeat(7, 1fr)",gap:1,textAlign:"center",children:[["S","M","T","W","T","F","S"].map((F,N)=>s.jsx(a.Text,{fontSize:"xs",fontWeight:"bold",color:"fg.subtle",py:1,children:F},`${F}-${N}`)),Array($).fill(null).map((F,N)=>s.jsx(a.Box,{},`empty-${N}`)),Array.from({length:A},(F,N)=>{const D=N+1,C=new Date(d.getFullYear(),d.getMonth(),D);let w=e,j=t;if(w&&j&&f)if(e&&t){const W=e.getTime()+(t.getTime()-e.getTime())/2;f.getTime()<=W?w=f:j=f,w>j&&([w,j]=[j,w])}else e&&!t&&(w=f<e?f:e,j=f<e?e:f);const M=w&&C.getTime()===w.getTime(),L=j&&C.getTime()===j.getTime(),Y=w&&j&&C>w&&C<j;let v="transparent",_="gray";M||L?_="blue":Y&&(v="blue.100");let z="md";return Y&&(z="0"),M&&j&&(z=L?"md":"md 0 0 md"),L&&w&&(z=M?"md":"0 md md 0"),s.jsx(a.Button,{size:"xs",variant:"ghost",colorPalette:_,bg:v!=="transparent"?v:void 0,onClick:()=>P(D),onMouseEnter:()=>x(C),onMouseLeave:()=>x(null),minW:"32px",h:"32px",fontSize:"xs",borderRadius:z,_hover:{bg:M||L?void 0:"gray.100"},children:D},D)})]}),s.jsx(a.Text,{fontSize:"10px",color:"fg.muted",mt:3,textAlign:"center",children:"Select Start Date then End Date"})]})})]})]})}const _a=b(a.Popover.Root),Oa=b(a.Popover.Content),ka=b(a.Popover.Arrow),Ia=b(a.Popover.Trigger),$a=b(a.Popover.Positioner);function Fn(e){if(!e)return"";const t=String(e.getDate()).padStart(2,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=e.getFullYear();return`${t}-${n}-${r}`}function Aa(e){const t=e.split("-");if(t.length!==3)return null;const[n,r,o]=t,i=parseInt(n),c=parseInt(r)-1,l=parseInt(o);if(isNaN(i)||isNaN(c)||isNaN(l)||o.length!==4)return null;const u=new Date(l,c,i);return u.getDate()===i&&u.getMonth()===c?u:null}function _r({value:e,onChange:t,width:n="220px",visible:r=!0,label:o="Select date"}){const[i,c]=h.useState(!1),[l,u]=h.useState(e||new Date),[d,g]=h.useState(Fn(e));h.useEffect(()=>{g(Fn(e))},[e]);const f=new Date(l.getFullYear(),l.getMonth()+1,0).getDate(),x=new Date(l.getFullYear(),l.getMonth(),1).getDay(),p=()=>{u(new Date(l.getFullYear(),l.getMonth()-1,1))},m=()=>{u(new Date(l.getFullYear(),l.getMonth()+1,1))},y=R=>{const T=new Date(l.getFullYear(),l.getMonth(),R);t(T),c(!1)},S=R=>{if(i)switch(R.key){case"ArrowLeft":p();break;case"ArrowRight":m();break;case"Escape":c(!1);break}};return s.jsxs(a.Box,{width:n,onKeyDown:S,children:[!r&&s.jsx(a.Text,{fontSize:"xs",color:"fg.muted",mb:1,fontWeight:"medium",children:o}),s.jsxs(_a,{open:i,onOpenChange:R=>c(R.open),positioning:{placement:"bottom-start",gutter:4},children:[s.jsxs(a.Group,{attached:!0,w:"full",children:[s.jsx(a.Input,{placeholder:"DD-MM-YYYY",value:d,onChange:R=>{const T=R.target.value;g(T);const E=Aa(T);E&&(t(E),u(E))},size:"sm",autoComplete:"off"}),s.jsx(Ia,{asChild:!0,children:s.jsx(a.InputAddon,{cursor:"pointer",px:2,_hover:{bg:"gray.100"},transition:"background 0.2s",children:s.jsx(Dr,{size:16})})})]}),s.jsx($a,{children:s.jsxs(Oa,{width:"300px",p:4,boxShadow:"xl",zIndex:1e3,borderRadius:"md",outline:"none",children:[s.jsx(ka,{}),s.jsxs(a.HStack,{justify:"space-between",mb:4,children:[s.jsx(a.IconButton,{size:"xs",variant:"ghost",onClick:p,"aria-label":"Previous month",children:"‹"}),s.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:l.toLocaleString("default",{month:"long",year:"numeric"})}),s.jsx(a.IconButton,{size:"xs",variant:"ghost",onClick:m,"aria-label":"Next month",children:"›"})]}),s.jsxs(a.Grid,{templateColumns:"repeat(7, 1fr)",gap:1,textAlign:"center",children:[["S","M","T","W","T","F","S"].map((R,T)=>s.jsx(a.Text,{fontSize:"xs",fontWeight:"bold",color:"fg.subtle",py:1,children:R},`${R}-${T}`)),Array(x).fill(null).map((R,T)=>s.jsx(a.Box,{},`empty-${T}`)),Array.from({length:f},(R,T)=>{const E=T+1,A=e&&e.getDate()===E&&e.getMonth()===l.getMonth()&&e.getFullYear()===l.getFullYear();return s.jsx(a.Button,{size:"xs",variant:A?"solid":"ghost",colorPalette:A?"blue":"gray",onClick:()=>y(E),minW:"32px",h:"32px",fontSize:"xs",borderRadius:"md",children:E},E)})]}),s.jsx(a.Text,{fontSize:"10px",color:"fg.muted",mt:3,textAlign:"center",children:"Use Arrow Keys to change months • Esc to close"})]})})]})]})}const La=b(a.Field.Root),Pa=b(a.Field.Label),Na=b(a.Field.HelperText),za=b(a.Field.ErrorText),Gt=({icon:e,value:t,onChange:n,placeholder:r,size:o="xs",variant:i="outline",width:c="100%",label:l,helperText:u,isDisabled:d=!1,required:g=!1,errorText:f,visible:x,type:p="text",min:m=0,max:y=100,step:S=1})=>s.jsxs(La,{width:c,children:[x&&s.jsx(Pa,{children:l}),s.jsx(a.InputGroup,{startElement:e,children:s.jsx(a.Input,{value:t,onChange:R=>n?.(R.target.value),placeholder:r,size:o,type:p,variant:i,disabled:d,required:g,min:m,max:y,step:S})}),f&&s.jsx(za,{fontSize:"xs",children:f}),u&&s.jsx(Na,{fontSize:"xs",children:u})]}),Fa=b(a.Field.Root),Ya=b(a.Field.HelperText),Ba=b(a.Field.ErrorText),Wa=b(a.Select.Root),Va=b(a.Select.Label),Ha=b(a.Select.Control),Ua=b(a.Select.Trigger),Ga=b(a.Select.ValueText),qa=b(a.Select.IndicatorGroup),Xa=b(a.Select.Indicator),Ka=b(a.Select.Content),Ja=b(a.Select.Item),Za=b(a.Select.ItemIndicator),Qa=b(a.Select.HiddenSelect),el=b(a.Select.Positioner),Or=({options:e=[],label:t,value:n,onChange:r,placeholder:o,size:i="xs",width:c="100%",variant:l="outline",helperText:u,isDisabled:d,required:g,errorText:f,visible:x})=>{const p=a.createListCollection({items:e});return s.jsxs(Fa,{disabled:d,required:g,children:[s.jsxs(Wa,{collection:p,variant:l,size:i,width:c,value:n?[n]:[],onValueChange:m=>r?.(m.value[0]),children:[s.jsx(Qa,{}),x&&s.jsx(Va,{children:t}),s.jsxs(Ha,{children:[s.jsx(Ua,{children:s.jsx(Ga,{placeholder:o})}),s.jsx(qa,{children:s.jsx(Xa,{})})]}),s.jsx(el,{children:s.jsx(Ka,{children:p.items.map(m=>s.jsxs(Ja,{item:m,children:[m.label,s.jsx(Za,{})]},m.value))})})]}),u&&s.jsx(Ya,{children:u}),f&&s.jsx(Ba,{children:f})]})},kr=(e="default")=>`FILTER_PRESETS_${e}`,tl=e=>{if(!e)return[];try{return JSON.parse(e)}catch{return[]}},nl=e=>typeof window>"u"?[]:tl(localStorage.getItem(kr(e))),Xe=new mr({}),Qe=e=>{const t=Xe.state;if(e in t)return t[e];const n=nl(e);return Xe.setState(r=>({...r,[e]:n})),n},jt=(e,t)=>{Xe.setState(n=>({...n,[e]:t})),typeof window<"u"&&localStorage.setItem(kr(e),JSON.stringify(t))},Ir=(e,t)=>{const n=[t,...Qe(e)];jt(e,n)},$r=(e,t)=>{const n=Qe(e).filter(r=>r.id!==t);jt(e,n)},rl=(e,t,n)=>{const r=Qe(e).map(o=>o.id===t?n(o):o);jt(e,r)},ol=b(a.Checkbox.Root),sl=b(a.Checkbox.HiddenInput),il=b(a.Checkbox.Control),al=b(a.Slider.Root),ll=b(a.Slider.Track),cl=b(a.Slider.Range),ul=b(a.Slider.Thumbs),dl=b(a.Slider.Control),fl=({filter:e,onVisibilityChange:t,onSizeChange:n})=>{const{attributes:r,listeners:o,setNodeRef:i,transform:c,transition:l}=gr({id:e.id}),u={transform:ke.Transform.toString(c),transition:l};return s.jsxs(a.VStack,{ref:i,style:u,align:"stretch",border:"1px solid",borderColor:"gray.200",rounded:"md",p:3,mb:3,bg:"white",children:[s.jsxs(a.HStack,{...r,...o,cursor:"grab",userSelect:"none",gap:2,children:[s.jsx(jr,{size:16}),s.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:e.label||e.id})]}),s.jsxs(a.HStack,{justify:"space-between",children:[s.jsx(a.Text,{fontSize:"sm",children:"Visible"}),s.jsxs(ol,{checked:e.visible,size:"sm",onCheckedChange:d=>t?.(e.id,!!d.checked),children:[s.jsx(sl,{}),s.jsx(il,{})]})]}),s.jsxs(a.VStack,{align:"stretch",gap:1,children:[s.jsx(a.Text,{fontSize:"sm",children:"Size"}),s.jsx(al,{min:1,max:5,step:.5,value:[e.size??1],onValueChange:d=>n?.(e.id,d.value[0]),children:s.jsxs(dl,{children:[s.jsx(ll,{children:s.jsx(cl,{})}),s.jsx(ul,{})]})})]})]})},hl=b(a.Drawer.Root),gl=b(a.Drawer.Trigger),pl=b(a.Drawer.Backdrop),vl=b(a.Drawer.Positioner),ml=b(a.Drawer.Content),xl=b(a.Drawer.Header),bl=b(a.Drawer.Title),yl=b(a.Drawer.Body),Sl=b(a.Drawer.Footer),wl=b(a.Drawer.CloseTrigger),Cl=b(a.Tabs.Root),Dl=b(a.Tabs.List),zt=b(a.Tabs.Trigger),Ft=b(a.Tabs.Content),Ar=(e,t)=>{if(e.customComponent)return e.customComponent;switch(console.log(e.type),e.type){case"text":return s.jsx(Gt,{placeholder:e.label,value:e.value,onChange:e.onChange,label:e.label,visible:t});case"number":return s.jsx(Gt,{label:e.label,value:e.value,onChange:e.onChange});case"checkbox":return s.jsx(Mr,{label:e.label,value:e.value,onChange:e.onChange});case"select":return s.jsx(Or,{label:e.label,value:e.value,onChange:e.onChange,options:e.options??[],visible:t,placeholder:e.placeholder});case"date":return s.jsx(_r,{value:e.value,onChange:e.onChange,visible:t,label:e.label});case"date-range":return s.jsx(Er,{startDate:e.startDate?new Date(e.startDate):void 0,endDate:e.endDate?new Date(e.endDate):void 0,onChange:e.onChange,visible:t,label:e.label});case"combobox":return s.jsx(Tr,{visible:!0,label:e.label,items:e.options,itemToString:n=>n.label,itemToValue:n=>n.value,renderItem:n=>s.jsx("span",{children:n.label})});default:return null}},jl=({filterDrawerSize:e="sm",onVisibilityChange:t,onSizeChange:n,onClear:r,filters:o,pageKey:i="default",onLoadPreset:c,activePresetName:l,onReorder:u,open:d,onOpenChange:g})=>{const x=Le(Xe)[i]??Qe(i),p=()=>{const m=prompt("Preset name?");if(!m)return;const y=o.reduce((S,R)=>(S[R.id]=R.value,S),{});Ir(i,{id:crypto.randomUUID(),name:m,date:new Date().toISOString(),values:y})};return s.jsx(a.HStack,{wrap:"wrap",children:s.jsxs(hl,{size:e,open:d,onOpenChange:g,children:[s.jsx(gl,{asChild:!0,children:s.jsxs(a.IconButton,{"aria-label":"Open filters",variant:"outline",size:"xs",ml:2,p:2,children:[s.jsx(Ri,{size:16}),"Filters"]})}),s.jsxs(a.Portal,{children:[s.jsx(pl,{}),s.jsx(vl,{children:s.jsxs(ml,{children:[s.jsx(xl,{children:s.jsx(bl,{children:"Filters"})}),s.jsx(yl,{overflowY:"auto",pt:1,children:s.jsxs(Cl,{defaultValue:"view",children:[s.jsxs(Dl,{mb:4,children:[s.jsxs(zt,{value:"view",children:[s.jsx(Ei,{size:16}),"Edit"]}),s.jsxs(zt,{value:"settings",children:[s.jsx(Ii,{size:16}),"Settings"]}),s.jsxs(zt,{value:"presets",children:[s.jsx(hi,{size:16}),"Presets"]})]}),s.jsx(Ft,{value:"view",children:o.filter(m=>m.visible).map(m=>s.jsx(a.VStack,{align:"stretch",border:"1px solid",borderColor:"gray.200",flex:m.size??1,minW:`${(m.size??1)*100}px`,rounded:"md",p:3,mb:3,children:Ar(m,d)},m.id))}),s.jsx(Ft,{value:"settings",children:s.jsx(lr,{sensors:go(ho(on)),collisionDetection:qn,onDragEnd:({active:m,over:y})=>{if(!y||m.id===y.id)return;const S=o.findIndex(E=>E.id===m.id),R=o.findIndex(E=>E.id===y.id),T=Ct(o,S,R);u?.(T)},children:s.jsx(fr,{items:o.map(m=>m.id),strategy:Es,children:o.map(m=>s.jsx(fl,{filter:m,onVisibilityChange:t,onSizeChange:n},m.id))})})}),s.jsx(Ft,{value:"presets",children:s.jsxs(a.VStack,{align:"stretch",mb:3,children:[x.length===0&&s.jsx(a.Text,{fontSize:"xs",color:"gray.500",children:"No presets saved yet."}),x.map(m=>s.jsxs(a.HStack,{justify:"space-between",border:"1px solid",borderColor:l===m.name?"blue.300":"gray.200",rounded:"md",p:2,children:[s.jsxs(a.VStack,{align:"start",gap:0,children:[s.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:m.name}),s.jsx(a.Text,{fontSize:"xs",color:"gray.500",children:new Date(m.date).toLocaleDateString()})]}),s.jsxs(a.HStack,{children:[s.jsx(a.Button,{size:"xs",variant:"ghost",onClick:()=>{const y=o.map(S=>({...S,value:m.values[S.id]??S.value}));c?.(y,m.name)},children:"Load"}),s.jsx(a.IconButton,{size:"xs","aria-label":"Delete preset",variant:"ghost",onClick:()=>$r(i,m.id),children:s.jsx(wi,{size:14})})]})]},m.id)),s.jsx(a.Button,{size:"sm",colorScheme:"blue",onClick:p,children:"Save Current Filters"})]})})]})}),s.jsx(Sl,{justify:"space-between",children:s.jsx(wl,{asChild:!0,children:s.jsx(a.CloseButton,{})})})]})})]})]})})},Rl=({title:e,filters:t,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:i,maxToolbarUnits:c,pageKey:l,onLoadPreset:u,activePresetName:d,filterDrawerSize:g="sm"})=>{const[f,x]=h.useState(!1);return s.jsxs(a.HStack,{wrap:"wrap",pl:2,pr:2,width:"100%",justify:"space-between",children:[e,s.jsxs(a.HStack,{gapX:1,children:[t.filter(p=>p.visible!==!1).map(p=>s.jsx(a.HStack,{flex:p.size??1,minW:`${(p.size??1)*100}px`,alignItems:"center",children:Ar(p)},p.id)),s.jsx(jl,{filterDrawerSize:g,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:i,maxToolbarUnits:c,pageKey:l,filters:t,onLoadPreset:u,activePresetName:d,open:f,onOpenChange:p=>{x(p.open)}})]})]})},Ml=(e,t)=>{localStorage.setItem(`FILTER_ORDER_${e}`,JSON.stringify(t))},Tl=e=>{try{return JSON.parse(localStorage.getItem(`FILTER_ORDER_${e}`)||"[]")}catch{return[]}},El=({onClick:e,size:t="xs",variant:n="solid",label:r,leftIcon:o,rightIcon:i,isDisabled:c,colorScheme:l,loading:u,loadingText:d,rounded:g,type:f="button",textColor:x="white"})=>s.jsx(a.Button,{onClick:e,size:t,variant:n,disabled:c,loading:u,loadingText:d,rounded:g,type:f,background:l,color:x,children:s.jsxs(a.HStack,{gap:1,children:[o,r,i]})}),_l=b(a.Dialog.Root),Ol=b(a.Dialog.Backdrop),kl=b(a.Dialog.Positioner),Il=b(a.Dialog.Content),$l=b(a.Dialog.Header),Al=b(a.Dialog.Body),Ll=b(a.Dialog.Footer),Pl=b(a.Dialog.Title),Nl=b(a.Dialog.CloseTrigger);function zl({open:e,onClose:t,onConfirm:n,title:r="Confirm Action",description:o="Are you sure you want to continue?",confirmLabel:i="Confirm",cancelLabel:c="Cancel",icon:l,isLoading:u=!1,confirmButtonColorScheme:d="#4169e1"}){return s.jsx(_l,{open:e,placement:"center",onOpenChange:g=>!g.open&&t(),children:s.jsxs(a.Portal,{children:[s.jsx(Ol,{}),s.jsx(kl,{children:s.jsxs(Il,{maxW:"480px",children:[s.jsx($l,{borderBottom:"1px solid",borderColor:"gray.200",children:s.jsx(Pl,{children:r})}),s.jsx(Al,{p:6,children:s.jsxs(a.Stack,{gap:4,align:"center",textAlign:"center",children:[s.jsx(a.Box,{color:"orange.500",children:l??s.jsx(Rr,{size:40})}),s.jsx(a.Text,{fontSize:"sm",color:"gray.600",children:o})]})}),s.jsxs(Ll,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"gray.200",children:[s.jsx(a.Button,{variant:"outline",size:"sm",onClick:t,children:c}),s.jsx(a.Button,{size:"sm",style:{backgroundColor:d},loading:u,onClick:n,children:i})]}),s.jsx(Nl,{asChild:!0,children:s.jsx(a.CloseButton,{size:"sm"})})]})})]})})}const Fl=b(a.Dialog.Root),Yl=b(a.Dialog.Backdrop),Bl=b(a.Dialog.Positioner),Wl=b(a.Dialog.Content),Vl=b(a.Dialog.Header),Hl=b(a.Dialog.Body),Ul=b(a.Dialog.Footer),Gl=b(a.Dialog.Title),ql=b(a.Dialog.CloseTrigger);function Xl({open:e,onClose:t,onConfirm:n,title:r="Delete Company",entityName:o,confirmText:i="DELETE",confirmLabel:c="Delete",isLoading:l=!1}){const[u,d]=h.useState(""),g=u===i;return s.jsx(Fl,{open:e,placement:"center",onOpenChange:f=>{!f.open&&t(),d("")},children:s.jsxs(a.Portal,{children:[s.jsx(Yl,{}),s.jsx(Bl,{children:s.jsxs(Wl,{maxW:"550px",children:[s.jsx(Vl,{borderBottom:"1px solid",borderColor:"#d3d3d3",children:s.jsx(Gl,{color:"red.600",children:r})}),s.jsx(Hl,{p:2,style:{padding:"16px"},children:s.jsxs(a.Stack,{gap:4,borderRadius:"md",p:4,bg:"white",children:[s.jsx(a.Box,{border:"1px solid",borderColor:"red.200",bg:"red.50",borderRadius:"md",p:4,children:s.jsxs(a.Stack,{direction:"row",gap:3,align:"flex-start",children:[s.jsx(a.Box,{color:"red.600",mt:"2px",children:s.jsx(Rr,{size:20})}),s.jsxs(a.Box,{children:[s.jsx(a.Text,{fontWeight:"semibold",color:"red.700",children:"Are you sure?"}),s.jsxs(a.Text,{fontSize:"sm",color:"red.600",children:["All the data of ",s.jsx("b",{children:o})," will permanently be deleted."]})]})]})}),s.jsx(a.Text,{fontSize:"sm",color:"gray.600",children:"You can’t undo this action afterwards."}),s.jsxs(a.Box,{children:[s.jsxs(a.Text,{fontSize:"sm",mb:2,children:["Type ",s.jsx("b",{children:i})," to continue"]}),s.jsx(a.Input,{placeholder:`Type ${i} here`,value:u,onChange:f=>d(f.target.value),size:"xs"})]})]})}),s.jsxs(Ul,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"#d3d3d3",children:[s.jsx(a.Button,{variant:"outline",size:"sm",onClick:()=>{t(),d("")},children:"Cancel"}),s.jsx(a.Button,{size:"sm",disabled:!g,style:{backgroundColor:"#FF0000"},loading:l,onClick:n,children:c})]}),s.jsx(ql,{asChild:!0,children:s.jsx(a.CloseButton,{size:"sm"})})]})})]})})}const Lr=({children:e})=>s.jsx(s.Fragment,{children:e}),Pr=({children:e})=>s.jsx(s.Fragment,{children:e}),Kl=a.Button,Jl=b(a.Dialog.Root),Zl=b(a.Dialog.Backdrop),Ql=b(a.Dialog.Positioner),ec=b(a.Dialog.Content),tc=b(a.Dialog.Header),nc=b(a.Dialog.Body),rc=b(a.Dialog.Footer),oc=b(a.Dialog.Title),sc=b(a.Dialog.CloseTrigger);function ic(e){let t=null,n=null;return h.Children.forEach(e,r=>{h.isValidElement(r)&&(r.type===Lr&&(t=r.props.children),r.type===Pr&&(n=r.props.children))}),{body:t,actions:n}}const ac=({open:e,onClose:t,title:n,children:r,width:o,position:i,refetch:c,loading:l=!1})=>{const{body:u,actions:d}=ic(r);return s.jsx(Jl,{open:e,onOpenChange:g=>!g.open&&t(),placement:i??"center",children:s.jsxs(a.Portal,{children:[s.jsx(Zl,{bg:"blackAlpha.400"}),s.jsx(Ql,{children:s.jsxs(ec,{w:o??"560px",maxW:o??"560px",borderRadius:"6px",overflow:"hidden",boxShadow:"lg",children:[s.jsx(tc,{px:"20px",py:"16px",bg:"white",borderBottom:"1px solid",borderColor:"gray.200",children:s.jsxs(a.Flex,{align:"center",justify:"space-between",children:[s.jsx(oc,{fontSize:"16px",fontWeight:"600",children:n}),s.jsx(sc,{asChild:!0,children:s.jsx(a.CloseButton,{size:"sm"})}),c&&s.jsx(sn,{label:"Refresh",refetch:c,isLoading:l})]})}),u&&s.jsx(nc,{px:"20px",py:"16px",bg:"#F8FAFC",type:"submit",children:s.jsx(a.Flex,{direction:"column",gap:"16px",children:u})}),d&&s.jsx(rc,{px:"20px",py:"16px",bg:"white",borderTop:"1px solid",borderColor:"gray.200",children:s.jsx(a.Flex,{ml:"auto",gap:"12px",children:d})})]})})]})})},lc=b(a.Field.Root),cc=b(a.Field.Label),uc=b(a.Field.HelperText),dc=b(a.Field.ErrorText),fc=b(a.PinInput.Input),hc=b(a.PinInput.Control),gc=b(a.PinInput.HiddenInput),pc=b(a.PinInput.Root),vc=({value:e,onChange:t,length:n=4,size:r="xs",isDisabled:o=!1,label:i,helperText:c,errorText:l,required:u=!1,visible:d=!0})=>{const g=Array.from({length:n}).map((f,x)=>e?.[x]??"");return s.jsxs(lc,{children:[d&&i&&s.jsxs(cc,{children:[i,u&&" *"]}),s.jsxs(pc,{value:g,onValueChange:f=>t?.(f.value.join("")),disabled:o,size:r,children:[s.jsx(gc,{}),s.jsx(hc,{children:s.jsx(a.HStack,{children:Array.from({length:n}).map((f,x)=>s.jsx(fc,{index:x},x))})})]}),l&&s.jsx(dc,{fontSize:"xs",children:l}),c&&!l&&s.jsx(uc,{fontSize:"xs",children:c})]})};function sn({refetch:e,isLoading:t=!1,label:n="Refresh"}){const[r,o]=h.useState(!1),i=async()=>{o(!0);try{await e()}finally{setTimeout(()=>o(!1),300)}};return s.jsx(a.IconButton,{"aria-label":n,size:"xs",variant:"outline",disabled:t||r,onClick:i,ml:2,children:s.jsx(Oi,{size:14,style:{animation:r?"spin 0.6s linear infinite":void 0}})})}var ut={exports:{}},mc=ut.exports,Yn;function xc(){return Yn||(Yn=1,(function(e,t){(function(n,r){e.exports=r()})(mc,(function(){var n=1e3,r=6e4,o=36e5,i="millisecond",c="second",l="minute",u="hour",d="day",g="week",f="month",x="quarter",p="year",m="date",y="Invalid Date",S=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,R=/\[([^\]]+)]|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,T={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(D){var C=["th","st","nd","rd"],w=D%100;return"["+D+(C[(w-20)%10]||C[w]||C[0])+"]"}},E=function(D,C,w){var j=String(D);return!j||j.length>=C?D:""+Array(C+1-j.length).join(w)+D},A={s:E,z:function(D){var C=-D.utcOffset(),w=Math.abs(C),j=Math.floor(w/60),M=w%60;return(C<=0?"+":"-")+E(j,2,"0")+":"+E(M,2,"0")},m:function D(C,w){if(C.date()<w.date())return-D(w,C);var j=12*(w.year()-C.year())+(w.month()-C.month()),M=C.clone().add(j,f),L=w-M<0,Y=C.clone().add(j+(L?-1:1),f);return+(-(j+(w-M)/(L?M-Y:Y-M))||0)},a:function(D){return D<0?Math.ceil(D)||0:Math.floor(D)},p:function(D){return{M:f,y:p,w:g,d,D:m,h:u,m:l,s:c,ms:i,Q:x}[D]||String(D||"").toLowerCase().replace(/s$/,"")},u:function(D){return D===void 0}},$="en",O={};O[$]=T;var I="$isDayjsObject",P=function(D){return D instanceof F||!(!D||!D[I])},H=function D(C,w,j){var M;if(!C)return $;if(typeof C=="string"){var L=C.toLowerCase();O[L]&&(M=L),w&&(O[L]=w,M=L);var Y=C.split("-");if(!M&&Y.length>1)return D(Y[0])}else{var v=C.name;O[v]=C,M=v}return!j&&M&&($=M),M||!j&&$},B=function(D,C){if(P(D))return D.clone();var w=typeof C=="object"?C:{};return w.date=D,w.args=arguments,new F(w)},k=A;k.l=H,k.i=P,k.w=function(D,C){return B(D,{locale:C.$L,utc:C.$u,x:C.$x,$offset:C.$offset})};var F=(function(){function D(w){this.$L=H(w.locale,null,!0),this.parse(w),this.$x=this.$x||w.x||{},this[I]=!0}var C=D.prototype;return C.parse=function(w){this.$d=(function(j){var M=j.date,L=j.utc;if(M===null)return new Date(NaN);if(k.u(M))return new Date;if(M instanceof Date)return new Date(M);if(typeof M=="string"&&!/Z$/i.test(M)){var Y=M.match(S);if(Y){var v=Y[2]-1||0,_=(Y[7]||"0").substring(0,3);return L?new Date(Date.UTC(Y[1],v,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,_)):new Date(Y[1],v,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,_)}}return new Date(M)})(w),this.init()},C.init=function(){var w=this.$d;this.$y=w.getFullYear(),this.$M=w.getMonth(),this.$D=w.getDate(),this.$W=w.getDay(),this.$H=w.getHours(),this.$m=w.getMinutes(),this.$s=w.getSeconds(),this.$ms=w.getMilliseconds()},C.$utils=function(){return k},C.isValid=function(){return this.$d.toString()!==y},C.isSame=function(w,j){var M=B(w);return this.startOf(j)<=M&&M<=this.endOf(j)},C.isAfter=function(w,j){return B(w)<this.startOf(j)},C.isBefore=function(w,j){return this.endOf(j)<B(w)},C.$g=function(w,j,M){return k.u(w)?this[j]:this.set(M,w)},C.unix=function(){return Math.floor(this.valueOf()/1e3)},C.valueOf=function(){return this.$d.getTime()},C.startOf=function(w,j){var M=this,L=!!k.u(j)||j,Y=k.p(w),v=function(J,V){var se=k.w(M.$u?Date.UTC(M.$y,V,J):new Date(M.$y,V,J),M);return L?se:se.endOf(d)},_=function(J,V){return k.w(M.toDate()[J].apply(M.toDate("s"),(L?[0,0,0,0]:[23,59,59,999]).slice(V)),M)},z=this.$W,W=this.$M,q=this.$D,X="set"+(this.$u?"UTC":"");switch(Y){case p:return L?v(1,0):v(31,11);case f:return L?v(1,W):v(0,W+1);case g:var U=this.$locale().weekStart||0,K=(z<U?z+7:z)-U;return v(L?q-K:q+(6-K),W);case d:case m:return _(X+"Hours",0);case u:return _(X+"Minutes",1);case l:return _(X+"Seconds",2);case c:return _(X+"Milliseconds",3);default:return this.clone()}},C.endOf=function(w){return this.startOf(w,!1)},C.$set=function(w,j){var M,L=k.p(w),Y="set"+(this.$u?"UTC":""),v=(M={},M[d]=Y+"Date",M[m]=Y+"Date",M[f]=Y+"Month",M[p]=Y+"FullYear",M[u]=Y+"Hours",M[l]=Y+"Minutes",M[c]=Y+"Seconds",M[i]=Y+"Milliseconds",M)[L],_=L===d?this.$D+(j-this.$W):j;if(L===f||L===p){var z=this.clone().set(m,1);z.$d[v](_),z.init(),this.$d=z.set(m,Math.min(this.$D,z.daysInMonth())).$d}else v&&this.$d[v](_);return this.init(),this},C.set=function(w,j){return this.clone().$set(w,j)},C.get=function(w){return this[k.p(w)]()},C.add=function(w,j){var M,L=this;w=Number(w);var Y=k.p(j),v=function(W){var q=B(L);return k.w(q.date(q.date()+Math.round(W*w)),L)};if(Y===f)return this.set(f,this.$M+w);if(Y===p)return this.set(p,this.$y+w);if(Y===d)return v(1);if(Y===g)return v(7);var _=(M={},M[l]=r,M[u]=o,M[c]=n,M)[Y]||1,z=this.$d.getTime()+w*_;return k.w(z,this)},C.subtract=function(w,j){return this.add(-1*w,j)},C.format=function(w){var j=this,M=this.$locale();if(!this.isValid())return M.invalidDate||y;var L=w||"YYYY-MM-DDTHH:mm:ssZ",Y=k.z(this),v=this.$H,_=this.$m,z=this.$M,W=M.weekdays,q=M.months,X=M.meridiem,U=function(V,se,re,fe){return V&&(V[se]||V(j,L))||re[se].slice(0,fe)},K=function(V){return k.s(v%12||12,V,"0")},J=X||function(V,se,re){var fe=V<12?"AM":"PM";return re?fe.toLowerCase():fe};return L.replace(R,(function(V,se){return se||(function(re){switch(re){case"YY":return String(j.$y).slice(-2);case"YYYY":return k.s(j.$y,4,"0");case"M":return z+1;case"MM":return k.s(z+1,2,"0");case"MMM":return U(M.monthsShort,z,q,3);case"MMMM":return U(q,z);case"D":return j.$D;case"DD":return k.s(j.$D,2,"0");case"d":return String(j.$W);case"dd":return U(M.weekdaysMin,j.$W,W,2);case"ddd":return U(M.weekdaysShort,j.$W,W,3);case"dddd":return W[j.$W];case"H":return String(v);case"HH":return k.s(v,2,"0");case"h":return K(1);case"hh":return K(2);case"a":return J(v,_,!0);case"A":return J(v,_,!1);case"m":return String(_);case"mm":return k.s(_,2,"0");case"s":return String(j.$s);case"ss":return k.s(j.$s,2,"0");case"SSS":return k.s(j.$ms,3,"0");case"Z":return Y}return null})(V)||Y.replace(":","")}))},C.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},C.diff=function(w,j,M){var L,Y=this,v=k.p(j),_=B(w),z=(_.utcOffset()-this.utcOffset())*r,W=this-_,q=function(){return k.m(Y,_)};switch(v){case p:L=q()/12;break;case f:L=q();break;case x:L=q()/3;break;case g:L=(W-z)/6048e5;break;case d:L=(W-z)/864e5;break;case u:L=W/o;break;case l:L=W/r;break;case c:L=W/n;break;default:L=W}return M?L:k.a(L)},C.daysInMonth=function(){return this.endOf(f).$D},C.$locale=function(){return O[this.$L]},C.locale=function(w,j){if(!w)return this.$L;var M=this.clone(),L=H(w,j,!0);return L&&(M.$L=L),M},C.clone=function(){return k.w(this.$d,this)},C.toDate=function(){return new Date(this.valueOf())},C.toJSON=function(){return this.isValid()?this.toISOString():null},C.toISOString=function(){return this.$d.toISOString()},C.toString=function(){return this.$d.toUTCString()},D})(),N=F.prototype;return B.prototype=N,[["$ms",i],["$s",c],["$m",l],["$H",u],["$W",d],["$M",f],["$y",p],["$D",m]].forEach((function(D){N[D[1]]=function(C){return this.$g(C,D[0],D[1])}})),B.extend=function(D,C){return D.$i||(D(C,F,B),D.$i=!0),B},B.locale=H,B.isDayjs=P,B.unix=function(D){return B(1e3*D)},B.en=O[$],B.Ls=O,B.p={},B}))})(ut)),ut.exports}var bc=xc();const Rt=bt(bc);var dt={exports:{}},yc=dt.exports,Bn;function Sc(){return Bn||(Bn=1,(function(e,t){(function(n,r){e.exports=r()})(yc,(function(){return function(n,r,o){n=n||{};var i=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 l(d,g,f,x){return i.fromToBase(d,g,f,x)}o.en.relativeTime=c,i.fromToBase=function(d,g,f,x,p){for(var m,y,S,R=f.$locale().relativeTime||c,T=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"}],E=T.length,A=0;A<E;A+=1){var $=T[A];$.d&&(m=x?o(d).diff(f,$.d,!0):f.diff(d,$.d,!0));var O=(n.rounding||Math.round)(Math.abs(m));if(S=m>0,O<=$.r||!$.r){O<=1&&A>0&&($=T[A-1]);var I=R[$.l];p&&(O=p(""+O)),y=typeof I=="string"?I.replace("%d",O):I(O,g,$.l,S);break}}if(g)return y;var P=S?R.future:R.past;return typeof P=="function"?P(y):P.replace("%s",y)},i.to=function(d,g){return l(d,g,this,!0)},i.from=function(d,g){return l(d,g,this)};var u=function(d){return d.$u?o.utc():o()};i.toNow=function(d){return this.to(u(this),d)},i.fromNow=function(d){return this.from(u(this),d)}}}))})(dt)),dt.exports}var wc=Sc();const Cc=bt(wc);var ft={exports:{}},Dc=ft.exports,Wn;function jc(){return Wn||(Wn=1,(function(e,t){(function(n,r){e.exports=r()})(Dc,(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,i){var c=o.prototype,l=c.format;i.en.formats=n,c.format=function(u){u===void 0&&(u="YYYY-MM-DDTHH:mm:ssZ");var d=this.$locale().formats,g=(function(f,x){return f.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(p,m,y){var S=y&&y.toUpperCase();return m||x[y]||n[y]||x[S].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(R,T,E){return T||E.slice(1)}))}))})(u,d===void 0?{}:d);return l.call(this,g)}}}))})(ft)),ft.exports}var Rc=jc();const Mc=bt(Rc);var ht={exports:{}},Tc=ht.exports,Vn;function Ec(){return Vn||(Vn=1,(function(e,t){(function(n,r){e.exports=r()})(Tc,(function(){return function(n,r){var o=r.prototype,i=o.format;o.format=function(c){var l=this,u=this.$locale();if(!this.isValid())return i.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(f){switch(f){case"Q":return Math.ceil((l.$M+1)/3);case"Do":return u.ordinal(l.$D);case"gggg":return l.weekYear();case"GGGG":return l.isoWeekYear();case"wo":return u.ordinal(l.week(),"W");case"w":case"ww":return d.s(l.week(),f==="w"?1:2,"0");case"W":case"WW":return d.s(l.isoWeek(),f==="W"?1:2,"0");case"k":case"kk":return d.s(String(l.$H===0?24:l.$H),f==="k"?1:2,"0");case"X":return Math.floor(l.$d.getTime()/1e3);case"x":return l.$d.getTime();case"z":return"["+l.offsetName()+"]";case"zzz":return"["+l.offsetName("long")+"]";default:return f}}));return i.bind(this)(g)}}}))})(ht)),ht.exports}var _c=Ec();const Oc=bt(_c);Rt.extend(Cc);Rt.extend(Mc);Rt.extend(Oc);const kc={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 qt({value:e,variant:t="dateTime",format:n,fallback:r="--"}){if(!e)return r;const o=Rt(e);return o.isValid()?t==="relative"?o.fromNow():o.format(n??kc[t]):r}function Ic({value:e,dateVariant:t="date",timeVariant:n="time",dateFormat:r,timeFormat:o,align:i="start",dateColor:c="gray.700",dateFontSize:l="16px",dateFontWeight:u="500",timeColor:d="gray.500",timeFontSize:g="12px",timeFontWeight:f="400"}){return s.jsxs(a.Stack,{gap:.5,align:i,children:[s.jsx(a.Text,{fontSize:l,fontWeight:u,color:c,children:qt({value:e,variant:t,format:r})}),s.jsx(a.Text,{fontSize:g,fontWeight:f,color:d,children:qt({value:e,variant:n,format:o})})]})}class Nr{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 Xt{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 Kt{constructor(t){this.api=t}store=new Nr;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 i=this.store.get(o);i?n[o]=i.value:r.push(o)}return r.length&&(await this.fetchMissing(r),r.forEach(o=>{const i=this.store.get(o);i&&(n[o]=i.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(i=>this.inflight.delete(i))});n.forEach(o=>this.inflight.set(o,r)),await r}}const zr=h.createContext(null);function Fr(){const e=h.useContext(zr);if(!e)throw new Error("OptionsProvider is missing. Wrap your app with <OptionsProvider />");return e}function $c({client:{apiUrl:e},children:t}){const n=h.useRef(new Kt(new Xt(e)));return n.current||(n.current=new Kt(new Xt(e))),s.jsx(zr.Provider,{value:n.current,children:t})}function Ac(e){const t=Fr(),[n,r]=h.useState(t.getRaw(e)?.value);return h.useEffect(()=>{let o=!0;t.getKey(e).then(c=>{o&&r(c)});const i=t.subscribe(e,c=>{r(c?.value)});return()=>{o=!1,i()}},[e,t]),n}function Lc(e){const t=Fr(),[n,r]=h.useState({});return h.useEffect(()=>{let o=!0;t.getMultiKey(e).then(c=>{o&&r(c)});const i=e.map(c=>t.subscribe(c,l=>{r(u=>({...u,[c]:l?.value}))}));return()=>{o=!1,i.forEach(c=>c())}},[e.join("|"),t]),n}async function Pc(e,t){return e.getKey(t)}async function Nc(e,t){await e.getMultiKey(t)}function zc(e={}){const{initialPage:t=1,initialLimit:n=20}=e,[r,o]=h.useState(t),[i,c]=h.useState(n),l=h.useCallback(x=>{o(Math.max(1,x))},[]),u=h.useCallback(x=>{c(Math.max(1,x)),o(1)},[]),d=h.useCallback(()=>{o(x=>x+1)},[]),g=h.useCallback(()=>{o(x=>Math.max(1,x-1))},[]),f=h.useCallback(()=>{o(t),c(n)},[t,n]);return{page:r,limit:i,setPage:l,setLimit:u,nextPage:d,prevPage:g,reset:f}}function Fc(e={}){const{initialValue:t="",delay:n=300}=e,[r,o]=h.useState(t),i=Yc(r,n),c=h.useCallback(u=>{o(u)},[]),l=h.useCallback(()=>{o(t)},[t]);return{search:r,debouncedSearch:i,onSearchChange:c,reset:l}}function Yc(e,t=300){const[n,r]=h.useState(e);return h.useEffect(()=>{const o=setTimeout(()=>{r(e)},t);return()=>clearTimeout(o)},[e,t]),n}exports.DataTable=fa;exports.Filters=Rl;exports.HttpOptionsApi=Xt;exports.MDSButton=El;exports.MDSCheckbox=Mr;exports.MDSCombobox=Tr;exports.MDSConfirmActionDialog=zl;exports.MDSConfirmDeleteDialog=Xl;exports.MDSDatePicker=_r;exports.MDSDateRangePicker=Er;exports.MDSDialogAction=Kl;exports.MDSDialogActions=Pr;exports.MDSDialogBody=Lr;exports.MDSDialogWrapper=ac;exports.MDSInput=Gt;exports.MDSPinInput=vc;exports.MDSRefreshButton=sn;exports.MDSSelectBox=Or;exports.OptionsClientImpl=Kt;exports.OptionsProvider=$c;exports.OptionsStore=Nr;exports.RefreshButton=sn;exports.StackedDateTime=Ic;exports.addPreset=Ir;exports.deletePreset=$r;exports.formatDateTime=qt;exports.getColumnWidthKey=Dt;exports.getOption=Pc;exports.getPresets=Qe;exports.loadOrder=Tl;exports.prefetchOptions=Nc;exports.presetStore=Xe;exports.saveOrder=Ml;exports.savePresets=jt;exports.setActionsConfig=yr;exports.setColumnWidth=Ks;exports.setData=xr;exports.setTableId=br;exports.tableStore=te;exports.updatePreset=rl;exports.useDebouncedSearch=Fc;exports.useOption=Ac;exports.useOptions=Lc;exports.usePagination=zc;exports.withChildren=b;
|
package/dist/index.d.ts
CHANGED
|
@@ -182,6 +182,7 @@ export declare interface IMDSButtonTypes {
|
|
|
182
182
|
loadingText?: string;
|
|
183
183
|
rounded?: 'sm' | 'md' | 'lg' | 'xl' | 'full' | 'xs';
|
|
184
184
|
type?: 'submit' | 'reset' | 'button';
|
|
185
|
+
textColor?: string;
|
|
185
186
|
}
|
|
186
187
|
|
|
187
188
|
export declare interface IMDSCheckboxTypes {
|
|
@@ -294,7 +295,7 @@ declare type Listener = (value: OptionValue | undefined) => void;
|
|
|
294
295
|
|
|
295
296
|
export declare const loadOrder: (pageKey: string) => string[];
|
|
296
297
|
|
|
297
|
-
export declare const MDSButton: ({ onClick, size, variant, label, leftIcon, rightIcon, isDisabled, colorScheme, loading, loadingText, rounded, type, }: IMDSButtonTypes) => JSX_2.Element;
|
|
298
|
+
export declare const MDSButton: ({ onClick, size, variant, label, leftIcon, rightIcon, isDisabled, colorScheme, loading, loadingText, rounded, type, textColor, }: IMDSButtonTypes) => JSX_2.Element;
|
|
298
299
|
|
|
299
300
|
export declare const MDSCheckbox: ({ value, onChange, size, label, helperText, isDisabled, required, errorText, }: IMDSCheckboxTypes) => JSX_2.Element;
|
|
300
301
|
|
package/dist/index.js
CHANGED
|
@@ -5102,7 +5102,8 @@ const bl = x(Re.Root), yl = x(Re.Label), wl = x(Re.HelperText), Sl = x(Re.ErrorT
|
|
|
5102
5102
|
loading: c,
|
|
5103
5103
|
loadingText: u,
|
|
5104
5104
|
rounded: f,
|
|
5105
|
-
type: d = "button"
|
|
5105
|
+
type: d = "button",
|
|
5106
|
+
textColor: v = "white"
|
|
5106
5107
|
}) => /* @__PURE__ */ s.jsx(
|
|
5107
5108
|
Te,
|
|
5108
5109
|
{
|
|
@@ -5110,11 +5111,12 @@ const bl = x(Re.Root), yl = x(Re.Label), wl = x(Re.HelperText), Sl = x(Re.ErrorT
|
|
|
5110
5111
|
size: t,
|
|
5111
5112
|
variant: n,
|
|
5112
5113
|
disabled: l,
|
|
5113
|
-
colorPalette: a,
|
|
5114
5114
|
loading: c,
|
|
5115
5115
|
loadingText: u,
|
|
5116
5116
|
rounded: f,
|
|
5117
5117
|
type: d,
|
|
5118
|
+
background: a,
|
|
5119
|
+
color: v,
|
|
5118
5120
|
children: /* @__PURE__ */ s.jsxs(he, { gap: 1, children: [
|
|
5119
5121
|
o,
|
|
5120
5122
|
r,
|