@mdspl/mds-shared-ui 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +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
|
-
`},ho={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function go(e){let{announcements:t=ho,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=fo}=e;const{announce:s,announcement:c}=co(),l=tt("DndLiveRegion"),[u,d]=f.useState(!1);if(f.useEffect(()=>{d(!0)},[]),lo(f.useMemo(()=>({onDragStart(h){let{active:y}=h;s(t.onDragStart({active:y}))},onDragMove(h){let{active:y,over:v}=h;t.onDragMove&&s(t.onDragMove({active:y,over:v}))},onDragOver(h){let{active:y,over:v}=h;s(t.onDragOver({active:y,over:v}))},onDragEnd(h){let{active:y,over:v}=h;s(t.onDragEnd({active:y,over:v}))},onDragCancel(h){let{active:y,over:v}=h;s(t.onDragCancel({active:y,over:v}))}}),[s,t])),!u)return null;const g=f.createElement(f.Fragment,null,f.createElement(io,{id:r,value:o.draggable}),f.createElement(ao,{id:l,announcement:c}));return n?Ue.createPortal(g,n):g}var Q;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Q||(Q={}));function yt(){}function po(e,t){return f.useMemo(()=>({sensor:e,options:{}}),[e,t])}function vo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return f.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const pe=Object.freeze({x:0,y:0});function mo(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function xo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function bo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function yo(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function wn(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const Zn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=wn(t,t.left,t.top),s=[];for(const c of r){const{id:l}=c,u=n.get(l);if(u){const d=mo(wn(u),o);s.push({id:l,data:{droppableContainer:c,value:d}})}}return s.sort(xo)};function So(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),c=o-r,l=s-n;if(r<o&&n<s){const u=t.width*t.height,d=e.width*e.height,g=c*l,h=g/(u+d-g);return Number(h.toFixed(4))}return 0}const wo=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const s of r){const{id:c}=s,l=n.get(c);if(l){const u=So(l,t);u>0&&o.push({id:c,data:{droppableContainer:s,value:u}})}}return o.sort(bo)};function Co(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Qn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:pe}function Do(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];return o.reduce((c,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 jo=Do(1);function Ro(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Eo(e,t,n){const r=Ro(t);if(!r)return e;const{scaleX:o,scaleY:s,x:c,y:l}=r,u=e.left-c-(1-o)*parseFloat(n),d=e.top-l-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),g=o?e.width/o:e.width,h=s?e.height/s:e.height;return{width:g,height:h,top:d,right:u+g,bottom:d+h,left:u}}const To={ignoreTransform:!1};function Pe(e,t){t===void 0&&(t=To);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:g}=ae(e).getComputedStyle(e);d&&(n=Eo(n,d,g))}const{top:r,left:o,width:s,height:c,bottom:l,right:u}=n;return{top:r,left:o,width:s,height:c,bottom:l,right:u}}function Cn(e){return Pe(e,{ignoreTransform:!0})}function Mo(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function _o(e,t){return t===void 0&&(t=ae(e).getComputedStyle(e)),t.position==="fixed"}function Oo(e,t){t===void 0&&(t=ae(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const s=t[o];return typeof s=="string"?n.test(s):!1})}function on(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(tn(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Qe(o)||Xn(o)||n.includes(o))return n;const s=ae(e).getComputedStyle(o);return o!==e&&Oo(o,s)&&n.push(o),_o(o,s)?n:r(o.parentNode)}return e?r(e):n}function er(e){const[t]=on(e,1);return t??null}function It(e){return!Dt||!e?null:Ae(e)?e:en(e)?tn(e)||e===Le(e).scrollingElement?window:Qe(e)?e:null:null}function tr(e){return Ae(e)?e.scrollX:e.scrollLeft}function nr(e){return Ae(e)?e.scrollY:e.scrollTop}function Ut(e){return{x:tr(e),y:nr(e)}}var ee;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ee||(ee={}));function rr(e){return!Dt||!e?!1:e===document.scrollingElement}function or(e){const t={x:0,y:0},n=rr(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,c=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:o,isLeft:s,isBottom:c,isRight:l,maxScroll:r,minScroll:t}}const ko={x:.2,y:.2};function $o(e,t,n,r,o){let{top:s,left:c,right:l,bottom:u}=n;r===void 0&&(r=10),o===void 0&&(o=ko);const{isTop:d,isBottom:g,isLeft:h,isRight:y}=or(e),v={x:0,y:0},p={x:0,y:0},x={height:t.height*o.y,width:t.width*o.x};return!d&&s<=t.top+x.height?(v.y=ee.Backward,p.y=r*Math.abs((t.top+x.height-s)/x.height)):!g&&u>=t.bottom-x.height&&(v.y=ee.Forward,p.y=r*Math.abs((t.bottom-x.height-u)/x.height)),!y&&l>=t.right-x.width?(v.x=ee.Forward,p.x=r*Math.abs((t.right-x.width-l)/x.width)):!h&&c<=t.left+x.width&&(v.x=ee.Backward,p.x=r*Math.abs((t.left+x.width-c)/x.width)),{direction:v,speed:p}}function Io(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:c}=window;return{top:0,left:0,right:s,bottom:c,width:s,height:c}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function sr(e){return e.reduce((t,n)=>$e(t,Ut(n)),pe)}function Ao(e){return e.reduce((t,n)=>t+tr(n),0)}function Lo(e){return e.reduce((t,n)=>t+nr(n),0)}function Po(e,t){if(t===void 0&&(t=Pe),!e)return;const{top:n,left:r,bottom:o,right:s}=t(e);er(e)&&(o<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const No=[["x",["left","right"],Ao],["y",["top","bottom"],Lo]];class sn{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=on(n),o=sr(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,c,l]of No)for(const u of c)Object.defineProperty(this,u,{get:()=>{const d=l(r),g=o[s]-d;return this.rect[u]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ge{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function zo(e){const{EventTarget:t}=ae(e);return e instanceof t?e:Le(e)}function At(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var fe;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(fe||(fe={}));function Dn(e){e.preventDefault()}function Fo(e){e.stopPropagation()}var U;(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"})(U||(U={}));const ir={start:[U.Space,U.Enter],cancel:[U.Esc],end:[U.Space,U.Enter,U.Tab]},Yo=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case U.Right:return{...n,x:n.x+25};case U.Left:return{...n,x:n.x-25};case U.Down:return{...n,y:n.y+25};case U.Up:return{...n,y:n.y-25}}};class ar{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Ge(Le(n)),this.windowListeners=new Ge(ae(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(fe.Resize,this.handleCancel),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(fe.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Po(r),n(pe)}handleKeyDown(t){if(rn(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=ir,coordinateGetter:c=Yo,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,g=d?{x:d.left,y:d.top}:pe;this.referenceCoordinates||(this.referenceCoordinates=g);const h=c(t,{active:n,context:r.current,currentCoordinates:g});if(h){const y=bt(h,g),v={x:0,y:0},{scrollableAncestors:p}=r.current;for(const x of p){const S=t.code,{isTop:w,isRight:O,isLeft:E,isBottom:k,maxScroll:$,minScroll:_}=or(x),A=Io(x),L={x:Math.min(S===U.Right?A.right-A.width/2:A.right,Math.max(S===U.Right?A.left:A.left+A.width/2,h.x)),y:Math.min(S===U.Down?A.bottom-A.height/2:A.bottom,Math.max(S===U.Down?A.top:A.top+A.height/2,h.y))},H=S===U.Right&&!O||S===U.Left&&!E,Y=S===U.Down&&!k||S===U.Up&&!w;if(H&&L.x!==h.x){const D=x.scrollLeft+y.x,W=S===U.Right&&D<=$.x||S===U.Left&&D>=_.x;if(W&&!y.y){x.scrollTo({left:D,behavior:l});return}W?v.x=x.scrollLeft-D:v.x=S===U.Right?x.scrollLeft-$.x:x.scrollLeft-_.x,v.x&&x.scrollBy({left:-v.x,behavior:l});break}else if(Y&&L.y!==h.y){const D=x.scrollTop+y.y,W=S===U.Down&&D<=$.y||S===U.Up&&D>=_.y;if(W&&!y.x){x.scrollTo({top:D,behavior:l});return}W?v.y=x.scrollTop-D:v.y=S===U.Down?x.scrollTop-$.y:x.scrollTop-_.y,v.y&&x.scrollBy({top:-v.y,behavior:l});break}}this.handleMove(t,$e(bt(h,this.referenceCoordinates),v))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}ar.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=ir,onActivation:o}=t,{active:s}=n;const{code:c}=e.nativeEvent;if(r.start.includes(c)){const l=s.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function jn(e){return!!(e&&"distance"in e)}function Rn(e){return!!(e&&"delay"in e)}class an{constructor(t,n,r){var o;r===void 0&&(r=zo(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:s}=t,{target:c}=s;this.props=t,this.events=n,this.document=Le(c),this.documentListeners=new Ge(this.document),this.listeners=new Ge(r),this.windowListeners=new Ge(ae(c)),this.initialCoordinates=(o=Wt(s))!=null?o:pe,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(fe.Resize,this.handleCancel),this.windowListeners.add(fe.DragStart,Dn),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),this.windowListeners.add(fe.ContextMenu,Dn),this.documentListeners.add(fe.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Rn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(jn(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(fe.Click,Fo,{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=Wt(t))!=null?n:pe,d=bt(o,u);if(!r&&l){if(jn(l)){if(l.tolerance!=null&&At(d,l.tolerance))return this.handleCancel();if(At(d,l.distance))return this.handleStart()}if(Rn(l)&&At(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===U.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Bo={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class cn extends an{constructor(t){const{event:n}=t,r=Le(n.target);super(t,Bo,r)}}cn.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const Ho={move:{name:"mousemove"},end:{name:"mouseup"}};var Gt;(function(e){e[e.RightClick=2]="RightClick"})(Gt||(Gt={}));class Vo extends an{constructor(t){super(t,Ho,Le(t.event.target))}}Vo.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Gt.RightClick?!1:(r?.({event:n}),!0)}}];const Lt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Wo extends an{constructor(t){super(t,Lt)}static setup(){return window.addEventListener(Lt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Lt.move.name,t)};function t(){}}}Wo.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var qe;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(qe||(qe={}));var St;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(St||(St={}));function Uo(e){let{acceleration:t,activator:n=qe.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:c=5,order:l=St.TreeOrder,pointerCoordinates:u,scrollableAncestors:d,scrollableAncestorRects:g,delta:h,threshold:y}=e;const v=qo({delta:h,disabled:!s}),[p,x]=to(),S=f.useRef({x:0,y:0}),w=f.useRef({x:0,y:0}),O=f.useMemo(()=>{switch(n){case qe.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case qe.DraggableRect:return o}},[n,o,u]),E=f.useRef(null),k=f.useCallback(()=>{const _=E.current;if(!_)return;const A=S.current.x*w.current.x,L=S.current.y*w.current.y;_.scrollBy(A,L)},[]),$=f.useMemo(()=>l===St.TreeOrder?[...d].reverse():d,[l,d]);f.useEffect(()=>{if(!s||!d.length||!O){x();return}for(const _ of $){if(r?.(_)===!1)continue;const A=d.indexOf(_),L=g[A];if(!L)continue;const{direction:H,speed:Y}=$o(_,L,O,t,y);for(const D of["x","y"])v[D][H[D]]||(Y[D]=0,H[D]=0);if(Y.x>0||Y.y>0){x(),E.current=_,p(k,c),S.current=Y,w.current=H;return}}S.current={x:0,y:0},w.current={x:0,y:0},x()},[t,k,r,x,s,c,JSON.stringify(O),JSON.stringify(v),p,d,$,g,JSON.stringify(y)])}const Go={x:{[ee.Backward]:!1,[ee.Forward]:!1},y:{[ee.Backward]:!1,[ee.Forward]:!1}};function qo(e){let{delta:t,disabled:n}=e;const r=Vt(t);return et(o=>{if(n||!r||!o)return Go;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ee.Backward]:o.x[ee.Backward]||s.x===-1,[ee.Forward]:o.x[ee.Forward]||s.x===1},y:{[ee.Backward]:o.y[ee.Backward]||s.y===-1,[ee.Forward]:o.y[ee.Forward]||s.y===1}}},[n,t,r])}function Xo(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return et(o=>{var s;return t==null?null:(s=r??o)!=null?s:null},[r,t])}function Ko(e,t){return f.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,s=o.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,r)}));return[...n,...s]},[]),[e,t])}var Je;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Je||(Je={}));var qt;(function(e){e.Optimized="optimized"})(qt||(qt={}));const En=new Map;function Jo(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,c]=f.useState(null),{frequency:l,measure:u,strategy:d}=o,g=f.useRef(e),h=S(),y=Ke(h),v=f.useCallback(function(w){w===void 0&&(w=[]),!y.current&&c(O=>O===null?w:O.concat(w.filter(E=>!O.includes(E))))},[y]),p=f.useRef(null),x=et(w=>{if(h&&!n)return En;if(!w||w===En||g.current!==e||s!=null){const O=new Map;for(let E of e){if(!E)continue;if(s&&s.length>0&&!s.includes(E.id)&&E.rect.current){O.set(E.id,E.rect.current);continue}const k=E.node.current,$=k?new sn(u(k),k):null;E.rect.current=$,$&&O.set(E.id,$)}return O}return w},[e,s,n,h,u]);return f.useEffect(()=>{g.current=e},[e]),f.useEffect(()=>{h||v()},[n,h]),f.useEffect(()=>{s&&s.length>0&&c(null)},[JSON.stringify(s)]),f.useEffect(()=>{h||typeof l!="number"||p.current!==null||(p.current=setTimeout(()=>{v(),p.current=null},l))},[l,h,v,...r]),{droppableRects:x,measureDroppableContainers:v,measuringScheduled:s!=null};function S(){switch(d){case Je.Always:return!1;case Je.BeforeDragging:return n;default:return!n}}}function cr(e,t){return et(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Zo(e,t){return cr(e,t)}function Qo(e){let{callback:t,disabled:n}=e;const r=nn(t),o=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return f.useEffect(()=>()=>o?.disconnect(),[o]),o}function jt(e){let{callback:t,disabled:n}=e;const r=nn(t),o=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return f.useEffect(()=>()=>o?.disconnect(),[o]),o}function es(e){return new sn(Pe(e),e)}function Tn(e,t,n){t===void 0&&(t=es);const[r,o]=f.useState(null);function s(){o(u=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=u??n)!=null?d:null}const g=t(e);return JSON.stringify(u)===JSON.stringify(g)?u:g})}const c=Qo({callback(u){if(e)for(const d of u){const{type:g,target:h}=d;if(g==="childList"&&h instanceof HTMLElement&&h.contains(e)){s();break}}}}),l=jt({callback:s});return xe(()=>{s(),e?(l?.observe(e),c?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),c?.disconnect())},[e]),r}function ts(e){const t=cr(e);return Qn(e,t)}const Mn=[];function ns(e){const t=f.useRef(e),n=et(r=>e?r&&r!==Mn&&e&&t.current&&e.parentNode===t.current.parentNode?r:on(e):Mn,[e]);return f.useEffect(()=>{t.current=e},[e]),n}function rs(e){const[t,n]=f.useState(null),r=f.useRef(e),o=f.useCallback(s=>{const c=It(s.target);c&&n(l=>l?(l.set(c,Ut(c)),new Map(l)):null)},[]);return f.useEffect(()=>{const s=r.current;if(e!==s){c(s);const l=e.map(u=>{const d=It(u);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,Ut(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=It(u);d?.removeEventListener("scroll",o)})}},[o,e]),f.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,c)=>$e(s,c),pe):sr(e):pe,[e,t])}function _n(e,t){t===void 0&&(t=[]);const n=f.useRef(null);return f.useEffect(()=>{n.current=null},t),f.useEffect(()=>{const r=e!==pe;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?bt(e,n.current):pe}function os(e){f.useEffect(()=>{if(!Dt)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function ss(e,t){return f.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:s}=r;return n[o]=c=>{s(c,t)},n},{}),[e,t])}function lr(e){return f.useMemo(()=>e?Mo(e):null,[e])}const On=[];function is(e,t){t===void 0&&(t=Pe);const[n]=e,r=lr(n?ae(n):null),[o,s]=f.useState(On);function c(){s(()=>e.length?e.map(u=>rr(u)?r:new sn(t(u),u)):On)}const l=jt({callback:c});return xe(()=>{l?.disconnect(),c(),e.forEach(u=>l?.observe(u))},[e]),o}function as(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Qe(t)?t:e}function cs(e){let{measure:t}=e;const[n,r]=f.useState(null),o=f.useCallback(d=>{for(const{target:g}of d)if(Qe(g)){r(h=>{const y=t(g);return h?{...h,width:y.width,height:y.height}:y});break}},[t]),s=jt({callback:o}),c=f.useCallback(d=>{const g=as(d);s?.disconnect(),g&&s?.observe(g),r(g?t(g):null)},[t,s]),[l,u]=xt(c);return f.useMemo(()=>({nodeRef:l,rect:n,setRef:u}),[n,l,u])}const ls=[{sensor:cn,options:{}},{sensor:ar,options:{}}],us={current:{}},ht={draggable:{measure:Cn},droppable:{measure:Cn,strategy:Je.WhileDragging,frequency:qt.Optimized},dragOverlay:{measure:Pe}};class Xe extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const ds={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Xe,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:yt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ht,measureDroppableContainers:yt,windowRect:null,measuringScheduled:!1},fs={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:yt,draggableNodes:new Map,over:null,measureDroppableContainers:yt},Rt=f.createContext(fs),ur=f.createContext(ds);function hs(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Xe}}}function gs(e,t){switch(t.type){case Q.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Q.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Q.DragEnd:case Q.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Q.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Xe(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case Q.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const c=new Xe(e.droppable.containers);return c.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:c}}}case Q.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Xe(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function ps(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=f.useContext(Rt),s=Vt(r),c=Vt(n?.id);return f.useEffect(()=>{if(!t&&!r&&s&&c!=null){if(!rn(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 g of[u.current,d.current]){if(!g)continue;const h=oo(g);if(h){h.focus();break}}})}},[r,t,o,c,s]),null}function vs(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,s)=>s({transform:o,...r}),n):n}function ms(e){return f.useMemo(()=>({draggable:{...ht.draggable,...e?.draggable},droppable:{...ht.droppable,...e?.droppable},dragOverlay:{...ht.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function xs(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const s=f.useRef(!1),{x:c,y:l}=typeof o=="boolean"?{x:o,y:o}:o;xe(()=>{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 g=n(d),h=Qn(g,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=er(d);y&&y.scrollBy({top:h.y,left:h.x})}},[t,c,l,r,n])}const dr=f.createContext({...pe,scaleX:1,scaleY:1});var Re;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Re||(Re={}));const fr=f.memo(function(t){var n,r,o,s;let{id:c,accessibility:l,autoScroll:u=!0,children:d,sensors:g=ls,collisionDetection:h=wo,measuring:y,modifiers:v,...p}=t;const x=f.useReducer(gs,void 0,hs),[S,w]=x,[O,E]=uo(),[k,$]=f.useState(Re.Uninitialized),_=k===Re.Initialized,{draggable:{active:A,nodes:L,translate:H},droppable:{containers:Y}}=S,D=A!=null?L.get(A):null,W=f.useRef({initial:null,translated:null}),G=f.useMemo(()=>{var re;return A!=null?{id:A,data:(re=D?.data)!=null?re:us,rect:W}:null},[A,D]),I=f.useRef(null),[j,C]=f.useState(null),[T,M]=f.useState(null),P=Ke(p,Object.values(p)),z=tt("DndDescribedBy",c),m=f.useMemo(()=>Y.getEnabled(),[Y]),R=ms(y),{droppableRects:N,measureDroppableContainers:B,measuringScheduled:q}=Jo(m,{dragging:_,dependencies:[H.x,H.y],config:R.droppable}),X=Xo(L,A),V=f.useMemo(()=>T?Wt(T):null,[T]),K=Kr(),J=Zo(X,R.draggable.measure);xs({activeNode:A!=null?L.get(A):null,config:K.layoutShiftCompensation,initialRect:J,measure:R.draggable.measure});const F=Tn(X,R.draggable.measure,J),se=Tn(X?X.parentElement:null),ne=f.useRef({activatorEvent:null,active:null,activeNode:X,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:L,draggingNode:null,draggingNodeRect:null,droppableContainers:Y,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),he=Y.getNodeFor((n=ne.current.over)==null?void 0:n.id),be=cs({measure:R.dragOverlay.measure}),Te=(r=be.nodeRef.current)!=null?r:X,Me=_?(o=be.rect)!=null?o:F:null,un=!!(be.nodeRef.current&&be.rect),dn=ts(un?null:F),_t=lr(Te?ae(Te):null),Se=ns(_?he??X:null),ot=is(Se),st=vs(v,{transform:{x:H.x-dn.x,y:H.y-dn.y,scaleX:1,scaleY:1},activatorEvent:T,active:G,activeNodeRect:F,containerNodeRect:se,draggingNodeRect:Me,over:ne.current.over,overlayNodeRect:be.rect,scrollableAncestors:Se,scrollableAncestorRects:ot,windowRect:_t}),fn=V?$e(V,H):null,hn=rs(Se),Hr=_n(hn),Vr=_n(hn,[F]),_e=$e(st,Hr),Oe=Me?jo(Me,st):null,Ne=G&&Oe?h({active:G,collisionRect:Oe,droppableRects:N,droppableContainers:m,pointerCoordinates:fn}):null,gn=yo(Ne,"id"),[we,pn]=f.useState(null),Wr=un?st:$e(st,Vr),Ur=Co(Wr,(s=we?.rect)!=null?s:null,F),Ot=f.useRef(null),vn=f.useCallback((re,ce)=>{let{sensor:le,options:Ce}=ce;if(I.current==null)return;const de=L.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(!L.get(te))return;const{onDragAbort:me}=P.current,ye={id:te};me?.(ye),O({type:"onDragAbort",event:ye})},onPending(te,De,me,ye){if(!L.get(te))return;const{onDragPending:Fe}=P.current,je={id:te,constraint:De,initialCoordinates:me,offset:ye};Fe?.(je),O({type:"onDragPending",event:je})},onStart(te){const De=I.current;if(De==null)return;const me=L.get(De);if(!me)return;const{onDragStart:ye}=P.current,ze={activatorEvent:ue,active:{id:De,data:me.data,rect:W}};Ue.unstable_batchedUpdates(()=>{ye?.(ze),$(Re.Initializing),w({type:Q.DragStart,initialCoordinates:te,active:De}),O({type:"onDragStart",event:ze}),C(Ot.current),M(ue)})},onMove(te){w({type:Q.DragMove,coordinates:te})},onEnd:ke(Q.DragEnd),onCancel:ke(Q.DragCancel)});Ot.current=ve;function ke(te){return async function(){const{active:me,collisions:ye,over:ze,scrollAdjustedTranslate:Fe}=ne.current;let je=null;if(me&&Fe){const{cancelDrop:Ye}=P.current;je={activatorEvent:ue,active:me,collisions:ye,delta:Fe,over:ze},te===Q.DragEnd&&typeof Ye=="function"&&await Promise.resolve(Ye(je))&&(te=Q.DragCancel)}I.current=null,Ue.unstable_batchedUpdates(()=>{w({type:te}),$(Re.Uninitialized),pn(null),C(null),M(null),Ot.current=null;const Ye=te===Q.DragEnd?"onDragEnd":"onDragCancel";if(je){const kt=P.current[Ye];kt?.(je),O({type:Ye,event:je})}})}}},[L]),Gr=f.useCallback((re,ce)=>(le,Ce)=>{const de=le.nativeEvent,ue=L.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,vn(le,ce))},[L,vn]),mn=Ko(g,Gr);os(g),xe(()=>{F&&k===Re.Initializing&&$(Re.Initialized)},[F,k]),f.useEffect(()=>{const{onDragMove:re}=P.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),O({type:"onDragMove",event:ue})})},[_e.x,_e.y]),f.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}=P.current,ve=Ce.get(gn),ke=ve&&ve.rect.current?{id:ve.id,rect:ve.rect.current,data:ve.data,disabled:ve.disabled}:null,te={active:re,activatorEvent:ce,collisions:le,delta:{x:de.x,y:de.y},over:ke};Ue.unstable_batchedUpdates(()=>{pn(ke),ue?.(te),O({type:"onDragOver",event:te})})},[gn]),xe(()=>{ne.current={activatorEvent:T,active:G,activeNode:X,collisionRect:Oe,collisions:Ne,droppableRects:N,draggableNodes:L,draggingNode:Te,draggingNodeRect:Me,droppableContainers:Y,over:we,scrollableAncestors:Se,scrollAdjustedTranslate:_e},W.current={initial:Me,translated:Oe}},[G,X,Ne,Oe,L,Te,Me,N,Y,we,Se,_e]),Uo({...K,delta:H,draggingRect:Oe,pointerCoordinates:fn,scrollableAncestors:Se,scrollableAncestorRects:ot});const qr=f.useMemo(()=>({active:G,activeNode:X,activeNodeRect:F,activatorEvent:T,collisions:Ne,containerNodeRect:se,dragOverlay:be,draggableNodes:L,droppableContainers:Y,droppableRects:N,over:we,measureDroppableContainers:B,scrollableAncestors:Se,scrollableAncestorRects:ot,measuringConfiguration:R,measuringScheduled:q,windowRect:_t}),[G,X,F,T,Ne,se,be,L,Y,N,we,B,Se,ot,R,q,_t]),Xr=f.useMemo(()=>({activatorEvent:T,activators:mn,active:G,activeNodeRect:F,ariaDescribedById:{draggable:z},dispatch:w,draggableNodes:L,over:we,measureDroppableContainers:B}),[T,mn,G,F,w,z,L,we,B]);return f.createElement(Jn.Provider,{value:E},f.createElement(Rt.Provider,{value:Xr},f.createElement(ur.Provider,{value:qr},f.createElement(dr.Provider,{value:Ur},d)),f.createElement(ps,{disabled:l?.restoreFocus===!1})),f.createElement(go,{...l,hiddenTextDescribedById:z}));function Kr(){const re=j?.autoScrollEnabled===!1,ce=typeof u=="object"?u.enabled===!1:u===!1,le=_&&!re&&!ce;return typeof u=="object"?{...u,enabled:le}:{enabled:le}}}),bs=f.createContext(null),kn="button",ys="Draggable";function Ss(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=tt(ys),{activators:c,activatorEvent:l,active:u,activeNodeRect:d,ariaDescribedById:g,draggableNodes:h,over:y}=f.useContext(Rt),{role:v=kn,roleDescription:p="draggable",tabIndex:x=0}=o??{},S=u?.id===t,w=f.useContext(S?dr:bs),[O,E]=xt(),[k,$]=xt(),_=ss(c,t),A=Ke(n);xe(()=>(h.set(t,{id:t,key:s,node:O,activatorNode:k,data:A}),()=>{const H=h.get(t);H&&H.key===s&&h.delete(t)}),[h,t]);const L=f.useMemo(()=>({role:v,tabIndex:x,"aria-disabled":r,"aria-pressed":S&&v===kn?!0:void 0,"aria-roledescription":p,"aria-describedby":g.draggable}),[r,v,x,S,p,g.draggable]);return{active:u,activatorEvent:l,activeNodeRect:d,attributes:L,isDragging:S,listeners:r?void 0:_,node:O,over:y,setNodeRef:E,setActivatorNodeRef:$,transform:w}}function ws(){return f.useContext(ur)}const Cs="Droppable",Ds={timeout:25};function js(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=tt(Cs),{active:c,dispatch:l,over:u,measureDroppableContainers:d}=f.useContext(Rt),g=f.useRef({disabled:n}),h=f.useRef(!1),y=f.useRef(null),v=f.useRef(null),{disabled:p,updateMeasurementsFor:x,timeout:S}={...Ds,...o},w=Ke(x??r),O=f.useCallback(()=>{if(!h.current){h.current=!0;return}v.current!=null&&clearTimeout(v.current),v.current=setTimeout(()=>{d(Array.isArray(w.current)?w.current:[w.current]),v.current=null},S)},[S]),E=jt({callback:O,disabled:p||!c}),k=f.useCallback((L,H)=>{E&&(H&&(E.unobserve(H),h.current=!1),L&&E.observe(L))},[E]),[$,_]=xt(k),A=Ke(t);return f.useEffect(()=>{!E||!$.current||(E.disconnect(),h.current=!1,E.observe($.current))},[$,E]),f.useEffect(()=>(l({type:Q.RegisterDroppable,element:{id:r,key:s,disabled:n,node:$,rect:y,data:A}}),()=>l({type:Q.UnregisterDroppable,key:s,id:r})),[r]),f.useEffect(()=>{n!==g.current.disabled&&(l({type:Q.SetDroppableDisabled,id:r,key:s,disabled:n}),g.current.disabled=n)},[r,s,n,l]),{active:c,rect:y,isOver:u?.id===r,node:$,over:u,setNodeRef:_}}function Et(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Rs(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function at(e){return e!==null&&e>=0}function Es(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Ts(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const ct={scaleX:1,scaleY:1},Ms=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:s,index:c}=e;const 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,...ct}:null}return c>o&&c<=s?{x:-l.width-u,y:0,...ct}:c<o&&c>=s?{x:l.width+u,y:0,...ct}:{x:0,y:0,...ct}};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 hr=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const s=Et(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}},lt={scaleX:1,scaleY:1},Os=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,...lt}:null}const u=ks(s,o,n);return o>n&&o<=c?{x:0,y:-l.height-u,...lt}:o<n&&o>=c?{x:0,y:l.height+u,...lt}:{x:0,y:0,...lt}};function ks(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return r?n<t?o?r.top-(o.top+o.height):s?s.top-(r.top+r.height):0:s?s.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const gr="Sortable",pr=f.createContext({activeIndex:-1,containerId:gr,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:hr,disabled:{draggable:!1,droppable:!1}});function vr(e){let{children:t,id:n,items:r,strategy:o=hr,disabled:s=!1}=e;const{active:c,dragOverlay:l,droppableRects:u,over:d,measureDroppableContainers:g}=ws(),h=tt(gr,n),y=l.rect!==null,v=f.useMemo(()=>r.map(_=>typeof _=="object"&&"id"in _?_.id:_),[r]),p=c!=null,x=c?v.indexOf(c.id):-1,S=d?v.indexOf(d.id):-1,w=f.useRef(v),O=!Es(v,w.current),E=S!==-1&&x===-1||O,k=Ts(s);xe(()=>{O&&p&&g(v)},[O,v,p,g]),f.useEffect(()=>{w.current=v},[v]);const $=f.useMemo(()=>({activeIndex:x,containerId:h,disabled:k,disableTransforms:E,items:v,overIndex:S,useDragOverlay:y,sortedRects:Rs(v,u),strategy:o}),[x,h,k.draggable,k.droppable,E,v,S,u,y,o]);return f.createElement(pr.Provider,{value:$},t)}const $s=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Et(n,r,o).indexOf(t)},Is=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:s,newIndex:c,previousItems:l,previousContainerId:u,transition:d}=e;return!d||!r||l!==s&&o===c?!1:n?!0:c!==o&&t===u},As={duration:200,easing:"ease"},mr="transform",Ls=Ie.Transition.toString({property:mr,duration:0,easing:"linear"}),Ps={roleDescription:"sortable"};function Ns(e){let{disabled:t,index:n,node:r,rect:o}=e;const[s,c]=f.useState(null),l=f.useRef(n);return xe(()=>{if(!t&&n!==l.current&&r.current){const u=o.current;if(u){const d=Pe(r.current,{ignoreTransform:!0}),g={x:u.left-d.left,y:u.top-d.top,scaleX:u.width/d.width,scaleY:u.height/d.height};(g.x||g.y)&&c(g)}}n!==l.current&&(l.current=n)},[t,n,r,o]),f.useEffect(()=>{s&&c(null)},[s]),s}function xr(e){let{animateLayoutChanges:t=Is,attributes:n,disabled:r,data:o,getNewIndex:s=$s,id:c,strategy:l,resizeObserverConfig:u,transition:d=As}=e;const{items:g,containerId:h,activeIndex:y,disabled:v,disableTransforms:p,sortedRects:x,overIndex:S,useDragOverlay:w,strategy:O}=f.useContext(pr),E=zs(r,v),k=g.indexOf(c),$=f.useMemo(()=>({sortable:{containerId:h,index:k,items:g},...o}),[h,o,k,g]),_=f.useMemo(()=>g.slice(g.indexOf(c)),[g,c]),{rect:A,node:L,isOver:H,setNodeRef:Y}=js({id:c,data:$,disabled:E.droppable,resizeObserverConfig:{updateMeasurementsFor:_,...u}}),{active:D,activatorEvent:W,activeNodeRect:G,attributes:I,setNodeRef:j,listeners:C,isDragging:T,over:M,setActivatorNodeRef:P,transform:z}=Ss({id:c,data:$,attributes:{...Ps,...n},disabled:E.draggable}),m=eo(Y,j),R=!!D,N=R&&!p&&at(y)&&at(S),B=!w&&T,q=B&&N?z:null,V=N?q??(l??O)({rects:x,activeNodeRect:G,activeIndex:y,overIndex:S,index:k}):null,K=at(y)&&at(S)?s({id:c,items:g,activeIndex:y,overIndex:S}):k,J=D?.id,F=f.useRef({activeId:J,items:g,newIndex:K,containerId:h}),se=g!==F.current.items,ne=t({active:D,containerId:h,isDragging:T,isSorting:R,id:c,index:k,items:g,newIndex:F.current.newIndex,previousItems:F.current.items,previousContainerId:F.current.containerId,transition:d,wasDragging:F.current.activeId!=null}),he=Ns({disabled:!ne,index:k,node:L,rect:A});return f.useEffect(()=>{R&&F.current.newIndex!==K&&(F.current.newIndex=K),h!==F.current.containerId&&(F.current.containerId=h),g!==F.current.items&&(F.current.items=g)},[R,K,h,g]),f.useEffect(()=>{if(J===F.current.activeId)return;if(J!=null&&F.current.activeId==null){F.current.activeId=J;return}const Te=setTimeout(()=>{F.current.activeId=J},50);return()=>clearTimeout(Te)},[J]),{active:D,activeIndex:y,attributes:I,data:$,rect:A,index:k,newIndex:K,items:g,isOver:H,isSorting:R,isDragging:T,listeners:C,node:L,overIndex:S,over:M,setNodeRef:m,setActivatorNodeRef:P,setDroppableNodeRef:Y,setDraggableNodeRef:j,transform:he??V,transition:be()};function be(){if(he||se&&F.current.newIndex===k)return Ls;if(!(B&&!rn(W)||!d)&&(R||ne))return Ie.Transition.toString({...d,property:mr})}}function zs(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}U.Down,U.Right,U.Up,U.Left;var ut={exports:{}},Pt={},dt={exports:{}},Nt={};var $n;function Fs(){if($n)return Nt;$n=1;var e=f;function t(h,y){return h===y&&(h!==0||1/h===1/y)||h!==h&&y!==y}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,c=e.useDebugValue;function l(h,y){var v=y(),p=r({inst:{value:v,getSnapshot:y}}),x=p[0].inst,S=p[1];return s(function(){x.value=v,x.getSnapshot=y,u(x)&&S({inst:x})},[h,v,y]),o(function(){return u(x)&&S({inst:x}),h(function(){u(x)&&S({inst:x})})},[h]),c(v),v}function u(h){var y=h.getSnapshot;h=h.value;try{var v=y();return!n(h,v)}catch{return!0}}function d(h,y){return y()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:l;return Nt.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,Nt}var zt={};var In;function Ys(){return In||(In=1,process.env.NODE_ENV!=="production"&&(function(){function e(v,p){return v===p&&(v!==0||1/v===1/p)||v!==v&&p!==p}function t(v,p){g||o.startTransition===void 0||(g=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var x=p();if(!h){var S=p();s(x,S)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),h=!0)}S=c({inst:{value:x,getSnapshot:p}});var w=S[0].inst,O=S[1];return u(function(){w.value=x,w.getSnapshot=p,n(w)&&O({inst:w})},[v,x,p]),l(function(){return n(w)&&O({inst:w}),v(function(){n(w)&&O({inst:w})})},[v]),d(x),x}function n(v){var p=v.getSnapshot;v=v.value;try{var x=p();return!s(v,x)}catch{return!0}}function r(v,p){return p()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=f,s=typeof Object.is=="function"?Object.is:e,c=o.useState,l=o.useEffect,u=o.useLayoutEffect,d=o.useDebugValue,g=!1,h=!1,y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;zt.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:y,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),zt}var An;function br(){return An||(An=1,process.env.NODE_ENV==="production"?dt.exports=Fs():dt.exports=Ys()),dt.exports}var Ln;function Bs(){if(Ln)return Pt;Ln=1;var e=f,t=br();function n(d,g){return d===g&&(d!==0||1/d===1/g)||d!==d&&g!==g}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,c=e.useEffect,l=e.useMemo,u=e.useDebugValue;return Pt.useSyncExternalStoreWithSelector=function(d,g,h,y,v){var p=s(null);if(p.current===null){var x={hasValue:!1,value:null};p.current=x}else x=p.current;p=l(function(){function w(_){if(!O){if(O=!0,E=_,_=y(_),v!==void 0&&x.hasValue){var A=x.value;if(v(A,_))return k=A}return k=_}if(A=k,r(E,_))return A;var L=y(_);return v!==void 0&&v(A,L)?(E=_,A):(E=_,k=L)}var O=!1,E,k,$=h===void 0?null:h;return[function(){return w(g())},$===null?void 0:function(){return w($())}]},[g,h,y,v]);var S=o(d,p[0],p[1]);return c(function(){x.hasValue=!0,x.value=S},[S]),u(S),S},Pt}var Ft={};var Pn;function Hs(){return Pn||(Pn=1,process.env.NODE_ENV!=="production"&&(function(){function e(d,g){return d===g&&(d!==0||1/d===1/g)||d!==d&&g!==g}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=f,n=br(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;Ft.useSyncExternalStoreWithSelector=function(d,g,h,y,v){var p=s(null);if(p.current===null){var x={hasValue:!1,value:null};p.current=x}else x=p.current;p=l(function(){function w(_){if(!O){if(O=!0,E=_,_=y(_),v!==void 0&&x.hasValue){var A=x.value;if(v(A,_))return k=A}return k=_}if(A=k,r(E,_))return A;var L=y(_);return v!==void 0&&v(A,L)?(E=_,A):(E=_,k=L)}var O=!1,E,k,$=h===void 0?null:h;return[function(){return w(g())},$===null?void 0:function(){return w($())}]},[g,h,y,v]);var S=o(d,p[0],p[1]);return c(function(){x.hasValue=!0,x.value=S},[S]),u(S),S},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Ft}var Nn;function Vs(){return Nn||(Nn=1,process.env.NODE_ENV==="production"?ut.exports=Bs():ut.exports=Hs()),ut.exports}var Ws=Vs();const Xt=new WeakMap,Us=new WeakMap,wt={current:[]};let Yt=!1;const ft=new Set,zn=new Map;function yr(e){for(const t of e){if(wt.current.includes(t))continue;wt.current.push(t),t.recompute();const n=Us.get(t);if(n)for(const r of n){const o=Xt.get(r);o?.length&&yr(o)}}}function Gs(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function qs(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Xs(e){if(ft.add(e),!Yt)try{for(Yt=!0;ft.size>0;){const t=Array.from(ft);ft.clear();for(const n of t){const r=zn.get(n)??n.prevState;n.prevState=r,Gs(n)}for(const n of t){const r=Xt.get(n);r&&(wt.current.push(n),yr(r))}for(const n of t){const r=Xt.get(n);if(r)for(const o of r)qs(o)}}}finally{Yt=!1,wt.current=[],zn.clear()}}function Ks(e){return typeof e=="function"}class Sr{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var o,s;this.listeners.add(r);const c=(s=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:s.call(o,r,this);return()=>{this.listeners.delete(r),c?.()}},this.prevState=t,this.state=t,this.options=n}setState(t){var n,r,o;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(t):Ks(t)?this.state=t(this.prevState):this.state=t,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),Xs(this)}}function nt(e,t=r=>r,n={}){const r=n.equal??Js;return Ws.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,r)}function Js(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=Fn(e);if(n.length!==Fn(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function Fn(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}const ie=new Sr({tableId:"",sortColumn:null,sortDirection:"asc",visibility:{},columnOrder:[],data:[],sortableColumns:[],actionsConfig:{showActionColumn:!0,showColumnVisibilityMenu:!0,children:"Actions",width:"100px"}});function wr(e,t){const n=e[0]??{},o=(t&&t.length?t:Object.keys(n).map(g=>({id:g,label:g}))).filter(g=>Object.prototype.hasOwnProperty.call(n,g.id)),{tableId:s}=ie.state,c=JSON.parse(localStorage.getItem(jr(s))||"[]"),l=[...c.map(g=>o.find(h=>h.id===g)).filter(Boolean),...o.filter(g=>!c.includes(g.id))],u=JSON.parse(localStorage.getItem(Rr(s))||"{}"),d=l.reduce((g,h)=>(g[h.id]=u[h.id]??!0,g),{});ie.setState(g=>({...g,data:e,columnOrder:l,visibility:d,sortableColumns:l.map(h=>({id:h.id,label:h.label,sortable:!0,backgroundColor:h.backgroundColor}))}))}function Cr(e){ie.setState(t=>({...t,tableId:e,sortColumn:null,sortDirection:"asc",columnOrder:[],visibility:{}}))}const Dr=e=>{ie.setState(t=>({...t,actionsConfig:e}))},jr=e=>`table_column_order_v1:${e}`,Rr=e=>`table_column_visibility_v1:${e}`,Zs=e=>{const{tableId:t}=ie.state;localStorage.setItem(jr(t),JSON.stringify(e.map(n=>n.id))),ie.setState(n=>({...n,columnOrder:e})),ie.setState(n=>({...n,columnOrder:e}))};function Qs(e){ie.setState(t=>t.sortColumn===e?{...t,sortDirection:t.sortDirection==="asc"?"desc":"asc"}:{...t,sortColumn:e,sortDirection:"asc"})}const ei=e=>{ie.setState(t=>{const n={...t.visibility,[e]:!t.visibility[e]};return t.tableId&&localStorage.setItem(Rr(t.tableId),JSON.stringify(n)),{...t,visibility:n}})};const ti=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ni=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Yn=e=>{const t=ni(e);return t.charAt(0).toUpperCase()+t.slice(1)},Er=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),ri=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var oi={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const si=f.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:c,...l},u)=>f.createElement("svg",{ref:u,...oi,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Er("lucide",o),...!s&&!ri(l)&&{"aria-hidden":"true"},...l},[...c.map(([d,g])=>f.createElement(d,g)),...Array.isArray(s)?s:[s]]));const oe=(e,t)=>{const n=f.forwardRef(({className:r,...o},s)=>f.createElement(si,{ref:s,iconNode:t,className:Er(`lucide-${ti(Yn(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Yn(e),n};const ii=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ai=oe("arrow-down",ii);const ci=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],li=oe("arrow-up-down",ci);const ui=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],di=oe("arrow-up",ui);const fi=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],hi=oe("bookmark",fi);const gi=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Bn=oe("calendar",gi);const pi=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],vi=oe("chevron-left",pi);const mi=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],xi=oe("chevron-right",mi);const bi=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],yi=oe("columns-2",bi);const Si=[["path",{d:"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z",key:"1yo7s0"}],["path",{d:"m12 9 6 6",key:"anjzzh"}],["path",{d:"m18 9-6 6",key:"1fp51s"}]],wi=oe("delete",Si);const Ci=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Di=oe("ellipsis",Ci);const ji=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Ri=oe("funnel",ji);const Ei=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Tr=oe("grip-vertical",Ei);const Ti=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],Mi=oe("pen",Ti);const _i=[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]],Oi=oe("refresh-ccw",_i);const ki=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],$i=oe("settings",ki);const Ii=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Mr=oe("triangle-alert",Ii);function b(e){return f.forwardRef((t,n)=>{const{children:r,...o}=t;return i.jsx(e,{ref:n,...o,children:r})})}const Ai=b(a.Menu.Trigger),Li=b(a.Menu.Positioner),Pi=b(a.Menu.Content),Ni=b(a.Menu.Item),zi=b(a.Checkbox.Label),Fi=b(a.Checkbox.HiddenInput),Yi=b(a.Checkbox.Control);function Bi({visibility:e,onToggle:t}){const{sortableColumns:n}=nt(ie);return i.jsxs(a.Menu.Root,{closeOnSelect:!1,children:[i.jsx(Ai,{asChild:!0,children:i.jsx(a.IconButton,{"aria-label":"Toggle columns",variant:"ghost",ml:"1",size:"xs",children:i.jsx(yi,{size:18})})}),i.jsx(a.Portal,{children:i.jsx(Li,{children:i.jsx(Pi,{minW:"220px",children:n.map(r=>{const o=!!e[r.id];return i.jsx(Ni,{value:r.id,closeOnSelect:!1,children:i.jsxs(a.Checkbox.Root,{checked:o,onCheckedChange:()=>t(r.id),children:[i.jsx(Fi,{}),i.jsx(Yi,{}),i.jsx(zi,{children:r.label})]})},r.id)})})})})]})}function Hi({id:e,children:t,onClick:n,cursor:r,borderRight:o,borderRightColor:s,backgroundColor:c}){const{setNodeRef:l,attributes:u,listeners:d,transform:g,transition:h}=xr({id:e});return i.jsx(a.Table.ColumnHeader,{ref:l,onClick:n,backgroundColor:c,w:e==="id"||e==="row_number"?"80px":void 0,style:{transform:Ie.Transform.toString(g),transition:h,cursor:r,borderRight:o,borderRightColor:s},...u,children:i.jsxs(a.HStack,{justify:"space-between",children:[t,i.jsx("span",{...d,children:i.jsx(Tr,{size:12})})]})})}function Vi(){const{columnOrder:e,visibility:t,sortColumn:n,sortDirection:r,sortableColumns:o,actionsConfig:s}=nt(ie),c=e.map(l=>o.find(u=>u.id===l.id)).filter(l=>l!==void 0).filter(l=>t[l.id]);return i.jsx(a.Table.Header,{background:"blue.200",position:"sticky",top:0,p:"0",zIndex:1,children:i.jsxs(a.Table.Row,{height:"28px",children:[s?.showSNo&&i.jsx(a.Table.ColumnHeader,{width:"60px",textAlign:"center",children:"S.No"}),c.map(l=>{const u=n===l?.id;return i.jsx(Hi,{id:l?.id,onClick:()=>l?.sortable&&Qs(l?.id),cursor:l?.sortable?"pointer":"default",borderRight:"2px solid #dcdcdc",backgroundColor:l?.backgroundColor,children:i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,userSelect:"none"},children:[l?.label,l?.sortable&&(u?r==="asc"?i.jsx(di,{size:14}):i.jsx(ai,{size:14}):i.jsx(li,{size:14,opacity:.4}))]})},l?.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(Bi,{visibility:t,onToggle:ei})})]})})}const Wi=[10,20,50,100],Ui=b(a.Select.Positioner),Gi=b(a.Select.Content),qi=b(a.Select.Item),Xi=b(a.Pagination.PrevTrigger),Ki=b(a.Pagination.NextTrigger),Ji=b(a.Select.HiddenSelect),Zi=b(a.Select.Control),Qi=b(a.Select.Trigger),ea=b(a.Select.ValueText),ta=b(a.Select.IndicatorGroup),na=b(a.Select.Indicator);function ra({totalCount:e,pageSize:t,currentPage:n,onPageChange:r,onPageSizeChange:o,siblingCount:s=2,pageSizeOptions:c=Wi}){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(Ji,{}),i.jsxs(Zi,{children:[i.jsx(Qi,{children:i.jsx(ea,{placeholder:""})}),i.jsx(ta,{children:i.jsx(na,{})})]}),i.jsx(a.Portal,{children:i.jsx(Ui,{children:i.jsx(Gi,{children:l.items.map(u=>i.jsxs(qi,{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(Xi,{asChild:!0,children:i.jsx(a.IconButton,{"aria-label":"Previous page",children:i.jsx(vi,{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(Ki,{asChild:!0,children:i.jsx(a.IconButton,{"aria-label":"Next page",children:i.jsx(xi,{size:18})})})]})})]})})}const oa=b(a.Menu.Item),sa=b(a.Menu.Content),ia=b(a.Menu.Positioner),aa=b(a.Menu.Trigger);function ca({data:e=[],actions:t=[],actionConfig:n,onRowSelect:r,startIndex:o=0}){const{columnOrder:s,visibility:c}=nt(ie);return i.jsx(a.Table.Body,{children:e.map((l,u)=>i.jsxs(a.Table.Row,{onClick:()=>r?.(l.__raw),_hover:{bg:"blue.50"},children:[n?.showSNo&&i.jsx(a.Table.Cell,{textAlign:"center",fontWeight:"medium",children:o+u+1}),s.filter(d=>c[d.id]).map(d=>i.jsx(a.Table.Cell,{children:l[d.id]},d.id)),n?.showActionColumn&&i.jsx(a.Table.Cell,{textAlign:"center",display:"flex",gap:2,children:i.jsxs(a.Menu.Root,{children:[i.jsx(aa,{asChild:!0,children:i.jsx(a.IconButton,{"aria-label":"Open",variant:"ghost",size:"sm",children:i.jsx(Di,{size:16})})}),i.jsx(a.Portal,{children:i.jsx(ia,{children:i.jsx(sa,{children:t.filter(d=>typeof d.visible=="function"?d.visible(l.__raw):d.visible!==!1).map(d=>i.jsxs(oa,{onClick:()=>d.onClick(l.__raw),colorScheme:d.colorScheme,value:d.label,children:[d.icon,d.label]},d.label))})})})]})}),n?.showColumnVisibilityMenu&&i.jsx(a.Table.Cell,{})]},l.__key||l.id))})}function la({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 ua({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:g,onPageSizeChange:h,density:y="sm",totalCount:v=0,actionConfig:p,pageSizeOptions:x,onRowSelect:S}){f.useEffect(()=>{Cr(e)},[e]),f.useEffect(()=>{wr(t,n)},[t,n]),f.useEffect(()=>{p&&Dr(p)},[p]);const{sortColumn:w,sortDirection:O,data:E,columnOrder:k}=nt(ie),$=f.useMemo(()=>{const D=[...E];return w&&D.sort((W,G)=>O==="asc"?String(W[w]).localeCompare(String(G[w])):String(G[w]).localeCompare(String(W[w]))),D},[E,w,O,u,d]),_=f.useMemo(()=>(Math.max(1,u||1)-1)*d,[u,d]);f.useEffect(()=>{u<1&&g&&g(1)},[u,g]);const A=D=>{const{active:W,over:G}=D;if(!G||W.id===G.id)return;const I=k.findIndex(T=>T.id===W.id),j=k.findIndex(T=>T.id===G.id),C=Et(k,I,j);Zs(C)},L=r&&!s,H=s&&!r,Y=!r&&!s&&$.length===0;return i.jsx(fr,{collisionDetection:Zn,onDragEnd:A,children:i.jsx(vr,{items:k.map(D=>D.id),strategy:Ms,children:i.jsxs(a.Box,{flex:"1",minH:0,display:"flex",flexDirection:"column",p:2,children:[i.jsxs(a.Box,{flex:"1",minH:0,position:"relative",overflow:"auto",children:[L&&i.jsx(a.Box,{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,bg:"whiteAlpha.600",children:o??i.jsx(a.Spinner,{})}),i.jsxs(a.Table.Root,{variant:"outline",w:"100%",size:y,children:[i.jsx(Vi,{}),H?i.jsx(la,{rows:d,columns:n.length+(l?2:0)}):Y?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(ca,{data:$,actions:l,actionConfig:p,onRowSelect:S,startIndex:_})]})]}),i.jsx(a.Box,{mt:.5,children:i.jsx(ra,{totalCount:v,pageSize:d,currentPage:u,onPageChange:g,onPageSizeChange:D=>{h?.(D),u>1&&g?.(1)},pageSizeOptions:x})})]})})})}const da=b(a.Checkbox.Root),fa=b(a.Checkbox.HiddenInput),ha=b(a.Checkbox.Control),ga=b(a.Checkbox.Label),_r=({value:e,onChange:t,size:n="sm",label:r,helperText:o,isDisabled:s,required:c,errorText:l})=>i.jsxs(da,{value:e,onChange:t,size:n,children:[i.jsx(fa,{}),i.jsx(ha,{disabled:s,required:c,errorText:l,helperText:o}),r&&i.jsx(ga,{children:r})]}),pa=b(a.Combobox.Root),va=b(a.Combobox.Control),ma=b(a.Combobox.Input),xa=b(a.Combobox.IndicatorGroup),ba=b(a.Combobox.ClearTrigger),ya=b(a.Combobox.Trigger),Sa=b(a.Combobox.Positioner),wa=b(a.Combobox.Content);function Or({label:e,size:t="sm",width:n="100%",variant:r="outline",items:o=[],itemToString:s,itemToValue:c,renderItem:l,value:u,loading:d,error:g,errorMessage:h,placeholder:y,helpText:v,onInputChange:p,onSelect:x,visible:S=!0,rootProps:w,inputProps:O,controlProps:E,contentProps:k,itemProps:$}){const[_,A]=f.useState(""),{collection:L,set:H}=a.useListCollection({initialItems:o,itemToString:s,itemToValue:c}),Y=f.useMemo(()=>{if(!_)return o;const D=_.toLowerCase();return o.filter(W=>s(W).toLowerCase().includes(D))},[o,_,s]);return f.useEffect(()=>{H(Y)},[Y,H]),f.useEffect(()=>{u&&A(s(u))},[u,s]),i.jsxs(pa,{width:n,size:t,variant:r,collection:L,placeholder:y,onInputValueChange:D=>{p?.(D.inputValue),A(D.inputValue)},value:u?[c(u)]:[],onValueChange:D=>{const W=D.value?.[0];if(!W)return;const G=L.items.find(I=>c(I)===W);G&&x?.(G)},positioning:{sameWidth:!1,placement:"bottom-start"},...w,children:[S&&e&&i.jsx(a.Text,{fontSize:"sm",children:e}),i.jsxs(va,{...E,children:[i.jsx(ma,{placeholder:y??"Type to search",...O}),i.jsxs(xa,{children:[i.jsx(ba,{}),i.jsx(ya,{})]})]}),i.jsx(Sa,{children:i.jsxs(wa,{minW:"sm",...k,children:[d?i.jsxs(a.HStack,{p:"2",children:[i.jsx(a.Spinner,{size:"xs",borderWidth:"1px"}),i.jsx(a.Span,{children:"Loading..."})]}):g?i.jsx(a.Text,{p:"2",color:"red.500",fontSize:"sm",children:h||"Something went wrong"}):L.items.map(D=>i.jsxs(a.Combobox.Item,{item:D,...$,children:[l(D),i.jsx(a.Combobox.ItemIndicator,{})]},c(D))),v&&!g&&!d&&i.jsx(a.Text,{p:"2",color:"fg.muted",fontSize:"sm",children:v})]})})]})}const Z=" to ",Hn=10,Ee={DAY_MAX:31,MONTH_MAX:12,YEAR_MIN:1900,YEAR_MAX:2100},ln=()=>{const e=new Date;return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}},Vn=()=>{const{year:e,month:t,day:n}=ln();return`${String(n).padStart(2,"0")}-${String(t).padStart(2,"0")}-${e}`},Ca=()=>{const{year:e,month:t,day:n}=ln();return`${e}-${String(t).padStart(2,"0")}-${String(n).padStart(2,"0")}`},Da=(e,t)=>{const n=e.length,r=parseInt(e);if(!e||isNaN(r))return t;if(n===4)return r>=Ee.YEAR_MIN&&r<=Ee.YEAR_MAX?r:t;if(n>0&&n<4){const o=t.toString(),s=4-n,c=o.substring(0,s);return parseInt(c+e)}return t},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}=ln();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=Da(n[2],r)),l=Math.max(1,Math.min(Ee.MONTH_MAX,l)),c=Math.max(1,Math.min(Ee.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}`},ja=(e,t)=>{if(e[0]?.length>0){const n=parseInt(e[0]);if(isNaN(n)||n===0||e[0].length===2&&n>Ee.DAY_MAX)return t}if(e[1]?.length>0){const n=parseInt(e[1]);if(isNaN(n)||n===0||e[1].length===2&&n>Ee.MONTH_MAX)return t}if(e[2]?.length>0){const n=parseInt(e[2]),r=e[2].length===4;if(isNaN(n)||n===0||r&&(n<Ee.YEAR_MIN||n>Ee.YEAR_MAX))return t}return null},We=e=>{let t=e.replace(/[^\d-]/g,"").substring(0,Hn);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,Hn),ja(n,e)||t},Ra=b(a.Popover.Root),Ea=b(a.Popover.Trigger),Ta=b(a.Popover.Content),Ma=b(a.Popover.Positioner);function _a({value:e,onChange:t,disabled:n=!1}){const[r="",o=""]=e?e.split("|"):[],[s,c]=f.useState(()=>r&&o?`${ge(r)}${Z}${ge(o)}`:r?ge(r):""),[l,u]=f.useState(!1),d=f.useRef(null);f.useEffect(()=>{const p=x=>{x.ctrlKey&&x.key==="d"&&!x.shiftKey&&!x.metaKey&&(x.preventDefault(),d.current?.focus())};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[]);const g=p=>{let x=p;if(x.includes(Z)){const[S,w=""]=x.split(Z);x=`${We(S.trim())}${Z}${We(w.trim())}`}else if(x.toLowerCase().includes(" to ")){const[S,w=""]=x.split(/\s+to\s+/i);x=`${We(S.trim())} to ${We(w.trim())}`}else x=We(x);c(x)},h=()=>{const p=s.trim();if(!p){t(void 0);return}if(p.includes(Z)){const[x,S=""]=p.split(Z).map(E=>E.trim()),w=Ve(x),O=S?Ve(S):null;if(w&&O){const[E,k]=O<w?[O,w]:[w,O],$=`${ge(E)}${Z}${ge(k)}`;c($),t(`${E}|${k}`)}else if(w&&!S)c(`${ge(w)}${Z}`),t(void 0);else if(w&&S){const E=Ca(),[k,$]=E<w?[E,w]:[w,E],_=`${ge(k)}${Z}${ge($)}`;c(_),t(`${k}|${$}`)}else c(""),t(void 0)}else{const x=Ve(p);x?(c(`${ge(x)}${Z}`),t(void 0)):(c(""),t(void 0))}},y=p=>{if(p.key!=="Enter")return;p.preventDefault();const x=d.current?.selectionStart||0,S=s.indexOf(Z);if(!s.trim()){c(`${Vn()}${Z}`);return}if(S===-1){const O=Ve(s.trim());O&&c(`${ge(O)}${Z}`);return}if(x<=S+Z.length){const O=s.substring(0,S).trim(),E=s.substring(S+Z.length),k=Ve(O);k&&c(`${ge(k)}${Z}${E}`);return}if(s.substring(S+Z.length).trim())h(),d.current?.blur();else{const O=s.substring(0,S+Z.length)+Vn();c(O),setTimeout(()=>{h(),d.current?.blur()},0)}},v=()=>{c(""),t(void 0)};return i.jsx(a.InputGroup,{children:i.jsx(i.Fragment,{children:i.jsxs(a.InputElement,{position:"revert",children:[i.jsxs(Ra,{open:l,onEscapeKeyDown:()=>{u(!1)},children:[i.jsx(Ea,{asChild:!0,children:i.jsx(a.IconButton,{size:"sm",variant:"ghost","aria-label":"Date range help",onClick:()=>u(p=>!p),children:i.jsx(Bn,{size:16})})}),i.jsx(a.Portal,{children:i.jsx(Ma,{children:i.jsxs(Ta,{p:4,children:[i.jsx(a.PopoverArrow,{}),i.jsxs(a.VStack,{align:"start",gap:4,children:[i.jsxs(a.HStack,{children:[i.jsx(Bn,{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",Z,"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:p=>g(p.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:v,w:"100%"})})]})})})}const Oa=b(a.Field.Root),ka=b(a.Field.Label),$a=b(a.Field.HelperText),Ia=b(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:g=!1,errorText:h,visible:y,type:v="text",min:p=0,max:x=100,step:S=1})=>i.jsxs(Oa,{width:c,children:[y&&i.jsx(ka,{children:l}),i.jsx(a.InputGroup,{startElement:e,children:i.jsx(a.Input,{value:t,onChange:w=>n?.(w.target.value),placeholder:r,size:o,type:v,variant:s,disabled:d,required:g,min:p,max:x,step:S})}),h&&i.jsx(Ia,{fontSize:"xs",children:h}),u&&i.jsx($a,{fontSize:"xs",children:u})]}),Aa=b(a.Field.Root),La=b(a.Field.HelperText),Pa=b(a.Field.ErrorText),Na=b(a.Select.Root),za=b(a.Select.Label),Fa=b(a.Select.Control),Ya=b(a.Select.Trigger),Ba=b(a.Select.ValueText),Ha=b(a.Select.IndicatorGroup),Va=b(a.Select.Indicator),Wa=b(a.Select.Content),Ua=b(a.Select.Item),Ga=b(a.Select.ItemIndicator),qa=b(a.Select.HiddenSelect),Xa=b(a.Select.Positioner),kr=({options:e=[],label:t,value:n,onChange:r,placeholder:o,size:s="xs",width:c="100%",variant:l="outline",helperText:u,isDisabled:d,required:g,errorText:h,visible:y})=>{const v=a.createListCollection({items:e});return i.jsxs(Aa,{disabled:d,required:g,children:[i.jsxs(Na,{collection:v,variant:l,size:s,width:c,value:n?[n]:[],onValueChange:p=>r?.(p.value[0]),children:[i.jsx(qa,{}),y&&i.jsx(za,{children:t}),i.jsxs(Fa,{children:[i.jsx(Ya,{children:i.jsx(Ba,{placeholder:o})}),i.jsx(Ha,{children:i.jsx(Va,{})})]}),i.jsx(Xa,{children:i.jsx(Wa,{children:v.items.map(p=>i.jsxs(Ua,{item:p,children:[p.label,i.jsx(Ga,{})]},p.value))})})]}),u&&i.jsx(La,{children:u}),h&&i.jsx(Pa,{children:h})]})},$r=(e="default")=>`FILTER_PRESETS_${e}`,Ka=e=>{if(!e)return[];try{return JSON.parse(e)}catch{return[]}},Ja=e=>typeof window>"u"?[]:Ka(localStorage.getItem($r(e))),Ze=new Sr({}),rt=e=>{const t=Ze.state;if(e in t)return t[e];const n=Ja(e);return Ze.setState(r=>({...r,[e]:n})),n},Tt=(e,t)=>{Ze.setState(n=>({...n,[e]:t})),typeof window<"u"&&localStorage.setItem($r(e),JSON.stringify(t))},Ir=(e,t)=>{const n=[t,...rt(e)];Tt(e,n)},Ar=(e,t)=>{const n=rt(e).filter(r=>r.id!==t);Tt(e,n)},Za=(e,t,n)=>{const r=rt(e).map(o=>o.id===t?n(o):o);Tt(e,r)},Qa=b(a.Checkbox.Root),ec=b(a.Checkbox.HiddenInput),tc=b(a.Checkbox.Control),nc=b(a.Slider.Root),rc=b(a.Slider.Track),oc=b(a.Slider.Range),sc=b(a.Slider.Thumbs),ic=b(a.Slider.Control),ac=({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(Tr,{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(Qa,{checked:e.visible,size:"sm",onCheckedChange:d=>t?.(e.id,!!d.checked),children:[i.jsx(ec,{}),i.jsx(tc,{})]})]}),i.jsxs(a.VStack,{align:"stretch",gap:1,children:[i.jsx(a.Text,{fontSize:"sm",children:"Size"}),i.jsx(nc,{min:1,max:5,step:.5,value:[e.size??1],onValueChange:d=>n?.(e.id,d.value[0]),children:i.jsxs(ic,{children:[i.jsx(rc,{children:i.jsx(oc,{})}),i.jsx(sc,{})]})})]})]})},cc=b(a.Drawer.Root),lc=b(a.Drawer.Trigger),uc=b(a.Drawer.Backdrop),dc=b(a.Drawer.Positioner),fc=b(a.Drawer.Content),hc=b(a.Drawer.Header),gc=b(a.Drawer.Title),pc=b(a.Drawer.Body),vc=b(a.Drawer.Footer),mc=b(a.Drawer.CloseTrigger),xc=b(a.Tabs.Root),bc=b(a.Tabs.List),Bt=b(a.Tabs.Trigger),Ht=b(a.Tabs.Content),Lr=(e,t)=>{if(e.customComponent)return e.customComponent;switch(e.type){case"text":return i.jsx(Kt,{placeholder:e.label,value:e.value,onChange:e.onChange,label:e.label,visible:t});case"number":return i.jsx(Kt,{label:e.label,value:e.value,onChange:e.onChange});case"checkbox":return i.jsx(_r,{label:e.label,value:e.value,onChange:e.onChange});case"select":return i.jsx(kr,{label:e.label,value:e.value,onChange:e.onChange,options:e.options??[],visible:t,placeholder:e.placeholder});case"date":return i.jsx(_a,{value:e.value,onChange:e.onChange});case"combobox":return i.jsx(Or,{visible:!0,label:e.label,items:e.options,itemToString:n=>n.label,itemToValue:n=>n.value,renderItem:n=>i.jsx("span",{children:n.label})});default:return null}},yc=({filterDrawerSize:e="sm",onVisibilityChange:t,onSizeChange:n,onClear:r,filters:o,pageKey:s="default",onLoadPreset:c,activePresetName:l,onReorder:u,open:d,onOpenChange:g})=>{const y=nt(Ze)[s]??rt(s),v=()=>{const p=prompt("Preset name?");if(!p)return;const x=o.reduce((S,w)=>(S[w.id]=w.value,S),{});Ir(s,{id:crypto.randomUUID(),name:p,date:new Date().toISOString(),values:x})};return i.jsx(a.HStack,{wrap:"wrap",children:i.jsxs(cc,{size:e,open:d,onOpenChange:g,children:[i.jsx(lc,{asChild:!0,children:i.jsxs(a.IconButton,{"aria-label":"Open filters",variant:"outline",size:"xs",ml:2,p:2,children:[i.jsx(Ri,{size:16}),"Filters"]})}),i.jsxs(a.Portal,{children:[i.jsx(uc,{}),i.jsx(dc,{children:i.jsxs(fc,{children:[i.jsx(hc,{children:i.jsx(gc,{children:"Filters"})}),i.jsx(pc,{overflowY:"auto",pt:1,children:i.jsxs(xc,{defaultValue:"view",children:[i.jsxs(bc,{mb:4,children:[i.jsxs(Bt,{value:"view",children:[i.jsx(Mi,{size:16}),"Edit"]}),i.jsxs(Bt,{value:"settings",children:[i.jsx($i,{size:16}),"Settings"]}),i.jsxs(Bt,{value:"presets",children:[i.jsx(hi,{size:16}),"Presets"]})]}),i.jsx(Ht,{value:"view",children:o.filter(p=>p.visible).map(p=>i.jsx(a.VStack,{align:"stretch",border:"1px solid",borderColor:"gray.200",flex:p.size??1,minW:`${(p.size??1)*100}px`,rounded:"md",p:3,mb:3,children:Lr(p,d)},p.id))}),i.jsx(Ht,{value:"settings",children:i.jsx(fr,{sensors:vo(po(cn)),collisionDetection:Zn,onDragEnd:({active:p,over:x})=>{if(!x||p.id===x.id)return;const S=o.findIndex(E=>E.id===p.id),w=o.findIndex(E=>E.id===x.id),O=Et(o,S,w);u?.(O)},children:i.jsx(vr,{items:o.map(p=>p.id),strategy:Os,children:o.map(p=>i.jsx(ac,{filter:p,onVisibilityChange:t,onSizeChange:n},p.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(p=>i.jsxs(a.HStack,{justify:"space-between",border:"1px solid",borderColor:l===p.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:p.name}),i.jsx(a.Text,{fontSize:"xs",color:"gray.500",children:new Date(p.date).toLocaleDateString()})]}),i.jsxs(a.HStack,{children:[i.jsx(a.Button,{size:"xs",variant:"ghost",onClick:()=>{const x=o.map(S=>({...S,value:p.values[S.id]??S.value}));c?.(x,p.name)},children:"Load"}),i.jsx(a.IconButton,{size:"xs","aria-label":"Delete preset",variant:"ghost",onClick:()=>Ar(s,p.id),children:i.jsx(wi,{size:14})})]})]},p.id)),i.jsx(a.Button,{size:"sm",colorScheme:"blue",onClick:v,children:"Save Current Filters"})]})})]})}),i.jsx(vc,{justify:"space-between",children:i.jsx(mc,{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:g="sm"})=>{const[h,y]=f.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(v=>v.visible!==!1).map(v=>i.jsx(a.HStack,{flex:v.size??1,minW:`${(v.size??1)*100}px`,alignItems:"center",children:Lr(v)},v.id)),i.jsx(yc,{filterDrawerSize:g,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:c,pageKey:l,filters:t,onLoadPreset:u,activePresetName:d,open:h,onOpenChange:v=>{y(v.open)}})]})]})},wc=(e,t)=>{localStorage.setItem(`FILTER_ORDER_${e}`,JSON.stringify(t))},Cc=e=>{try{return JSON.parse(localStorage.getItem(`FILTER_ORDER_${e}`)||"[]")}catch{return[]}},Dc=({onClick:e,size:t="xs",variant:n="solid",label:r,leftIcon:o,rightIcon:s,isDisabled:c,colorScheme:l,loading:u,loadingText:d,rounded:g,type:h="button"})=>i.jsx(a.Button,{onClick:e,size:t,variant:n,disabled:c,colorPalette:l,loading:u,loadingText:d,rounded:g,type:h,children:i.jsxs(a.HStack,{gap:1,children:[o,r,s]})}),jc=b(a.Dialog.Root),Rc=b(a.Dialog.Backdrop),Ec=b(a.Dialog.Positioner),Tc=b(a.Dialog.Content),Mc=b(a.Dialog.Header),_c=b(a.Dialog.Body),Oc=b(a.Dialog.Footer),kc=b(a.Dialog.Title),$c=b(a.Dialog.CloseTrigger);function Ic({open:e,onClose:t,onConfirm:n,title:r="Confirm Action",description:o="Are you sure you want to continue?",confirmLabel:s="Confirm",cancelLabel:c="Cancel",icon:l,isLoading:u=!1,confirmButtonColorScheme:d="#4169e1"}){return i.jsx(jc,{open:e,placement:"center",onOpenChange:g=>!g.open&&t(),children:i.jsxs(a.Portal,{children:[i.jsx(Rc,{}),i.jsx(Ec,{children:i.jsxs(Tc,{maxW:"480px",children:[i.jsx(Mc,{borderBottom:"1px solid",borderColor:"gray.200",children:i.jsx(kc,{children:r})}),i.jsx(_c,{p:6,children:i.jsxs(a.Stack,{gap:4,align:"center",textAlign:"center",children:[i.jsx(a.Box,{color:"orange.500",children:l??i.jsx(Mr,{size:40})}),i.jsx(a.Text,{fontSize:"sm",color:"gray.600",children:o})]})}),i.jsxs(Oc,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"gray.200",children:[i.jsx(a.Button,{variant:"outline",size:"sm",onClick:t,children:c}),i.jsx(a.Button,{size:"sm",style:{backgroundColor:d},loading:u,onClick:n,children:s})]}),i.jsx($c,{asChild:!0,children:i.jsx(a.CloseButton,{size:"sm"})})]})})]})})}const Ac=b(a.Dialog.Root),Lc=b(a.Dialog.Backdrop),Pc=b(a.Dialog.Positioner),Nc=b(a.Dialog.Content),zc=b(a.Dialog.Header),Fc=b(a.Dialog.Body),Yc=b(a.Dialog.Footer),Bc=b(a.Dialog.Title),Hc=b(a.Dialog.CloseTrigger);function Vc({open:e,onClose:t,onConfirm:n,title:r="Delete Company",entityName:o,confirmText:s="DELETE",confirmLabel:c="Delete",isLoading:l=!1}){const[u,d]=f.useState(""),g=u===s;return i.jsx(Ac,{open:e,placement:"center",onOpenChange:h=>{!h.open&&t(),d("")},children:i.jsxs(a.Portal,{children:[i.jsx(Lc,{}),i.jsx(Pc,{children:i.jsxs(Nc,{maxW:"550px",children:[i.jsx(zc,{borderBottom:"1px solid",borderColor:"#d3d3d3",children:i.jsx(Bc,{color:"red.600",children:r})}),i.jsx(Fc,{p:2,style:{padding:"16px"},children:i.jsxs(a.Stack,{gap:4,borderRadius:"md",p:4,bg:"white",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(Mr,{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:2,children:["Type ",i.jsx("b",{children:s})," to continue"]}),i.jsx(a.Input,{placeholder:`Type ${s} here`,value:u,onChange:h=>d(h.target.value),size:"xs"})]})]})}),i.jsxs(Yc,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"#d3d3d3",children:[i.jsx(a.Button,{variant:"outline",size:"sm",onClick:()=>{t(),d("")},children:"Cancel"}),i.jsx(a.Button,{size:"sm",disabled:!g,style:{backgroundColor:"#FF0000"},loading:l,onClick:n,children:c})]}),i.jsx(Hc,{asChild:!0,children:i.jsx(a.CloseButton,{size:"sm"})})]})})]})})}const Pr=({children:e})=>i.jsx(i.Fragment,{children:e}),Nr=({children:e})=>i.jsx(i.Fragment,{children:e}),Wc=a.Button,Uc=b(a.Dialog.Root),Gc=b(a.Dialog.Backdrop),qc=b(a.Dialog.Positioner),Xc=b(a.Dialog.Content),Kc=b(a.Dialog.Header),Jc=b(a.Dialog.Body),Zc=b(a.Dialog.Footer),Qc=b(a.Dialog.Title),el=b(a.Dialog.CloseTrigger);function tl(e){let t=null,n=null;return f.Children.forEach(e,r=>{f.isValidElement(r)&&(r.type===Pr&&(t=r.props.children),r.type===Nr&&(n=r.props.children))}),{body:t,actions:n}}const nl=({open:e,onClose:t,title:n,children:r})=>{const{body:o,actions:s}=tl(r);return i.jsx(Uc,{open:e,onOpenChange:c=>!c.open&&t(),children:i.jsxs(a.Portal,{children:[i.jsx(Gc,{bg:"blackAlpha.400"}),i.jsx(qc,{children:i.jsxs(Xc,{w:"100%",maxW:"520px",borderRadius:"12px",overflow:"hidden",boxShadow:"lg",children:[i.jsx(Kc,{px:"20px",py:"16px",bg:"white",borderBottom:"1px solid",borderColor:"gray.200",children:i.jsxs(a.Flex,{align:"center",justify:"space-between",children:[i.jsx(Qc,{fontSize:"16px",fontWeight:"600",children:n}),i.jsx(el,{asChild:!0,children:i.jsx(a.CloseButton,{size:"sm"})})]})}),o&&i.jsx(Jc,{px:"20px",py:"16px",bg:"#F8FAFC",children:i.jsx(a.Flex,{direction:"column",gap:"16px",children:o})}),s&&i.jsx(Zc,{px:"20px",py:"16px",bg:"white",borderTop:"1px solid",borderColor:"gray.200",children:i.jsx(a.Flex,{ml:"auto",gap:"12px",children:s})})]})})]})})},rl=b(a.Field.Root),ol=b(a.Field.Label),sl=b(a.Field.HelperText),il=b(a.Field.ErrorText),al=b(a.PinInput.Input),cl=b(a.PinInput.Control),ll=b(a.PinInput.HiddenInput),ul=b(a.PinInput.Root),dl=({value:e,onChange:t,length:n=4,size:r="xs",isDisabled:o=!1,label:s,helperText:c,errorText:l,required:u=!1,visible:d=!0})=>{const g=Array.from({length:n}).map((h,y)=>e?.[y]??"");return i.jsxs(rl,{children:[d&&s&&i.jsxs(ol,{children:[s,u&&" *"]}),i.jsxs(ul,{value:g,onValueChange:h=>t?.(h.value.join("")),disabled:o,size:r,children:[i.jsx(ll,{}),i.jsx(cl,{children:i.jsx(a.HStack,{children:Array.from({length:n}).map((h,y)=>i.jsx(al,{index:y},y))})})]}),l&&i.jsx(il,{fontSize:"xs",children:l}),c&&!l&&i.jsx(sl,{fontSize:"xs",children:c})]})};function zr({refetch:e,isLoading:t=!1,label:n="Refresh"}){const[r,o]=f.useState(!1),s=async()=>{o(!0);try{await e()}finally{setTimeout(()=>o(!1),300)}};return i.jsx(a.IconButton,{"aria-label":n,size:"xs",variant:"outline",disabled:t||r,onClick:s,ml:2,children:i.jsx(Oi,{size:14,style:{animation:r?"spin 0.6s linear infinite":void 0}})})}var gt={exports:{}},fl=gt.exports,Wn;function hl(){return Wn||(Wn=1,(function(e,t){(function(n,r){e.exports=r()})(fl,(function(){var n=1e3,r=6e4,o=36e5,s="millisecond",c="second",l="minute",u="hour",d="day",g="week",h="month",y="quarter",v="year",p="date",x="Invalid Date",S=/^(\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,O={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 j=["th","st","nd","rd"],C=I%100;return"["+I+(j[(C-20)%10]||j[C]||j[0])+"]"}},E=function(I,j,C){var T=String(I);return!T||T.length>=j?I:""+Array(j+1-T.length).join(C)+I},k={s:E,z:function(I){var j=-I.utcOffset(),C=Math.abs(j),T=Math.floor(C/60),M=C%60;return(j<=0?"+":"-")+E(T,2,"0")+":"+E(M,2,"0")},m:function I(j,C){if(j.date()<C.date())return-I(C,j);var T=12*(C.year()-j.year())+(C.month()-j.month()),M=j.clone().add(T,h),P=C-M<0,z=j.clone().add(T+(P?-1:1),h);return+(-(T+(C-M)/(P?M-z:z-M))||0)},a:function(I){return I<0?Math.ceil(I)||0:Math.floor(I)},p:function(I){return{M:h,y:v,w:g,d,D:p,h:u,m:l,s:c,ms:s,Q:y}[I]||String(I||"").toLowerCase().replace(/s$/,"")},u:function(I){return I===void 0}},$="en",_={};_[$]=O;var A="$isDayjsObject",L=function(I){return I instanceof W||!(!I||!I[A])},H=function I(j,C,T){var M;if(!j)return $;if(typeof j=="string"){var P=j.toLowerCase();_[P]&&(M=P),C&&(_[P]=C,M=P);var z=j.split("-");if(!M&&z.length>1)return I(z[0])}else{var m=j.name;_[m]=j,M=m}return!T&&M&&($=M),M||!T&&$},Y=function(I,j){if(L(I))return I.clone();var C=typeof j=="object"?j:{};return C.date=I,C.args=arguments,new W(C)},D=k;D.l=H,D.i=L,D.w=function(I,j){return Y(I,{locale:j.$L,utc:j.$u,x:j.$x,$offset:j.$offset})};var W=(function(){function I(C){this.$L=H(C.locale,null,!0),this.parse(C),this.$x=this.$x||C.x||{},this[A]=!0}var j=I.prototype;return j.parse=function(C){this.$d=(function(T){var M=T.date,P=T.utc;if(M===null)return new Date(NaN);if(D.u(M))return new Date;if(M instanceof Date)return new Date(M);if(typeof M=="string"&&!/Z$/i.test(M)){var z=M.match(S);if(z){var m=z[2]-1||0,R=(z[7]||"0").substring(0,3);return P?new Date(Date.UTC(z[1],m,z[3]||1,z[4]||0,z[5]||0,z[6]||0,R)):new Date(z[1],m,z[3]||1,z[4]||0,z[5]||0,z[6]||0,R)}}return new Date(M)})(C),this.init()},j.init=function(){var C=this.$d;this.$y=C.getFullYear(),this.$M=C.getMonth(),this.$D=C.getDate(),this.$W=C.getDay(),this.$H=C.getHours(),this.$m=C.getMinutes(),this.$s=C.getSeconds(),this.$ms=C.getMilliseconds()},j.$utils=function(){return D},j.isValid=function(){return this.$d.toString()!==x},j.isSame=function(C,T){var M=Y(C);return this.startOf(T)<=M&&M<=this.endOf(T)},j.isAfter=function(C,T){return Y(C)<this.startOf(T)},j.isBefore=function(C,T){return this.endOf(T)<Y(C)},j.$g=function(C,T,M){return D.u(C)?this[T]:this.set(M,C)},j.unix=function(){return Math.floor(this.valueOf()/1e3)},j.valueOf=function(){return this.$d.getTime()},j.startOf=function(C,T){var M=this,P=!!D.u(T)||T,z=D.p(C),m=function(J,F){var se=D.w(M.$u?Date.UTC(M.$y,F,J):new Date(M.$y,F,J),M);return P?se:se.endOf(d)},R=function(J,F){return D.w(M.toDate()[J].apply(M.toDate("s"),(P?[0,0,0,0]:[23,59,59,999]).slice(F)),M)},N=this.$W,B=this.$M,q=this.$D,X="set"+(this.$u?"UTC":"");switch(z){case v:return P?m(1,0):m(31,11);case h:return P?m(1,B):m(0,B+1);case g:var V=this.$locale().weekStart||0,K=(N<V?N+7:N)-V;return m(P?q-K:q+(6-K),B);case d:case p:return R(X+"Hours",0);case u:return R(X+"Minutes",1);case l:return R(X+"Seconds",2);case c:return R(X+"Milliseconds",3);default:return this.clone()}},j.endOf=function(C){return this.startOf(C,!1)},j.$set=function(C,T){var M,P=D.p(C),z="set"+(this.$u?"UTC":""),m=(M={},M[d]=z+"Date",M[p]=z+"Date",M[h]=z+"Month",M[v]=z+"FullYear",M[u]=z+"Hours",M[l]=z+"Minutes",M[c]=z+"Seconds",M[s]=z+"Milliseconds",M)[P],R=P===d?this.$D+(T-this.$W):T;if(P===h||P===v){var N=this.clone().set(p,1);N.$d[m](R),N.init(),this.$d=N.set(p,Math.min(this.$D,N.daysInMonth())).$d}else m&&this.$d[m](R);return this.init(),this},j.set=function(C,T){return this.clone().$set(C,T)},j.get=function(C){return this[D.p(C)]()},j.add=function(C,T){var M,P=this;C=Number(C);var z=D.p(T),m=function(B){var q=Y(P);return D.w(q.date(q.date()+Math.round(B*C)),P)};if(z===h)return this.set(h,this.$M+C);if(z===v)return this.set(v,this.$y+C);if(z===d)return m(1);if(z===g)return m(7);var R=(M={},M[l]=r,M[u]=o,M[c]=n,M)[z]||1,N=this.$d.getTime()+C*R;return D.w(N,this)},j.subtract=function(C,T){return this.add(-1*C,T)},j.format=function(C){var T=this,M=this.$locale();if(!this.isValid())return M.invalidDate||x;var P=C||"YYYY-MM-DDTHH:mm:ssZ",z=D.z(this),m=this.$H,R=this.$m,N=this.$M,B=M.weekdays,q=M.months,X=M.meridiem,V=function(F,se,ne,he){return F&&(F[se]||F(T,P))||ne[se].slice(0,he)},K=function(F){return D.s(m%12||12,F,"0")},J=X||function(F,se,ne){var he=F<12?"AM":"PM";return ne?he.toLowerCase():he};return P.replace(w,(function(F,se){return se||(function(ne){switch(ne){case"YY":return String(T.$y).slice(-2);case"YYYY":return D.s(T.$y,4,"0");case"M":return N+1;case"MM":return D.s(N+1,2,"0");case"MMM":return V(M.monthsShort,N,q,3);case"MMMM":return V(q,N);case"D":return T.$D;case"DD":return D.s(T.$D,2,"0");case"d":return String(T.$W);case"dd":return V(M.weekdaysMin,T.$W,B,2);case"ddd":return V(M.weekdaysShort,T.$W,B,3);case"dddd":return B[T.$W];case"H":return String(m);case"HH":return D.s(m,2,"0");case"h":return K(1);case"hh":return K(2);case"a":return J(m,R,!0);case"A":return J(m,R,!1);case"m":return String(R);case"mm":return D.s(R,2,"0");case"s":return String(T.$s);case"ss":return D.s(T.$s,2,"0");case"SSS":return D.s(T.$ms,3,"0");case"Z":return z}return null})(F)||z.replace(":","")}))},j.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},j.diff=function(C,T,M){var P,z=this,m=D.p(T),R=Y(C),N=(R.utcOffset()-this.utcOffset())*r,B=this-R,q=function(){return D.m(z,R)};switch(m){case v:P=q()/12;break;case h:P=q();break;case y:P=q()/3;break;case g:P=(B-N)/6048e5;break;case d:P=(B-N)/864e5;break;case u:P=B/o;break;case l:P=B/r;break;case c:P=B/n;break;default:P=B}return M?P:D.a(P)},j.daysInMonth=function(){return this.endOf(h).$D},j.$locale=function(){return _[this.$L]},j.locale=function(C,T){if(!C)return this.$L;var M=this.clone(),P=H(C,T,!0);return P&&(M.$L=P),M},j.clone=function(){return D.w(this.$d,this)},j.toDate=function(){return new Date(this.valueOf())},j.toJSON=function(){return this.isValid()?this.toISOString():null},j.toISOString=function(){return this.$d.toISOString()},j.toString=function(){return this.$d.toUTCString()},I})(),G=W.prototype;return Y.prototype=G,[["$ms",s],["$s",c],["$m",l],["$H",u],["$W",d],["$M",h],["$y",v],["$D",p]].forEach((function(I){G[I[1]]=function(j){return this.$g(j,I[0],I[1])}})),Y.extend=function(I,j){return I.$i||(I(j,W,Y),I.$i=!0),Y},Y.locale=H,Y.isDayjs=L,Y.unix=function(I){return Y(1e3*I)},Y.en=_[$],Y.Ls=_,Y.p={},Y}))})(gt)),gt.exports}var gl=hl();const Mt=Ct(gl);var pt={exports:{}},pl=pt.exports,Un;function vl(){return Un||(Un=1,(function(e,t){(function(n,r){e.exports=r()})(pl,(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,g,h,y){return s.fromToBase(d,g,h,y)}o.en.relativeTime=c,s.fromToBase=function(d,g,h,y,v){for(var p,x,S,w=h.$locale().relativeTime||c,O=n.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],E=O.length,k=0;k<E;k+=1){var $=O[k];$.d&&(p=y?o(d).diff(h,$.d,!0):h.diff(d,$.d,!0));var _=(n.rounding||Math.round)(Math.abs(p));if(S=p>0,_<=$.r||!$.r){_<=1&&k>0&&($=O[k-1]);var A=w[$.l];v&&(_=v(""+_)),x=typeof A=="string"?A.replace("%d",_):A(_,g,$.l,S);break}}if(g)return x;var L=S?w.future:w.past;return typeof L=="function"?L(x):L.replace("%s",x)},s.to=function(d,g){return l(d,g,this,!0)},s.from=function(d,g){return l(d,g,this)};var u=function(d){return d.$u?o.utc():o()};s.toNow=function(d){return this.to(u(this),d)},s.fromNow=function(d){return this.from(u(this),d)}}}))})(pt)),pt.exports}var ml=vl();const xl=Ct(ml);var vt={exports:{}},bl=vt.exports,Gn;function yl(){return Gn||(Gn=1,(function(e,t){(function(n,r){e.exports=r()})(bl,(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,g=(function(h,y){return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(v,p,x){var S=x&&x.toUpperCase();return p||y[x]||n[x]||y[S].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(w,O,E){return O||E.slice(1)}))}))})(u,d===void 0?{}:d);return l.call(this,g)}}}))})(vt)),vt.exports}var Sl=yl();const wl=Ct(Sl);var mt={exports:{}},Cl=mt.exports,qn;function Dl(){return qn||(qn=1,(function(e,t){(function(n,r){e.exports=r()})(Cl,(function(){return function(n,r){var o=r.prototype,s=o.format;o.format=function(c){var l=this,u=this.$locale();if(!this.isValid())return s.bind(this)(c);var d=this.$utils(),g=(c||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(h){switch(h){case"Q":return Math.ceil((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)(g)}}}))})(mt)),mt.exports}var jl=Dl();const Rl=Ct(jl);Mt.extend(xl);Mt.extend(wl);Mt.extend(Rl);const El={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??El[t]):r}function Tl({value:e,dateVariant:t="date",timeVariant:n="time",dateFormat:r,timeFormat:o,align:s="start",dateColor:c="gray.700",dateFontSize:l="16px",dateFontWeight:u="500",timeColor:d="gray.500",timeFontSize:g="12px",timeFontWeight:h="400"}){return i.jsxs(a.Stack,{gap:.5,align:s,children:[i.jsx(a.Text,{fontSize:l,fontWeight:u,color:c,children:Jt({value:e,variant:t,format:r})}),i.jsx(a.Text,{fontSize:g,fontWeight:h,color:d,children:Jt({value:e,variant:n,format:o})})]})}class Fr{state=new Map;listeners=new Map;get(t){return this.state.get(t)}set(t){this.state.set(t.key,t),this.notify(t.key)}setMany(t){t.forEach(n=>this.set(n))}subscribe(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),n(this.state.get(t)),()=>{this.listeners.get(t)?.delete(n)}}notify(t){this.listeners.get(t)?.forEach(n=>n(this.state.get(t)))}clear(){this.state.clear()}}class Zt{constructor(t){this.baseUrl=t}async fetchLatest(t){const n=new URLSearchParams;return n.set("keys",t.join(",")),(await(await fetch(`${this.baseUrl}/options?${n}`)).json()).data}}class Qt{constructor(t){this.api=t}store=new Fr;inflight=new Map;getRaw(t){return this.store.get(t)}async getKey(t){const n=this.store.get(t);return n?n.value:(await this.fetchMissing([t]),this.store.get(t)?.value)}async getMultiKey(t){const n={},r=[];for(const o of t){const s=this.store.get(o);s?n[o]=s.value:r.push(o)}return r.length&&(await this.fetchMissing(r),r.forEach(o=>{const s=this.store.get(o);s&&(n[o]=s.value)})),n}subscribe(t,n){return this.store.subscribe(t,n)}hydrate(t){this.store.setMany(t)}clear(){this.store.clear()}async fetchMissing(t){const n=t.filter(o=>!this.inflight.has(o));if(!n.length)return;const r=this.api.fetchLatest(n).then(o=>{this.store.setMany(o),n.forEach(s=>this.inflight.delete(s))});n.forEach(o=>this.inflight.set(o,r)),await r}}const Yr=f.createContext(null);function Br(){const e=f.useContext(Yr);if(!e)throw new Error("OptionsProvider is missing. Wrap your app with <OptionsProvider />");return e}function Ml({client:{apiUrl:e},children:t}){const n=f.useRef(new Qt(new Zt(e)));return n.current||(n.current=new Qt(new Zt(e))),i.jsx(Yr.Provider,{value:n.current,children:t})}function _l(e){const t=Br(),[n,r]=f.useState(t.getRaw(e)?.value);return f.useEffect(()=>{let o=!0;t.getKey(e).then(c=>{o&&r(c)});const s=t.subscribe(e,c=>{r(c?.value)});return()=>{o=!1,s()}},[e,t]),n}function Ol(e){const t=Br(),[n,r]=f.useState({});return f.useEffect(()=>{let o=!0;t.getMultiKey(e).then(c=>{o&&r(c)});const s=e.map(c=>t.subscribe(c,l=>{r(u=>({...u,[c]:l?.value}))}));return()=>{o=!1,s.forEach(c=>c())}},[e.join("|"),t]),n}async function kl(e,t){return e.getKey(t)}async function $l(e,t){await e.getMultiKey(t)}function Il(e={}){const{initialPage:t=1,initialLimit:n=20}=e,[r,o]=f.useState(t),[s,c]=f.useState(n),l=f.useCallback(y=>{o(Math.max(1,y))},[]),u=f.useCallback(y=>{c(Math.max(1,y)),o(1)},[]),d=f.useCallback(()=>{o(y=>y+1)},[]),g=f.useCallback(()=>{o(y=>Math.max(1,y-1))},[]),h=f.useCallback(()=>{o(t),c(n)},[t,n]);return{page:r,limit:s,setPage:l,setLimit:u,nextPage:d,prevPage:g,reset:h}}function Al(e={}){const{initialValue:t="",delay:n=300}=e,[r,o]=f.useState(t),s=Ll(r,n),c=f.useCallback(u=>{o(u)},[]),l=f.useCallback(()=>{o(t)},[t]);return{search:r,debouncedSearch:s,onSearchChange:c,reset:l}}function Ll(e,t=300){const[n,r]=f.useState(e);return f.useEffect(()=>{const o=setTimeout(()=>{r(e)},t);return()=>clearTimeout(o)},[e,t]),n}exports.DataTable=ua;exports.Filters=Sc;exports.HttpOptionsApi=Zt;exports.MDSButton=Dc;exports.MDSCheckbox=_r;exports.MDSCombobox=Or;exports.MDSConfirmActionDialog=Ic;exports.MDSConfirmDeleteDialog=Vc;exports.MDSDialogAction=Wc;exports.MDSDialogActions=Nr;exports.MDSDialogBody=Pr;exports.MDSDialogWrapper=nl;exports.MDSInput=Kt;exports.MDSPinInput=dl;exports.MDSRefreshButton=zr;exports.MDSSelectBox=kr;exports.OptionsClientImpl=Qt;exports.OptionsProvider=Ml;exports.OptionsStore=Fr;exports.RefreshButton=zr;exports.StackedDateTime=Tl;exports.addPreset=Ir;exports.deletePreset=Ar;exports.formatDateTime=Jt;exports.getOption=kl;exports.getPresets=rt;exports.loadOrder=Cc;exports.prefetchOptions=$l;exports.presetStore=Ze;exports.saveOrder=wc;exports.savePresets=Tt;exports.setActionsConfig=Dr;exports.setData=wr;exports.setTableId=Cr;exports.tableStore=ie;exports.updatePreset=Za;exports.useDebouncedSearch=Al;exports.useOption=_l;exports.useOptions=Ol;exports.usePagination=Il;exports.withChildren=b;
|
|
10
|
+
`},ho={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function go(e){let{announcements:t=ho,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=fo}=e;const{announce:s,announcement:c}=co(),l=tt("DndLiveRegion"),[u,d]=f.useState(!1);if(f.useEffect(()=>{d(!0)},[]),lo(f.useMemo(()=>({onDragStart(h){let{active:y}=h;s(t.onDragStart({active:y}))},onDragMove(h){let{active:y,over:v}=h;t.onDragMove&&s(t.onDragMove({active:y,over:v}))},onDragOver(h){let{active:y,over:v}=h;s(t.onDragOver({active:y,over:v}))},onDragEnd(h){let{active:y,over:v}=h;s(t.onDragEnd({active:y,over:v}))},onDragCancel(h){let{active:y,over:v}=h;s(t.onDragCancel({active:y,over:v}))}}),[s,t])),!u)return null;const g=f.createElement(f.Fragment,null,f.createElement(io,{id:r,value:o.draggable}),f.createElement(ao,{id:l,announcement:c}));return n?Ue.createPortal(g,n):g}var Q;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Q||(Q={}));function yt(){}function po(e,t){return f.useMemo(()=>({sensor:e,options:{}}),[e,t])}function vo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return f.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const pe=Object.freeze({x:0,y:0});function mo(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function xo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function bo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function yo(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function wn(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const Zn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=wn(t,t.left,t.top),s=[];for(const c of r){const{id:l}=c,u=n.get(l);if(u){const d=mo(wn(u),o);s.push({id:l,data:{droppableContainer:c,value:d}})}}return s.sort(xo)};function So(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),c=o-r,l=s-n;if(r<o&&n<s){const u=t.width*t.height,d=e.width*e.height,g=c*l,h=g/(u+d-g);return Number(h.toFixed(4))}return 0}const wo=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const s of r){const{id:c}=s,l=n.get(c);if(l){const u=So(l,t);u>0&&o.push({id:c,data:{droppableContainer:s,value:u}})}}return o.sort(bo)};function Co(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Qn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:pe}function Do(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];return o.reduce((c,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 jo=Do(1);function Ro(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Eo(e,t,n){const r=Ro(t);if(!r)return e;const{scaleX:o,scaleY:s,x:c,y:l}=r,u=e.left-c-(1-o)*parseFloat(n),d=e.top-l-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),g=o?e.width/o:e.width,h=s?e.height/s:e.height;return{width:g,height:h,top:d,right:u+g,bottom:d+h,left:u}}const To={ignoreTransform:!1};function Pe(e,t){t===void 0&&(t=To);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:g}=ae(e).getComputedStyle(e);d&&(n=Eo(n,d,g))}const{top:r,left:o,width:s,height:c,bottom:l,right:u}=n;return{top:r,left:o,width:s,height:c,bottom:l,right:u}}function Cn(e){return Pe(e,{ignoreTransform:!0})}function Mo(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function _o(e,t){return t===void 0&&(t=ae(e).getComputedStyle(e)),t.position==="fixed"}function Oo(e,t){t===void 0&&(t=ae(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const s=t[o];return typeof s=="string"?n.test(s):!1})}function on(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(tn(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Qe(o)||Xn(o)||n.includes(o))return n;const s=ae(e).getComputedStyle(o);return o!==e&&Oo(o,s)&&n.push(o),_o(o,s)?n:r(o.parentNode)}return e?r(e):n}function er(e){const[t]=on(e,1);return t??null}function It(e){return!Dt||!e?null:Ae(e)?e:en(e)?tn(e)||e===Le(e).scrollingElement?window:Qe(e)?e:null:null}function tr(e){return Ae(e)?e.scrollX:e.scrollLeft}function nr(e){return Ae(e)?e.scrollY:e.scrollTop}function Ut(e){return{x:tr(e),y:nr(e)}}var ee;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ee||(ee={}));function rr(e){return!Dt||!e?!1:e===document.scrollingElement}function or(e){const t={x:0,y:0},n=rr(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,c=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:o,isLeft:s,isBottom:c,isRight:l,maxScroll:r,minScroll:t}}const ko={x:.2,y:.2};function $o(e,t,n,r,o){let{top:s,left:c,right:l,bottom:u}=n;r===void 0&&(r=10),o===void 0&&(o=ko);const{isTop:d,isBottom:g,isLeft:h,isRight:y}=or(e),v={x:0,y:0},p={x:0,y:0},x={height:t.height*o.y,width:t.width*o.x};return!d&&s<=t.top+x.height?(v.y=ee.Backward,p.y=r*Math.abs((t.top+x.height-s)/x.height)):!g&&u>=t.bottom-x.height&&(v.y=ee.Forward,p.y=r*Math.abs((t.bottom-x.height-u)/x.height)),!y&&l>=t.right-x.width?(v.x=ee.Forward,p.x=r*Math.abs((t.right-x.width-l)/x.width)):!h&&c<=t.left+x.width&&(v.x=ee.Backward,p.x=r*Math.abs((t.left+x.width-c)/x.width)),{direction:v,speed:p}}function Io(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:c}=window;return{top:0,left:0,right:s,bottom:c,width:s,height:c}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function sr(e){return e.reduce((t,n)=>$e(t,Ut(n)),pe)}function Ao(e){return e.reduce((t,n)=>t+tr(n),0)}function Lo(e){return e.reduce((t,n)=>t+nr(n),0)}function Po(e,t){if(t===void 0&&(t=Pe),!e)return;const{top:n,left:r,bottom:o,right:s}=t(e);er(e)&&(o<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const No=[["x",["left","right"],Ao],["y",["top","bottom"],Lo]];class sn{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=on(n),o=sr(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,c,l]of No)for(const u of c)Object.defineProperty(this,u,{get:()=>{const d=l(r),g=o[s]-d;return this.rect[u]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ge{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function zo(e){const{EventTarget:t}=ae(e);return e instanceof t?e:Le(e)}function At(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var fe;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(fe||(fe={}));function Dn(e){e.preventDefault()}function Fo(e){e.stopPropagation()}var U;(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"})(U||(U={}));const ir={start:[U.Space,U.Enter],cancel:[U.Esc],end:[U.Space,U.Enter,U.Tab]},Yo=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case U.Right:return{...n,x:n.x+25};case U.Left:return{...n,x:n.x-25};case U.Down:return{...n,y:n.y+25};case U.Up:return{...n,y:n.y-25}}};class ar{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Ge(Le(n)),this.windowListeners=new Ge(ae(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(fe.Resize,this.handleCancel),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(fe.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Po(r),n(pe)}handleKeyDown(t){if(rn(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=ir,coordinateGetter:c=Yo,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,g=d?{x:d.left,y:d.top}:pe;this.referenceCoordinates||(this.referenceCoordinates=g);const h=c(t,{active:n,context:r.current,currentCoordinates:g});if(h){const y=bt(h,g),v={x:0,y:0},{scrollableAncestors:p}=r.current;for(const x of p){const S=t.code,{isTop:w,isRight:O,isLeft:E,isBottom:k,maxScroll:$,minScroll:_}=or(x),A=Io(x),L={x:Math.min(S===U.Right?A.right-A.width/2:A.right,Math.max(S===U.Right?A.left:A.left+A.width/2,h.x)),y:Math.min(S===U.Down?A.bottom-A.height/2:A.bottom,Math.max(S===U.Down?A.top:A.top+A.height/2,h.y))},H=S===U.Right&&!O||S===U.Left&&!E,Y=S===U.Down&&!k||S===U.Up&&!w;if(H&&L.x!==h.x){const D=x.scrollLeft+y.x,W=S===U.Right&&D<=$.x||S===U.Left&&D>=_.x;if(W&&!y.y){x.scrollTo({left:D,behavior:l});return}W?v.x=x.scrollLeft-D:v.x=S===U.Right?x.scrollLeft-$.x:x.scrollLeft-_.x,v.x&&x.scrollBy({left:-v.x,behavior:l});break}else if(Y&&L.y!==h.y){const D=x.scrollTop+y.y,W=S===U.Down&&D<=$.y||S===U.Up&&D>=_.y;if(W&&!y.x){x.scrollTo({top:D,behavior:l});return}W?v.y=x.scrollTop-D:v.y=S===U.Down?x.scrollTop-$.y:x.scrollTop-_.y,v.y&&x.scrollBy({top:-v.y,behavior:l});break}}this.handleMove(t,$e(bt(h,this.referenceCoordinates),v))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}ar.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=ir,onActivation:o}=t,{active:s}=n;const{code:c}=e.nativeEvent;if(r.start.includes(c)){const l=s.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function jn(e){return!!(e&&"distance"in e)}function Rn(e){return!!(e&&"delay"in e)}class an{constructor(t,n,r){var o;r===void 0&&(r=zo(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:s}=t,{target:c}=s;this.props=t,this.events=n,this.document=Le(c),this.documentListeners=new Ge(this.document),this.listeners=new Ge(r),this.windowListeners=new Ge(ae(c)),this.initialCoordinates=(o=Wt(s))!=null?o:pe,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(fe.Resize,this.handleCancel),this.windowListeners.add(fe.DragStart,Dn),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),this.windowListeners.add(fe.ContextMenu,Dn),this.documentListeners.add(fe.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Rn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(jn(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(fe.Click,Fo,{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=Wt(t))!=null?n:pe,d=bt(o,u);if(!r&&l){if(jn(l)){if(l.tolerance!=null&&At(d,l.tolerance))return this.handleCancel();if(At(d,l.distance))return this.handleStart()}if(Rn(l)&&At(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===U.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Bo={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class cn extends an{constructor(t){const{event:n}=t,r=Le(n.target);super(t,Bo,r)}}cn.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const Ho={move:{name:"mousemove"},end:{name:"mouseup"}};var Gt;(function(e){e[e.RightClick=2]="RightClick"})(Gt||(Gt={}));class Vo extends an{constructor(t){super(t,Ho,Le(t.event.target))}}Vo.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Gt.RightClick?!1:(r?.({event:n}),!0)}}];const Lt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Wo extends an{constructor(t){super(t,Lt)}static setup(){return window.addEventListener(Lt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Lt.move.name,t)};function t(){}}}Wo.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var qe;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(qe||(qe={}));var St;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(St||(St={}));function Uo(e){let{acceleration:t,activator:n=qe.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:c=5,order:l=St.TreeOrder,pointerCoordinates:u,scrollableAncestors:d,scrollableAncestorRects:g,delta:h,threshold:y}=e;const v=qo({delta:h,disabled:!s}),[p,x]=to(),S=f.useRef({x:0,y:0}),w=f.useRef({x:0,y:0}),O=f.useMemo(()=>{switch(n){case qe.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case qe.DraggableRect:return o}},[n,o,u]),E=f.useRef(null),k=f.useCallback(()=>{const _=E.current;if(!_)return;const A=S.current.x*w.current.x,L=S.current.y*w.current.y;_.scrollBy(A,L)},[]),$=f.useMemo(()=>l===St.TreeOrder?[...d].reverse():d,[l,d]);f.useEffect(()=>{if(!s||!d.length||!O){x();return}for(const _ of $){if(r?.(_)===!1)continue;const A=d.indexOf(_),L=g[A];if(!L)continue;const{direction:H,speed:Y}=$o(_,L,O,t,y);for(const D of["x","y"])v[D][H[D]]||(Y[D]=0,H[D]=0);if(Y.x>0||Y.y>0){x(),E.current=_,p(k,c),S.current=Y,w.current=H;return}}S.current={x:0,y:0},w.current={x:0,y:0},x()},[t,k,r,x,s,c,JSON.stringify(O),JSON.stringify(v),p,d,$,g,JSON.stringify(y)])}const Go={x:{[ee.Backward]:!1,[ee.Forward]:!1},y:{[ee.Backward]:!1,[ee.Forward]:!1}};function qo(e){let{delta:t,disabled:n}=e;const r=Vt(t);return et(o=>{if(n||!r||!o)return Go;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ee.Backward]:o.x[ee.Backward]||s.x===-1,[ee.Forward]:o.x[ee.Forward]||s.x===1},y:{[ee.Backward]:o.y[ee.Backward]||s.y===-1,[ee.Forward]:o.y[ee.Forward]||s.y===1}}},[n,t,r])}function Xo(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return et(o=>{var s;return t==null?null:(s=r??o)!=null?s:null},[r,t])}function Ko(e,t){return f.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,s=o.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,r)}));return[...n,...s]},[]),[e,t])}var Je;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Je||(Je={}));var qt;(function(e){e.Optimized="optimized"})(qt||(qt={}));const En=new Map;function Jo(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,c]=f.useState(null),{frequency:l,measure:u,strategy:d}=o,g=f.useRef(e),h=S(),y=Ke(h),v=f.useCallback(function(w){w===void 0&&(w=[]),!y.current&&c(O=>O===null?w:O.concat(w.filter(E=>!O.includes(E))))},[y]),p=f.useRef(null),x=et(w=>{if(h&&!n)return En;if(!w||w===En||g.current!==e||s!=null){const O=new Map;for(let E of e){if(!E)continue;if(s&&s.length>0&&!s.includes(E.id)&&E.rect.current){O.set(E.id,E.rect.current);continue}const k=E.node.current,$=k?new sn(u(k),k):null;E.rect.current=$,$&&O.set(E.id,$)}return O}return w},[e,s,n,h,u]);return f.useEffect(()=>{g.current=e},[e]),f.useEffect(()=>{h||v()},[n,h]),f.useEffect(()=>{s&&s.length>0&&c(null)},[JSON.stringify(s)]),f.useEffect(()=>{h||typeof l!="number"||p.current!==null||(p.current=setTimeout(()=>{v(),p.current=null},l))},[l,h,v,...r]),{droppableRects:x,measureDroppableContainers:v,measuringScheduled:s!=null};function S(){switch(d){case Je.Always:return!1;case Je.BeforeDragging:return n;default:return!n}}}function cr(e,t){return et(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Zo(e,t){return cr(e,t)}function Qo(e){let{callback:t,disabled:n}=e;const r=nn(t),o=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return f.useEffect(()=>()=>o?.disconnect(),[o]),o}function jt(e){let{callback:t,disabled:n}=e;const r=nn(t),o=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return f.useEffect(()=>()=>o?.disconnect(),[o]),o}function es(e){return new sn(Pe(e),e)}function Tn(e,t,n){t===void 0&&(t=es);const[r,o]=f.useState(null);function s(){o(u=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=u??n)!=null?d:null}const g=t(e);return JSON.stringify(u)===JSON.stringify(g)?u:g})}const c=Qo({callback(u){if(e)for(const d of u){const{type:g,target:h}=d;if(g==="childList"&&h instanceof HTMLElement&&h.contains(e)){s();break}}}}),l=jt({callback:s});return xe(()=>{s(),e?(l?.observe(e),c?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),c?.disconnect())},[e]),r}function ts(e){const t=cr(e);return Qn(e,t)}const Mn=[];function ns(e){const t=f.useRef(e),n=et(r=>e?r&&r!==Mn&&e&&t.current&&e.parentNode===t.current.parentNode?r:on(e):Mn,[e]);return f.useEffect(()=>{t.current=e},[e]),n}function rs(e){const[t,n]=f.useState(null),r=f.useRef(e),o=f.useCallback(s=>{const c=It(s.target);c&&n(l=>l?(l.set(c,Ut(c)),new Map(l)):null)},[]);return f.useEffect(()=>{const s=r.current;if(e!==s){c(s);const l=e.map(u=>{const d=It(u);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,Ut(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=It(u);d?.removeEventListener("scroll",o)})}},[o,e]),f.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,c)=>$e(s,c),pe):sr(e):pe,[e,t])}function _n(e,t){t===void 0&&(t=[]);const n=f.useRef(null);return f.useEffect(()=>{n.current=null},t),f.useEffect(()=>{const r=e!==pe;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?bt(e,n.current):pe}function os(e){f.useEffect(()=>{if(!Dt)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function ss(e,t){return f.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:s}=r;return n[o]=c=>{s(c,t)},n},{}),[e,t])}function lr(e){return f.useMemo(()=>e?Mo(e):null,[e])}const On=[];function is(e,t){t===void 0&&(t=Pe);const[n]=e,r=lr(n?ae(n):null),[o,s]=f.useState(On);function c(){s(()=>e.length?e.map(u=>rr(u)?r:new sn(t(u),u)):On)}const l=jt({callback:c});return xe(()=>{l?.disconnect(),c(),e.forEach(u=>l?.observe(u))},[e]),o}function as(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Qe(t)?t:e}function cs(e){let{measure:t}=e;const[n,r]=f.useState(null),o=f.useCallback(d=>{for(const{target:g}of d)if(Qe(g)){r(h=>{const y=t(g);return h?{...h,width:y.width,height:y.height}:y});break}},[t]),s=jt({callback:o}),c=f.useCallback(d=>{const g=as(d);s?.disconnect(),g&&s?.observe(g),r(g?t(g):null)},[t,s]),[l,u]=xt(c);return f.useMemo(()=>({nodeRef:l,rect:n,setRef:u}),[n,l,u])}const ls=[{sensor:cn,options:{}},{sensor:ar,options:{}}],us={current:{}},ht={draggable:{measure:Cn},droppable:{measure:Cn,strategy:Je.WhileDragging,frequency:qt.Optimized},dragOverlay:{measure:Pe}};class Xe extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const ds={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Xe,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:yt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ht,measureDroppableContainers:yt,windowRect:null,measuringScheduled:!1},fs={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:yt,draggableNodes:new Map,over:null,measureDroppableContainers:yt},Rt=f.createContext(fs),ur=f.createContext(ds);function hs(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Xe}}}function gs(e,t){switch(t.type){case Q.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Q.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Q.DragEnd:case Q.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Q.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Xe(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case Q.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const c=new Xe(e.droppable.containers);return c.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:c}}}case Q.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Xe(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function ps(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=f.useContext(Rt),s=Vt(r),c=Vt(n?.id);return f.useEffect(()=>{if(!t&&!r&&s&&c!=null){if(!rn(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 g of[u.current,d.current]){if(!g)continue;const h=oo(g);if(h){h.focus();break}}})}},[r,t,o,c,s]),null}function vs(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,s)=>s({transform:o,...r}),n):n}function ms(e){return f.useMemo(()=>({draggable:{...ht.draggable,...e?.draggable},droppable:{...ht.droppable,...e?.droppable},dragOverlay:{...ht.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function xs(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const s=f.useRef(!1),{x:c,y:l}=typeof o=="boolean"?{x:o,y:o}:o;xe(()=>{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 g=n(d),h=Qn(g,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=er(d);y&&y.scrollBy({top:h.y,left:h.x})}},[t,c,l,r,n])}const dr=f.createContext({...pe,scaleX:1,scaleY:1});var Re;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Re||(Re={}));const fr=f.memo(function(t){var n,r,o,s;let{id:c,accessibility:l,autoScroll:u=!0,children:d,sensors:g=ls,collisionDetection:h=wo,measuring:y,modifiers:v,...p}=t;const x=f.useReducer(gs,void 0,hs),[S,w]=x,[O,E]=uo(),[k,$]=f.useState(Re.Uninitialized),_=k===Re.Initialized,{draggable:{active:A,nodes:L,translate:H},droppable:{containers:Y}}=S,D=A!=null?L.get(A):null,W=f.useRef({initial:null,translated:null}),G=f.useMemo(()=>{var re;return A!=null?{id:A,data:(re=D?.data)!=null?re:us,rect:W}:null},[A,D]),I=f.useRef(null),[j,C]=f.useState(null),[T,M]=f.useState(null),P=Ke(p,Object.values(p)),z=tt("DndDescribedBy",c),m=f.useMemo(()=>Y.getEnabled(),[Y]),R=ms(y),{droppableRects:N,measureDroppableContainers:B,measuringScheduled:q}=Jo(m,{dragging:_,dependencies:[H.x,H.y],config:R.droppable}),X=Xo(L,A),V=f.useMemo(()=>T?Wt(T):null,[T]),K=Kr(),J=Zo(X,R.draggable.measure);xs({activeNode:A!=null?L.get(A):null,config:K.layoutShiftCompensation,initialRect:J,measure:R.draggable.measure});const F=Tn(X,R.draggable.measure,J),se=Tn(X?X.parentElement:null),ne=f.useRef({activatorEvent:null,active:null,activeNode:X,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:L,draggingNode:null,draggingNodeRect:null,droppableContainers:Y,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),he=Y.getNodeFor((n=ne.current.over)==null?void 0:n.id),be=cs({measure:R.dragOverlay.measure}),Te=(r=be.nodeRef.current)!=null?r:X,Me=_?(o=be.rect)!=null?o:F:null,un=!!(be.nodeRef.current&&be.rect),dn=ts(un?null:F),_t=lr(Te?ae(Te):null),Se=ns(_?he??X:null),ot=is(Se),st=vs(v,{transform:{x:H.x-dn.x,y:H.y-dn.y,scaleX:1,scaleY:1},activatorEvent:T,active:G,activeNodeRect:F,containerNodeRect:se,draggingNodeRect:Me,over:ne.current.over,overlayNodeRect:be.rect,scrollableAncestors:Se,scrollableAncestorRects:ot,windowRect:_t}),fn=V?$e(V,H):null,hn=rs(Se),Hr=_n(hn),Vr=_n(hn,[F]),_e=$e(st,Hr),Oe=Me?jo(Me,st):null,Ne=G&&Oe?h({active:G,collisionRect:Oe,droppableRects:N,droppableContainers:m,pointerCoordinates:fn}):null,gn=yo(Ne,"id"),[we,pn]=f.useState(null),Wr=un?st:$e(st,Vr),Ur=Co(Wr,(s=we?.rect)!=null?s:null,F),Ot=f.useRef(null),vn=f.useCallback((re,ce)=>{let{sensor:le,options:Ce}=ce;if(I.current==null)return;const de=L.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(!L.get(te))return;const{onDragAbort:me}=P.current,ye={id:te};me?.(ye),O({type:"onDragAbort",event:ye})},onPending(te,De,me,ye){if(!L.get(te))return;const{onDragPending:Fe}=P.current,je={id:te,constraint:De,initialCoordinates:me,offset:ye};Fe?.(je),O({type:"onDragPending",event:je})},onStart(te){const De=I.current;if(De==null)return;const me=L.get(De);if(!me)return;const{onDragStart:ye}=P.current,ze={activatorEvent:ue,active:{id:De,data:me.data,rect:W}};Ue.unstable_batchedUpdates(()=>{ye?.(ze),$(Re.Initializing),w({type:Q.DragStart,initialCoordinates:te,active:De}),O({type:"onDragStart",event:ze}),C(Ot.current),M(ue)})},onMove(te){w({type:Q.DragMove,coordinates:te})},onEnd:ke(Q.DragEnd),onCancel:ke(Q.DragCancel)});Ot.current=ve;function ke(te){return async function(){const{active:me,collisions:ye,over:ze,scrollAdjustedTranslate:Fe}=ne.current;let je=null;if(me&&Fe){const{cancelDrop:Ye}=P.current;je={activatorEvent:ue,active:me,collisions:ye,delta:Fe,over:ze},te===Q.DragEnd&&typeof Ye=="function"&&await Promise.resolve(Ye(je))&&(te=Q.DragCancel)}I.current=null,Ue.unstable_batchedUpdates(()=>{w({type:te}),$(Re.Uninitialized),pn(null),C(null),M(null),Ot.current=null;const Ye=te===Q.DragEnd?"onDragEnd":"onDragCancel";if(je){const kt=P.current[Ye];kt?.(je),O({type:Ye,event:je})}})}}},[L]),Gr=f.useCallback((re,ce)=>(le,Ce)=>{const de=le.nativeEvent,ue=L.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,vn(le,ce))},[L,vn]),mn=Ko(g,Gr);os(g),xe(()=>{F&&k===Re.Initializing&&$(Re.Initialized)},[F,k]),f.useEffect(()=>{const{onDragMove:re}=P.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),O({type:"onDragMove",event:ue})})},[_e.x,_e.y]),f.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}=P.current,ve=Ce.get(gn),ke=ve&&ve.rect.current?{id:ve.id,rect:ve.rect.current,data:ve.data,disabled:ve.disabled}:null,te={active:re,activatorEvent:ce,collisions:le,delta:{x:de.x,y:de.y},over:ke};Ue.unstable_batchedUpdates(()=>{pn(ke),ue?.(te),O({type:"onDragOver",event:te})})},[gn]),xe(()=>{ne.current={activatorEvent:T,active:G,activeNode:X,collisionRect:Oe,collisions:Ne,droppableRects:N,draggableNodes:L,draggingNode:Te,draggingNodeRect:Me,droppableContainers:Y,over:we,scrollableAncestors:Se,scrollAdjustedTranslate:_e},W.current={initial:Me,translated:Oe}},[G,X,Ne,Oe,L,Te,Me,N,Y,we,Se,_e]),Uo({...K,delta:H,draggingRect:Oe,pointerCoordinates:fn,scrollableAncestors:Se,scrollableAncestorRects:ot});const qr=f.useMemo(()=>({active:G,activeNode:X,activeNodeRect:F,activatorEvent:T,collisions:Ne,containerNodeRect:se,dragOverlay:be,draggableNodes:L,droppableContainers:Y,droppableRects:N,over:we,measureDroppableContainers:B,scrollableAncestors:Se,scrollableAncestorRects:ot,measuringConfiguration:R,measuringScheduled:q,windowRect:_t}),[G,X,F,T,Ne,se,be,L,Y,N,we,B,Se,ot,R,q,_t]),Xr=f.useMemo(()=>({activatorEvent:T,activators:mn,active:G,activeNodeRect:F,ariaDescribedById:{draggable:z},dispatch:w,draggableNodes:L,over:we,measureDroppableContainers:B}),[T,mn,G,F,w,z,L,we,B]);return f.createElement(Jn.Provider,{value:E},f.createElement(Rt.Provider,{value:Xr},f.createElement(ur.Provider,{value:qr},f.createElement(dr.Provider,{value:Ur},d)),f.createElement(ps,{disabled:l?.restoreFocus===!1})),f.createElement(go,{...l,hiddenTextDescribedById:z}));function Kr(){const re=j?.autoScrollEnabled===!1,ce=typeof u=="object"?u.enabled===!1:u===!1,le=_&&!re&&!ce;return typeof u=="object"?{...u,enabled:le}:{enabled:le}}}),bs=f.createContext(null),kn="button",ys="Draggable";function Ss(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=tt(ys),{activators:c,activatorEvent:l,active:u,activeNodeRect:d,ariaDescribedById:g,draggableNodes:h,over:y}=f.useContext(Rt),{role:v=kn,roleDescription:p="draggable",tabIndex:x=0}=o??{},S=u?.id===t,w=f.useContext(S?dr:bs),[O,E]=xt(),[k,$]=xt(),_=ss(c,t),A=Ke(n);xe(()=>(h.set(t,{id:t,key:s,node:O,activatorNode:k,data:A}),()=>{const H=h.get(t);H&&H.key===s&&h.delete(t)}),[h,t]);const L=f.useMemo(()=>({role:v,tabIndex:x,"aria-disabled":r,"aria-pressed":S&&v===kn?!0:void 0,"aria-roledescription":p,"aria-describedby":g.draggable}),[r,v,x,S,p,g.draggable]);return{active:u,activatorEvent:l,activeNodeRect:d,attributes:L,isDragging:S,listeners:r?void 0:_,node:O,over:y,setNodeRef:E,setActivatorNodeRef:$,transform:w}}function ws(){return f.useContext(ur)}const Cs="Droppable",Ds={timeout:25};function js(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=tt(Cs),{active:c,dispatch:l,over:u,measureDroppableContainers:d}=f.useContext(Rt),g=f.useRef({disabled:n}),h=f.useRef(!1),y=f.useRef(null),v=f.useRef(null),{disabled:p,updateMeasurementsFor:x,timeout:S}={...Ds,...o},w=Ke(x??r),O=f.useCallback(()=>{if(!h.current){h.current=!0;return}v.current!=null&&clearTimeout(v.current),v.current=setTimeout(()=>{d(Array.isArray(w.current)?w.current:[w.current]),v.current=null},S)},[S]),E=jt({callback:O,disabled:p||!c}),k=f.useCallback((L,H)=>{E&&(H&&(E.unobserve(H),h.current=!1),L&&E.observe(L))},[E]),[$,_]=xt(k),A=Ke(t);return f.useEffect(()=>{!E||!$.current||(E.disconnect(),h.current=!1,E.observe($.current))},[$,E]),f.useEffect(()=>(l({type:Q.RegisterDroppable,element:{id:r,key:s,disabled:n,node:$,rect:y,data:A}}),()=>l({type:Q.UnregisterDroppable,key:s,id:r})),[r]),f.useEffect(()=>{n!==g.current.disabled&&(l({type:Q.SetDroppableDisabled,id:r,key:s,disabled:n}),g.current.disabled=n)},[r,s,n,l]),{active:c,rect:y,isOver:u?.id===r,node:$,over:u,setNodeRef:_}}function Et(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Rs(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function at(e){return e!==null&&e>=0}function Es(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Ts(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const ct={scaleX:1,scaleY:1},Ms=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:s,index:c}=e;const 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,...ct}:null}return c>o&&c<=s?{x:-l.width-u,y:0,...ct}:c<o&&c>=s?{x:l.width+u,y:0,...ct}:{x:0,y:0,...ct}};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 hr=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const s=Et(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}},lt={scaleX:1,scaleY:1},Os=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,...lt}:null}const u=ks(s,o,n);return o>n&&o<=c?{x:0,y:-l.height-u,...lt}:o<n&&o>=c?{x:0,y:l.height+u,...lt}:{x:0,y:0,...lt}};function ks(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return r?n<t?o?r.top-(o.top+o.height):s?s.top-(r.top+r.height):0:s?s.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const gr="Sortable",pr=f.createContext({activeIndex:-1,containerId:gr,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:hr,disabled:{draggable:!1,droppable:!1}});function vr(e){let{children:t,id:n,items:r,strategy:o=hr,disabled:s=!1}=e;const{active:c,dragOverlay:l,droppableRects:u,over:d,measureDroppableContainers:g}=ws(),h=tt(gr,n),y=l.rect!==null,v=f.useMemo(()=>r.map(_=>typeof _=="object"&&"id"in _?_.id:_),[r]),p=c!=null,x=c?v.indexOf(c.id):-1,S=d?v.indexOf(d.id):-1,w=f.useRef(v),O=!Es(v,w.current),E=S!==-1&&x===-1||O,k=Ts(s);xe(()=>{O&&p&&g(v)},[O,v,p,g]),f.useEffect(()=>{w.current=v},[v]);const $=f.useMemo(()=>({activeIndex:x,containerId:h,disabled:k,disableTransforms:E,items:v,overIndex:S,useDragOverlay:y,sortedRects:Rs(v,u),strategy:o}),[x,h,k.draggable,k.droppable,E,v,S,u,y,o]);return f.createElement(pr.Provider,{value:$},t)}const $s=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Et(n,r,o).indexOf(t)},Is=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:s,newIndex:c,previousItems:l,previousContainerId:u,transition:d}=e;return!d||!r||l!==s&&o===c?!1:n?!0:c!==o&&t===u},As={duration:200,easing:"ease"},mr="transform",Ls=Ie.Transition.toString({property:mr,duration:0,easing:"linear"}),Ps={roleDescription:"sortable"};function Ns(e){let{disabled:t,index:n,node:r,rect:o}=e;const[s,c]=f.useState(null),l=f.useRef(n);return xe(()=>{if(!t&&n!==l.current&&r.current){const u=o.current;if(u){const d=Pe(r.current,{ignoreTransform:!0}),g={x:u.left-d.left,y:u.top-d.top,scaleX:u.width/d.width,scaleY:u.height/d.height};(g.x||g.y)&&c(g)}}n!==l.current&&(l.current=n)},[t,n,r,o]),f.useEffect(()=>{s&&c(null)},[s]),s}function xr(e){let{animateLayoutChanges:t=Is,attributes:n,disabled:r,data:o,getNewIndex:s=$s,id:c,strategy:l,resizeObserverConfig:u,transition:d=As}=e;const{items:g,containerId:h,activeIndex:y,disabled:v,disableTransforms:p,sortedRects:x,overIndex:S,useDragOverlay:w,strategy:O}=f.useContext(pr),E=zs(r,v),k=g.indexOf(c),$=f.useMemo(()=>({sortable:{containerId:h,index:k,items:g},...o}),[h,o,k,g]),_=f.useMemo(()=>g.slice(g.indexOf(c)),[g,c]),{rect:A,node:L,isOver:H,setNodeRef:Y}=js({id:c,data:$,disabled:E.droppable,resizeObserverConfig:{updateMeasurementsFor:_,...u}}),{active:D,activatorEvent:W,activeNodeRect:G,attributes:I,setNodeRef:j,listeners:C,isDragging:T,over:M,setActivatorNodeRef:P,transform:z}=Ss({id:c,data:$,attributes:{...Ps,...n},disabled:E.draggable}),m=eo(Y,j),R=!!D,N=R&&!p&&at(y)&&at(S),B=!w&&T,q=B&&N?z:null,V=N?q??(l??O)({rects:x,activeNodeRect:G,activeIndex:y,overIndex:S,index:k}):null,K=at(y)&&at(S)?s({id:c,items:g,activeIndex:y,overIndex:S}):k,J=D?.id,F=f.useRef({activeId:J,items:g,newIndex:K,containerId:h}),se=g!==F.current.items,ne=t({active:D,containerId:h,isDragging:T,isSorting:R,id:c,index:k,items:g,newIndex:F.current.newIndex,previousItems:F.current.items,previousContainerId:F.current.containerId,transition:d,wasDragging:F.current.activeId!=null}),he=Ns({disabled:!ne,index:k,node:L,rect:A});return f.useEffect(()=>{R&&F.current.newIndex!==K&&(F.current.newIndex=K),h!==F.current.containerId&&(F.current.containerId=h),g!==F.current.items&&(F.current.items=g)},[R,K,h,g]),f.useEffect(()=>{if(J===F.current.activeId)return;if(J!=null&&F.current.activeId==null){F.current.activeId=J;return}const Te=setTimeout(()=>{F.current.activeId=J},50);return()=>clearTimeout(Te)},[J]),{active:D,activeIndex:y,attributes:I,data:$,rect:A,index:k,newIndex:K,items:g,isOver:H,isSorting:R,isDragging:T,listeners:C,node:L,overIndex:S,over:M,setNodeRef:m,setActivatorNodeRef:P,setDroppableNodeRef:Y,setDraggableNodeRef:j,transform:he??V,transition:be()};function be(){if(he||se&&F.current.newIndex===k)return Ls;if(!(B&&!rn(W)||!d)&&(R||ne))return Ie.Transition.toString({...d,property:mr})}}function zs(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}U.Down,U.Right,U.Up,U.Left;var ut={exports:{}},Pt={},dt={exports:{}},Nt={};var $n;function Fs(){if($n)return Nt;$n=1;var e=f;function t(h,y){return h===y&&(h!==0||1/h===1/y)||h!==h&&y!==y}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,c=e.useDebugValue;function l(h,y){var v=y(),p=r({inst:{value:v,getSnapshot:y}}),x=p[0].inst,S=p[1];return s(function(){x.value=v,x.getSnapshot=y,u(x)&&S({inst:x})},[h,v,y]),o(function(){return u(x)&&S({inst:x}),h(function(){u(x)&&S({inst:x})})},[h]),c(v),v}function u(h){var y=h.getSnapshot;h=h.value;try{var v=y();return!n(h,v)}catch{return!0}}function d(h,y){return y()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:l;return Nt.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,Nt}var zt={};var In;function Ys(){return In||(In=1,process.env.NODE_ENV!=="production"&&(function(){function e(v,p){return v===p&&(v!==0||1/v===1/p)||v!==v&&p!==p}function t(v,p){g||o.startTransition===void 0||(g=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var x=p();if(!h){var S=p();s(x,S)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),h=!0)}S=c({inst:{value:x,getSnapshot:p}});var w=S[0].inst,O=S[1];return u(function(){w.value=x,w.getSnapshot=p,n(w)&&O({inst:w})},[v,x,p]),l(function(){return n(w)&&O({inst:w}),v(function(){n(w)&&O({inst:w})})},[v]),d(x),x}function n(v){var p=v.getSnapshot;v=v.value;try{var x=p();return!s(v,x)}catch{return!0}}function r(v,p){return p()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=f,s=typeof Object.is=="function"?Object.is:e,c=o.useState,l=o.useEffect,u=o.useLayoutEffect,d=o.useDebugValue,g=!1,h=!1,y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;zt.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:y,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),zt}var An;function br(){return An||(An=1,process.env.NODE_ENV==="production"?dt.exports=Fs():dt.exports=Ys()),dt.exports}var Ln;function Bs(){if(Ln)return Pt;Ln=1;var e=f,t=br();function n(d,g){return d===g&&(d!==0||1/d===1/g)||d!==d&&g!==g}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,c=e.useEffect,l=e.useMemo,u=e.useDebugValue;return Pt.useSyncExternalStoreWithSelector=function(d,g,h,y,v){var p=s(null);if(p.current===null){var x={hasValue:!1,value:null};p.current=x}else x=p.current;p=l(function(){function w(_){if(!O){if(O=!0,E=_,_=y(_),v!==void 0&&x.hasValue){var A=x.value;if(v(A,_))return k=A}return k=_}if(A=k,r(E,_))return A;var L=y(_);return v!==void 0&&v(A,L)?(E=_,A):(E=_,k=L)}var O=!1,E,k,$=h===void 0?null:h;return[function(){return w(g())},$===null?void 0:function(){return w($())}]},[g,h,y,v]);var S=o(d,p[0],p[1]);return c(function(){x.hasValue=!0,x.value=S},[S]),u(S),S},Pt}var Ft={};var Pn;function Hs(){return Pn||(Pn=1,process.env.NODE_ENV!=="production"&&(function(){function e(d,g){return d===g&&(d!==0||1/d===1/g)||d!==d&&g!==g}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=f,n=br(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;Ft.useSyncExternalStoreWithSelector=function(d,g,h,y,v){var p=s(null);if(p.current===null){var x={hasValue:!1,value:null};p.current=x}else x=p.current;p=l(function(){function w(_){if(!O){if(O=!0,E=_,_=y(_),v!==void 0&&x.hasValue){var A=x.value;if(v(A,_))return k=A}return k=_}if(A=k,r(E,_))return A;var L=y(_);return v!==void 0&&v(A,L)?(E=_,A):(E=_,k=L)}var O=!1,E,k,$=h===void 0?null:h;return[function(){return w(g())},$===null?void 0:function(){return w($())}]},[g,h,y,v]);var S=o(d,p[0],p[1]);return c(function(){x.hasValue=!0,x.value=S},[S]),u(S),S},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Ft}var Nn;function Vs(){return Nn||(Nn=1,process.env.NODE_ENV==="production"?ut.exports=Bs():ut.exports=Hs()),ut.exports}var Ws=Vs();const Xt=new WeakMap,Us=new WeakMap,wt={current:[]};let Yt=!1;const ft=new Set,zn=new Map;function yr(e){for(const t of e){if(wt.current.includes(t))continue;wt.current.push(t),t.recompute();const n=Us.get(t);if(n)for(const r of n){const o=Xt.get(r);o?.length&&yr(o)}}}function Gs(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function qs(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Xs(e){if(ft.add(e),!Yt)try{for(Yt=!0;ft.size>0;){const t=Array.from(ft);ft.clear();for(const n of t){const r=zn.get(n)??n.prevState;n.prevState=r,Gs(n)}for(const n of t){const r=Xt.get(n);r&&(wt.current.push(n),yr(r))}for(const n of t){const r=Xt.get(n);if(r)for(const o of r)qs(o)}}}finally{Yt=!1,wt.current=[],zn.clear()}}function Ks(e){return typeof e=="function"}class Sr{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var o,s;this.listeners.add(r);const c=(s=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:s.call(o,r,this);return()=>{this.listeners.delete(r),c?.()}},this.prevState=t,this.state=t,this.options=n}setState(t){var n,r,o;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(t):Ks(t)?this.state=t(this.prevState):this.state=t,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),Xs(this)}}function nt(e,t=r=>r,n={}){const r=n.equal??Js;return Ws.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,r)}function Js(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=Fn(e);if(n.length!==Fn(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function Fn(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}const ie=new Sr({tableId:"",sortColumn:null,sortDirection:"asc",visibility:{},columnOrder:[],data:[],sortableColumns:[],actionsConfig:{showActionColumn:!0,showColumnVisibilityMenu:!0,children:"Actions",width:"100px"}});function wr(e,t){const n=e[0]??{},o=(t&&t.length?t:Object.keys(n).map(g=>({id:g,label:g}))).filter(g=>Object.prototype.hasOwnProperty.call(n,g.id)),{tableId:s}=ie.state,c=JSON.parse(localStorage.getItem(jr(s))||"[]"),l=[...c.map(g=>o.find(h=>h.id===g)).filter(Boolean),...o.filter(g=>!c.includes(g.id))],u=JSON.parse(localStorage.getItem(Rr(s))||"{}"),d=l.reduce((g,h)=>(g[h.id]=u[h.id]??!0,g),{});ie.setState(g=>({...g,data:e,columnOrder:l,visibility:d,sortableColumns:l.map(h=>({id:h.id,label:h.label,sortable:!0,backgroundColor:h.backgroundColor}))}))}function Cr(e){ie.setState(t=>({...t,tableId:e,sortColumn:null,sortDirection:"asc",columnOrder:[],visibility:{}}))}const Dr=e=>{ie.setState(t=>({...t,actionsConfig:e}))},jr=e=>`table_column_order_v1:${e}`,Rr=e=>`table_column_visibility_v1:${e}`,Zs=e=>{const{tableId:t}=ie.state;localStorage.setItem(jr(t),JSON.stringify(e.map(n=>n.id))),ie.setState(n=>({...n,columnOrder:e})),ie.setState(n=>({...n,columnOrder:e}))};function Qs(e){ie.setState(t=>t.sortColumn===e?{...t,sortDirection:t.sortDirection==="asc"?"desc":"asc"}:{...t,sortColumn:e,sortDirection:"asc"})}const ei=e=>{ie.setState(t=>{const n={...t.visibility,[e]:!t.visibility[e]};return t.tableId&&localStorage.setItem(Rr(t.tableId),JSON.stringify(n)),{...t,visibility:n}})};const ti=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ni=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Yn=e=>{const t=ni(e);return t.charAt(0).toUpperCase()+t.slice(1)},Er=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),ri=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var oi={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const si=f.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:c,...l},u)=>f.createElement("svg",{ref:u,...oi,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Er("lucide",o),...!s&&!ri(l)&&{"aria-hidden":"true"},...l},[...c.map(([d,g])=>f.createElement(d,g)),...Array.isArray(s)?s:[s]]));const oe=(e,t)=>{const n=f.forwardRef(({className:r,...o},s)=>f.createElement(si,{ref:s,iconNode:t,className:Er(`lucide-${ti(Yn(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Yn(e),n};const ii=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ai=oe("arrow-down",ii);const ci=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],li=oe("arrow-up-down",ci);const ui=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],di=oe("arrow-up",ui);const fi=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],hi=oe("bookmark",fi);const gi=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Bn=oe("calendar",gi);const pi=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],vi=oe("chevron-left",pi);const mi=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],xi=oe("chevron-right",mi);const bi=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],yi=oe("columns-2",bi);const Si=[["path",{d:"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z",key:"1yo7s0"}],["path",{d:"m12 9 6 6",key:"anjzzh"}],["path",{d:"m18 9-6 6",key:"1fp51s"}]],wi=oe("delete",Si);const Ci=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Di=oe("ellipsis",Ci);const ji=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Ri=oe("funnel",ji);const Ei=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Tr=oe("grip-vertical",Ei);const Ti=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],Mi=oe("pen",Ti);const _i=[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]],Oi=oe("refresh-ccw",_i);const ki=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],$i=oe("settings",ki);const Ii=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Mr=oe("triangle-alert",Ii);function b(e){return f.forwardRef((t,n)=>{const{children:r,...o}=t;return i.jsx(e,{ref:n,...o,children:r})})}const Ai=b(a.Menu.Trigger),Li=b(a.Menu.Positioner),Pi=b(a.Menu.Content),Ni=b(a.Menu.Item),zi=b(a.Checkbox.Label),Fi=b(a.Checkbox.HiddenInput),Yi=b(a.Checkbox.Control);function Bi({visibility:e,onToggle:t}){const{sortableColumns:n}=nt(ie);return i.jsxs(a.Menu.Root,{closeOnSelect:!1,children:[i.jsx(Ai,{asChild:!0,children:i.jsx(a.IconButton,{"aria-label":"Toggle columns",variant:"ghost",ml:"1",size:"xs",children:i.jsx(yi,{size:18})})}),i.jsx(a.Portal,{children:i.jsx(Li,{children:i.jsx(Pi,{minW:"220px",children:n.map(r=>{const o=!!e[r.id];return i.jsx(Ni,{value:r.id,closeOnSelect:!1,children:i.jsxs(a.Checkbox.Root,{checked:o,onCheckedChange:()=>t(r.id),children:[i.jsx(Fi,{}),i.jsx(Yi,{}),i.jsx(zi,{children:r.label})]})},r.id)})})})})]})}function Hi({id:e,children:t,onClick:n,cursor:r,borderRight:o,borderRightColor:s,backgroundColor:c}){const{setNodeRef:l,attributes:u,listeners:d,transform:g,transition:h}=xr({id:e});return i.jsx(a.Table.ColumnHeader,{ref:l,onClick:n,backgroundColor:c,w:e==="id"||e==="row_number"?"80px":void 0,style:{transform:Ie.Transform.toString(g),transition:h,cursor:r,borderRight:o,borderRightColor:s},...u,children:i.jsxs(a.HStack,{justify:"space-between",children:[t,i.jsx("span",{...d,children:i.jsx(Tr,{size:12})})]})})}function Vi(){const{columnOrder:e,visibility:t,sortColumn:n,sortDirection:r,sortableColumns:o,actionsConfig:s}=nt(ie),c=e.map(l=>o.find(u=>u.id===l.id)).filter(l=>l!==void 0).filter(l=>t[l.id]);return i.jsx(a.Table.Header,{background:"blue.200",position:"sticky",top:0,p:"0",zIndex:1,children:i.jsxs(a.Table.Row,{height:"28px",children:[s?.showSNo&&i.jsx(a.Table.ColumnHeader,{width:"60px",textAlign:"center",children:"S.No"}),c.map(l=>{const u=n===l?.id;return i.jsx(Hi,{id:l?.id,onClick:()=>l?.sortable&&Qs(l?.id),cursor:l?.sortable?"pointer":"default",borderRight:"2px solid #dcdcdc",backgroundColor:l?.backgroundColor,children:i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,userSelect:"none"},children:[l?.label,l?.sortable&&(u?r==="asc"?i.jsx(di,{size:14}):i.jsx(ai,{size:14}):i.jsx(li,{size:14,opacity:.4}))]})},l?.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(Bi,{visibility:t,onToggle:ei})})]})})}const Wi=[10,20,50,100],Ui=b(a.Select.Positioner),Gi=b(a.Select.Content),qi=b(a.Select.Item),Xi=b(a.Pagination.PrevTrigger),Ki=b(a.Pagination.NextTrigger),Ji=b(a.Select.HiddenSelect),Zi=b(a.Select.Control),Qi=b(a.Select.Trigger),ea=b(a.Select.ValueText),ta=b(a.Select.IndicatorGroup),na=b(a.Select.Indicator);function ra({totalCount:e,pageSize:t,currentPage:n,onPageChange:r,onPageSizeChange:o,siblingCount:s=2,pageSizeOptions:c=Wi}){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(Ji,{}),i.jsxs(Zi,{children:[i.jsx(Qi,{children:i.jsx(ea,{placeholder:""})}),i.jsx(ta,{children:i.jsx(na,{})})]}),i.jsx(a.Portal,{children:i.jsx(Ui,{children:i.jsx(Gi,{children:l.items.map(u=>i.jsxs(qi,{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(Xi,{asChild:!0,children:i.jsx(a.IconButton,{"aria-label":"Previous page",children:i.jsx(vi,{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(Ki,{asChild:!0,children:i.jsx(a.IconButton,{"aria-label":"Next page",children:i.jsx(xi,{size:18})})})]})})]})})}const oa=b(a.Menu.Item),sa=b(a.Menu.Content),ia=b(a.Menu.Positioner),aa=b(a.Menu.Trigger);function ca({data:e=[],actions:t=[],actionConfig:n,onRowSelect:r,startIndex:o=0}){const{columnOrder:s,visibility:c}=nt(ie);return i.jsx(a.Table.Body,{children:e.map((l,u)=>i.jsxs(a.Table.Row,{onClick:()=>r?.(l.__raw),_hover:{bg:"blue.50"},children:[n?.showSNo&&i.jsx(a.Table.Cell,{textAlign:"center",fontWeight:"medium",children:o+u+1}),s.filter(d=>c[d.id]).map(d=>i.jsx(a.Table.Cell,{children:l[d.id]},d.id)),n?.showActionColumn&&i.jsx(a.Table.Cell,{textAlign:"center",display:"flex",gap:2,children:i.jsxs(a.Menu.Root,{children:[i.jsx(aa,{asChild:!0,children:i.jsx(a.IconButton,{"aria-label":"Open",variant:"ghost",size:"sm",children:i.jsx(Di,{size:16})})}),i.jsx(a.Portal,{children:i.jsx(ia,{children:i.jsx(sa,{children:t.filter(d=>typeof d.visible=="function"?d.visible(l.__raw):d.visible!==!1).map(d=>i.jsxs(oa,{onClick:()=>d.onClick(l.__raw),colorScheme:d.colorScheme,value:d.label,children:[d.icon,d.label]},d.label))})})})]})}),n?.showColumnVisibilityMenu&&i.jsx(a.Table.Cell,{})]},l.__key||l.id))})}function la({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 ua({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:g,onPageSizeChange:h,density:y="sm",totalCount:v=0,actionConfig:p,pageSizeOptions:x,onRowSelect:S}){f.useEffect(()=>{Cr(e)},[e]),f.useEffect(()=>{wr(t,n)},[t,n]),f.useEffect(()=>{p&&Dr(p)},[p]);const{sortColumn:w,sortDirection:O,data:E,columnOrder:k}=nt(ie),$=f.useMemo(()=>{const D=[...E];return w&&D.sort((W,G)=>O==="asc"?String(W[w]).localeCompare(String(G[w])):String(G[w]).localeCompare(String(W[w]))),D},[E,w,O,u,d]),_=f.useMemo(()=>(Math.max(1,u||1)-1)*d,[u,d]);f.useEffect(()=>{u<1&&g&&g(1)},[u,g]);const A=D=>{const{active:W,over:G}=D;if(!G||W.id===G.id)return;const I=k.findIndex(T=>T.id===W.id),j=k.findIndex(T=>T.id===G.id),C=Et(k,I,j);Zs(C)},L=r&&!s,H=s&&!r,Y=!r&&!s&&$.length===0;return i.jsx(fr,{collisionDetection:Zn,onDragEnd:A,children:i.jsx(vr,{items:k.map(D=>D.id),strategy:Ms,children:i.jsxs(a.Box,{flex:"1",minH:0,display:"flex",flexDirection:"column",p:2,children:[i.jsxs(a.Box,{flex:"1",minH:0,position:"relative",overflow:"auto",children:[L&&i.jsx(a.Box,{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,bg:"whiteAlpha.600",children:o??i.jsx(a.Spinner,{})}),i.jsxs(a.Table.Root,{variant:"outline",w:"100%",size:y,children:[i.jsx(Vi,{}),H?i.jsx(la,{rows:d,columns:n.length+(l?2:0)}):Y?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(ca,{data:$,actions:l,actionConfig:p,onRowSelect:S,startIndex:_})]})]}),i.jsx(a.Box,{mt:.5,children:i.jsx(ra,{totalCount:v,pageSize:d,currentPage:u,onPageChange:g,onPageSizeChange:D=>{h?.(D),u>1&&g?.(1)},pageSizeOptions:x})})]})})})}const da=b(a.Checkbox.Root),fa=b(a.Checkbox.HiddenInput),ha=b(a.Checkbox.Control),ga=b(a.Checkbox.Label),_r=({value:e,onChange:t,size:n="sm",label:r,helperText:o,isDisabled:s,required:c,errorText:l})=>i.jsxs(da,{value:e,onChange:t,size:n,children:[i.jsx(fa,{}),i.jsx(ha,{disabled:s,required:c,errorText:l,helperText:o}),r&&i.jsx(ga,{children:r})]}),pa=b(a.Combobox.Root),va=b(a.Combobox.Control),ma=b(a.Combobox.Input),xa=b(a.Combobox.IndicatorGroup),ba=b(a.Combobox.ClearTrigger),ya=b(a.Combobox.Trigger),Sa=b(a.Combobox.Positioner),wa=b(a.Combobox.Content);function Or({label:e,size:t="sm",width:n="100%",variant:r="outline",items:o=[],itemToString:s,itemToValue:c,renderItem:l,value:u,loading:d,error:g,errorMessage:h,placeholder:y,helpText:v,onInputChange:p,onSelect:x,visible:S=!0,rootProps:w,inputProps:O,controlProps:E,contentProps:k,itemProps:$}){const[_,A]=f.useState(""),{collection:L,set:H}=a.useListCollection({initialItems:o,itemToString:s,itemToValue:c}),Y=f.useMemo(()=>{if(!_)return o;const D=_.toLowerCase();return o.filter(W=>s(W).toLowerCase().includes(D))},[o,_,s]);return f.useEffect(()=>{H(Y)},[Y,H]),f.useEffect(()=>{u&&A(s(u))},[u,s]),i.jsxs(pa,{width:n,size:t,variant:r,collection:L,placeholder:y,onInputValueChange:D=>{p?.(D.inputValue),A(D.inputValue)},value:u?[c(u)]:[],onValueChange:D=>{const W=D.value?.[0];if(!W)return;const G=L.items.find(I=>c(I)===W);G&&x?.(G)},positioning:{sameWidth:!1,placement:"bottom-start"},...w,children:[S&&e&&i.jsx(a.Text,{fontSize:"sm",children:e}),i.jsxs(va,{...E,children:[i.jsx(ma,{placeholder:y??"Type to search",...O}),i.jsxs(xa,{children:[i.jsx(ba,{}),i.jsx(ya,{})]})]}),i.jsx(Sa,{children:i.jsxs(wa,{minW:"sm",...k,children:[d?i.jsxs(a.HStack,{p:"2",children:[i.jsx(a.Spinner,{size:"xs",borderWidth:"1px"}),i.jsx(a.Span,{children:"Loading..."})]}):g?i.jsx(a.Text,{p:"2",color:"red.500",fontSize:"sm",children:h||"Something went wrong"}):L.items.map(D=>i.jsxs(a.Combobox.Item,{item:D,...$,children:[l(D),i.jsx(a.Combobox.ItemIndicator,{})]},c(D))),v&&!g&&!d&&i.jsx(a.Text,{p:"2",color:"fg.muted",fontSize:"sm",children:v})]})})]})}const Z=" to ",Hn=10,Ee={DAY_MAX:31,MONTH_MAX:12,YEAR_MIN:1900,YEAR_MAX:2100},ln=()=>{const e=new Date;return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}},Vn=()=>{const{year:e,month:t,day:n}=ln();return`${String(n).padStart(2,"0")}-${String(t).padStart(2,"0")}-${e}`},Ca=()=>{const{year:e,month:t,day:n}=ln();return`${e}-${String(t).padStart(2,"0")}-${String(n).padStart(2,"0")}`},Da=(e,t)=>{const n=e.length,r=parseInt(e);if(!e||isNaN(r))return t;if(n===4)return r>=Ee.YEAR_MIN&&r<=Ee.YEAR_MAX?r:t;if(n>0&&n<4){const o=t.toString(),s=4-n,c=o.substring(0,s);return parseInt(c+e)}return t},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}=ln();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=Da(n[2],r)),l=Math.max(1,Math.min(Ee.MONTH_MAX,l)),c=Math.max(1,Math.min(Ee.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}`},ja=(e,t)=>{if(e[0]?.length>0){const n=parseInt(e[0]);if(isNaN(n)||n===0||e[0].length===2&&n>Ee.DAY_MAX)return t}if(e[1]?.length>0){const n=parseInt(e[1]);if(isNaN(n)||n===0||e[1].length===2&&n>Ee.MONTH_MAX)return t}if(e[2]?.length>0){const n=parseInt(e[2]),r=e[2].length===4;if(isNaN(n)||n===0||r&&(n<Ee.YEAR_MIN||n>Ee.YEAR_MAX))return t}return null},We=e=>{let t=e.replace(/[^\d-]/g,"").substring(0,Hn);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,Hn),ja(n,e)||t},Ra=b(a.Popover.Root),Ea=b(a.Popover.Trigger),Ta=b(a.Popover.Content),Ma=b(a.Popover.Positioner);function _a({value:e,onChange:t,disabled:n=!1}){const[r="",o=""]=e?e.split("|"):[],[s,c]=f.useState(()=>r&&o?`${ge(r)}${Z}${ge(o)}`:r?ge(r):""),[l,u]=f.useState(!1),d=f.useRef(null);f.useEffect(()=>{const p=x=>{x.ctrlKey&&x.key==="d"&&!x.shiftKey&&!x.metaKey&&(x.preventDefault(),d.current?.focus())};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[]);const g=p=>{let x=p;if(x.includes(Z)){const[S,w=""]=x.split(Z);x=`${We(S.trim())}${Z}${We(w.trim())}`}else if(x.toLowerCase().includes(" to ")){const[S,w=""]=x.split(/\s+to\s+/i);x=`${We(S.trim())} to ${We(w.trim())}`}else x=We(x);c(x)},h=()=>{const p=s.trim();if(!p){t(void 0);return}if(p.includes(Z)){const[x,S=""]=p.split(Z).map(E=>E.trim()),w=Ve(x),O=S?Ve(S):null;if(w&&O){const[E,k]=O<w?[O,w]:[w,O],$=`${ge(E)}${Z}${ge(k)}`;c($),t(`${E}|${k}`)}else if(w&&!S)c(`${ge(w)}${Z}`),t(void 0);else if(w&&S){const E=Ca(),[k,$]=E<w?[E,w]:[w,E],_=`${ge(k)}${Z}${ge($)}`;c(_),t(`${k}|${$}`)}else c(""),t(void 0)}else{const x=Ve(p);x?(c(`${ge(x)}${Z}`),t(void 0)):(c(""),t(void 0))}},y=p=>{if(p.key!=="Enter")return;p.preventDefault();const x=d.current?.selectionStart||0,S=s.indexOf(Z);if(!s.trim()){c(`${Vn()}${Z}`);return}if(S===-1){const O=Ve(s.trim());O&&c(`${ge(O)}${Z}`);return}if(x<=S+Z.length){const O=s.substring(0,S).trim(),E=s.substring(S+Z.length),k=Ve(O);k&&c(`${ge(k)}${Z}${E}`);return}if(s.substring(S+Z.length).trim())h(),d.current?.blur();else{const O=s.substring(0,S+Z.length)+Vn();c(O),setTimeout(()=>{h(),d.current?.blur()},0)}},v=()=>{c(""),t(void 0)};return i.jsx(a.InputGroup,{children:i.jsx(i.Fragment,{children:i.jsxs(a.InputElement,{position:"revert",children:[i.jsxs(Ra,{open:l,onEscapeKeyDown:()=>{u(!1)},children:[i.jsx(Ea,{asChild:!0,children:i.jsx(a.IconButton,{size:"sm",variant:"ghost","aria-label":"Date range help",onClick:()=>u(p=>!p),children:i.jsx(Bn,{size:16})})}),i.jsx(a.Portal,{children:i.jsx(Ma,{children:i.jsxs(Ta,{p:4,children:[i.jsx(a.PopoverArrow,{}),i.jsxs(a.VStack,{align:"start",gap:4,children:[i.jsxs(a.HStack,{children:[i.jsx(Bn,{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",Z,"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:p=>g(p.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:v,w:"100%"})})]})})})}const Oa=b(a.Field.Root),ka=b(a.Field.Label),$a=b(a.Field.HelperText),Ia=b(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:g=!1,errorText:h,visible:y,type:v="text",min:p=0,max:x=100,step:S=1})=>i.jsxs(Oa,{width:c,children:[y&&i.jsx(ka,{children:l}),i.jsx(a.InputGroup,{startElement:e,children:i.jsx(a.Input,{value:t,onChange:w=>n?.(w.target.value),placeholder:r,size:o,type:v,variant:s,disabled:d,required:g,min:p,max:x,step:S})}),h&&i.jsx(Ia,{fontSize:"xs",children:h}),u&&i.jsx($a,{fontSize:"xs",children:u})]}),Aa=b(a.Field.Root),La=b(a.Field.HelperText),Pa=b(a.Field.ErrorText),Na=b(a.Select.Root),za=b(a.Select.Label),Fa=b(a.Select.Control),Ya=b(a.Select.Trigger),Ba=b(a.Select.ValueText),Ha=b(a.Select.IndicatorGroup),Va=b(a.Select.Indicator),Wa=b(a.Select.Content),Ua=b(a.Select.Item),Ga=b(a.Select.ItemIndicator),qa=b(a.Select.HiddenSelect),Xa=b(a.Select.Positioner),kr=({options:e=[],label:t,value:n,onChange:r,placeholder:o,size:s="xs",width:c="100%",variant:l="outline",helperText:u,isDisabled:d,required:g,errorText:h,visible:y})=>{const v=a.createListCollection({items:e});return i.jsxs(Aa,{disabled:d,required:g,children:[i.jsxs(Na,{collection:v,variant:l,size:s,width:c,value:n?[n]:[],onValueChange:p=>r?.(p.value[0]),children:[i.jsx(qa,{}),y&&i.jsx(za,{children:t}),i.jsxs(Fa,{children:[i.jsx(Ya,{children:i.jsx(Ba,{placeholder:o})}),i.jsx(Ha,{children:i.jsx(Va,{})})]}),i.jsx(Xa,{children:i.jsx(Wa,{children:v.items.map(p=>i.jsxs(Ua,{item:p,children:[p.label,i.jsx(Ga,{})]},p.value))})})]}),u&&i.jsx(La,{children:u}),h&&i.jsx(Pa,{children:h})]})},$r=(e="default")=>`FILTER_PRESETS_${e}`,Ka=e=>{if(!e)return[];try{return JSON.parse(e)}catch{return[]}},Ja=e=>typeof window>"u"?[]:Ka(localStorage.getItem($r(e))),Ze=new Sr({}),rt=e=>{const t=Ze.state;if(e in t)return t[e];const n=Ja(e);return Ze.setState(r=>({...r,[e]:n})),n},Tt=(e,t)=>{Ze.setState(n=>({...n,[e]:t})),typeof window<"u"&&localStorage.setItem($r(e),JSON.stringify(t))},Ir=(e,t)=>{const n=[t,...rt(e)];Tt(e,n)},Ar=(e,t)=>{const n=rt(e).filter(r=>r.id!==t);Tt(e,n)},Za=(e,t,n)=>{const r=rt(e).map(o=>o.id===t?n(o):o);Tt(e,r)},Qa=b(a.Checkbox.Root),ec=b(a.Checkbox.HiddenInput),tc=b(a.Checkbox.Control),nc=b(a.Slider.Root),rc=b(a.Slider.Track),oc=b(a.Slider.Range),sc=b(a.Slider.Thumbs),ic=b(a.Slider.Control),ac=({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(Tr,{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(Qa,{checked:e.visible,size:"sm",onCheckedChange:d=>t?.(e.id,!!d.checked),children:[i.jsx(ec,{}),i.jsx(tc,{})]})]}),i.jsxs(a.VStack,{align:"stretch",gap:1,children:[i.jsx(a.Text,{fontSize:"sm",children:"Size"}),i.jsx(nc,{min:1,max:5,step:.5,value:[e.size??1],onValueChange:d=>n?.(e.id,d.value[0]),children:i.jsxs(ic,{children:[i.jsx(rc,{children:i.jsx(oc,{})}),i.jsx(sc,{})]})})]})]})},cc=b(a.Drawer.Root),lc=b(a.Drawer.Trigger),uc=b(a.Drawer.Backdrop),dc=b(a.Drawer.Positioner),fc=b(a.Drawer.Content),hc=b(a.Drawer.Header),gc=b(a.Drawer.Title),pc=b(a.Drawer.Body),vc=b(a.Drawer.Footer),mc=b(a.Drawer.CloseTrigger),xc=b(a.Tabs.Root),bc=b(a.Tabs.List),Bt=b(a.Tabs.Trigger),Ht=b(a.Tabs.Content),Lr=(e,t)=>{if(e.customComponent)return e.customComponent;switch(e.type){case"text":return i.jsx(Kt,{placeholder:e.label,value:e.value,onChange:e.onChange,label:e.label,visible:t});case"number":return i.jsx(Kt,{label:e.label,value:e.value,onChange:e.onChange});case"checkbox":return i.jsx(_r,{label:e.label,value:e.value,onChange:e.onChange});case"select":return i.jsx(kr,{label:e.label,value:e.value,onChange:e.onChange,options:e.options??[],visible:t,placeholder:e.placeholder});case"date":return i.jsx(_a,{value:e.value,onChange:e.onChange});case"combobox":return i.jsx(Or,{visible:!0,label:e.label,items:e.options,itemToString:n=>n.label,itemToValue:n=>n.value,renderItem:n=>i.jsx("span",{children:n.label})});default:return null}},yc=({filterDrawerSize:e="sm",onVisibilityChange:t,onSizeChange:n,onClear:r,filters:o,pageKey:s="default",onLoadPreset:c,activePresetName:l,onReorder:u,open:d,onOpenChange:g})=>{const y=nt(Ze)[s]??rt(s),v=()=>{const p=prompt("Preset name?");if(!p)return;const x=o.reduce((S,w)=>(S[w.id]=w.value,S),{});Ir(s,{id:crypto.randomUUID(),name:p,date:new Date().toISOString(),values:x})};return i.jsx(a.HStack,{wrap:"wrap",children:i.jsxs(cc,{size:e,open:d,onOpenChange:g,children:[i.jsx(lc,{asChild:!0,children:i.jsxs(a.IconButton,{"aria-label":"Open filters",variant:"outline",size:"xs",ml:2,p:2,children:[i.jsx(Ri,{size:16}),"Filters"]})}),i.jsxs(a.Portal,{children:[i.jsx(uc,{}),i.jsx(dc,{children:i.jsxs(fc,{children:[i.jsx(hc,{children:i.jsx(gc,{children:"Filters"})}),i.jsx(pc,{overflowY:"auto",pt:1,children:i.jsxs(xc,{defaultValue:"view",children:[i.jsxs(bc,{mb:4,children:[i.jsxs(Bt,{value:"view",children:[i.jsx(Mi,{size:16}),"Edit"]}),i.jsxs(Bt,{value:"settings",children:[i.jsx($i,{size:16}),"Settings"]}),i.jsxs(Bt,{value:"presets",children:[i.jsx(hi,{size:16}),"Presets"]})]}),i.jsx(Ht,{value:"view",children:o.filter(p=>p.visible).map(p=>i.jsx(a.VStack,{align:"stretch",border:"1px solid",borderColor:"gray.200",flex:p.size??1,minW:`${(p.size??1)*100}px`,rounded:"md",p:3,mb:3,children:Lr(p,d)},p.id))}),i.jsx(Ht,{value:"settings",children:i.jsx(fr,{sensors:vo(po(cn)),collisionDetection:Zn,onDragEnd:({active:p,over:x})=>{if(!x||p.id===x.id)return;const S=o.findIndex(E=>E.id===p.id),w=o.findIndex(E=>E.id===x.id),O=Et(o,S,w);u?.(O)},children:i.jsx(vr,{items:o.map(p=>p.id),strategy:Os,children:o.map(p=>i.jsx(ac,{filter:p,onVisibilityChange:t,onSizeChange:n},p.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(p=>i.jsxs(a.HStack,{justify:"space-between",border:"1px solid",borderColor:l===p.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:p.name}),i.jsx(a.Text,{fontSize:"xs",color:"gray.500",children:new Date(p.date).toLocaleDateString()})]}),i.jsxs(a.HStack,{children:[i.jsx(a.Button,{size:"xs",variant:"ghost",onClick:()=>{const x=o.map(S=>({...S,value:p.values[S.id]??S.value}));c?.(x,p.name)},children:"Load"}),i.jsx(a.IconButton,{size:"xs","aria-label":"Delete preset",variant:"ghost",onClick:()=>Ar(s,p.id),children:i.jsx(wi,{size:14})})]})]},p.id)),i.jsx(a.Button,{size:"sm",colorScheme:"blue",onClick:v,children:"Save Current Filters"})]})})]})}),i.jsx(vc,{justify:"space-between",children:i.jsx(mc,{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:g="sm"})=>{const[h,y]=f.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(v=>v.visible!==!1).map(v=>i.jsx(a.HStack,{flex:v.size??1,minW:`${(v.size??1)*100}px`,alignItems:"center",children:Lr(v)},v.id)),i.jsx(yc,{filterDrawerSize:g,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:c,pageKey:l,filters:t,onLoadPreset:u,activePresetName:d,open:h,onOpenChange:v=>{y(v.open)}})]})]})},wc=(e,t)=>{localStorage.setItem(`FILTER_ORDER_${e}`,JSON.stringify(t))},Cc=e=>{try{return JSON.parse(localStorage.getItem(`FILTER_ORDER_${e}`)||"[]")}catch{return[]}},Dc=({onClick:e,size:t="xs",variant:n="solid",label:r,leftIcon:o,rightIcon:s,isDisabled:c,colorScheme:l,loading:u,loadingText:d,rounded:g,type:h="button"})=>i.jsx(a.Button,{onClick:e,size:t,variant:n,disabled:c,colorPalette:l,loading:u,loadingText:d,rounded:g,type:h,children:i.jsxs(a.HStack,{gap:1,children:[o,r,s]})}),jc=b(a.Dialog.Root),Rc=b(a.Dialog.Backdrop),Ec=b(a.Dialog.Positioner),Tc=b(a.Dialog.Content),Mc=b(a.Dialog.Header),_c=b(a.Dialog.Body),Oc=b(a.Dialog.Footer),kc=b(a.Dialog.Title),$c=b(a.Dialog.CloseTrigger);function Ic({open:e,onClose:t,onConfirm:n,title:r="Confirm Action",description:o="Are you sure you want to continue?",confirmLabel:s="Confirm",cancelLabel:c="Cancel",icon:l,isLoading:u=!1,confirmButtonColorScheme:d="#4169e1"}){return i.jsx(jc,{open:e,placement:"center",onOpenChange:g=>!g.open&&t(),children:i.jsxs(a.Portal,{children:[i.jsx(Rc,{}),i.jsx(Ec,{children:i.jsxs(Tc,{maxW:"480px",children:[i.jsx(Mc,{borderBottom:"1px solid",borderColor:"gray.200",children:i.jsx(kc,{children:r})}),i.jsx(_c,{p:6,children:i.jsxs(a.Stack,{gap:4,align:"center",textAlign:"center",children:[i.jsx(a.Box,{color:"orange.500",children:l??i.jsx(Mr,{size:40})}),i.jsx(a.Text,{fontSize:"sm",color:"gray.600",children:o})]})}),i.jsxs(Oc,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"gray.200",children:[i.jsx(a.Button,{variant:"outline",size:"sm",onClick:t,children:c}),i.jsx(a.Button,{size:"sm",style:{backgroundColor:d},loading:u,onClick:n,children:s})]}),i.jsx($c,{asChild:!0,children:i.jsx(a.CloseButton,{size:"sm"})})]})})]})})}const Ac=b(a.Dialog.Root),Lc=b(a.Dialog.Backdrop),Pc=b(a.Dialog.Positioner),Nc=b(a.Dialog.Content),zc=b(a.Dialog.Header),Fc=b(a.Dialog.Body),Yc=b(a.Dialog.Footer),Bc=b(a.Dialog.Title),Hc=b(a.Dialog.CloseTrigger);function Vc({open:e,onClose:t,onConfirm:n,title:r="Delete Company",entityName:o,confirmText:s="DELETE",confirmLabel:c="Delete",isLoading:l=!1}){const[u,d]=f.useState(""),g=u===s;return i.jsx(Ac,{open:e,placement:"center",onOpenChange:h=>{!h.open&&t(),d("")},children:i.jsxs(a.Portal,{children:[i.jsx(Lc,{}),i.jsx(Pc,{children:i.jsxs(Nc,{maxW:"550px",children:[i.jsx(zc,{borderBottom:"1px solid",borderColor:"#d3d3d3",children:i.jsx(Bc,{color:"red.600",children:r})}),i.jsx(Fc,{p:2,style:{padding:"16px"},children:i.jsxs(a.Stack,{gap:4,borderRadius:"md",p:4,bg:"white",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(Mr,{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:2,children:["Type ",i.jsx("b",{children:s})," to continue"]}),i.jsx(a.Input,{placeholder:`Type ${s} here`,value:u,onChange:h=>d(h.target.value),size:"xs"})]})]})}),i.jsxs(Yc,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"#d3d3d3",children:[i.jsx(a.Button,{variant:"outline",size:"sm",onClick:()=>{t(),d("")},children:"Cancel"}),i.jsx(a.Button,{size:"sm",disabled:!g,style:{backgroundColor:"#FF0000"},loading:l,onClick:n,children:c})]}),i.jsx(Hc,{asChild:!0,children:i.jsx(a.CloseButton,{size:"sm"})})]})})]})})}const Pr=({children:e})=>i.jsx(i.Fragment,{children:e}),Nr=({children:e})=>i.jsx(i.Fragment,{children:e}),Wc=a.Button,Uc=b(a.Dialog.Root),Gc=b(a.Dialog.Backdrop),qc=b(a.Dialog.Positioner),Xc=b(a.Dialog.Content),Kc=b(a.Dialog.Header),Jc=b(a.Dialog.Body),Zc=b(a.Dialog.Footer),Qc=b(a.Dialog.Title),el=b(a.Dialog.CloseTrigger);function tl(e){let t=null,n=null;return f.Children.forEach(e,r=>{f.isValidElement(r)&&(r.type===Pr&&(t=r.props.children),r.type===Nr&&(n=r.props.children))}),{body:t,actions:n}}const nl=({open:e,onClose:t,title:n,children:r})=>{const{body:o,actions:s}=tl(r);return i.jsx(Uc,{open:e,onOpenChange:c=>!c.open&&t(),children:i.jsxs(a.Portal,{children:[i.jsx(Gc,{bg:"blackAlpha.400"}),i.jsx(qc,{children:i.jsxs(Xc,{w:"100%",maxW:"520px",borderRadius:"6px",overflow:"hidden",boxShadow:"lg",children:[i.jsx(Kc,{px:"20px",py:"16px",bg:"white",borderBottom:"1px solid",borderColor:"gray.200",children:i.jsxs(a.Flex,{align:"center",justify:"space-between",children:[i.jsx(Qc,{fontSize:"16px",fontWeight:"600",children:n}),i.jsx(el,{asChild:!0,children:i.jsx(a.CloseButton,{size:"sm"})})]})}),o&&i.jsx(Jc,{px:"20px",py:"16px",bg:"#F8FAFC",children:i.jsx(a.Flex,{direction:"column",gap:"16px",children:o})}),s&&i.jsx(Zc,{px:"20px",py:"16px",bg:"white",borderTop:"1px solid",borderColor:"gray.200",children:i.jsx(a.Flex,{ml:"auto",gap:"12px",children:s})})]})})]})})},rl=b(a.Field.Root),ol=b(a.Field.Label),sl=b(a.Field.HelperText),il=b(a.Field.ErrorText),al=b(a.PinInput.Input),cl=b(a.PinInput.Control),ll=b(a.PinInput.HiddenInput),ul=b(a.PinInput.Root),dl=({value:e,onChange:t,length:n=4,size:r="xs",isDisabled:o=!1,label:s,helperText:c,errorText:l,required:u=!1,visible:d=!0})=>{const g=Array.from({length:n}).map((h,y)=>e?.[y]??"");return i.jsxs(rl,{children:[d&&s&&i.jsxs(ol,{children:[s,u&&" *"]}),i.jsxs(ul,{value:g,onValueChange:h=>t?.(h.value.join("")),disabled:o,size:r,children:[i.jsx(ll,{}),i.jsx(cl,{children:i.jsx(a.HStack,{children:Array.from({length:n}).map((h,y)=>i.jsx(al,{index:y},y))})})]}),l&&i.jsx(il,{fontSize:"xs",children:l}),c&&!l&&i.jsx(sl,{fontSize:"xs",children:c})]})};function zr({refetch:e,isLoading:t=!1,label:n="Refresh"}){const[r,o]=f.useState(!1),s=async()=>{o(!0);try{await e()}finally{setTimeout(()=>o(!1),300)}};return i.jsx(a.IconButton,{"aria-label":n,size:"xs",variant:"outline",disabled:t||r,onClick:s,ml:2,children:i.jsx(Oi,{size:14,style:{animation:r?"spin 0.6s linear infinite":void 0}})})}var gt={exports:{}},fl=gt.exports,Wn;function hl(){return Wn||(Wn=1,(function(e,t){(function(n,r){e.exports=r()})(fl,(function(){var n=1e3,r=6e4,o=36e5,s="millisecond",c="second",l="minute",u="hour",d="day",g="week",h="month",y="quarter",v="year",p="date",x="Invalid Date",S=/^(\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,O={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 j=["th","st","nd","rd"],C=I%100;return"["+I+(j[(C-20)%10]||j[C]||j[0])+"]"}},E=function(I,j,C){var T=String(I);return!T||T.length>=j?I:""+Array(j+1-T.length).join(C)+I},k={s:E,z:function(I){var j=-I.utcOffset(),C=Math.abs(j),T=Math.floor(C/60),M=C%60;return(j<=0?"+":"-")+E(T,2,"0")+":"+E(M,2,"0")},m:function I(j,C){if(j.date()<C.date())return-I(C,j);var T=12*(C.year()-j.year())+(C.month()-j.month()),M=j.clone().add(T,h),P=C-M<0,z=j.clone().add(T+(P?-1:1),h);return+(-(T+(C-M)/(P?M-z:z-M))||0)},a:function(I){return I<0?Math.ceil(I)||0:Math.floor(I)},p:function(I){return{M:h,y:v,w:g,d,D:p,h:u,m:l,s:c,ms:s,Q:y}[I]||String(I||"").toLowerCase().replace(/s$/,"")},u:function(I){return I===void 0}},$="en",_={};_[$]=O;var A="$isDayjsObject",L=function(I){return I instanceof W||!(!I||!I[A])},H=function I(j,C,T){var M;if(!j)return $;if(typeof j=="string"){var P=j.toLowerCase();_[P]&&(M=P),C&&(_[P]=C,M=P);var z=j.split("-");if(!M&&z.length>1)return I(z[0])}else{var m=j.name;_[m]=j,M=m}return!T&&M&&($=M),M||!T&&$},Y=function(I,j){if(L(I))return I.clone();var C=typeof j=="object"?j:{};return C.date=I,C.args=arguments,new W(C)},D=k;D.l=H,D.i=L,D.w=function(I,j){return Y(I,{locale:j.$L,utc:j.$u,x:j.$x,$offset:j.$offset})};var W=(function(){function I(C){this.$L=H(C.locale,null,!0),this.parse(C),this.$x=this.$x||C.x||{},this[A]=!0}var j=I.prototype;return j.parse=function(C){this.$d=(function(T){var M=T.date,P=T.utc;if(M===null)return new Date(NaN);if(D.u(M))return new Date;if(M instanceof Date)return new Date(M);if(typeof M=="string"&&!/Z$/i.test(M)){var z=M.match(S);if(z){var m=z[2]-1||0,R=(z[7]||"0").substring(0,3);return P?new Date(Date.UTC(z[1],m,z[3]||1,z[4]||0,z[5]||0,z[6]||0,R)):new Date(z[1],m,z[3]||1,z[4]||0,z[5]||0,z[6]||0,R)}}return new Date(M)})(C),this.init()},j.init=function(){var C=this.$d;this.$y=C.getFullYear(),this.$M=C.getMonth(),this.$D=C.getDate(),this.$W=C.getDay(),this.$H=C.getHours(),this.$m=C.getMinutes(),this.$s=C.getSeconds(),this.$ms=C.getMilliseconds()},j.$utils=function(){return D},j.isValid=function(){return this.$d.toString()!==x},j.isSame=function(C,T){var M=Y(C);return this.startOf(T)<=M&&M<=this.endOf(T)},j.isAfter=function(C,T){return Y(C)<this.startOf(T)},j.isBefore=function(C,T){return this.endOf(T)<Y(C)},j.$g=function(C,T,M){return D.u(C)?this[T]:this.set(M,C)},j.unix=function(){return Math.floor(this.valueOf()/1e3)},j.valueOf=function(){return this.$d.getTime()},j.startOf=function(C,T){var M=this,P=!!D.u(T)||T,z=D.p(C),m=function(J,F){var se=D.w(M.$u?Date.UTC(M.$y,F,J):new Date(M.$y,F,J),M);return P?se:se.endOf(d)},R=function(J,F){return D.w(M.toDate()[J].apply(M.toDate("s"),(P?[0,0,0,0]:[23,59,59,999]).slice(F)),M)},N=this.$W,B=this.$M,q=this.$D,X="set"+(this.$u?"UTC":"");switch(z){case v:return P?m(1,0):m(31,11);case h:return P?m(1,B):m(0,B+1);case g:var V=this.$locale().weekStart||0,K=(N<V?N+7:N)-V;return m(P?q-K:q+(6-K),B);case d:case p:return R(X+"Hours",0);case u:return R(X+"Minutes",1);case l:return R(X+"Seconds",2);case c:return R(X+"Milliseconds",3);default:return this.clone()}},j.endOf=function(C){return this.startOf(C,!1)},j.$set=function(C,T){var M,P=D.p(C),z="set"+(this.$u?"UTC":""),m=(M={},M[d]=z+"Date",M[p]=z+"Date",M[h]=z+"Month",M[v]=z+"FullYear",M[u]=z+"Hours",M[l]=z+"Minutes",M[c]=z+"Seconds",M[s]=z+"Milliseconds",M)[P],R=P===d?this.$D+(T-this.$W):T;if(P===h||P===v){var N=this.clone().set(p,1);N.$d[m](R),N.init(),this.$d=N.set(p,Math.min(this.$D,N.daysInMonth())).$d}else m&&this.$d[m](R);return this.init(),this},j.set=function(C,T){return this.clone().$set(C,T)},j.get=function(C){return this[D.p(C)]()},j.add=function(C,T){var M,P=this;C=Number(C);var z=D.p(T),m=function(B){var q=Y(P);return D.w(q.date(q.date()+Math.round(B*C)),P)};if(z===h)return this.set(h,this.$M+C);if(z===v)return this.set(v,this.$y+C);if(z===d)return m(1);if(z===g)return m(7);var R=(M={},M[l]=r,M[u]=o,M[c]=n,M)[z]||1,N=this.$d.getTime()+C*R;return D.w(N,this)},j.subtract=function(C,T){return this.add(-1*C,T)},j.format=function(C){var T=this,M=this.$locale();if(!this.isValid())return M.invalidDate||x;var P=C||"YYYY-MM-DDTHH:mm:ssZ",z=D.z(this),m=this.$H,R=this.$m,N=this.$M,B=M.weekdays,q=M.months,X=M.meridiem,V=function(F,se,ne,he){return F&&(F[se]||F(T,P))||ne[se].slice(0,he)},K=function(F){return D.s(m%12||12,F,"0")},J=X||function(F,se,ne){var he=F<12?"AM":"PM";return ne?he.toLowerCase():he};return P.replace(w,(function(F,se){return se||(function(ne){switch(ne){case"YY":return String(T.$y).slice(-2);case"YYYY":return D.s(T.$y,4,"0");case"M":return N+1;case"MM":return D.s(N+1,2,"0");case"MMM":return V(M.monthsShort,N,q,3);case"MMMM":return V(q,N);case"D":return T.$D;case"DD":return D.s(T.$D,2,"0");case"d":return String(T.$W);case"dd":return V(M.weekdaysMin,T.$W,B,2);case"ddd":return V(M.weekdaysShort,T.$W,B,3);case"dddd":return B[T.$W];case"H":return String(m);case"HH":return D.s(m,2,"0");case"h":return K(1);case"hh":return K(2);case"a":return J(m,R,!0);case"A":return J(m,R,!1);case"m":return String(R);case"mm":return D.s(R,2,"0");case"s":return String(T.$s);case"ss":return D.s(T.$s,2,"0");case"SSS":return D.s(T.$ms,3,"0");case"Z":return z}return null})(F)||z.replace(":","")}))},j.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},j.diff=function(C,T,M){var P,z=this,m=D.p(T),R=Y(C),N=(R.utcOffset()-this.utcOffset())*r,B=this-R,q=function(){return D.m(z,R)};switch(m){case v:P=q()/12;break;case h:P=q();break;case y:P=q()/3;break;case g:P=(B-N)/6048e5;break;case d:P=(B-N)/864e5;break;case u:P=B/o;break;case l:P=B/r;break;case c:P=B/n;break;default:P=B}return M?P:D.a(P)},j.daysInMonth=function(){return this.endOf(h).$D},j.$locale=function(){return _[this.$L]},j.locale=function(C,T){if(!C)return this.$L;var M=this.clone(),P=H(C,T,!0);return P&&(M.$L=P),M},j.clone=function(){return D.w(this.$d,this)},j.toDate=function(){return new Date(this.valueOf())},j.toJSON=function(){return this.isValid()?this.toISOString():null},j.toISOString=function(){return this.$d.toISOString()},j.toString=function(){return this.$d.toUTCString()},I})(),G=W.prototype;return Y.prototype=G,[["$ms",s],["$s",c],["$m",l],["$H",u],["$W",d],["$M",h],["$y",v],["$D",p]].forEach((function(I){G[I[1]]=function(j){return this.$g(j,I[0],I[1])}})),Y.extend=function(I,j){return I.$i||(I(j,W,Y),I.$i=!0),Y},Y.locale=H,Y.isDayjs=L,Y.unix=function(I){return Y(1e3*I)},Y.en=_[$],Y.Ls=_,Y.p={},Y}))})(gt)),gt.exports}var gl=hl();const Mt=Ct(gl);var pt={exports:{}},pl=pt.exports,Un;function vl(){return Un||(Un=1,(function(e,t){(function(n,r){e.exports=r()})(pl,(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,g,h,y){return s.fromToBase(d,g,h,y)}o.en.relativeTime=c,s.fromToBase=function(d,g,h,y,v){for(var p,x,S,w=h.$locale().relativeTime||c,O=n.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],E=O.length,k=0;k<E;k+=1){var $=O[k];$.d&&(p=y?o(d).diff(h,$.d,!0):h.diff(d,$.d,!0));var _=(n.rounding||Math.round)(Math.abs(p));if(S=p>0,_<=$.r||!$.r){_<=1&&k>0&&($=O[k-1]);var A=w[$.l];v&&(_=v(""+_)),x=typeof A=="string"?A.replace("%d",_):A(_,g,$.l,S);break}}if(g)return x;var L=S?w.future:w.past;return typeof L=="function"?L(x):L.replace("%s",x)},s.to=function(d,g){return l(d,g,this,!0)},s.from=function(d,g){return l(d,g,this)};var u=function(d){return d.$u?o.utc():o()};s.toNow=function(d){return this.to(u(this),d)},s.fromNow=function(d){return this.from(u(this),d)}}}))})(pt)),pt.exports}var ml=vl();const xl=Ct(ml);var vt={exports:{}},bl=vt.exports,Gn;function yl(){return Gn||(Gn=1,(function(e,t){(function(n,r){e.exports=r()})(bl,(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,g=(function(h,y){return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(v,p,x){var S=x&&x.toUpperCase();return p||y[x]||n[x]||y[S].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(w,O,E){return O||E.slice(1)}))}))})(u,d===void 0?{}:d);return l.call(this,g)}}}))})(vt)),vt.exports}var Sl=yl();const wl=Ct(Sl);var mt={exports:{}},Cl=mt.exports,qn;function Dl(){return qn||(qn=1,(function(e,t){(function(n,r){e.exports=r()})(Cl,(function(){return function(n,r){var o=r.prototype,s=o.format;o.format=function(c){var l=this,u=this.$locale();if(!this.isValid())return s.bind(this)(c);var d=this.$utils(),g=(c||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(h){switch(h){case"Q":return Math.ceil((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)(g)}}}))})(mt)),mt.exports}var jl=Dl();const Rl=Ct(jl);Mt.extend(xl);Mt.extend(wl);Mt.extend(Rl);const El={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??El[t]):r}function Tl({value:e,dateVariant:t="date",timeVariant:n="time",dateFormat:r,timeFormat:o,align:s="start",dateColor:c="gray.700",dateFontSize:l="16px",dateFontWeight:u="500",timeColor:d="gray.500",timeFontSize:g="12px",timeFontWeight:h="400"}){return i.jsxs(a.Stack,{gap:.5,align:s,children:[i.jsx(a.Text,{fontSize:l,fontWeight:u,color:c,children:Jt({value:e,variant:t,format:r})}),i.jsx(a.Text,{fontSize:g,fontWeight:h,color:d,children:Jt({value:e,variant:n,format:o})})]})}class Fr{state=new Map;listeners=new Map;get(t){return this.state.get(t)}set(t){this.state.set(t.key,t),this.notify(t.key)}setMany(t){t.forEach(n=>this.set(n))}subscribe(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),n(this.state.get(t)),()=>{this.listeners.get(t)?.delete(n)}}notify(t){this.listeners.get(t)?.forEach(n=>n(this.state.get(t)))}clear(){this.state.clear()}}class Zt{constructor(t){this.baseUrl=t}async fetchLatest(t){const n=new URLSearchParams;return n.set("keys",t.join(",")),(await(await fetch(`${this.baseUrl}/options?${n}`)).json()).data}}class Qt{constructor(t){this.api=t}store=new Fr;inflight=new Map;getRaw(t){return this.store.get(t)}async getKey(t){const n=this.store.get(t);return n?n.value:(await this.fetchMissing([t]),this.store.get(t)?.value)}async getMultiKey(t){const n={},r=[];for(const o of t){const s=this.store.get(o);s?n[o]=s.value:r.push(o)}return r.length&&(await this.fetchMissing(r),r.forEach(o=>{const s=this.store.get(o);s&&(n[o]=s.value)})),n}subscribe(t,n){return this.store.subscribe(t,n)}hydrate(t){this.store.setMany(t)}clear(){this.store.clear()}async fetchMissing(t){const n=t.filter(o=>!this.inflight.has(o));if(!n.length)return;const r=this.api.fetchLatest(n).then(o=>{this.store.setMany(o),n.forEach(s=>this.inflight.delete(s))});n.forEach(o=>this.inflight.set(o,r)),await r}}const Yr=f.createContext(null);function Br(){const e=f.useContext(Yr);if(!e)throw new Error("OptionsProvider is missing. Wrap your app with <OptionsProvider />");return e}function Ml({client:{apiUrl:e},children:t}){const n=f.useRef(new Qt(new Zt(e)));return n.current||(n.current=new Qt(new Zt(e))),i.jsx(Yr.Provider,{value:n.current,children:t})}function _l(e){const t=Br(),[n,r]=f.useState(t.getRaw(e)?.value);return f.useEffect(()=>{let o=!0;t.getKey(e).then(c=>{o&&r(c)});const s=t.subscribe(e,c=>{r(c?.value)});return()=>{o=!1,s()}},[e,t]),n}function Ol(e){const t=Br(),[n,r]=f.useState({});return f.useEffect(()=>{let o=!0;t.getMultiKey(e).then(c=>{o&&r(c)});const s=e.map(c=>t.subscribe(c,l=>{r(u=>({...u,[c]:l?.value}))}));return()=>{o=!1,s.forEach(c=>c())}},[e.join("|"),t]),n}async function kl(e,t){return e.getKey(t)}async function $l(e,t){await e.getMultiKey(t)}function Il(e={}){const{initialPage:t=1,initialLimit:n=20}=e,[r,o]=f.useState(t),[s,c]=f.useState(n),l=f.useCallback(y=>{o(Math.max(1,y))},[]),u=f.useCallback(y=>{c(Math.max(1,y)),o(1)},[]),d=f.useCallback(()=>{o(y=>y+1)},[]),g=f.useCallback(()=>{o(y=>Math.max(1,y-1))},[]),h=f.useCallback(()=>{o(t),c(n)},[t,n]);return{page:r,limit:s,setPage:l,setLimit:u,nextPage:d,prevPage:g,reset:h}}function Al(e={}){const{initialValue:t="",delay:n=300}=e,[r,o]=f.useState(t),s=Ll(r,n),c=f.useCallback(u=>{o(u)},[]),l=f.useCallback(()=>{o(t)},[t]);return{search:r,debouncedSearch:s,onSearchChange:c,reset:l}}function Ll(e,t=300){const[n,r]=f.useState(e);return f.useEffect(()=>{const o=setTimeout(()=>{r(e)},t);return()=>clearTimeout(o)},[e,t]),n}exports.DataTable=ua;exports.Filters=Sc;exports.HttpOptionsApi=Zt;exports.MDSButton=Dc;exports.MDSCheckbox=_r;exports.MDSCombobox=Or;exports.MDSConfirmActionDialog=Ic;exports.MDSConfirmDeleteDialog=Vc;exports.MDSDialogAction=Wc;exports.MDSDialogActions=Nr;exports.MDSDialogBody=Pr;exports.MDSDialogWrapper=nl;exports.MDSInput=Kt;exports.MDSPinInput=dl;exports.MDSRefreshButton=zr;exports.MDSSelectBox=kr;exports.OptionsClientImpl=Qt;exports.OptionsProvider=Ml;exports.OptionsStore=Fr;exports.RefreshButton=zr;exports.StackedDateTime=Tl;exports.addPreset=Ir;exports.deletePreset=Ar;exports.formatDateTime=Jt;exports.getOption=kl;exports.getPresets=rt;exports.loadOrder=Cc;exports.prefetchOptions=$l;exports.presetStore=Ze;exports.saveOrder=wc;exports.savePresets=Tt;exports.setActionsConfig=Dr;exports.setData=wr;exports.setTableId=Cr;exports.tableStore=ie;exports.updatePreset=Za;exports.useDebouncedSearch=Al;exports.useOption=_l;exports.useOptions=Ol;exports.usePagination=Il;exports.withChildren=b;
|
package/dist/index.js
CHANGED
|
@@ -5051,7 +5051,7 @@ const wu = ({ open: e, onClose: t, title: n, children: r }) => {
|
|
|
5051
5051
|
const { body: o, actions: s } = Ll(r);
|
|
5052
5052
|
return /* @__PURE__ */ i.jsx(El, { open: e, onOpenChange: (a) => !a.open && t(), children: /* @__PURE__ */ i.jsxs(Ge, { children: [
|
|
5053
5053
|
/* @__PURE__ */ i.jsx(_l, { bg: "blackAlpha.400" }),
|
|
5054
|
-
/* @__PURE__ */ i.jsx(Tl, { children: /* @__PURE__ */ i.jsxs(Ol, { w: "100%", maxW: "520px", borderRadius: "
|
|
5054
|
+
/* @__PURE__ */ i.jsx(Tl, { children: /* @__PURE__ */ i.jsxs(Ol, { w: "100%", maxW: "520px", borderRadius: "6px", overflow: "hidden", boxShadow: "lg", children: [
|
|
5055
5055
|
/* @__PURE__ */ i.jsx(
|
|
5056
5056
|
Ml,
|
|
5057
5057
|
{
|