@mdspl/mds-shared-ui 0.5.6 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7,4 +7,4 @@ React keys must be passed directly to JSX without using spread:
|
|
|
7
7
|
To pick up a draggable item, press the space bar.
|
|
8
8
|
While dragging, use the arrow keys to move the item.
|
|
9
9
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
10
|
-
`},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:c}=fo(),l=nt("DndLiveRegion"),[u,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:p}=h;t.onDragMove&&s(t.onDragMove({active:y,over:p}))},onDragOver(h){let{active:y,over:p}=h;s(t.onDragOver({active:y,over:p}))},onDragEnd(h){let{active:y,over:p}=h;s(t.onDragEnd({active:y,over:p}))},onDragCancel(h){let{active:y,over:p}=h;s(t.onDragCancel({active:y,over:p}))}}),[s,t])),!u)return null;const f=g.createElement(g.Fragment,null,g.createElement(lo,{id:r,value:o.draggable}),g.createElement(uo,{id:l,announcement:c}));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 Co(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function En(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=En(t,t.left,t.top),s=[];for(const c of r){const{id:l}=c,u=n.get(l);if(u){const d=yo(En(u),o);s.push({id:l,data:{droppableContainer:c,value:d}})}}return s.sort(So)};function Do(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),c=o-r,l=s-n;if(r<o&&n<s){const u=t.width*t.height,d=e.width*e.height,f=c*l,h=f/(u+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:c}=s,l=n.get(c);if(l){const u=Do(l,t);u>0&&o.push({id:c,data:{droppableContainer:s,value:u}})}}return o.sort(wo)};function jo(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 To(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];return o.reduce((c,l)=>({...c,top:c.top+e*l.y,bottom:c.bottom+e*l.y,left:c.left+e*l.x,right:c.right+e*l.x}),{...n})}}const Eo=To(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:c,y:l}=r,u=e.left-c-(1-o)*parseFloat(n),d=e.top-l-(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:u+f,bottom:d+h,left:u}}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:c,bottom:l,right:u}=n;return{top:r,left:o,width:s,height:c,bottom:l,right:u}}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!Dt||!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!Dt||!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,c=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:o,isLeft:s,isBottom:c,isRight:l,maxScroll:r,minScroll:t}}const Ao={x:.2,y:.2};function Lo(e,t,n,r,o){let{top:s,left:c,right:l,bottom:u}=n;r===void 0&&(r=10),o===void 0&&(o=Ao);const{isTop:d,isBottom:f,isLeft:h,isRight:y}=sr(e),p={x:0,y:0},v={x:0,y:0},b={height:t.height*o.y,width:t.width*o.x};return!d&&s<=t.top+b.height?(p.y=Q.Backward,v.y=r*Math.abs((t.top+b.height-s)/b.height)):!f&&u>=t.bottom-b.height&&(p.y=Q.Forward,v.y=r*Math.abs((t.bottom-b.height-u)/b.height)),!y&&l>=t.right-b.width?(p.x=Q.Forward,v.x=r*Math.abs((t.right-b.width-l)/b.width)):!h&&c<=t.left+b.width&&(p.x=Q.Backward,v.x=r*Math.abs((t.left+b.width-c)/b.width)),{direction:p,speed:v}}function No(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:c}=window;return{top:0,left:0,right:s,bottom:c,width:s,height:c}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function 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,c,l]of Fo)for(const u of c)Object.defineProperty(this,u,{get:()=>{const d=l(r),f=o[s]-d;return this.rect[u]+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:c=Vo,scrollBehavior:l="smooth"}=o,{code:u}=t;if(s.end.includes(u)){this.handleEnd(t);return}if(s.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:d}=r.current,f=d?{x:d.left,y:d.top}:pe;this.referenceCoordinates||(this.referenceCoordinates=f);const h=c(t,{active:n,context:r.current,currentCoordinates:f});if(h){const y=yt(h,f),p={x:0,y:0},{scrollableAncestors:v}=r.current;for(const b of v){const x=t.code,{isTop:w,isRight:M,isLeft:R,isBottom:O,maxScroll:k,minScroll:D}=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&&!M||x===W.Left&&!R,B=x===W.Down&&!O||x===W.Up&&!w;if(H&&A.x!==h.x){const L=b.scrollLeft+y.x,K=x===W.Right&&L<=k.x||x===W.Left&&L>=D.x;if(K&&!y.y){b.scrollTo({left:L,behavior:l});return}K?p.x=b.scrollLeft-L:p.x=x===W.Right?b.scrollLeft-k.x:b.scrollLeft-D.x,p.x&&b.scrollBy({left:-p.x,behavior:l});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>=D.y;if(K&&!y.x){b.scrollTo({top:L,behavior:l});return}K?p.y=b.scrollTop-L:p.y=x===W.Down?b.scrollTop-k.y:b.scrollTop-D.y,p.y&&b.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(t,$e(yt(h,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}cr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=ar,onActivation:o}=t,{active:s}=n;const{code:c}=e.nativeEvent;if(r.start.includes(c)){const l=s.activatorNode.current;return l&&e.target!==l?!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:c}=s;this.props=t,this.events=n,this.document=Le(c),this.documentListeners=new Ge(this.document),this.listeners=new Ge(r),this.windowListeners=new Ge(ae(c)),this.initialCoordinates=(o=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:c,options:{activationConstraint:l}}=s;if(!o)return;const u=(n=Ut(t))!=null?n:pe,d=yt(o,u);if(!r&&l){if(On(l)){if(l.tolerance!=null&&Yt(d,l.tolerance))return this.handleCancel();if(Yt(d,l.distance))return this.handleStart()}if(kn(l)&&Yt(d,l.tolerance))return this.handleCancel();this.handlePending(l,d);return}t.cancelable&&t.preventDefault(),c(u)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===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:c=5,order:l=wt.TreeOrder,pointerCoordinates:u,scrollableAncestors:d,scrollableAncestorRects:f,delta:h,threshold:y}=e;const p=Jo({delta:h,disabled:!s}),[v,b]=oo(),x=g.useRef({x:0,y:0}),w=g.useRef({x:0,y:0}),M=g.useMemo(()=>{switch(n){case Xe.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case Xe.DraggableRect:return o}},[n,o,u]),R=g.useRef(null),O=g.useCallback(()=>{const D=R.current;if(!D)return;const $=x.current.x*w.current.x,A=x.current.y*w.current.y;D.scrollBy($,A)},[]),k=g.useMemo(()=>l===wt.TreeOrder?[...d].reverse():d,[l,d]);g.useEffect(()=>{if(!s||!d.length||!M){b();return}for(const D of k){if(r?.(D)===!1)continue;const $=d.indexOf(D),A=f[$];if(!A)continue;const{direction:H,speed:B}=Lo(D,A,M,t,y);for(const L of["x","y"])p[L][H[L]]||(B[L]=0,H[L]=0);if(B.x>0||B.y>0){b(),R.current=D,v(O,c),x.current=B,w.current=H;return}}x.current={x:0,y:0},w.current={x:0,y:0},b()},[t,O,r,b,s,c,JSON.stringify(M),JSON.stringify(p),v,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(c=>({eventName:c.eventName,handler:t(c.handler,r)}));return[...n,...s]},[]),[e,t])}var Je;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Je||(Je={}));var qt;(function(e){e.Optimized="optimized"})(qt||(qt={}));const $n=new Map;function es(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,c]=g.useState(null),{frequency:l,measure:u,strategy:d}=o,f=g.useRef(e),h=x(),y=Ke(h),p=g.useCallback(function(w){w===void 0&&(w=[]),!y.current&&c(M=>M===null?w:M.concat(w.filter(R=>!M.includes(R))))},[y]),v=g.useRef(null),b=tt(w=>{if(h&&!n)return $n;if(!w||w===$n||f.current!==e||s!=null){const M=new Map;for(let R of e){if(!R)continue;if(s&&s.length>0&&!s.includes(R.id)&&R.rect.current){M.set(R.id,R.rect.current);continue}const O=R.node.current,k=O?new rn(u(O),O):null;R.rect.current=k,k&&M.set(R.id,k)}return M}return w},[e,s,n,h,u]);return g.useEffect(()=>{f.current=e},[e]),g.useEffect(()=>{h||p()},[n,h]),g.useEffect(()=>{s&&s.length>0&&c(null)},[JSON.stringify(s)]),g.useEffect(()=>{h||typeof l!="number"||v.current!==null||(v.current=setTimeout(()=>{p(),v.current=null},l))},[l,h,p,...r]),{droppableRects:b,measureDroppableContainers:p,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(u=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=u??n)!=null?d:null}const f=t(e);return JSON.stringify(u)===JSON.stringify(f)?u:f})}const c=ns({callback(u){if(e)for(const d of u){const{type:f,target:h}=d;if(f==="childList"&&h instanceof HTMLElement&&h.contains(e)){s();break}}}}),l=Rt({callback:s});return be(()=>{s(),e?(l?.observe(e),c?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),c?.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 c=Pt(s.target);c&&n(l=>l?(l.set(c,Gt(c)),new Map(l)):null)},[]);return g.useEffect(()=>{const s=r.current;if(e!==s){c(s);const l=e.map(u=>{const d=Pt(u);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,Gt(d)]):null}).filter(u=>u!=null);n(l.length?new Map(l):null),r.current=e}return()=>{c(e),c(s)};function c(l){l.forEach(u=>{const d=Pt(u);d?.removeEventListener("scroll",o)})}},[o,e]),g.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,c)=>$e(s,c),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(!Dt)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function cs(e,t){return g.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:s}=r;return n[o]=c=>{s(c,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 c(){s(()=>e.length?e.map(u=>or(u)?r:new rn(t(u),u)):Nn)}const l=Rt({callback:c});return be(()=>{l?.disconnect(),c(),e.forEach(u=>l?.observe(u))},[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}),c=g.useCallback(d=>{const f=us(d);s?.disconnect(),f&&s?.observe(f),r(f?t(f):null)},[t,s]),[l,u]=xt(c);return g.useMemo(()=>({nodeRef:l,rect:n,setRef:u}),[n,l,u])}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},jt=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 c=new qe(e.droppable.containers);return c.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:c}}}case Z.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const 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(jt),s=Wt(r),c=Wt(n?.id);return g.useEffect(()=>{if(!t&&!r&&s&&c!=null){if(!tn(s)||document.activeElement===s.target)return;const l=o.get(c);if(!l)return;const{activatorNode:u,node:d}=l;if(!u.current&&!d.current)return;requestAnimationFrame(()=>{for(const f of[u.current,d.current]){if(!f)continue;const h=ao(f);if(h){h.focus();break}}})}},[r,t,o,c,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:c,y:l}=typeof o=="boolean"?{x:o,y:o}:o;be(()=>{if(!c&&!l||!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(c||(h.x=0),l||(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,c,l,r,n])}const fr=g.createContext({...pe,scaleX:1,scaleY:1});var je;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(je||(je={}));const hr=g.memo(function(t){var n,r,o,s;let{id:c,accessibility:l,autoScroll:u=!0,children:d,sensors:f=fs,collisionDetection:h=Ro,measuring:y,modifiers:p,...v}=t;const b=g.useReducer(ms,void 0,vs),[x,w]=b,[M,R]=go(),[O,k]=g.useState(je.Uninitialized),D=O===je.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),[T,C]=g.useState(null),[_,E]=g.useState(null),N=Ke(v,Object.values(v)),P=nt("DndDescribedBy",c),m=g.useMemo(()=>B.getEnabled(),[B]),j=ys(y),{droppableRects:z,measureDroppableContainers:F,measuringScheduled:U}=es(m,{dragging:D,dependencies:[H.x,H.y],config:j.droppable}),G=Zo(A,$),V=g.useMemo(()=>_?Ut(_):null,[_]),X=Fr(),q=ts(G,j.draggable.measure);Ss({activeNode:$!=null?A.get($):null,config:X.layoutShiftCompensation,initialRect:q,measure:j.draggable.measure});const Y=In(G,j.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:j.dragOverlay.measure}),Ee=(r=xe.nodeRef.current)!=null?r:G,Me=D?(o=xe.rect)!=null?o:Y:null,cn=!!(xe.nodeRef.current&&xe.rect),ln=os(cn?null:Y),_t=ur(Ee?ae(Ee):null),Se=ss(D?he??G:null),ot=ls(Se),st=xs(p,{transform:{x:H.x-ln.x,y:H.y-ln.y,scaleX:1,scaleY:1},activatorEvent:_,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?Eo(Me,st):null,ze=ee&&Oe?h({active:ee,collisionRect:Oe,droppableRects:z,droppableContainers:m,pointerCoordinates:un}):null,fn=Co(ze,"id"),[we,hn]=g.useState(null),Lr=cn?st:$e(st,Ar),Nr=jo(Lr,(s=we?.rect)!=null?s:null,Y),Ot=g.useRef(null),gn=g.useCallback((re,ce)=>{let{sensor:le,options:Ce}=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:Ce,context:ne,onAbort(te){if(!A.get(te))return;const{onDragAbort:me}=N.current,ye={id:te};me?.(ye),M({type:"onDragAbort",event:ye})},onPending(te,De,me,ye){if(!A.get(te))return;const{onDragPending:Ye}=N.current,Re={id:te,constraint:De,initialCoordinates:me,offset:ye};Ye?.(Re),M({type:"onDragPending",event:Re})},onStart(te){const De=I.current;if(De==null)return;const me=A.get(De);if(!me)return;const{onDragStart:ye}=N.current,Pe={activatorEvent:ue,active:{id:De,data:me.data,rect:K}};Ue.unstable_batchedUpdates(()=>{ye?.(Pe),k(je.Initializing),w({type:Z.DragStart,initialCoordinates:te,active:De}),M({type:"onDragStart",event:Pe}),C(Ot.current),E(ue)})},onMove(te){w({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(()=>{w({type:te}),k(je.Uninitialized),hn(null),C(null),E(null),Ot.current=null;const Fe=te===Z.DragEnd?"onDragEnd":"onDragCancel";if(Re){const kt=N.current[Fe];kt?.(Re),M({type:Fe,event:Re})}})}}},[A]),zr=g.useCallback((re,ce)=>(le,Ce)=>{const de=le.nativeEvent,ue=A.get(Ce);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=Ce,gn(le,ce))},[A,gn]),pn=Qo(f,zr);as(f),be(()=>{Y&&O===je.Initializing&&k(je.Initialized)},[Y,O]),g.useEffect(()=>{const{onDragMove:re}=N.current,{active:ce,activatorEvent:le,collisions:Ce,over:de}=ne.current;if(!ce||!le)return;const ue={active:ce,activatorEvent:le,collisions:Ce,delta:{x:_e.x,y:_e.y},over:de};Ue.unstable_batchedUpdates(()=>{re?.(ue),M({type:"onDragMove",event:ue})})},[_e.x,_e.y]),g.useEffect(()=>{const{active:re,activatorEvent:ce,collisions:le,droppableContainers:Ce,scrollAdjustedTranslate:de}=ne.current;if(!re||I.current==null||!ce||!de)return;const{onDragOver:ue}=N.current,ve=Ce.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),M({type:"onDragOver",event:te})})},[fn]),be(()=>{ne.current={activatorEvent:_,active:ee,activeNode:G,collisionRect:Oe,collisions:ze,droppableRects:z,draggableNodes:A,draggingNode:Ee,draggingNodeRect:Me,droppableContainers:B,over:we,scrollableAncestors:Se,scrollAdjustedTranslate:_e},K.current={initial:Me,translated:Oe}},[ee,G,ze,Oe,A,Ee,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:_,collisions:ze,containerNodeRect:se,dragOverlay:xe,draggableNodes:A,droppableContainers:B,droppableRects:z,over:we,measureDroppableContainers:F,scrollableAncestors:Se,scrollableAncestorRects:ot,measuringConfiguration:j,measuringScheduled:U,windowRect:_t}),[ee,G,Y,_,ze,se,xe,A,B,z,we,F,Se,ot,j,U,_t]),Yr=g.useMemo(()=>({activatorEvent:_,activators:pn,active:ee,activeNodeRect:Y,ariaDescribedById:{draggable:P},dispatch:w,draggableNodes:A,over:we,measureDroppableContainers:F}),[_,pn,ee,Y,w,P,A,we,F]);return g.createElement(Zn.Provider,{value:R},g.createElement(jt.Provider,{value:Yr},g.createElement(dr.Provider,{value:Pr},g.createElement(fr.Provider,{value:Nr},d)),g.createElement(bs,{disabled:l?.restoreFocus===!1})),g.createElement(mo,{...l,hiddenTextDescribedById:P}));function Fr(){const re=T?.autoScrollEnabled===!1,ce=typeof u=="object"?u.enabled===!1:u===!1,le=D&&!re&&!ce;return typeof u=="object"?{...u,enabled:le}:{enabled:le}}}),ws=g.createContext(null),zn="button",Cs="Draggable";function Ds(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=nt(Cs),{activators:c,activatorEvent:l,active:u,activeNodeRect:d,ariaDescribedById:f,draggableNodes:h,over:y}=g.useContext(jt),{role:p=zn,roleDescription:v="draggable",tabIndex:b=0}=o??{},x=u?.id===t,w=g.useContext(x?fr:ws),[M,R]=xt(),[O,k]=xt(),D=cs(c,t),$=Ke(n);be(()=>(h.set(t,{id:t,key:s,node:M,activatorNode:O,data:$}),()=>{const H=h.get(t);H&&H.key===s&&h.delete(t)}),[h,t]);const A=g.useMemo(()=>({role:p,tabIndex:b,"aria-disabled":r,"aria-pressed":x&&p===zn?!0:void 0,"aria-roledescription":v,"aria-describedby":f.draggable}),[r,p,b,x,v,f.draggable]);return{active:u,activatorEvent:l,activeNodeRect:d,attributes:A,isDragging:x,listeners:r?void 0:D,node:M,over:y,setNodeRef:R,setActivatorNodeRef:k,transform:w}}function Rs(){return g.useContext(dr)}const js="Droppable",Ts={timeout:25};function Es(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=nt(js),{active:c,dispatch:l,over:u,measureDroppableContainers:d}=g.useContext(jt),f=g.useRef({disabled:n}),h=g.useRef(!1),y=g.useRef(null),p=g.useRef(null),{disabled:v,updateMeasurementsFor:b,timeout:x}={...Ts,...o},w=Ke(b??r),M=g.useCallback(()=>{if(!h.current){h.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{d(Array.isArray(w.current)?w.current:[w.current]),p.current=null},x)},[x]),R=Rt({callback:M,disabled:v||!c}),O=g.useCallback((A,H)=>{R&&(H&&(R.unobserve(H),h.current=!1),A&&R.observe(A))},[R]),[k,D]=xt(O),$=Ke(t);return g.useEffect(()=>{!R||!k.current||(R.disconnect(),h.current=!1,R.observe(k.current))},[k,R]),g.useEffect(()=>(l({type:Z.RegisterDroppable,element:{id:r,key:s,disabled:n,node:k,rect:y,data:$}}),()=>l({type:Z.UnregisterDroppable,key:s,id:r})),[r]),g.useEffect(()=>{n!==f.current.disabled&&(l({type:Z.SetDroppableDisabled,id:r,key:s,disabled:n}),f.current.disabled=n)},[r,s,n,l]),{active:c,rect:y,isOver:u?.id===r,node:k,over:u,setNodeRef:D}}function Tt(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:c}=e;const l=(t=n[o])!=null?t:r;if(!l)return null;const u=$s(n,c,o);if(c===o){const d=n[s];return d?{x:o<s?d.left+d.width-(l.left+l.width):d.left-l.left,y:0,...dt}:null}return c>o&&c<=s?{x:-l.width-u,y:0,...dt}:c<o&&c>=s?{x:l.width+u,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=Tt(t,r,n),c=t[o],l=s[o];return!l||!c?null:{x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height}},ft={scaleX:1,scaleY:1},Is=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:s,overIndex:c}=e;const l=(t=s[n])!=null?t:r;if(!l)return null;if(o===n){const d=s[c];return d?{x:0,y:n<c?d.top+d.height-(l.top+l.height):d.top-l.top,...ft}:null}const u=As(s,o,n);return o>n&&o<=c?{x:0,y:-l.height-u,...ft}:o<n&&o>=c?{x:0,y:l.height+u,...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:c,dragOverlay:l,droppableRects:u,over:d,measureDroppableContainers:f}=Rs(),h=nt(pr,n),y=l.rect!==null,p=g.useMemo(()=>r.map(D=>typeof D=="object"&&"id"in D?D.id:D),[r]),v=c!=null,b=c?p.indexOf(c.id):-1,x=d?p.indexOf(d.id):-1,w=g.useRef(p),M=!_s(p,w.current),R=x!==-1&&b===-1||M,O=Os(s);be(()=>{M&&v&&f(p)},[M,p,v,f]),g.useEffect(()=>{w.current=p},[p]);const k=g.useMemo(()=>({activeIndex:b,containerId:h,disabled:O,disableTransforms:R,items:p,overIndex:x,useDragOverlay:y,sortedRects:Ms(p,u),strategy:o}),[b,h,O.draggable,O.droppable,R,p,x,u,y,o]);return g.createElement(vr.Provider,{value:k},t)}const Ls=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Tt(n,r,o).indexOf(t)},Ns=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:s,newIndex:c,previousItems:l,previousContainerId:u,transition:d}=e;return!d||!r||l!==s&&o===c?!1:n?!0:c!==o&&t===u},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,c]=g.useState(null),l=g.useRef(n);return be(()=>{if(!t&&n!==l.current&&r.current){const u=o.current;if(u){const d=Ne(r.current,{ignoreTransform:!0}),f={x:u.left-d.left,y:u.top-d.top,scaleX:u.width/d.width,scaleY:u.height/d.height};(f.x||f.y)&&c(f)}}n!==l.current&&(l.current=n)},[t,n,r,o]),g.useEffect(()=>{s&&c(null)},[s]),s}function xr(e){let{animateLayoutChanges:t=Ns,attributes:n,disabled:r,data:o,getNewIndex:s=Ls,id:c,strategy:l,resizeObserverConfig:u,transition:d=zs}=e;const{items:f,containerId:h,activeIndex:y,disabled:p,disableTransforms:v,sortedRects:b,overIndex:x,useDragOverlay:w,strategy:M}=g.useContext(vr),R=Bs(r,p),O=f.indexOf(c),k=g.useMemo(()=>({sortable:{containerId:h,index:O,items:f},...o}),[h,o,O,f]),D=g.useMemo(()=>f.slice(f.indexOf(c)),[f,c]),{rect:$,node:A,isOver:H,setNodeRef:B}=Es({id:c,data:k,disabled:R.droppable,resizeObserverConfig:{updateMeasurementsFor:D,...u}}),{active:L,activatorEvent:K,activeNodeRect:ee,attributes:I,setNodeRef:T,listeners:C,isDragging:_,over:E,setActivatorNodeRef:N,transform:P}=Ds({id:c,data:k,attributes:{...Ys,...n},disabled:R.draggable}),m=ro(B,T),j=!!L,z=j&&!v&&ut(y)&&ut(x),F=!w&&_,U=F&&z?P:null,V=z?U??(l??M)({rects:b,activeNodeRect:ee,activeIndex:y,overIndex:x,index:O}):null,X=ut(y)&&ut(x)?s({id:c,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:_,isSorting:j,id:c,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(()=>{j&&Y.current.newIndex!==X&&(Y.current.newIndex=X),h!==Y.current.containerId&&(Y.current.containerId=h),f!==Y.current.items&&(Y.current.items=f)},[j,X,h,f]),g.useEffect(()=>{if(q===Y.current.activeId)return;if(q!=null&&Y.current.activeId==null){Y.current.activeId=q;return}const Ee=setTimeout(()=>{Y.current.activeId=q},50);return()=>clearTimeout(Ee)},[q]),{active:L,activeIndex:y,attributes:I,data:k,rect:$,index:O,newIndex:X,items:f,isOver:H,isSorting:j,isDragging:_,listeners:C,node:A,overIndex:x,over:E,setNodeRef:m,setActivatorNodeRef:N,setDroppableNodeRef:B,setDraggableNodeRef:T,transform:he??V,transition:xe()};function xe(){if(he||se&&Y.current.newIndex===O)return Ps;if(!(F&&!tn(K)||!d)&&(j||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:c,...l},u)=>g.createElement("svg",{ref:u,...Us,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:yr("lucide",o),...!s&&!Ws(l)&&{"aria-hidden":"true"},...l},[...c.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"}]],Ci=oe("triangle-alert",wi);function S(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}`,Cr=e=>`table_column_visibility_v1:${e}`,Di=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 ji=e=>{ie.setState(t=>{const n={...t.visibility,[e]:!t.visibility[e]};return t.tableId&&localStorage.setItem(Cr(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 Dr(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,c=JSON.parse(localStorage.getItem(wr(s))||"[]"),l=[...c.map(f=>o.find(h=>h.id===f)).filter(Boolean),...o.filter(f=>!c.includes(f.id))],u=JSON.parse(localStorage.getItem(Cr(s))||"{}"),d=l.reduce((f,h)=>(f[h.id]=u[h.id]??!0,f),{});ie.setState(f=>({...f,data:e,columnOrder:l,visibility:d,sortableColumns:l.map(h=>({id:h.id,label:h.label,sortable:!0,backgroundColor:h.backgroundColor}))}))}function Rr(e){ie.setState(t=>({...t,tableId:e}))}const jr=e=>{ie.setState(t=>({...t,actionsConfig:e}))},Ti=S(a.Menu.Trigger),Ei=S(a.Menu.Positioner),Mi=S(a.Menu.Content),_i=S(a.Menu.Item),Oi=S(a.Checkbox.Label),ki=S(a.Checkbox.HiddenInput),$i=S(a.Checkbox.Control);function Ii({visibility:e,onToggle:t}){const{sortableColumns:n}=Qe(ie);return i.jsxs(a.Menu.Root,{closeOnSelect:!1,children:[i.jsx(Ti,{asChild:!0,children:i.jsx(a.IconButton,{"aria-label":"Toggle columns",variant:"ghost",ml:"1",size:"xs",children:i.jsx(ci,{size:18})})}),i.jsx(a.Portal,{children:i.jsx(Ei,{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(a.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:c}){const{setNodeRef:l,attributes:u,listeners:d,transform:f,transition:h}=xr({id:e});return i.jsx(a.Table.ColumnHeader,{ref:l,onClick:n,backgroundColor:c,w:e==="id"?"80px":void 0,style:{transform:Ie.Transform.toString(f),transition:h,cursor:r,borderRight:o,borderRightColor:s},...u,children:i.jsxs(a.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),c=e.map(u=>o.find(d=>d.id===u.id)).filter(u=>u!==void 0).filter(u=>t[u.id]),l=u=>{const{active:d,over:f}=u;if(!f||d.id===f.id)return;const h=e.findIndex(v=>v.id===d.id),y=e.findIndex(v=>v.id===f.id),p=Tt(e,h,y);Di(p)};return i.jsx(a.Table.Header,{background:"blue.200",position:"sticky",top:0,p:"0",zIndex:1,children:i.jsx(hr,{collisionDetection:Qn,onDragEnd:l,children:i.jsx(mr,{items:e.map(u=>u.id),strategy:ks,children:i.jsxs(a.Table.Row,{height:"28px",children:[c.map(u=>{const d=n===u?.id;return i.jsx(Ai,{id:u?.id,onClick:()=>u?.sortable&&Ri(u?.id),cursor:u?.sortable?"pointer":"default",borderRight:"2px solid #dcdcdc",backgroundColor:u?.backgroundColor,children:i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,userSelect:"none"},children:[u?.label,u?.sortable&&(d?r==="asc"?i.jsx(Qs,{size:14}):i.jsx(qs,{size:14}):i.jsx(Js,{size:14,opacity:.4}))]})},u?.id)}),s?.showActionColumn&&i.jsx(a.Table.ColumnHeader,{width:s.width,backgroundColor:s.backgroundColor,borderRight:"2px solid #dcdcdc",children:s.children}),s?.showColumnVisibilityMenu&&i.jsx(a.Table.ColumnHeader,{boxSize:"0.5",backgroundColor:s.backgroundColorColumnVisibilityMenu,children:i.jsx(Ii,{visibility:t,onToggle:ji})})]})})})})}const Ni=[10,20,50,100],zi=S(a.Select.Positioner),Pi=S(a.Select.Content),Yi=S(a.Select.Item),Fi=S(a.Pagination.PrevTrigger),Bi=S(a.Pagination.NextTrigger),Hi=S(a.Select.HiddenSelect),Vi=S(a.Select.Control),Wi=S(a.Select.Trigger),Ui=S(a.Select.ValueText),Gi=S(a.Select.IndicatorGroup),Xi=S(a.Select.Indicator);function qi({totalCount:e,pageSize:t,currentPage:n,onPageChange:r,onPageSizeChange:o,siblingCount:s=2,pageSizeOptions:c=Ni}){const l=a.createListCollection({items:c.map(u=>({label:String(u),value:String(u)}))});return i.jsx(a.Box,{width:"100%",children:i.jsxs(a.HStack,{justify:"space-between",mx:"auto",flexWrap:"wrap",children:[i.jsxs(a.HStack,{children:[i.jsx(a.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:"Rows per page:"}),i.jsxs(a.Select.Root,{collection:l,size:"sm",width:"60px",onValueChange:u=>o?.(Number(u.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(a.Portal,{children:i.jsx(zi,{children:i.jsx(Pi,{children:l.items.map(u=>i.jsxs(Yi,{item:u.value,children:[u.label,i.jsx(a.Select.ItemIndicator,{})]},u.value))})})})]})]}),i.jsx(a.Pagination.Root,{count:e,pageSize:t,page:n,siblingCount:s,onPageChange:u=>r&&r(u.page),children:i.jsxs(a.ButtonGroup,{size:"sm",variant:"ghost",children:[i.jsx(Fi,{asChild:!0,children:i.jsx(a.IconButton,{"aria-label":"Previous page",children:i.jsx(oi,{size:18})})}),i.jsx(a.Pagination.Items,{render:u=>i.jsx(a.IconButton,{variant:u.type==="page"&&u.value===n?"outline":"ghost","aria-current":u.type==="page"&&u.value===n?"page":void 0,children:u.type==="page"?u.value:"…"},u.value??u.type)}),i.jsx(Bi,{asChild:!0,children:i.jsx(a.IconButton,{"aria-label":"Next page",children:i.jsx(ii,{size:18})})})]})})]})})}const Ki=S(a.Menu.Item),Ji=S(a.Menu.Content),Zi=S(a.Menu.Positioner),Qi=S(a.Menu.Trigger);function ea({data:e=[],actions:t=[]}){const{columnOrder:n,visibility:r}=Qe(ie);return i.jsx(a.Table.Body,{children:e.map(o=>i.jsxs(a.Table.Row,{_hover:{bg:"blue.50"},children:[n.filter(s=>r[s.id]).map(s=>i.jsx(a.Table.Cell,{children:o[s.id]},s.id)),i.jsx(a.Table.Cell,{textAlign:"center",display:"flex",gap:2,children:i.jsxs(a.Menu.Root,{children:[i.jsx(Qi,{asChild:!0,children:i.jsx(a.IconButton,{"aria-label":"Open",variant:"ghost",size:"sm",children:i.jsx(fi,{size:16})})}),i.jsx(a.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(a.Table.Cell,{})]},o.id))})}function ta({rows:e=6,columns:t}){return i.jsx(a.Table.Body,{children:Array.from({length:e}).map((n,r)=>i.jsx(a.Table.Row,{children:Array.from({length:t}).map((o,s)=>i.jsx(a.Table.Cell,{children:i.jsx(a.Skeleton,{height:"25px"})},s))},r))})}function na({tableId:e,data:t=[],headers:n=[],loading:r=!1,loadingChildren:o,skeletonLoading:s=!1,emptyMessage:c="No data",actions:l,page:u=1,pageSize:d=10,onPageChange:f,onPageSizeChange:h,density:y="sm",totalCount:p=0,paginationMode:v="client",actionConfig:b,pageSizeOptions:x}){g.useEffect(()=>{Rr(e)},[e]),g.useEffect(()=>{Dr(t,n)},[t,n]),g.useEffect(()=>{b&&jr(b)},[b]);const{sortColumn:w,sortDirection:M,data:R,columnOrder:O}=Qe(ie),k=g.useMemo(()=>{const D=[...R],$=Math.max(1,u||1);if(w&&D.sort((A,H)=>M==="asc"?String(A[w]).localeCompare(String(H[w])):String(H[w]).localeCompare(String(A[w]))),v==="client"){const A=($-1)*d;return D.slice(A,A+d)}return D},[R,w,M,u,d,v]);return g.useEffect(()=>{u<1&&f&&f(1)},[u,f]),i.jsxs(a.Box,{h:"100%",display:"flex",flexDirection:"column",p:2,pt:2,minHeight:0,children:[i.jsx(a.Box,{flex:"1",minHeight:0,overflow:"auto",h:"100%",children:i.jsxs(a.Table.Root,{variant:"outline",w:"100%",size:y,children:[i.jsx(Li,{}),r?i.jsx(a.Table.Body,{children:i.jsx(a.Table.Row,{children:i.jsx(a.Table.Cell,{colSpan:O.length+(l?1:0),children:i.jsx(a.Box,{display:"flex",alignItems:"center",justifyContent:"center",h:"81vh",w:"100%",children:o??"Loading..."})})})}):s?i.jsx(ta,{rows:d,columns:n.length+(l?2:0)}):k.length===0?i.jsx(a.Table.Body,{children:i.jsx(a.Table.Row,{children:i.jsx(a.Table.Cell,{colSpan:n.length+(l?1:0),children:i.jsx(a.Box,{display:"flex",alignItems:"center",justifyContent:"center",minH:"200px",color:"gray.500",children:c})})})}):i.jsx(ea,{data:k,actions:l})]})}),i.jsx(a.Box,{mt:.5,children:i.jsx(qi,{totalCount:p,pageSize:d,currentPage:u,onPageChange:f,onPageSizeChange:D=>{h&&h(D),u>1&&f&&f(1)},pageSizeOptions:x})})]})}const ra=S(a.Checkbox.Root),oa=S(a.Checkbox.HiddenInput),sa=S(a.Checkbox.Control),ia=S(a.Checkbox.Label),Tr=({value:e,onChange:t,size:n="sm",label:r,helperText:o,isDisabled:s,required:c,errorText:l})=>i.jsxs(ra,{value:e,onChange:t,size:n,children:[i.jsx(oa,{}),i.jsx(sa,{disabled:s,required:c,errorText:l,helperText:o}),r&&i.jsx(ia,{children:r})]}),J=" to ",Fn=10,Te={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>=Te.YEAR_MIN&&r<=Te.YEAR_MAX?r:t;if(n>0&&n<4){const o=t.toString(),s=4-n,c=o.substring(0,s);return parseInt(c+e)}return t},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 c,l,u;return n.length===1?(c=parseInt(n[0])||s,l=o,u=r):n.length===2?(c=parseInt(n[0])||s,l=parseInt(n[1])||o,u=r):(c=parseInt(n[0])||s,l=parseInt(n[1])||o,u=ca(n[2],r)),l=Math.max(1,Math.min(Te.MONTH_MAX,l)),c=Math.max(1,Math.min(Te.DAY_MAX,c)),`${u}-${String(l).padStart(2,"0")}-${String(c).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>Te.DAY_MAX)return t}if(e[1]?.length>0){const n=parseInt(e[1]);if(isNaN(n)||n===0||e[1].length===2&&n>Te.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<Te.YEAR_MIN||n>Te.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=S(a.Popover.Root),da=S(a.Popover.Trigger),fa=S(a.Popover.Content),ha=S(a.Popover.Positioner);function ga({value:e,onChange:t,disabled:n=!1}){const[r="",o=""]=e?e.split("|"):[],[s,c]=g.useState(()=>r&&o?`${ge(r)}${J}${ge(o)}`:r?ge(r):""),[l,u]=g.useState(!1),d=g.useRef(null);g.useEffect(()=>{const v=b=>{b.ctrlKey&&b.key==="d"&&!b.shiftKey&&!b.metaKey&&(b.preventDefault(),d.current?.focus())};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[]);const f=v=>{let b=v;if(b.includes(J)){const[x,w=""]=b.split(J);b=`${We(x.trim())}${J}${We(w.trim())}`}else if(b.toLowerCase().includes(" to ")){const[x,w=""]=b.split(/\s+to\s+/i);b=`${We(x.trim())} to ${We(w.trim())}`}else b=We(b);c(b)},h=()=>{const v=s.trim();if(!v){t(void 0);return}if(v.includes(J)){const[b,x=""]=v.split(J).map(R=>R.trim()),w=Ve(b),M=x?Ve(x):null;if(w&&M){const[R,O]=M<w?[M,w]:[w,M],k=`${ge(R)}${J}${ge(O)}`;c(k),t(`${R}|${O}`)}else if(w&&!x)c(`${ge(w)}${J}`),t(void 0);else if(w&&x){const R=aa(),[O,k]=R<w?[R,w]:[w,R],D=`${ge(O)}${J}${ge(k)}`;c(D),t(`${O}|${k}`)}else c(""),t(void 0)}else{const b=Ve(v);b?(c(`${ge(b)}${J}`),t(void 0)):(c(""),t(void 0))}},y=v=>{if(v.key!=="Enter")return;v.preventDefault();const b=d.current?.selectionStart||0,x=s.indexOf(J);if(!s.trim()){c(`${Bn()}${J}`);return}if(x===-1){const M=Ve(s.trim());M&&c(`${ge(M)}${J}`);return}if(b<=x+J.length){const M=s.substring(0,x).trim(),R=s.substring(x+J.length),O=Ve(M);O&&c(`${ge(O)}${J}${R}`);return}if(s.substring(x+J.length).trim())h(),d.current?.blur();else{const M=s.substring(0,x+J.length)+Bn();c(M),setTimeout(()=>{h(),d.current?.blur()},0)}},p=()=>{c(""),t(void 0)};return i.jsx(a.InputGroup,{children:i.jsx(i.Fragment,{children:i.jsxs(a.InputElement,{position:"revert",children:[i.jsxs(ua,{open:l,onEscapeKeyDown:()=>{u(!1)},children:[i.jsx(da,{asChild:!0,children:i.jsx(a.IconButton,{size:"sm",variant:"ghost","aria-label":"Date range help",onClick:()=>u(v=>!v),children:i.jsx(Yn,{size:16})})}),i.jsx(a.Portal,{children:i.jsx(ha,{children:i.jsxs(fa,{p:4,children:[i.jsx(a.PopoverArrow,{}),i.jsxs(a.VStack,{align:"start",gap:4,children:[i.jsxs(a.HStack,{children:[i.jsx(Yn,{size:16}),i.jsx(a.Text,{fontWeight:"semibold",fontSize:"sm",children:"Date Range Filter"})]}),i.jsxs(a.VStack,{align:"start",gap:1,children:[i.jsx(a.Text,{fontSize:"sm",fontWeight:"medium",children:"Format:"}),i.jsxs(a.Text,{fontSize:"xs",color:"gray.600",children:["DD-MM-YYYY",J,"DD-MM-YYYY"]})]}),i.jsxs(a.VStack,{align:"start",gap:1,children:[i.jsx(a.Text,{fontSize:"sm",fontWeight:"medium",children:"Tips:"}),i.jsx(a.Text,{fontSize:"xs",children:'• "15 to 20" → assumes current month/year'}),i.jsx(a.Text,{fontSize:"xs",children:"• Leave end blank → up to today"}),i.jsx(a.Text,{fontSize:"xs",children:"• Dates auto-swapped if reversed"}),i.jsx(a.Text,{fontSize:"xs",children:"• Press Enter on empty end → fills today"})]}),i.jsxs(a.VStack,{align:"start",gap:1,children:[i.jsx(a.Text,{fontSize:"sm",fontWeight:"medium",children:"Shortcut:"}),i.jsxs(a.HStack,{children:[i.jsx(a.Kbd,{children:"Ctrl"}),i.jsx(a.Text,{children:"+"}),i.jsx(a.Kbd,{children:"D"})]})]})]})]})})})]}),i.jsx(a.Input,{ref:d,placeholder:"15-06-2025 to 20-06-2025",value:s,size:"sm",disabled:n,onChange:v=>f(v.target.value),onBlur:h,onKeyDown:y,pr:s?"10":void 0,w:"100%"}),s&&i.jsx(a.InputElement,{children:i.jsx(a.IconButton,{size:"sm",variant:"ghost","aria-label":"Clear date range",onClick:p,w:"100%"})})]})})})}const pa=S(a.Field.Root),va=S(a.Field.Label),ma=S(a.Field.HelperText),ba=S(a.Field.ErrorText),Kt=({icon:e,value:t,onChange:n,placeholder:r,size:o="xs",variant:s="outline",width:c="100%",label:l,helperText:u,isDisabled:d=!1,required:f=!1,errorText:h,visible:y})=>i.jsxs(pa,{width:c,children:[y&&i.jsx(va,{children:l}),i.jsx(a.InputGroup,{startElement:e,children:i.jsx(a.Input,{value:t,onChange:p=>n?.(p.target.value),placeholder:r,size:o,variant:s,disabled:d,required:f})}),h&&i.jsx(ba,{fontSize:"xs",children:h}),u&&i.jsx(ma,{fontSize:"xs",children:u})]}),xa=S(a.Field.Root),ya=S(a.Field.HelperText),Sa=S(a.Field.ErrorText),wa=S(a.Select.Root),Ca=S(a.Select.Label),Da=S(a.Select.Control),Ra=S(a.Select.Trigger),ja=S(a.Select.ValueText),Ta=S(a.Select.IndicatorGroup),Ea=S(a.Select.Indicator),Ma=S(a.Select.Content),_a=S(a.Select.Item),Oa=S(a.Select.ItemIndicator),ka=S(a.Select.HiddenSelect),$a=S(a.Select.Positioner),Er=({options:e=[],label:t,value:n,onChange:r,placeholder:o,size:s="xs",width:c="100%",variant:l="outline",helperText:u,isDisabled:d,required:f,errorText:h,visible:y})=>{const p=a.createListCollection({items:e});return i.jsxs(xa,{disabled:d,required:f,children:[i.jsxs(wa,{collection:p,variant:l,size:s,width:c,value:n?[n]:[],onValueChange:v=>r?.(v.value[0]),children:[i.jsx(ka,{}),y&&i.jsx(Ca,{children:t}),i.jsxs(Da,{children:[i.jsx(Ra,{children:i.jsx(ja,{placeholder:o})}),i.jsx(Ta,{children:i.jsx(Ea,{})})]}),i.jsx($a,{children:i.jsx(Ma,{children:p.items.map(v=>i.jsxs(_a,{item:v,children:[v.label,i.jsx(Oa,{})]},v.value))})})]}),u&&i.jsx(ya,{children:u}),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},Et=(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)];Et(e,n)},Or=(e,t)=>{const n=rt(e).filter(r=>r.id!==t);Et(e,n)},La=(e,t,n)=>{const r=rt(e).map(o=>o.id===t?n(o):o);Et(e,r)},Na=S(a.Checkbox.Root),za=S(a.Checkbox.HiddenInput),Pa=S(a.Checkbox.Control),Ya=S(a.Slider.Root),Fa=S(a.Slider.Track),Ba=S(a.Slider.Range),Ha=S(a.Slider.Thumbs),Va=S(a.Slider.Control),Wa=({filter:e,onVisibilityChange:t,onSizeChange:n})=>{const{attributes:r,listeners:o,setNodeRef:s,transform:c,transition:l}=xr({id:e.id}),u={transform:Ie.Transform.toString(c),transition:l};return i.jsxs(a.VStack,{ref:s,style:u,align:"stretch",border:"1px solid",borderColor:"gray.200",rounded:"md",p:3,mb:3,bg:"white",children:[i.jsxs(a.HStack,{...r,...o,cursor:"grab",userSelect:"none",gap:2,children:[i.jsx(Sr,{size:16}),i.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:e.label||e.id})]}),i.jsxs(a.HStack,{justify:"space-between",children:[i.jsx(a.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(a.VStack,{align:"stretch",gap:1,children:[i.jsx(a.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=S(a.Drawer.Root),Ga=S(a.Drawer.Trigger),Xa=S(a.Drawer.Backdrop),qa=S(a.Drawer.Positioner),Ka=S(a.Drawer.Content),Ja=S(a.Drawer.Header),Za=S(a.Drawer.Title),Qa=S(a.Drawer.Body),ec=S(a.Drawer.Footer),tc=S(a.Drawer.CloseTrigger),nc=S(a.Tabs.Root),rc=S(a.Tabs.List),Bt=S(a.Tabs.Trigger),Ht=S(a.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(Tr,{label:e.label,value:e.value,onChange:e.onChange});case"select":return i.jsx(Er,{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:c,activePresetName:l,onReorder:u,open:d,onOpenChange:f})=>{const y=Qe(Ze)[s]??rt(s),p=()=>{const v=prompt("Preset name?");if(!v)return;const b=o.reduce((x,w)=>(x[w.id]=w.value,x),{});_r(s,{id:crypto.randomUUID(),name:v,date:new Date().toISOString(),values:b})};return i.jsx(a.HStack,{wrap:"wrap",children:i.jsxs(Ua,{size:e,open:d,onOpenChange:f,children:[i.jsx(Ga,{asChild:!0,children:i.jsxs(a.IconButton,{"aria-label":"Open filters",variant:"outline",size:"xs",ml:2,p:2,children:[i.jsx(gi,{size:16}),"Filters"]})}),i.jsxs(a.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(v=>v.visible).map(v=>i.jsx(a.VStack,{align:"stretch",border:"1px solid",borderColor:"gray.200",flex:v.size??1,minW:`${(v.size??1)*100}px`,rounded:"md",p:3,mb:3,children:kr(v,d)},v.id))}),i.jsx(Ht,{value:"settings",children:i.jsx(hr,{sensors:xo(bo(sn)),collisionDetection:Qn,onDragEnd:({active:v,over:b})=>{if(!b||v.id===b.id)return;const x=o.findIndex(R=>R.id===v.id),w=o.findIndex(R=>R.id===b.id),M=Tt(o,x,w);u?.(M)},children:i.jsx(mr,{items:o.map(v=>v.id),strategy:Is,children:o.map(v=>i.jsx(Wa,{filter:v,onVisibilityChange:t,onSizeChange:n},v.id))})})}),i.jsx(Ht,{value:"presets",children:i.jsxs(a.VStack,{align:"stretch",mb:3,children:[y.length===0&&i.jsx(a.Text,{fontSize:"xs",color:"gray.500",children:"No presets saved yet."}),y.map(v=>i.jsxs(a.HStack,{justify:"space-between",border:"1px solid",borderColor:l===v.name?"blue.300":"gray.200",rounded:"md",p:2,children:[i.jsxs(a.VStack,{align:"start",gap:0,children:[i.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:v.name}),i.jsx(a.Text,{fontSize:"xs",color:"gray.500",children:new Date(v.date).toLocaleDateString()})]}),i.jsxs(a.HStack,{children:[i.jsx(a.Button,{size:"xs",variant:"ghost",onClick:()=>{const b=o.map(x=>({...x,value:v.values[x.id]??x.value}));c?.(b,v.name)},children:"Load"}),i.jsx(a.IconButton,{size:"xs","aria-label":"Delete preset",variant:"ghost",onClick:()=>Or(s,v.id),children:i.jsx(ui,{size:14})})]})]},v.id)),i.jsx(a.Button,{size:"sm",colorScheme:"blue",onClick:p,children:"Save Current Filters"})]})})]})}),i.jsx(ec,{justify:"space-between",children:i.jsx(tc,{asChild:!0,children:i.jsx(a.CloseButton,{})})})]})})]})]})})},sc=({title:e,filters:t,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:c,pageKey:l,onLoadPreset:u,activePresetName:d,filterDrawerSize:f="sm"})=>{const[h,y]=g.useState(!1);return i.jsxs(a.HStack,{wrap:"wrap",pl:2,pr:2,width:"100%",justify:"space-between",children:[e,i.jsxs(a.HStack,{gapX:1,children:[t.filter(p=>p.visible!==!1).map(p=>i.jsx(a.HStack,{flex:p.size??1,minW:`${(p.size??1)*100}px`,alignItems:"center",children:kr(p)},p.id)),i.jsx(oc,{filterDrawerSize:f,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:c,pageKey:l,filters:t,onLoadPreset:u,activePresetName:d,open:h,onOpenChange:p=>{y(p.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:c,colorScheme:l,loading:u,loadingText:d,rounded:f,type:h="button"})=>i.jsx(a.Button,{onClick:e,size:t,variant:n,disabled:c,colorPalette:l,loading:u,loadingText:d,rounded:f,type:h,children:i.jsxs(a.HStack,{gap:1,children:[o,r,s]})}),lc=S(a.Combobox.Root),uc=S(a.Combobox.Label),dc=S(a.Combobox.Control),fc=S(a.Combobox.Input),hc=S(a.Combobox.IndicatorGroup),gc=S(a.Combobox.ClearTrigger),pc=S(a.Combobox.Trigger),vc=S(a.Combobox.Positioner),mc=S(a.Combobox.Content);function bc({label:e,size:t="sm",width:n="100%",variant:r="outline",items:o=[],itemToString:s,itemToValue:c,renderItem:l,loading:u,error:d,placeholder:f,onInputChange:h,onSelect:y,rootProps:p,inputProps:v,controlProps:b,contentProps:x,itemProps:w}){const{collection:M,set:R}=a.useListCollection({initialItems:o,itemToString:s,itemToValue:c});return g.useEffect(()=>{o&&R(o)},[o,R]),i.jsxs(lc,{width:n,size:t,variant:r,collection:M,placeholder:f,onInputValueChange:O=>{h?.(O.inputValue)},onValueChange:O=>{const k=O.value?.[0];if(!k)return;const D=M.items.find($=>c($)===k);D&&y?.(D)},positioning:{sameWidth:!1,placement:"bottom-start"},...p,children:[e&&i.jsx(uc,{children:e}),i.jsxs(dc,{...b,children:[i.jsx(fc,{placeholder:f??"Type to search",...v}),i.jsxs(hc,{children:[i.jsx(gc,{}),i.jsx(pc,{})]})]}),i.jsx(vc,{children:i.jsx(mc,{minW:"sm",...x,children:u?i.jsxs(a.HStack,{p:"2",children:[i.jsx(a.Spinner,{size:"xs",borderWidth:"1px"}),i.jsx(a.Span,{children:"Loading..."})]}):d?i.jsx(a.Span,{p:"2",color:"fg.error",children:"Error fetching"}):M.items.map(O=>i.jsxs(a.Combobox.Item,{item:O,...w,children:[l(O),i.jsx(a.Combobox.ItemIndicator,{})]},c(O)))})})]})}const xc=S(a.Dialog.Root),yc=S(a.Dialog.Backdrop),Sc=S(a.Dialog.Positioner),wc=S(a.Dialog.Content),Cc=S(a.Dialog.Header),Dc=S(a.Dialog.Body),Rc=S(a.Dialog.Footer),jc=S(a.Dialog.Title),Tc=S(a.Dialog.CloseTrigger);function Ec({open:e,onClose:t,onConfirm:n,title:r="Delete Company",entityName:o,confirmText:s="DELETE",confirmLabel:c="Delete",isLoading:l=!1}){const[u,d]=g.useState("");return i.jsx(xc,{open:e,placement:"center",onOpenChange:f=>!f.open&&t(),children:i.jsxs(a.Portal,{children:[i.jsx(yc,{}),i.jsx(Sc,{children:i.jsxs(wc,{maxW:"520px",children:[i.jsx(Cc,{borderBottom:"1px solid",borderColor:"red.200",boxShadow:"sm",children:i.jsx(jc,{color:"red.600",children:r})}),i.jsx(Dc,{children:i.jsxs(a.Stack,{gap:4,boxShadow:"lg",border:"1px solid gray.200",borderRadius:"md",p:4,children:[i.jsx(a.Box,{border:"1px solid",borderColor:"red.200",bg:"red.50",borderRadius:"md",p:4,children:i.jsxs(a.Stack,{direction:"row",gap:3,align:"flex-start",children:[i.jsx(a.Box,{color:"red.600",mt:"2px",children:i.jsx(Ci,{size:20})}),i.jsxs(a.Box,{children:[i.jsx(a.Text,{fontWeight:"semibold",color:"red.700",children:"Are you sure?"}),i.jsxs(a.Text,{fontSize:"sm",color:"red.600",children:["All the data of ",i.jsx("b",{children:o})," will permanently be deleted."]})]})]})}),i.jsx(a.Text,{fontSize:"sm",color:"gray.600",children:"You can’t undo this action afterwards."}),i.jsxs(a.Box,{children:[i.jsxs(a.Text,{fontSize:"sm",mb:1,children:["Type ",i.jsx("b",{children:s})," to continue"]}),i.jsx(a.Input,{placeholder:`Type ${s} here`,value:u,onChange:f=>d(f.target.value),size:"xs"})]})]})}),i.jsxs(Rc,{justifyContent:"flex-end",gap:3,borderTop:"1px solid",borderColor:"red.200",boxShadow:"lg",children:[i.jsx(a.Button,{variant:"outline",size:"sm",onClick:t,children:"Cancel"}),i.jsx(a.Button,{size:"sm",style:{backgroundColor:"#FF0000"},loading:l,onClick:n,children:c})]}),i.jsx(Tc,{asChild:!0,children:i.jsx(a.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(a.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:{}},Mc=gt.exports,Hn;function _c(){return Hn||(Hn=1,(function(e,t){(function(n,r){e.exports=r()})(Mc,(function(){var n=1e3,r=6e4,o=36e5,s="millisecond",c="second",l="minute",u="hour",d="day",f="week",h="month",y="quarter",p="year",v="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+)?$/,w=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={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 T=["th","st","nd","rd"],C=I%100;return"["+I+(T[(C-20)%10]||T[C]||T[0])+"]"}},R=function(I,T,C){var _=String(I);return!_||_.length>=T?I:""+Array(T+1-_.length).join(C)+I},O={s:R,z:function(I){var T=-I.utcOffset(),C=Math.abs(T),_=Math.floor(C/60),E=C%60;return(T<=0?"+":"-")+R(_,2,"0")+":"+R(E,2,"0")},m:function I(T,C){if(T.date()<C.date())return-I(C,T);var _=12*(C.year()-T.year())+(C.month()-T.month()),E=T.clone().add(_,h),N=C-E<0,P=T.clone().add(_+(N?-1:1),h);return+(-(_+(C-E)/(N?E-P:P-E))||0)},a:function(I){return I<0?Math.ceil(I)||0:Math.floor(I)},p:function(I){return{M:h,y:p,w:f,d,D:v,h:u,m:l,s:c,ms:s,Q:y}[I]||String(I||"").toLowerCase().replace(/s$/,"")},u:function(I){return I===void 0}},k="en",D={};D[k]=M;var $="$isDayjsObject",A=function(I){return I instanceof K||!(!I||!I[$])},H=function I(T,C,_){var E;if(!T)return k;if(typeof T=="string"){var N=T.toLowerCase();D[N]&&(E=N),C&&(D[N]=C,E=N);var P=T.split("-");if(!E&&P.length>1)return I(P[0])}else{var m=T.name;D[m]=T,E=m}return!_&&E&&(k=E),E||!_&&k},B=function(I,T){if(A(I))return I.clone();var C=typeof T=="object"?T:{};return C.date=I,C.args=arguments,new K(C)},L=O;L.l=H,L.i=A,L.w=function(I,T){return B(I,{locale:T.$L,utc:T.$u,x:T.$x,$offset:T.$offset})};var K=(function(){function I(C){this.$L=H(C.locale,null,!0),this.parse(C),this.$x=this.$x||C.x||{},this[$]=!0}var T=I.prototype;return T.parse=function(C){this.$d=(function(_){var E=_.date,N=_.utc;if(E===null)return new Date(NaN);if(L.u(E))return new Date;if(E instanceof Date)return new Date(E);if(typeof E=="string"&&!/Z$/i.test(E)){var P=E.match(x);if(P){var m=P[2]-1||0,j=(P[7]||"0").substring(0,3);return N?new Date(Date.UTC(P[1],m,P[3]||1,P[4]||0,P[5]||0,P[6]||0,j)):new Date(P[1],m,P[3]||1,P[4]||0,P[5]||0,P[6]||0,j)}}return new Date(E)})(C),this.init()},T.init=function(){var C=this.$d;this.$y=C.getFullYear(),this.$M=C.getMonth(),this.$D=C.getDate(),this.$W=C.getDay(),this.$H=C.getHours(),this.$m=C.getMinutes(),this.$s=C.getSeconds(),this.$ms=C.getMilliseconds()},T.$utils=function(){return L},T.isValid=function(){return this.$d.toString()!==b},T.isSame=function(C,_){var E=B(C);return this.startOf(_)<=E&&E<=this.endOf(_)},T.isAfter=function(C,_){return B(C)<this.startOf(_)},T.isBefore=function(C,_){return this.endOf(_)<B(C)},T.$g=function(C,_,E){return L.u(C)?this[_]:this.set(E,C)},T.unix=function(){return Math.floor(this.valueOf()/1e3)},T.valueOf=function(){return this.$d.getTime()},T.startOf=function(C,_){var E=this,N=!!L.u(_)||_,P=L.p(C),m=function(q,Y){var se=L.w(E.$u?Date.UTC(E.$y,Y,q):new Date(E.$y,Y,q),E);return N?se:se.endOf(d)},j=function(q,Y){return L.w(E.toDate()[q].apply(E.toDate("s"),(N?[0,0,0,0]:[23,59,59,999]).slice(Y)),E)},z=this.$W,F=this.$M,U=this.$D,G="set"+(this.$u?"UTC":"");switch(P){case p:return N?m(1,0):m(31,11);case h:return N?m(1,F):m(0,F+1);case f:var V=this.$locale().weekStart||0,X=(z<V?z+7:z)-V;return m(N?U-X:U+(6-X),F);case d:case v:return j(G+"Hours",0);case u:return j(G+"Minutes",1);case l:return j(G+"Seconds",2);case c:return j(G+"Milliseconds",3);default:return this.clone()}},T.endOf=function(C){return this.startOf(C,!1)},T.$set=function(C,_){var E,N=L.p(C),P="set"+(this.$u?"UTC":""),m=(E={},E[d]=P+"Date",E[v]=P+"Date",E[h]=P+"Month",E[p]=P+"FullYear",E[u]=P+"Hours",E[l]=P+"Minutes",E[c]=P+"Seconds",E[s]=P+"Milliseconds",E)[N],j=N===d?this.$D+(_-this.$W):_;if(N===h||N===p){var z=this.clone().set(v,1);z.$d[m](j),z.init(),this.$d=z.set(v,Math.min(this.$D,z.daysInMonth())).$d}else m&&this.$d[m](j);return this.init(),this},T.set=function(C,_){return this.clone().$set(C,_)},T.get=function(C){return this[L.p(C)]()},T.add=function(C,_){var E,N=this;C=Number(C);var P=L.p(_),m=function(F){var U=B(N);return L.w(U.date(U.date()+Math.round(F*C)),N)};if(P===h)return this.set(h,this.$M+C);if(P===p)return this.set(p,this.$y+C);if(P===d)return m(1);if(P===f)return m(7);var j=(E={},E[l]=r,E[u]=o,E[c]=n,E)[P]||1,z=this.$d.getTime()+C*j;return L.w(z,this)},T.subtract=function(C,_){return this.add(-1*C,_)},T.format=function(C){var _=this,E=this.$locale();if(!this.isValid())return E.invalidDate||b;var N=C||"YYYY-MM-DDTHH:mm:ssZ",P=L.z(this),m=this.$H,j=this.$m,z=this.$M,F=E.weekdays,U=E.months,G=E.meridiem,V=function(Y,se,ne,he){return Y&&(Y[se]||Y(_,N))||ne[se].slice(0,he)},X=function(Y){return L.s(m%12||12,Y,"0")},q=G||function(Y,se,ne){var he=Y<12?"AM":"PM";return ne?he.toLowerCase():he};return N.replace(w,(function(Y,se){return se||(function(ne){switch(ne){case"YY":return String(_.$y).slice(-2);case"YYYY":return L.s(_.$y,4,"0");case"M":return z+1;case"MM":return L.s(z+1,2,"0");case"MMM":return V(E.monthsShort,z,U,3);case"MMMM":return V(U,z);case"D":return _.$D;case"DD":return L.s(_.$D,2,"0");case"d":return String(_.$W);case"dd":return V(E.weekdaysMin,_.$W,F,2);case"ddd":return V(E.weekdaysShort,_.$W,F,3);case"dddd":return F[_.$W];case"H":return String(m);case"HH":return L.s(m,2,"0");case"h":return X(1);case"hh":return X(2);case"a":return q(m,j,!0);case"A":return q(m,j,!1);case"m":return String(j);case"mm":return L.s(j,2,"0");case"s":return String(_.$s);case"ss":return L.s(_.$s,2,"0");case"SSS":return L.s(_.$ms,3,"0");case"Z":return P}return null})(Y)||P.replace(":","")}))},T.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},T.diff=function(C,_,E){var N,P=this,m=L.p(_),j=B(C),z=(j.utcOffset()-this.utcOffset())*r,F=this-j,U=function(){return L.m(P,j)};switch(m){case p: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 u:N=F/o;break;case l:N=F/r;break;case c:N=F/n;break;default:N=F}return E?N:L.a(N)},T.daysInMonth=function(){return this.endOf(h).$D},T.$locale=function(){return D[this.$L]},T.locale=function(C,_){if(!C)return this.$L;var E=this.clone(),N=H(C,_,!0);return N&&(E.$L=N),E},T.clone=function(){return L.w(this.$d,this)},T.toDate=function(){return new Date(this.valueOf())},T.toJSON=function(){return this.isValid()?this.toISOString():null},T.toISOString=function(){return this.$d.toISOString()},T.toString=function(){return this.$d.toUTCString()},I})(),ee=K.prototype;return B.prototype=ee,[["$ms",s],["$s",c],["$m",l],["$H",u],["$W",d],["$M",h],["$y",p],["$D",v]].forEach((function(I){ee[I[1]]=function(T){return this.$g(T,I[0],I[1])}})),B.extend=function(I,T){return I.$i||(I(T,K,B),I.$i=!0),B},B.locale=H,B.isDayjs=A,B.unix=function(I){return B(1e3*I)},B.en=D[k],B.Ls=D,B.p={},B}))})(gt)),gt.exports}var Oc=_c();const Mt=Ct(Oc);var pt={exports:{}},kc=pt.exports,Vn;function $c(){return Vn||(Vn=1,(function(e,t){(function(n,r){e.exports=r()})(kc,(function(){return function(n,r,o){n=n||{};var s=r.prototype,c={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function l(d,f,h,y){return s.fromToBase(d,f,h,y)}o.en.relativeTime=c,s.fromToBase=function(d,f,h,y,p){for(var v,b,x,w=h.$locale().relativeTime||c,M=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"}],R=M.length,O=0;O<R;O+=1){var k=M[O];k.d&&(v=y?o(d).diff(h,k.d,!0):h.diff(d,k.d,!0));var D=(n.rounding||Math.round)(Math.abs(v));if(x=v>0,D<=k.r||!k.r){D<=1&&O>0&&(k=M[O-1]);var $=w[k.l];p&&(D=p(""+D)),b=typeof $=="string"?$.replace("%d",D):$(D,f,k.l,x);break}}if(f)return b;var A=x?w.future:w.past;return typeof A=="function"?A(b):A.replace("%s",b)},s.to=function(d,f){return l(d,f,this,!0)},s.from=function(d,f){return l(d,f,this)};var u=function(d){return d.$u?o.utc():o()};s.toNow=function(d){return this.to(u(this),d)},s.fromNow=function(d){return this.from(u(this),d)}}}))})(pt)),pt.exports}var Ic=$c();const Ac=Ct(Ic);var vt={exports:{}},Lc=vt.exports,Wn;function Nc(){return Wn||(Wn=1,(function(e,t){(function(n,r){e.exports=r()})(Lc,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,o,s){var c=o.prototype,l=c.format;s.en.formats=n,c.format=function(u){u===void 0&&(u="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(p,v,b){var x=b&&b.toUpperCase();return v||y[b]||n[b]||y[x].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(w,M,R){return M||R.slice(1)}))}))})(u,d===void 0?{}:d);return l.call(this,f)}}}))})(vt)),vt.exports}var zc=Nc();const Pc=Ct(zc);var mt={exports:{}},Yc=mt.exports,Un;function Fc(){return Un||(Un=1,(function(e,t){(function(n,r){e.exports=r()})(Yc,(function(){return function(n,r){var o=r.prototype,s=o.format;o.format=function(c){var l=this,u=this.$locale();if(!this.isValid())return s.bind(this)(c);var d=this.$utils(),f=(c||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(h){switch(h){case"Q":return Math.ceil((l.$M+1)/3);case"Do":return u.ordinal(l.$D);case"gggg":return l.weekYear();case"GGGG":return l.isoWeekYear();case"wo":return u.ordinal(l.week(),"W");case"w":case"ww":return d.s(l.week(),h==="w"?1:2,"0");case"W":case"WW":return d.s(l.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return d.s(String(l.$H===0?24:l.$H),h==="k"?1:2,"0");case"X":return Math.floor(l.$d.getTime()/1e3);case"x":return l.$d.getTime();case"z":return"["+l.offsetName()+"]";case"zzz":return"["+l.offsetName("long")+"]";default:return h}}));return s.bind(this)(f)}}}))})(mt)),mt.exports}var Bc=Fc();const Hc=Ct(Bc);Mt.extend(Ac);Mt.extend(Pc);Mt.extend(Hc);const Vc={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??Vc[t]):r}function Wc({value:e,dateVariant:t="date",timeVariant:n="time",dateFormat:r,timeFormat:o,align:s="start"}){return i.jsxs(a.Stack,{gap:.5,align:s,children:[i.jsx(a.Text,{fontSize:"sm",fontWeight:"500",children:Jt({value:e,variant:t,format:r})}),i.jsx(a.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=Tr;exports.MDSCombobox=bc;exports.MDSConfirmDeleteDialog=Ec;exports.MDSInput=Kt;exports.MDSRefreshButton=$r;exports.MDSSelectBox=Er;exports.RefreshButton=$r;exports.StackedDateTime=Wc;exports.addPreset=_r;exports.deletePreset=Or;exports.formatDateTime=Jt;exports.getPresets=rt;exports.loadOrder=ac;exports.presetStore=Ze;exports.saveOrder=ic;exports.savePresets=Et;exports.setActionsConfig=jr;exports.setData=Dr;exports.setTableId=Rr;exports.tableStore=ie;exports.updatePreset=La;exports.withChildren=S;
|
|
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:c}=fo(),l=nt("DndLiveRegion"),[u,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:p}=h;t.onDragMove&&s(t.onDragMove({active:y,over:p}))},onDragOver(h){let{active:y,over:p}=h;s(t.onDragOver({active:y,over:p}))},onDragEnd(h){let{active:y,over:p}=h;s(t.onDragEnd({active:y,over:p}))},onDragCancel(h){let{active:y,over:p}=h;s(t.onDragCancel({active:y,over:p}))}}),[s,t])),!u)return null;const f=g.createElement(g.Fragment,null,g.createElement(lo,{id:r,value:o.draggable}),g.createElement(uo,{id:l,announcement:c}));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 Co(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function En(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=En(t,t.left,t.top),s=[];for(const c of r){const{id:l}=c,u=n.get(l);if(u){const d=yo(En(u),o);s.push({id:l,data:{droppableContainer:c,value:d}})}}return s.sort(So)};function Do(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),c=o-r,l=s-n;if(r<o&&n<s){const u=t.width*t.height,d=e.width*e.height,f=c*l,h=f/(u+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:c}=s,l=n.get(c);if(l){const u=Do(l,t);u>0&&o.push({id:c,data:{droppableContainer:s,value:u}})}}return o.sort(wo)};function jo(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 To(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];return o.reduce((c,l)=>({...c,top:c.top+e*l.y,bottom:c.bottom+e*l.y,left:c.left+e*l.x,right:c.right+e*l.x}),{...n})}}const Eo=To(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:c,y:l}=r,u=e.left-c-(1-o)*parseFloat(n),d=e.top-l-(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:u+f,bottom:d+h,left:u}}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:c,bottom:l,right:u}=n;return{top:r,left:o,width:s,height:c,bottom:l,right:u}}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!Dt||!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!Dt||!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,c=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:o,isLeft:s,isBottom:c,isRight:l,maxScroll:r,minScroll:t}}const Ao={x:.2,y:.2};function Lo(e,t,n,r,o){let{top:s,left:c,right:l,bottom:u}=n;r===void 0&&(r=10),o===void 0&&(o=Ao);const{isTop:d,isBottom:f,isLeft:h,isRight:y}=sr(e),p={x:0,y:0},v={x:0,y:0},b={height:t.height*o.y,width:t.width*o.x};return!d&&s<=t.top+b.height?(p.y=Q.Backward,v.y=r*Math.abs((t.top+b.height-s)/b.height)):!f&&u>=t.bottom-b.height&&(p.y=Q.Forward,v.y=r*Math.abs((t.bottom-b.height-u)/b.height)),!y&&l>=t.right-b.width?(p.x=Q.Forward,v.x=r*Math.abs((t.right-b.width-l)/b.width)):!h&&c<=t.left+b.width&&(p.x=Q.Backward,v.x=r*Math.abs((t.left+b.width-c)/b.width)),{direction:p,speed:v}}function No(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:c}=window;return{top:0,left:0,right:s,bottom:c,width:s,height:c}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function 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,c,l]of Fo)for(const u of c)Object.defineProperty(this,u,{get:()=>{const d=l(r),f=o[s]-d;return this.rect[u]+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:c=Vo,scrollBehavior:l="smooth"}=o,{code:u}=t;if(s.end.includes(u)){this.handleEnd(t);return}if(s.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:d}=r.current,f=d?{x:d.left,y:d.top}:pe;this.referenceCoordinates||(this.referenceCoordinates=f);const h=c(t,{active:n,context:r.current,currentCoordinates:f});if(h){const y=yt(h,f),p={x:0,y:0},{scrollableAncestors:v}=r.current;for(const b of v){const x=t.code,{isTop:w,isRight:M,isLeft:R,isBottom:O,maxScroll:k,minScroll:D}=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&&!M||x===W.Left&&!R,B=x===W.Down&&!O||x===W.Up&&!w;if(H&&A.x!==h.x){const L=b.scrollLeft+y.x,K=x===W.Right&&L<=k.x||x===W.Left&&L>=D.x;if(K&&!y.y){b.scrollTo({left:L,behavior:l});return}K?p.x=b.scrollLeft-L:p.x=x===W.Right?b.scrollLeft-k.x:b.scrollLeft-D.x,p.x&&b.scrollBy({left:-p.x,behavior:l});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>=D.y;if(K&&!y.x){b.scrollTo({top:L,behavior:l});return}K?p.y=b.scrollTop-L:p.y=x===W.Down?b.scrollTop-k.y:b.scrollTop-D.y,p.y&&b.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(t,$e(yt(h,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}cr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=ar,onActivation:o}=t,{active:s}=n;const{code:c}=e.nativeEvent;if(r.start.includes(c)){const l=s.activatorNode.current;return l&&e.target!==l?!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:c}=s;this.props=t,this.events=n,this.document=Le(c),this.documentListeners=new Ge(this.document),this.listeners=new Ge(r),this.windowListeners=new Ge(ae(c)),this.initialCoordinates=(o=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:c,options:{activationConstraint:l}}=s;if(!o)return;const u=(n=Ut(t))!=null?n:pe,d=yt(o,u);if(!r&&l){if(On(l)){if(l.tolerance!=null&&Yt(d,l.tolerance))return this.handleCancel();if(Yt(d,l.distance))return this.handleStart()}if(kn(l)&&Yt(d,l.tolerance))return this.handleCancel();this.handlePending(l,d);return}t.cancelable&&t.preventDefault(),c(u)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===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:c=5,order:l=wt.TreeOrder,pointerCoordinates:u,scrollableAncestors:d,scrollableAncestorRects:f,delta:h,threshold:y}=e;const p=Jo({delta:h,disabled:!s}),[v,b]=oo(),x=g.useRef({x:0,y:0}),w=g.useRef({x:0,y:0}),M=g.useMemo(()=>{switch(n){case Xe.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case Xe.DraggableRect:return o}},[n,o,u]),R=g.useRef(null),O=g.useCallback(()=>{const D=R.current;if(!D)return;const $=x.current.x*w.current.x,A=x.current.y*w.current.y;D.scrollBy($,A)},[]),k=g.useMemo(()=>l===wt.TreeOrder?[...d].reverse():d,[l,d]);g.useEffect(()=>{if(!s||!d.length||!M){b();return}for(const D of k){if(r?.(D)===!1)continue;const $=d.indexOf(D),A=f[$];if(!A)continue;const{direction:H,speed:B}=Lo(D,A,M,t,y);for(const L of["x","y"])p[L][H[L]]||(B[L]=0,H[L]=0);if(B.x>0||B.y>0){b(),R.current=D,v(O,c),x.current=B,w.current=H;return}}x.current={x:0,y:0},w.current={x:0,y:0},b()},[t,O,r,b,s,c,JSON.stringify(M),JSON.stringify(p),v,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(c=>({eventName:c.eventName,handler:t(c.handler,r)}));return[...n,...s]},[]),[e,t])}var Je;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Je||(Je={}));var qt;(function(e){e.Optimized="optimized"})(qt||(qt={}));const $n=new Map;function es(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,c]=g.useState(null),{frequency:l,measure:u,strategy:d}=o,f=g.useRef(e),h=x(),y=Ke(h),p=g.useCallback(function(w){w===void 0&&(w=[]),!y.current&&c(M=>M===null?w:M.concat(w.filter(R=>!M.includes(R))))},[y]),v=g.useRef(null),b=tt(w=>{if(h&&!n)return $n;if(!w||w===$n||f.current!==e||s!=null){const M=new Map;for(let R of e){if(!R)continue;if(s&&s.length>0&&!s.includes(R.id)&&R.rect.current){M.set(R.id,R.rect.current);continue}const O=R.node.current,k=O?new rn(u(O),O):null;R.rect.current=k,k&&M.set(R.id,k)}return M}return w},[e,s,n,h,u]);return g.useEffect(()=>{f.current=e},[e]),g.useEffect(()=>{h||p()},[n,h]),g.useEffect(()=>{s&&s.length>0&&c(null)},[JSON.stringify(s)]),g.useEffect(()=>{h||typeof l!="number"||v.current!==null||(v.current=setTimeout(()=>{p(),v.current=null},l))},[l,h,p,...r]),{droppableRects:b,measureDroppableContainers:p,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(u=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=u??n)!=null?d:null}const f=t(e);return JSON.stringify(u)===JSON.stringify(f)?u:f})}const c=ns({callback(u){if(e)for(const d of u){const{type:f,target:h}=d;if(f==="childList"&&h instanceof HTMLElement&&h.contains(e)){s();break}}}}),l=Rt({callback:s});return be(()=>{s(),e?(l?.observe(e),c?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),c?.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 c=Pt(s.target);c&&n(l=>l?(l.set(c,Gt(c)),new Map(l)):null)},[]);return g.useEffect(()=>{const s=r.current;if(e!==s){c(s);const l=e.map(u=>{const d=Pt(u);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,Gt(d)]):null}).filter(u=>u!=null);n(l.length?new Map(l):null),r.current=e}return()=>{c(e),c(s)};function c(l){l.forEach(u=>{const d=Pt(u);d?.removeEventListener("scroll",o)})}},[o,e]),g.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,c)=>$e(s,c),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(!Dt)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function cs(e,t){return g.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:s}=r;return n[o]=c=>{s(c,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 c(){s(()=>e.length?e.map(u=>or(u)?r:new rn(t(u),u)):Nn)}const l=Rt({callback:c});return be(()=>{l?.disconnect(),c(),e.forEach(u=>l?.observe(u))},[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}),c=g.useCallback(d=>{const f=us(d);s?.disconnect(),f&&s?.observe(f),r(f?t(f):null)},[t,s]),[l,u]=xt(c);return g.useMemo(()=>({nodeRef:l,rect:n,setRef:u}),[n,l,u])}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},jt=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 c=new qe(e.droppable.containers);return c.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:c}}}case Z.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const 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(jt),s=Wt(r),c=Wt(n?.id);return g.useEffect(()=>{if(!t&&!r&&s&&c!=null){if(!tn(s)||document.activeElement===s.target)return;const l=o.get(c);if(!l)return;const{activatorNode:u,node:d}=l;if(!u.current&&!d.current)return;requestAnimationFrame(()=>{for(const f of[u.current,d.current]){if(!f)continue;const h=ao(f);if(h){h.focus();break}}})}},[r,t,o,c,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:c,y:l}=typeof o=="boolean"?{x:o,y:o}:o;be(()=>{if(!c&&!l||!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(c||(h.x=0),l||(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,c,l,r,n])}const fr=g.createContext({...pe,scaleX:1,scaleY:1});var je;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(je||(je={}));const hr=g.memo(function(t){var n,r,o,s;let{id:c,accessibility:l,autoScroll:u=!0,children:d,sensors:f=fs,collisionDetection:h=Ro,measuring:y,modifiers:p,...v}=t;const b=g.useReducer(ms,void 0,vs),[x,w]=b,[M,R]=go(),[O,k]=g.useState(je.Uninitialized),D=O===je.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),[T,C]=g.useState(null),[_,E]=g.useState(null),N=Ke(v,Object.values(v)),P=nt("DndDescribedBy",c),m=g.useMemo(()=>B.getEnabled(),[B]),j=ys(y),{droppableRects:z,measureDroppableContainers:F,measuringScheduled:U}=es(m,{dragging:D,dependencies:[H.x,H.y],config:j.droppable}),G=Zo(A,$),V=g.useMemo(()=>_?Ut(_):null,[_]),X=Fr(),q=ts(G,j.draggable.measure);Ss({activeNode:$!=null?A.get($):null,config:X.layoutShiftCompensation,initialRect:q,measure:j.draggable.measure});const Y=In(G,j.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:j.dragOverlay.measure}),Ee=(r=xe.nodeRef.current)!=null?r:G,Me=D?(o=xe.rect)!=null?o:Y:null,cn=!!(xe.nodeRef.current&&xe.rect),ln=os(cn?null:Y),_t=ur(Ee?ae(Ee):null),Se=ss(D?he??G:null),ot=ls(Se),st=xs(p,{transform:{x:H.x-ln.x,y:H.y-ln.y,scaleX:1,scaleY:1},activatorEvent:_,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?Eo(Me,st):null,ze=ee&&Oe?h({active:ee,collisionRect:Oe,droppableRects:z,droppableContainers:m,pointerCoordinates:un}):null,fn=Co(ze,"id"),[we,hn]=g.useState(null),Lr=cn?st:$e(st,Ar),Nr=jo(Lr,(s=we?.rect)!=null?s:null,Y),Ot=g.useRef(null),gn=g.useCallback((re,ce)=>{let{sensor:le,options:Ce}=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:Ce,context:ne,onAbort(te){if(!A.get(te))return;const{onDragAbort:me}=N.current,ye={id:te};me?.(ye),M({type:"onDragAbort",event:ye})},onPending(te,De,me,ye){if(!A.get(te))return;const{onDragPending:Ye}=N.current,Re={id:te,constraint:De,initialCoordinates:me,offset:ye};Ye?.(Re),M({type:"onDragPending",event:Re})},onStart(te){const De=I.current;if(De==null)return;const me=A.get(De);if(!me)return;const{onDragStart:ye}=N.current,Pe={activatorEvent:ue,active:{id:De,data:me.data,rect:K}};Ue.unstable_batchedUpdates(()=>{ye?.(Pe),k(je.Initializing),w({type:Z.DragStart,initialCoordinates:te,active:De}),M({type:"onDragStart",event:Pe}),C(Ot.current),E(ue)})},onMove(te){w({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(()=>{w({type:te}),k(je.Uninitialized),hn(null),C(null),E(null),Ot.current=null;const Fe=te===Z.DragEnd?"onDragEnd":"onDragCancel";if(Re){const kt=N.current[Fe];kt?.(Re),M({type:Fe,event:Re})}})}}},[A]),zr=g.useCallback((re,ce)=>(le,Ce)=>{const de=le.nativeEvent,ue=A.get(Ce);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=Ce,gn(le,ce))},[A,gn]),pn=Qo(f,zr);as(f),be(()=>{Y&&O===je.Initializing&&k(je.Initialized)},[Y,O]),g.useEffect(()=>{const{onDragMove:re}=N.current,{active:ce,activatorEvent:le,collisions:Ce,over:de}=ne.current;if(!ce||!le)return;const ue={active:ce,activatorEvent:le,collisions:Ce,delta:{x:_e.x,y:_e.y},over:de};Ue.unstable_batchedUpdates(()=>{re?.(ue),M({type:"onDragMove",event:ue})})},[_e.x,_e.y]),g.useEffect(()=>{const{active:re,activatorEvent:ce,collisions:le,droppableContainers:Ce,scrollAdjustedTranslate:de}=ne.current;if(!re||I.current==null||!ce||!de)return;const{onDragOver:ue}=N.current,ve=Ce.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),M({type:"onDragOver",event:te})})},[fn]),be(()=>{ne.current={activatorEvent:_,active:ee,activeNode:G,collisionRect:Oe,collisions:ze,droppableRects:z,draggableNodes:A,draggingNode:Ee,draggingNodeRect:Me,droppableContainers:B,over:we,scrollableAncestors:Se,scrollAdjustedTranslate:_e},K.current={initial:Me,translated:Oe}},[ee,G,ze,Oe,A,Ee,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:_,collisions:ze,containerNodeRect:se,dragOverlay:xe,draggableNodes:A,droppableContainers:B,droppableRects:z,over:we,measureDroppableContainers:F,scrollableAncestors:Se,scrollableAncestorRects:ot,measuringConfiguration:j,measuringScheduled:U,windowRect:_t}),[ee,G,Y,_,ze,se,xe,A,B,z,we,F,Se,ot,j,U,_t]),Yr=g.useMemo(()=>({activatorEvent:_,activators:pn,active:ee,activeNodeRect:Y,ariaDescribedById:{draggable:P},dispatch:w,draggableNodes:A,over:we,measureDroppableContainers:F}),[_,pn,ee,Y,w,P,A,we,F]);return g.createElement(Zn.Provider,{value:R},g.createElement(jt.Provider,{value:Yr},g.createElement(dr.Provider,{value:Pr},g.createElement(fr.Provider,{value:Nr},d)),g.createElement(bs,{disabled:l?.restoreFocus===!1})),g.createElement(mo,{...l,hiddenTextDescribedById:P}));function Fr(){const re=T?.autoScrollEnabled===!1,ce=typeof u=="object"?u.enabled===!1:u===!1,le=D&&!re&&!ce;return typeof u=="object"?{...u,enabled:le}:{enabled:le}}}),ws=g.createContext(null),zn="button",Cs="Draggable";function Ds(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=nt(Cs),{activators:c,activatorEvent:l,active:u,activeNodeRect:d,ariaDescribedById:f,draggableNodes:h,over:y}=g.useContext(jt),{role:p=zn,roleDescription:v="draggable",tabIndex:b=0}=o??{},x=u?.id===t,w=g.useContext(x?fr:ws),[M,R]=xt(),[O,k]=xt(),D=cs(c,t),$=Ke(n);be(()=>(h.set(t,{id:t,key:s,node:M,activatorNode:O,data:$}),()=>{const H=h.get(t);H&&H.key===s&&h.delete(t)}),[h,t]);const A=g.useMemo(()=>({role:p,tabIndex:b,"aria-disabled":r,"aria-pressed":x&&p===zn?!0:void 0,"aria-roledescription":v,"aria-describedby":f.draggable}),[r,p,b,x,v,f.draggable]);return{active:u,activatorEvent:l,activeNodeRect:d,attributes:A,isDragging:x,listeners:r?void 0:D,node:M,over:y,setNodeRef:R,setActivatorNodeRef:k,transform:w}}function Rs(){return g.useContext(dr)}const js="Droppable",Ts={timeout:25};function Es(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=nt(js),{active:c,dispatch:l,over:u,measureDroppableContainers:d}=g.useContext(jt),f=g.useRef({disabled:n}),h=g.useRef(!1),y=g.useRef(null),p=g.useRef(null),{disabled:v,updateMeasurementsFor:b,timeout:x}={...Ts,...o},w=Ke(b??r),M=g.useCallback(()=>{if(!h.current){h.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{d(Array.isArray(w.current)?w.current:[w.current]),p.current=null},x)},[x]),R=Rt({callback:M,disabled:v||!c}),O=g.useCallback((A,H)=>{R&&(H&&(R.unobserve(H),h.current=!1),A&&R.observe(A))},[R]),[k,D]=xt(O),$=Ke(t);return g.useEffect(()=>{!R||!k.current||(R.disconnect(),h.current=!1,R.observe(k.current))},[k,R]),g.useEffect(()=>(l({type:Z.RegisterDroppable,element:{id:r,key:s,disabled:n,node:k,rect:y,data:$}}),()=>l({type:Z.UnregisterDroppable,key:s,id:r})),[r]),g.useEffect(()=>{n!==f.current.disabled&&(l({type:Z.SetDroppableDisabled,id:r,key:s,disabled:n}),f.current.disabled=n)},[r,s,n,l]),{active:c,rect:y,isOver:u?.id===r,node:k,over:u,setNodeRef:D}}function Tt(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:c}=e;const l=(t=n[o])!=null?t:r;if(!l)return null;const u=$s(n,c,o);if(c===o){const d=n[s];return d?{x:o<s?d.left+d.width-(l.left+l.width):d.left-l.left,y:0,...dt}:null}return c>o&&c<=s?{x:-l.width-u,y:0,...dt}:c<o&&c>=s?{x:l.width+u,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=Tt(t,r,n),c=t[o],l=s[o];return!l||!c?null:{x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height}},ft={scaleX:1,scaleY:1},Is=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:s,overIndex:c}=e;const l=(t=s[n])!=null?t:r;if(!l)return null;if(o===n){const d=s[c];return d?{x:0,y:n<c?d.top+d.height-(l.top+l.height):d.top-l.top,...ft}:null}const u=As(s,o,n);return o>n&&o<=c?{x:0,y:-l.height-u,...ft}:o<n&&o>=c?{x:0,y:l.height+u,...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:c,dragOverlay:l,droppableRects:u,over:d,measureDroppableContainers:f}=Rs(),h=nt(pr,n),y=l.rect!==null,p=g.useMemo(()=>r.map(D=>typeof D=="object"&&"id"in D?D.id:D),[r]),v=c!=null,b=c?p.indexOf(c.id):-1,x=d?p.indexOf(d.id):-1,w=g.useRef(p),M=!_s(p,w.current),R=x!==-1&&b===-1||M,O=Os(s);be(()=>{M&&v&&f(p)},[M,p,v,f]),g.useEffect(()=>{w.current=p},[p]);const k=g.useMemo(()=>({activeIndex:b,containerId:h,disabled:O,disableTransforms:R,items:p,overIndex:x,useDragOverlay:y,sortedRects:Ms(p,u),strategy:o}),[b,h,O.draggable,O.droppable,R,p,x,u,y,o]);return g.createElement(vr.Provider,{value:k},t)}const Ls=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Tt(n,r,o).indexOf(t)},Ns=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:s,newIndex:c,previousItems:l,previousContainerId:u,transition:d}=e;return!d||!r||l!==s&&o===c?!1:n?!0:c!==o&&t===u},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,c]=g.useState(null),l=g.useRef(n);return be(()=>{if(!t&&n!==l.current&&r.current){const u=o.current;if(u){const d=Ne(r.current,{ignoreTransform:!0}),f={x:u.left-d.left,y:u.top-d.top,scaleX:u.width/d.width,scaleY:u.height/d.height};(f.x||f.y)&&c(f)}}n!==l.current&&(l.current=n)},[t,n,r,o]),g.useEffect(()=>{s&&c(null)},[s]),s}function xr(e){let{animateLayoutChanges:t=Ns,attributes:n,disabled:r,data:o,getNewIndex:s=Ls,id:c,strategy:l,resizeObserverConfig:u,transition:d=zs}=e;const{items:f,containerId:h,activeIndex:y,disabled:p,disableTransforms:v,sortedRects:b,overIndex:x,useDragOverlay:w,strategy:M}=g.useContext(vr),R=Bs(r,p),O=f.indexOf(c),k=g.useMemo(()=>({sortable:{containerId:h,index:O,items:f},...o}),[h,o,O,f]),D=g.useMemo(()=>f.slice(f.indexOf(c)),[f,c]),{rect:$,node:A,isOver:H,setNodeRef:B}=Es({id:c,data:k,disabled:R.droppable,resizeObserverConfig:{updateMeasurementsFor:D,...u}}),{active:L,activatorEvent:K,activeNodeRect:ee,attributes:I,setNodeRef:T,listeners:C,isDragging:_,over:E,setActivatorNodeRef:N,transform:P}=Ds({id:c,data:k,attributes:{...Ys,...n},disabled:R.draggable}),m=ro(B,T),j=!!L,z=j&&!v&&ut(y)&&ut(x),F=!w&&_,U=F&&z?P:null,V=z?U??(l??M)({rects:b,activeNodeRect:ee,activeIndex:y,overIndex:x,index:O}):null,X=ut(y)&&ut(x)?s({id:c,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:_,isSorting:j,id:c,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(()=>{j&&Y.current.newIndex!==X&&(Y.current.newIndex=X),h!==Y.current.containerId&&(Y.current.containerId=h),f!==Y.current.items&&(Y.current.items=f)},[j,X,h,f]),g.useEffect(()=>{if(q===Y.current.activeId)return;if(q!=null&&Y.current.activeId==null){Y.current.activeId=q;return}const Ee=setTimeout(()=>{Y.current.activeId=q},50);return()=>clearTimeout(Ee)},[q]),{active:L,activeIndex:y,attributes:I,data:k,rect:$,index:O,newIndex:X,items:f,isOver:H,isSorting:j,isDragging:_,listeners:C,node:A,overIndex:x,over:E,setNodeRef:m,setActivatorNodeRef:N,setDroppableNodeRef:B,setDraggableNodeRef:T,transform:he??V,transition:xe()};function xe(){if(he||se&&Y.current.newIndex===O)return Ps;if(!(F&&!tn(K)||!d)&&(j||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:c,...l},u)=>g.createElement("svg",{ref:u,...Us,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:yr("lucide",o),...!s&&!Ws(l)&&{"aria-hidden":"true"},...l},[...c.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"}]],Ci=oe("triangle-alert",wi);function S(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}`,Cr=e=>`table_column_visibility_v1:${e}`,Di=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 ji=e=>{ie.setState(t=>{const n={...t.visibility,[e]:!t.visibility[e]};return t.tableId&&localStorage.setItem(Cr(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 Dr(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,c=JSON.parse(localStorage.getItem(wr(s))||"[]"),l=[...c.map(f=>o.find(h=>h.id===f)).filter(Boolean),...o.filter(f=>!c.includes(f.id))],u=JSON.parse(localStorage.getItem(Cr(s))||"{}"),d=l.reduce((f,h)=>(f[h.id]=u[h.id]??!0,f),{});ie.setState(f=>({...f,data:e,columnOrder:l,visibility:d,sortableColumns:l.map(h=>({id:h.id,label:h.label,sortable:!0,backgroundColor:h.backgroundColor}))}))}function Rr(e){ie.setState(t=>({...t,tableId:e}))}const jr=e=>{ie.setState(t=>({...t,actionsConfig:e}))},Ti=S(a.Menu.Trigger),Ei=S(a.Menu.Positioner),Mi=S(a.Menu.Content),_i=S(a.Menu.Item),Oi=S(a.Checkbox.Label),ki=S(a.Checkbox.HiddenInput),$i=S(a.Checkbox.Control);function Ii({visibility:e,onToggle:t}){const{sortableColumns:n}=Qe(ie);return i.jsxs(a.Menu.Root,{closeOnSelect:!1,children:[i.jsx(Ti,{asChild:!0,children:i.jsx(a.IconButton,{"aria-label":"Toggle columns",variant:"ghost",ml:"1",size:"xs",children:i.jsx(ci,{size:18})})}),i.jsx(a.Portal,{children:i.jsx(Ei,{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(a.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:c}){const{setNodeRef:l,attributes:u,listeners:d,transform:f,transition:h}=xr({id:e});return i.jsx(a.Table.ColumnHeader,{ref:l,onClick:n,backgroundColor:c,w:e==="id"?"80px":void 0,style:{transform:Ie.Transform.toString(f),transition:h,cursor:r,borderRight:o,borderRightColor:s},...u,children:i.jsxs(a.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),c=e.map(u=>o.find(d=>d.id===u.id)).filter(u=>u!==void 0).filter(u=>t[u.id]),l=u=>{const{active:d,over:f}=u;if(!f||d.id===f.id)return;const h=e.findIndex(v=>v.id===d.id),y=e.findIndex(v=>v.id===f.id),p=Tt(e,h,y);Di(p)};return i.jsx(a.Table.Header,{background:"blue.200",position:"sticky",top:0,p:"0",zIndex:1,children:i.jsx(hr,{collisionDetection:Qn,onDragEnd:l,children:i.jsx(mr,{items:e.map(u=>u.id),strategy:ks,children:i.jsxs(a.Table.Row,{height:"28px",children:[c.map(u=>{const d=n===u?.id;return i.jsx(Ai,{id:u?.id,onClick:()=>u?.sortable&&Ri(u?.id),cursor:u?.sortable?"pointer":"default",borderRight:"2px solid #dcdcdc",backgroundColor:u?.backgroundColor,children:i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,userSelect:"none"},children:[u?.label,u?.sortable&&(d?r==="asc"?i.jsx(Qs,{size:14}):i.jsx(qs,{size:14}):i.jsx(Js,{size:14,opacity:.4}))]})},u?.id)}),s?.showActionColumn&&i.jsx(a.Table.ColumnHeader,{width:s.width,backgroundColor:s.backgroundColor,borderRight:"2px solid #dcdcdc",children:s.children}),s?.showColumnVisibilityMenu&&i.jsx(a.Table.ColumnHeader,{boxSize:"0.5",backgroundColor:s.backgroundColorColumnVisibilityMenu,children:i.jsx(Ii,{visibility:t,onToggle:ji})})]})})})})}const Ni=[10,20,50,100],zi=S(a.Select.Positioner),Pi=S(a.Select.Content),Yi=S(a.Select.Item),Fi=S(a.Pagination.PrevTrigger),Bi=S(a.Pagination.NextTrigger),Hi=S(a.Select.HiddenSelect),Vi=S(a.Select.Control),Wi=S(a.Select.Trigger),Ui=S(a.Select.ValueText),Gi=S(a.Select.IndicatorGroup),Xi=S(a.Select.Indicator);function qi({totalCount:e,pageSize:t,currentPage:n,onPageChange:r,onPageSizeChange:o,siblingCount:s=2,pageSizeOptions:c=Ni}){const l=a.createListCollection({items:c.map(u=>({label:String(u),value:String(u)}))});return i.jsx(a.Box,{width:"100%",children:i.jsxs(a.HStack,{justify:"space-between",mx:"auto",flexWrap:"wrap",children:[i.jsxs(a.HStack,{children:[i.jsx(a.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:"Rows per page:"}),i.jsxs(a.Select.Root,{collection:l,size:"sm",width:"60px",onValueChange:u=>o?.(Number(u.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(a.Portal,{children:i.jsx(zi,{children:i.jsx(Pi,{children:l.items.map(u=>i.jsxs(Yi,{item:u.value,children:[u.label,i.jsx(a.Select.ItemIndicator,{})]},u.value))})})})]})]}),i.jsx(a.Pagination.Root,{count:e,pageSize:t,page:n,siblingCount:s,onPageChange:u=>r&&r(u.page),children:i.jsxs(a.ButtonGroup,{size:"sm",variant:"ghost",children:[i.jsx(Fi,{asChild:!0,children:i.jsx(a.IconButton,{"aria-label":"Previous page",children:i.jsx(oi,{size:18})})}),i.jsx(a.Pagination.Items,{render:u=>i.jsx(a.IconButton,{variant:u.type==="page"&&u.value===n?"outline":"ghost","aria-current":u.type==="page"&&u.value===n?"page":void 0,children:u.type==="page"?u.value:"…"},u.value??u.type)}),i.jsx(Bi,{asChild:!0,children:i.jsx(a.IconButton,{"aria-label":"Next page",children:i.jsx(ii,{size:18})})})]})})]})})}const Ki=S(a.Menu.Item),Ji=S(a.Menu.Content),Zi=S(a.Menu.Positioner),Qi=S(a.Menu.Trigger);function ea({data:e=[],actions:t=[]}){const{columnOrder:n,visibility:r}=Qe(ie);return i.jsx(a.Table.Body,{children:e.map(o=>i.jsxs(a.Table.Row,{_hover:{bg:"blue.50"},children:[n.filter(s=>r[s.id]).map(s=>i.jsx(a.Table.Cell,{children:o[s.id]},s.id)),i.jsx(a.Table.Cell,{textAlign:"center",display:"flex",gap:2,children:i.jsxs(a.Menu.Root,{children:[i.jsx(Qi,{asChild:!0,children:i.jsx(a.IconButton,{"aria-label":"Open",variant:"ghost",size:"sm",children:i.jsx(fi,{size:16})})}),i.jsx(a.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(a.Table.Cell,{})]},o.id))})}function ta({rows:e=6,columns:t}){return i.jsx(a.Table.Body,{children:Array.from({length:e}).map((n,r)=>i.jsx(a.Table.Row,{children:Array.from({length:t}).map((o,s)=>i.jsx(a.Table.Cell,{children:i.jsx(a.Skeleton,{height:"25px"})},s))},r))})}function na({tableId:e,data:t=[],headers:n=[],loading:r=!1,loadingChildren:o,skeletonLoading:s=!1,emptyMessage:c="No data",actions:l,page:u=1,pageSize:d=10,onPageChange:f,onPageSizeChange:h,density:y="sm",totalCount:p=0,paginationMode:v="client",actionConfig:b,pageSizeOptions:x}){g.useEffect(()=>{Rr(e)},[e]),g.useEffect(()=>{Dr(t,n)},[t,n]),g.useEffect(()=>{b&&jr(b)},[b]);const{sortColumn:w,sortDirection:M,data:R,columnOrder:O}=Qe(ie),k=g.useMemo(()=>{const D=[...R],$=Math.max(1,u||1);if(w&&D.sort((A,H)=>M==="asc"?String(A[w]).localeCompare(String(H[w])):String(H[w]).localeCompare(String(A[w]))),v==="client"){const A=($-1)*d;return D.slice(A,A+d)}return D},[R,w,M,u,d,v]);return g.useEffect(()=>{u<1&&f&&f(1)},[u,f]),i.jsxs(a.Box,{h:"100%",display:"flex",flexDirection:"column",p:2,pt:2,minHeight:0,children:[i.jsx(a.Box,{flex:"1",minHeight:0,overflow:"auto",h:"100%",children:i.jsxs(a.Table.Root,{variant:"outline",w:"100%",size:y,children:[i.jsx(Li,{}),r?i.jsx(a.Table.Body,{children:i.jsx(a.Table.Row,{children:i.jsx(a.Table.Cell,{colSpan:O.length+(l?1:0),children:i.jsx(a.Box,{display:"flex",alignItems:"center",justifyContent:"center",h:"81vh",w:"100%",children:o??"Loading..."})})})}):s?i.jsx(ta,{rows:d,columns:n.length+(l?2:0)}):k.length===0?i.jsx(a.Table.Body,{children:i.jsx(a.Table.Row,{children:i.jsx(a.Table.Cell,{colSpan:n.length+(l?1:0),children:i.jsx(a.Box,{display:"flex",alignItems:"center",justifyContent:"center",minH:"200px",color:"gray.500",children:c})})})}):i.jsx(ea,{data:k,actions:l})]})}),i.jsx(a.Box,{mt:.5,children:i.jsx(qi,{totalCount:p,pageSize:d,currentPage:u,onPageChange:f,onPageSizeChange:D=>{h&&h(D),u>1&&f&&f(1)},pageSizeOptions:x})})]})}const ra=S(a.Checkbox.Root),oa=S(a.Checkbox.HiddenInput),sa=S(a.Checkbox.Control),ia=S(a.Checkbox.Label),Tr=({value:e,onChange:t,size:n="sm",label:r,helperText:o,isDisabled:s,required:c,errorText:l})=>i.jsxs(ra,{value:e,onChange:t,size:n,children:[i.jsx(oa,{}),i.jsx(sa,{disabled:s,required:c,errorText:l,helperText:o}),r&&i.jsx(ia,{children:r})]}),J=" to ",Fn=10,Te={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>=Te.YEAR_MIN&&r<=Te.YEAR_MAX?r:t;if(n>0&&n<4){const o=t.toString(),s=4-n,c=o.substring(0,s);return parseInt(c+e)}return t},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 c,l,u;return n.length===1?(c=parseInt(n[0])||s,l=o,u=r):n.length===2?(c=parseInt(n[0])||s,l=parseInt(n[1])||o,u=r):(c=parseInt(n[0])||s,l=parseInt(n[1])||o,u=ca(n[2],r)),l=Math.max(1,Math.min(Te.MONTH_MAX,l)),c=Math.max(1,Math.min(Te.DAY_MAX,c)),`${u}-${String(l).padStart(2,"0")}-${String(c).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>Te.DAY_MAX)return t}if(e[1]?.length>0){const n=parseInt(e[1]);if(isNaN(n)||n===0||e[1].length===2&&n>Te.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<Te.YEAR_MIN||n>Te.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=S(a.Popover.Root),da=S(a.Popover.Trigger),fa=S(a.Popover.Content),ha=S(a.Popover.Positioner);function ga({value:e,onChange:t,disabled:n=!1}){const[r="",o=""]=e?e.split("|"):[],[s,c]=g.useState(()=>r&&o?`${ge(r)}${J}${ge(o)}`:r?ge(r):""),[l,u]=g.useState(!1),d=g.useRef(null);g.useEffect(()=>{const v=b=>{b.ctrlKey&&b.key==="d"&&!b.shiftKey&&!b.metaKey&&(b.preventDefault(),d.current?.focus())};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[]);const f=v=>{let b=v;if(b.includes(J)){const[x,w=""]=b.split(J);b=`${We(x.trim())}${J}${We(w.trim())}`}else if(b.toLowerCase().includes(" to ")){const[x,w=""]=b.split(/\s+to\s+/i);b=`${We(x.trim())} to ${We(w.trim())}`}else b=We(b);c(b)},h=()=>{const v=s.trim();if(!v){t(void 0);return}if(v.includes(J)){const[b,x=""]=v.split(J).map(R=>R.trim()),w=Ve(b),M=x?Ve(x):null;if(w&&M){const[R,O]=M<w?[M,w]:[w,M],k=`${ge(R)}${J}${ge(O)}`;c(k),t(`${R}|${O}`)}else if(w&&!x)c(`${ge(w)}${J}`),t(void 0);else if(w&&x){const R=aa(),[O,k]=R<w?[R,w]:[w,R],D=`${ge(O)}${J}${ge(k)}`;c(D),t(`${O}|${k}`)}else c(""),t(void 0)}else{const b=Ve(v);b?(c(`${ge(b)}${J}`),t(void 0)):(c(""),t(void 0))}},y=v=>{if(v.key!=="Enter")return;v.preventDefault();const b=d.current?.selectionStart||0,x=s.indexOf(J);if(!s.trim()){c(`${Bn()}${J}`);return}if(x===-1){const M=Ve(s.trim());M&&c(`${ge(M)}${J}`);return}if(b<=x+J.length){const M=s.substring(0,x).trim(),R=s.substring(x+J.length),O=Ve(M);O&&c(`${ge(O)}${J}${R}`);return}if(s.substring(x+J.length).trim())h(),d.current?.blur();else{const M=s.substring(0,x+J.length)+Bn();c(M),setTimeout(()=>{h(),d.current?.blur()},0)}},p=()=>{c(""),t(void 0)};return i.jsx(a.InputGroup,{children:i.jsx(i.Fragment,{children:i.jsxs(a.InputElement,{position:"revert",children:[i.jsxs(ua,{open:l,onEscapeKeyDown:()=>{u(!1)},children:[i.jsx(da,{asChild:!0,children:i.jsx(a.IconButton,{size:"sm",variant:"ghost","aria-label":"Date range help",onClick:()=>u(v=>!v),children:i.jsx(Yn,{size:16})})}),i.jsx(a.Portal,{children:i.jsx(ha,{children:i.jsxs(fa,{p:4,children:[i.jsx(a.PopoverArrow,{}),i.jsxs(a.VStack,{align:"start",gap:4,children:[i.jsxs(a.HStack,{children:[i.jsx(Yn,{size:16}),i.jsx(a.Text,{fontWeight:"semibold",fontSize:"sm",children:"Date Range Filter"})]}),i.jsxs(a.VStack,{align:"start",gap:1,children:[i.jsx(a.Text,{fontSize:"sm",fontWeight:"medium",children:"Format:"}),i.jsxs(a.Text,{fontSize:"xs",color:"gray.600",children:["DD-MM-YYYY",J,"DD-MM-YYYY"]})]}),i.jsxs(a.VStack,{align:"start",gap:1,children:[i.jsx(a.Text,{fontSize:"sm",fontWeight:"medium",children:"Tips:"}),i.jsx(a.Text,{fontSize:"xs",children:'• "15 to 20" → assumes current month/year'}),i.jsx(a.Text,{fontSize:"xs",children:"• Leave end blank → up to today"}),i.jsx(a.Text,{fontSize:"xs",children:"• Dates auto-swapped if reversed"}),i.jsx(a.Text,{fontSize:"xs",children:"• Press Enter on empty end → fills today"})]}),i.jsxs(a.VStack,{align:"start",gap:1,children:[i.jsx(a.Text,{fontSize:"sm",fontWeight:"medium",children:"Shortcut:"}),i.jsxs(a.HStack,{children:[i.jsx(a.Kbd,{children:"Ctrl"}),i.jsx(a.Text,{children:"+"}),i.jsx(a.Kbd,{children:"D"})]})]})]})]})})})]}),i.jsx(a.Input,{ref:d,placeholder:"15-06-2025 to 20-06-2025",value:s,size:"sm",disabled:n,onChange:v=>f(v.target.value),onBlur:h,onKeyDown:y,pr:s?"10":void 0,w:"100%"}),s&&i.jsx(a.InputElement,{children:i.jsx(a.IconButton,{size:"sm",variant:"ghost","aria-label":"Clear date range",onClick:p,w:"100%"})})]})})})}const pa=S(a.Field.Root),va=S(a.Field.Label),ma=S(a.Field.HelperText),ba=S(a.Field.ErrorText),Kt=({icon:e,value:t,onChange:n,placeholder:r,size:o="xs",variant:s="outline",width:c="100%",label:l,helperText:u,isDisabled:d=!1,required:f=!1,errorText:h,visible:y})=>i.jsxs(pa,{width:c,children:[y&&i.jsx(va,{children:l}),i.jsx(a.InputGroup,{startElement:e,children:i.jsx(a.Input,{value:t,onChange:p=>n?.(p.target.value),placeholder:r,size:o,variant:s,disabled:d,required:f})}),h&&i.jsx(ba,{fontSize:"xs",children:h}),u&&i.jsx(ma,{fontSize:"xs",children:u})]}),xa=S(a.Field.Root),ya=S(a.Field.HelperText),Sa=S(a.Field.ErrorText),wa=S(a.Select.Root),Ca=S(a.Select.Label),Da=S(a.Select.Control),Ra=S(a.Select.Trigger),ja=S(a.Select.ValueText),Ta=S(a.Select.IndicatorGroup),Ea=S(a.Select.Indicator),Ma=S(a.Select.Content),_a=S(a.Select.Item),Oa=S(a.Select.ItemIndicator),ka=S(a.Select.HiddenSelect),$a=S(a.Select.Positioner),Er=({options:e=[],label:t,value:n,onChange:r,placeholder:o,size:s="xs",width:c="100%",variant:l="outline",helperText:u,isDisabled:d,required:f,errorText:h,visible:y})=>{const p=a.createListCollection({items:e});return i.jsxs(xa,{disabled:d,required:f,children:[i.jsxs(wa,{collection:p,variant:l,size:s,width:c,value:n?[n]:[],onValueChange:v=>r?.(v.value[0]),children:[i.jsx(ka,{}),y&&i.jsx(Ca,{children:t}),i.jsxs(Da,{children:[i.jsx(Ra,{children:i.jsx(ja,{placeholder:o})}),i.jsx(Ta,{children:i.jsx(Ea,{})})]}),i.jsx($a,{children:i.jsx(Ma,{children:p.items.map(v=>i.jsxs(_a,{item:v,children:[v.label,i.jsx(Oa,{})]},v.value))})})]}),u&&i.jsx(ya,{children:u}),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},Et=(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)];Et(e,n)},Or=(e,t)=>{const n=rt(e).filter(r=>r.id!==t);Et(e,n)},La=(e,t,n)=>{const r=rt(e).map(o=>o.id===t?n(o):o);Et(e,r)},Na=S(a.Checkbox.Root),za=S(a.Checkbox.HiddenInput),Pa=S(a.Checkbox.Control),Ya=S(a.Slider.Root),Fa=S(a.Slider.Track),Ba=S(a.Slider.Range),Ha=S(a.Slider.Thumbs),Va=S(a.Slider.Control),Wa=({filter:e,onVisibilityChange:t,onSizeChange:n})=>{const{attributes:r,listeners:o,setNodeRef:s,transform:c,transition:l}=xr({id:e.id}),u={transform:Ie.Transform.toString(c),transition:l};return i.jsxs(a.VStack,{ref:s,style:u,align:"stretch",border:"1px solid",borderColor:"gray.200",rounded:"md",p:3,mb:3,bg:"white",children:[i.jsxs(a.HStack,{...r,...o,cursor:"grab",userSelect:"none",gap:2,children:[i.jsx(Sr,{size:16}),i.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:e.label||e.id})]}),i.jsxs(a.HStack,{justify:"space-between",children:[i.jsx(a.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(a.VStack,{align:"stretch",gap:1,children:[i.jsx(a.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=S(a.Drawer.Root),Ga=S(a.Drawer.Trigger),Xa=S(a.Drawer.Backdrop),qa=S(a.Drawer.Positioner),Ka=S(a.Drawer.Content),Ja=S(a.Drawer.Header),Za=S(a.Drawer.Title),Qa=S(a.Drawer.Body),ec=S(a.Drawer.Footer),tc=S(a.Drawer.CloseTrigger),nc=S(a.Tabs.Root),rc=S(a.Tabs.List),Bt=S(a.Tabs.Trigger),Ht=S(a.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(Tr,{label:e.label,value:e.value,onChange:e.onChange});case"select":return i.jsx(Er,{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:c,activePresetName:l,onReorder:u,open:d,onOpenChange:f})=>{const y=Qe(Ze)[s]??rt(s),p=()=>{const v=prompt("Preset name?");if(!v)return;const b=o.reduce((x,w)=>(x[w.id]=w.value,x),{});_r(s,{id:crypto.randomUUID(),name:v,date:new Date().toISOString(),values:b})};return i.jsx(a.HStack,{wrap:"wrap",children:i.jsxs(Ua,{size:e,open:d,onOpenChange:f,children:[i.jsx(Ga,{asChild:!0,children:i.jsxs(a.IconButton,{"aria-label":"Open filters",variant:"outline",size:"xs",ml:2,p:2,children:[i.jsx(gi,{size:16}),"Filters"]})}),i.jsxs(a.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(v=>v.visible).map(v=>i.jsx(a.VStack,{align:"stretch",border:"1px solid",borderColor:"gray.200",flex:v.size??1,minW:`${(v.size??1)*100}px`,rounded:"md",p:3,mb:3,children:kr(v,d)},v.id))}),i.jsx(Ht,{value:"settings",children:i.jsx(hr,{sensors:xo(bo(sn)),collisionDetection:Qn,onDragEnd:({active:v,over:b})=>{if(!b||v.id===b.id)return;const x=o.findIndex(R=>R.id===v.id),w=o.findIndex(R=>R.id===b.id),M=Tt(o,x,w);u?.(M)},children:i.jsx(mr,{items:o.map(v=>v.id),strategy:Is,children:o.map(v=>i.jsx(Wa,{filter:v,onVisibilityChange:t,onSizeChange:n},v.id))})})}),i.jsx(Ht,{value:"presets",children:i.jsxs(a.VStack,{align:"stretch",mb:3,children:[y.length===0&&i.jsx(a.Text,{fontSize:"xs",color:"gray.500",children:"No presets saved yet."}),y.map(v=>i.jsxs(a.HStack,{justify:"space-between",border:"1px solid",borderColor:l===v.name?"blue.300":"gray.200",rounded:"md",p:2,children:[i.jsxs(a.VStack,{align:"start",gap:0,children:[i.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:v.name}),i.jsx(a.Text,{fontSize:"xs",color:"gray.500",children:new Date(v.date).toLocaleDateString()})]}),i.jsxs(a.HStack,{children:[i.jsx(a.Button,{size:"xs",variant:"ghost",onClick:()=>{const b=o.map(x=>({...x,value:v.values[x.id]??x.value}));c?.(b,v.name)},children:"Load"}),i.jsx(a.IconButton,{size:"xs","aria-label":"Delete preset",variant:"ghost",onClick:()=>Or(s,v.id),children:i.jsx(ui,{size:14})})]})]},v.id)),i.jsx(a.Button,{size:"sm",colorScheme:"blue",onClick:p,children:"Save Current Filters"})]})})]})}),i.jsx(ec,{justify:"space-between",children:i.jsx(tc,{asChild:!0,children:i.jsx(a.CloseButton,{})})})]})})]})]})})},sc=({title:e,filters:t,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:c,pageKey:l,onLoadPreset:u,activePresetName:d,filterDrawerSize:f="sm"})=>{const[h,y]=g.useState(!1);return i.jsxs(a.HStack,{wrap:"wrap",pl:2,pr:2,width:"100%",justify:"space-between",children:[e,i.jsxs(a.HStack,{gapX:1,children:[t.filter(p=>p.visible!==!1).map(p=>i.jsx(a.HStack,{flex:p.size??1,minW:`${(p.size??1)*100}px`,alignItems:"center",children:kr(p)},p.id)),i.jsx(oc,{filterDrawerSize:f,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:c,pageKey:l,filters:t,onLoadPreset:u,activePresetName:d,open:h,onOpenChange:p=>{y(p.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:c,colorScheme:l,loading:u,loadingText:d,rounded:f,type:h="button"})=>i.jsx(a.Button,{onClick:e,size:t,variant:n,disabled:c,colorPalette:l,loading:u,loadingText:d,rounded:f,type:h,children:i.jsxs(a.HStack,{gap:1,children:[o,r,s]})}),lc=S(a.Combobox.Root),uc=S(a.Combobox.Label),dc=S(a.Combobox.Control),fc=S(a.Combobox.Input),hc=S(a.Combobox.IndicatorGroup),gc=S(a.Combobox.ClearTrigger),pc=S(a.Combobox.Trigger),vc=S(a.Combobox.Positioner),mc=S(a.Combobox.Content);function bc({label:e,size:t="sm",width:n="100%",variant:r="outline",items:o=[],itemToString:s,itemToValue:c,renderItem:l,loading:u,error:d,placeholder:f,onInputChange:h,onSelect:y,rootProps:p,inputProps:v,controlProps:b,contentProps:x,itemProps:w}){const{collection:M,set:R}=a.useListCollection({initialItems:o,itemToString:s,itemToValue:c});return g.useEffect(()=>{R(o)},[o,R]),i.jsxs(lc,{width:n,size:t,variant:r,collection:M,placeholder:f,onInputValueChange:O=>{h?.(O.inputValue)},onValueChange:O=>{const k=O.value?.[0];if(!k)return;const D=M.items.find($=>c($)===k);D&&y?.(D)},positioning:{sameWidth:!1,placement:"bottom-start"},...p,children:[e&&i.jsx(uc,{children:e}),i.jsxs(dc,{...b,children:[i.jsx(fc,{placeholder:f??"Type to search",...v}),i.jsxs(hc,{children:[i.jsx(gc,{}),i.jsx(pc,{})]})]}),i.jsx(vc,{children:i.jsx(mc,{minW:"sm",...x,children:u?i.jsxs(a.HStack,{p:"2",children:[i.jsx(a.Spinner,{size:"xs",borderWidth:"1px"}),i.jsx(a.Span,{children:"Loading..."})]}):d?i.jsx(a.Span,{p:"2",color:"fg.error",children:"Error fetching"}):M.items.map(O=>i.jsxs(a.Combobox.Item,{item:O,...w,children:[l(O),i.jsx(a.Combobox.ItemIndicator,{})]},c(O)))})})]})}const xc=S(a.Dialog.Root),yc=S(a.Dialog.Backdrop),Sc=S(a.Dialog.Positioner),wc=S(a.Dialog.Content),Cc=S(a.Dialog.Header),Dc=S(a.Dialog.Body),Rc=S(a.Dialog.Footer),jc=S(a.Dialog.Title),Tc=S(a.Dialog.CloseTrigger);function Ec({open:e,onClose:t,onConfirm:n,title:r="Delete Company",entityName:o,confirmText:s="DELETE",confirmLabel:c="Delete",isLoading:l=!1}){const[u,d]=g.useState("");return i.jsx(xc,{open:e,placement:"center",onOpenChange:f=>!f.open&&t(),children:i.jsxs(a.Portal,{children:[i.jsx(yc,{}),i.jsx(Sc,{children:i.jsxs(wc,{maxW:"520px",children:[i.jsx(Cc,{borderBottom:"1px solid",borderColor:"red.200",boxShadow:"sm",children:i.jsx(jc,{color:"red.600",children:r})}),i.jsx(Dc,{children:i.jsxs(a.Stack,{gap:4,boxShadow:"lg",border:"1px solid gray.200",borderRadius:"md",p:4,children:[i.jsx(a.Box,{border:"1px solid",borderColor:"red.200",bg:"red.50",borderRadius:"md",p:4,children:i.jsxs(a.Stack,{direction:"row",gap:3,align:"flex-start",children:[i.jsx(a.Box,{color:"red.600",mt:"2px",children:i.jsx(Ci,{size:20})}),i.jsxs(a.Box,{children:[i.jsx(a.Text,{fontWeight:"semibold",color:"red.700",children:"Are you sure?"}),i.jsxs(a.Text,{fontSize:"sm",color:"red.600",children:["All the data of ",i.jsx("b",{children:o})," will permanently be deleted."]})]})]})}),i.jsx(a.Text,{fontSize:"sm",color:"gray.600",children:"You can’t undo this action afterwards."}),i.jsxs(a.Box,{children:[i.jsxs(a.Text,{fontSize:"sm",mb:1,children:["Type ",i.jsx("b",{children:s})," to continue"]}),i.jsx(a.Input,{placeholder:`Type ${s} here`,value:u,onChange:f=>d(f.target.value),size:"xs"})]})]})}),i.jsxs(Rc,{justifyContent:"flex-end",gap:3,borderTop:"1px solid",borderColor:"red.200",boxShadow:"lg",children:[i.jsx(a.Button,{variant:"outline",size:"sm",onClick:t,children:"Cancel"}),i.jsx(a.Button,{size:"sm",style:{backgroundColor:"#FF0000"},loading:l,onClick:n,children:c})]}),i.jsx(Tc,{asChild:!0,children:i.jsx(a.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(a.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:{}},Mc=gt.exports,Hn;function _c(){return Hn||(Hn=1,(function(e,t){(function(n,r){e.exports=r()})(Mc,(function(){var n=1e3,r=6e4,o=36e5,s="millisecond",c="second",l="minute",u="hour",d="day",f="week",h="month",y="quarter",p="year",v="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+)?$/,w=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={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 T=["th","st","nd","rd"],C=I%100;return"["+I+(T[(C-20)%10]||T[C]||T[0])+"]"}},R=function(I,T,C){var _=String(I);return!_||_.length>=T?I:""+Array(T+1-_.length).join(C)+I},O={s:R,z:function(I){var T=-I.utcOffset(),C=Math.abs(T),_=Math.floor(C/60),E=C%60;return(T<=0?"+":"-")+R(_,2,"0")+":"+R(E,2,"0")},m:function I(T,C){if(T.date()<C.date())return-I(C,T);var _=12*(C.year()-T.year())+(C.month()-T.month()),E=T.clone().add(_,h),N=C-E<0,P=T.clone().add(_+(N?-1:1),h);return+(-(_+(C-E)/(N?E-P:P-E))||0)},a:function(I){return I<0?Math.ceil(I)||0:Math.floor(I)},p:function(I){return{M:h,y:p,w:f,d,D:v,h:u,m:l,s:c,ms:s,Q:y}[I]||String(I||"").toLowerCase().replace(/s$/,"")},u:function(I){return I===void 0}},k="en",D={};D[k]=M;var $="$isDayjsObject",A=function(I){return I instanceof K||!(!I||!I[$])},H=function I(T,C,_){var E;if(!T)return k;if(typeof T=="string"){var N=T.toLowerCase();D[N]&&(E=N),C&&(D[N]=C,E=N);var P=T.split("-");if(!E&&P.length>1)return I(P[0])}else{var m=T.name;D[m]=T,E=m}return!_&&E&&(k=E),E||!_&&k},B=function(I,T){if(A(I))return I.clone();var C=typeof T=="object"?T:{};return C.date=I,C.args=arguments,new K(C)},L=O;L.l=H,L.i=A,L.w=function(I,T){return B(I,{locale:T.$L,utc:T.$u,x:T.$x,$offset:T.$offset})};var K=(function(){function I(C){this.$L=H(C.locale,null,!0),this.parse(C),this.$x=this.$x||C.x||{},this[$]=!0}var T=I.prototype;return T.parse=function(C){this.$d=(function(_){var E=_.date,N=_.utc;if(E===null)return new Date(NaN);if(L.u(E))return new Date;if(E instanceof Date)return new Date(E);if(typeof E=="string"&&!/Z$/i.test(E)){var P=E.match(x);if(P){var m=P[2]-1||0,j=(P[7]||"0").substring(0,3);return N?new Date(Date.UTC(P[1],m,P[3]||1,P[4]||0,P[5]||0,P[6]||0,j)):new Date(P[1],m,P[3]||1,P[4]||0,P[5]||0,P[6]||0,j)}}return new Date(E)})(C),this.init()},T.init=function(){var C=this.$d;this.$y=C.getFullYear(),this.$M=C.getMonth(),this.$D=C.getDate(),this.$W=C.getDay(),this.$H=C.getHours(),this.$m=C.getMinutes(),this.$s=C.getSeconds(),this.$ms=C.getMilliseconds()},T.$utils=function(){return L},T.isValid=function(){return this.$d.toString()!==b},T.isSame=function(C,_){var E=B(C);return this.startOf(_)<=E&&E<=this.endOf(_)},T.isAfter=function(C,_){return B(C)<this.startOf(_)},T.isBefore=function(C,_){return this.endOf(_)<B(C)},T.$g=function(C,_,E){return L.u(C)?this[_]:this.set(E,C)},T.unix=function(){return Math.floor(this.valueOf()/1e3)},T.valueOf=function(){return this.$d.getTime()},T.startOf=function(C,_){var E=this,N=!!L.u(_)||_,P=L.p(C),m=function(q,Y){var se=L.w(E.$u?Date.UTC(E.$y,Y,q):new Date(E.$y,Y,q),E);return N?se:se.endOf(d)},j=function(q,Y){return L.w(E.toDate()[q].apply(E.toDate("s"),(N?[0,0,0,0]:[23,59,59,999]).slice(Y)),E)},z=this.$W,F=this.$M,U=this.$D,G="set"+(this.$u?"UTC":"");switch(P){case p:return N?m(1,0):m(31,11);case h:return N?m(1,F):m(0,F+1);case f:var V=this.$locale().weekStart||0,X=(z<V?z+7:z)-V;return m(N?U-X:U+(6-X),F);case d:case v:return j(G+"Hours",0);case u:return j(G+"Minutes",1);case l:return j(G+"Seconds",2);case c:return j(G+"Milliseconds",3);default:return this.clone()}},T.endOf=function(C){return this.startOf(C,!1)},T.$set=function(C,_){var E,N=L.p(C),P="set"+(this.$u?"UTC":""),m=(E={},E[d]=P+"Date",E[v]=P+"Date",E[h]=P+"Month",E[p]=P+"FullYear",E[u]=P+"Hours",E[l]=P+"Minutes",E[c]=P+"Seconds",E[s]=P+"Milliseconds",E)[N],j=N===d?this.$D+(_-this.$W):_;if(N===h||N===p){var z=this.clone().set(v,1);z.$d[m](j),z.init(),this.$d=z.set(v,Math.min(this.$D,z.daysInMonth())).$d}else m&&this.$d[m](j);return this.init(),this},T.set=function(C,_){return this.clone().$set(C,_)},T.get=function(C){return this[L.p(C)]()},T.add=function(C,_){var E,N=this;C=Number(C);var P=L.p(_),m=function(F){var U=B(N);return L.w(U.date(U.date()+Math.round(F*C)),N)};if(P===h)return this.set(h,this.$M+C);if(P===p)return this.set(p,this.$y+C);if(P===d)return m(1);if(P===f)return m(7);var j=(E={},E[l]=r,E[u]=o,E[c]=n,E)[P]||1,z=this.$d.getTime()+C*j;return L.w(z,this)},T.subtract=function(C,_){return this.add(-1*C,_)},T.format=function(C){var _=this,E=this.$locale();if(!this.isValid())return E.invalidDate||b;var N=C||"YYYY-MM-DDTHH:mm:ssZ",P=L.z(this),m=this.$H,j=this.$m,z=this.$M,F=E.weekdays,U=E.months,G=E.meridiem,V=function(Y,se,ne,he){return Y&&(Y[se]||Y(_,N))||ne[se].slice(0,he)},X=function(Y){return L.s(m%12||12,Y,"0")},q=G||function(Y,se,ne){var he=Y<12?"AM":"PM";return ne?he.toLowerCase():he};return N.replace(w,(function(Y,se){return se||(function(ne){switch(ne){case"YY":return String(_.$y).slice(-2);case"YYYY":return L.s(_.$y,4,"0");case"M":return z+1;case"MM":return L.s(z+1,2,"0");case"MMM":return V(E.monthsShort,z,U,3);case"MMMM":return V(U,z);case"D":return _.$D;case"DD":return L.s(_.$D,2,"0");case"d":return String(_.$W);case"dd":return V(E.weekdaysMin,_.$W,F,2);case"ddd":return V(E.weekdaysShort,_.$W,F,3);case"dddd":return F[_.$W];case"H":return String(m);case"HH":return L.s(m,2,"0");case"h":return X(1);case"hh":return X(2);case"a":return q(m,j,!0);case"A":return q(m,j,!1);case"m":return String(j);case"mm":return L.s(j,2,"0");case"s":return String(_.$s);case"ss":return L.s(_.$s,2,"0");case"SSS":return L.s(_.$ms,3,"0");case"Z":return P}return null})(Y)||P.replace(":","")}))},T.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},T.diff=function(C,_,E){var N,P=this,m=L.p(_),j=B(C),z=(j.utcOffset()-this.utcOffset())*r,F=this-j,U=function(){return L.m(P,j)};switch(m){case p: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 u:N=F/o;break;case l:N=F/r;break;case c:N=F/n;break;default:N=F}return E?N:L.a(N)},T.daysInMonth=function(){return this.endOf(h).$D},T.$locale=function(){return D[this.$L]},T.locale=function(C,_){if(!C)return this.$L;var E=this.clone(),N=H(C,_,!0);return N&&(E.$L=N),E},T.clone=function(){return L.w(this.$d,this)},T.toDate=function(){return new Date(this.valueOf())},T.toJSON=function(){return this.isValid()?this.toISOString():null},T.toISOString=function(){return this.$d.toISOString()},T.toString=function(){return this.$d.toUTCString()},I})(),ee=K.prototype;return B.prototype=ee,[["$ms",s],["$s",c],["$m",l],["$H",u],["$W",d],["$M",h],["$y",p],["$D",v]].forEach((function(I){ee[I[1]]=function(T){return this.$g(T,I[0],I[1])}})),B.extend=function(I,T){return I.$i||(I(T,K,B),I.$i=!0),B},B.locale=H,B.isDayjs=A,B.unix=function(I){return B(1e3*I)},B.en=D[k],B.Ls=D,B.p={},B}))})(gt)),gt.exports}var Oc=_c();const Mt=Ct(Oc);var pt={exports:{}},kc=pt.exports,Vn;function $c(){return Vn||(Vn=1,(function(e,t){(function(n,r){e.exports=r()})(kc,(function(){return function(n,r,o){n=n||{};var s=r.prototype,c={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function l(d,f,h,y){return s.fromToBase(d,f,h,y)}o.en.relativeTime=c,s.fromToBase=function(d,f,h,y,p){for(var v,b,x,w=h.$locale().relativeTime||c,M=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"}],R=M.length,O=0;O<R;O+=1){var k=M[O];k.d&&(v=y?o(d).diff(h,k.d,!0):h.diff(d,k.d,!0));var D=(n.rounding||Math.round)(Math.abs(v));if(x=v>0,D<=k.r||!k.r){D<=1&&O>0&&(k=M[O-1]);var $=w[k.l];p&&(D=p(""+D)),b=typeof $=="string"?$.replace("%d",D):$(D,f,k.l,x);break}}if(f)return b;var A=x?w.future:w.past;return typeof A=="function"?A(b):A.replace("%s",b)},s.to=function(d,f){return l(d,f,this,!0)},s.from=function(d,f){return l(d,f,this)};var u=function(d){return d.$u?o.utc():o()};s.toNow=function(d){return this.to(u(this),d)},s.fromNow=function(d){return this.from(u(this),d)}}}))})(pt)),pt.exports}var Ic=$c();const Ac=Ct(Ic);var vt={exports:{}},Lc=vt.exports,Wn;function Nc(){return Wn||(Wn=1,(function(e,t){(function(n,r){e.exports=r()})(Lc,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,o,s){var c=o.prototype,l=c.format;s.en.formats=n,c.format=function(u){u===void 0&&(u="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(p,v,b){var x=b&&b.toUpperCase();return v||y[b]||n[b]||y[x].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(w,M,R){return M||R.slice(1)}))}))})(u,d===void 0?{}:d);return l.call(this,f)}}}))})(vt)),vt.exports}var zc=Nc();const Pc=Ct(zc);var mt={exports:{}},Yc=mt.exports,Un;function Fc(){return Un||(Un=1,(function(e,t){(function(n,r){e.exports=r()})(Yc,(function(){return function(n,r){var o=r.prototype,s=o.format;o.format=function(c){var l=this,u=this.$locale();if(!this.isValid())return s.bind(this)(c);var d=this.$utils(),f=(c||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(h){switch(h){case"Q":return Math.ceil((l.$M+1)/3);case"Do":return u.ordinal(l.$D);case"gggg":return l.weekYear();case"GGGG":return l.isoWeekYear();case"wo":return u.ordinal(l.week(),"W");case"w":case"ww":return d.s(l.week(),h==="w"?1:2,"0");case"W":case"WW":return d.s(l.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return d.s(String(l.$H===0?24:l.$H),h==="k"?1:2,"0");case"X":return Math.floor(l.$d.getTime()/1e3);case"x":return l.$d.getTime();case"z":return"["+l.offsetName()+"]";case"zzz":return"["+l.offsetName("long")+"]";default:return h}}));return s.bind(this)(f)}}}))})(mt)),mt.exports}var Bc=Fc();const Hc=Ct(Bc);Mt.extend(Ac);Mt.extend(Pc);Mt.extend(Hc);const Vc={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??Vc[t]):r}function Wc({value:e,dateVariant:t="date",timeVariant:n="time",dateFormat:r,timeFormat:o,align:s="start"}){return i.jsxs(a.Stack,{gap:.5,align:s,children:[i.jsx(a.Text,{fontSize:"sm",fontWeight:"500",children:Jt({value:e,variant:t,format:r})}),i.jsx(a.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=Tr;exports.MDSCombobox=bc;exports.MDSConfirmDeleteDialog=Ec;exports.MDSInput=Kt;exports.MDSRefreshButton=$r;exports.MDSSelectBox=Er;exports.RefreshButton=$r;exports.StackedDateTime=Wc;exports.addPreset=_r;exports.deletePreset=Or;exports.formatDateTime=Jt;exports.getPresets=rt;exports.loadOrder=ac;exports.presetStore=Ze;exports.saveOrder=ic;exports.savePresets=Et;exports.setActionsConfig=jr;exports.setData=Dr;exports.setTableId=Rr;exports.tableStore=ie;exports.updatePreset=La;exports.withChildren=S;
|
package/dist/index.js
CHANGED