@mdspl/mds-shared-ui 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs 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
- `},vo={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 mo(e){let{announcements:t=vo,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=po}=e;const{announce:s,announcement:a}=fo(),c=nt("DndLiveRegion"),[l,d]=g.useState(!1);if(g.useEffect(()=>{d(!0)},[]),ho(g.useMemo(()=>({onDragStart(h){let{active:y}=h;s(t.onDragStart({active:y}))},onDragMove(h){let{active:y,over:v}=h;t.onDragMove&&s(t.onDragMove({active:y,over:v}))},onDragOver(h){let{active:y,over:v}=h;s(t.onDragOver({active:y,over:v}))},onDragEnd(h){let{active:y,over:v}=h;s(t.onDragEnd({active:y,over:v}))},onDragCancel(h){let{active:y,over:v}=h;s(t.onDragCancel({active:y,over:v}))}}),[s,t])),!l)return null;const f=g.createElement(g.Fragment,null,g.createElement(lo,{id:r,value:o.draggable}),g.createElement(uo,{id:c,announcement:a}));return n?Ue.createPortal(f,n):f}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 St(){}function bo(e,t){return g.useMemo(()=>({sensor:e,options:{}}),[e,t])}function xo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const pe=Object.freeze({x:0,y:0});function yo(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function So(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function wo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Do(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function jn(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=jn(t,t.left,t.top),s=[];for(const a of r){const{id:c}=a,l=n.get(c);if(l){const d=yo(jn(l),o);s.push({id:c,data:{droppableContainer:a,value:d}})}}return s.sort(So)};function Co(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),a=o-r,c=s-n;if(r<o&&n<s){const l=t.width*t.height,d=e.width*e.height,f=a*c,h=f/(l+d-f);return Number(h.toFixed(4))}return 0}const Ro=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const s of r){const{id:a}=s,c=n.get(a);if(c){const l=Co(c,t);l>0&&o.push({id:a,data:{droppableContainer:s,value:l}})}}return o.sort(wo)};function To(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function er(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:pe}function Eo(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];return o.reduce((a,c)=>({...a,top:a.top+e*c.y,bottom:a.bottom+e*c.y,left:a.left+e*c.x,right:a.right+e*c.x}),{...n})}}const jo=Eo(1);function Mo(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 _o(e,t,n){const r=Mo(t);if(!r)return e;const{scaleX:o,scaleY:s,x:a,y:c}=r,l=e.left-a-(1-o)*parseFloat(n),d=e.top-c-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),f=o?e.width/o:e.width,h=s?e.height/s:e.height;return{width:f,height:h,top:d,right:l+f,bottom:d+h,left:l}}const Oo={ignoreTransform:!1};function Ne(e,t){t===void 0&&(t=Oo);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:f}=ae(e).getComputedStyle(e);d&&(n=_o(n,d,f))}const{top:r,left:o,width:s,height:a,bottom:c,right:l}=n;return{top:r,left:o,width:s,height:a,bottom:c,right:l}}function Mn(e){return Ne(e,{ignoreTransform:!0})}function ko(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function $o(e,t){return t===void 0&&(t=ae(e).getComputedStyle(e)),t.position==="fixed"}function Io(e,t){t===void 0&&(t=ae(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const s=t[o];return typeof s=="string"?n.test(s):!1})}function nn(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(Qt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!et(o)||Kn(o)||n.includes(o))return n;const s=ae(e).getComputedStyle(o);return o!==e&&Io(o,s)&&n.push(o),$o(o,s)?n:r(o.parentNode)}return e?r(e):n}function tr(e){const[t]=nn(e,1);return t??null}function Pt(e){return!Ct||!e?null:Ae(e)?e:Zt(e)?Qt(e)||e===Le(e).scrollingElement?window:et(e)?e:null:null}function nr(e){return Ae(e)?e.scrollX:e.scrollLeft}function rr(e){return Ae(e)?e.scrollY:e.scrollTop}function Gt(e){return{x:nr(e),y:rr(e)}}var Q;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Q||(Q={}));function or(e){return!Ct||!e?!1:e===document.scrollingElement}function sr(e){const t={x:0,y:0},n=or(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,c=e.scrollLeft>=r.x;return{isTop:o,isLeft:s,isBottom:a,isRight:c,maxScroll:r,minScroll:t}}const Ao={x:.2,y:.2};function Lo(e,t,n,r,o){let{top:s,left:a,right:c,bottom:l}=n;r===void 0&&(r=10),o===void 0&&(o=Ao);const{isTop:d,isBottom:f,isLeft:h,isRight:y}=sr(e),v={x:0,y:0},m={x:0,y:0},b={height:t.height*o.y,width:t.width*o.x};return!d&&s<=t.top+b.height?(v.y=Q.Backward,m.y=r*Math.abs((t.top+b.height-s)/b.height)):!f&&l>=t.bottom-b.height&&(v.y=Q.Forward,m.y=r*Math.abs((t.bottom-b.height-l)/b.height)),!y&&c>=t.right-b.width?(v.x=Q.Forward,m.x=r*Math.abs((t.right-b.width-c)/b.width)):!h&&a<=t.left+b.width&&(v.x=Q.Backward,m.x=r*Math.abs((t.left+b.width-a)/b.width)),{direction:v,speed:m}}function No(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:a}=window;return{top:0,left:0,right:s,bottom:a,width:s,height:a}}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 ir(e){return e.reduce((t,n)=>$e(t,Gt(n)),pe)}function zo(e){return e.reduce((t,n)=>t+nr(n),0)}function Po(e){return e.reduce((t,n)=>t+rr(n),0)}function Yo(e,t){if(t===void 0&&(t=Ne),!e)return;const{top:n,left:r,bottom:o,right:s}=t(e);tr(e)&&(o<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Fo=[["x",["left","right"],zo],["y",["top","bottom"],Po]];class rn{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=nn(n),o=ir(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,a,c]of Fo)for(const l of a)Object.defineProperty(this,l,{get:()=>{const d=c(r),f=o[s]-d;return this.rect[l]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ge{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Bo(e){const{EventTarget:t}=ae(e);return e instanceof t?e:Le(e)}function Yt(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var fe;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(fe||(fe={}));function _n(e){e.preventDefault()}function Ho(e){e.stopPropagation()}var W;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(W||(W={}));const ar={start:[W.Space,W.Enter],cancel:[W.Esc],end:[W.Space,W.Enter,W.Tab]},Vo=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case W.Right:return{...n,x:n.x+25};case W.Left:return{...n,x:n.x-25};case W.Down:return{...n,y:n.y+25};case W.Up:return{...n,y:n.y-25}}};class cr{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Ge(Le(n)),this.windowListeners=new Ge(ae(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(fe.Resize,this.handleCancel),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(fe.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Yo(r),n(pe)}handleKeyDown(t){if(tn(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=ar,coordinateGetter:a=Vo,scrollBehavior:c="smooth"}=o,{code:l}=t;if(s.end.includes(l)){this.handleEnd(t);return}if(s.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:d}=r.current,f=d?{x:d.left,y:d.top}:pe;this.referenceCoordinates||(this.referenceCoordinates=f);const h=a(t,{active:n,context:r.current,currentCoordinates:f});if(h){const y=yt(h,f),v={x:0,y:0},{scrollableAncestors:m}=r.current;for(const b of m){const x=t.code,{isTop:S,isRight:_,isLeft:j,isBottom:O,maxScroll:k,minScroll:E}=sr(b),$=No(b),A={x:Math.min(x===W.Right?$.right-$.width/2:$.right,Math.max(x===W.Right?$.left:$.left+$.width/2,h.x)),y:Math.min(x===W.Down?$.bottom-$.height/2:$.bottom,Math.max(x===W.Down?$.top:$.top+$.height/2,h.y))},H=x===W.Right&&!_||x===W.Left&&!j,B=x===W.Down&&!O||x===W.Up&&!S;if(H&&A.x!==h.x){const L=b.scrollLeft+y.x,K=x===W.Right&&L<=k.x||x===W.Left&&L>=E.x;if(K&&!y.y){b.scrollTo({left:L,behavior:c});return}K?v.x=b.scrollLeft-L:v.x=x===W.Right?b.scrollLeft-k.x:b.scrollLeft-E.x,v.x&&b.scrollBy({left:-v.x,behavior:c});break}else if(B&&A.y!==h.y){const L=b.scrollTop+y.y,K=x===W.Down&&L<=k.y||x===W.Up&&L>=E.y;if(K&&!y.x){b.scrollTo({top:L,behavior:c});return}K?v.y=b.scrollTop-L:v.y=x===W.Down?b.scrollTop-k.y:b.scrollTop-E.y,v.y&&b.scrollBy({top:-v.y,behavior:c});break}}this.handleMove(t,$e(yt(h,this.referenceCoordinates),v))}}}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()}}cr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=ar,onActivation:o}=t,{active:s}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const c=s.activatorNode.current;return c&&e.target!==c?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function On(e){return!!(e&&"distance"in e)}function kn(e){return!!(e&&"delay"in e)}class on{constructor(t,n,r){var o;r===void 0&&(r=Bo(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:s}=t,{target:a}=s;this.props=t,this.events=n,this.document=Le(a),this.documentListeners=new Ge(this.document),this.listeners=new Ge(r),this.windowListeners=new Ge(ae(a)),this.initialCoordinates=(o=Ut(s))!=null?o:pe,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(fe.Resize,this.handleCancel),this.windowListeners.add(fe.DragStart,_n),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),this.windowListeners.add(fe.ContextMenu,_n),this.documentListeners.add(fe.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(kn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(On(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(fe.Click,Ho,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(fe.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:s}=this,{onMove:a,options:{activationConstraint:c}}=s;if(!o)return;const l=(n=Ut(t))!=null?n:pe,d=yt(o,l);if(!r&&c){if(On(c)){if(c.tolerance!=null&&Yt(d,c.tolerance))return this.handleCancel();if(Yt(d,c.distance))return this.handleStart()}if(kn(c)&&Yt(d,c.tolerance))return this.handleCancel();this.handlePending(c,d);return}t.cancelable&&t.preventDefault(),a(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===W.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Wo={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class sn extends on{constructor(t){const{event:n}=t,r=Le(n.target);super(t,Wo,r)}}sn.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 Uo={move:{name:"mousemove"},end:{name:"mouseup"}};var Xt;(function(e){e[e.RightClick=2]="RightClick"})(Xt||(Xt={}));class Go extends on{constructor(t){super(t,Uo,Le(t.event.target))}}Go.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Xt.RightClick?!1:(r?.({event:n}),!0)}}];const Ft={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Xo extends on{constructor(t){super(t,Ft)}static setup(){return window.addEventListener(Ft.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Ft.move.name,t)};function t(){}}}Xo.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 Xe;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Xe||(Xe={}));var wt;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(wt||(wt={}));function qo(e){let{acceleration:t,activator:n=Xe.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:a=5,order:c=wt.TreeOrder,pointerCoordinates:l,scrollableAncestors:d,scrollableAncestorRects:f,delta:h,threshold:y}=e;const v=Jo({delta:h,disabled:!s}),[m,b]=oo(),x=g.useRef({x:0,y:0}),S=g.useRef({x:0,y:0}),_=g.useMemo(()=>{switch(n){case Xe.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Xe.DraggableRect:return o}},[n,o,l]),j=g.useRef(null),O=g.useCallback(()=>{const E=j.current;if(!E)return;const $=x.current.x*S.current.x,A=x.current.y*S.current.y;E.scrollBy($,A)},[]),k=g.useMemo(()=>c===wt.TreeOrder?[...d].reverse():d,[c,d]);g.useEffect(()=>{if(!s||!d.length||!_){b();return}for(const E of k){if(r?.(E)===!1)continue;const $=d.indexOf(E),A=f[$];if(!A)continue;const{direction:H,speed:B}=Lo(E,A,_,t,y);for(const L of["x","y"])v[L][H[L]]||(B[L]=0,H[L]=0);if(B.x>0||B.y>0){b(),j.current=E,m(O,a),x.current=B,S.current=H;return}}x.current={x:0,y:0},S.current={x:0,y:0},b()},[t,O,r,b,s,a,JSON.stringify(_),JSON.stringify(v),m,d,k,f,JSON.stringify(y)])}const Ko={x:{[Q.Backward]:!1,[Q.Forward]:!1},y:{[Q.Backward]:!1,[Q.Forward]:!1}};function Jo(e){let{delta:t,disabled:n}=e;const r=Wt(t);return tt(o=>{if(n||!r||!o)return Ko;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Q.Backward]:o.x[Q.Backward]||s.x===-1,[Q.Forward]:o.x[Q.Forward]||s.x===1},y:{[Q.Backward]:o.y[Q.Backward]||s.y===-1,[Q.Forward]:o.y[Q.Forward]||s.y===1}}},[n,t,r])}function Zo(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return tt(o=>{var s;return t==null?null:(s=r??o)!=null?s:null},[r,t])}function Qo(e,t){return g.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,s=o.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...s]},[]),[e,t])}var Je;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Je||(Je={}));var qt;(function(e){e.Optimized="optimized"})(qt||(qt={}));const $n=new Map;function es(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,a]=g.useState(null),{frequency:c,measure:l,strategy:d}=o,f=g.useRef(e),h=x(),y=Ke(h),v=g.useCallback(function(S){S===void 0&&(S=[]),!y.current&&a(_=>_===null?S:_.concat(S.filter(j=>!_.includes(j))))},[y]),m=g.useRef(null),b=tt(S=>{if(h&&!n)return $n;if(!S||S===$n||f.current!==e||s!=null){const _=new Map;for(let j of e){if(!j)continue;if(s&&s.length>0&&!s.includes(j.id)&&j.rect.current){_.set(j.id,j.rect.current);continue}const O=j.node.current,k=O?new rn(l(O),O):null;j.rect.current=k,k&&_.set(j.id,k)}return _}return S},[e,s,n,h,l]);return g.useEffect(()=>{f.current=e},[e]),g.useEffect(()=>{h||v()},[n,h]),g.useEffect(()=>{s&&s.length>0&&a(null)},[JSON.stringify(s)]),g.useEffect(()=>{h||typeof c!="number"||m.current!==null||(m.current=setTimeout(()=>{v(),m.current=null},c))},[c,h,v,...r]),{droppableRects:b,measureDroppableContainers:v,measuringScheduled:s!=null};function x(){switch(d){case Je.Always:return!1;case Je.BeforeDragging:return n;default:return!n}}}function lr(e,t){return tt(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function ts(e,t){return lr(e,t)}function ns(e){let{callback:t,disabled:n}=e;const r=en(t),o=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return g.useEffect(()=>()=>o?.disconnect(),[o]),o}function Rt(e){let{callback:t,disabled:n}=e;const r=en(t),o=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return g.useEffect(()=>()=>o?.disconnect(),[o]),o}function rs(e){return new rn(Ne(e),e)}function In(e,t,n){t===void 0&&(t=rs);const[r,o]=g.useState(null);function s(){o(l=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=l??n)!=null?d:null}const f=t(e);return JSON.stringify(l)===JSON.stringify(f)?l:f})}const a=ns({callback(l){if(e)for(const d of l){const{type:f,target:h}=d;if(f==="childList"&&h instanceof HTMLElement&&h.contains(e)){s();break}}}}),c=Rt({callback:s});return be(()=>{s(),e?(c?.observe(e),a?.observe(document.body,{childList:!0,subtree:!0})):(c?.disconnect(),a?.disconnect())},[e]),r}function os(e){const t=lr(e);return er(e,t)}const An=[];function ss(e){const t=g.useRef(e),n=tt(r=>e?r&&r!==An&&e&&t.current&&e.parentNode===t.current.parentNode?r:nn(e):An,[e]);return g.useEffect(()=>{t.current=e},[e]),n}function is(e){const[t,n]=g.useState(null),r=g.useRef(e),o=g.useCallback(s=>{const a=Pt(s.target);a&&n(c=>c?(c.set(a,Gt(a)),new Map(c)):null)},[]);return g.useEffect(()=>{const s=r.current;if(e!==s){a(s);const c=e.map(l=>{const d=Pt(l);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,Gt(d)]):null}).filter(l=>l!=null);n(c.length?new Map(c):null),r.current=e}return()=>{a(e),a(s)};function a(c){c.forEach(l=>{const d=Pt(l);d?.removeEventListener("scroll",o)})}},[o,e]),g.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,a)=>$e(s,a),pe):ir(e):pe,[e,t])}function Ln(e,t){t===void 0&&(t=[]);const n=g.useRef(null);return g.useEffect(()=>{n.current=null},t),g.useEffect(()=>{const r=e!==pe;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?yt(e,n.current):pe}function as(e){g.useEffect(()=>{if(!Ct)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 cs(e,t){return g.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:s}=r;return n[o]=a=>{s(a,t)},n},{}),[e,t])}function ur(e){return g.useMemo(()=>e?ko(e):null,[e])}const Nn=[];function ls(e,t){t===void 0&&(t=Ne);const[n]=e,r=ur(n?ae(n):null),[o,s]=g.useState(Nn);function a(){s(()=>e.length?e.map(l=>or(l)?r:new rn(t(l),l)):Nn)}const c=Rt({callback:a});return be(()=>{c?.disconnect(),a(),e.forEach(l=>c?.observe(l))},[e]),o}function us(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return et(t)?t:e}function ds(e){let{measure:t}=e;const[n,r]=g.useState(null),o=g.useCallback(d=>{for(const{target:f}of d)if(et(f)){r(h=>{const y=t(f);return h?{...h,width:y.width,height:y.height}:y});break}},[t]),s=Rt({callback:o}),a=g.useCallback(d=>{const f=us(d);s?.disconnect(),f&&s?.observe(f),r(f?t(f):null)},[t,s]),[c,l]=xt(a);return g.useMemo(()=>({nodeRef:c,rect:n,setRef:l}),[n,c,l])}const fs=[{sensor:sn,options:{}},{sensor:cr,options:{}}],hs={current:{}},ht={draggable:{measure:Mn},droppable:{measure:Mn,strategy:Je.WhileDragging,frequency:qt.Optimized},dragOverlay:{measure:Ne}};class qe 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 gs={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new qe,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:St},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ht,measureDroppableContainers:St,windowRect:null,measuringScheduled:!1},ps={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:St,draggableNodes:new Map,over:null,measureDroppableContainers:St},Tt=g.createContext(ps),dr=g.createContext(gs);function vs(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new qe}}}function ms(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 qe(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,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const a=new qe(e.droppable.containers);return a.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case Z.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new qe(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function bs(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=g.useContext(Tt),s=Wt(r),a=Wt(n?.id);return g.useEffect(()=>{if(!t&&!r&&s&&a!=null){if(!tn(s)||document.activeElement===s.target)return;const c=o.get(a);if(!c)return;const{activatorNode:l,node:d}=c;if(!l.current&&!d.current)return;requestAnimationFrame(()=>{for(const f of[l.current,d.current]){if(!f)continue;const h=ao(f);if(h){h.focus();break}}})}},[r,t,o,a,s]),null}function xs(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,s)=>s({transform:o,...r}),n):n}function ys(e){return g.useMemo(()=>({draggable:{...ht.draggable,...e?.draggable},droppable:{...ht.droppable,...e?.droppable},dragOverlay:{...ht.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ss(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const s=g.useRef(!1),{x:a,y:c}=typeof o=="boolean"?{x:o,y:o}:o;be(()=>{if(!a&&!c||!t){s.current=!1;return}if(s.current||!r)return;const d=t?.node.current;if(!d||d.isConnected===!1)return;const f=n(d),h=er(f,r);if(a||(h.x=0),c||(h.y=0),s.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const y=tr(d);y&&y.scrollBy({top:h.y,left:h.x})}},[t,a,c,r,n])}const fr=g.createContext({...pe,scaleX:1,scaleY:1});var Te;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Te||(Te={}));const hr=g.memo(function(t){var n,r,o,s;let{id:a,accessibility:c,autoScroll:l=!0,children:d,sensors:f=fs,collisionDetection:h=Ro,measuring:y,modifiers:v,...m}=t;const b=g.useReducer(ms,void 0,vs),[x,S]=b,[_,j]=go(),[O,k]=g.useState(Te.Uninitialized),E=O===Te.Initialized,{draggable:{active:$,nodes:A,translate:H},droppable:{containers:B}}=x,L=$!=null?A.get($):null,K=g.useRef({initial:null,translated:null}),ee=g.useMemo(()=>{var re;return $!=null?{id:$,data:(re=L?.data)!=null?re:hs,rect:K}:null},[$,L]),I=g.useRef(null),[R,D]=g.useState(null),[M,T]=g.useState(null),N=Ke(m,Object.values(m)),P=nt("DndDescribedBy",a),p=g.useMemo(()=>B.getEnabled(),[B]),C=ys(y),{droppableRects:z,measureDroppableContainers:F,measuringScheduled:U}=es(p,{dragging:E,dependencies:[H.x,H.y],config:C.droppable}),G=Zo(A,$),V=g.useMemo(()=>M?Ut(M):null,[M]),X=Fr(),q=ts(G,C.draggable.measure);Ss({activeNode:$!=null?A.get($):null,config:X.layoutShiftCompensation,initialRect:q,measure:C.draggable.measure});const Y=In(G,C.draggable.measure,q),se=In(G?G.parentElement:null),ne=g.useRef({activatorEvent:null,active:null,activeNode:G,collisionRect:null,collisions:null,droppableRects:z,draggableNodes:A,draggingNode:null,draggingNodeRect:null,droppableContainers:B,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),he=B.getNodeFor((n=ne.current.over)==null?void 0:n.id),xe=ds({measure:C.dragOverlay.measure}),je=(r=xe.nodeRef.current)!=null?r:G,Me=E?(o=xe.rect)!=null?o:Y:null,cn=!!(xe.nodeRef.current&&xe.rect),ln=os(cn?null:Y),_t=ur(je?ae(je):null),Se=ss(E?he??G:null),ot=ls(Se),st=xs(v,{transform:{x:H.x-ln.x,y:H.y-ln.y,scaleX:1,scaleY:1},activatorEvent:M,active:ee,activeNodeRect:Y,containerNodeRect:se,draggingNodeRect:Me,over:ne.current.over,overlayNodeRect:xe.rect,scrollableAncestors:Se,scrollableAncestorRects:ot,windowRect:_t}),un=V?$e(V,H):null,dn=is(Se),Ir=Ln(dn),Ar=Ln(dn,[Y]),_e=$e(st,Ir),Oe=Me?jo(Me,st):null,ze=ee&&Oe?h({active:ee,collisionRect:Oe,droppableRects:z,droppableContainers:p,pointerCoordinates:un}):null,fn=Do(ze,"id"),[we,hn]=g.useState(null),Lr=cn?st:$e(st,Ar),Nr=To(Lr,(s=we?.rect)!=null?s:null,Y),Ot=g.useRef(null),gn=g.useCallback((re,ce)=>{let{sensor:le,options:De}=ce;if(I.current==null)return;const de=A.get(I.current);if(!de)return;const ue=re.nativeEvent,ve=new le({active:I.current,activeNode:de,event:ue,options:De,context:ne,onAbort(te){if(!A.get(te))return;const{onDragAbort:me}=N.current,ye={id:te};me?.(ye),_({type:"onDragAbort",event:ye})},onPending(te,Ce,me,ye){if(!A.get(te))return;const{onDragPending:Ye}=N.current,Re={id:te,constraint:Ce,initialCoordinates:me,offset:ye};Ye?.(Re),_({type:"onDragPending",event:Re})},onStart(te){const Ce=I.current;if(Ce==null)return;const me=A.get(Ce);if(!me)return;const{onDragStart:ye}=N.current,Pe={activatorEvent:ue,active:{id:Ce,data:me.data,rect:K}};Ue.unstable_batchedUpdates(()=>{ye?.(Pe),k(Te.Initializing),S({type:Z.DragStart,initialCoordinates:te,active:Ce}),_({type:"onDragStart",event:Pe}),D(Ot.current),T(ue)})},onMove(te){S({type:Z.DragMove,coordinates:te})},onEnd:ke(Z.DragEnd),onCancel:ke(Z.DragCancel)});Ot.current=ve;function ke(te){return async function(){const{active:me,collisions:ye,over:Pe,scrollAdjustedTranslate:Ye}=ne.current;let Re=null;if(me&&Ye){const{cancelDrop:Fe}=N.current;Re={activatorEvent:ue,active:me,collisions:ye,delta:Ye,over:Pe},te===Z.DragEnd&&typeof Fe=="function"&&await Promise.resolve(Fe(Re))&&(te=Z.DragCancel)}I.current=null,Ue.unstable_batchedUpdates(()=>{S({type:te}),k(Te.Uninitialized),hn(null),D(null),T(null),Ot.current=null;const Fe=te===Z.DragEnd?"onDragEnd":"onDragCancel";if(Re){const kt=N.current[Fe];kt?.(Re),_({type:Fe,event:Re})}})}}},[A]),zr=g.useCallback((re,ce)=>(le,De)=>{const de=le.nativeEvent,ue=A.get(De);if(I.current!==null||!ue||de.dndKit||de.defaultPrevented)return;const ve={active:ue};re(le,ce.options,ve)===!0&&(de.dndKit={capturedBy:ce.sensor},I.current=De,gn(le,ce))},[A,gn]),pn=Qo(f,zr);as(f),be(()=>{Y&&O===Te.Initializing&&k(Te.Initialized)},[Y,O]),g.useEffect(()=>{const{onDragMove:re}=N.current,{active:ce,activatorEvent:le,collisions:De,over:de}=ne.current;if(!ce||!le)return;const ue={active:ce,activatorEvent:le,collisions:De,delta:{x:_e.x,y:_e.y},over:de};Ue.unstable_batchedUpdates(()=>{re?.(ue),_({type:"onDragMove",event:ue})})},[_e.x,_e.y]),g.useEffect(()=>{const{active:re,activatorEvent:ce,collisions:le,droppableContainers:De,scrollAdjustedTranslate:de}=ne.current;if(!re||I.current==null||!ce||!de)return;const{onDragOver:ue}=N.current,ve=De.get(fn),ke=ve&&ve.rect.current?{id:ve.id,rect:ve.rect.current,data:ve.data,disabled:ve.disabled}:null,te={active:re,activatorEvent:ce,collisions:le,delta:{x:de.x,y:de.y},over:ke};Ue.unstable_batchedUpdates(()=>{hn(ke),ue?.(te),_({type:"onDragOver",event:te})})},[fn]),be(()=>{ne.current={activatorEvent:M,active:ee,activeNode:G,collisionRect:Oe,collisions:ze,droppableRects:z,draggableNodes:A,draggingNode:je,draggingNodeRect:Me,droppableContainers:B,over:we,scrollableAncestors:Se,scrollAdjustedTranslate:_e},K.current={initial:Me,translated:Oe}},[ee,G,ze,Oe,A,je,Me,z,B,we,Se,_e]),qo({...X,delta:H,draggingRect:Oe,pointerCoordinates:un,scrollableAncestors:Se,scrollableAncestorRects:ot});const Pr=g.useMemo(()=>({active:ee,activeNode:G,activeNodeRect:Y,activatorEvent:M,collisions:ze,containerNodeRect:se,dragOverlay:xe,draggableNodes:A,droppableContainers:B,droppableRects:z,over:we,measureDroppableContainers:F,scrollableAncestors:Se,scrollableAncestorRects:ot,measuringConfiguration:C,measuringScheduled:U,windowRect:_t}),[ee,G,Y,M,ze,se,xe,A,B,z,we,F,Se,ot,C,U,_t]),Yr=g.useMemo(()=>({activatorEvent:M,activators:pn,active:ee,activeNodeRect:Y,ariaDescribedById:{draggable:P},dispatch:S,draggableNodes:A,over:we,measureDroppableContainers:F}),[M,pn,ee,Y,S,P,A,we,F]);return g.createElement(Zn.Provider,{value:j},g.createElement(Tt.Provider,{value:Yr},g.createElement(dr.Provider,{value:Pr},g.createElement(fr.Provider,{value:Nr},d)),g.createElement(bs,{disabled:c?.restoreFocus===!1})),g.createElement(mo,{...c,hiddenTextDescribedById:P}));function Fr(){const re=R?.autoScrollEnabled===!1,ce=typeof l=="object"?l.enabled===!1:l===!1,le=E&&!re&&!ce;return typeof l=="object"?{...l,enabled:le}:{enabled:le}}}),ws=g.createContext(null),zn="button",Ds="Draggable";function Cs(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=nt(Ds),{activators:a,activatorEvent:c,active:l,activeNodeRect:d,ariaDescribedById:f,draggableNodes:h,over:y}=g.useContext(Tt),{role:v=zn,roleDescription:m="draggable",tabIndex:b=0}=o??{},x=l?.id===t,S=g.useContext(x?fr:ws),[_,j]=xt(),[O,k]=xt(),E=cs(a,t),$=Ke(n);be(()=>(h.set(t,{id:t,key:s,node:_,activatorNode:O,data:$}),()=>{const H=h.get(t);H&&H.key===s&&h.delete(t)}),[h,t]);const A=g.useMemo(()=>({role:v,tabIndex:b,"aria-disabled":r,"aria-pressed":x&&v===zn?!0:void 0,"aria-roledescription":m,"aria-describedby":f.draggable}),[r,v,b,x,m,f.draggable]);return{active:l,activatorEvent:c,activeNodeRect:d,attributes:A,isDragging:x,listeners:r?void 0:E,node:_,over:y,setNodeRef:j,setActivatorNodeRef:k,transform:S}}function Rs(){return g.useContext(dr)}const Ts="Droppable",Es={timeout:25};function js(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=nt(Ts),{active:a,dispatch:c,over:l,measureDroppableContainers:d}=g.useContext(Tt),f=g.useRef({disabled:n}),h=g.useRef(!1),y=g.useRef(null),v=g.useRef(null),{disabled:m,updateMeasurementsFor:b,timeout:x}={...Es,...o},S=Ke(b??r),_=g.useCallback(()=>{if(!h.current){h.current=!0;return}v.current!=null&&clearTimeout(v.current),v.current=setTimeout(()=>{d(Array.isArray(S.current)?S.current:[S.current]),v.current=null},x)},[x]),j=Rt({callback:_,disabled:m||!a}),O=g.useCallback((A,H)=>{j&&(H&&(j.unobserve(H),h.current=!1),A&&j.observe(A))},[j]),[k,E]=xt(O),$=Ke(t);return g.useEffect(()=>{!j||!k.current||(j.disconnect(),h.current=!1,j.observe(k.current))},[k,j]),g.useEffect(()=>(c({type:Z.RegisterDroppable,element:{id:r,key:s,disabled:n,node:k,rect:y,data:$}}),()=>c({type:Z.UnregisterDroppable,key:s,id:r})),[r]),g.useEffect(()=>{n!==f.current.disabled&&(c({type:Z.SetDroppableDisabled,id:r,key:s,disabled:n}),f.current.disabled=n)},[r,s,n,c]),{active:a,rect:y,isOver:l?.id===r,node:k,over:l,setNodeRef:E}}function Et(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Ms(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function ut(e){return e!==null&&e>=0}function _s(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 Os(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const dt={scaleX:1,scaleY:1},ks=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:s,index:a}=e;const c=(t=n[o])!=null?t:r;if(!c)return null;const l=$s(n,a,o);if(a===o){const d=n[s];return d?{x:o<s?d.left+d.width-(c.left+c.width):d.left-c.left,y:0,...dt}:null}return a>o&&a<=s?{x:-c.width-l,y:0,...dt}:a<o&&a>=s?{x:c.width+l,y:0,...dt}:{x:0,y:0,...dt}};function $s(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return!r||!o&&!s?0:n<t?o?r.left-(o.left+o.width):s.left-(r.left+r.width):s?s.left-(r.left+r.width):r.left-(o.left+o.width)}const gr=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const s=Et(t,r,n),a=t[o],c=s[o];return!c||!a?null:{x:c.left-a.left,y:c.top-a.top,scaleX:c.width/a.width,scaleY:c.height/a.height}},ft={scaleX:1,scaleY:1},Is=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:s,overIndex:a}=e;const c=(t=s[n])!=null?t:r;if(!c)return null;if(o===n){const d=s[a];return d?{x:0,y:n<a?d.top+d.height-(c.top+c.height):d.top-c.top,...ft}:null}const l=As(s,o,n);return o>n&&o<=a?{x:0,y:-c.height-l,...ft}:o<n&&o>=a?{x:0,y:c.height+l,...ft}:{x:0,y:0,...ft}};function As(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return r?n<t?o?r.top-(o.top+o.height):s?s.top-(r.top+r.height):0:s?s.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const pr="Sortable",vr=g.createContext({activeIndex:-1,containerId:pr,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:gr,disabled:{draggable:!1,droppable:!1}});function mr(e){let{children:t,id:n,items:r,strategy:o=gr,disabled:s=!1}=e;const{active:a,dragOverlay:c,droppableRects:l,over:d,measureDroppableContainers:f}=Rs(),h=nt(pr,n),y=c.rect!==null,v=g.useMemo(()=>r.map(E=>typeof E=="object"&&"id"in E?E.id:E),[r]),m=a!=null,b=a?v.indexOf(a.id):-1,x=d?v.indexOf(d.id):-1,S=g.useRef(v),_=!_s(v,S.current),j=x!==-1&&b===-1||_,O=Os(s);be(()=>{_&&m&&f(v)},[_,v,m,f]),g.useEffect(()=>{S.current=v},[v]);const k=g.useMemo(()=>({activeIndex:b,containerId:h,disabled:O,disableTransforms:j,items:v,overIndex:x,useDragOverlay:y,sortedRects:Ms(v,l),strategy:o}),[b,h,O.draggable,O.droppable,j,v,x,l,y,o]);return g.createElement(vr.Provider,{value:k},t)}const Ls=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Et(n,r,o).indexOf(t)},Ns=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:s,newIndex:a,previousItems:c,previousContainerId:l,transition:d}=e;return!d||!r||c!==s&&o===a?!1:n?!0:a!==o&&t===l},zs={duration:200,easing:"ease"},br="transform",Ps=Ie.Transition.toString({property:br,duration:0,easing:"linear"}),Ys={roleDescription:"sortable"};function Fs(e){let{disabled:t,index:n,node:r,rect:o}=e;const[s,a]=g.useState(null),c=g.useRef(n);return be(()=>{if(!t&&n!==c.current&&r.current){const l=o.current;if(l){const d=Ne(r.current,{ignoreTransform:!0}),f={x:l.left-d.left,y:l.top-d.top,scaleX:l.width/d.width,scaleY:l.height/d.height};(f.x||f.y)&&a(f)}}n!==c.current&&(c.current=n)},[t,n,r,o]),g.useEffect(()=>{s&&a(null)},[s]),s}function xr(e){let{animateLayoutChanges:t=Ns,attributes:n,disabled:r,data:o,getNewIndex:s=Ls,id:a,strategy:c,resizeObserverConfig:l,transition:d=zs}=e;const{items:f,containerId:h,activeIndex:y,disabled:v,disableTransforms:m,sortedRects:b,overIndex:x,useDragOverlay:S,strategy:_}=g.useContext(vr),j=Bs(r,v),O=f.indexOf(a),k=g.useMemo(()=>({sortable:{containerId:h,index:O,items:f},...o}),[h,o,O,f]),E=g.useMemo(()=>f.slice(f.indexOf(a)),[f,a]),{rect:$,node:A,isOver:H,setNodeRef:B}=js({id:a,data:k,disabled:j.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...l}}),{active:L,activatorEvent:K,activeNodeRect:ee,attributes:I,setNodeRef:R,listeners:D,isDragging:M,over:T,setActivatorNodeRef:N,transform:P}=Cs({id:a,data:k,attributes:{...Ys,...n},disabled:j.draggable}),p=ro(B,R),C=!!L,z=C&&!m&&ut(y)&&ut(x),F=!S&&M,U=F&&z?P:null,V=z?U??(c??_)({rects:b,activeNodeRect:ee,activeIndex:y,overIndex:x,index:O}):null,X=ut(y)&&ut(x)?s({id:a,items:f,activeIndex:y,overIndex:x}):O,q=L?.id,Y=g.useRef({activeId:q,items:f,newIndex:X,containerId:h}),se=f!==Y.current.items,ne=t({active:L,containerId:h,isDragging:M,isSorting:C,id:a,index:O,items:f,newIndex:Y.current.newIndex,previousItems:Y.current.items,previousContainerId:Y.current.containerId,transition:d,wasDragging:Y.current.activeId!=null}),he=Fs({disabled:!ne,index:O,node:A,rect:$});return g.useEffect(()=>{C&&Y.current.newIndex!==X&&(Y.current.newIndex=X),h!==Y.current.containerId&&(Y.current.containerId=h),f!==Y.current.items&&(Y.current.items=f)},[C,X,h,f]),g.useEffect(()=>{if(q===Y.current.activeId)return;if(q!=null&&Y.current.activeId==null){Y.current.activeId=q;return}const je=setTimeout(()=>{Y.current.activeId=q},50);return()=>clearTimeout(je)},[q]),{active:L,activeIndex:y,attributes:I,data:k,rect:$,index:O,newIndex:X,items:f,isOver:H,isSorting:C,isDragging:M,listeners:D,node:A,overIndex:x,over:T,setNodeRef:p,setActivatorNodeRef:N,setDroppableNodeRef:B,setDraggableNodeRef:R,transform:he??V,transition:xe()};function xe(){if(he||se&&Y.current.newIndex===O)return Ps;if(!(F&&!tn(K)||!d)&&(C||ne))return Ie.Transition.toString({...d,property:br})}}function Bs(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}W.Down,W.Right,W.Up,W.Left;const Hs=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Vs=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Pn=e=>{const t=Vs(e);return t.charAt(0).toUpperCase()+t.slice(1)},yr=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),Ws=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var Us={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 Gs=g.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:a,...c},l)=>g.createElement("svg",{ref:l,...Us,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:yr("lucide",o),...!s&&!Ws(c)&&{"aria-hidden":"true"},...c},[...a.map(([d,f])=>g.createElement(d,f)),...Array.isArray(s)?s:[s]]));const oe=(e,t)=>{const n=g.forwardRef(({className:r,...o},s)=>g.createElement(Gs,{ref:s,iconNode:t,className:yr(`lucide-${Hs(Pn(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Pn(e),n};const Xs=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],qs=oe("arrow-down",Xs);const Ks=[["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"}]],Js=oe("arrow-up-down",Ks);const Zs=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Qs=oe("arrow-up",Zs);const ei=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],ti=oe("bookmark",ei);const ni=[["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"}]],Yn=oe("calendar",ni);const ri=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],oi=oe("chevron-left",ri);const si=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ii=oe("chevron-right",si);const ai=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],ci=oe("columns-2",ai);const li=[["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"}]],ui=oe("delete",li);const di=[["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"}]],fi=oe("ellipsis",di);const hi=[["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"}]],gi=oe("funnel",hi);const pi=[["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"}]],Sr=oe("grip-vertical",pi);const vi=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],mi=oe("pen",vi);const bi=[["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"}]],xi=oe("refresh-ccw",bi);const yi=[["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"}]],Si=oe("settings",yi);const wi=[["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"}]],Di=oe("triangle-alert",wi);function w(e){return g.forwardRef((t,n)=>{const{children:r,...o}=t;return i.jsx(e,{ref:n,...o,children:r})})}const wr=e=>`table_column_order_v1:${e}`,Dr=e=>`table_column_visibility_v1:${e}`,Ci=e=>{const{tableId:t}=ie.state;localStorage.setItem(wr(t),JSON.stringify(e.map(n=>n.id))),ie.setState(n=>({...n,columnOrder:e})),ie.setState(n=>({...n,columnOrder:e}))};function Ri(e){ie.setState(t=>t.sortColumn===e?{...t,sortDirection:t.sortDirection==="asc"?"desc":"asc"}:{...t,sortColumn:e,sortDirection:"asc"})}const Ti=e=>{ie.setState(t=>{const n={...t.visibility,[e]:!t.visibility[e]};return t.tableId&&localStorage.setItem(Dr(t.tableId),JSON.stringify(n)),{...t,visibility:n}})},ie=new qn({tableId:"",sortColumn:null,sortDirection:"asc",visibility:{},columnOrder:[],data:[],sortableColumns:[],actionsConfig:{showActionColumn:!0,showColumnVisibilityMenu:!0,children:"Actions",width:"100px"}});function Cr(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:s}=ie.state,a=JSON.parse(localStorage.getItem(wr(s))||"[]"),c=[...a.map(f=>o.find(h=>h.id===f)).filter(Boolean),...o.filter(f=>!a.includes(f.id))],l=JSON.parse(localStorage.getItem(Dr(s))||"{}"),d=c.reduce((f,h)=>(f[h.id]=l[h.id]??!0,f),{});ie.setState(f=>({...f,data:e,columnOrder:c,visibility:d,sortableColumns:c.map(h=>({id:h.id,label:h.label,sortable:!0,backgroundColor:h.backgroundColor}))}))}function Rr(e){ie.setState(t=>({...t,tableId:e}))}const Tr=e=>{ie.setState(t=>({...t,actionsConfig:e}))},Ei=w(u.Menu.Trigger),ji=w(u.Menu.Positioner),Mi=w(u.Menu.Content),_i=w(u.Menu.Item),Oi=w(u.Checkbox.Label),ki=w(u.Checkbox.HiddenInput),$i=w(u.Checkbox.Control);function Ii({visibility:e,onToggle:t}){const{sortableColumns:n}=Qe(ie);return i.jsxs(u.Menu.Root,{closeOnSelect:!1,children:[i.jsx(Ei,{asChild:!0,children:i.jsx(u.IconButton,{"aria-label":"Toggle columns",variant:"ghost",ml:"1",size:"xs",children:i.jsx(ci,{size:18})})}),i.jsx(u.Portal,{children:i.jsx(ji,{children:i.jsx(Mi,{minW:"220px",children:n.map(r=>{const o=!!e[r.id];return i.jsx(_i,{value:r.id,closeOnSelect:!1,children:i.jsxs(u.Checkbox.Root,{checked:o,onCheckedChange:()=>t(r.id),children:[i.jsx(ki,{}),i.jsx($i,{}),i.jsx(Oi,{children:r.label})]})},r.id)})})})})]})}function Ai({id:e,children:t,onClick:n,cursor:r,borderRight:o,borderRightColor:s,backgroundColor:a}){const{setNodeRef:c,attributes:l,listeners:d,transform:f,transition:h}=xr({id:e});return i.jsx(u.Table.ColumnHeader,{ref:c,onClick:n,backgroundColor:a,w:e==="id"?"80px":void 0,style:{transform:Ie.Transform.toString(f),transition:h,cursor:r,borderRight:o,borderRightColor:s},...l,children:i.jsxs(u.HStack,{justify:"space-between",children:[t,i.jsx("span",{...d,children:i.jsx(Sr,{size:12})})]})})}function Li(){const{columnOrder:e,visibility:t,sortColumn:n,sortDirection:r,sortableColumns:o,actionsConfig:s}=Qe(ie),a=e.map(l=>o.find(d=>d.id===l.id)).filter(l=>l!==void 0).filter(l=>t[l.id]),c=l=>{const{active:d,over:f}=l;if(!f||d.id===f.id)return;const h=e.findIndex(m=>m.id===d.id),y=e.findIndex(m=>m.id===f.id),v=Et(e,h,y);Ci(v)};return i.jsx(u.Table.Header,{background:"blue.200",position:"sticky",top:0,p:"0",zIndex:1,children:i.jsx(hr,{collisionDetection:Qn,onDragEnd:c,children:i.jsx(mr,{items:e.map(l=>l.id),strategy:ks,children:i.jsxs(u.Table.Row,{height:"28px",children:[a.map(l=>{const d=n===l?.id;return i.jsx(Ai,{id:l?.id,onClick:()=>l?.sortable&&Ri(l?.id),cursor:l?.sortable?"pointer":"default",borderRight:"2px solid #dcdcdc",backgroundColor:l?.backgroundColor,children:i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,userSelect:"none"},children:[l?.label,l?.sortable&&(d?r==="asc"?i.jsx(Qs,{size:14}):i.jsx(qs,{size:14}):i.jsx(Js,{size:14,opacity:.4}))]})},l?.id)}),s?.showActionColumn&&i.jsx(u.Table.ColumnHeader,{width:s.width,backgroundColor:s.backgroundColor,borderRight:"2px solid #dcdcdc",children:s.children}),s?.showColumnVisibilityMenu&&i.jsx(u.Table.ColumnHeader,{boxSize:"0.5",backgroundColor:s.backgroundColorColumnVisibilityMenu,children:i.jsx(Ii,{visibility:t,onToggle:Ti})})]})})})})}const Ni=[10,20,50,100],zi=w(u.Select.Positioner),Pi=w(u.Select.Content),Yi=w(u.Select.Item),Fi=w(u.Pagination.PrevTrigger),Bi=w(u.Pagination.NextTrigger),Hi=w(u.Select.HiddenSelect),Vi=w(u.Select.Control),Wi=w(u.Select.Trigger),Ui=w(u.Select.ValueText),Gi=w(u.Select.IndicatorGroup),Xi=w(u.Select.Indicator);function qi({totalCount:e,pageSize:t,currentPage:n,onPageChange:r,onPageSizeChange:o,siblingCount:s=2,pageSizeOptions:a=Ni}){const c=u.createListCollection({items:a.map(l=>({label:String(l),value:String(l)}))});return i.jsx(u.Box,{width:"100%",children:i.jsxs(u.HStack,{justify:"space-between",mx:"auto",flexWrap:"wrap",children:[i.jsxs(u.HStack,{children:[i.jsx(u.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:"Rows per page:"}),i.jsxs(u.Select.Root,{collection:c,size:"sm",width:"60px",onValueChange:l=>o?.(Number(l.items[0].value)),value:[String(t)],children:[i.jsx(Hi,{}),i.jsxs(Vi,{children:[i.jsx(Wi,{children:i.jsx(Ui,{placeholder:""})}),i.jsx(Gi,{children:i.jsx(Xi,{})})]}),i.jsx(u.Portal,{children:i.jsx(zi,{children:i.jsx(Pi,{children:c.items.map(l=>i.jsxs(Yi,{item:l.value,children:[l.label,i.jsx(u.Select.ItemIndicator,{})]},l.value))})})})]})]}),i.jsx(u.Pagination.Root,{count:e,pageSize:t,page:n,siblingCount:s,onPageChange:l=>r&&r(l.page),children:i.jsxs(u.ButtonGroup,{size:"sm",variant:"ghost",children:[i.jsx(Fi,{asChild:!0,children:i.jsx(u.IconButton,{"aria-label":"Previous page",children:i.jsx(oi,{size:18})})}),i.jsx(u.Pagination.Items,{render:l=>i.jsx(u.IconButton,{variant:l.type==="page"&&l.value===n?"outline":"ghost","aria-current":l.type==="page"&&l.value===n?"page":void 0,children:l.type==="page"?l.value:"…"},l.value??l.type)}),i.jsx(Bi,{asChild:!0,children:i.jsx(u.IconButton,{"aria-label":"Next page",children:i.jsx(ii,{size:18})})})]})})]})})}const Ki=w(u.Menu.Item),Ji=w(u.Menu.Content),Zi=w(u.Menu.Positioner),Qi=w(u.Menu.Trigger);function ea({data:e=[],actions:t=[]}){const{columnOrder:n,visibility:r}=Qe(ie);return i.jsx(u.Table.Body,{children:e.map(o=>i.jsxs(u.Table.Row,{_hover:{bg:"blue.50"},children:[n.filter(s=>r[s.id]).map(s=>i.jsx(u.Table.Cell,{children:o[s.id]},s.id)),i.jsx(u.Table.Cell,{textAlign:"center",display:"flex",gap:2,children:i.jsxs(u.Menu.Root,{children:[i.jsx(Qi,{asChild:!0,children:i.jsx(u.IconButton,{"aria-label":"Open",variant:"ghost",size:"sm",children:i.jsx(fi,{size:16})})}),i.jsx(u.Portal,{children:i.jsx(Zi,{children:i.jsx(Ji,{children:t.map(s=>i.jsxs(Ki,{onClick:()=>s.onClick(o),colorScheme:s.colorScheme,value:s.label,children:[s.icon,s.label]},s.label))})})})]})}),i.jsx(u.Table.Cell,{})]},o.id))})}function ta({rows:e=6,columns:t}){return i.jsx(u.Table.Body,{children:Array.from({length:e}).map((n,r)=>i.jsx(u.Table.Row,{children:Array.from({length:t}).map((o,s)=>i.jsx(u.Table.Cell,{children:i.jsx(u.Skeleton,{height:"25px"})},s))},r))})}function na({tableId:e,data:t=[],headers:n=[],loading:r=!1,loadingChildren:o,skeletonLoading:s=!1,emptyMessage:a="No data",actions:c,page:l=1,pageSize:d=10,onPageChange:f,onPageSizeChange:h,density:y="sm",totalCount:v=0,paginationMode:m="client",actionConfig:b,pageSizeOptions:x}){g.useEffect(()=>{Rr(e)},[e]),g.useEffect(()=>{Cr(t,n)},[t,n]),g.useEffect(()=>{b&&Tr(b)},[b]);const{sortColumn:S,sortDirection:_,data:j,columnOrder:O}=Qe(ie),k=g.useMemo(()=>{const E=[...j],$=Math.max(1,l||1);if(S&&E.sort((A,H)=>_==="asc"?String(A[S]).localeCompare(String(H[S])):String(H[S]).localeCompare(String(A[S]))),m==="client"){const A=($-1)*d;return E.slice(A,A+d)}return E},[j,S,_,l,d,m]);return g.useEffect(()=>{l<1&&f&&f(1)},[l,f]),i.jsxs(u.Box,{h:"100%",display:"flex",flexDirection:"column",p:2,pt:2,minHeight:0,children:[i.jsx(u.Box,{flex:"1",minHeight:0,overflow:"auto",h:"100%",children:i.jsxs(u.Table.Root,{variant:"outline",w:"100%",size:y,children:[i.jsx(Li,{}),r?i.jsx(u.Table.Body,{children:i.jsx(u.Table.Row,{children:i.jsx(u.Table.Cell,{colSpan:O.length+(c?1:0),children:i.jsx(u.Box,{display:"flex",alignItems:"center",justifyContent:"center",h:"83vh",w:"100%",children:o??"Loading..."})})})}):s?i.jsx(ta,{rows:d,columns:n.length+(c?2:0)}):k.length===0?i.jsx(u.Table.Body,{children:i.jsx(u.Table.Row,{children:i.jsx(u.Table.Cell,{colSpan:n.length+(c?1:0),children:i.jsx(u.Box,{display:"flex",alignItems:"center",justifyContent:"center",minH:"200px",color:"gray.500",children:a})})})}):i.jsx(ea,{data:k,actions:c})]})}),i.jsx(u.Box,{mt:.5,children:i.jsx(qi,{totalCount:v,pageSize:d,currentPage:l,onPageChange:f,onPageSizeChange:E=>{h&&h(E),l>1&&f&&f(1)},pageSizeOptions:x})})]})}const ra=w(u.Checkbox.Root),oa=w(u.Checkbox.HiddenInput),sa=w(u.Checkbox.Control),ia=w(u.Checkbox.Label),Er=({value:e,onChange:t,size:n="sm",label:r,helperText:o,isDisabled:s,required:a,errorText:c})=>i.jsxs(ra,{value:e,onChange:t,size:n,children:[i.jsx(oa,{}),i.jsx(sa,{disabled:s,required:a,errorText:c,helperText:o}),r&&i.jsx(ia,{children:r})]}),J=" to ",Fn=10,Ee={DAY_MAX:31,MONTH_MAX:12,YEAR_MIN:1900,YEAR_MAX:2100},an=()=>{const e=new Date;return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}},Bn=()=>{const{year:e,month:t,day:n}=an();return`${String(n).padStart(2,"0")}-${String(t).padStart(2,"0")}-${e}`},aa=()=>{const{year:e,month:t,day:n}=an();return`${e}-${String(t).padStart(2,"0")}-${String(n).padStart(2,"0")}`},ca=(e,t)=>{const n=e.length,r=parseInt(e);if(!e||isNaN(r))return t;if(n===4)return r>=Ee.YEAR_MIN&&r<=Ee.YEAR_MAX?r:t;if(n>0&&n<4){const o=t.toString(),s=4-n,a=o.substring(0,s);return parseInt(a+e)}return t},Ve=e=>{if(!e?.trim())return null;const n=e.replace(/[^\d-]/g,"").split("-").filter(d=>d!=="");if(n.length===0)return null;const{year:r,month:o,day:s}=an();let a,c,l;return n.length===1?(a=parseInt(n[0])||s,c=o,l=r):n.length===2?(a=parseInt(n[0])||s,c=parseInt(n[1])||o,l=r):(a=parseInt(n[0])||s,c=parseInt(n[1])||o,l=ca(n[2],r)),c=Math.max(1,Math.min(Ee.MONTH_MAX,c)),a=Math.max(1,Math.min(Ee.DAY_MAX,a)),`${l}-${String(c).padStart(2,"0")}-${String(a).padStart(2,"0")}`},ge=e=>{if(!e)return"";const[t,n,r]=e.split("-");return`${r}-${n}-${t}`},la=(e,t)=>{if(e[0]?.length>0){const n=parseInt(e[0]);if(isNaN(n)||n===0||e[0].length===2&&n>Ee.DAY_MAX)return t}if(e[1]?.length>0){const n=parseInt(e[1]);if(isNaN(n)||n===0||e[1].length===2&&n>Ee.MONTH_MAX)return t}if(e[2]?.length>0){const n=parseInt(e[2]),r=e[2].length===4;if(isNaN(n)||n===0||r&&(n<Ee.YEAR_MIN||n>Ee.YEAR_MAX))return t}return null},We=e=>{let t=e.replace(/[^\d-]/g,"").substring(0,Fn);if(t.length>=3&&t[2]!=="-"&&(t=t.substring(0,2)+"-"+t.substring(2).replace(/-/g,"")),t.length>=6&&t[5]!=="-"){const o=t.split("-");o.length>=2&&(t=`${o[0]}-${o[1].substring(0,2)}-${o[1].substring(2)}${o[2]||""}`)}const n=t.split("-");return n[0]=n[0]?.substring(0,2)||"",n[1]=n[1]?.substring(0,2)||"",n[2]=n[2]?.substring(0,4)||"",t=n.filter(o=>o!=="").join("-"),t=t.substring(0,Fn),la(n,e)||t},ua=w(u.Popover.Root),da=w(u.Popover.Trigger),fa=w(u.Popover.Content),ha=w(u.Popover.Positioner);function ga({value:e,onChange:t,disabled:n=!1}){const[r="",o=""]=e?e.split("|"):[],[s,a]=g.useState(()=>r&&o?`${ge(r)}${J}${ge(o)}`:r?ge(r):""),[c,l]=g.useState(!1),d=g.useRef(null);g.useEffect(()=>{const m=b=>{b.ctrlKey&&b.key==="d"&&!b.shiftKey&&!b.metaKey&&(b.preventDefault(),d.current?.focus())};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[]);const f=m=>{let b=m;if(b.includes(J)){const[x,S=""]=b.split(J);b=`${We(x.trim())}${J}${We(S.trim())}`}else if(b.toLowerCase().includes(" to ")){const[x,S=""]=b.split(/\s+to\s+/i);b=`${We(x.trim())} to ${We(S.trim())}`}else b=We(b);a(b)},h=()=>{const m=s.trim();if(!m){t(void 0);return}if(m.includes(J)){const[b,x=""]=m.split(J).map(j=>j.trim()),S=Ve(b),_=x?Ve(x):null;if(S&&_){const[j,O]=_<S?[_,S]:[S,_],k=`${ge(j)}${J}${ge(O)}`;a(k),t(`${j}|${O}`)}else if(S&&!x)a(`${ge(S)}${J}`),t(void 0);else if(S&&x){const j=aa(),[O,k]=j<S?[j,S]:[S,j],E=`${ge(O)}${J}${ge(k)}`;a(E),t(`${O}|${k}`)}else a(""),t(void 0)}else{const b=Ve(m);b?(a(`${ge(b)}${J}`),t(void 0)):(a(""),t(void 0))}},y=m=>{if(m.key!=="Enter")return;m.preventDefault();const b=d.current?.selectionStart||0,x=s.indexOf(J);if(!s.trim()){a(`${Bn()}${J}`);return}if(x===-1){const _=Ve(s.trim());_&&a(`${ge(_)}${J}`);return}if(b<=x+J.length){const _=s.substring(0,x).trim(),j=s.substring(x+J.length),O=Ve(_);O&&a(`${ge(O)}${J}${j}`);return}if(s.substring(x+J.length).trim())h(),d.current?.blur();else{const _=s.substring(0,x+J.length)+Bn();a(_),setTimeout(()=>{h(),d.current?.blur()},0)}},v=()=>{a(""),t(void 0)};return i.jsx(u.InputGroup,{children:i.jsx(i.Fragment,{children:i.jsxs(u.InputElement,{position:"revert",children:[i.jsxs(ua,{open:c,onEscapeKeyDown:()=>{l(!1)},children:[i.jsx(da,{asChild:!0,children:i.jsx(u.IconButton,{size:"sm",variant:"ghost","aria-label":"Date range help",onClick:()=>l(m=>!m),children:i.jsx(Yn,{size:16})})}),i.jsx(u.Portal,{children:i.jsx(ha,{children:i.jsxs(fa,{p:4,children:[i.jsx(u.PopoverArrow,{}),i.jsxs(u.VStack,{align:"start",gap:4,children:[i.jsxs(u.HStack,{children:[i.jsx(Yn,{size:16}),i.jsx(u.Text,{fontWeight:"semibold",fontSize:"sm",children:"Date Range Filter"})]}),i.jsxs(u.VStack,{align:"start",gap:1,children:[i.jsx(u.Text,{fontSize:"sm",fontWeight:"medium",children:"Format:"}),i.jsxs(u.Text,{fontSize:"xs",color:"gray.600",children:["DD-MM-YYYY",J,"DD-MM-YYYY"]})]}),i.jsxs(u.VStack,{align:"start",gap:1,children:[i.jsx(u.Text,{fontSize:"sm",fontWeight:"medium",children:"Tips:"}),i.jsx(u.Text,{fontSize:"xs",children:'• "15 to 20" → assumes current month/year'}),i.jsx(u.Text,{fontSize:"xs",children:"• Leave end blank → up to today"}),i.jsx(u.Text,{fontSize:"xs",children:"• Dates auto-swapped if reversed"}),i.jsx(u.Text,{fontSize:"xs",children:"• Press Enter on empty end → fills today"})]}),i.jsxs(u.VStack,{align:"start",gap:1,children:[i.jsx(u.Text,{fontSize:"sm",fontWeight:"medium",children:"Shortcut:"}),i.jsxs(u.HStack,{children:[i.jsx(u.Kbd,{children:"Ctrl"}),i.jsx(u.Text,{children:"+"}),i.jsx(u.Kbd,{children:"D"})]})]})]})]})})})]}),i.jsx(u.Input,{ref:d,placeholder:"15-06-2025 to 20-06-2025",value:s,size:"sm",disabled:n,onChange:m=>f(m.target.value),onBlur:h,onKeyDown:y,pr:s?"10":void 0,w:"100%"}),s&&i.jsx(u.InputElement,{children:i.jsx(u.IconButton,{size:"sm",variant:"ghost","aria-label":"Clear date range",onClick:v,w:"100%"})})]})})})}const pa=w(u.Field.Root),va=w(u.Field.Label),ma=w(u.Field.HelperText),ba=w(u.Field.ErrorText),Kt=({icon:e,value:t,onChange:n,placeholder:r,size:o="xs",variant:s="outline",width:a="100%",label:c,helperText:l,isDisabled:d=!1,required:f=!1,errorText:h,visible:y})=>i.jsxs(pa,{width:a,children:[y&&i.jsx(va,{children:c}),i.jsx(u.InputGroup,{startElement:e,children:i.jsx(u.Input,{value:t,onChange:v=>n?.(v.target.value),placeholder:r,size:o,variant:s,disabled:d,required:f})}),h&&i.jsx(ba,{fontSize:"xs",children:h}),l&&i.jsx(ma,{fontSize:"xs",children:l})]}),xa=w(u.Field.Root),ya=w(u.Field.HelperText),Sa=w(u.Field.ErrorText),wa=w(u.Select.Root),Da=w(u.Select.Label),Ca=w(u.Select.Control),Ra=w(u.Select.Trigger),Ta=w(u.Select.ValueText),Ea=w(u.Select.IndicatorGroup),ja=w(u.Select.Indicator),Ma=w(u.Select.Content),_a=w(u.Select.Item),Oa=w(u.Select.ItemIndicator),ka=w(u.Select.HiddenSelect),$a=w(u.Select.Positioner),jr=({options:e=[],label:t,value:n,onChange:r,placeholder:o,size:s="xs",width:a="100%",variant:c="outline",helperText:l,isDisabled:d,required:f,errorText:h,visible:y})=>{const v=u.createListCollection({items:e});return i.jsxs(xa,{disabled:d,required:f,children:[i.jsxs(wa,{collection:v,variant:c,size:s,width:a,value:n?[n]:[],onValueChange:m=>r?.(m.value[0]),children:[i.jsx(ka,{}),y&&i.jsx(Da,{children:t}),i.jsxs(Ca,{children:[i.jsx(Ra,{children:i.jsx(Ta,{placeholder:o})}),i.jsx(Ea,{children:i.jsx(ja,{})})]}),i.jsx($a,{children:i.jsx(Ma,{children:v.items.map(m=>i.jsxs(_a,{item:m,children:[m.label,i.jsx(Oa,{})]},m.value))})})]}),l&&i.jsx(ya,{children:l}),h&&i.jsx(Sa,{children:h})]})},Mr=(e="default")=>`FILTER_PRESETS_${e}`,Ia=e=>{if(!e)return[];try{return JSON.parse(e)}catch{return[]}},Aa=e=>typeof window>"u"?[]:Ia(localStorage.getItem(Mr(e))),Ze=new qn({}),rt=e=>{const t=Ze.state;if(e in t)return t[e];const n=Aa(e);return Ze.setState(r=>({...r,[e]:n})),n},jt=(e,t)=>{Ze.setState(n=>({...n,[e]:t})),typeof window<"u"&&localStorage.setItem(Mr(e),JSON.stringify(t))},_r=(e,t)=>{const n=[t,...rt(e)];jt(e,n)},Or=(e,t)=>{const n=rt(e).filter(r=>r.id!==t);jt(e,n)},La=(e,t,n)=>{const r=rt(e).map(o=>o.id===t?n(o):o);jt(e,r)},Na=w(u.Checkbox.Root),za=w(u.Checkbox.HiddenInput),Pa=w(u.Checkbox.Control),Ya=w(u.Slider.Root),Fa=w(u.Slider.Track),Ba=w(u.Slider.Range),Ha=w(u.Slider.Thumbs),Va=w(u.Slider.Control),Wa=({filter:e,onVisibilityChange:t,onSizeChange:n})=>{const{attributes:r,listeners:o,setNodeRef:s,transform:a,transition:c}=xr({id:e.id}),l={transform:Ie.Transform.toString(a),transition:c};return i.jsxs(u.VStack,{ref:s,style:l,align:"stretch",border:"1px solid",borderColor:"gray.200",rounded:"md",p:3,mb:3,bg:"white",children:[i.jsxs(u.HStack,{...r,...o,cursor:"grab",userSelect:"none",gap:2,children:[i.jsx(Sr,{size:16}),i.jsx(u.Text,{fontWeight:"bold",fontSize:"sm",children:e.label||e.id})]}),i.jsxs(u.HStack,{justify:"space-between",children:[i.jsx(u.Text,{fontSize:"sm",children:"Visible"}),i.jsxs(Na,{checked:e.visible,size:"sm",onCheckedChange:d=>t?.(e.id,!!d.checked),children:[i.jsx(za,{}),i.jsx(Pa,{})]})]}),i.jsxs(u.VStack,{align:"stretch",gap:1,children:[i.jsx(u.Text,{fontSize:"sm",children:"Size"}),i.jsx(Ya,{min:1,max:5,step:.5,value:[e.size??1],onValueChange:d=>n?.(e.id,d.value[0]),children:i.jsxs(Va,{children:[i.jsx(Fa,{children:i.jsx(Ba,{})}),i.jsx(Ha,{})]})})]})]})},Ua=w(u.Drawer.Root),Ga=w(u.Drawer.Trigger),Xa=w(u.Drawer.Backdrop),qa=w(u.Drawer.Positioner),Ka=w(u.Drawer.Content),Ja=w(u.Drawer.Header),Za=w(u.Drawer.Title),Qa=w(u.Drawer.Body),ec=w(u.Drawer.Footer),tc=w(u.Drawer.CloseTrigger),nc=w(u.Tabs.Root),rc=w(u.Tabs.List),Bt=w(u.Tabs.Trigger),Ht=w(u.Tabs.Content),kr=(e,t)=>{if(e.customComponent)return e.customComponent;switch(e.type){case"text":return i.jsx(Kt,{placeholder:e.label,value:e.value,onChange:e.onChange,label:e.label,visible:t});case"number":return i.jsx(Kt,{label:e.label,value:e.value,onChange:e.onChange});case"checkbox":return i.jsx(Er,{label:e.label,value:e.value,onChange:e.onChange});case"select":return i.jsx(jr,{label:e.label,value:e.value,onChange:e.onChange,options:e.options??[],visible:t});case"date":return i.jsx(ga,{value:e.value,onChange:e.onChange});default:return null}},oc=({filterDrawerSize:e="sm",onVisibilityChange:t,onSizeChange:n,onClear:r,filters:o,pageKey:s="default",onLoadPreset:a,activePresetName:c,onReorder:l,open:d,onOpenChange:f})=>{const y=Qe(Ze)[s]??rt(s),v=()=>{const m=prompt("Preset name?");if(!m)return;const b=o.reduce((x,S)=>(x[S.id]=S.value,x),{});_r(s,{id:crypto.randomUUID(),name:m,date:new Date().toISOString(),values:b})};return i.jsx(u.HStack,{wrap:"wrap",children:i.jsxs(Ua,{size:e,open:d,onOpenChange:f,children:[i.jsx(Ga,{asChild:!0,children:i.jsxs(u.IconButton,{"aria-label":"Open filters",variant:"outline",size:"xs",ml:2,p:2,children:[i.jsx(gi,{size:16}),"Filters"]})}),i.jsxs(u.Portal,{children:[i.jsx(Xa,{}),i.jsx(qa,{children:i.jsxs(Ka,{children:[i.jsx(Ja,{children:i.jsx(Za,{children:"Filters"})}),i.jsx(Qa,{overflowY:"auto",pt:1,children:i.jsxs(nc,{defaultValue:"view",children:[i.jsxs(rc,{mb:4,children:[i.jsxs(Bt,{value:"view",children:[i.jsx(mi,{size:16}),"Edit"]}),i.jsxs(Bt,{value:"settings",children:[i.jsx(Si,{size:16}),"Settings"]}),i.jsxs(Bt,{value:"presets",children:[i.jsx(ti,{size:16}),"Presets"]})]}),i.jsx(Ht,{value:"view",children:o.filter(m=>m.visible).map(m=>i.jsx(u.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:kr(m,d)},m.id))}),i.jsx(Ht,{value:"settings",children:i.jsx(hr,{sensors:xo(bo(sn)),collisionDetection:Qn,onDragEnd:({active:m,over:b})=>{if(!b||m.id===b.id)return;const x=o.findIndex(j=>j.id===m.id),S=o.findIndex(j=>j.id===b.id),_=Et(o,x,S);l?.(_)},children:i.jsx(mr,{items:o.map(m=>m.id),strategy:Is,children:o.map(m=>i.jsx(Wa,{filter:m,onVisibilityChange:t,onSizeChange:n},m.id))})})}),i.jsx(Ht,{value:"presets",children:i.jsxs(u.VStack,{align:"stretch",mb:3,children:[y.length===0&&i.jsx(u.Text,{fontSize:"xs",color:"gray.500",children:"No presets saved yet."}),y.map(m=>i.jsxs(u.HStack,{justify:"space-between",border:"1px solid",borderColor:c===m.name?"blue.300":"gray.200",rounded:"md",p:2,children:[i.jsxs(u.VStack,{align:"start",gap:0,children:[i.jsx(u.Text,{fontWeight:"bold",fontSize:"sm",children:m.name}),i.jsx(u.Text,{fontSize:"xs",color:"gray.500",children:new Date(m.date).toLocaleDateString()})]}),i.jsxs(u.HStack,{children:[i.jsx(u.Button,{size:"xs",variant:"ghost",onClick:()=>{const b=o.map(x=>({...x,value:m.values[x.id]??x.value}));a?.(b,m.name)},children:"Load"}),i.jsx(u.IconButton,{size:"xs","aria-label":"Delete preset",variant:"ghost",onClick:()=>Or(s,m.id),children:i.jsx(ui,{size:14})})]})]},m.id)),i.jsx(u.Button,{size:"sm",colorScheme:"blue",onClick:v,children:"Save Current Filters"})]})})]})}),i.jsx(ec,{justify:"space-between",children:i.jsx(tc,{asChild:!0,children:i.jsx(u.CloseButton,{})})})]})})]})]})})},sc=({title:e,filters:t,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:a,pageKey:c,onLoadPreset:l,activePresetName:d,filterDrawerSize:f="sm"})=>{const[h,y]=g.useState(!1);return i.jsxs(u.HStack,{wrap:"wrap",pl:2,pr:2,width:"100%",justify:"space-between",children:[e,i.jsxs(u.HStack,{gapX:1,children:[t.filter(v=>v.visible!==!1).map(v=>i.jsx(u.HStack,{flex:v.size??1,minW:`${(v.size??1)*100}px`,alignItems:"center",children:kr(v)},v.id)),i.jsx(oc,{filterDrawerSize:f,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:a,pageKey:c,filters:t,onLoadPreset:l,activePresetName:d,open:h,onOpenChange:v=>{y(v.open)}})]})]})},ic=(e,t)=>{localStorage.setItem(`FILTER_ORDER_${e}`,JSON.stringify(t))},ac=e=>{try{return JSON.parse(localStorage.getItem(`FILTER_ORDER_${e}`)||"[]")}catch{return[]}},cc=({onClick:e,size:t="xs",variant:n="solid",label:r,leftIcon:o,rightIcon:s,isDisabled:a,colorScheme:c,loading:l,loadingText:d,rounded:f,type:h="button"})=>i.jsx(u.Button,{onClick:e,size:t,variant:n,disabled:a,colorPalette:c,loading:l,loadingText:d,rounded:f,type:h,children:i.jsxs(u.HStack,{gap:1,children:[o,r,s]})}),lc=w(u.Dialog.Root),uc=w(u.Dialog.Backdrop),dc=w(u.Dialog.Positioner),fc=w(u.Dialog.Content),hc=w(u.Dialog.Header),gc=w(u.Dialog.Body),pc=w(u.Dialog.Footer),vc=w(u.Dialog.Title),mc=w(u.Dialog.CloseTrigger);function bc({open:e,onClose:t,onConfirm:n,title:r="Delete Company",entityName:o,confirmText:s="DELETE",confirmLabel:a="Delete",isLoading:c=!1}){const[l,d]=g.useState("");return i.jsx(lc,{open:e,placement:"center",onOpenChange:f=>!f.open&&t(),children:i.jsxs(u.Portal,{children:[i.jsx(uc,{}),i.jsx(dc,{children:i.jsxs(fc,{maxW:"520px",children:[i.jsx(hc,{borderBottom:"1px solid",borderColor:"red.200",boxShadow:"sm",children:i.jsx(vc,{color:"red.600",children:r})}),i.jsx(gc,{children:i.jsxs(u.Stack,{gap:4,boxShadow:"lg",border:"1px solid gray.200",borderRadius:"md",p:4,children:[i.jsx(u.Box,{border:"1px solid",borderColor:"red.200",bg:"red.50",borderRadius:"md",p:4,children:i.jsxs(u.Stack,{direction:"row",gap:3,align:"flex-start",children:[i.jsx(u.Box,{color:"red.600",mt:"2px",children:i.jsx(Di,{size:20})}),i.jsxs(u.Box,{children:[i.jsx(u.Text,{fontWeight:"semibold",color:"red.700",children:"Are you sure?"}),i.jsxs(u.Text,{fontSize:"sm",color:"red.600",children:["All the data of ",i.jsx("b",{children:o})," will permanently be deleted."]})]})]})}),i.jsx(u.Text,{fontSize:"sm",color:"gray.600",children:"You can’t undo this action afterwards."}),i.jsxs(u.Box,{children:[i.jsxs(u.Text,{fontSize:"sm",mb:1,children:["Type ",i.jsx("b",{children:s})," to continue"]}),i.jsx(u.Input,{placeholder:`Type ${s} here`,value:l,onChange:f=>d(f.target.value),size:"xs"})]})]})}),i.jsxs(pc,{justifyContent:"flex-end",gap:3,borderTop:"1px solid",borderColor:"red.200",boxShadow:"lg",children:[i.jsx(u.Button,{variant:"outline",size:"sm",onClick:t,children:"Cancel"}),i.jsx(u.Button,{size:"sm",style:{backgroundColor:"#FF0000"},loading:c,onClick:n,children:a})]}),i.jsx(mc,{asChild:!0,children:i.jsx(u.CloseButton,{size:"sm"})})]})})]})})}function $r({refetch:e,isLoading:t=!1,label:n="Refresh"}){const[r,o]=g.useState(!1),s=async()=>{o(!0);try{await e()}finally{setTimeout(()=>o(!1),300)}};return i.jsx(u.IconButton,{"aria-label":n,size:"xs",variant:"outline",disabled:t||r,onClick:s,ml:2,children:i.jsx(xi,{size:14,style:{animation:r?"spin 0.6s linear infinite":void 0}})})}var gt={exports:{}},xc=gt.exports,Hn;function yc(){return Hn||(Hn=1,(function(e,t){(function(n,r){e.exports=r()})(xc,(function(){var n=1e3,r=6e4,o=36e5,s="millisecond",a="second",c="minute",l="hour",d="day",f="week",h="month",y="quarter",v="year",m="date",b="Invalid Date",x=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,S=/\[([^\]]+)]|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,_={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(I){var R=["th","st","nd","rd"],D=I%100;return"["+I+(R[(D-20)%10]||R[D]||R[0])+"]"}},j=function(I,R,D){var M=String(I);return!M||M.length>=R?I:""+Array(R+1-M.length).join(D)+I},O={s:j,z:function(I){var R=-I.utcOffset(),D=Math.abs(R),M=Math.floor(D/60),T=D%60;return(R<=0?"+":"-")+j(M,2,"0")+":"+j(T,2,"0")},m:function I(R,D){if(R.date()<D.date())return-I(D,R);var M=12*(D.year()-R.year())+(D.month()-R.month()),T=R.clone().add(M,h),N=D-T<0,P=R.clone().add(M+(N?-1:1),h);return+(-(M+(D-T)/(N?T-P:P-T))||0)},a:function(I){return I<0?Math.ceil(I)||0:Math.floor(I)},p:function(I){return{M:h,y:v,w:f,d,D:m,h:l,m:c,s:a,ms:s,Q:y}[I]||String(I||"").toLowerCase().replace(/s$/,"")},u:function(I){return I===void 0}},k="en",E={};E[k]=_;var $="$isDayjsObject",A=function(I){return I instanceof K||!(!I||!I[$])},H=function I(R,D,M){var T;if(!R)return k;if(typeof R=="string"){var N=R.toLowerCase();E[N]&&(T=N),D&&(E[N]=D,T=N);var P=R.split("-");if(!T&&P.length>1)return I(P[0])}else{var p=R.name;E[p]=R,T=p}return!M&&T&&(k=T),T||!M&&k},B=function(I,R){if(A(I))return I.clone();var D=typeof R=="object"?R:{};return D.date=I,D.args=arguments,new K(D)},L=O;L.l=H,L.i=A,L.w=function(I,R){return B(I,{locale:R.$L,utc:R.$u,x:R.$x,$offset:R.$offset})};var K=(function(){function I(D){this.$L=H(D.locale,null,!0),this.parse(D),this.$x=this.$x||D.x||{},this[$]=!0}var R=I.prototype;return R.parse=function(D){this.$d=(function(M){var T=M.date,N=M.utc;if(T===null)return new Date(NaN);if(L.u(T))return new Date;if(T instanceof Date)return new Date(T);if(typeof T=="string"&&!/Z$/i.test(T)){var P=T.match(x);if(P){var p=P[2]-1||0,C=(P[7]||"0").substring(0,3);return N?new Date(Date.UTC(P[1],p,P[3]||1,P[4]||0,P[5]||0,P[6]||0,C)):new Date(P[1],p,P[3]||1,P[4]||0,P[5]||0,P[6]||0,C)}}return new Date(T)})(D),this.init()},R.init=function(){var D=this.$d;this.$y=D.getFullYear(),this.$M=D.getMonth(),this.$D=D.getDate(),this.$W=D.getDay(),this.$H=D.getHours(),this.$m=D.getMinutes(),this.$s=D.getSeconds(),this.$ms=D.getMilliseconds()},R.$utils=function(){return L},R.isValid=function(){return this.$d.toString()!==b},R.isSame=function(D,M){var T=B(D);return this.startOf(M)<=T&&T<=this.endOf(M)},R.isAfter=function(D,M){return B(D)<this.startOf(M)},R.isBefore=function(D,M){return this.endOf(M)<B(D)},R.$g=function(D,M,T){return L.u(D)?this[M]:this.set(T,D)},R.unix=function(){return Math.floor(this.valueOf()/1e3)},R.valueOf=function(){return this.$d.getTime()},R.startOf=function(D,M){var T=this,N=!!L.u(M)||M,P=L.p(D),p=function(q,Y){var se=L.w(T.$u?Date.UTC(T.$y,Y,q):new Date(T.$y,Y,q),T);return N?se:se.endOf(d)},C=function(q,Y){return L.w(T.toDate()[q].apply(T.toDate("s"),(N?[0,0,0,0]:[23,59,59,999]).slice(Y)),T)},z=this.$W,F=this.$M,U=this.$D,G="set"+(this.$u?"UTC":"");switch(P){case v:return N?p(1,0):p(31,11);case h:return N?p(1,F):p(0,F+1);case f:var V=this.$locale().weekStart||0,X=(z<V?z+7:z)-V;return p(N?U-X:U+(6-X),F);case d:case m:return C(G+"Hours",0);case l:return C(G+"Minutes",1);case c:return C(G+"Seconds",2);case a:return C(G+"Milliseconds",3);default:return this.clone()}},R.endOf=function(D){return this.startOf(D,!1)},R.$set=function(D,M){var T,N=L.p(D),P="set"+(this.$u?"UTC":""),p=(T={},T[d]=P+"Date",T[m]=P+"Date",T[h]=P+"Month",T[v]=P+"FullYear",T[l]=P+"Hours",T[c]=P+"Minutes",T[a]=P+"Seconds",T[s]=P+"Milliseconds",T)[N],C=N===d?this.$D+(M-this.$W):M;if(N===h||N===v){var z=this.clone().set(m,1);z.$d[p](C),z.init(),this.$d=z.set(m,Math.min(this.$D,z.daysInMonth())).$d}else p&&this.$d[p](C);return this.init(),this},R.set=function(D,M){return this.clone().$set(D,M)},R.get=function(D){return this[L.p(D)]()},R.add=function(D,M){var T,N=this;D=Number(D);var P=L.p(M),p=function(F){var U=B(N);return L.w(U.date(U.date()+Math.round(F*D)),N)};if(P===h)return this.set(h,this.$M+D);if(P===v)return this.set(v,this.$y+D);if(P===d)return p(1);if(P===f)return p(7);var C=(T={},T[c]=r,T[l]=o,T[a]=n,T)[P]||1,z=this.$d.getTime()+D*C;return L.w(z,this)},R.subtract=function(D,M){return this.add(-1*D,M)},R.format=function(D){var M=this,T=this.$locale();if(!this.isValid())return T.invalidDate||b;var N=D||"YYYY-MM-DDTHH:mm:ssZ",P=L.z(this),p=this.$H,C=this.$m,z=this.$M,F=T.weekdays,U=T.months,G=T.meridiem,V=function(Y,se,ne,he){return Y&&(Y[se]||Y(M,N))||ne[se].slice(0,he)},X=function(Y){return L.s(p%12||12,Y,"0")},q=G||function(Y,se,ne){var he=Y<12?"AM":"PM";return ne?he.toLowerCase():he};return N.replace(S,(function(Y,se){return se||(function(ne){switch(ne){case"YY":return String(M.$y).slice(-2);case"YYYY":return L.s(M.$y,4,"0");case"M":return z+1;case"MM":return L.s(z+1,2,"0");case"MMM":return V(T.monthsShort,z,U,3);case"MMMM":return V(U,z);case"D":return M.$D;case"DD":return L.s(M.$D,2,"0");case"d":return String(M.$W);case"dd":return V(T.weekdaysMin,M.$W,F,2);case"ddd":return V(T.weekdaysShort,M.$W,F,3);case"dddd":return F[M.$W];case"H":return String(p);case"HH":return L.s(p,2,"0");case"h":return X(1);case"hh":return X(2);case"a":return q(p,C,!0);case"A":return q(p,C,!1);case"m":return String(C);case"mm":return L.s(C,2,"0");case"s":return String(M.$s);case"ss":return L.s(M.$s,2,"0");case"SSS":return L.s(M.$ms,3,"0");case"Z":return P}return null})(Y)||P.replace(":","")}))},R.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},R.diff=function(D,M,T){var N,P=this,p=L.p(M),C=B(D),z=(C.utcOffset()-this.utcOffset())*r,F=this-C,U=function(){return L.m(P,C)};switch(p){case v:N=U()/12;break;case h:N=U();break;case y:N=U()/3;break;case f:N=(F-z)/6048e5;break;case d:N=(F-z)/864e5;break;case l:N=F/o;break;case c:N=F/r;break;case a:N=F/n;break;default:N=F}return T?N:L.a(N)},R.daysInMonth=function(){return this.endOf(h).$D},R.$locale=function(){return E[this.$L]},R.locale=function(D,M){if(!D)return this.$L;var T=this.clone(),N=H(D,M,!0);return N&&(T.$L=N),T},R.clone=function(){return L.w(this.$d,this)},R.toDate=function(){return new Date(this.valueOf())},R.toJSON=function(){return this.isValid()?this.toISOString():null},R.toISOString=function(){return this.$d.toISOString()},R.toString=function(){return this.$d.toUTCString()},I})(),ee=K.prototype;return B.prototype=ee,[["$ms",s],["$s",a],["$m",c],["$H",l],["$W",d],["$M",h],["$y",v],["$D",m]].forEach((function(I){ee[I[1]]=function(R){return this.$g(R,I[0],I[1])}})),B.extend=function(I,R){return I.$i||(I(R,K,B),I.$i=!0),B},B.locale=H,B.isDayjs=A,B.unix=function(I){return B(1e3*I)},B.en=E[k],B.Ls=E,B.p={},B}))})(gt)),gt.exports}var Sc=yc();const Mt=Dt(Sc);var pt={exports:{}},wc=pt.exports,Vn;function Dc(){return Vn||(Vn=1,(function(e,t){(function(n,r){e.exports=r()})(wc,(function(){return function(n,r,o){n=n||{};var s=r.prototype,a={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 c(d,f,h,y){return s.fromToBase(d,f,h,y)}o.en.relativeTime=a,s.fromToBase=function(d,f,h,y,v){for(var m,b,x,S=h.$locale().relativeTime||a,_=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"}],j=_.length,O=0;O<j;O+=1){var k=_[O];k.d&&(m=y?o(d).diff(h,k.d,!0):h.diff(d,k.d,!0));var E=(n.rounding||Math.round)(Math.abs(m));if(x=m>0,E<=k.r||!k.r){E<=1&&O>0&&(k=_[O-1]);var $=S[k.l];v&&(E=v(""+E)),b=typeof $=="string"?$.replace("%d",E):$(E,f,k.l,x);break}}if(f)return b;var A=x?S.future:S.past;return typeof A=="function"?A(b):A.replace("%s",b)},s.to=function(d,f){return c(d,f,this,!0)},s.from=function(d,f){return c(d,f,this)};var l=function(d){return d.$u?o.utc():o()};s.toNow=function(d){return this.to(l(this),d)},s.fromNow=function(d){return this.from(l(this),d)}}}))})(pt)),pt.exports}var Cc=Dc();const Rc=Dt(Cc);var vt={exports:{}},Tc=vt.exports,Wn;function Ec(){return Wn||(Wn=1,(function(e,t){(function(n,r){e.exports=r()})(Tc,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,o,s){var a=o.prototype,c=a.format;s.en.formats=n,a.format=function(l){l===void 0&&(l="YYYY-MM-DDTHH:mm:ssZ");var d=this.$locale().formats,f=(function(h,y){return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(v,m,b){var x=b&&b.toUpperCase();return m||y[b]||n[b]||y[x].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(S,_,j){return _||j.slice(1)}))}))})(l,d===void 0?{}:d);return c.call(this,f)}}}))})(vt)),vt.exports}var jc=Ec();const Mc=Dt(jc);var mt={exports:{}},_c=mt.exports,Un;function Oc(){return Un||(Un=1,(function(e,t){(function(n,r){e.exports=r()})(_c,(function(){return function(n,r){var o=r.prototype,s=o.format;o.format=function(a){var c=this,l=this.$locale();if(!this.isValid())return s.bind(this)(a);var d=this.$utils(),f=(a||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(h){switch(h){case"Q":return Math.ceil((c.$M+1)/3);case"Do":return l.ordinal(c.$D);case"gggg":return c.weekYear();case"GGGG":return c.isoWeekYear();case"wo":return l.ordinal(c.week(),"W");case"w":case"ww":return d.s(c.week(),h==="w"?1:2,"0");case"W":case"WW":return d.s(c.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return d.s(String(c.$H===0?24:c.$H),h==="k"?1:2,"0");case"X":return Math.floor(c.$d.getTime()/1e3);case"x":return c.$d.getTime();case"z":return"["+c.offsetName()+"]";case"zzz":return"["+c.offsetName("long")+"]";default:return h}}));return s.bind(this)(f)}}}))})(mt)),mt.exports}var kc=Oc();const $c=Dt(kc);Mt.extend(Rc);Mt.extend(Mc);Mt.extend($c);const Ic={date:"DD MMM YYYY",time:"hh:mm A",dateTime:"DD MMM YYYY, hh:mm A",full:"dddd, DD MMM YYYY, hh:mm A",short:"DD/MM/YY",relative:""};function Jt({value:e,variant:t="dateTime",format:n,fallback:r="--"}){if(!e)return r;const o=Mt(e);return o.isValid()?t==="relative"?o.fromNow():o.format(n??Ic[t]):r}function Ac({value:e,dateVariant:t="date",timeVariant:n="time",dateFormat:r,timeFormat:o,align:s="start"}){return i.jsxs(u.Stack,{gap:.5,align:s,children:[i.jsx(u.Text,{fontSize:"sm",fontWeight:"500",children:Jt({value:e,variant:t,format:r})}),i.jsx(u.Text,{fontSize:"xs",color:"gray.500",children:Jt({value:e,variant:n,format:o})})]})}exports.DataTable=na;exports.Filters=sc;exports.MDSButton=cc;exports.MDSCheckbox=Er;exports.MDSConfirmDeleteDialog=bc;exports.MDSInput=Kt;exports.MDSRefreshButton=$r;exports.MDSSelectBox=jr;exports.RefreshButton=$r;exports.StackedDateTime=Ac;exports.addPreset=_r;exports.deletePreset=Or;exports.formatDateTime=Jt;exports.getPresets=rt;exports.loadOrder=ac;exports.presetStore=Ze;exports.saveOrder=ic;exports.savePresets=jt;exports.setActionsConfig=Tr;exports.setData=Cr;exports.setTableId=Rr;exports.tableStore=ie;exports.updatePreset=La;exports.withChildren=w;
10
+ `},vo={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 mo(e){let{announcements:t=vo,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=po}=e;const{announce:s,announcement:a}=fo(),c=nt("DndLiveRegion"),[l,d]=g.useState(!1);if(g.useEffect(()=>{d(!0)},[]),ho(g.useMemo(()=>({onDragStart(h){let{active:y}=h;s(t.onDragStart({active:y}))},onDragMove(h){let{active:y,over:v}=h;t.onDragMove&&s(t.onDragMove({active:y,over:v}))},onDragOver(h){let{active:y,over:v}=h;s(t.onDragOver({active:y,over:v}))},onDragEnd(h){let{active:y,over:v}=h;s(t.onDragEnd({active:y,over:v}))},onDragCancel(h){let{active:y,over:v}=h;s(t.onDragCancel({active:y,over:v}))}}),[s,t])),!l)return null;const f=g.createElement(g.Fragment,null,g.createElement(lo,{id:r,value:o.draggable}),g.createElement(uo,{id:c,announcement:a}));return n?Ue.createPortal(f,n):f}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 St(){}function bo(e,t){return g.useMemo(()=>({sensor:e,options:{}}),[e,t])}function xo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const pe=Object.freeze({x:0,y:0});function yo(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function So(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function wo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Do(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function jn(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=jn(t,t.left,t.top),s=[];for(const a of r){const{id:c}=a,l=n.get(c);if(l){const d=yo(jn(l),o);s.push({id:c,data:{droppableContainer:a,value:d}})}}return s.sort(So)};function Co(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),a=o-r,c=s-n;if(r<o&&n<s){const l=t.width*t.height,d=e.width*e.height,f=a*c,h=f/(l+d-f);return Number(h.toFixed(4))}return 0}const Ro=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const s of r){const{id:a}=s,c=n.get(a);if(c){const l=Co(c,t);l>0&&o.push({id:a,data:{droppableContainer:s,value:l}})}}return o.sort(wo)};function To(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function er(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:pe}function Eo(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];return o.reduce((a,c)=>({...a,top:a.top+e*c.y,bottom:a.bottom+e*c.y,left:a.left+e*c.x,right:a.right+e*c.x}),{...n})}}const jo=Eo(1);function Mo(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 _o(e,t,n){const r=Mo(t);if(!r)return e;const{scaleX:o,scaleY:s,x:a,y:c}=r,l=e.left-a-(1-o)*parseFloat(n),d=e.top-c-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),f=o?e.width/o:e.width,h=s?e.height/s:e.height;return{width:f,height:h,top:d,right:l+f,bottom:d+h,left:l}}const Oo={ignoreTransform:!1};function Ne(e,t){t===void 0&&(t=Oo);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:f}=ae(e).getComputedStyle(e);d&&(n=_o(n,d,f))}const{top:r,left:o,width:s,height:a,bottom:c,right:l}=n;return{top:r,left:o,width:s,height:a,bottom:c,right:l}}function Mn(e){return Ne(e,{ignoreTransform:!0})}function ko(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function $o(e,t){return t===void 0&&(t=ae(e).getComputedStyle(e)),t.position==="fixed"}function Io(e,t){t===void 0&&(t=ae(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const s=t[o];return typeof s=="string"?n.test(s):!1})}function nn(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(Qt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!et(o)||Kn(o)||n.includes(o))return n;const s=ae(e).getComputedStyle(o);return o!==e&&Io(o,s)&&n.push(o),$o(o,s)?n:r(o.parentNode)}return e?r(e):n}function tr(e){const[t]=nn(e,1);return t??null}function Pt(e){return!Ct||!e?null:Ae(e)?e:Zt(e)?Qt(e)||e===Le(e).scrollingElement?window:et(e)?e:null:null}function nr(e){return Ae(e)?e.scrollX:e.scrollLeft}function rr(e){return Ae(e)?e.scrollY:e.scrollTop}function Gt(e){return{x:nr(e),y:rr(e)}}var Q;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Q||(Q={}));function or(e){return!Ct||!e?!1:e===document.scrollingElement}function sr(e){const t={x:0,y:0},n=or(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,c=e.scrollLeft>=r.x;return{isTop:o,isLeft:s,isBottom:a,isRight:c,maxScroll:r,minScroll:t}}const Ao={x:.2,y:.2};function Lo(e,t,n,r,o){let{top:s,left:a,right:c,bottom:l}=n;r===void 0&&(r=10),o===void 0&&(o=Ao);const{isTop:d,isBottom:f,isLeft:h,isRight:y}=sr(e),v={x:0,y:0},m={x:0,y:0},b={height:t.height*o.y,width:t.width*o.x};return!d&&s<=t.top+b.height?(v.y=Q.Backward,m.y=r*Math.abs((t.top+b.height-s)/b.height)):!f&&l>=t.bottom-b.height&&(v.y=Q.Forward,m.y=r*Math.abs((t.bottom-b.height-l)/b.height)),!y&&c>=t.right-b.width?(v.x=Q.Forward,m.x=r*Math.abs((t.right-b.width-c)/b.width)):!h&&a<=t.left+b.width&&(v.x=Q.Backward,m.x=r*Math.abs((t.left+b.width-a)/b.width)),{direction:v,speed:m}}function No(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:a}=window;return{top:0,left:0,right:s,bottom:a,width:s,height:a}}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 ir(e){return e.reduce((t,n)=>$e(t,Gt(n)),pe)}function zo(e){return e.reduce((t,n)=>t+nr(n),0)}function Po(e){return e.reduce((t,n)=>t+rr(n),0)}function Yo(e,t){if(t===void 0&&(t=Ne),!e)return;const{top:n,left:r,bottom:o,right:s}=t(e);tr(e)&&(o<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Fo=[["x",["left","right"],zo],["y",["top","bottom"],Po]];class rn{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=nn(n),o=ir(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,a,c]of Fo)for(const l of a)Object.defineProperty(this,l,{get:()=>{const d=c(r),f=o[s]-d;return this.rect[l]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ge{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Bo(e){const{EventTarget:t}=ae(e);return e instanceof t?e:Le(e)}function Yt(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var fe;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(fe||(fe={}));function _n(e){e.preventDefault()}function Ho(e){e.stopPropagation()}var W;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(W||(W={}));const ar={start:[W.Space,W.Enter],cancel:[W.Esc],end:[W.Space,W.Enter,W.Tab]},Vo=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case W.Right:return{...n,x:n.x+25};case W.Left:return{...n,x:n.x-25};case W.Down:return{...n,y:n.y+25};case W.Up:return{...n,y:n.y-25}}};class cr{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Ge(Le(n)),this.windowListeners=new Ge(ae(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(fe.Resize,this.handleCancel),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(fe.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Yo(r),n(pe)}handleKeyDown(t){if(tn(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=ar,coordinateGetter:a=Vo,scrollBehavior:c="smooth"}=o,{code:l}=t;if(s.end.includes(l)){this.handleEnd(t);return}if(s.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:d}=r.current,f=d?{x:d.left,y:d.top}:pe;this.referenceCoordinates||(this.referenceCoordinates=f);const h=a(t,{active:n,context:r.current,currentCoordinates:f});if(h){const y=yt(h,f),v={x:0,y:0},{scrollableAncestors:m}=r.current;for(const b of m){const x=t.code,{isTop:S,isRight:_,isLeft:j,isBottom:O,maxScroll:k,minScroll:E}=sr(b),$=No(b),A={x:Math.min(x===W.Right?$.right-$.width/2:$.right,Math.max(x===W.Right?$.left:$.left+$.width/2,h.x)),y:Math.min(x===W.Down?$.bottom-$.height/2:$.bottom,Math.max(x===W.Down?$.top:$.top+$.height/2,h.y))},H=x===W.Right&&!_||x===W.Left&&!j,B=x===W.Down&&!O||x===W.Up&&!S;if(H&&A.x!==h.x){const L=b.scrollLeft+y.x,K=x===W.Right&&L<=k.x||x===W.Left&&L>=E.x;if(K&&!y.y){b.scrollTo({left:L,behavior:c});return}K?v.x=b.scrollLeft-L:v.x=x===W.Right?b.scrollLeft-k.x:b.scrollLeft-E.x,v.x&&b.scrollBy({left:-v.x,behavior:c});break}else if(B&&A.y!==h.y){const L=b.scrollTop+y.y,K=x===W.Down&&L<=k.y||x===W.Up&&L>=E.y;if(K&&!y.x){b.scrollTo({top:L,behavior:c});return}K?v.y=b.scrollTop-L:v.y=x===W.Down?b.scrollTop-k.y:b.scrollTop-E.y,v.y&&b.scrollBy({top:-v.y,behavior:c});break}}this.handleMove(t,$e(yt(h,this.referenceCoordinates),v))}}}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()}}cr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=ar,onActivation:o}=t,{active:s}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const c=s.activatorNode.current;return c&&e.target!==c?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function On(e){return!!(e&&"distance"in e)}function kn(e){return!!(e&&"delay"in e)}class on{constructor(t,n,r){var o;r===void 0&&(r=Bo(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:s}=t,{target:a}=s;this.props=t,this.events=n,this.document=Le(a),this.documentListeners=new Ge(this.document),this.listeners=new Ge(r),this.windowListeners=new Ge(ae(a)),this.initialCoordinates=(o=Ut(s))!=null?o:pe,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(fe.Resize,this.handleCancel),this.windowListeners.add(fe.DragStart,_n),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),this.windowListeners.add(fe.ContextMenu,_n),this.documentListeners.add(fe.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(kn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(On(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(fe.Click,Ho,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(fe.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:s}=this,{onMove:a,options:{activationConstraint:c}}=s;if(!o)return;const l=(n=Ut(t))!=null?n:pe,d=yt(o,l);if(!r&&c){if(On(c)){if(c.tolerance!=null&&Yt(d,c.tolerance))return this.handleCancel();if(Yt(d,c.distance))return this.handleStart()}if(kn(c)&&Yt(d,c.tolerance))return this.handleCancel();this.handlePending(c,d);return}t.cancelable&&t.preventDefault(),a(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===W.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Wo={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class sn extends on{constructor(t){const{event:n}=t,r=Le(n.target);super(t,Wo,r)}}sn.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 Uo={move:{name:"mousemove"},end:{name:"mouseup"}};var Xt;(function(e){e[e.RightClick=2]="RightClick"})(Xt||(Xt={}));class Go extends on{constructor(t){super(t,Uo,Le(t.event.target))}}Go.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Xt.RightClick?!1:(r?.({event:n}),!0)}}];const Ft={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Xo extends on{constructor(t){super(t,Ft)}static setup(){return window.addEventListener(Ft.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Ft.move.name,t)};function t(){}}}Xo.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 Xe;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Xe||(Xe={}));var wt;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(wt||(wt={}));function qo(e){let{acceleration:t,activator:n=Xe.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:a=5,order:c=wt.TreeOrder,pointerCoordinates:l,scrollableAncestors:d,scrollableAncestorRects:f,delta:h,threshold:y}=e;const v=Jo({delta:h,disabled:!s}),[m,b]=oo(),x=g.useRef({x:0,y:0}),S=g.useRef({x:0,y:0}),_=g.useMemo(()=>{switch(n){case Xe.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Xe.DraggableRect:return o}},[n,o,l]),j=g.useRef(null),O=g.useCallback(()=>{const E=j.current;if(!E)return;const $=x.current.x*S.current.x,A=x.current.y*S.current.y;E.scrollBy($,A)},[]),k=g.useMemo(()=>c===wt.TreeOrder?[...d].reverse():d,[c,d]);g.useEffect(()=>{if(!s||!d.length||!_){b();return}for(const E of k){if(r?.(E)===!1)continue;const $=d.indexOf(E),A=f[$];if(!A)continue;const{direction:H,speed:B}=Lo(E,A,_,t,y);for(const L of["x","y"])v[L][H[L]]||(B[L]=0,H[L]=0);if(B.x>0||B.y>0){b(),j.current=E,m(O,a),x.current=B,S.current=H;return}}x.current={x:0,y:0},S.current={x:0,y:0},b()},[t,O,r,b,s,a,JSON.stringify(_),JSON.stringify(v),m,d,k,f,JSON.stringify(y)])}const Ko={x:{[Q.Backward]:!1,[Q.Forward]:!1},y:{[Q.Backward]:!1,[Q.Forward]:!1}};function Jo(e){let{delta:t,disabled:n}=e;const r=Wt(t);return tt(o=>{if(n||!r||!o)return Ko;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Q.Backward]:o.x[Q.Backward]||s.x===-1,[Q.Forward]:o.x[Q.Forward]||s.x===1},y:{[Q.Backward]:o.y[Q.Backward]||s.y===-1,[Q.Forward]:o.y[Q.Forward]||s.y===1}}},[n,t,r])}function Zo(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return tt(o=>{var s;return t==null?null:(s=r??o)!=null?s:null},[r,t])}function Qo(e,t){return g.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,s=o.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...s]},[]),[e,t])}var Je;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Je||(Je={}));var qt;(function(e){e.Optimized="optimized"})(qt||(qt={}));const $n=new Map;function es(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,a]=g.useState(null),{frequency:c,measure:l,strategy:d}=o,f=g.useRef(e),h=x(),y=Ke(h),v=g.useCallback(function(S){S===void 0&&(S=[]),!y.current&&a(_=>_===null?S:_.concat(S.filter(j=>!_.includes(j))))},[y]),m=g.useRef(null),b=tt(S=>{if(h&&!n)return $n;if(!S||S===$n||f.current!==e||s!=null){const _=new Map;for(let j of e){if(!j)continue;if(s&&s.length>0&&!s.includes(j.id)&&j.rect.current){_.set(j.id,j.rect.current);continue}const O=j.node.current,k=O?new rn(l(O),O):null;j.rect.current=k,k&&_.set(j.id,k)}return _}return S},[e,s,n,h,l]);return g.useEffect(()=>{f.current=e},[e]),g.useEffect(()=>{h||v()},[n,h]),g.useEffect(()=>{s&&s.length>0&&a(null)},[JSON.stringify(s)]),g.useEffect(()=>{h||typeof c!="number"||m.current!==null||(m.current=setTimeout(()=>{v(),m.current=null},c))},[c,h,v,...r]),{droppableRects:b,measureDroppableContainers:v,measuringScheduled:s!=null};function x(){switch(d){case Je.Always:return!1;case Je.BeforeDragging:return n;default:return!n}}}function lr(e,t){return tt(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function ts(e,t){return lr(e,t)}function ns(e){let{callback:t,disabled:n}=e;const r=en(t),o=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return g.useEffect(()=>()=>o?.disconnect(),[o]),o}function Rt(e){let{callback:t,disabled:n}=e;const r=en(t),o=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return g.useEffect(()=>()=>o?.disconnect(),[o]),o}function rs(e){return new rn(Ne(e),e)}function In(e,t,n){t===void 0&&(t=rs);const[r,o]=g.useState(null);function s(){o(l=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=l??n)!=null?d:null}const f=t(e);return JSON.stringify(l)===JSON.stringify(f)?l:f})}const a=ns({callback(l){if(e)for(const d of l){const{type:f,target:h}=d;if(f==="childList"&&h instanceof HTMLElement&&h.contains(e)){s();break}}}}),c=Rt({callback:s});return be(()=>{s(),e?(c?.observe(e),a?.observe(document.body,{childList:!0,subtree:!0})):(c?.disconnect(),a?.disconnect())},[e]),r}function os(e){const t=lr(e);return er(e,t)}const An=[];function ss(e){const t=g.useRef(e),n=tt(r=>e?r&&r!==An&&e&&t.current&&e.parentNode===t.current.parentNode?r:nn(e):An,[e]);return g.useEffect(()=>{t.current=e},[e]),n}function is(e){const[t,n]=g.useState(null),r=g.useRef(e),o=g.useCallback(s=>{const a=Pt(s.target);a&&n(c=>c?(c.set(a,Gt(a)),new Map(c)):null)},[]);return g.useEffect(()=>{const s=r.current;if(e!==s){a(s);const c=e.map(l=>{const d=Pt(l);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,Gt(d)]):null}).filter(l=>l!=null);n(c.length?new Map(c):null),r.current=e}return()=>{a(e),a(s)};function a(c){c.forEach(l=>{const d=Pt(l);d?.removeEventListener("scroll",o)})}},[o,e]),g.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,a)=>$e(s,a),pe):ir(e):pe,[e,t])}function Ln(e,t){t===void 0&&(t=[]);const n=g.useRef(null);return g.useEffect(()=>{n.current=null},t),g.useEffect(()=>{const r=e!==pe;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?yt(e,n.current):pe}function as(e){g.useEffect(()=>{if(!Ct)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 cs(e,t){return g.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:s}=r;return n[o]=a=>{s(a,t)},n},{}),[e,t])}function ur(e){return g.useMemo(()=>e?ko(e):null,[e])}const Nn=[];function ls(e,t){t===void 0&&(t=Ne);const[n]=e,r=ur(n?ae(n):null),[o,s]=g.useState(Nn);function a(){s(()=>e.length?e.map(l=>or(l)?r:new rn(t(l),l)):Nn)}const c=Rt({callback:a});return be(()=>{c?.disconnect(),a(),e.forEach(l=>c?.observe(l))},[e]),o}function us(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return et(t)?t:e}function ds(e){let{measure:t}=e;const[n,r]=g.useState(null),o=g.useCallback(d=>{for(const{target:f}of d)if(et(f)){r(h=>{const y=t(f);return h?{...h,width:y.width,height:y.height}:y});break}},[t]),s=Rt({callback:o}),a=g.useCallback(d=>{const f=us(d);s?.disconnect(),f&&s?.observe(f),r(f?t(f):null)},[t,s]),[c,l]=xt(a);return g.useMemo(()=>({nodeRef:c,rect:n,setRef:l}),[n,c,l])}const fs=[{sensor:sn,options:{}},{sensor:cr,options:{}}],hs={current:{}},ht={draggable:{measure:Mn},droppable:{measure:Mn,strategy:Je.WhileDragging,frequency:qt.Optimized},dragOverlay:{measure:Ne}};class qe 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 gs={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new qe,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:St},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ht,measureDroppableContainers:St,windowRect:null,measuringScheduled:!1},ps={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:St,draggableNodes:new Map,over:null,measureDroppableContainers:St},Tt=g.createContext(ps),dr=g.createContext(gs);function vs(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new qe}}}function ms(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 qe(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,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const a=new qe(e.droppable.containers);return a.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case Z.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new qe(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function bs(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=g.useContext(Tt),s=Wt(r),a=Wt(n?.id);return g.useEffect(()=>{if(!t&&!r&&s&&a!=null){if(!tn(s)||document.activeElement===s.target)return;const c=o.get(a);if(!c)return;const{activatorNode:l,node:d}=c;if(!l.current&&!d.current)return;requestAnimationFrame(()=>{for(const f of[l.current,d.current]){if(!f)continue;const h=ao(f);if(h){h.focus();break}}})}},[r,t,o,a,s]),null}function xs(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,s)=>s({transform:o,...r}),n):n}function ys(e){return g.useMemo(()=>({draggable:{...ht.draggable,...e?.draggable},droppable:{...ht.droppable,...e?.droppable},dragOverlay:{...ht.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ss(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const s=g.useRef(!1),{x:a,y:c}=typeof o=="boolean"?{x:o,y:o}:o;be(()=>{if(!a&&!c||!t){s.current=!1;return}if(s.current||!r)return;const d=t?.node.current;if(!d||d.isConnected===!1)return;const f=n(d),h=er(f,r);if(a||(h.x=0),c||(h.y=0),s.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const y=tr(d);y&&y.scrollBy({top:h.y,left:h.x})}},[t,a,c,r,n])}const fr=g.createContext({...pe,scaleX:1,scaleY:1});var Te;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Te||(Te={}));const hr=g.memo(function(t){var n,r,o,s;let{id:a,accessibility:c,autoScroll:l=!0,children:d,sensors:f=fs,collisionDetection:h=Ro,measuring:y,modifiers:v,...m}=t;const b=g.useReducer(ms,void 0,vs),[x,S]=b,[_,j]=go(),[O,k]=g.useState(Te.Uninitialized),E=O===Te.Initialized,{draggable:{active:$,nodes:A,translate:H},droppable:{containers:B}}=x,L=$!=null?A.get($):null,K=g.useRef({initial:null,translated:null}),ee=g.useMemo(()=>{var re;return $!=null?{id:$,data:(re=L?.data)!=null?re:hs,rect:K}:null},[$,L]),I=g.useRef(null),[R,D]=g.useState(null),[M,T]=g.useState(null),N=Ke(m,Object.values(m)),P=nt("DndDescribedBy",a),p=g.useMemo(()=>B.getEnabled(),[B]),C=ys(y),{droppableRects:z,measureDroppableContainers:F,measuringScheduled:U}=es(p,{dragging:E,dependencies:[H.x,H.y],config:C.droppable}),G=Zo(A,$),V=g.useMemo(()=>M?Ut(M):null,[M]),X=Fr(),q=ts(G,C.draggable.measure);Ss({activeNode:$!=null?A.get($):null,config:X.layoutShiftCompensation,initialRect:q,measure:C.draggable.measure});const Y=In(G,C.draggable.measure,q),se=In(G?G.parentElement:null),ne=g.useRef({activatorEvent:null,active:null,activeNode:G,collisionRect:null,collisions:null,droppableRects:z,draggableNodes:A,draggingNode:null,draggingNodeRect:null,droppableContainers:B,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),he=B.getNodeFor((n=ne.current.over)==null?void 0:n.id),xe=ds({measure:C.dragOverlay.measure}),je=(r=xe.nodeRef.current)!=null?r:G,Me=E?(o=xe.rect)!=null?o:Y:null,cn=!!(xe.nodeRef.current&&xe.rect),ln=os(cn?null:Y),_t=ur(je?ae(je):null),Se=ss(E?he??G:null),ot=ls(Se),st=xs(v,{transform:{x:H.x-ln.x,y:H.y-ln.y,scaleX:1,scaleY:1},activatorEvent:M,active:ee,activeNodeRect:Y,containerNodeRect:se,draggingNodeRect:Me,over:ne.current.over,overlayNodeRect:xe.rect,scrollableAncestors:Se,scrollableAncestorRects:ot,windowRect:_t}),un=V?$e(V,H):null,dn=is(Se),Ir=Ln(dn),Ar=Ln(dn,[Y]),_e=$e(st,Ir),Oe=Me?jo(Me,st):null,ze=ee&&Oe?h({active:ee,collisionRect:Oe,droppableRects:z,droppableContainers:p,pointerCoordinates:un}):null,fn=Do(ze,"id"),[we,hn]=g.useState(null),Lr=cn?st:$e(st,Ar),Nr=To(Lr,(s=we?.rect)!=null?s:null,Y),Ot=g.useRef(null),gn=g.useCallback((re,ce)=>{let{sensor:le,options:De}=ce;if(I.current==null)return;const de=A.get(I.current);if(!de)return;const ue=re.nativeEvent,ve=new le({active:I.current,activeNode:de,event:ue,options:De,context:ne,onAbort(te){if(!A.get(te))return;const{onDragAbort:me}=N.current,ye={id:te};me?.(ye),_({type:"onDragAbort",event:ye})},onPending(te,Ce,me,ye){if(!A.get(te))return;const{onDragPending:Ye}=N.current,Re={id:te,constraint:Ce,initialCoordinates:me,offset:ye};Ye?.(Re),_({type:"onDragPending",event:Re})},onStart(te){const Ce=I.current;if(Ce==null)return;const me=A.get(Ce);if(!me)return;const{onDragStart:ye}=N.current,Pe={activatorEvent:ue,active:{id:Ce,data:me.data,rect:K}};Ue.unstable_batchedUpdates(()=>{ye?.(Pe),k(Te.Initializing),S({type:Z.DragStart,initialCoordinates:te,active:Ce}),_({type:"onDragStart",event:Pe}),D(Ot.current),T(ue)})},onMove(te){S({type:Z.DragMove,coordinates:te})},onEnd:ke(Z.DragEnd),onCancel:ke(Z.DragCancel)});Ot.current=ve;function ke(te){return async function(){const{active:me,collisions:ye,over:Pe,scrollAdjustedTranslate:Ye}=ne.current;let Re=null;if(me&&Ye){const{cancelDrop:Fe}=N.current;Re={activatorEvent:ue,active:me,collisions:ye,delta:Ye,over:Pe},te===Z.DragEnd&&typeof Fe=="function"&&await Promise.resolve(Fe(Re))&&(te=Z.DragCancel)}I.current=null,Ue.unstable_batchedUpdates(()=>{S({type:te}),k(Te.Uninitialized),hn(null),D(null),T(null),Ot.current=null;const Fe=te===Z.DragEnd?"onDragEnd":"onDragCancel";if(Re){const kt=N.current[Fe];kt?.(Re),_({type:Fe,event:Re})}})}}},[A]),zr=g.useCallback((re,ce)=>(le,De)=>{const de=le.nativeEvent,ue=A.get(De);if(I.current!==null||!ue||de.dndKit||de.defaultPrevented)return;const ve={active:ue};re(le,ce.options,ve)===!0&&(de.dndKit={capturedBy:ce.sensor},I.current=De,gn(le,ce))},[A,gn]),pn=Qo(f,zr);as(f),be(()=>{Y&&O===Te.Initializing&&k(Te.Initialized)},[Y,O]),g.useEffect(()=>{const{onDragMove:re}=N.current,{active:ce,activatorEvent:le,collisions:De,over:de}=ne.current;if(!ce||!le)return;const ue={active:ce,activatorEvent:le,collisions:De,delta:{x:_e.x,y:_e.y},over:de};Ue.unstable_batchedUpdates(()=>{re?.(ue),_({type:"onDragMove",event:ue})})},[_e.x,_e.y]),g.useEffect(()=>{const{active:re,activatorEvent:ce,collisions:le,droppableContainers:De,scrollAdjustedTranslate:de}=ne.current;if(!re||I.current==null||!ce||!de)return;const{onDragOver:ue}=N.current,ve=De.get(fn),ke=ve&&ve.rect.current?{id:ve.id,rect:ve.rect.current,data:ve.data,disabled:ve.disabled}:null,te={active:re,activatorEvent:ce,collisions:le,delta:{x:de.x,y:de.y},over:ke};Ue.unstable_batchedUpdates(()=>{hn(ke),ue?.(te),_({type:"onDragOver",event:te})})},[fn]),be(()=>{ne.current={activatorEvent:M,active:ee,activeNode:G,collisionRect:Oe,collisions:ze,droppableRects:z,draggableNodes:A,draggingNode:je,draggingNodeRect:Me,droppableContainers:B,over:we,scrollableAncestors:Se,scrollAdjustedTranslate:_e},K.current={initial:Me,translated:Oe}},[ee,G,ze,Oe,A,je,Me,z,B,we,Se,_e]),qo({...X,delta:H,draggingRect:Oe,pointerCoordinates:un,scrollableAncestors:Se,scrollableAncestorRects:ot});const Pr=g.useMemo(()=>({active:ee,activeNode:G,activeNodeRect:Y,activatorEvent:M,collisions:ze,containerNodeRect:se,dragOverlay:xe,draggableNodes:A,droppableContainers:B,droppableRects:z,over:we,measureDroppableContainers:F,scrollableAncestors:Se,scrollableAncestorRects:ot,measuringConfiguration:C,measuringScheduled:U,windowRect:_t}),[ee,G,Y,M,ze,se,xe,A,B,z,we,F,Se,ot,C,U,_t]),Yr=g.useMemo(()=>({activatorEvent:M,activators:pn,active:ee,activeNodeRect:Y,ariaDescribedById:{draggable:P},dispatch:S,draggableNodes:A,over:we,measureDroppableContainers:F}),[M,pn,ee,Y,S,P,A,we,F]);return g.createElement(Zn.Provider,{value:j},g.createElement(Tt.Provider,{value:Yr},g.createElement(dr.Provider,{value:Pr},g.createElement(fr.Provider,{value:Nr},d)),g.createElement(bs,{disabled:c?.restoreFocus===!1})),g.createElement(mo,{...c,hiddenTextDescribedById:P}));function Fr(){const re=R?.autoScrollEnabled===!1,ce=typeof l=="object"?l.enabled===!1:l===!1,le=E&&!re&&!ce;return typeof l=="object"?{...l,enabled:le}:{enabled:le}}}),ws=g.createContext(null),zn="button",Ds="Draggable";function Cs(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=nt(Ds),{activators:a,activatorEvent:c,active:l,activeNodeRect:d,ariaDescribedById:f,draggableNodes:h,over:y}=g.useContext(Tt),{role:v=zn,roleDescription:m="draggable",tabIndex:b=0}=o??{},x=l?.id===t,S=g.useContext(x?fr:ws),[_,j]=xt(),[O,k]=xt(),E=cs(a,t),$=Ke(n);be(()=>(h.set(t,{id:t,key:s,node:_,activatorNode:O,data:$}),()=>{const H=h.get(t);H&&H.key===s&&h.delete(t)}),[h,t]);const A=g.useMemo(()=>({role:v,tabIndex:b,"aria-disabled":r,"aria-pressed":x&&v===zn?!0:void 0,"aria-roledescription":m,"aria-describedby":f.draggable}),[r,v,b,x,m,f.draggable]);return{active:l,activatorEvent:c,activeNodeRect:d,attributes:A,isDragging:x,listeners:r?void 0:E,node:_,over:y,setNodeRef:j,setActivatorNodeRef:k,transform:S}}function Rs(){return g.useContext(dr)}const Ts="Droppable",Es={timeout:25};function js(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=nt(Ts),{active:a,dispatch:c,over:l,measureDroppableContainers:d}=g.useContext(Tt),f=g.useRef({disabled:n}),h=g.useRef(!1),y=g.useRef(null),v=g.useRef(null),{disabled:m,updateMeasurementsFor:b,timeout:x}={...Es,...o},S=Ke(b??r),_=g.useCallback(()=>{if(!h.current){h.current=!0;return}v.current!=null&&clearTimeout(v.current),v.current=setTimeout(()=>{d(Array.isArray(S.current)?S.current:[S.current]),v.current=null},x)},[x]),j=Rt({callback:_,disabled:m||!a}),O=g.useCallback((A,H)=>{j&&(H&&(j.unobserve(H),h.current=!1),A&&j.observe(A))},[j]),[k,E]=xt(O),$=Ke(t);return g.useEffect(()=>{!j||!k.current||(j.disconnect(),h.current=!1,j.observe(k.current))},[k,j]),g.useEffect(()=>(c({type:Z.RegisterDroppable,element:{id:r,key:s,disabled:n,node:k,rect:y,data:$}}),()=>c({type:Z.UnregisterDroppable,key:s,id:r})),[r]),g.useEffect(()=>{n!==f.current.disabled&&(c({type:Z.SetDroppableDisabled,id:r,key:s,disabled:n}),f.current.disabled=n)},[r,s,n,c]),{active:a,rect:y,isOver:l?.id===r,node:k,over:l,setNodeRef:E}}function Et(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Ms(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function ut(e){return e!==null&&e>=0}function _s(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 Os(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const dt={scaleX:1,scaleY:1},ks=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:s,index:a}=e;const c=(t=n[o])!=null?t:r;if(!c)return null;const l=$s(n,a,o);if(a===o){const d=n[s];return d?{x:o<s?d.left+d.width-(c.left+c.width):d.left-c.left,y:0,...dt}:null}return a>o&&a<=s?{x:-c.width-l,y:0,...dt}:a<o&&a>=s?{x:c.width+l,y:0,...dt}:{x:0,y:0,...dt}};function $s(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return!r||!o&&!s?0:n<t?o?r.left-(o.left+o.width):s.left-(r.left+r.width):s?s.left-(r.left+r.width):r.left-(o.left+o.width)}const gr=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const s=Et(t,r,n),a=t[o],c=s[o];return!c||!a?null:{x:c.left-a.left,y:c.top-a.top,scaleX:c.width/a.width,scaleY:c.height/a.height}},ft={scaleX:1,scaleY:1},Is=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:s,overIndex:a}=e;const c=(t=s[n])!=null?t:r;if(!c)return null;if(o===n){const d=s[a];return d?{x:0,y:n<a?d.top+d.height-(c.top+c.height):d.top-c.top,...ft}:null}const l=As(s,o,n);return o>n&&o<=a?{x:0,y:-c.height-l,...ft}:o<n&&o>=a?{x:0,y:c.height+l,...ft}:{x:0,y:0,...ft}};function As(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return r?n<t?o?r.top-(o.top+o.height):s?s.top-(r.top+r.height):0:s?s.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const pr="Sortable",vr=g.createContext({activeIndex:-1,containerId:pr,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:gr,disabled:{draggable:!1,droppable:!1}});function mr(e){let{children:t,id:n,items:r,strategy:o=gr,disabled:s=!1}=e;const{active:a,dragOverlay:c,droppableRects:l,over:d,measureDroppableContainers:f}=Rs(),h=nt(pr,n),y=c.rect!==null,v=g.useMemo(()=>r.map(E=>typeof E=="object"&&"id"in E?E.id:E),[r]),m=a!=null,b=a?v.indexOf(a.id):-1,x=d?v.indexOf(d.id):-1,S=g.useRef(v),_=!_s(v,S.current),j=x!==-1&&b===-1||_,O=Os(s);be(()=>{_&&m&&f(v)},[_,v,m,f]),g.useEffect(()=>{S.current=v},[v]);const k=g.useMemo(()=>({activeIndex:b,containerId:h,disabled:O,disableTransforms:j,items:v,overIndex:x,useDragOverlay:y,sortedRects:Ms(v,l),strategy:o}),[b,h,O.draggable,O.droppable,j,v,x,l,y,o]);return g.createElement(vr.Provider,{value:k},t)}const Ls=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Et(n,r,o).indexOf(t)},Ns=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:s,newIndex:a,previousItems:c,previousContainerId:l,transition:d}=e;return!d||!r||c!==s&&o===a?!1:n?!0:a!==o&&t===l},zs={duration:200,easing:"ease"},br="transform",Ps=Ie.Transition.toString({property:br,duration:0,easing:"linear"}),Ys={roleDescription:"sortable"};function Fs(e){let{disabled:t,index:n,node:r,rect:o}=e;const[s,a]=g.useState(null),c=g.useRef(n);return be(()=>{if(!t&&n!==c.current&&r.current){const l=o.current;if(l){const d=Ne(r.current,{ignoreTransform:!0}),f={x:l.left-d.left,y:l.top-d.top,scaleX:l.width/d.width,scaleY:l.height/d.height};(f.x||f.y)&&a(f)}}n!==c.current&&(c.current=n)},[t,n,r,o]),g.useEffect(()=>{s&&a(null)},[s]),s}function xr(e){let{animateLayoutChanges:t=Ns,attributes:n,disabled:r,data:o,getNewIndex:s=Ls,id:a,strategy:c,resizeObserverConfig:l,transition:d=zs}=e;const{items:f,containerId:h,activeIndex:y,disabled:v,disableTransforms:m,sortedRects:b,overIndex:x,useDragOverlay:S,strategy:_}=g.useContext(vr),j=Bs(r,v),O=f.indexOf(a),k=g.useMemo(()=>({sortable:{containerId:h,index:O,items:f},...o}),[h,o,O,f]),E=g.useMemo(()=>f.slice(f.indexOf(a)),[f,a]),{rect:$,node:A,isOver:H,setNodeRef:B}=js({id:a,data:k,disabled:j.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...l}}),{active:L,activatorEvent:K,activeNodeRect:ee,attributes:I,setNodeRef:R,listeners:D,isDragging:M,over:T,setActivatorNodeRef:N,transform:P}=Cs({id:a,data:k,attributes:{...Ys,...n},disabled:j.draggable}),p=ro(B,R),C=!!L,z=C&&!m&&ut(y)&&ut(x),F=!S&&M,U=F&&z?P:null,V=z?U??(c??_)({rects:b,activeNodeRect:ee,activeIndex:y,overIndex:x,index:O}):null,X=ut(y)&&ut(x)?s({id:a,items:f,activeIndex:y,overIndex:x}):O,q=L?.id,Y=g.useRef({activeId:q,items:f,newIndex:X,containerId:h}),se=f!==Y.current.items,ne=t({active:L,containerId:h,isDragging:M,isSorting:C,id:a,index:O,items:f,newIndex:Y.current.newIndex,previousItems:Y.current.items,previousContainerId:Y.current.containerId,transition:d,wasDragging:Y.current.activeId!=null}),he=Fs({disabled:!ne,index:O,node:A,rect:$});return g.useEffect(()=>{C&&Y.current.newIndex!==X&&(Y.current.newIndex=X),h!==Y.current.containerId&&(Y.current.containerId=h),f!==Y.current.items&&(Y.current.items=f)},[C,X,h,f]),g.useEffect(()=>{if(q===Y.current.activeId)return;if(q!=null&&Y.current.activeId==null){Y.current.activeId=q;return}const je=setTimeout(()=>{Y.current.activeId=q},50);return()=>clearTimeout(je)},[q]),{active:L,activeIndex:y,attributes:I,data:k,rect:$,index:O,newIndex:X,items:f,isOver:H,isSorting:C,isDragging:M,listeners:D,node:A,overIndex:x,over:T,setNodeRef:p,setActivatorNodeRef:N,setDroppableNodeRef:B,setDraggableNodeRef:R,transform:he??V,transition:xe()};function xe(){if(he||se&&Y.current.newIndex===O)return Ps;if(!(F&&!tn(K)||!d)&&(C||ne))return Ie.Transition.toString({...d,property:br})}}function Bs(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}W.Down,W.Right,W.Up,W.Left;const Hs=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Vs=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Pn=e=>{const t=Vs(e);return t.charAt(0).toUpperCase()+t.slice(1)},yr=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),Ws=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var Us={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 Gs=g.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:a,...c},l)=>g.createElement("svg",{ref:l,...Us,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:yr("lucide",o),...!s&&!Ws(c)&&{"aria-hidden":"true"},...c},[...a.map(([d,f])=>g.createElement(d,f)),...Array.isArray(s)?s:[s]]));const oe=(e,t)=>{const n=g.forwardRef(({className:r,...o},s)=>g.createElement(Gs,{ref:s,iconNode:t,className:yr(`lucide-${Hs(Pn(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Pn(e),n};const Xs=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],qs=oe("arrow-down",Xs);const Ks=[["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"}]],Js=oe("arrow-up-down",Ks);const Zs=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Qs=oe("arrow-up",Zs);const ei=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],ti=oe("bookmark",ei);const ni=[["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"}]],Yn=oe("calendar",ni);const ri=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],oi=oe("chevron-left",ri);const si=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ii=oe("chevron-right",si);const ai=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],ci=oe("columns-2",ai);const li=[["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"}]],ui=oe("delete",li);const di=[["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"}]],fi=oe("ellipsis",di);const hi=[["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"}]],gi=oe("funnel",hi);const pi=[["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"}]],Sr=oe("grip-vertical",pi);const vi=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],mi=oe("pen",vi);const bi=[["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"}]],xi=oe("refresh-ccw",bi);const yi=[["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"}]],Si=oe("settings",yi);const wi=[["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"}]],Di=oe("triangle-alert",wi);function w(e){return g.forwardRef((t,n)=>{const{children:r,...o}=t;return i.jsx(e,{ref:n,...o,children:r})})}const wr=e=>`table_column_order_v1:${e}`,Dr=e=>`table_column_visibility_v1:${e}`,Ci=e=>{const{tableId:t}=ie.state;localStorage.setItem(wr(t),JSON.stringify(e.map(n=>n.id))),ie.setState(n=>({...n,columnOrder:e})),ie.setState(n=>({...n,columnOrder:e}))};function Ri(e){ie.setState(t=>t.sortColumn===e?{...t,sortDirection:t.sortDirection==="asc"?"desc":"asc"}:{...t,sortColumn:e,sortDirection:"asc"})}const Ti=e=>{ie.setState(t=>{const n={...t.visibility,[e]:!t.visibility[e]};return t.tableId&&localStorage.setItem(Dr(t.tableId),JSON.stringify(n)),{...t,visibility:n}})},ie=new qn({tableId:"",sortColumn:null,sortDirection:"asc",visibility:{},columnOrder:[],data:[],sortableColumns:[],actionsConfig:{showActionColumn:!0,showColumnVisibilityMenu:!0,children:"Actions",width:"100px"}});function Cr(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:s}=ie.state,a=JSON.parse(localStorage.getItem(wr(s))||"[]"),c=[...a.map(f=>o.find(h=>h.id===f)).filter(Boolean),...o.filter(f=>!a.includes(f.id))],l=JSON.parse(localStorage.getItem(Dr(s))||"{}"),d=c.reduce((f,h)=>(f[h.id]=l[h.id]??!0,f),{});ie.setState(f=>({...f,data:e,columnOrder:c,visibility:d,sortableColumns:c.map(h=>({id:h.id,label:h.label,sortable:!0,backgroundColor:h.backgroundColor}))}))}function Rr(e){ie.setState(t=>({...t,tableId:e}))}const Tr=e=>{ie.setState(t=>({...t,actionsConfig:e}))},Ei=w(u.Menu.Trigger),ji=w(u.Menu.Positioner),Mi=w(u.Menu.Content),_i=w(u.Menu.Item),Oi=w(u.Checkbox.Label),ki=w(u.Checkbox.HiddenInput),$i=w(u.Checkbox.Control);function Ii({visibility:e,onToggle:t}){const{sortableColumns:n}=Qe(ie);return i.jsxs(u.Menu.Root,{closeOnSelect:!1,children:[i.jsx(Ei,{asChild:!0,children:i.jsx(u.IconButton,{"aria-label":"Toggle columns",variant:"ghost",ml:"1",size:"xs",children:i.jsx(ci,{size:18})})}),i.jsx(u.Portal,{children:i.jsx(ji,{children:i.jsx(Mi,{minW:"220px",children:n.map(r=>{const o=!!e[r.id];return i.jsx(_i,{value:r.id,closeOnSelect:!1,children:i.jsxs(u.Checkbox.Root,{checked:o,onCheckedChange:()=>t(r.id),children:[i.jsx(ki,{}),i.jsx($i,{}),i.jsx(Oi,{children:r.label})]})},r.id)})})})})]})}function Ai({id:e,children:t,onClick:n,cursor:r,borderRight:o,borderRightColor:s,backgroundColor:a}){const{setNodeRef:c,attributes:l,listeners:d,transform:f,transition:h}=xr({id:e});return i.jsx(u.Table.ColumnHeader,{ref:c,onClick:n,backgroundColor:a,w:e==="id"?"80px":void 0,style:{transform:Ie.Transform.toString(f),transition:h,cursor:r,borderRight:o,borderRightColor:s},...l,children:i.jsxs(u.HStack,{justify:"space-between",children:[t,i.jsx("span",{...d,children:i.jsx(Sr,{size:12})})]})})}function Li(){const{columnOrder:e,visibility:t,sortColumn:n,sortDirection:r,sortableColumns:o,actionsConfig:s}=Qe(ie),a=e.map(l=>o.find(d=>d.id===l.id)).filter(l=>l!==void 0).filter(l=>t[l.id]),c=l=>{const{active:d,over:f}=l;if(!f||d.id===f.id)return;const h=e.findIndex(m=>m.id===d.id),y=e.findIndex(m=>m.id===f.id),v=Et(e,h,y);Ci(v)};return i.jsx(u.Table.Header,{background:"blue.200",position:"sticky",top:0,p:"0",zIndex:1,children:i.jsx(hr,{collisionDetection:Qn,onDragEnd:c,children:i.jsx(mr,{items:e.map(l=>l.id),strategy:ks,children:i.jsxs(u.Table.Row,{height:"28px",children:[a.map(l=>{const d=n===l?.id;return i.jsx(Ai,{id:l?.id,onClick:()=>l?.sortable&&Ri(l?.id),cursor:l?.sortable?"pointer":"default",borderRight:"2px solid #dcdcdc",backgroundColor:l?.backgroundColor,children:i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,userSelect:"none"},children:[l?.label,l?.sortable&&(d?r==="asc"?i.jsx(Qs,{size:14}):i.jsx(qs,{size:14}):i.jsx(Js,{size:14,opacity:.4}))]})},l?.id)}),s?.showActionColumn&&i.jsx(u.Table.ColumnHeader,{width:s.width,backgroundColor:s.backgroundColor,borderRight:"2px solid #dcdcdc",children:s.children}),s?.showColumnVisibilityMenu&&i.jsx(u.Table.ColumnHeader,{boxSize:"0.5",backgroundColor:s.backgroundColorColumnVisibilityMenu,children:i.jsx(Ii,{visibility:t,onToggle:Ti})})]})})})})}const Ni=[10,20,50,100],zi=w(u.Select.Positioner),Pi=w(u.Select.Content),Yi=w(u.Select.Item),Fi=w(u.Pagination.PrevTrigger),Bi=w(u.Pagination.NextTrigger),Hi=w(u.Select.HiddenSelect),Vi=w(u.Select.Control),Wi=w(u.Select.Trigger),Ui=w(u.Select.ValueText),Gi=w(u.Select.IndicatorGroup),Xi=w(u.Select.Indicator);function qi({totalCount:e,pageSize:t,currentPage:n,onPageChange:r,onPageSizeChange:o,siblingCount:s=2,pageSizeOptions:a=Ni}){const c=u.createListCollection({items:a.map(l=>({label:String(l),value:String(l)}))});return i.jsx(u.Box,{width:"100%",children:i.jsxs(u.HStack,{justify:"space-between",mx:"auto",flexWrap:"wrap",children:[i.jsxs(u.HStack,{children:[i.jsx(u.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:"Rows per page:"}),i.jsxs(u.Select.Root,{collection:c,size:"sm",width:"60px",onValueChange:l=>o?.(Number(l.items[0].value)),value:[String(t)],children:[i.jsx(Hi,{}),i.jsxs(Vi,{children:[i.jsx(Wi,{children:i.jsx(Ui,{placeholder:""})}),i.jsx(Gi,{children:i.jsx(Xi,{})})]}),i.jsx(u.Portal,{children:i.jsx(zi,{children:i.jsx(Pi,{children:c.items.map(l=>i.jsxs(Yi,{item:l.value,children:[l.label,i.jsx(u.Select.ItemIndicator,{})]},l.value))})})})]})]}),i.jsx(u.Pagination.Root,{count:e,pageSize:t,page:n,siblingCount:s,onPageChange:l=>r&&r(l.page),children:i.jsxs(u.ButtonGroup,{size:"sm",variant:"ghost",children:[i.jsx(Fi,{asChild:!0,children:i.jsx(u.IconButton,{"aria-label":"Previous page",children:i.jsx(oi,{size:18})})}),i.jsx(u.Pagination.Items,{render:l=>i.jsx(u.IconButton,{variant:l.type==="page"&&l.value===n?"outline":"ghost","aria-current":l.type==="page"&&l.value===n?"page":void 0,children:l.type==="page"?l.value:"…"},l.value??l.type)}),i.jsx(Bi,{asChild:!0,children:i.jsx(u.IconButton,{"aria-label":"Next page",children:i.jsx(ii,{size:18})})})]})})]})})}const Ki=w(u.Menu.Item),Ji=w(u.Menu.Content),Zi=w(u.Menu.Positioner),Qi=w(u.Menu.Trigger);function ea({data:e=[],actions:t=[]}){const{columnOrder:n,visibility:r}=Qe(ie);return i.jsx(u.Table.Body,{children:e.map(o=>i.jsxs(u.Table.Row,{_hover:{bg:"blue.50"},children:[n.filter(s=>r[s.id]).map(s=>i.jsx(u.Table.Cell,{children:o[s.id]},s.id)),i.jsx(u.Table.Cell,{textAlign:"center",display:"flex",gap:2,children:i.jsxs(u.Menu.Root,{children:[i.jsx(Qi,{asChild:!0,children:i.jsx(u.IconButton,{"aria-label":"Open",variant:"ghost",size:"sm",children:i.jsx(fi,{size:16})})}),i.jsx(u.Portal,{children:i.jsx(Zi,{children:i.jsx(Ji,{children:t.map(s=>i.jsxs(Ki,{onClick:()=>s.onClick(o),colorScheme:s.colorScheme,value:s.label,children:[s.icon,s.label]},s.label))})})})]})}),i.jsx(u.Table.Cell,{})]},o.id))})}function ta({rows:e=6,columns:t}){return i.jsx(u.Table.Body,{children:Array.from({length:e}).map((n,r)=>i.jsx(u.Table.Row,{children:Array.from({length:t}).map((o,s)=>i.jsx(u.Table.Cell,{children:i.jsx(u.Skeleton,{height:"25px"})},s))},r))})}function na({tableId:e,data:t=[],headers:n=[],loading:r=!1,loadingChildren:o,skeletonLoading:s=!1,emptyMessage:a="No data",actions:c,page:l=1,pageSize:d=10,onPageChange:f,onPageSizeChange:h,density:y="sm",totalCount:v=0,paginationMode:m="client",actionConfig:b,pageSizeOptions:x}){g.useEffect(()=>{Rr(e)},[e]),g.useEffect(()=>{Cr(t,n)},[t,n]),g.useEffect(()=>{b&&Tr(b)},[b]);const{sortColumn:S,sortDirection:_,data:j,columnOrder:O}=Qe(ie),k=g.useMemo(()=>{const E=[...j],$=Math.max(1,l||1);if(S&&E.sort((A,H)=>_==="asc"?String(A[S]).localeCompare(String(H[S])):String(H[S]).localeCompare(String(A[S]))),m==="client"){const A=($-1)*d;return E.slice(A,A+d)}return E},[j,S,_,l,d,m]);return g.useEffect(()=>{l<1&&f&&f(1)},[l,f]),i.jsxs(u.Box,{h:"100%",display:"flex",flexDirection:"column",p:2,pt:2,minHeight:0,children:[i.jsx(u.Box,{flex:"1",minHeight:0,overflow:"auto",h:"100%",children:i.jsxs(u.Table.Root,{variant:"outline",w:"100%",size:y,children:[i.jsx(Li,{}),r?i.jsx(u.Table.Body,{children:i.jsx(u.Table.Row,{children:i.jsx(u.Table.Cell,{colSpan:O.length+(c?1:0),children:i.jsx(u.Box,{display:"flex",alignItems:"center",justifyContent:"center",h:"81vh",w:"100%",children:o??"Loading..."})})})}):s?i.jsx(ta,{rows:d,columns:n.length+(c?2:0)}):k.length===0?i.jsx(u.Table.Body,{children:i.jsx(u.Table.Row,{children:i.jsx(u.Table.Cell,{colSpan:n.length+(c?1:0),children:i.jsx(u.Box,{display:"flex",alignItems:"center",justifyContent:"center",minH:"200px",color:"gray.500",children:a})})})}):i.jsx(ea,{data:k,actions:c})]})}),i.jsx(u.Box,{mt:.5,children:i.jsx(qi,{totalCount:v,pageSize:d,currentPage:l,onPageChange:f,onPageSizeChange:E=>{h&&h(E),l>1&&f&&f(1)},pageSizeOptions:x})})]})}const ra=w(u.Checkbox.Root),oa=w(u.Checkbox.HiddenInput),sa=w(u.Checkbox.Control),ia=w(u.Checkbox.Label),Er=({value:e,onChange:t,size:n="sm",label:r,helperText:o,isDisabled:s,required:a,errorText:c})=>i.jsxs(ra,{value:e,onChange:t,size:n,children:[i.jsx(oa,{}),i.jsx(sa,{disabled:s,required:a,errorText:c,helperText:o}),r&&i.jsx(ia,{children:r})]}),J=" to ",Fn=10,Ee={DAY_MAX:31,MONTH_MAX:12,YEAR_MIN:1900,YEAR_MAX:2100},an=()=>{const e=new Date;return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}},Bn=()=>{const{year:e,month:t,day:n}=an();return`${String(n).padStart(2,"0")}-${String(t).padStart(2,"0")}-${e}`},aa=()=>{const{year:e,month:t,day:n}=an();return`${e}-${String(t).padStart(2,"0")}-${String(n).padStart(2,"0")}`},ca=(e,t)=>{const n=e.length,r=parseInt(e);if(!e||isNaN(r))return t;if(n===4)return r>=Ee.YEAR_MIN&&r<=Ee.YEAR_MAX?r:t;if(n>0&&n<4){const o=t.toString(),s=4-n,a=o.substring(0,s);return parseInt(a+e)}return t},Ve=e=>{if(!e?.trim())return null;const n=e.replace(/[^\d-]/g,"").split("-").filter(d=>d!=="");if(n.length===0)return null;const{year:r,month:o,day:s}=an();let a,c,l;return n.length===1?(a=parseInt(n[0])||s,c=o,l=r):n.length===2?(a=parseInt(n[0])||s,c=parseInt(n[1])||o,l=r):(a=parseInt(n[0])||s,c=parseInt(n[1])||o,l=ca(n[2],r)),c=Math.max(1,Math.min(Ee.MONTH_MAX,c)),a=Math.max(1,Math.min(Ee.DAY_MAX,a)),`${l}-${String(c).padStart(2,"0")}-${String(a).padStart(2,"0")}`},ge=e=>{if(!e)return"";const[t,n,r]=e.split("-");return`${r}-${n}-${t}`},la=(e,t)=>{if(e[0]?.length>0){const n=parseInt(e[0]);if(isNaN(n)||n===0||e[0].length===2&&n>Ee.DAY_MAX)return t}if(e[1]?.length>0){const n=parseInt(e[1]);if(isNaN(n)||n===0||e[1].length===2&&n>Ee.MONTH_MAX)return t}if(e[2]?.length>0){const n=parseInt(e[2]),r=e[2].length===4;if(isNaN(n)||n===0||r&&(n<Ee.YEAR_MIN||n>Ee.YEAR_MAX))return t}return null},We=e=>{let t=e.replace(/[^\d-]/g,"").substring(0,Fn);if(t.length>=3&&t[2]!=="-"&&(t=t.substring(0,2)+"-"+t.substring(2).replace(/-/g,"")),t.length>=6&&t[5]!=="-"){const o=t.split("-");o.length>=2&&(t=`${o[0]}-${o[1].substring(0,2)}-${o[1].substring(2)}${o[2]||""}`)}const n=t.split("-");return n[0]=n[0]?.substring(0,2)||"",n[1]=n[1]?.substring(0,2)||"",n[2]=n[2]?.substring(0,4)||"",t=n.filter(o=>o!=="").join("-"),t=t.substring(0,Fn),la(n,e)||t},ua=w(u.Popover.Root),da=w(u.Popover.Trigger),fa=w(u.Popover.Content),ha=w(u.Popover.Positioner);function ga({value:e,onChange:t,disabled:n=!1}){const[r="",o=""]=e?e.split("|"):[],[s,a]=g.useState(()=>r&&o?`${ge(r)}${J}${ge(o)}`:r?ge(r):""),[c,l]=g.useState(!1),d=g.useRef(null);g.useEffect(()=>{const m=b=>{b.ctrlKey&&b.key==="d"&&!b.shiftKey&&!b.metaKey&&(b.preventDefault(),d.current?.focus())};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[]);const f=m=>{let b=m;if(b.includes(J)){const[x,S=""]=b.split(J);b=`${We(x.trim())}${J}${We(S.trim())}`}else if(b.toLowerCase().includes(" to ")){const[x,S=""]=b.split(/\s+to\s+/i);b=`${We(x.trim())} to ${We(S.trim())}`}else b=We(b);a(b)},h=()=>{const m=s.trim();if(!m){t(void 0);return}if(m.includes(J)){const[b,x=""]=m.split(J).map(j=>j.trim()),S=Ve(b),_=x?Ve(x):null;if(S&&_){const[j,O]=_<S?[_,S]:[S,_],k=`${ge(j)}${J}${ge(O)}`;a(k),t(`${j}|${O}`)}else if(S&&!x)a(`${ge(S)}${J}`),t(void 0);else if(S&&x){const j=aa(),[O,k]=j<S?[j,S]:[S,j],E=`${ge(O)}${J}${ge(k)}`;a(E),t(`${O}|${k}`)}else a(""),t(void 0)}else{const b=Ve(m);b?(a(`${ge(b)}${J}`),t(void 0)):(a(""),t(void 0))}},y=m=>{if(m.key!=="Enter")return;m.preventDefault();const b=d.current?.selectionStart||0,x=s.indexOf(J);if(!s.trim()){a(`${Bn()}${J}`);return}if(x===-1){const _=Ve(s.trim());_&&a(`${ge(_)}${J}`);return}if(b<=x+J.length){const _=s.substring(0,x).trim(),j=s.substring(x+J.length),O=Ve(_);O&&a(`${ge(O)}${J}${j}`);return}if(s.substring(x+J.length).trim())h(),d.current?.blur();else{const _=s.substring(0,x+J.length)+Bn();a(_),setTimeout(()=>{h(),d.current?.blur()},0)}},v=()=>{a(""),t(void 0)};return i.jsx(u.InputGroup,{children:i.jsx(i.Fragment,{children:i.jsxs(u.InputElement,{position:"revert",children:[i.jsxs(ua,{open:c,onEscapeKeyDown:()=>{l(!1)},children:[i.jsx(da,{asChild:!0,children:i.jsx(u.IconButton,{size:"sm",variant:"ghost","aria-label":"Date range help",onClick:()=>l(m=>!m),children:i.jsx(Yn,{size:16})})}),i.jsx(u.Portal,{children:i.jsx(ha,{children:i.jsxs(fa,{p:4,children:[i.jsx(u.PopoverArrow,{}),i.jsxs(u.VStack,{align:"start",gap:4,children:[i.jsxs(u.HStack,{children:[i.jsx(Yn,{size:16}),i.jsx(u.Text,{fontWeight:"semibold",fontSize:"sm",children:"Date Range Filter"})]}),i.jsxs(u.VStack,{align:"start",gap:1,children:[i.jsx(u.Text,{fontSize:"sm",fontWeight:"medium",children:"Format:"}),i.jsxs(u.Text,{fontSize:"xs",color:"gray.600",children:["DD-MM-YYYY",J,"DD-MM-YYYY"]})]}),i.jsxs(u.VStack,{align:"start",gap:1,children:[i.jsx(u.Text,{fontSize:"sm",fontWeight:"medium",children:"Tips:"}),i.jsx(u.Text,{fontSize:"xs",children:'• "15 to 20" → assumes current month/year'}),i.jsx(u.Text,{fontSize:"xs",children:"• Leave end blank → up to today"}),i.jsx(u.Text,{fontSize:"xs",children:"• Dates auto-swapped if reversed"}),i.jsx(u.Text,{fontSize:"xs",children:"• Press Enter on empty end → fills today"})]}),i.jsxs(u.VStack,{align:"start",gap:1,children:[i.jsx(u.Text,{fontSize:"sm",fontWeight:"medium",children:"Shortcut:"}),i.jsxs(u.HStack,{children:[i.jsx(u.Kbd,{children:"Ctrl"}),i.jsx(u.Text,{children:"+"}),i.jsx(u.Kbd,{children:"D"})]})]})]})]})})})]}),i.jsx(u.Input,{ref:d,placeholder:"15-06-2025 to 20-06-2025",value:s,size:"sm",disabled:n,onChange:m=>f(m.target.value),onBlur:h,onKeyDown:y,pr:s?"10":void 0,w:"100%"}),s&&i.jsx(u.InputElement,{children:i.jsx(u.IconButton,{size:"sm",variant:"ghost","aria-label":"Clear date range",onClick:v,w:"100%"})})]})})})}const pa=w(u.Field.Root),va=w(u.Field.Label),ma=w(u.Field.HelperText),ba=w(u.Field.ErrorText),Kt=({icon:e,value:t,onChange:n,placeholder:r,size:o="xs",variant:s="outline",width:a="100%",label:c,helperText:l,isDisabled:d=!1,required:f=!1,errorText:h,visible:y})=>i.jsxs(pa,{width:a,children:[y&&i.jsx(va,{children:c}),i.jsx(u.InputGroup,{startElement:e,children:i.jsx(u.Input,{value:t,onChange:v=>n?.(v.target.value),placeholder:r,size:o,variant:s,disabled:d,required:f})}),h&&i.jsx(ba,{fontSize:"xs",children:h}),l&&i.jsx(ma,{fontSize:"xs",children:l})]}),xa=w(u.Field.Root),ya=w(u.Field.HelperText),Sa=w(u.Field.ErrorText),wa=w(u.Select.Root),Da=w(u.Select.Label),Ca=w(u.Select.Control),Ra=w(u.Select.Trigger),Ta=w(u.Select.ValueText),Ea=w(u.Select.IndicatorGroup),ja=w(u.Select.Indicator),Ma=w(u.Select.Content),_a=w(u.Select.Item),Oa=w(u.Select.ItemIndicator),ka=w(u.Select.HiddenSelect),$a=w(u.Select.Positioner),jr=({options:e=[],label:t,value:n,onChange:r,placeholder:o,size:s="xs",width:a="100%",variant:c="outline",helperText:l,isDisabled:d,required:f,errorText:h,visible:y})=>{const v=u.createListCollection({items:e});return i.jsxs(xa,{disabled:d,required:f,children:[i.jsxs(wa,{collection:v,variant:c,size:s,width:a,value:n?[n]:[],onValueChange:m=>r?.(m.value[0]),children:[i.jsx(ka,{}),y&&i.jsx(Da,{children:t}),i.jsxs(Ca,{children:[i.jsx(Ra,{children:i.jsx(Ta,{placeholder:o})}),i.jsx(Ea,{children:i.jsx(ja,{})})]}),i.jsx($a,{children:i.jsx(Ma,{children:v.items.map(m=>i.jsxs(_a,{item:m,children:[m.label,i.jsx(Oa,{})]},m.value))})})]}),l&&i.jsx(ya,{children:l}),h&&i.jsx(Sa,{children:h})]})},Mr=(e="default")=>`FILTER_PRESETS_${e}`,Ia=e=>{if(!e)return[];try{return JSON.parse(e)}catch{return[]}},Aa=e=>typeof window>"u"?[]:Ia(localStorage.getItem(Mr(e))),Ze=new qn({}),rt=e=>{const t=Ze.state;if(e in t)return t[e];const n=Aa(e);return Ze.setState(r=>({...r,[e]:n})),n},jt=(e,t)=>{Ze.setState(n=>({...n,[e]:t})),typeof window<"u"&&localStorage.setItem(Mr(e),JSON.stringify(t))},_r=(e,t)=>{const n=[t,...rt(e)];jt(e,n)},Or=(e,t)=>{const n=rt(e).filter(r=>r.id!==t);jt(e,n)},La=(e,t,n)=>{const r=rt(e).map(o=>o.id===t?n(o):o);jt(e,r)},Na=w(u.Checkbox.Root),za=w(u.Checkbox.HiddenInput),Pa=w(u.Checkbox.Control),Ya=w(u.Slider.Root),Fa=w(u.Slider.Track),Ba=w(u.Slider.Range),Ha=w(u.Slider.Thumbs),Va=w(u.Slider.Control),Wa=({filter:e,onVisibilityChange:t,onSizeChange:n})=>{const{attributes:r,listeners:o,setNodeRef:s,transform:a,transition:c}=xr({id:e.id}),l={transform:Ie.Transform.toString(a),transition:c};return i.jsxs(u.VStack,{ref:s,style:l,align:"stretch",border:"1px solid",borderColor:"gray.200",rounded:"md",p:3,mb:3,bg:"white",children:[i.jsxs(u.HStack,{...r,...o,cursor:"grab",userSelect:"none",gap:2,children:[i.jsx(Sr,{size:16}),i.jsx(u.Text,{fontWeight:"bold",fontSize:"sm",children:e.label||e.id})]}),i.jsxs(u.HStack,{justify:"space-between",children:[i.jsx(u.Text,{fontSize:"sm",children:"Visible"}),i.jsxs(Na,{checked:e.visible,size:"sm",onCheckedChange:d=>t?.(e.id,!!d.checked),children:[i.jsx(za,{}),i.jsx(Pa,{})]})]}),i.jsxs(u.VStack,{align:"stretch",gap:1,children:[i.jsx(u.Text,{fontSize:"sm",children:"Size"}),i.jsx(Ya,{min:1,max:5,step:.5,value:[e.size??1],onValueChange:d=>n?.(e.id,d.value[0]),children:i.jsxs(Va,{children:[i.jsx(Fa,{children:i.jsx(Ba,{})}),i.jsx(Ha,{})]})})]})]})},Ua=w(u.Drawer.Root),Ga=w(u.Drawer.Trigger),Xa=w(u.Drawer.Backdrop),qa=w(u.Drawer.Positioner),Ka=w(u.Drawer.Content),Ja=w(u.Drawer.Header),Za=w(u.Drawer.Title),Qa=w(u.Drawer.Body),ec=w(u.Drawer.Footer),tc=w(u.Drawer.CloseTrigger),nc=w(u.Tabs.Root),rc=w(u.Tabs.List),Bt=w(u.Tabs.Trigger),Ht=w(u.Tabs.Content),kr=(e,t)=>{if(e.customComponent)return e.customComponent;switch(e.type){case"text":return i.jsx(Kt,{placeholder:e.label,value:e.value,onChange:e.onChange,label:e.label,visible:t});case"number":return i.jsx(Kt,{label:e.label,value:e.value,onChange:e.onChange});case"checkbox":return i.jsx(Er,{label:e.label,value:e.value,onChange:e.onChange});case"select":return i.jsx(jr,{label:e.label,value:e.value,onChange:e.onChange,options:e.options??[],visible:t});case"date":return i.jsx(ga,{value:e.value,onChange:e.onChange});default:return null}},oc=({filterDrawerSize:e="sm",onVisibilityChange:t,onSizeChange:n,onClear:r,filters:o,pageKey:s="default",onLoadPreset:a,activePresetName:c,onReorder:l,open:d,onOpenChange:f})=>{const y=Qe(Ze)[s]??rt(s),v=()=>{const m=prompt("Preset name?");if(!m)return;const b=o.reduce((x,S)=>(x[S.id]=S.value,x),{});_r(s,{id:crypto.randomUUID(),name:m,date:new Date().toISOString(),values:b})};return i.jsx(u.HStack,{wrap:"wrap",children:i.jsxs(Ua,{size:e,open:d,onOpenChange:f,children:[i.jsx(Ga,{asChild:!0,children:i.jsxs(u.IconButton,{"aria-label":"Open filters",variant:"outline",size:"xs",ml:2,p:2,children:[i.jsx(gi,{size:16}),"Filters"]})}),i.jsxs(u.Portal,{children:[i.jsx(Xa,{}),i.jsx(qa,{children:i.jsxs(Ka,{children:[i.jsx(Ja,{children:i.jsx(Za,{children:"Filters"})}),i.jsx(Qa,{overflowY:"auto",pt:1,children:i.jsxs(nc,{defaultValue:"view",children:[i.jsxs(rc,{mb:4,children:[i.jsxs(Bt,{value:"view",children:[i.jsx(mi,{size:16}),"Edit"]}),i.jsxs(Bt,{value:"settings",children:[i.jsx(Si,{size:16}),"Settings"]}),i.jsxs(Bt,{value:"presets",children:[i.jsx(ti,{size:16}),"Presets"]})]}),i.jsx(Ht,{value:"view",children:o.filter(m=>m.visible).map(m=>i.jsx(u.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:kr(m,d)},m.id))}),i.jsx(Ht,{value:"settings",children:i.jsx(hr,{sensors:xo(bo(sn)),collisionDetection:Qn,onDragEnd:({active:m,over:b})=>{if(!b||m.id===b.id)return;const x=o.findIndex(j=>j.id===m.id),S=o.findIndex(j=>j.id===b.id),_=Et(o,x,S);l?.(_)},children:i.jsx(mr,{items:o.map(m=>m.id),strategy:Is,children:o.map(m=>i.jsx(Wa,{filter:m,onVisibilityChange:t,onSizeChange:n},m.id))})})}),i.jsx(Ht,{value:"presets",children:i.jsxs(u.VStack,{align:"stretch",mb:3,children:[y.length===0&&i.jsx(u.Text,{fontSize:"xs",color:"gray.500",children:"No presets saved yet."}),y.map(m=>i.jsxs(u.HStack,{justify:"space-between",border:"1px solid",borderColor:c===m.name?"blue.300":"gray.200",rounded:"md",p:2,children:[i.jsxs(u.VStack,{align:"start",gap:0,children:[i.jsx(u.Text,{fontWeight:"bold",fontSize:"sm",children:m.name}),i.jsx(u.Text,{fontSize:"xs",color:"gray.500",children:new Date(m.date).toLocaleDateString()})]}),i.jsxs(u.HStack,{children:[i.jsx(u.Button,{size:"xs",variant:"ghost",onClick:()=>{const b=o.map(x=>({...x,value:m.values[x.id]??x.value}));a?.(b,m.name)},children:"Load"}),i.jsx(u.IconButton,{size:"xs","aria-label":"Delete preset",variant:"ghost",onClick:()=>Or(s,m.id),children:i.jsx(ui,{size:14})})]})]},m.id)),i.jsx(u.Button,{size:"sm",colorScheme:"blue",onClick:v,children:"Save Current Filters"})]})})]})}),i.jsx(ec,{justify:"space-between",children:i.jsx(tc,{asChild:!0,children:i.jsx(u.CloseButton,{})})})]})})]})]})})},sc=({title:e,filters:t,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:a,pageKey:c,onLoadPreset:l,activePresetName:d,filterDrawerSize:f="sm"})=>{const[h,y]=g.useState(!1);return i.jsxs(u.HStack,{wrap:"wrap",pl:2,pr:2,width:"100%",justify:"space-between",children:[e,i.jsxs(u.HStack,{gapX:1,children:[t.filter(v=>v.visible!==!1).map(v=>i.jsx(u.HStack,{flex:v.size??1,minW:`${(v.size??1)*100}px`,alignItems:"center",children:kr(v)},v.id)),i.jsx(oc,{filterDrawerSize:f,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:a,pageKey:c,filters:t,onLoadPreset:l,activePresetName:d,open:h,onOpenChange:v=>{y(v.open)}})]})]})},ic=(e,t)=>{localStorage.setItem(`FILTER_ORDER_${e}`,JSON.stringify(t))},ac=e=>{try{return JSON.parse(localStorage.getItem(`FILTER_ORDER_${e}`)||"[]")}catch{return[]}},cc=({onClick:e,size:t="xs",variant:n="solid",label:r,leftIcon:o,rightIcon:s,isDisabled:a,colorScheme:c,loading:l,loadingText:d,rounded:f,type:h="button"})=>i.jsx(u.Button,{onClick:e,size:t,variant:n,disabled:a,colorPalette:c,loading:l,loadingText:d,rounded:f,type:h,children:i.jsxs(u.HStack,{gap:1,children:[o,r,s]})}),lc=w(u.Dialog.Root),uc=w(u.Dialog.Backdrop),dc=w(u.Dialog.Positioner),fc=w(u.Dialog.Content),hc=w(u.Dialog.Header),gc=w(u.Dialog.Body),pc=w(u.Dialog.Footer),vc=w(u.Dialog.Title),mc=w(u.Dialog.CloseTrigger);function bc({open:e,onClose:t,onConfirm:n,title:r="Delete Company",entityName:o,confirmText:s="DELETE",confirmLabel:a="Delete",isLoading:c=!1}){const[l,d]=g.useState("");return i.jsx(lc,{open:e,placement:"center",onOpenChange:f=>!f.open&&t(),children:i.jsxs(u.Portal,{children:[i.jsx(uc,{}),i.jsx(dc,{children:i.jsxs(fc,{maxW:"520px",children:[i.jsx(hc,{borderBottom:"1px solid",borderColor:"red.200",boxShadow:"sm",children:i.jsx(vc,{color:"red.600",children:r})}),i.jsx(gc,{children:i.jsxs(u.Stack,{gap:4,boxShadow:"lg",border:"1px solid gray.200",borderRadius:"md",p:4,children:[i.jsx(u.Box,{border:"1px solid",borderColor:"red.200",bg:"red.50",borderRadius:"md",p:4,children:i.jsxs(u.Stack,{direction:"row",gap:3,align:"flex-start",children:[i.jsx(u.Box,{color:"red.600",mt:"2px",children:i.jsx(Di,{size:20})}),i.jsxs(u.Box,{children:[i.jsx(u.Text,{fontWeight:"semibold",color:"red.700",children:"Are you sure?"}),i.jsxs(u.Text,{fontSize:"sm",color:"red.600",children:["All the data of ",i.jsx("b",{children:o})," will permanently be deleted."]})]})]})}),i.jsx(u.Text,{fontSize:"sm",color:"gray.600",children:"You can’t undo this action afterwards."}),i.jsxs(u.Box,{children:[i.jsxs(u.Text,{fontSize:"sm",mb:1,children:["Type ",i.jsx("b",{children:s})," to continue"]}),i.jsx(u.Input,{placeholder:`Type ${s} here`,value:l,onChange:f=>d(f.target.value),size:"xs"})]})]})}),i.jsxs(pc,{justifyContent:"flex-end",gap:3,borderTop:"1px solid",borderColor:"red.200",boxShadow:"lg",children:[i.jsx(u.Button,{variant:"outline",size:"sm",onClick:t,children:"Cancel"}),i.jsx(u.Button,{size:"sm",style:{backgroundColor:"#FF0000"},loading:c,onClick:n,children:a})]}),i.jsx(mc,{asChild:!0,children:i.jsx(u.CloseButton,{size:"sm"})})]})})]})})}function $r({refetch:e,isLoading:t=!1,label:n="Refresh"}){const[r,o]=g.useState(!1),s=async()=>{o(!0);try{await e()}finally{setTimeout(()=>o(!1),300)}};return i.jsx(u.IconButton,{"aria-label":n,size:"xs",variant:"outline",disabled:t||r,onClick:s,ml:2,children:i.jsx(xi,{size:14,style:{animation:r?"spin 0.6s linear infinite":void 0}})})}var gt={exports:{}},xc=gt.exports,Hn;function yc(){return Hn||(Hn=1,(function(e,t){(function(n,r){e.exports=r()})(xc,(function(){var n=1e3,r=6e4,o=36e5,s="millisecond",a="second",c="minute",l="hour",d="day",f="week",h="month",y="quarter",v="year",m="date",b="Invalid Date",x=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,S=/\[([^\]]+)]|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,_={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(I){var R=["th","st","nd","rd"],D=I%100;return"["+I+(R[(D-20)%10]||R[D]||R[0])+"]"}},j=function(I,R,D){var M=String(I);return!M||M.length>=R?I:""+Array(R+1-M.length).join(D)+I},O={s:j,z:function(I){var R=-I.utcOffset(),D=Math.abs(R),M=Math.floor(D/60),T=D%60;return(R<=0?"+":"-")+j(M,2,"0")+":"+j(T,2,"0")},m:function I(R,D){if(R.date()<D.date())return-I(D,R);var M=12*(D.year()-R.year())+(D.month()-R.month()),T=R.clone().add(M,h),N=D-T<0,P=R.clone().add(M+(N?-1:1),h);return+(-(M+(D-T)/(N?T-P:P-T))||0)},a:function(I){return I<0?Math.ceil(I)||0:Math.floor(I)},p:function(I){return{M:h,y:v,w:f,d,D:m,h:l,m:c,s:a,ms:s,Q:y}[I]||String(I||"").toLowerCase().replace(/s$/,"")},u:function(I){return I===void 0}},k="en",E={};E[k]=_;var $="$isDayjsObject",A=function(I){return I instanceof K||!(!I||!I[$])},H=function I(R,D,M){var T;if(!R)return k;if(typeof R=="string"){var N=R.toLowerCase();E[N]&&(T=N),D&&(E[N]=D,T=N);var P=R.split("-");if(!T&&P.length>1)return I(P[0])}else{var p=R.name;E[p]=R,T=p}return!M&&T&&(k=T),T||!M&&k},B=function(I,R){if(A(I))return I.clone();var D=typeof R=="object"?R:{};return D.date=I,D.args=arguments,new K(D)},L=O;L.l=H,L.i=A,L.w=function(I,R){return B(I,{locale:R.$L,utc:R.$u,x:R.$x,$offset:R.$offset})};var K=(function(){function I(D){this.$L=H(D.locale,null,!0),this.parse(D),this.$x=this.$x||D.x||{},this[$]=!0}var R=I.prototype;return R.parse=function(D){this.$d=(function(M){var T=M.date,N=M.utc;if(T===null)return new Date(NaN);if(L.u(T))return new Date;if(T instanceof Date)return new Date(T);if(typeof T=="string"&&!/Z$/i.test(T)){var P=T.match(x);if(P){var p=P[2]-1||0,C=(P[7]||"0").substring(0,3);return N?new Date(Date.UTC(P[1],p,P[3]||1,P[4]||0,P[5]||0,P[6]||0,C)):new Date(P[1],p,P[3]||1,P[4]||0,P[5]||0,P[6]||0,C)}}return new Date(T)})(D),this.init()},R.init=function(){var D=this.$d;this.$y=D.getFullYear(),this.$M=D.getMonth(),this.$D=D.getDate(),this.$W=D.getDay(),this.$H=D.getHours(),this.$m=D.getMinutes(),this.$s=D.getSeconds(),this.$ms=D.getMilliseconds()},R.$utils=function(){return L},R.isValid=function(){return this.$d.toString()!==b},R.isSame=function(D,M){var T=B(D);return this.startOf(M)<=T&&T<=this.endOf(M)},R.isAfter=function(D,M){return B(D)<this.startOf(M)},R.isBefore=function(D,M){return this.endOf(M)<B(D)},R.$g=function(D,M,T){return L.u(D)?this[M]:this.set(T,D)},R.unix=function(){return Math.floor(this.valueOf()/1e3)},R.valueOf=function(){return this.$d.getTime()},R.startOf=function(D,M){var T=this,N=!!L.u(M)||M,P=L.p(D),p=function(q,Y){var se=L.w(T.$u?Date.UTC(T.$y,Y,q):new Date(T.$y,Y,q),T);return N?se:se.endOf(d)},C=function(q,Y){return L.w(T.toDate()[q].apply(T.toDate("s"),(N?[0,0,0,0]:[23,59,59,999]).slice(Y)),T)},z=this.$W,F=this.$M,U=this.$D,G="set"+(this.$u?"UTC":"");switch(P){case v:return N?p(1,0):p(31,11);case h:return N?p(1,F):p(0,F+1);case f:var V=this.$locale().weekStart||0,X=(z<V?z+7:z)-V;return p(N?U-X:U+(6-X),F);case d:case m:return C(G+"Hours",0);case l:return C(G+"Minutes",1);case c:return C(G+"Seconds",2);case a:return C(G+"Milliseconds",3);default:return this.clone()}},R.endOf=function(D){return this.startOf(D,!1)},R.$set=function(D,M){var T,N=L.p(D),P="set"+(this.$u?"UTC":""),p=(T={},T[d]=P+"Date",T[m]=P+"Date",T[h]=P+"Month",T[v]=P+"FullYear",T[l]=P+"Hours",T[c]=P+"Minutes",T[a]=P+"Seconds",T[s]=P+"Milliseconds",T)[N],C=N===d?this.$D+(M-this.$W):M;if(N===h||N===v){var z=this.clone().set(m,1);z.$d[p](C),z.init(),this.$d=z.set(m,Math.min(this.$D,z.daysInMonth())).$d}else p&&this.$d[p](C);return this.init(),this},R.set=function(D,M){return this.clone().$set(D,M)},R.get=function(D){return this[L.p(D)]()},R.add=function(D,M){var T,N=this;D=Number(D);var P=L.p(M),p=function(F){var U=B(N);return L.w(U.date(U.date()+Math.round(F*D)),N)};if(P===h)return this.set(h,this.$M+D);if(P===v)return this.set(v,this.$y+D);if(P===d)return p(1);if(P===f)return p(7);var C=(T={},T[c]=r,T[l]=o,T[a]=n,T)[P]||1,z=this.$d.getTime()+D*C;return L.w(z,this)},R.subtract=function(D,M){return this.add(-1*D,M)},R.format=function(D){var M=this,T=this.$locale();if(!this.isValid())return T.invalidDate||b;var N=D||"YYYY-MM-DDTHH:mm:ssZ",P=L.z(this),p=this.$H,C=this.$m,z=this.$M,F=T.weekdays,U=T.months,G=T.meridiem,V=function(Y,se,ne,he){return Y&&(Y[se]||Y(M,N))||ne[se].slice(0,he)},X=function(Y){return L.s(p%12||12,Y,"0")},q=G||function(Y,se,ne){var he=Y<12?"AM":"PM";return ne?he.toLowerCase():he};return N.replace(S,(function(Y,se){return se||(function(ne){switch(ne){case"YY":return String(M.$y).slice(-2);case"YYYY":return L.s(M.$y,4,"0");case"M":return z+1;case"MM":return L.s(z+1,2,"0");case"MMM":return V(T.monthsShort,z,U,3);case"MMMM":return V(U,z);case"D":return M.$D;case"DD":return L.s(M.$D,2,"0");case"d":return String(M.$W);case"dd":return V(T.weekdaysMin,M.$W,F,2);case"ddd":return V(T.weekdaysShort,M.$W,F,3);case"dddd":return F[M.$W];case"H":return String(p);case"HH":return L.s(p,2,"0");case"h":return X(1);case"hh":return X(2);case"a":return q(p,C,!0);case"A":return q(p,C,!1);case"m":return String(C);case"mm":return L.s(C,2,"0");case"s":return String(M.$s);case"ss":return L.s(M.$s,2,"0");case"SSS":return L.s(M.$ms,3,"0");case"Z":return P}return null})(Y)||P.replace(":","")}))},R.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},R.diff=function(D,M,T){var N,P=this,p=L.p(M),C=B(D),z=(C.utcOffset()-this.utcOffset())*r,F=this-C,U=function(){return L.m(P,C)};switch(p){case v:N=U()/12;break;case h:N=U();break;case y:N=U()/3;break;case f:N=(F-z)/6048e5;break;case d:N=(F-z)/864e5;break;case l:N=F/o;break;case c:N=F/r;break;case a:N=F/n;break;default:N=F}return T?N:L.a(N)},R.daysInMonth=function(){return this.endOf(h).$D},R.$locale=function(){return E[this.$L]},R.locale=function(D,M){if(!D)return this.$L;var T=this.clone(),N=H(D,M,!0);return N&&(T.$L=N),T},R.clone=function(){return L.w(this.$d,this)},R.toDate=function(){return new Date(this.valueOf())},R.toJSON=function(){return this.isValid()?this.toISOString():null},R.toISOString=function(){return this.$d.toISOString()},R.toString=function(){return this.$d.toUTCString()},I})(),ee=K.prototype;return B.prototype=ee,[["$ms",s],["$s",a],["$m",c],["$H",l],["$W",d],["$M",h],["$y",v],["$D",m]].forEach((function(I){ee[I[1]]=function(R){return this.$g(R,I[0],I[1])}})),B.extend=function(I,R){return I.$i||(I(R,K,B),I.$i=!0),B},B.locale=H,B.isDayjs=A,B.unix=function(I){return B(1e3*I)},B.en=E[k],B.Ls=E,B.p={},B}))})(gt)),gt.exports}var Sc=yc();const Mt=Dt(Sc);var pt={exports:{}},wc=pt.exports,Vn;function Dc(){return Vn||(Vn=1,(function(e,t){(function(n,r){e.exports=r()})(wc,(function(){return function(n,r,o){n=n||{};var s=r.prototype,a={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 c(d,f,h,y){return s.fromToBase(d,f,h,y)}o.en.relativeTime=a,s.fromToBase=function(d,f,h,y,v){for(var m,b,x,S=h.$locale().relativeTime||a,_=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"}],j=_.length,O=0;O<j;O+=1){var k=_[O];k.d&&(m=y?o(d).diff(h,k.d,!0):h.diff(d,k.d,!0));var E=(n.rounding||Math.round)(Math.abs(m));if(x=m>0,E<=k.r||!k.r){E<=1&&O>0&&(k=_[O-1]);var $=S[k.l];v&&(E=v(""+E)),b=typeof $=="string"?$.replace("%d",E):$(E,f,k.l,x);break}}if(f)return b;var A=x?S.future:S.past;return typeof A=="function"?A(b):A.replace("%s",b)},s.to=function(d,f){return c(d,f,this,!0)},s.from=function(d,f){return c(d,f,this)};var l=function(d){return d.$u?o.utc():o()};s.toNow=function(d){return this.to(l(this),d)},s.fromNow=function(d){return this.from(l(this),d)}}}))})(pt)),pt.exports}var Cc=Dc();const Rc=Dt(Cc);var vt={exports:{}},Tc=vt.exports,Wn;function Ec(){return Wn||(Wn=1,(function(e,t){(function(n,r){e.exports=r()})(Tc,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,o,s){var a=o.prototype,c=a.format;s.en.formats=n,a.format=function(l){l===void 0&&(l="YYYY-MM-DDTHH:mm:ssZ");var d=this.$locale().formats,f=(function(h,y){return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(v,m,b){var x=b&&b.toUpperCase();return m||y[b]||n[b]||y[x].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(S,_,j){return _||j.slice(1)}))}))})(l,d===void 0?{}:d);return c.call(this,f)}}}))})(vt)),vt.exports}var jc=Ec();const Mc=Dt(jc);var mt={exports:{}},_c=mt.exports,Un;function Oc(){return Un||(Un=1,(function(e,t){(function(n,r){e.exports=r()})(_c,(function(){return function(n,r){var o=r.prototype,s=o.format;o.format=function(a){var c=this,l=this.$locale();if(!this.isValid())return s.bind(this)(a);var d=this.$utils(),f=(a||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(h){switch(h){case"Q":return Math.ceil((c.$M+1)/3);case"Do":return l.ordinal(c.$D);case"gggg":return c.weekYear();case"GGGG":return c.isoWeekYear();case"wo":return l.ordinal(c.week(),"W");case"w":case"ww":return d.s(c.week(),h==="w"?1:2,"0");case"W":case"WW":return d.s(c.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return d.s(String(c.$H===0?24:c.$H),h==="k"?1:2,"0");case"X":return Math.floor(c.$d.getTime()/1e3);case"x":return c.$d.getTime();case"z":return"["+c.offsetName()+"]";case"zzz":return"["+c.offsetName("long")+"]";default:return h}}));return s.bind(this)(f)}}}))})(mt)),mt.exports}var kc=Oc();const $c=Dt(kc);Mt.extend(Rc);Mt.extend(Mc);Mt.extend($c);const Ic={date:"DD MMM YYYY",time:"hh:mm A",dateTime:"DD MMM YYYY, hh:mm A",full:"dddd, DD MMM YYYY, hh:mm A",short:"DD/MM/YY",relative:""};function Jt({value:e,variant:t="dateTime",format:n,fallback:r="--"}){if(!e)return r;const o=Mt(e);return o.isValid()?t==="relative"?o.fromNow():o.format(n??Ic[t]):r}function Ac({value:e,dateVariant:t="date",timeVariant:n="time",dateFormat:r,timeFormat:o,align:s="start"}){return i.jsxs(u.Stack,{gap:.5,align:s,children:[i.jsx(u.Text,{fontSize:"sm",fontWeight:"500",children:Jt({value:e,variant:t,format:r})}),i.jsx(u.Text,{fontSize:"xs",color:"gray.500",children:Jt({value:e,variant:n,format:o})})]})}exports.DataTable=na;exports.Filters=sc;exports.MDSButton=cc;exports.MDSCheckbox=Er;exports.MDSConfirmDeleteDialog=bc;exports.MDSInput=Kt;exports.MDSRefreshButton=$r;exports.MDSSelectBox=jr;exports.RefreshButton=$r;exports.StackedDateTime=Ac;exports.addPreset=_r;exports.deletePreset=Or;exports.formatDateTime=Jt;exports.getPresets=rt;exports.loadOrder=ac;exports.presetStore=Ze;exports.saveOrder=ic;exports.savePresets=jt;exports.setActionsConfig=Tr;exports.setData=Cr;exports.setTableId=Rr;exports.tableStore=ie;exports.updatePreset=La;exports.withChildren=w;
package/dist/index.js CHANGED
@@ -4035,7 +4035,7 @@ function vc({
4035
4035
  display: "flex",
4036
4036
  alignItems: "center",
4037
4037
  justifyContent: "center",
4038
- h: "83vh",
4038
+ h: "81vh",
4039
4039
  w: "100%",
4040
4040
  children: o ?? "Loading..."
4041
4041
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mdspl/mds-shared-ui",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Chakra UI v3 DataTable with sorting, pagination, column visibility & drag reorder",
5
5
  "author": "magadh",
6
6
  "license": "MIT",