@mdspl/mds-shared-ui 1.2.4 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +6 -3
- package/dist/index.d.ts +52 -41
- package/dist/index.js +3426 -2838
- package/package.json +3 -1
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react"),u=require("@chakra-ui/react"),Ae=require("react-dom");function io(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const mt=io(f);function wt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ot={exports:{}},Ue={};var Sn;function ao(){if(Sn)return Ue;Sn=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,o,s){var i=null;if(s!==void 0&&(i=""+s),o.key!==void 0&&(i=""+o.key),"key"in o){s={};for(var a in o)a!=="key"&&(s[a]=o[a])}else s=o;return o=s.ref,{$$typeof:e,type:r,key:i,ref:o!==void 0?o:null,props:s}}return Ue.Fragment=t,Ue.jsx=n,Ue.jsxs=n,Ue}var Ge={};var wn;function lo(){return wn||(wn=1,process.env.NODE_ENV!=="production"&&(function(){function e(b){if(b==null)return null;if(typeof b=="function")return b.$$typeof===z?null:b.displayName||b.name||null;if(typeof b=="string")return b;switch(b){case y:return"Fragment";case D:return"Profiler";case T:return"StrictMode";case _:return"Suspense";case k:return"SuspenseList";case B:return"Activity"}if(typeof b=="object")switch(typeof b.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),b.$$typeof){case x:return"Portal";case I:return b.displayName||"Context";case j:return(b._context.displayName||"Context")+".Consumer";case $:var O=b.render;return b=b.displayName,b||(b=O.displayName||O.name||"",b=b!==""?"ForwardRef("+b+")":"ForwardRef"),b;case L:return O=b.displayName||null,O!==null?O:e(b.type)||"Memo";case H:O=b._payload,b=b._init;try{return e(b(O))}catch{}}return null}function t(b){return""+b}function n(b){try{t(b);var O=!1}catch{O=!0}if(O){O=console;var N=O.error,V=typeof Symbol=="function"&&Symbol.toStringTag&&b[Symbol.toStringTag]||b.constructor.name||"Object";return N.call(O,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",V),t(b)}}function r(b){if(b===y)return"<>";if(typeof b=="object"&&b!==null&&b.$$typeof===H)return"<...>";try{var O=e(b);return O?"<"+O+">":"<...>"}catch{return"<...>"}}function o(){var b=W.A;return b===null?null:b.getOwner()}function s(){return Error("react-stack-top-frame")}function i(b){if(F.call(b,"key")){var O=Object.getOwnPropertyDescriptor(b,"key").get;if(O&&O.isReactWarning)return!1}return b.key!==void 0}function a(b,O){function N(){C||(C=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",O))}N.isReactWarning=!0,Object.defineProperty(b,"key",{get:N,configurable:!0})}function c(){var b=e(this.type);return R[b]||(R[b]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),b=this.props.ref,b!==void 0?b:null}function d(b,O,N,V,q,K){var U=N.ref;return b={$$typeof:p,type:b,key:O,props:N,_owner:V},(U!==void 0?U:null)!==null?Object.defineProperty(b,"ref",{enumerable:!1,get:c}):Object.defineProperty(b,"ref",{enumerable:!1,value:null}),b._store={},Object.defineProperty(b._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(b,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(b,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:q}),Object.defineProperty(b,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:K}),Object.freeze&&(Object.freeze(b.props),Object.freeze(b)),b}function g(b,O,N,V,q,K){var U=O.children;if(U!==void 0)if(V)if(M(U)){for(V=0;V<U.length;V++)h(U[V]);Object.freeze&&Object.freeze(U)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else h(U);if(F.call(O,"key")){U=e(b);var X=Object.keys(O).filter(function(Y){return Y!=="key"});V=0<X.length?"{key: someKey, "+X.join(": ..., ")+": ...}":"{key: someKey}",P[U+V]||(X=0<X.length?"{"+X.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
2
|
let props = %s;
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
|
5
5
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,
|
|
6
|
+
<%s key={someKey} {...props} />`,V,U,X,U),P[U+V]=!0)}if(U=null,N!==void 0&&(n(N),U=""+N),i(O)&&(n(O.key),U=""+O.key),"key"in O){N={};for(var J in O)J!=="key"&&(N[J]=O[J])}else N=O;return U&&a(N,typeof b=="function"?b.displayName||b.name||"Unknown":b),d(b,U,N,o(),q,K)}function h(b){v(b)?b._store&&(b._store.validated=1):typeof b=="object"&&b!==null&&b.$$typeof===H&&(b._payload.status==="fulfilled"?v(b._payload.value)&&b._payload.value._store&&(b._payload.value._store.validated=1):b._store&&(b._store.validated=1))}function v(b){return typeof b=="object"&&b!==null&&b.$$typeof===p}var m=f,p=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),I=Symbol.for("react.context"),$=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),z=Symbol.for("react.client.reference"),W=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=Object.prototype.hasOwnProperty,M=Array.isArray,w=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(b){return b()}};var C,R={},E=m.react_stack_bottom_frame.bind(m,s)(),A=w(r(s)),P={};Ge.Fragment=y,Ge.jsx=function(b,O,N){var V=1e4>W.recentlyCreatedOwnerStacks++;return g(b,O,N,!1,V?Error("react-stack-top-frame"):E,V?w(r(b)):A)},Ge.jsxs=function(b,O,N){var V=1e4>W.recentlyCreatedOwnerStacks++;return g(b,O,N,!0,V?Error("react-stack-top-frame"):E,V?w(r(b)):A)}})()),Ge}var Cn;function co(){return Cn||(Cn=1,process.env.NODE_ENV==="production"?ot.exports=ao():ot.exports=lo()),ot.exports}var l=co();function uo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return f.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const Ct=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ne(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function nn(e){return"nodeType"in e}function ie(e){var t,n;return e?Ne(e)?e:nn(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function rn(e){const{Document:t}=ie(e);return e instanceof t}function Qe(e){return Ne(e)?!1:e instanceof ie(e).HTMLElement}function rr(e){return e instanceof ie(e).SVGElement}function Pe(e){return e?Ne(e)?e.document:nn(e)?rn(e)?e:Qe(e)||rr(e)?e.ownerDocument:document:document:document}const xe=Ct?f.useLayoutEffect:f.useEffect;function on(e){const t=f.useRef(e);return xe(()=>{t.current=e}),f.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function fo(){const e=f.useRef(null),t=f.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=f.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Je(e,t){t===void 0&&(t=[e]);const n=f.useRef(e);return xe(()=>{n.current!==e&&(n.current=e)},t),n}function et(e,t){const n=f.useRef();return f.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function vt(e){const t=on(e),n=f.useRef(null),r=f.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function Ht(e){const t=f.useRef();return f.useEffect(()=>{t.current=e},[e]),t.current}let kt={};function tt(e,t){return f.useMemo(()=>{if(t)return t;const n=kt[e]==null?0:kt[e]+1;return kt[e]=n,e+"-"+n},[e,t])}function or(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((s,i)=>{const a=Object.entries(i);for(const[c,d]of a){const g=s[c];g!=null&&(s[c]=g+e*d)}return s},{...t})}}const ze=or(1),xt=or(-1);function ho(e){return"clientX"in e&&"clientY"in e}function sn(e){if(!e)return!1;const{KeyboardEvent:t}=ie(e.target);return t&&e instanceof t}function go(e){if(!e)return!1;const{TouchEvent:t}=ie(e.target);return t&&e instanceof t}function Ut(e){if(go(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return ho(e)?{x:e.clientX,y:e.clientY}:null}const Le=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Le.Translate.toString(e),Le.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Dn="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function po(e){return e.matches(Dn)?e:e.querySelector(Dn)}const mo={display:"none"};function vo(e){let{id:t,value:n}=e;return f.createElement("div",{id:t,style:mo},n)}function xo(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return f.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function bo(){const[e,t]=f.useState("");return{announce:f.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const sr=f.createContext(null);function yo(e){const t=f.useContext(sr);f.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function So(){const[e]=f.useState(()=>new Set),t=f.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[f.useCallback(r=>{let{type:o,event:s}=r;e.forEach(i=>{var a;return(a=i[o])==null?void 0:a.call(i,s)})},[e]),t]}const wo={draggable:`
|
|
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:i,announcement:c}=lo(),l=Je("DndLiveRegion"),[d,u]=h.useState(!1);if(h.useEffect(()=>{u(!0)},[]),co(h.useMemo(()=>({onDragStart(f){let{active:v}=f;i(t.onDragStart({active:v}))},onDragMove(f){let{active:v,over:p}=f;t.onDragMove&&i(t.onDragMove({active:v,over:p}))},onDragOver(f){let{active:v,over:p}=f;i(t.onDragOver({active:v,over:p}))},onDragEnd(f){let{active:v,over:p}=f;i(t.onDragEnd({active:v,over:p}))},onDragCancel(f){let{active:v,over:p}=f;i(t.onDragCancel({active:v,over:p}))}}),[i,t])),!d)return null;const g=h.createElement(h.Fragment,null,h.createElement(io,{id:r,value:o.draggable}),h.createElement(ao,{id:l,announcement:c}));return n?We.createPortal(g,n):g}var Z;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Z||(Z={}));function pt(){}function po(e,t){return h.useMemo(()=>({sensor:e,options:{}}),[e,t])}function mo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return h.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const ge=Object.freeze({x:0,y:0});function vo(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 yn(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 Kn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=yn(t,t.left,t.top),i=[];for(const c of r){const{id:l}=c,d=n.get(l);if(d){const u=vo(yn(d),o);i.push({id:l,data:{droppableContainer:c,value:u}})}}return i.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),i=Math.min(t.top+t.height,e.top+e.height),c=o-r,l=i-n;if(r<o&&n<i){const d=t.width*t.height,u=e.width*e.height,g=c*l,f=g/(d+u-g);return Number(f.toFixed(4))}return 0}const wo=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:c}=i,l=n.get(c);if(l){const d=So(l,t);d>0&&o.push({id:c,data:{droppableContainer:i,value:d}})}}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 Jn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ge}function Do(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.reduce((c,l)=>({...c,top:c.top+e*l.y,bottom:c.bottom+e*l.y,left:c.left+e*l.x,right:c.right+e*l.x}),{...n})}}const 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 Mo(e,t,n){const r=Ro(t);if(!r)return e;const{scaleX:o,scaleY:i,x:c,y:l}=r,d=e.left-c-(1-o)*parseFloat(n),u=e.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),g=o?e.width/o:e.width,f=i?e.height/i:e.height;return{width:g,height:f,top:u,right:d+g,bottom:u+f,left:d}}const Eo={ignoreTransform:!1};function Le(e,t){t===void 0&&(t=Eo);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:g}=ae(e).getComputedStyle(e);u&&(n=Mo(n,u,g))}const{top:r,left:o,width:i,height:c,bottom:l,right:d}=n;return{top:r,left:o,width:i,height:c,bottom:l,right:d}}function Sn(e){return Le(e,{ignoreTransform:!0})}function To(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 i=t[o];return typeof i=="string"?n.test(i):!1})}function tn(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(Zt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Xe(o)||Gn(o)||n.includes(o))return n;const i=ae(e).getComputedStyle(o);return o!==e&&Oo(o,i)&&n.push(o),_o(o,i)?n:r(o.parentNode)}return e?r(e):n}function Zn(e){const[t]=tn(e,1);return t??null}function _t(e){return!bt||!e?null:$e(e)?e:Jt(e)?Zt(e)||e===Ae(e).scrollingElement?window:Xe(e)?e:null:null}function Qn(e){return $e(e)?e.scrollX:e.scrollLeft}function er(e){return $e(e)?e.scrollY:e.scrollTop}function Wt(e){return{x:Qn(e),y:er(e)}}var Q;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Q||(Q={}));function tr(e){return!bt||!e?!1:e===document.scrollingElement}function nr(e){const t={x:0,y:0},n=tr(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,c=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:c,isRight:l,maxScroll:r,minScroll:t}}const ko={x:.2,y:.2};function Io(e,t,n,r,o){let{top:i,left:c,right:l,bottom:d}=n;r===void 0&&(r=10),o===void 0&&(o=ko);const{isTop:u,isBottom:g,isLeft:f,isRight:v}=nr(e),p={x:0,y:0},x={x:0,y:0},b={height:t.height*o.y,width:t.width*o.x};return!u&&i<=t.top+b.height?(p.y=Q.Backward,x.y=r*Math.abs((t.top+b.height-i)/b.height)):!g&&d>=t.bottom-b.height&&(p.y=Q.Forward,x.y=r*Math.abs((t.bottom-b.height-d)/b.height)),!v&&l>=t.right-b.width?(p.x=Q.Forward,x.x=r*Math.abs((t.right-b.width-l)/b.width)):!f&&c<=t.left+b.width&&(p.x=Q.Backward,x.x=r*Math.abs((t.left+b.width-c)/b.width)),{direction:p,speed:x}}function $o(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:c}=window;return{top:0,left:0,right:i,bottom:c,width:i,height:c}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function rr(e){return e.reduce((t,n)=>ke(t,Wt(n)),ge)}function Ao(e){return e.reduce((t,n)=>t+Qn(n),0)}function Lo(e){return e.reduce((t,n)=>t+er(n),0)}function Po(e,t){if(t===void 0&&(t=Le),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);Zn(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const zo=[["x",["left","right"],Ao],["y",["top","bottom"],Lo]];class nn{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=tn(n),o=rr(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,c,l]of zo)for(const d of c)Object.defineProperty(this,d,{get:()=>{const u=l(r),g=o[i]-u;return this.rect[d]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ve{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function No(e){const{EventTarget:t}=ae(e);return e instanceof t?e:Ae(e)}function Ot(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 wn(e){e.preventDefault()}function Fo(e){e.stopPropagation()}var G;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(G||(G={}));const or={start:[G.Space,G.Enter],cancel:[G.Esc],end:[G.Space,G.Enter,G.Tab]},Yo=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case G.Right:return{...n,x:n.x+25};case G.Left:return{...n,x:n.x-25};case G.Down:return{...n,y:n.y+25};case G.Up:return{...n,y:n.y-25}}};class sr{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Ve(Ae(n)),this.windowListeners=new Ve(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(ge)}handleKeyDown(t){if(en(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=or,coordinateGetter:c=Yo,scrollBehavior:l="smooth"}=o,{code:d}=t;if(i.end.includes(d)){this.handleEnd(t);return}if(i.cancel.includes(d)){this.handleCancel(t);return}const{collisionRect:u}=r.current,g=u?{x:u.left,y:u.top}:ge;this.referenceCoordinates||(this.referenceCoordinates=g);const f=c(t,{active:n,context:r.current,currentCoordinates:g});if(f){const v=gt(f,g),p={x:0,y:0},{scrollableAncestors:x}=r.current;for(const b of x){const S=t.code,{isTop:O,isRight:R,isLeft:M,isBottom:I,maxScroll:k,minScroll:_}=nr(b),$=$o(b),P={x:Math.min(S===G.Right?$.right-$.width/2:$.right,Math.max(S===G.Right?$.left:$.left+$.width/2,f.x)),y:Math.min(S===G.Down?$.bottom-$.height/2:$.bottom,Math.max(S===G.Down?$.top:$.top+$.height/2,f.y))},H=S===G.Right&&!R||S===G.Left&&!M,B=S===G.Down&&!I||S===G.Up&&!O;if(H&&P.x!==f.x){const A=b.scrollLeft+v.x,Y=S===G.Right&&A<=k.x||S===G.Left&&A>=_.x;if(Y&&!v.y){b.scrollTo({left:A,behavior:l});return}Y?p.x=b.scrollLeft-A:p.x=S===G.Right?b.scrollLeft-k.x:b.scrollLeft-_.x,p.x&&b.scrollBy({left:-p.x,behavior:l});break}else if(B&&P.y!==f.y){const A=b.scrollTop+v.y,Y=S===G.Down&&A<=k.y||S===G.Up&&A>=_.y;if(Y&&!v.x){b.scrollTo({top:A,behavior:l});return}Y?p.y=b.scrollTop-A:p.y=S===G.Down?b.scrollTop-k.y:b.scrollTop-_.y,p.y&&b.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(t,ke(gt(f,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}sr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=or,onActivation:o}=t,{active:i}=n;const{code:c}=e.nativeEvent;if(r.start.includes(c)){const l=i.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function Cn(e){return!!(e&&"distance"in e)}function Dn(e){return!!(e&&"delay"in e)}class rn{constructor(t,n,r){var o;r===void 0&&(r=No(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:c}=i;this.props=t,this.events=n,this.document=Ae(c),this.documentListeners=new Ve(this.document),this.listeners=new Ve(r),this.windowListeners=new Ve(ae(c)),this.initialCoordinates=(o=Bt(i))!=null?o:ge,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,wn),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),this.windowListeners.add(fe.ContextMenu,wn),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(Dn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Cn(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:i}=this,{onMove:c,options:{activationConstraint:l}}=i;if(!o)return;const d=(n=Bt(t))!=null?n:ge,u=gt(o,d);if(!r&&l){if(Cn(l)){if(l.tolerance!=null&&Ot(u,l.tolerance))return this.handleCancel();if(Ot(u,l.distance))return this.handleStart()}if(Dn(l)&&Ot(u,l.tolerance))return this.handleCancel();this.handlePending(l,u);return}t.cancelable&&t.preventDefault(),c(d)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===G.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Bo={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class on extends rn{constructor(t){const{event:n}=t,r=Ae(n.target);super(t,Bo,r)}}on.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const Wo={move:{name:"mousemove"},end:{name:"mouseup"}};var Vt;(function(e){e[e.RightClick=2]="RightClick"})(Vt||(Vt={}));class Vo extends rn{constructor(t){super(t,Wo,Ae(t.event.target))}}Vo.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Vt.RightClick?!1:(r?.({event:n}),!0)}}];const kt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Ho extends rn{constructor(t){super(t,kt)}static setup(){return window.addEventListener(kt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(kt.move.name,t)};function t(){}}}Ho.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var He;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(He||(He={}));var mt;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(mt||(mt={}));function Uo(e){let{acceleration:t,activator:n=He.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:c=5,order:l=mt.TreeOrder,pointerCoordinates:d,scrollableAncestors:u,scrollableAncestorRects:g,delta:f,threshold:v}=e;const p=qo({delta:f,disabled:!i}),[x,b]=to(),S=h.useRef({x:0,y:0}),O=h.useRef({x:0,y:0}),R=h.useMemo(()=>{switch(n){case He.Pointer:return d?{top:d.y,bottom:d.y,left:d.x,right:d.x}:null;case He.DraggableRect:return o}},[n,o,d]),M=h.useRef(null),I=h.useCallback(()=>{const _=M.current;if(!_)return;const $=S.current.x*O.current.x,P=S.current.y*O.current.y;_.scrollBy($,P)},[]),k=h.useMemo(()=>l===mt.TreeOrder?[...u].reverse():u,[l,u]);h.useEffect(()=>{if(!i||!u.length||!R){b();return}for(const _ of k){if(r?.(_)===!1)continue;const $=u.indexOf(_),P=g[$];if(!P)continue;const{direction:H,speed:B}=Io(_,P,R,t,v);for(const A of["x","y"])p[A][H[A]]||(B[A]=0,H[A]=0);if(B.x>0||B.y>0){b(),M.current=_,x(I,c),S.current=B,O.current=H;return}}S.current={x:0,y:0},O.current={x:0,y:0},b()},[t,I,r,b,i,c,JSON.stringify(R),JSON.stringify(p),x,u,k,g,JSON.stringify(v)])}const Go={x:{[Q.Backward]:!1,[Q.Forward]:!1},y:{[Q.Backward]:!1,[Q.Forward]:!1}};function qo(e){let{delta:t,disabled:n}=e;const r=Yt(t);return Ke(o=>{if(n||!r||!o)return Go;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Q.Backward]:o.x[Q.Backward]||i.x===-1,[Q.Forward]:o.x[Q.Forward]||i.x===1},y:{[Q.Backward]:o.y[Q.Backward]||i.y===-1,[Q.Forward]:o.y[Q.Forward]||i.y===1}}},[n,t,r])}function Xo(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Ke(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function Ko(e,t){return h.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,r)}));return[...n,...i]},[]),[e,t])}var qe;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(qe||(qe={}));var Ht;(function(e){e.Optimized="optimized"})(Ht||(Ht={}));const jn=new Map;function Jo(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,c]=h.useState(null),{frequency:l,measure:d,strategy:u}=o,g=h.useRef(e),f=S(),v=Ge(f),p=h.useCallback(function(O){O===void 0&&(O=[]),!v.current&&c(R=>R===null?O:R.concat(O.filter(M=>!R.includes(M))))},[v]),x=h.useRef(null),b=Ke(O=>{if(f&&!n)return jn;if(!O||O===jn||g.current!==e||i!=null){const R=new Map;for(let M of e){if(!M)continue;if(i&&i.length>0&&!i.includes(M.id)&&M.rect.current){R.set(M.id,M.rect.current);continue}const I=M.node.current,k=I?new nn(d(I),I):null;M.rect.current=k,k&&R.set(M.id,k)}return R}return O},[e,i,n,f,d]);return h.useEffect(()=>{g.current=e},[e]),h.useEffect(()=>{f||p()},[n,f]),h.useEffect(()=>{i&&i.length>0&&c(null)},[JSON.stringify(i)]),h.useEffect(()=>{f||typeof l!="number"||x.current!==null||(x.current=setTimeout(()=>{p(),x.current=null},l))},[l,f,p,...r]),{droppableRects:b,measureDroppableContainers:p,measuringScheduled:i!=null};function S(){switch(u){case qe.Always:return!1;case qe.BeforeDragging:return n;default:return!n}}}function ir(e,t){return Ke(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Zo(e,t){return ir(e,t)}function Qo(e){let{callback:t,disabled:n}=e;const r=Qt(t),o=h.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return h.useEffect(()=>()=>o?.disconnect(),[o]),o}function yt(e){let{callback:t,disabled:n}=e;const r=Qt(t),o=h.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return h.useEffect(()=>()=>o?.disconnect(),[o]),o}function es(e){return new nn(Le(e),e)}function Rn(e,t,n){t===void 0&&(t=es);const[r,o]=h.useState(null);function i(){o(d=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=d??n)!=null?u:null}const g=t(e);return JSON.stringify(d)===JSON.stringify(g)?d:g})}const c=Qo({callback(d){if(e)for(const u of d){const{type:g,target:f}=u;if(g==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),l=yt({callback:i});return ve(()=>{i(),e?(l?.observe(e),c?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),c?.disconnect())},[e]),r}function ts(e){const t=ir(e);return Jn(e,t)}const Mn=[];function ns(e){const t=h.useRef(e),n=Ke(r=>e?r&&r!==Mn&&e&&t.current&&e.parentNode===t.current.parentNode?r:tn(e):Mn,[e]);return h.useEffect(()=>{t.current=e},[e]),n}function rs(e){const[t,n]=h.useState(null),r=h.useRef(e),o=h.useCallback(i=>{const c=_t(i.target);c&&n(l=>l?(l.set(c,Wt(c)),new Map(l)):null)},[]);return h.useEffect(()=>{const i=r.current;if(e!==i){c(i);const l=e.map(d=>{const u=_t(d);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,Wt(u)]):null}).filter(d=>d!=null);n(l.length?new Map(l):null),r.current=e}return()=>{c(e),c(i)};function c(l){l.forEach(d=>{const u=_t(d);u?.removeEventListener("scroll",o)})}},[o,e]),h.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,c)=>ke(i,c),ge):rr(e):ge,[e,t])}function En(e,t){t===void 0&&(t=[]);const n=h.useRef(null);return h.useEffect(()=>{n.current=null},t),h.useEffect(()=>{const r=e!==ge;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?gt(e,n.current):ge}function os(e){h.useEffect(()=>{if(!bt)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 h.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=c=>{i(c,t)},n},{}),[e,t])}function ar(e){return h.useMemo(()=>e?To(e):null,[e])}const Tn=[];function is(e,t){t===void 0&&(t=Le);const[n]=e,r=ar(n?ae(n):null),[o,i]=h.useState(Tn);function c(){i(()=>e.length?e.map(d=>tr(d)?r:new nn(t(d),d)):Tn)}const l=yt({callback:c});return ve(()=>{l?.disconnect(),c(),e.forEach(d=>l?.observe(d))},[e]),o}function as(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Xe(t)?t:e}function ls(e){let{measure:t}=e;const[n,r]=h.useState(null),o=h.useCallback(u=>{for(const{target:g}of u)if(Xe(g)){r(f=>{const v=t(g);return f?{...f,width:v.width,height:v.height}:v});break}},[t]),i=yt({callback:o}),c=h.useCallback(u=>{const g=as(u);i?.disconnect(),g&&i?.observe(g),r(g?t(g):null)},[t,i]),[l,d]=ht(c);return h.useMemo(()=>({nodeRef:l,rect:n,setRef:d}),[n,l,d])}const cs=[{sensor:on,options:{}},{sensor:sr,options:{}}],us={current:{}},lt={draggable:{measure:Sn},droppable:{measure:Sn,strategy:qe.WhileDragging,frequency:Ht.Optimized},dragOverlay:{measure:Le}};class Ue extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const ds={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ue,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:pt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:lt,measureDroppableContainers:pt,windowRect:null,measuringScheduled:!1},fs={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:pt,draggableNodes:new Map,over:null,measureDroppableContainers:pt},St=h.createContext(fs),lr=h.createContext(ds);function hs(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ue}}}function gs(e,t){switch(t.type){case Z.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Z.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Z.DragEnd:case Z.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Z.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Ue(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case Z.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const c=new Ue(e.droppable.containers);return c.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:c}}}case Z.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Ue(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function ps(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=h.useContext(St),i=Yt(r),c=Yt(n?.id);return h.useEffect(()=>{if(!t&&!r&&i&&c!=null){if(!en(i)||document.activeElement===i.target)return;const l=o.get(c);if(!l)return;const{activatorNode:d,node:u}=l;if(!d.current&&!u.current)return;requestAnimationFrame(()=>{for(const g of[d.current,u.current]){if(!g)continue;const f=oo(g);if(f){f.focus();break}}})}},[r,t,o,c,i]),null}function ms(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function vs(e){return h.useMemo(()=>({draggable:{...lt.draggable,...e?.draggable},droppable:{...lt.droppable,...e?.droppable},dragOverlay:{...lt.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function xs(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=h.useRef(!1),{x:c,y:l}=typeof o=="boolean"?{x:o,y:o}:o;ve(()=>{if(!c&&!l||!t){i.current=!1;return}if(i.current||!r)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const g=n(u),f=Jn(g,r);if(c||(f.x=0),l||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const v=Zn(u);v&&v.scrollBy({top:f.y,left:f.x})}},[t,c,l,r,n])}const cr=h.createContext({...ge,scaleX:1,scaleY:1});var je;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(je||(je={}));const ur=h.memo(function(t){var n,r,o,i;let{id:c,accessibility:l,autoScroll:d=!0,children:u,sensors:g=cs,collisionDetection:f=wo,measuring:v,modifiers:p,...x}=t;const b=h.useReducer(gs,void 0,hs),[S,O]=b,[R,M]=uo(),[I,k]=h.useState(je.Uninitialized),_=I===je.Initialized,{draggable:{active:$,nodes:P,translate:H},droppable:{containers:B}}=S,A=$!=null?P.get($):null,Y=h.useRef({initial:null,translated:null}),N=h.useMemo(()=>{var se;return $!=null?{id:$,data:(se=A?.data)!=null?se:us,rect:Y}:null},[$,A]),D=h.useRef(null),[w,C]=h.useState(null),[j,E]=h.useState(null),L=Ge(x,Object.values(x)),z=Je("DndDescribedBy",c),m=h.useMemo(()=>B.getEnabled(),[B]),T=vs(v),{droppableRects:F,measureDroppableContainers:W,measuringScheduled:q}=Jo(m,{dragging:_,dependencies:[H.x,H.y],config:T.droppable}),X=Xo(P,$),U=h.useMemo(()=>j?Bt(j):null,[j]),K=Kr(),J=Zo(X,T.draggable.measure);xs({activeNode:$!=null?P.get($):null,config:K.layoutShiftCompensation,initialRect:J,measure:T.draggable.measure});const V=Rn(X,T.draggable.measure,J),ie=Rn(X?X.parentElement:null),oe=h.useRef({activatorEvent:null,active:null,activeNode:X,collisionRect:null,collisions:null,droppableRects:F,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:B,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),he=B.getNodeFor((n=oe.current.over)==null?void 0:n.id),xe=ls({measure:T.dragOverlay.measure}),Me=(r=xe.nodeRef.current)!=null?r:X,Ee=_?(o=xe.rect)!=null?o:V:null,ln=!!(xe.nodeRef.current&&xe.rect),cn=ts(ln?null:V),Rt=ar(Me?ae(Me):null),ye=ns(_?he??X:null),Qe=is(ye),et=ms(p,{transform:{x:H.x-cn.x,y:H.y-cn.y,scaleX:1,scaleY:1},activatorEvent:j,active:N,activeNodeRect:V,containerNodeRect:ie,draggingNodeRect:Ee,over:oe.current.over,overlayNodeRect:xe.rect,scrollableAncestors:ye,scrollableAncestorRects:Qe,windowRect:Rt}),un=U?ke(U,H):null,dn=rs(ye),Wr=En(dn),Vr=En(dn,[V]),Te=ke(et,Wr),_e=Ee?jo(Ee,et):null,Pe=N&&_e?f({active:N,collisionRect:_e,droppableRects:F,droppableContainers:m,pointerCoordinates:un}):null,fn=yo(Pe,"id"),[Se,hn]=h.useState(null),Hr=ln?et:ke(et,Vr),Ur=Co(Hr,(i=Se?.rect)!=null?i:null,V),Mt=h.useRef(null),gn=h.useCallback((se,le)=>{let{sensor:ce,options:we}=le;if(D.current==null)return;const de=P.get(D.current);if(!de)return;const ue=se.nativeEvent,pe=new ce({active:D.current,activeNode:de,event:ue,options:we,context:oe,onAbort(te){if(!P.get(te))return;const{onDragAbort:me}=L.current,be={id:te};me?.(be),R({type:"onDragAbort",event:be})},onPending(te,Ce,me,be){if(!P.get(te))return;const{onDragPending:Ne}=L.current,De={id:te,constraint:Ce,initialCoordinates:me,offset:be};Ne?.(De),R({type:"onDragPending",event:De})},onStart(te){const Ce=D.current;if(Ce==null)return;const me=P.get(Ce);if(!me)return;const{onDragStart:be}=L.current,ze={activatorEvent:ue,active:{id:Ce,data:me.data,rect:Y}};We.unstable_batchedUpdates(()=>{be?.(ze),k(je.Initializing),O({type:Z.DragStart,initialCoordinates:te,active:Ce}),R({type:"onDragStart",event:ze}),C(Mt.current),E(ue)})},onMove(te){O({type:Z.DragMove,coordinates:te})},onEnd:Oe(Z.DragEnd),onCancel:Oe(Z.DragCancel)});Mt.current=pe;function Oe(te){return async function(){const{active:me,collisions:be,over:ze,scrollAdjustedTranslate:Ne}=oe.current;let De=null;if(me&&Ne){const{cancelDrop:Fe}=L.current;De={activatorEvent:ue,active:me,collisions:be,delta:Ne,over:ze},te===Z.DragEnd&&typeof Fe=="function"&&await Promise.resolve(Fe(De))&&(te=Z.DragCancel)}D.current=null,We.unstable_batchedUpdates(()=>{O({type:te}),k(je.Uninitialized),hn(null),C(null),E(null),Mt.current=null;const Fe=te===Z.DragEnd?"onDragEnd":"onDragCancel";if(De){const Et=L.current[Fe];Et?.(De),R({type:Fe,event:De})}})}}},[P]),Gr=h.useCallback((se,le)=>(ce,we)=>{const de=ce.nativeEvent,ue=P.get(we);if(D.current!==null||!ue||de.dndKit||de.defaultPrevented)return;const pe={active:ue};se(ce,le.options,pe)===!0&&(de.dndKit={capturedBy:le.sensor},D.current=we,gn(ce,le))},[P,gn]),pn=Ko(g,Gr);os(g),ve(()=>{V&&I===je.Initializing&&k(je.Initialized)},[V,I]),h.useEffect(()=>{const{onDragMove:se}=L.current,{active:le,activatorEvent:ce,collisions:we,over:de}=oe.current;if(!le||!ce)return;const ue={active:le,activatorEvent:ce,collisions:we,delta:{x:Te.x,y:Te.y},over:de};We.unstable_batchedUpdates(()=>{se?.(ue),R({type:"onDragMove",event:ue})})},[Te.x,Te.y]),h.useEffect(()=>{const{active:se,activatorEvent:le,collisions:ce,droppableContainers:we,scrollAdjustedTranslate:de}=oe.current;if(!se||D.current==null||!le||!de)return;const{onDragOver:ue}=L.current,pe=we.get(fn),Oe=pe&&pe.rect.current?{id:pe.id,rect:pe.rect.current,data:pe.data,disabled:pe.disabled}:null,te={active:se,activatorEvent:le,collisions:ce,delta:{x:de.x,y:de.y},over:Oe};We.unstable_batchedUpdates(()=>{hn(Oe),ue?.(te),R({type:"onDragOver",event:te})})},[fn]),ve(()=>{oe.current={activatorEvent:j,active:N,activeNode:X,collisionRect:_e,collisions:Pe,droppableRects:F,draggableNodes:P,draggingNode:Me,draggingNodeRect:Ee,droppableContainers:B,over:Se,scrollableAncestors:ye,scrollAdjustedTranslate:Te},Y.current={initial:Ee,translated:_e}},[N,X,Pe,_e,P,Me,Ee,F,B,Se,ye,Te]),Uo({...K,delta:H,draggingRect:_e,pointerCoordinates:un,scrollableAncestors:ye,scrollableAncestorRects:Qe});const qr=h.useMemo(()=>({active:N,activeNode:X,activeNodeRect:V,activatorEvent:j,collisions:Pe,containerNodeRect:ie,dragOverlay:xe,draggableNodes:P,droppableContainers:B,droppableRects:F,over:Se,measureDroppableContainers:W,scrollableAncestors:ye,scrollableAncestorRects:Qe,measuringConfiguration:T,measuringScheduled:q,windowRect:Rt}),[N,X,V,j,Pe,ie,xe,P,B,F,Se,W,ye,Qe,T,q,Rt]),Xr=h.useMemo(()=>({activatorEvent:j,activators:pn,active:N,activeNodeRect:V,ariaDescribedById:{draggable:z},dispatch:O,draggableNodes:P,over:Se,measureDroppableContainers:W}),[j,pn,N,V,O,z,P,Se,W]);return h.createElement(Xn.Provider,{value:M},h.createElement(St.Provider,{value:Xr},h.createElement(lr.Provider,{value:qr},h.createElement(cr.Provider,{value:Ur},u)),h.createElement(ps,{disabled:l?.restoreFocus===!1})),h.createElement(go,{...l,hiddenTextDescribedById:z}));function Kr(){const se=w?.autoScrollEnabled===!1,le=typeof d=="object"?d.enabled===!1:d===!1,ce=_&&!se&&!le;return typeof d=="object"?{...d,enabled:ce}:{enabled:ce}}}),bs=h.createContext(null),_n="button",ys="Draggable";function Ss(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=Je(ys),{activators:c,activatorEvent:l,active:d,activeNodeRect:u,ariaDescribedById:g,draggableNodes:f,over:v}=h.useContext(St),{role:p=_n,roleDescription:x="draggable",tabIndex:b=0}=o??{},S=d?.id===t,O=h.useContext(S?cr:bs),[R,M]=ht(),[I,k]=ht(),_=ss(c,t),$=Ge(n);ve(()=>(f.set(t,{id:t,key:i,node:R,activatorNode:I,data:$}),()=>{const H=f.get(t);H&&H.key===i&&f.delete(t)}),[f,t]);const P=h.useMemo(()=>({role:p,tabIndex:b,"aria-disabled":r,"aria-pressed":S&&p===_n?!0:void 0,"aria-roledescription":x,"aria-describedby":g.draggable}),[r,p,b,S,x,g.draggable]);return{active:d,activatorEvent:l,activeNodeRect:u,attributes:P,isDragging:S,listeners:r?void 0:_,node:R,over:v,setNodeRef:M,setActivatorNodeRef:k,transform:O}}function ws(){return h.useContext(lr)}const Cs="Droppable",Ds={timeout:25};function js(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=Je(Cs),{active:c,dispatch:l,over:d,measureDroppableContainers:u}=h.useContext(St),g=h.useRef({disabled:n}),f=h.useRef(!1),v=h.useRef(null),p=h.useRef(null),{disabled:x,updateMeasurementsFor:b,timeout:S}={...Ds,...o},O=Ge(b??r),R=h.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{u(Array.isArray(O.current)?O.current:[O.current]),p.current=null},S)},[S]),M=yt({callback:R,disabled:x||!c}),I=h.useCallback((P,H)=>{M&&(H&&(M.unobserve(H),f.current=!1),P&&M.observe(P))},[M]),[k,_]=ht(I),$=Ge(t);return h.useEffect(()=>{!M||!k.current||(M.disconnect(),f.current=!1,M.observe(k.current))},[k,M]),h.useEffect(()=>(l({type:Z.RegisterDroppable,element:{id:r,key:i,disabled:n,node:k,rect:v,data:$}}),()=>l({type:Z.UnregisterDroppable,key:i,id:r})),[r]),h.useEffect(()=>{n!==g.current.disabled&&(l({type:Z.SetDroppableDisabled,id:r,key:i,disabled:n}),g.current.disabled=n)},[r,i,n,l]),{active:c,rect:v,isOver:d?.id===r,node:k,over:d,setNodeRef:_}}function wt(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 i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function nt(e){return e!==null&&e>=0}function Ms(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 Es(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const rt={scaleX:1,scaleY:1},Ts=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:i,index:c}=e;const l=(t=n[o])!=null?t:r;if(!l)return null;const d=_s(n,c,o);if(c===o){const u=n[i];return u?{x:o<i?u.left+u.width-(l.left+l.width):u.left-l.left,y:0,...rt}:null}return c>o&&c<=i?{x:-l.width-d,y:0,...rt}:c<o&&c>=i?{x:l.width+d,y:0,...rt}:{x:0,y:0,...rt}};function _s(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return!r||!o&&!i?0:n<t?o?r.left-(o.left+o.width):i.left-(r.left+r.width):i?i.left-(r.left+r.width):r.left-(o.left+o.width)}const dr=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=wt(t,r,n),c=t[o],l=i[o];return!l||!c?null:{x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height}},ot={scaleX:1,scaleY:1},Os=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:c}=e;const l=(t=i[n])!=null?t:r;if(!l)return null;if(o===n){const u=i[c];return u?{x:0,y:n<c?u.top+u.height-(l.top+l.height):u.top-l.top,...ot}:null}const d=ks(i,o,n);return o>n&&o<=c?{x:0,y:-l.height-d,...ot}:o<n&&o>=c?{x:0,y:l.height+d,...ot}:{x:0,y:0,...ot}};function ks(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return r?n<t?o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const fr="Sortable",hr=h.createContext({activeIndex:-1,containerId:fr,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:dr,disabled:{draggable:!1,droppable:!1}});function gr(e){let{children:t,id:n,items:r,strategy:o=dr,disabled:i=!1}=e;const{active:c,dragOverlay:l,droppableRects:d,over:u,measureDroppableContainers:g}=ws(),f=Je(fr,n),v=l.rect!==null,p=h.useMemo(()=>r.map(_=>typeof _=="object"&&"id"in _?_.id:_),[r]),x=c!=null,b=c?p.indexOf(c.id):-1,S=u?p.indexOf(u.id):-1,O=h.useRef(p),R=!Ms(p,O.current),M=S!==-1&&b===-1||R,I=Es(i);ve(()=>{R&&x&&g(p)},[R,p,x,g]),h.useEffect(()=>{O.current=p},[p]);const k=h.useMemo(()=>({activeIndex:b,containerId:f,disabled:I,disableTransforms:M,items:p,overIndex:S,useDragOverlay:v,sortedRects:Rs(p,d),strategy:o}),[b,f,I.draggable,I.droppable,M,p,S,d,v,o]);return h.createElement(hr.Provider,{value:k},t)}const Is=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return wt(n,r,o).indexOf(t)},$s=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:c,previousItems:l,previousContainerId:d,transition:u}=e;return!u||!r||l!==i&&o===c?!1:n?!0:c!==o&&t===d},As={duration:200,easing:"ease"},pr="transform",Ls=Ie.Transition.toString({property:pr,duration:0,easing:"linear"}),Ps={roleDescription:"sortable"};function zs(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,c]=h.useState(null),l=h.useRef(n);return ve(()=>{if(!t&&n!==l.current&&r.current){const d=o.current;if(d){const u=Le(r.current,{ignoreTransform:!0}),g={x:d.left-u.left,y:d.top-u.top,scaleX:d.width/u.width,scaleY:d.height/u.height};(g.x||g.y)&&c(g)}}n!==l.current&&(l.current=n)},[t,n,r,o]),h.useEffect(()=>{i&&c(null)},[i]),i}function mr(e){let{animateLayoutChanges:t=$s,attributes:n,disabled:r,data:o,getNewIndex:i=Is,id:c,strategy:l,resizeObserverConfig:d,transition:u=As}=e;const{items:g,containerId:f,activeIndex:v,disabled:p,disableTransforms:x,sortedRects:b,overIndex:S,useDragOverlay:O,strategy:R}=h.useContext(hr),M=Ns(r,p),I=g.indexOf(c),k=h.useMemo(()=>({sortable:{containerId:f,index:I,items:g},...o}),[f,o,I,g]),_=h.useMemo(()=>g.slice(g.indexOf(c)),[g,c]),{rect:$,node:P,isOver:H,setNodeRef:B}=js({id:c,data:k,disabled:M.droppable,resizeObserverConfig:{updateMeasurementsFor:_,...d}}),{active:A,activatorEvent:Y,activeNodeRect:N,attributes:D,setNodeRef:w,listeners:C,isDragging:j,over:E,setActivatorNodeRef:L,transform:z}=Ss({id:c,data:k,attributes:{...Ps,...n},disabled:M.draggable}),m=eo(B,w),T=!!A,F=T&&!x&&nt(v)&&nt(S),W=!O&&j,q=W&&F?z:null,U=F?q??(l??R)({rects:b,activeNodeRect:N,activeIndex:v,overIndex:S,index:I}):null,K=nt(v)&&nt(S)?i({id:c,items:g,activeIndex:v,overIndex:S}):I,J=A?.id,V=h.useRef({activeId:J,items:g,newIndex:K,containerId:f}),ie=g!==V.current.items,oe=t({active:A,containerId:f,isDragging:j,isSorting:T,id:c,index:I,items:g,newIndex:V.current.newIndex,previousItems:V.current.items,previousContainerId:V.current.containerId,transition:u,wasDragging:V.current.activeId!=null}),he=zs({disabled:!oe,index:I,node:P,rect:$});return h.useEffect(()=>{T&&V.current.newIndex!==K&&(V.current.newIndex=K),f!==V.current.containerId&&(V.current.containerId=f),g!==V.current.items&&(V.current.items=g)},[T,K,f,g]),h.useEffect(()=>{if(J===V.current.activeId)return;if(J!=null&&V.current.activeId==null){V.current.activeId=J;return}const Me=setTimeout(()=>{V.current.activeId=J},50);return()=>clearTimeout(Me)},[J]),{active:A,activeIndex:v,attributes:D,data:k,rect:$,index:I,newIndex:K,items:g,isOver:H,isSorting:T,isDragging:j,listeners:C,node:P,overIndex:S,over:E,setNodeRef:m,setActivatorNodeRef:L,setDroppableNodeRef:B,setDraggableNodeRef:w,transform:he??U,transition:xe()};function xe(){if(he||ie&&V.current.newIndex===I)return Ls;if(!(W&&!en(Y)||!u)&&(T||oe))return Ie.Transition.toString({...u,property:pr})}}function Ns(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}G.Down,G.Right,G.Up,G.Left;var st={exports:{}},It={},it={exports:{}},$t={};var On;function Fs(){if(On)return $t;On=1;var e=h;function t(f,v){return f===v&&(f!==0||1/f===1/v)||f!==f&&v!==v}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,i=e.useLayoutEffect,c=e.useDebugValue;function l(f,v){var p=v(),x=r({inst:{value:p,getSnapshot:v}}),b=x[0].inst,S=x[1];return i(function(){b.value=p,b.getSnapshot=v,d(b)&&S({inst:b})},[f,p,v]),o(function(){return d(b)&&S({inst:b}),f(function(){d(b)&&S({inst:b})})},[f]),c(p),p}function d(f){var v=f.getSnapshot;f=f.value;try{var p=v();return!n(f,p)}catch{return!0}}function u(f,v){return v()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:l;return $t.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,$t}var At={};var kn;function Ys(){return kn||(kn=1,process.env.NODE_ENV!=="production"&&(function(){function e(p,x){return p===x&&(p!==0||1/p===1/x)||p!==p&&x!==x}function t(p,x){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 b=x();if(!f){var S=x();i(b,S)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}S=c({inst:{value:b,getSnapshot:x}});var O=S[0].inst,R=S[1];return d(function(){O.value=b,O.getSnapshot=x,n(O)&&R({inst:O})},[p,b,x]),l(function(){return n(O)&&R({inst:O}),p(function(){n(O)&&R({inst:O})})},[p]),u(b),b}function n(p){var x=p.getSnapshot;p=p.value;try{var b=x();return!i(p,b)}catch{return!0}}function r(p,x){return x()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=h,i=typeof Object.is=="function"?Object.is:e,c=o.useState,l=o.useEffect,d=o.useLayoutEffect,u=o.useDebugValue,g=!1,f=!1,v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;At.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:v,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),At}var In;function vr(){return In||(In=1,process.env.NODE_ENV==="production"?it.exports=Fs():it.exports=Ys()),it.exports}var $n;function Bs(){if($n)return It;$n=1;var e=h,t=vr();function n(u,g){return u===g&&(u!==0||1/u===1/g)||u!==u&&g!==g}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,i=e.useRef,c=e.useEffect,l=e.useMemo,d=e.useDebugValue;return It.useSyncExternalStoreWithSelector=function(u,g,f,v,p){var x=i(null);if(x.current===null){var b={hasValue:!1,value:null};x.current=b}else b=x.current;x=l(function(){function O(_){if(!R){if(R=!0,M=_,_=v(_),p!==void 0&&b.hasValue){var $=b.value;if(p($,_))return I=$}return I=_}if($=I,r(M,_))return $;var P=v(_);return p!==void 0&&p($,P)?(M=_,$):(M=_,I=P)}var R=!1,M,I,k=f===void 0?null:f;return[function(){return O(g())},k===null?void 0:function(){return O(k())}]},[g,f,v,p]);var S=o(u,x[0],x[1]);return c(function(){b.hasValue=!0,b.value=S},[S]),d(S),S},It}var Lt={};var An;function Ws(){return An||(An=1,process.env.NODE_ENV!=="production"&&(function(){function e(u,g){return u===g&&(u!==0||1/u===1/g)||u!==u&&g!==g}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=h,n=vr(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,i=t.useRef,c=t.useEffect,l=t.useMemo,d=t.useDebugValue;Lt.useSyncExternalStoreWithSelector=function(u,g,f,v,p){var x=i(null);if(x.current===null){var b={hasValue:!1,value:null};x.current=b}else b=x.current;x=l(function(){function O(_){if(!R){if(R=!0,M=_,_=v(_),p!==void 0&&b.hasValue){var $=b.value;if(p($,_))return I=$}return I=_}if($=I,r(M,_))return $;var P=v(_);return p!==void 0&&p($,P)?(M=_,$):(M=_,I=P)}var R=!1,M,I,k=f===void 0?null:f;return[function(){return O(g())},k===null?void 0:function(){return O(k())}]},[g,f,v,p]);var S=o(u,x[0],x[1]);return c(function(){b.hasValue=!0,b.value=S},[S]),d(S),S},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Lt}var Ln;function Vs(){return Ln||(Ln=1,process.env.NODE_ENV==="production"?st.exports=Bs():st.exports=Ws()),st.exports}var Hs=Vs();const Ut=new WeakMap,Us=new WeakMap,vt={current:[]};let Pt=!1;const at=new Set,Pn=new Map;function xr(e){for(const t of e){if(vt.current.includes(t))continue;vt.current.push(t),t.recompute();const n=Us.get(t);if(n)for(const r of n){const o=Ut.get(r);o?.length&&xr(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(at.add(e),!Pt)try{for(Pt=!0;at.size>0;){const t=Array.from(at);at.clear();for(const n of t){const r=Pn.get(n)??n.prevState;n.prevState=r,Gs(n)}for(const n of t){const r=Ut.get(n);r&&(vt.current.push(n),xr(r))}for(const n of t){const r=Ut.get(n);if(r)for(const o of r)qs(o)}}}finally{Pt=!1,vt.current=[],Pn.clear()}}function Ks(e){return typeof e=="function"}class Js{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var o,i;this.listeners.add(r);const c=(i=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:i.call(o,r,this);return()=>{this.listeners.delete(r),c?.()}},this.prevState=t,this.state=t,this.options=n}setState(t){var n,r,o;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(t):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 Ze(e,t=r=>r,n={}){const r=n.equal??Zs;return Hs.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,r)}function Zs(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=zn(e);if(n.length!==zn(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 zn(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}function Qs(e,t,n){return e.map((r,o)=>{const i={};return t.forEach(c=>{i[c.id]=ei(r[c.id])}),{__key:r.id??o,__raw:r,cells:i}})}function ei(e){return e==null?"—":h.isValidElement(e)||typeof e=="string"||typeof e=="number"?e:typeof e=="boolean"?e?"Yes":"No":e instanceof Date?e.toLocaleDateString():Array.isArray(e)?e.join(", "):typeof e=="object"?JSON.stringify(e):String(e)}const re=new Js({tableId:"",sortColumn:null,sortDirection:"asc",visibility:{},columnOrder:[],columnWidths:{},data:[],sortableColumns:[],actionsConfig:{showActionColumn:!0,showColumnVisibilityMenu:!0,children:"Actions",width:"100px"}}),Ct=e=>`datatable:${e}:column-widths`;function br(e,t){const n=e[0]??{},o=(t&&t.length?t:Object.keys(n).map(f=>({id:f,label:f}))).filter(f=>Object.prototype.hasOwnProperty.call(n,f.id)),{tableId:i}=re.state,c=JSON.parse(localStorage.getItem(wr(i))||"[]"),l=[...c.map(f=>o.find(v=>v.id===f)).filter(Boolean),...o.filter(f=>!c.includes(f.id))],d=JSON.parse(localStorage.getItem(Cr(i))||"{}"),u=l.reduce((f,v)=>(f[v.id]=d[v.id]??!0,f),{}),g=JSON.parse(localStorage.getItem(Ct(i))||"{}");re.setState(f=>({...f,data:e,columnOrder:l,visibility:u,columnWidths:g,sortableColumns:l.map(v=>({id:v.id,label:v.label,sortable:!0,backgroundColor:v.backgroundColor,minWidth:v.minWidth}))}))}function yr(e){re.setState(t=>({...t,tableId:e,sortColumn:null,sortDirection:"asc",columnOrder:[],visibility:{}}))}const Sr=e=>{re.setState(t=>({...t,actionsConfig:e}))};function ti(e,t){re.setState(n=>{const r={...n.columnWidths,[e]:Math.max(60,t)};return localStorage.setItem(Ct(n.tableId),JSON.stringify(r)),{...n,columnWidths:r}})}const wr=e=>`table_column_order_v1:${e}`,Cr=e=>`table_column_visibility_v1:${e}`,ni=e=>{const{tableId:t}=re.state;localStorage.setItem(wr(t),JSON.stringify(e.map(n=>n.id))),re.setState(n=>({...n,columnOrder:e})),re.setState(n=>({...n,columnOrder:e}))};function ri(e){re.setState(t=>t.sortColumn===e?{...t,sortDirection:t.sortDirection==="asc"?"desc":"asc"}:{...t,sortColumn:e,sortDirection:"asc"})}const oi=e=>{re.setState(t=>{const n={...t.visibility,[e]:!t.visibility[e]};return t.tableId&&localStorage.setItem(Cr(t.tableId),JSON.stringify(n)),{...t,visibility:n}})};function si(e,t){re.setState(n=>{const r=n.columnOrder.find(c=>c.id===e),o=typeof r?.minWidth=="number"?r.minWidth:120,i={...n.columnWidths,[e]:Math.max(o,t)};return localStorage.setItem(Ct(n.tableId),JSON.stringify(i)),{...n,columnWidths:i}})}const ii=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ai=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Nn=e=>{const t=ai(e);return t.charAt(0).toUpperCase()+t.slice(1)},Dr=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),li=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var ci={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 ui=h.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:c,...l},d)=>h.createElement("svg",{ref:d,...ci,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Dr("lucide",o),...!i&&!li(l)&&{"aria-hidden":"true"},...l},[...c.map(([u,g])=>h.createElement(u,g)),...Array.isArray(i)?i:[i]]));const ee=(e,t)=>{const n=h.forwardRef(({className:r,...o},i)=>h.createElement(ui,{ref:i,iconNode:t,className:Dr(`lucide-${ii(Nn(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Nn(e),n};const di=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],fi=ee("arrow-down",di);const hi=[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]],gi=ee("arrow-left-right",hi);const pi=[["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"}]],mi=ee("arrow-up-down",pi);const vi=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],xi=ee("arrow-up",vi);const bi=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],yi=ee("bookmark",bi);const Si=[["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"}]],jr=ee("calendar",Si);const wi=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Ci=ee("chevron-left",wi);const Di=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ji=ee("chevron-right",Di);const Ri=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Mi=ee("columns-2",Ri);const Ei=[["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"}]],Ti=ee("delete",Ei);const _i=[["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"}]],Oi=ee("ellipsis",_i);const ki=[["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"}]],Ii=ee("funnel",ki);const $i=[["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"}]],Rr=ee("grip-vertical",$i);const Ai=[["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"}]],Li=ee("pen",Ai);const Pi=[["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"}]],zi=ee("refresh-ccw",Pi);const Ni=[["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"}]],Fi=ee("settings",Ni);const Yi=[["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=ee("triangle-alert",Yi);const Bi=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Er=ee("x",Bi);function y(e){return h.forwardRef((t,n)=>{const{children:r,...o}=t;return s.jsx(e,{ref:n,...o,children:r})})}const Wi=y(a.Menu.Trigger),Vi=y(a.Menu.Positioner),Hi=y(a.Menu.Content),Ui=y(a.Menu.Item),Gi=y(a.Checkbox.Label),qi=y(a.Checkbox.HiddenInput),Xi=y(a.Checkbox.Control);function Ki({visibility:e,onToggle:t}){const{sortableColumns:n}=Ze(re);return s.jsxs(a.Menu.Root,{closeOnSelect:!1,children:[s.jsx(Wi,{asChild:!0,children:s.jsx(a.IconButton,{"aria-label":"Toggle columns",variant:"ghost",ml:"1",size:"xs",children:s.jsx(Mi,{size:18})})}),s.jsx(a.Portal,{children:s.jsx(Vi,{children:s.jsx(Hi,{minW:"220px",children:n.map(r=>{const o=!!e[r.id];return s.jsx(Ui,{value:r.id,closeOnSelect:!1,children:s.jsxs(a.Checkbox.Root,{checked:o,onCheckedChange:()=>t(r.id),children:[s.jsx(qi,{}),s.jsx(Xi,{}),s.jsx(Gi,{children:r.label})]})},r.id)})})})})]})}function Ji({id:e,children:t,onClick:n,cursor:r,borderRight:o,backgroundColor:i,minW:c}){const{columnWidths:l}=Ze(re),d=l[e],u=h.useRef(0),g=h.useRef(0),{setNodeRef:f,attributes:v,listeners:p,transform:x,transition:b}=mr({id:e}),S=M=>{M.stopPropagation(),u.current=M.clientX,g.current=d??150;const I=_=>{si(e,g.current+(_.clientX-u.current))},k=()=>{document.removeEventListener("mousemove",I),document.removeEventListener("mouseup",k)};document.addEventListener("mousemove",I),document.addEventListener("mouseup",k)},[O,R]=h.useState(!1);return s.jsx(a.Table.ColumnHeader,{ref:f,onClick:n,backgroundColor:i,w:d?`${d}px`:void 0,minW:c,style:{transform:Ie.Transform.toString(x),transition:b,cursor:r,borderRight:o},...v,children:s.jsxs(a.HStack,{position:"relative",children:[s.jsx("span",{...p,children:s.jsx(Rr,{size:12,style:{cursor:"grab"}})}),t,s.jsx(a.Box,{position:"absolute",right:0,top:0,h:"100%",w:"10px",cursor:"col-resize",onMouseDown:S,onMouseEnter:()=>R(!0),onMouseLeave:()=>R(!1),display:"flex",alignItems:"center",justifyContent:"center",zIndex:2,children:O&&s.jsx(gi,{size:14,style:{pointerEvents:"none",opacity:.8}})})]})})}function Zi(){const{columnOrder:e,visibility:t,sortColumn:n,sortDirection:r,sortableColumns:o,actionsConfig:i}=Ze(re),c=e.map(l=>o.find(d=>d.id===l.id)).filter(l=>l!==void 0).filter(l=>t[l.id]);return s.jsx(a.Table.Header,{background:"blue.200",position:"sticky",top:0,p:"0",zIndex:1,children:s.jsxs(a.Table.Row,{height:"28px",children:[i?.showSNo&&s.jsx(a.Table.ColumnHeader,{width:"80px",minW:80,maxW:80,textAlign:"center",backgroundColor:i.backgroundColor,borderRight:"2px solid #dcdcdc",children:i.indexChildren||"S.No"}),c.map(l=>{const d=n===l?.id,u=l.minWidth;return s.jsx(Ji,{id:l?.id,onClick:()=>l?.sortable&&ri(l?.id),borderRight:"2px solid #dcdcdc",backgroundColor:l?.backgroundColor,minW:u,children:s.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,userSelect:"none"},children:[l.label,l?.sortable&&(d?r==="asc"?s.jsx(xi,{size:14}):s.jsx(fi,{size:14}):s.jsx(mi,{size:14,opacity:.4}))]})},l?.id)}),i?.showActionColumn&&s.jsx(a.Table.ColumnHeader,{width:i.width,backgroundColor:i.backgroundColor,borderRight:"2px solid #dcdcdc",children:i.children||"Actions"}),i?.showColumnVisibilityMenu&&s.jsx(a.Table.ColumnHeader,{boxSize:"0.5",backgroundColor:i.backgroundColorColumnVisibilityMenu,width:"50px",children:s.jsx(Ki,{visibility:t,onToggle:oi})})]})})}const Qi=[10,20,50,100],ea=y(a.Select.Positioner),ta=y(a.Select.Content),na=y(a.Select.Item),ra=y(a.Pagination.PrevTrigger),oa=y(a.Pagination.NextTrigger),sa=y(a.Select.HiddenSelect),ia=y(a.Select.Control),aa=y(a.Select.Trigger),la=y(a.Select.ValueText),ca=y(a.Select.IndicatorGroup),ua=y(a.Select.Indicator);function da({totalCount:e,pageSize:t,currentPage:n,onPageChange:r,onPageSizeChange:o,siblingCount:i=2,pageSizeOptions:c=Qi}){const l=a.createListCollection({items:c.map(d=>({label:String(d),value:String(d)}))});return s.jsx(a.Box,{width:"100%",children:s.jsxs(a.HStack,{justify:"space-between",mx:"auto",flexWrap:"wrap",children:[s.jsxs(a.HStack,{children:[s.jsx(a.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:"Rows per page:"}),s.jsxs(a.Select.Root,{collection:l,size:"sm",width:"60px",onValueChange:d=>o?.(Number(d.items[0].value)),value:[String(t)],children:[s.jsx(sa,{}),s.jsxs(ia,{children:[s.jsx(aa,{children:s.jsx(la,{placeholder:""})}),s.jsx(ca,{children:s.jsx(ua,{})})]}),s.jsx(a.Portal,{children:s.jsx(ea,{children:s.jsx(ta,{children:l.items.map(d=>s.jsxs(na,{item:d.value,children:[d.label,s.jsx(a.Select.ItemIndicator,{})]},d.value))})})})]}),s.jsxs(a.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:["of ",e]})]}),s.jsx(a.Pagination.Root,{count:e,pageSize:t,page:n,siblingCount:i,onPageChange:d=>r&&r(d.page),children:s.jsxs(a.ButtonGroup,{size:"sm",variant:"ghost",children:[s.jsx(ra,{asChild:!0,children:s.jsx(a.IconButton,{"aria-label":"Previous page",children:s.jsx(Ci,{size:18})})}),s.jsx(a.Pagination.Items,{render:d=>s.jsx(a.IconButton,{variant:d.type==="page"&&d.value===n?"outline":"ghost","aria-current":d.type==="page"&&d.value===n?"page":void 0,children:d.type==="page"?d.value:"…"},d.value??d.type)}),s.jsx(oa,{asChild:!0,children:s.jsx(a.IconButton,{"aria-label":"Next page",children:s.jsx(ji,{size:18})})})]})})]})})}const fa=y(a.Menu.Item),ha=y(a.Menu.Content),ga=y(a.Menu.Positioner),pa=y(a.Menu.Trigger);function ma({data:e=[],actions:t,actionConfig:n,onRowSelect:r,onRowSelectEvent:o="left",startIndex:i=0}){const{columnOrder:c,visibility:l,columnWidths:d}=Ze(re);return s.jsx(a.Table.Body,{children:e?.map((u,g)=>s.jsxs(a.Table.Row,{onClick:()=>o==="left"&&u.__raw&&r?.(u.__raw),_hover:{bg:"blue.50"},onContextMenu:o==="right"?f=>{f.preventDefault(),u.__raw&&r?.(u.__raw,f)}:void 0,children:[n?.showSNo&&s.jsx(a.Table.Cell,{textAlign:"center",fontWeight:"medium",children:i+g+1}),c.filter(f=>l[f.id]).map(f=>{const v=typeof f.minWidth=="number"?`${f.minWidth}px`:f.minWidth;return s.jsx(a.Table.Cell,{w:d[f.id]?`${d[f.id]}px`:void 0,minW:`${v}px`,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:u.cells[f.id]},u.id)}),n?.showActionColumn&&s.jsx(a.Table.Cell,{textAlign:"center",display:"flex",gap:2,children:s.jsxs(a.Menu.Root,{children:[s.jsx(pa,{asChild:!0,children:s.jsx(a.IconButton,{"aria-label":"Open",variant:"ghost",size:"sm",children:s.jsx(Oi,{size:16})})}),s.jsx(ga,{children:s.jsx(ha,{children:t?.filter(f=>typeof f.visible=="function"?u.__raw&&f.visible(u.__raw):f.visible!==!1).map(f=>s.jsxs(fa,{onClick:()=>u.__raw&&f.onClick(u.__raw),colorScheme:f.colorScheme,value:f.label,children:[f.icon,f.label]},f.label))})})]})}),n?.showColumnVisibilityMenu&&s.jsx(a.Table.Cell,{})]},u.__key||u.id))})}function va({rows:e=6,columns:t}){return s.jsx(a.Table.Body,{children:Array.from({length:e}).map((n,r)=>s.jsx(a.Table.Row,{children:Array.from({length:t}).map((o,i)=>s.jsx(a.Table.Cell,{children:s.jsx(a.Skeleton,{height:"25px"})},i))},r))})}function xa({tableId:e,data:t=[],headers:n=[],loading:r=!1,loadingChildren:o,skeletonLoading:i=!1,emptyMessage:c="No data",actions:l,page:d=1,pageSize:u=10,onPageChange:g,onPageSizeChange:f,density:v="sm",totalCount:p=0,actionConfig:x,pageSizeOptions:b,onRowSelect:S,onRowSelectEvent:O="left"}){h.useEffect(()=>{yr(e)},[e]),h.useEffect(()=>{br(t,n)},[t,n]),h.useEffect(()=>{x&&Sr(x)},[x]);const{sortColumn:R,sortDirection:M,data:I,columnOrder:k}=Ze(re),_=h.useMemo(()=>{const D=[...I];return R&&D.sort((w,C)=>M==="asc"?String(w[R]).localeCompare(String(C[R])):String(C[R]).localeCompare(String(w[R]))),D},[I,R,M,d,u]),$=h.useMemo(()=>(Math.max(1,d||1)-1)*u,[d,u]);h.useEffect(()=>{d<1&&g&&g(1)},[d,g]);const P=D=>{const{active:w,over:C}=D;if(!C||w.id===C.id)return;const j=k.findIndex(z=>z.id===w.id),E=k.findIndex(z=>z.id===C.id),L=wt(k,j,E);ni(L)},H=r&&!i,B=i&&!r,A=!r&&!i&&_.length===0,Y=k.length?k:n,N=h.useMemo(()=>Qs(_,Y),[_,Y]);return console.log("formattedRows",N),console.log("columnOrder",k),s.jsx(ur,{collisionDetection:Kn,onDragEnd:P,children:s.jsx(gr,{items:k.map(D=>D.id),strategy:Ts,children:s.jsxs(a.Box,{flex:"1",minH:0,display:"flex",flexDirection:"column",p:2,children:[s.jsxs(a.Box,{flex:"1",minH:0,position:"relative",overflowX:"auto",overflowY:"auto",children:[H&&s.jsx(a.Box,{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,bg:"whiteAlpha.600",children:o??s.jsx(a.Spinner,{})}),s.jsxs(a.Table.Root,{variant:"outline",w:"100%",size:v,tableLayout:"fixed",minW:"max-content",children:[s.jsx(Zi,{}),B?s.jsx(va,{rows:u,columns:n.length+(l?2:0)}):A?s.jsx(a.Table.Body,{children:s.jsx(a.Table.Row,{children:s.jsx(a.Table.Cell,{colSpan:n.length+(l?1:0),children:s.jsx(a.Box,{display:"flex",alignItems:"center",justifyContent:"center",minH:"200px",color:"gray.500",children:c})})})}):s.jsx(ma,{data:N,actions:l,actionConfig:x,onRowSelect:S,startIndex:$,onRowSelectEvent:O})]},e)]}),s.jsx(a.Box,{mt:.5,children:s.jsx(da,{totalCount:p,pageSize:u,currentPage:d,onPageChange:g,onPageSizeChange:D=>{f?.(D),d>1&&g?.(1)},pageSizeOptions:b})})]})})})}const ne=[];for(let e=0;e<256;++e)ne.push((e+256).toString(16).slice(1));function ba(e,t=0){return(ne[e[t+0]]+ne[e[t+1]]+ne[e[t+2]]+ne[e[t+3]]+"-"+ne[e[t+4]]+ne[e[t+5]]+"-"+ne[e[t+6]]+ne[e[t+7]]+"-"+ne[e[t+8]]+ne[e[t+9]]+"-"+ne[e[t+10]]+ne[e[t+11]]+ne[e[t+12]]+ne[e[t+13]]+ne[e[t+14]]+ne[e[t+15]]).toLowerCase()}let zt;const ya=new Uint8Array(16);function Sa(){if(!zt){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");zt=crypto.getRandomValues.bind(crypto)}return zt(ya)}const wa=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Fn={randomUUID:wa};function Ca(e,t,n){e=e||{};const r=e.random??e.rng?.()??Sa();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,ba(r)}function Da(e,t,n){return Fn.randomUUID&&!e?Fn.randomUUID():Ca(e)}const ja=y(a.Checkbox.Root),Ra=y(a.Checkbox.HiddenInput),Ma=y(a.Checkbox.Control),Ea=y(a.Checkbox.Label),Tr=({value:e,onChange:t,size:n="sm",label:r,helperText:o,isDisabled:i,required:c,errorText:l})=>s.jsxs(ja,{value:e,onChange:t,size:n,children:[s.jsx(Ra,{}),s.jsx(Ma,{disabled:i,required:c,errorText:l,helperText:o}),r&&s.jsx(Ea,{children:r})]}),Ta=y(a.Combobox.Root),_a=y(a.Combobox.Control),Oa=y(a.Combobox.Input),ka=y(a.Combobox.IndicatorGroup),Ia=y(a.Combobox.ClearTrigger),$a=y(a.Combobox.Trigger),Aa=y(a.Combobox.Positioner),La=y(a.Combobox.Content);function _r({label:e,size:t="sm",width:n="100%",variant:r="outline",items:o=[],itemToString:i,itemToValue:c,renderItem:l,value:d,loading:u,error:g,errorMessage:f,placeholder:v,helpText:p,onInputChange:x,onSelect:b,visible:S=!0,rootProps:O,inputProps:R,controlProps:M,contentProps:I,itemProps:k}){const[_,$]=h.useState(""),P=h.useMemo(()=>Array.isArray(o)?o:[],[o]),{collection:H,set:B}=a.useListCollection({initialItems:P,itemToString:i,itemToValue:c}),A=h.useMemo(()=>{if(!_)return P;const Y=_.toLowerCase();return P.filter(N=>i(N).toLowerCase().includes(Y))},[o,_,i]);return h.useEffect(()=>{B(A)},[A,B]),h.useEffect(()=>{d&&$(i(d))},[d,i]),s.jsxs(Ta,{width:n,size:t,variant:r,collection:H,placeholder:v,onInputValueChange:Y=>{x?.(Y.inputValue),$(Y.inputValue)},value:d?[c(d)]:[],onValueChange:Y=>{const N=Y.value?.[0];if(!N)return;const D=H.items.find(w=>c(w)===N);D&&b?.(D)},positioning:{sameWidth:!1,placement:"bottom-start"},...O,children:[S&&e&&s.jsx(a.Text,{fontSize:"sm",children:e}),s.jsxs(_a,{...M,children:[s.jsx(Oa,{placeholder:v??"Type to search",...R}),s.jsxs(ka,{children:[s.jsx(Ia,{}),s.jsx($a,{})]})]}),s.jsx(Aa,{children:s.jsxs(La,{minW:"sm",...I,children:[u?s.jsxs(a.HStack,{p:"2",children:[s.jsx(a.Spinner,{size:"xs",borderWidth:"1px"}),s.jsx(a.Span,{children:"Loading..."})]}):g?s.jsx(a.Text,{p:"2",color:"red.500",fontSize:"sm",children:f||"Something went wrong"}):H.items.map(Y=>s.jsxs(a.Combobox.Item,{item:Y,...k,children:[l(Y),s.jsx(a.Combobox.ItemIndicator,{})]},c(Y))),p&&!g&&!u&&s.jsx(a.Text,{p:"2",color:"fg.muted",fontSize:"sm",children:p})]})})]})}const Pa=y(a.Popover.Root),za=y(a.Popover.Content),Na=y(a.Popover.Arrow),Fa=y(a.Popover.Trigger),Ya=y(a.Popover.Positioner);function Re(e){if(!e)return"";const t=String(e.getDate()).padStart(2,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=e.getFullYear();return`${t}-${n}-${r}`}function Yn(e){const t=e.split(/\s+to\s+/i),n=t[0],r=t[1],o=l=>{if(!l)return null;const d=l.trim().split("-");if(d.length!==3)return null;const[u,g,f]=d,v=parseInt(u),p=parseInt(g)-1,x=parseInt(f);if(isNaN(v)||isNaN(p)||isNaN(x)||f.length!==4)return null;const b=new Date(x,p,v);return b.getDate()===v&&b.getMonth()===p?b:null},i=o(n),c=o(r);return{start:i,end:c}}function Or({startDate:e,endDate:t,onChange:n,width:r="280px",showLabel:o=!0,label:i="Select date range",visible:c=!0}){const[l,d]=h.useState(!1),[u,g]=h.useState(e||new Date),[f,v]=h.useState(null),[p,x]=h.useState(e||null),[b,S]=h.useState(t||null),O=(Y,N)=>Y&&N?`${Re(Y)} to ${Re(N)}`:Y?`${Re(Y)}`:"",[R,M]=h.useState(O(e,t));h.useEffect(()=>{x(e||null),S(t||null)},[e,t]);const I=new Date(u.getFullYear(),u.getMonth()+1,0).getDate(),k=new Date(u.getFullYear(),u.getMonth(),1).getDay(),_=()=>{g(new Date(u.getFullYear(),u.getMonth()-1,1))},$=()=>{g(new Date(u.getFullYear(),u.getMonth()+1,1))},P=Y=>{const N=new Date(u.getFullYear(),u.getMonth(),Y);if(!p||p&&b){x(N),S(null),n(N,null),M(Re(N));return}if(p&&!b){const D=N<p?N:p,w=N<p?p:N;x(D),S(w),n(D,w),M(`${Re(D)} to ${Re(w)}`),d(!1)}},H=Y=>{const N=Y.target.value;M(N);const{start:D,end:w}=Yn(N);if(D&&w){const C=D<w?D:w,j=D<w?w:D;n(C,j),g(C)}else D&&!N.toLowerCase().includes("to")&&n(D,null)},B=Y=>{if(Y.key!=="Enter")return;const{start:N,end:D}=Yn(R);if(N&&!D&&!R.toLowerCase().includes("to")){const w=`${Re(N)} to `;M(w),x(N),S(null),n(N,null),requestAnimationFrame(()=>{Y.target.setSelectionRange(w.length,w.length)});return}if(N&&D){const w=N<D?N:D,C=N<D?D:N;x(w),S(C),n(w,C),d(!1)}},A=()=>{x(null),S(null),M(""),n(null,null)};return s.jsxs(a.Box,{width:r,onKeyDown:B,children:[o&&!c&&s.jsx(a.Text,{fontSize:"xs",color:"fg.muted",mb:1,fontWeight:"medium",children:i}),s.jsxs(Pa,{open:l,onOpenChange:Y=>d(Y.open),positioning:{placement:"bottom-start",gutter:4},children:[s.jsxs(a.Group,{attached:!0,w:"full",position:"relative",children:[s.jsx(a.Input,{placeholder:"DD-MM-YYYY to DD-MM-YYYY",value:R,onChange:H,size:"sm",autoComplete:"off"}),R&&s.jsx(a.IconButton,{size:"xs",variant:"ghost","aria-label":"Clear date",onClick:A,position:"absolute",right:"32px",top:"50%",transform:"translateY(-50%)",children:s.jsx(Er,{size:14})}),s.jsx(Fa,{asChild:!0,children:s.jsx(a.InputAddon,{cursor:"pointer",px:2,_hover:{bg:"gray.100"},transition:"background 0.2s",children:s.jsx(jr,{size:16})})})]}),s.jsx(Ya,{children:s.jsxs(za,{width:"300px",p:4,boxShadow:"xl",zIndex:1e3,borderRadius:"md",outline:"none",children:[s.jsx(Na,{}),s.jsxs(a.HStack,{justify:"space-between",mb:4,children:[s.jsx(a.IconButton,{size:"xs",variant:"ghost",onClick:_,"aria-label":"Previous month",children:"‹"}),s.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:u.toLocaleString("default",{month:"long",year:"numeric"})}),s.jsx(a.IconButton,{size:"xs",variant:"ghost",onClick:$,"aria-label":"Next month",children:"›"})]}),s.jsxs(a.Grid,{templateColumns:"repeat(7, 1fr)",gap:1,textAlign:"center",children:[["S","M","T","W","T","F","S"].map((Y,N)=>s.jsx(a.Text,{fontSize:"xs",fontWeight:"bold",color:"fg.subtle",py:1,children:Y},`${Y}-${N}`)),Array(k).fill(null).map((Y,N)=>s.jsx(a.Box,{},`empty-${N}`)),Array.from({length:I},(Y,N)=>{const D=N+1,w=new Date(u.getFullYear(),u.getMonth(),D);let C=e,j=t;if(C&&j&&f)if(e&&t){const W=e.getTime()+(t.getTime()-e.getTime())/2;f.getTime()<=W?C=f:j=f,C>j&&([C,j]=[j,C])}else e&&!t&&(C=f<e?f:e,j=f<e?e:f);const E=C&&w.getTime()===C.getTime(),L=j&&w.getTime()===j.getTime(),z=C&&j&&w>C&&w<j;let m="transparent",T="gray";E||L?T="blue":z&&(m="blue.100");let F="md";return z&&(F="0"),E&&j&&(F=L?"md":"md 0 0 md"),L&&C&&(F=E?"md":"0 md md 0"),s.jsx(a.Button,{size:"xs",variant:"ghost",colorPalette:T,bg:m!=="transparent"?m:void 0,onClick:()=>P(D),onMouseEnter:()=>v(w),onMouseLeave:()=>v(null),minW:"32px",h:"32px",fontSize:"xs",borderRadius:F,_hover:{bg:E||L?void 0:"gray.100"},children:D},D)})]}),s.jsx(a.Text,{fontSize:"10px",color:"fg.muted",mt:3,textAlign:"center",children:"Select Start Date then End Date"})]})})]})]})}const Ba=y(a.Popover.Root),Wa=y(a.Popover.Content),Va=y(a.Popover.Arrow),Ha=y(a.Popover.Trigger),Ua=y(a.Popover.Positioner);function Bn(e){if(!e)return"";const t=String(e.getDate()).padStart(2,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=e.getFullYear();return`${t}-${n}-${r}`}function Ga(e){const t=e.split("-");if(t.length!==3)return null;const[n,r,o]=t,i=parseInt(n),c=parseInt(r)-1,l=parseInt(o);if(isNaN(i)||isNaN(c)||isNaN(l)||o.length!==4)return null;const d=new Date(l,c,i);return d.getDate()===i&&d.getMonth()===c?d:null}function kr({value:e,onChange:t,width:n="220px",visible:r=!0,label:o="Select date"}){const[i,c]=h.useState(!1),[l,d]=h.useState(e||new Date),[u,g]=h.useState(Bn(e));h.useEffect(()=>{g(Bn(e))},[e]);const f=new Date(l.getFullYear(),l.getMonth()+1,0).getDate(),v=new Date(l.getFullYear(),l.getMonth(),1).getDay(),p=()=>{d(new Date(l.getFullYear(),l.getMonth()-1,1))},x=()=>{d(new Date(l.getFullYear(),l.getMonth()+1,1))},b=R=>{const M=new Date(l.getFullYear(),l.getMonth(),R);t(M),c(!1)},S=R=>{if(i)switch(R.key){case"ArrowLeft":p();break;case"ArrowRight":x();break;case"Escape":c(!1);break}},O=()=>{g(""),t(null)};return s.jsxs(a.Box,{width:n,onKeyDown:S,children:[!r&&s.jsx(a.Text,{fontSize:"xs",color:"fg.muted",mb:1,fontWeight:"medium",children:o}),s.jsxs(Ba,{open:i,onOpenChange:R=>c(R.open),positioning:{placement:"bottom-start",gutter:4},children:[s.jsxs(a.Group,{attached:!0,w:"full",position:"relative",children:[u&&s.jsx(a.IconButton,{size:"xs",variant:"ghost","aria-label":"Clear date",onClick:O,position:"absolute",right:"32px",top:"50%",transform:"translateY(-50%)",zIndex:1,children:s.jsx(Er,{size:14})}),s.jsx(a.Input,{placeholder:"DD-MM-YYYY",value:u,onChange:R=>{const M=R.target.value;g(M);const I=Ga(M);I&&(t(I),d(I))},size:"sm",autoComplete:"off"}),s.jsx(Ha,{asChild:!0,children:s.jsx(a.InputAddon,{cursor:"pointer",px:2,_hover:{bg:"gray.100"},transition:"background 0.2s",children:s.jsx(jr,{size:16})})})]}),s.jsx(Ua,{children:s.jsxs(Wa,{width:"300px",p:4,boxShadow:"xl",zIndex:1e3,borderRadius:"md",outline:"none",children:[s.jsx(Va,{}),s.jsxs(a.HStack,{justify:"space-between",mb:4,children:[s.jsx(a.IconButton,{size:"xs",variant:"ghost",onClick:p,"aria-label":"Previous month",children:"‹"}),s.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:l.toLocaleString("default",{month:"long",year:"numeric"})}),s.jsx(a.IconButton,{size:"xs",variant:"ghost",onClick:x,"aria-label":"Next month",children:"›"})]}),s.jsxs(a.Grid,{templateColumns:"repeat(7, 1fr)",gap:1,textAlign:"center",children:[["S","M","T","W","T","F","S"].map((R,M)=>s.jsx(a.Text,{fontSize:"xs",fontWeight:"bold",color:"fg.subtle",py:1,children:R},`${R}-${M}`)),Array(v).fill(null).map((R,M)=>s.jsx(a.Box,{},`empty-${M}`)),Array.from({length:f},(R,M)=>{const I=M+1,k=e&&e.getDate()===I&&e.getMonth()===l.getMonth()&&e.getFullYear()===l.getFullYear();return s.jsx(a.Button,{size:"xs",variant:k?"solid":"ghost",colorPalette:k?"blue":"gray",onClick:()=>b(I),minW:"32px",h:"32px",fontSize:"xs",borderRadius:"md",children:I},I)})]}),s.jsx(a.Text,{fontSize:"10px",color:"fg.muted",mt:3,textAlign:"center",children:"Use Arrow Keys to change months • Esc to close"})]})})]})]})}const qa=y(a.Field.Root),Xa=y(a.Field.Label),Ka=y(a.Field.HelperText),Ja=y(a.Field.ErrorText),Gt=({icon:e,value:t,onChange:n,placeholder:r,size:o="xs",variant:i="outline",width:c="100%",label:l,helperText:d,isDisabled:u=!1,required:g=!1,errorText:f,visible:v,type:p="text",min:x=0,max:b=100,step:S=1})=>s.jsxs(qa,{width:c,children:[v&&s.jsx(Xa,{children:l}),s.jsx(a.InputGroup,{startElement:e,children:s.jsx(a.Input,{value:t,onChange:O=>n?.(O.target.value),placeholder:r,size:o,type:p,variant:i,disabled:u,required:g,min:x,max:b,step:S})}),f&&s.jsx(Ja,{fontSize:"xs",children:f}),d&&s.jsx(Ka,{fontSize:"xs",children:d})]}),Za=y(a.Field.Root),Qa=y(a.Field.HelperText),el=y(a.Field.ErrorText),tl=y(a.Select.Root),nl=y(a.Select.Label),rl=y(a.Select.Control),ol=y(a.Select.Trigger),sl=y(a.Select.ValueText),il=y(a.Select.IndicatorGroup),al=y(a.Select.Indicator),ll=y(a.Select.Content),cl=y(a.Select.Item),ul=y(a.Select.ItemIndicator),dl=y(a.Select.HiddenSelect),fl=y(a.Select.Positioner),Ir=({options:e=[],label:t,value:n,onChange:r,placeholder:o,size:i="xs",width:c="100%",variant:l="outline",helperText:d,isDisabled:u,required:g,errorText:f,visible:v})=>{const p=h.useMemo(()=>a.createListCollection({items:e}),[e]),x=e.find(S=>S.value===n),b=S=>{S.preventDefault(),S.stopPropagation(),r?.(void 0)};return s.jsxs(Za,{disabled:u,required:g,children:[s.jsxs(tl,{collection:p,variant:l,size:i,width:c,value:n?[n]:[],onValueChange:S=>{r?.(S.value[0])},children:[s.jsx(dl,{}),v&&s.jsx(nl,{children:t}),s.jsxs(rl,{children:[s.jsx(ol,{children:s.jsx(sl,{placeholder:o,children:x?.displayValue??x?.label})}),s.jsxs(il,{children:[n&&!u&&s.jsx("div",{style:{pointerEvents:"auto",display:"flex",alignItems:"center"},onPointerDown:S=>S.stopPropagation(),onClick:S=>S.stopPropagation(),children:s.jsx(a.CloseButton,{size:"sm",variant:"ghost",onPointerDown:b,onClick:b,position:"relative",zIndex:10})}),s.jsx(al,{})]})]}),s.jsx(fl,{children:s.jsx(ll,{children:p.items.map((S,O)=>s.jsxs(cl,{item:S,children:[S.label,s.jsx(ul,{})]},O))})})]}),d&&s.jsx(Qa,{children:d}),f&&s.jsx(el,{children:f})]})},hl="FILTER_PRESETS_",$r=e=>`${hl}${e}`,Dt=e=>{if(typeof window>"u")return[];const t=localStorage.getItem($r(e));try{return t?JSON.parse(t):[]}catch(n){return console.error("Failed to parse presets",n),[]}},sn=(e,t)=>{typeof window>"u"||(localStorage.setItem($r(e),JSON.stringify(t)),window.dispatchEvent(new Event("storage_updated")))},Ar=(e,t)=>{const n=Dt(e);sn(e,[t,...n])},Lr=(e,t)=>{const n=Dt(e).filter(r=>r.id!==t);sn(e,n)},gl=y(a.Checkbox.Root),pl=y(a.Checkbox.HiddenInput),ml=y(a.Checkbox.Control),vl=y(a.Slider.Root),xl=y(a.Slider.Track),bl=y(a.Slider.Range),yl=y(a.Slider.Thumbs),Sl=y(a.Slider.Control),wl=({filter:e,onVisibilityChange:t,onSizeChange:n})=>{const{attributes:r,listeners:o,setNodeRef:i,transform:c,transition:l}=mr({id:e.id}),d={transform:Ie.Transform.toString(c),transition:l};return s.jsxs(a.VStack,{ref:i,style:d,align:"stretch",border:"1px solid",borderColor:"gray.200",rounded:"md",p:3,mb:3,bg:"white",children:[s.jsxs(a.HStack,{...r,...o,cursor:"grab",userSelect:"none",gap:2,children:[s.jsx(Rr,{size:16}),s.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:e.label||e.id})]}),s.jsxs(a.HStack,{justify:"space-between",children:[s.jsx(a.Text,{fontSize:"sm",children:"Visible"}),s.jsxs(gl,{checked:e.visible,size:"sm",onCheckedChange:u=>t?.(e.id,!!u.checked),children:[s.jsx(pl,{}),s.jsx(ml,{})]})]}),s.jsxs(a.VStack,{align:"stretch",gap:1,children:[s.jsx(a.Text,{fontSize:"sm",children:"Size"}),s.jsx(vl,{min:1,max:5,step:.5,value:[e.size??1],onValueChange:u=>n?.(e.id,u.value[0]),children:s.jsxs(Sl,{children:[s.jsx(xl,{children:s.jsx(bl,{})}),s.jsx(yl,{})]})})]})]})},Cl=y(a.Drawer.Root),Dl=y(a.Drawer.Trigger),jl=y(a.Drawer.Backdrop),Rl=y(a.Drawer.Positioner),Ml=y(a.Drawer.Content),El=y(a.Drawer.Header),Tl=y(a.Drawer.Title),_l=y(a.Drawer.Body),Ol=y(a.Drawer.Footer),kl=y(a.Drawer.CloseTrigger),Il=y(a.Tabs.Root),$l=y(a.Tabs.List),Nt=y(a.Tabs.Trigger),Ft=y(a.Tabs.Content),Pr=(e,t)=>{if(e.customComponent)return e.customComponent;switch(e.type){case"text":return s.jsx(Gt,{placeholder:e.label,value:e.value,onChange:e.onChange,label:e.label,visible:t});case"number":return s.jsx(Gt,{label:e.label,value:e.value,onChange:e.onChange});case"checkbox":return s.jsx(Tr,{label:e.label,value:e.value,onChange:e.onChange});case"select":return s.jsx(Ir,{label:e.label,value:e.value,onChange:e.onChange,options:e.options??[],visible:t,placeholder:e.placeholder});case"date":return s.jsx(kr,{value:e.value,onChange:e.onChange,visible:t,label:e.label});case"date-range":return s.jsx(Or,{startDate:e.startDate?new Date(e.startDate):void 0,endDate:e.endDate?new Date(e.endDate):void 0,onChange:e.onChange,visible:t,label:e.label});case"combobox":return s.jsx(_r,{visible:!0,label:e.label,itemToString:n=>String(n.label),itemToValue:n=>n.value,renderItem:n=>s.jsx("span",{children:n.label})});default:return null}},Al=({filterDrawerSize:e="sm",onVisibilityChange:t,onSizeChange:n,onClear:r,filters:o,pageKey:i="default",onLoadPreset:c,activePresetName:l,onReorder:d,open:u,onOpenChange:g})=>{const[f,v]=h.useState([]);h.useEffect(()=>{const x=()=>{v(Dt(i))};return x(),window.addEventListener("storage",x),window.addEventListener("storage_updated",x),()=>{window.removeEventListener("storage",x),window.removeEventListener("storage_updated",x)}},[i]);const p=()=>{const x=prompt("Preset name?");if(!x)return;const b=o.reduce((S,O)=>(S[O.id]=O.value,S),{});Ar(i,{id:Da(),name:x,date:new Date().toISOString(),values:b})};return s.jsx(a.HStack,{wrap:"wrap",children:s.jsxs(Cl,{size:e,open:u,onOpenChange:g,children:[s.jsx(Dl,{asChild:!0,children:s.jsxs(a.IconButton,{"aria-label":"Open filters",variant:"outline",size:"xs",ml:2,p:2,children:[s.jsx(Ii,{size:16}),"Filters"]})}),s.jsxs(a.Portal,{children:[s.jsx(jl,{}),s.jsx(Rl,{children:s.jsxs(Ml,{children:[s.jsx(El,{children:s.jsx(Tl,{children:"Filters"})}),s.jsx(_l,{overflowY:"auto",pt:1,children:s.jsxs(Il,{defaultValue:"view",children:[s.jsxs($l,{mb:4,children:[s.jsxs(Nt,{value:"view",children:[s.jsx(Li,{size:16}),"Edit"]}),s.jsxs(Nt,{value:"settings",children:[s.jsx(Fi,{size:16}),"Settings"]}),s.jsxs(Nt,{value:"presets",children:[s.jsx(yi,{size:16}),"Presets"]})]}),s.jsx(Ft,{value:"view",children:o.filter(x=>x.visible).map(x=>s.jsx(a.VStack,{align:"stretch",border:"1px solid",borderColor:"gray.200",flex:x.size??1,minW:`${(x.size??1)*100}px`,rounded:"md",p:3,mb:3,children:Pr(x,u)},x.id))}),s.jsx(Ft,{value:"settings",children:s.jsx(ur,{sensors:mo(po(on)),collisionDetection:Kn,onDragEnd:({active:x,over:b})=>{if(!b||x.id===b.id)return;const S=o.findIndex(M=>M.id===x.id),O=o.findIndex(M=>M.id===b.id),R=wt(o,S,O);d?.(R)},children:s.jsx(gr,{items:o.map(x=>x.id),strategy:Os,children:o.map(x=>s.jsx(wl,{filter:x,onVisibilityChange:t,onSizeChange:n},x.id))})})}),s.jsx(Ft,{value:"presets",children:s.jsxs(a.VStack,{align:"stretch",mb:3,children:[f.length===0&&s.jsx(a.Text,{fontSize:"xs",color:"gray.500",children:"No presets saved yet."}),f.map(x=>s.jsxs(a.HStack,{justify:"space-between",border:"1px solid",borderColor:l===x.name?"blue.300":"gray.200",rounded:"md",p:2,children:[s.jsxs(a.VStack,{align:"start",gap:0,children:[s.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:x.name}),s.jsx(a.Text,{fontSize:"xs",color:"gray.500",children:new Date(x.date).toLocaleDateString()})]}),s.jsxs(a.HStack,{children:[s.jsx(a.Button,{size:"xs",variant:"ghost",onClick:()=>{const b=o.map(S=>({...S,value:x.values[S.id]??S.value}));c?.(b,x.name)},children:"Load"}),s.jsx(a.IconButton,{size:"xs","aria-label":"Delete preset",variant:"ghost",onClick:()=>Lr(i,x.id),children:s.jsx(Ti,{size:14})})]})]},x.id)),s.jsx(a.Button,{size:"sm",colorScheme:"blue",onClick:p,children:"Save Current Filters"})]})})]})}),s.jsx(Ol,{justify:"space-between",children:s.jsx(kl,{asChild:!0,children:s.jsx(a.CloseButton,{})})})]})})]})]})})},Ll=({title:e,filters:t,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:i,maxToolbarUnits:c,pageKey:l,onLoadPreset:d,activePresetName:u,filterDrawerSize:g="sm"})=>{const[f,v]=h.useState(!1);return s.jsxs(a.HStack,{wrap:"wrap",pl:2,pr:2,width:"100%",justify:"space-between",children:[e,s.jsxs(a.HStack,{gapX:1,children:[t.filter(p=>p.visible!==!1).map(p=>s.jsx(a.HStack,{flex:p.size??1,minW:`${(p.size??1)*100}px`,alignItems:"center",children:Pr(p)},p.id)),s.jsx(Al,{filterDrawerSize:g,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:i,maxToolbarUnits:c,pageKey:l,filters:t,onLoadPreset:d,activePresetName:u,open:f,onOpenChange:p=>{v(p.open)}})]})]})},Pl=(e,t)=>{localStorage.setItem(`FILTER_ORDER_${e}`,JSON.stringify(t))},zl=e=>{try{return JSON.parse(localStorage.getItem(`FILTER_ORDER_${e}`)||"[]")}catch{return[]}},Nl=({onClick:e,size:t="xs",variant:n="solid",label:r,leftIcon:o,rightIcon:i,isDisabled:c,colorScheme:l,loading:d,loadingText:u,rounded:g,type:f="button",textColor:v="white",borderColor:p})=>s.jsx(a.Button,{onClick:e,size:t,variant:n,disabled:c,loading:d,loadingText:u,rounded:g,type:f,background:l,color:v,border:p,children:s.jsxs(a.HStack,{gap:1,children:[o,r,i]})}),Fl=y(a.Dialog.Root),Yl=y(a.Dialog.Backdrop),Bl=y(a.Dialog.Positioner),Wl=y(a.Dialog.Content),Vl=y(a.Dialog.Header),Hl=y(a.Dialog.Body),Ul=y(a.Dialog.Footer),Gl=y(a.Dialog.Title),ql=y(a.Dialog.CloseTrigger);function Xl({open:e,onClose:t,onConfirm:n,title:r="Confirm Action",description:o="Are you sure you want to continue?",confirmLabel:i="Confirm",cancelLabel:c="Cancel",icon:l,isLoading:d=!1,confirmButtonColorScheme:u="#4169e1"}){return s.jsx(Fl,{open:e,placement:"center",onOpenChange:g=>!g.open&&t(),children:s.jsxs(a.Portal,{children:[s.jsx(Yl,{}),s.jsx(Bl,{children:s.jsxs(Wl,{maxW:"480px",children:[s.jsx(Vl,{borderBottom:"1px solid",borderColor:"gray.200",children:s.jsx(Gl,{children:r})}),s.jsx(Hl,{p:6,children:s.jsxs(a.Stack,{gap:4,align:"center",textAlign:"center",children:[s.jsx(a.Box,{color:"orange.500",children:l??s.jsx(Mr,{size:40})}),s.jsx(a.Text,{fontSize:"sm",color:"gray.600",children:o})]})}),s.jsxs(Ul,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"gray.200",children:[s.jsx(a.Button,{variant:"outline",size:"sm",onClick:t,children:c}),s.jsx(a.Button,{size:"sm",style:{backgroundColor:u},loading:d,onClick:n,children:i})]}),s.jsx(ql,{asChild:!0,children:s.jsx(a.CloseButton,{size:"sm"})})]})})]})})}const Kl=y(a.Dialog.Root),Jl=y(a.Dialog.Backdrop),Zl=y(a.Dialog.Positioner),Ql=y(a.Dialog.Content),ec=y(a.Dialog.Header),tc=y(a.Dialog.Body),nc=y(a.Dialog.Footer),rc=y(a.Dialog.Title),oc=y(a.Dialog.CloseTrigger);function sc({open:e,onClose:t,onConfirm:n,title:r="Delete Company",entityName:o,confirmText:i="DELETE",confirmLabel:c="Delete",isLoading:l=!1}){const[d,u]=h.useState(""),g=d===i;return s.jsx(Kl,{open:e,placement:"center",onOpenChange:f=>{!f.open&&t(),u("")},children:s.jsxs(a.Portal,{children:[s.jsx(Jl,{}),s.jsx(Zl,{children:s.jsxs(Ql,{maxW:"550px",children:[s.jsx(ec,{borderBottom:"1px solid",borderColor:"#d3d3d3",children:s.jsx(rc,{color:"red.600",children:r})}),s.jsx(tc,{p:2,style:{padding:"16px"},children:s.jsxs(a.Stack,{gap:4,borderRadius:"md",p:4,bg:"white",children:[s.jsx(a.Box,{border:"1px solid",borderColor:"red.200",bg:"red.50",borderRadius:"md",p:4,children:s.jsxs(a.Stack,{direction:"row",gap:3,align:"flex-start",children:[s.jsx(a.Box,{color:"red.600",mt:"2px",children:s.jsx(Mr,{size:20})}),s.jsxs(a.Box,{children:[s.jsx(a.Text,{fontWeight:"semibold",color:"red.700",children:"Are you sure?"}),s.jsxs(a.Text,{fontSize:"sm",color:"red.600",children:["All the data of ",s.jsx("b",{children:o})," will permanently be deleted."]})]})]})}),s.jsx(a.Text,{fontSize:"sm",color:"gray.600",children:"You can’t undo this action afterwards."}),s.jsxs(a.Box,{children:[s.jsxs(a.Text,{fontSize:"sm",mb:2,children:["Type ",s.jsx("b",{children:i})," to continue"]}),s.jsx(a.Input,{placeholder:`Type ${i} here`,value:d,onChange:f=>u(f.target.value),size:"xs"})]})]})}),s.jsxs(nc,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"#d3d3d3",children:[s.jsx(a.Button,{variant:"outline",size:"sm",onClick:()=>{t(),u("")},children:"Cancel"}),s.jsx(a.Button,{size:"sm",disabled:!g,style:{backgroundColor:"#FF0000"},loading:l,onClick:n,children:c})]}),s.jsx(oc,{asChild:!0,children:s.jsx(a.CloseButton,{size:"sm"})})]})})]})})}const zr=({children:e})=>s.jsx(s.Fragment,{children:e}),Nr=({children:e})=>s.jsx(s.Fragment,{children:e}),ic=a.Button,ac=y(a.Dialog.Root),lc=y(a.Dialog.Backdrop),cc=y(a.Dialog.Positioner),uc=y(a.Dialog.Content),dc=y(a.Dialog.Header),fc=y(a.Dialog.Body),hc=y(a.Dialog.Footer),gc=y(a.Dialog.Title),pc=y(a.Dialog.CloseTrigger);function mc(e){let t=null,n=null;return h.Children.forEach(e,r=>{h.isValidElement(r)&&(r.type===zr&&(t=r.props.children),r.type===Nr&&(n=r.props.children))}),{body:t,actions:n}}const vc=({open:e,onClose:t,title:n,children:r,width:o,position:i,refetch:c,loading:l=!1})=>{const{body:d,actions:u}=mc(r);return s.jsx(ac,{open:e,onOpenChange:g=>!g.open&&t(),placement:i??"center",children:s.jsxs(a.Portal,{children:[s.jsx(lc,{bg:"blackAlpha.400"}),s.jsx(cc,{children:s.jsxs(uc,{w:o??"560px",maxW:o??"560px",borderRadius:"6px",overflow:"hidden",boxShadow:"lg",children:[s.jsx(dc,{px:"20px",py:"16px",bg:"white",borderBottom:"1px solid",borderColor:"gray.200",children:s.jsxs(a.Flex,{align:"center",justify:"space-between",children:[s.jsx(gc,{fontSize:"16px",fontWeight:"600",children:n}),s.jsx(pc,{asChild:!0,children:s.jsx(a.CloseButton,{size:"sm"})}),c&&s.jsx(an,{label:"Refresh",refetch:c,isLoading:l})]})}),d&&s.jsx(fc,{px:"20px",py:"16px",bg:"#F8FAFC",type:"submit",children:s.jsx(a.Flex,{direction:"column",gap:"16px",children:d})}),u&&s.jsx(hc,{px:"20px",py:"16px",bg:"white",borderTop:"1px solid",borderColor:"gray.200",children:s.jsx(a.Flex,{ml:"auto",gap:"12px",children:u})})]})})]})})},xc=y(a.Field.Root),bc=y(a.Field.Label),yc=y(a.Field.HelperText),Sc=y(a.Field.ErrorText),wc=y(a.PinInput.Input),Cc=y(a.PinInput.Control),Dc=y(a.PinInput.HiddenInput),jc=y(a.PinInput.Root),Rc=({value:e,onChange:t,length:n=4,size:r="xs",isDisabled:o=!1,label:i,helperText:c,errorText:l,required:d=!1,visible:u=!0})=>{const g=Array.from({length:n}).map((f,v)=>e?.[v]??"");return s.jsxs(xc,{children:[u&&i&&s.jsxs(bc,{children:[i,d&&" *"]}),s.jsxs(jc,{value:g,onValueChange:f=>t?.(f.value.join("")),disabled:o,size:r,children:[s.jsx(Dc,{}),s.jsx(Cc,{children:s.jsx(a.HStack,{children:Array.from({length:n}).map((f,v)=>s.jsx(wc,{index:v},v))})})]}),l&&s.jsx(Sc,{fontSize:"xs",children:l}),c&&!l&&s.jsx(yc,{fontSize:"xs",children:c})]})};function an({refetch:e,isLoading:t=!1,label:n="Refresh"}){const[r,o]=h.useState(!1),i=async()=>{o(!0);try{await e()}finally{setTimeout(()=>o(!1),300)}};return s.jsx(a.IconButton,{"aria-label":n,size:"xs",variant:"outline",disabled:t||r,onClick:i,ml:2,children:s.jsx(zi,{size:14,style:{animation:r?"spin 0.6s linear infinite":void 0}})})}var ct={exports:{}},Mc=ct.exports,Wn;function Ec(){return Wn||(Wn=1,(function(e,t){(function(n,r){e.exports=r()})(Mc,(function(){var n=1e3,r=6e4,o=36e5,i="millisecond",c="second",l="minute",d="hour",u="day",g="week",f="month",v="quarter",p="year",x="date",b="Invalid Date",S=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,O=/\[([^\]]+)]|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,R={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(D){var w=["th","st","nd","rd"],C=D%100;return"["+D+(w[(C-20)%10]||w[C]||w[0])+"]"}},M=function(D,w,C){var j=String(D);return!j||j.length>=w?D:""+Array(w+1-j.length).join(C)+D},I={s:M,z:function(D){var w=-D.utcOffset(),C=Math.abs(w),j=Math.floor(C/60),E=C%60;return(w<=0?"+":"-")+M(j,2,"0")+":"+M(E,2,"0")},m:function D(w,C){if(w.date()<C.date())return-D(C,w);var j=12*(C.year()-w.year())+(C.month()-w.month()),E=w.clone().add(j,f),L=C-E<0,z=w.clone().add(j+(L?-1:1),f);return+(-(j+(C-E)/(L?E-z:z-E))||0)},a:function(D){return D<0?Math.ceil(D)||0:Math.floor(D)},p:function(D){return{M:f,y:p,w:g,d:u,D:x,h:d,m:l,s:c,ms:i,Q:v}[D]||String(D||"").toLowerCase().replace(/s$/,"")},u:function(D){return D===void 0}},k="en",_={};_[k]=R;var $="$isDayjsObject",P=function(D){return D instanceof Y||!(!D||!D[$])},H=function D(w,C,j){var E;if(!w)return k;if(typeof w=="string"){var L=w.toLowerCase();_[L]&&(E=L),C&&(_[L]=C,E=L);var z=w.split("-");if(!E&&z.length>1)return D(z[0])}else{var m=w.name;_[m]=w,E=m}return!j&&E&&(k=E),E||!j&&k},B=function(D,w){if(P(D))return D.clone();var C=typeof w=="object"?w:{};return C.date=D,C.args=arguments,new Y(C)},A=I;A.l=H,A.i=P,A.w=function(D,w){return B(D,{locale:w.$L,utc:w.$u,x:w.$x,$offset:w.$offset})};var Y=(function(){function D(C){this.$L=H(C.locale,null,!0),this.parse(C),this.$x=this.$x||C.x||{},this[$]=!0}var w=D.prototype;return w.parse=function(C){this.$d=(function(j){var E=j.date,L=j.utc;if(E===null)return new Date(NaN);if(A.u(E))return new Date;if(E instanceof Date)return new Date(E);if(typeof E=="string"&&!/Z$/i.test(E)){var z=E.match(S);if(z){var m=z[2]-1||0,T=(z[7]||"0").substring(0,3);return L?new Date(Date.UTC(z[1],m,z[3]||1,z[4]||0,z[5]||0,z[6]||0,T)):new Date(z[1],m,z[3]||1,z[4]||0,z[5]||0,z[6]||0,T)}}return new Date(E)})(C),this.init()},w.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()},w.$utils=function(){return A},w.isValid=function(){return this.$d.toString()!==b},w.isSame=function(C,j){var E=B(C);return this.startOf(j)<=E&&E<=this.endOf(j)},w.isAfter=function(C,j){return B(C)<this.startOf(j)},w.isBefore=function(C,j){return this.endOf(j)<B(C)},w.$g=function(C,j,E){return A.u(C)?this[j]:this.set(E,C)},w.unix=function(){return Math.floor(this.valueOf()/1e3)},w.valueOf=function(){return this.$d.getTime()},w.startOf=function(C,j){var E=this,L=!!A.u(j)||j,z=A.p(C),m=function(J,V){var ie=A.w(E.$u?Date.UTC(E.$y,V,J):new Date(E.$y,V,J),E);return L?ie:ie.endOf(u)},T=function(J,V){return A.w(E.toDate()[J].apply(E.toDate("s"),(L?[0,0,0,0]:[23,59,59,999]).slice(V)),E)},F=this.$W,W=this.$M,q=this.$D,X="set"+(this.$u?"UTC":"");switch(z){case p:return L?m(1,0):m(31,11);case f:return L?m(1,W):m(0,W+1);case g:var U=this.$locale().weekStart||0,K=(F<U?F+7:F)-U;return m(L?q-K:q+(6-K),W);case u:case x:return T(X+"Hours",0);case d:return T(X+"Minutes",1);case l:return T(X+"Seconds",2);case c:return T(X+"Milliseconds",3);default:return this.clone()}},w.endOf=function(C){return this.startOf(C,!1)},w.$set=function(C,j){var E,L=A.p(C),z="set"+(this.$u?"UTC":""),m=(E={},E[u]=z+"Date",E[x]=z+"Date",E[f]=z+"Month",E[p]=z+"FullYear",E[d]=z+"Hours",E[l]=z+"Minutes",E[c]=z+"Seconds",E[i]=z+"Milliseconds",E)[L],T=L===u?this.$D+(j-this.$W):j;if(L===f||L===p){var F=this.clone().set(x,1);F.$d[m](T),F.init(),this.$d=F.set(x,Math.min(this.$D,F.daysInMonth())).$d}else m&&this.$d[m](T);return this.init(),this},w.set=function(C,j){return this.clone().$set(C,j)},w.get=function(C){return this[A.p(C)]()},w.add=function(C,j){var E,L=this;C=Number(C);var z=A.p(j),m=function(W){var q=B(L);return A.w(q.date(q.date()+Math.round(W*C)),L)};if(z===f)return this.set(f,this.$M+C);if(z===p)return this.set(p,this.$y+C);if(z===u)return m(1);if(z===g)return m(7);var T=(E={},E[l]=r,E[d]=o,E[c]=n,E)[z]||1,F=this.$d.getTime()+C*T;return A.w(F,this)},w.subtract=function(C,j){return this.add(-1*C,j)},w.format=function(C){var j=this,E=this.$locale();if(!this.isValid())return E.invalidDate||b;var L=C||"YYYY-MM-DDTHH:mm:ssZ",z=A.z(this),m=this.$H,T=this.$m,F=this.$M,W=E.weekdays,q=E.months,X=E.meridiem,U=function(V,ie,oe,he){return V&&(V[ie]||V(j,L))||oe[ie].slice(0,he)},K=function(V){return A.s(m%12||12,V,"0")},J=X||function(V,ie,oe){var he=V<12?"AM":"PM";return oe?he.toLowerCase():he};return L.replace(O,(function(V,ie){return ie||(function(oe){switch(oe){case"YY":return String(j.$y).slice(-2);case"YYYY":return A.s(j.$y,4,"0");case"M":return F+1;case"MM":return A.s(F+1,2,"0");case"MMM":return U(E.monthsShort,F,q,3);case"MMMM":return U(q,F);case"D":return j.$D;case"DD":return A.s(j.$D,2,"0");case"d":return String(j.$W);case"dd":return U(E.weekdaysMin,j.$W,W,2);case"ddd":return U(E.weekdaysShort,j.$W,W,3);case"dddd":return W[j.$W];case"H":return String(m);case"HH":return A.s(m,2,"0");case"h":return K(1);case"hh":return K(2);case"a":return J(m,T,!0);case"A":return J(m,T,!1);case"m":return String(T);case"mm":return A.s(T,2,"0");case"s":return String(j.$s);case"ss":return A.s(j.$s,2,"0");case"SSS":return A.s(j.$ms,3,"0");case"Z":return z}return null})(V)||z.replace(":","")}))},w.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},w.diff=function(C,j,E){var L,z=this,m=A.p(j),T=B(C),F=(T.utcOffset()-this.utcOffset())*r,W=this-T,q=function(){return A.m(z,T)};switch(m){case p:L=q()/12;break;case f:L=q();break;case v:L=q()/3;break;case g:L=(W-F)/6048e5;break;case u:L=(W-F)/864e5;break;case d:L=W/o;break;case l:L=W/r;break;case c:L=W/n;break;default:L=W}return E?L:A.a(L)},w.daysInMonth=function(){return this.endOf(f).$D},w.$locale=function(){return _[this.$L]},w.locale=function(C,j){if(!C)return this.$L;var E=this.clone(),L=H(C,j,!0);return L&&(E.$L=L),E},w.clone=function(){return A.w(this.$d,this)},w.toDate=function(){return new Date(this.valueOf())},w.toJSON=function(){return this.isValid()?this.toISOString():null},w.toISOString=function(){return this.$d.toISOString()},w.toString=function(){return this.$d.toUTCString()},D})(),N=Y.prototype;return B.prototype=N,[["$ms",i],["$s",c],["$m",l],["$H",d],["$W",u],["$M",f],["$y",p],["$D",x]].forEach((function(D){N[D[1]]=function(w){return this.$g(w,D[0],D[1])}})),B.extend=function(D,w){return D.$i||(D(w,Y,B),D.$i=!0),B},B.locale=H,B.isDayjs=P,B.unix=function(D){return B(1e3*D)},B.en=_[k],B.Ls=_,B.p={},B}))})(ct)),ct.exports}var Tc=Ec();const jt=xt(Tc);var ut={exports:{}},_c=ut.exports,Vn;function Oc(){return Vn||(Vn=1,(function(e,t){(function(n,r){e.exports=r()})(_c,(function(){return function(n,r,o){n=n||{};var i=r.prototype,c={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function l(u,g,f,v){return i.fromToBase(u,g,f,v)}o.en.relativeTime=c,i.fromToBase=function(u,g,f,v,p){for(var x,b,S,O=f.$locale().relativeTime||c,R=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"}],M=R.length,I=0;I<M;I+=1){var k=R[I];k.d&&(x=v?o(u).diff(f,k.d,!0):f.diff(u,k.d,!0));var _=(n.rounding||Math.round)(Math.abs(x));if(S=x>0,_<=k.r||!k.r){_<=1&&I>0&&(k=R[I-1]);var $=O[k.l];p&&(_=p(""+_)),b=typeof $=="string"?$.replace("%d",_):$(_,g,k.l,S);break}}if(g)return b;var P=S?O.future:O.past;return typeof P=="function"?P(b):P.replace("%s",b)},i.to=function(u,g){return l(u,g,this,!0)},i.from=function(u,g){return l(u,g,this)};var d=function(u){return u.$u?o.utc():o()};i.toNow=function(u){return this.to(d(this),u)},i.fromNow=function(u){return this.from(d(this),u)}}}))})(ut)),ut.exports}var kc=Oc();const Ic=xt(kc);var dt={exports:{}},$c=dt.exports,Hn;function Ac(){return Hn||(Hn=1,(function(e,t){(function(n,r){e.exports=r()})($c,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,o,i){var c=o.prototype,l=c.format;i.en.formats=n,c.format=function(d){d===void 0&&(d="YYYY-MM-DDTHH:mm:ssZ");var u=this.$locale().formats,g=(function(f,v){return f.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(p,x,b){var S=b&&b.toUpperCase();return x||v[b]||n[b]||v[S].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(O,R,M){return R||M.slice(1)}))}))})(d,u===void 0?{}:u);return l.call(this,g)}}}))})(dt)),dt.exports}var Lc=Ac();const Pc=xt(Lc);var ft={exports:{}},zc=ft.exports,Un;function Nc(){return Un||(Un=1,(function(e,t){(function(n,r){e.exports=r()})(zc,(function(){return function(n,r){var o=r.prototype,i=o.format;o.format=function(c){var l=this,d=this.$locale();if(!this.isValid())return i.bind(this)(c);var u=this.$utils(),g=(c||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(f){switch(f){case"Q":return Math.ceil((l.$M+1)/3);case"Do":return d.ordinal(l.$D);case"gggg":return l.weekYear();case"GGGG":return l.isoWeekYear();case"wo":return d.ordinal(l.week(),"W");case"w":case"ww":return u.s(l.week(),f==="w"?1:2,"0");case"W":case"WW":return u.s(l.isoWeek(),f==="W"?1:2,"0");case"k":case"kk":return u.s(String(l.$H===0?24:l.$H),f==="k"?1:2,"0");case"X":return Math.floor(l.$d.getTime()/1e3);case"x":return l.$d.getTime();case"z":return"["+l.offsetName()+"]";case"zzz":return"["+l.offsetName("long")+"]";default:return f}}));return i.bind(this)(g)}}}))})(ft)),ft.exports}var Fc=Nc();const Yc=xt(Fc);jt.extend(Ic);jt.extend(Pc);jt.extend(Yc);const Bc={date:"DD MMM YYYY",time:"hh:mm A",dateTime:"DD MMM YYYY, hh:mm A",full:"dddd, DD MMM YYYY, hh:mm A",short:"DD/MM/YY",relative:""};function qt({value:e,variant:t="dateTime",format:n,fallback:r="--"}){if(!e)return r;const o=jt(e);return o.isValid()?t==="relative"?o.fromNow():o.format(n??Bc[t]):r}function Wc({value:e,dateVariant:t="date",timeVariant:n="time",dateFormat:r,timeFormat:o,align:i="start",dateColor:c="gray.700",dateFontSize:l="16px",dateFontWeight:d="500",timeColor:u="gray.500",timeFontSize:g="12px",timeFontWeight:f="400",showTime:v=!0}){return s.jsxs(a.Stack,{gap:.5,align:i,children:[s.jsx(a.Text,{fontSize:l,fontWeight:d,color:c,children:qt({value:e,variant:t,format:r})}),v&&s.jsx(a.Text,{fontSize:g,fontWeight:f,color:u,children:qt({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 Xt{constructor(t){this.baseUrl=t}async fetchLatest(t){const n=new URLSearchParams;return n.set("keys",t.join(",")),(await(await fetch(`${this.baseUrl}/options?${n}`)).json()).data}}class Kt{constructor(t){this.api=t}store=new 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 i=this.store.get(o);i?n[o]=i.value:r.push(o)}return r.length&&(await this.fetchMissing(r),r.forEach(o=>{const i=this.store.get(o);i&&(n[o]=i.value)})),n}subscribe(t,n){return this.store.subscribe(t,n)}hydrate(t){this.store.setMany(t)}clear(){this.store.clear()}async fetchMissing(t){const n=t.filter(o=>!this.inflight.has(o));if(!n.length)return;const r=this.api.fetchLatest(n).then(o=>{this.store.setMany(o),n.forEach(i=>this.inflight.delete(i))});n.forEach(o=>this.inflight.set(o,r)),await r}}const Yr=h.createContext(null);function Br(){const e=h.useContext(Yr);if(!e)throw new Error("OptionsProvider is missing. Wrap your app with <OptionsProvider />");return e}function Vc({client:{apiUrl:e},children:t}){const n=h.useRef(new Kt(new Xt(e)));return n.current||(n.current=new Kt(new Xt(e))),s.jsx(Yr.Provider,{value:n.current,children:t})}function Hc(e){const t=Br(),[n,r]=h.useState(t.getRaw(e)?.value);return h.useEffect(()=>{let o=!0;t.getKey(e).then(c=>{o&&r(c)});const i=t.subscribe(e,c=>{r(c?.value)});return()=>{o=!1,i()}},[e,t]),n}function Uc(e){const t=Br(),[n,r]=h.useState({});return h.useEffect(()=>{let o=!0;t.getMultiKey(e).then(c=>{o&&r(c)});const i=e.map(c=>t.subscribe(c,l=>{r(d=>({...d,[c]:l?.value}))}));return()=>{o=!1,i.forEach(c=>c())}},[e.join("|"),t]),n}async function Gc(e,t){return e.getKey(t)}async function qc(e,t){await e.getMultiKey(t)}function Xc(e={}){const{initialPage:t=1,initialLimit:n=20}=e,[r,o]=h.useState(t),[i,c]=h.useState(n),l=h.useCallback(v=>{o(Math.max(1,v))},[]),d=h.useCallback(v=>{c(Math.max(1,v)),o(1)},[]),u=h.useCallback(()=>{o(v=>v+1)},[]),g=h.useCallback(()=>{o(v=>Math.max(1,v-1))},[]),f=h.useCallback(()=>{o(t),c(n)},[t,n]);return{page:r,limit:i,setPage:l,setLimit:d,nextPage:u,prevPage:g,reset:f}}function Kc(e={}){const{initialValue:t="",delay:n=300}=e,[r,o]=h.useState(t),i=Jc(r,n),c=h.useCallback(d=>{o(d)},[]),l=h.useCallback(()=>{o(t)},[t]);return{search:r,debouncedSearch:i,onSearchChange:c,reset:l}}function Jc(e,t=300){const[n,r]=h.useState(e);return h.useEffect(()=>{const o=setTimeout(()=>{r(e)},t);return()=>clearTimeout(o)},[e,t]),n}exports.DataTable=xa;exports.Filters=Ll;exports.HttpOptionsApi=Xt;exports.MDSButton=Nl;exports.MDSCheckbox=Tr;exports.MDSCombobox=_r;exports.MDSConfirmActionDialog=Xl;exports.MDSConfirmDeleteDialog=sc;exports.MDSDatePicker=kr;exports.MDSDateRangePicker=Or;exports.MDSDialogAction=ic;exports.MDSDialogActions=Nr;exports.MDSDialogBody=zr;exports.MDSDialogWrapper=vc;exports.MDSInput=Gt;exports.MDSPinInput=Rc;exports.MDSRefreshButton=an;exports.MDSSelectBox=Ir;exports.OptionsClientImpl=Kt;exports.OptionsProvider=Vc;exports.OptionsStore=Fr;exports.RefreshButton=an;exports.StackedDateTime=Wc;exports.addPreset=Ar;exports.deletePreset=Lr;exports.formatDateTime=qt;exports.getColumnWidthKey=Ct;exports.getOption=Gc;exports.getPresets=Dt;exports.loadOrder=zl;exports.prefetchOptions=qc;exports.saveOrder=Pl;exports.savePresets=sn;exports.setActionsConfig=Sr;exports.setColumnWidth=ti;exports.setData=br;exports.setTableId=yr;exports.tableStore=re;exports.useDebouncedSearch=Kc;exports.useOption=Hc;exports.useOptions=Uc;exports.usePagination=Xc;exports.withChildren=y;
|
|
10
|
+
`},Co={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 Do(e){let{announcements:t=Co,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=wo}=e;const{announce:s,announcement:i}=bo(),a=tt("DndLiveRegion"),[c,d]=f.useState(!1);if(f.useEffect(()=>{d(!0)},[]),yo(f.useMemo(()=>({onDragStart(h){let{active:v}=h;s(t.onDragStart({active:v}))},onDragMove(h){let{active:v,over:m}=h;t.onDragMove&&s(t.onDragMove({active:v,over:m}))},onDragOver(h){let{active:v,over:m}=h;s(t.onDragOver({active:v,over:m}))},onDragEnd(h){let{active:v,over:m}=h;s(t.onDragEnd({active:v,over:m}))},onDragCancel(h){let{active:v,over:m}=h;s(t.onDragCancel({active:v,over:m}))}}),[s,t])),!c)return null;const g=f.createElement(f.Fragment,null,f.createElement(vo,{id:r,value:o.draggable}),f.createElement(xo,{id:a,announcement:i}));return n?Ae.createPortal(g,n):g}var Z;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Z||(Z={}));function bt(){}function Eo(e,t){return f.useMemo(()=>({sensor:e,options:{}}),[e,t])}function jo(){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 Ro(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function To(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Oo(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function En(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const ir=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=En(t,t.left,t.top),s=[];for(const i of r){const{id:a}=i,c=n.get(a);if(c){const d=Mo(En(c),o);s.push({id:a,data:{droppableContainer:i,value:d}})}}return s.sort(Ro)};function _o(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),i=o-r,a=s-n;if(r<o&&n<s){const c=t.width*t.height,d=e.width*e.height,g=i*a,h=g/(c+d-g);return Number(h.toFixed(4))}return 0}const Io=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const s of r){const{id:i}=s,a=n.get(i);if(a){const c=_o(a,t);c>0&&o.push({id:i,data:{droppableContainer:s,value:c}})}}return o.sort(To)};function ko(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function ar(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:pe}function $o(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((i,a)=>({...i,top:i.top+e*a.y,bottom:i.bottom+e*a.y,left:i.left+e*a.x,right:i.right+e*a.x}),{...n})}}const Ao=$o(1);function zo(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 Lo(e,t,n){const r=zo(t);if(!r)return e;const{scaleX:o,scaleY:s,x:i,y:a}=r,c=e.left-i-(1-o)*parseFloat(n),d=e.top-a-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),g=o?e.width/o:e.width,h=s?e.height/s:e.height;return{width:g,height:h,top:d,right:c+g,bottom:d+h,left:c}}const No={ignoreTransform:!1};function Fe(e,t){t===void 0&&(t=No);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:g}=ie(e).getComputedStyle(e);d&&(n=Lo(n,d,g))}const{top:r,left:o,width:s,height:i,bottom:a,right:c}=n;return{top:r,left:o,width:s,height:i,bottom:a,right:c}}function jn(e){return Fe(e,{ignoreTransform:!0})}function Po(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Fo(e,t){return t===void 0&&(t=ie(e).getComputedStyle(e)),t.position==="fixed"}function Wo(e,t){t===void 0&&(t=ie(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 an(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(rn(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Qe(o)||rr(o)||n.includes(o))return n;const s=ie(e).getComputedStyle(o);return o!==e&&Wo(o,s)&&n.push(o),Fo(o,s)?n:r(o.parentNode)}return e?r(e):n}function lr(e){const[t]=an(e,1);return t??null}function $t(e){return!Ct||!e?null:Ne(e)?e:nn(e)?rn(e)||e===Pe(e).scrollingElement?window:Qe(e)?e:null:null}function cr(e){return Ne(e)?e.scrollX:e.scrollLeft}function ur(e){return Ne(e)?e.scrollY:e.scrollTop}function Gt(e){return{x:cr(e),y:ur(e)}}var Q;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Q||(Q={}));function dr(e){return!Ct||!e?!1:e===document.scrollingElement}function fr(e){const t={x:0,y:0},n=dr(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,i=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:o,isLeft:s,isBottom:i,isRight:a,maxScroll:r,minScroll:t}}const Bo={x:.2,y:.2};function Vo(e,t,n,r,o){let{top:s,left:i,right:a,bottom:c}=n;r===void 0&&(r=10),o===void 0&&(o=Bo);const{isTop:d,isBottom:g,isLeft:h,isRight:v}=fr(e),m={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?(m.y=Q.Backward,p.y=r*Math.abs((t.top+x.height-s)/x.height)):!g&&c>=t.bottom-x.height&&(m.y=Q.Forward,p.y=r*Math.abs((t.bottom-x.height-c)/x.height)),!v&&a>=t.right-x.width?(m.x=Q.Forward,p.x=r*Math.abs((t.right-x.width-a)/x.width)):!h&&i<=t.left+x.width&&(m.x=Q.Backward,p.x=r*Math.abs((t.left+x.width-i)/x.width)),{direction:m,speed:p}}function Yo(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:i}=window;return{top:0,left:0,right:s,bottom:i,width:s,height:i}}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 hr(e){return e.reduce((t,n)=>ze(t,Gt(n)),pe)}function Ho(e){return e.reduce((t,n)=>t+cr(n),0)}function Uo(e){return e.reduce((t,n)=>t+ur(n),0)}function Go(e,t){if(t===void 0&&(t=Fe),!e)return;const{top:n,left:r,bottom:o,right:s}=t(e);lr(e)&&(o<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const qo=[["x",["left","right"],Ho],["y",["top","bottom"],Uo]];class ln{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=an(n),o=hr(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,i,a]of qo)for(const c of i)Object.defineProperty(this,c,{get:()=>{const d=a(r),g=o[s]-d;return this.rect[c]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class qe{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 Ko(e){const{EventTarget:t}=ie(e);return e instanceof t?e:Pe(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 Mn(e){e.preventDefault()}function Xo(e){e.stopPropagation()}var G;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(G||(G={}));const gr={start:[G.Space,G.Enter],cancel:[G.Esc],end:[G.Space,G.Enter,G.Tab]},Jo=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case G.Right:return{...n,x:n.x+25};case G.Left:return{...n,x:n.x-25};case G.Down:return{...n,y:n.y+25};case G.Up:return{...n,y:n.y-25}}};class pr{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 qe(Pe(n)),this.windowListeners=new qe(ie(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&&Go(r),n(pe)}handleKeyDown(t){if(sn(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=gr,coordinateGetter:i=Jo,scrollBehavior:a="smooth"}=o,{code:c}=t;if(s.end.includes(c)){this.handleEnd(t);return}if(s.cancel.includes(c)){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=i(t,{active:n,context:r.current,currentCoordinates:g});if(h){const v=xt(h,g),m={x:0,y:0},{scrollableAncestors:p}=r.current;for(const x of p){const y=t.code,{isTop:T,isRight:D,isLeft:j,isBottom:I,maxScroll:$,minScroll:_}=fr(x),k=Yo(x),L={x:Math.min(y===G.Right?k.right-k.width/2:k.right,Math.max(y===G.Right?k.left:k.left+k.width/2,h.x)),y:Math.min(y===G.Down?k.bottom-k.height/2:k.bottom,Math.max(y===G.Down?k.top:k.top+k.height/2,h.y))},H=y===G.Right&&!D||y===G.Left&&!j,B=y===G.Down&&!I||y===G.Up&&!T;if(H&&L.x!==h.x){const z=x.scrollLeft+v.x,W=y===G.Right&&z<=$.x||y===G.Left&&z>=_.x;if(W&&!v.y){x.scrollTo({left:z,behavior:a});return}W?m.x=x.scrollLeft-z:m.x=y===G.Right?x.scrollLeft-$.x:x.scrollLeft-_.x,m.x&&x.scrollBy({left:-m.x,behavior:a});break}else if(B&&L.y!==h.y){const z=x.scrollTop+v.y,W=y===G.Down&&z<=$.y||y===G.Up&&z>=_.y;if(W&&!v.x){x.scrollTo({top:z,behavior:a});return}W?m.y=x.scrollTop-z:m.y=y===G.Down?x.scrollTop-$.y:x.scrollTop-_.y,m.y&&x.scrollBy({top:-m.y,behavior:a});break}}this.handleMove(t,ze(xt(h,this.referenceCoordinates),m))}}}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()}}pr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=gr,onActivation:o}=t,{active:s}=n;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const a=s.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function Rn(e){return!!(e&&"distance"in e)}function Tn(e){return!!(e&&"delay"in e)}class cn{constructor(t,n,r){var o;r===void 0&&(r=Ko(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:i}=s;this.props=t,this.events=n,this.document=Pe(i),this.documentListeners=new qe(this.document),this.listeners=new qe(r),this.windowListeners=new qe(ie(i)),this.initialCoordinates=(o=Ut(s))!=null?o:pe,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(fe.Resize,this.handleCancel),this.windowListeners.add(fe.DragStart,Mn),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),this.windowListeners.add(fe.ContextMenu,Mn),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(Tn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Rn(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,Xo,{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:i,options:{activationConstraint:a}}=s;if(!o)return;const c=(n=Ut(t))!=null?n:pe,d=xt(o,c);if(!r&&a){if(Rn(a)){if(a.tolerance!=null&&At(d,a.tolerance))return this.handleCancel();if(At(d,a.distance))return this.handleStart()}if(Tn(a)&&At(d,a.tolerance))return this.handleCancel();this.handlePending(a,d);return}t.cancelable&&t.preventDefault(),i(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===G.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Zo={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class un extends cn{constructor(t){const{event:n}=t,r=Pe(n.target);super(t,Zo,r)}}un.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 Qo={move:{name:"mousemove"},end:{name:"mouseup"}};var qt;(function(e){e[e.RightClick=2]="RightClick"})(qt||(qt={}));class es extends cn{constructor(t){super(t,Qo,Pe(t.event.target))}}es.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===qt.RightClick?!1:(r?.({event:n}),!0)}}];const zt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class ts extends cn{constructor(t){super(t,zt)}static setup(){return window.addEventListener(zt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(zt.move.name,t)};function t(){}}}ts.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 Ke;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ke||(Ke={}));var yt;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(yt||(yt={}));function ns(e){let{acceleration:t,activator:n=Ke.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:i=5,order:a=yt.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:g,delta:h,threshold:v}=e;const m=os({delta:h,disabled:!s}),[p,x]=fo(),y=f.useRef({x:0,y:0}),T=f.useRef({x:0,y:0}),D=f.useMemo(()=>{switch(n){case Ke.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Ke.DraggableRect:return o}},[n,o,c]),j=f.useRef(null),I=f.useCallback(()=>{const _=j.current;if(!_)return;const k=y.current.x*T.current.x,L=y.current.y*T.current.y;_.scrollBy(k,L)},[]),$=f.useMemo(()=>a===yt.TreeOrder?[...d].reverse():d,[a,d]);f.useEffect(()=>{if(!s||!d.length||!D){x();return}for(const _ of $){if(r?.(_)===!1)continue;const k=d.indexOf(_),L=g[k];if(!L)continue;const{direction:H,speed:B}=Vo(_,L,D,t,v);for(const z of["x","y"])m[z][H[z]]||(B[z]=0,H[z]=0);if(B.x>0||B.y>0){x(),j.current=_,p(I,i),y.current=B,T.current=H;return}}y.current={x:0,y:0},T.current={x:0,y:0},x()},[t,I,r,x,s,i,JSON.stringify(D),JSON.stringify(m),p,d,$,g,JSON.stringify(v)])}const rs={x:{[Q.Backward]:!1,[Q.Forward]:!1},y:{[Q.Backward]:!1,[Q.Forward]:!1}};function os(e){let{delta:t,disabled:n}=e;const r=Ht(t);return et(o=>{if(n||!r||!o)return rs;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Q.Backward]:o.x[Q.Backward]||s.x===-1,[Q.Forward]:o.x[Q.Forward]||s.x===1},y:{[Q.Backward]:o.y[Q.Backward]||s.y===-1,[Q.Forward]:o.y[Q.Forward]||s.y===1}}},[n,t,r])}function ss(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 is(e,t){return f.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,s=o.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,r)}));return[...n,...s]},[]),[e,t])}var Ze;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Ze||(Ze={}));var Kt;(function(e){e.Optimized="optimized"})(Kt||(Kt={}));const On=new Map;function as(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,i]=f.useState(null),{frequency:a,measure:c,strategy:d}=o,g=f.useRef(e),h=y(),v=Je(h),m=f.useCallback(function(T){T===void 0&&(T=[]),!v.current&&i(D=>D===null?T:D.concat(T.filter(j=>!D.includes(j))))},[v]),p=f.useRef(null),x=et(T=>{if(h&&!n)return On;if(!T||T===On||g.current!==e||s!=null){const D=new Map;for(let j of e){if(!j)continue;if(s&&s.length>0&&!s.includes(j.id)&&j.rect.current){D.set(j.id,j.rect.current);continue}const I=j.node.current,$=I?new ln(c(I),I):null;j.rect.current=$,$&&D.set(j.id,$)}return D}return T},[e,s,n,h,c]);return f.useEffect(()=>{g.current=e},[e]),f.useEffect(()=>{h||m()},[n,h]),f.useEffect(()=>{s&&s.length>0&&i(null)},[JSON.stringify(s)]),f.useEffect(()=>{h||typeof a!="number"||p.current!==null||(p.current=setTimeout(()=>{m(),p.current=null},a))},[a,h,m,...r]),{droppableRects:x,measureDroppableContainers:m,measuringScheduled:s!=null};function y(){switch(d){case Ze.Always:return!1;case Ze.BeforeDragging:return n;default:return!n}}}function mr(e,t){return et(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function ls(e,t){return mr(e,t)}function cs(e){let{callback:t,disabled:n}=e;const r=on(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 Dt(e){let{callback:t,disabled:n}=e;const r=on(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 us(e){return new ln(Fe(e),e)}function _n(e,t,n){t===void 0&&(t=us);const[r,o]=f.useState(null);function s(){o(c=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=c??n)!=null?d:null}const g=t(e);return JSON.stringify(c)===JSON.stringify(g)?c:g})}const i=cs({callback(c){if(e)for(const d of c){const{type:g,target:h}=d;if(g==="childList"&&h instanceof HTMLElement&&h.contains(e)){s();break}}}}),a=Dt({callback:s});return xe(()=>{s(),e?(a?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),i?.disconnect())},[e]),r}function ds(e){const t=mr(e);return ar(e,t)}const In=[];function fs(e){const t=f.useRef(e),n=et(r=>e?r&&r!==In&&e&&t.current&&e.parentNode===t.current.parentNode?r:an(e):In,[e]);return f.useEffect(()=>{t.current=e},[e]),n}function hs(e){const[t,n]=f.useState(null),r=f.useRef(e),o=f.useCallback(s=>{const i=$t(s.target);i&&n(a=>a?(a.set(i,Gt(i)),new Map(a)):null)},[]);return f.useEffect(()=>{const s=r.current;if(e!==s){i(s);const a=e.map(c=>{const d=$t(c);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,Gt(d)]):null}).filter(c=>c!=null);n(a.length?new Map(a):null),r.current=e}return()=>{i(e),i(s)};function i(a){a.forEach(c=>{const d=$t(c);d?.removeEventListener("scroll",o)})}},[o,e]),f.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,i)=>ze(s,i),pe):hr(e):pe,[e,t])}function kn(e,t){t===void 0&&(t=[]);const n=f.useRef(null);return f.useEffect(()=>{n.current=null},t),f.useEffect(()=>{const r=e!==pe;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?xt(e,n.current):pe}function gs(e){f.useEffect(()=>{if(!Ct)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function ps(e,t){return f.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:s}=r;return n[o]=i=>{s(i,t)},n},{}),[e,t])}function vr(e){return f.useMemo(()=>e?Po(e):null,[e])}const $n=[];function ms(e,t){t===void 0&&(t=Fe);const[n]=e,r=vr(n?ie(n):null),[o,s]=f.useState($n);function i(){s(()=>e.length?e.map(c=>dr(c)?r:new ln(t(c),c)):$n)}const a=Dt({callback:i});return xe(()=>{a?.disconnect(),i(),e.forEach(c=>a?.observe(c))},[e]),o}function vs(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Qe(t)?t:e}function xs(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 v=t(g);return h?{...h,width:v.width,height:v.height}:v});break}},[t]),s=Dt({callback:o}),i=f.useCallback(d=>{const g=vs(d);s?.disconnect(),g&&s?.observe(g),r(g?t(g):null)},[t,s]),[a,c]=vt(i);return f.useMemo(()=>({nodeRef:a,rect:n,setRef:c}),[n,a,c])}const bs=[{sensor:un,options:{}},{sensor:pr,options:{}}],ys={current:{}},dt={draggable:{measure:jn},droppable:{measure:jn,strategy:Ze.WhileDragging,frequency:Kt.Optimized},dragOverlay:{measure:Fe}};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 Ss={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:bt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:dt,measureDroppableContainers:bt,windowRect:null,measuringScheduled:!1},ws={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:bt,draggableNodes:new Map,over:null,measureDroppableContainers:bt},Et=f.createContext(ws),xr=f.createContext(Ss);function Cs(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Xe}}}function Ds(e,t){switch(t.type){case Z.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Z.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Z.DragEnd:case Z.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Z.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Xe(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case Z.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const i=new Xe(e.droppable.containers);return i.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:i}}}case Z.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Xe(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function Es(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=f.useContext(Et),s=Ht(r),i=Ht(n?.id);return f.useEffect(()=>{if(!t&&!r&&s&&i!=null){if(!sn(s)||document.activeElement===s.target)return;const a=o.get(i);if(!a)return;const{activatorNode:c,node:d}=a;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const g of[c.current,d.current]){if(!g)continue;const h=po(g);if(h){h.focus();break}}})}},[r,t,o,i,s]),null}function js(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:{...dt.draggable,...e?.draggable},droppable:{...dt.droppable,...e?.droppable},dragOverlay:{...dt.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Rs(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const s=f.useRef(!1),{x:i,y:a}=typeof o=="boolean"?{x:o,y:o}:o;xe(()=>{if(!i&&!a||!t){s.current=!1;return}if(s.current||!r)return;const d=t?.node.current;if(!d||d.isConnected===!1)return;const g=n(d),h=ar(g,r);if(i||(h.x=0),a||(h.y=0),s.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const v=lr(d);v&&v.scrollBy({top:h.y,left:h.x})}},[t,i,a,r,n])}const br=f.createContext({...pe,scaleX:1,scaleY:1});var je;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(je||(je={}));const yr=f.memo(function(t){var n,r,o,s;let{id:i,accessibility:a,autoScroll:c=!0,children:d,sensors:g=bs,collisionDetection:h=Io,measuring:v,modifiers:m,...p}=t;const x=f.useReducer(Ds,void 0,Cs),[y,T]=x,[D,j]=So(),[I,$]=f.useState(je.Uninitialized),_=I===je.Initialized,{draggable:{active:k,nodes:L,translate:H},droppable:{containers:B}}=y,z=k!=null?L.get(k):null,W=f.useRef({initial:null,translated:null}),F=f.useMemo(()=>{var oe;return k!=null?{id:k,data:(oe=z?.data)!=null?oe:ys,rect:W}:null},[k,z]),M=f.useRef(null),[w,C]=f.useState(null),[R,E]=f.useState(null),A=Je(p,Object.values(p)),P=tt("DndDescribedBy",i),b=f.useMemo(()=>B.getEnabled(),[B]),O=Ms(v),{droppableRects:N,measureDroppableContainers:V,measuringScheduled:q}=as(b,{dragging:_,dependencies:[H.x,H.y],config:O.droppable}),K=ss(L,k),U=f.useMemo(()=>R?Ut(R):null,[R]),X=so(),J=ls(K,O.draggable.measure);Rs({activeNode:k!=null?L.get(k):null,config:X.layoutShiftCompensation,initialRect:J,measure:O.draggable.measure});const Y=_n(K,O.draggable.measure,J),se=_n(K?K.parentElement:null),re=f.useRef({activatorEvent:null,active:null,activeNode:K,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:L,draggingNode:null,draggingNodeRect:null,droppableContainers:B,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ge=B.getNodeFor((n=re.current.over)==null?void 0:n.id),be=xs({measure:O.dragOverlay.measure}),Te=(r=be.nodeRef.current)!=null?r:K,Oe=_?(o=be.rect)!=null?o:Y:null,hn=!!(be.nodeRef.current&&be.rect),gn=ds(hn?null:Y),Ot=vr(Te?ie(Te):null),Se=fs(_?ge??K:null),nt=ms(Se),rt=js(m,{transform:{x:H.x-gn.x,y:H.y-gn.y,scaleX:1,scaleY:1},activatorEvent:R,active:F,activeNodeRect:Y,containerNodeRect:se,draggingNodeRect:Oe,over:re.current.over,overlayNodeRect:be.rect,scrollableAncestors:Se,scrollableAncestorRects:nt,windowRect:Ot}),pn=U?ze(U,H):null,mn=hs(Se),Zr=kn(mn),Qr=kn(mn,[Y]),_e=ze(rt,Zr),Ie=Oe?Ao(Oe,rt):null,Be=F&&Ie?h({active:F,collisionRect:Ie,droppableRects:N,droppableContainers:b,pointerCoordinates:pn}):null,vn=Oo(Be,"id"),[we,xn]=f.useState(null),eo=hn?rt:ze(rt,Qr),to=ko(eo,(s=we?.rect)!=null?s:null,Y),_t=f.useRef(null),bn=f.useCallback((oe,le)=>{let{sensor:ce,options:Ce}=le;if(M.current==null)return;const de=L.get(M.current);if(!de)return;const ue=oe.nativeEvent,me=new ce({active:M.current,activeNode:de,event:ue,options:Ce,context:re,onAbort(ee){if(!L.get(ee))return;const{onDragAbort:ve}=A.current,ye={id:ee};ve?.(ye),D({type:"onDragAbort",event:ye})},onPending(ee,De,ve,ye){if(!L.get(ee))return;const{onDragPending:Ye}=A.current,Ee={id:ee,constraint:De,initialCoordinates:ve,offset:ye};Ye?.(Ee),D({type:"onDragPending",event:Ee})},onStart(ee){const De=M.current;if(De==null)return;const ve=L.get(De);if(!ve)return;const{onDragStart:ye}=A.current,Ve={activatorEvent:ue,active:{id:De,data:ve.data,rect:W}};Ae.unstable_batchedUpdates(()=>{ye?.(Ve),$(je.Initializing),T({type:Z.DragStart,initialCoordinates:ee,active:De}),D({type:"onDragStart",event:Ve}),C(_t.current),E(ue)})},onMove(ee){T({type:Z.DragMove,coordinates:ee})},onEnd:ke(Z.DragEnd),onCancel:ke(Z.DragCancel)});_t.current=me;function ke(ee){return async function(){const{active:ve,collisions:ye,over:Ve,scrollAdjustedTranslate:Ye}=re.current;let Ee=null;if(ve&&Ye){const{cancelDrop:He}=A.current;Ee={activatorEvent:ue,active:ve,collisions:ye,delta:Ye,over:Ve},ee===Z.DragEnd&&typeof He=="function"&&await Promise.resolve(He(Ee))&&(ee=Z.DragCancel)}M.current=null,Ae.unstable_batchedUpdates(()=>{T({type:ee}),$(je.Uninitialized),xn(null),C(null),E(null),_t.current=null;const He=ee===Z.DragEnd?"onDragEnd":"onDragCancel";if(Ee){const It=A.current[He];It?.(Ee),D({type:He,event:Ee})}})}}},[L]),no=f.useCallback((oe,le)=>(ce,Ce)=>{const de=ce.nativeEvent,ue=L.get(Ce);if(M.current!==null||!ue||de.dndKit||de.defaultPrevented)return;const me={active:ue};oe(ce,le.options,me)===!0&&(de.dndKit={capturedBy:le.sensor},M.current=Ce,bn(ce,le))},[L,bn]),yn=is(g,no);gs(g),xe(()=>{Y&&I===je.Initializing&&$(je.Initialized)},[Y,I]),f.useEffect(()=>{const{onDragMove:oe}=A.current,{active:le,activatorEvent:ce,collisions:Ce,over:de}=re.current;if(!le||!ce)return;const ue={active:le,activatorEvent:ce,collisions:Ce,delta:{x:_e.x,y:_e.y},over:de};Ae.unstable_batchedUpdates(()=>{oe?.(ue),D({type:"onDragMove",event:ue})})},[_e.x,_e.y]),f.useEffect(()=>{const{active:oe,activatorEvent:le,collisions:ce,droppableContainers:Ce,scrollAdjustedTranslate:de}=re.current;if(!oe||M.current==null||!le||!de)return;const{onDragOver:ue}=A.current,me=Ce.get(vn),ke=me&&me.rect.current?{id:me.id,rect:me.rect.current,data:me.data,disabled:me.disabled}:null,ee={active:oe,activatorEvent:le,collisions:ce,delta:{x:de.x,y:de.y},over:ke};Ae.unstable_batchedUpdates(()=>{xn(ke),ue?.(ee),D({type:"onDragOver",event:ee})})},[vn]),xe(()=>{re.current={activatorEvent:R,active:F,activeNode:K,collisionRect:Ie,collisions:Be,droppableRects:N,draggableNodes:L,draggingNode:Te,draggingNodeRect:Oe,droppableContainers:B,over:we,scrollableAncestors:Se,scrollAdjustedTranslate:_e},W.current={initial:Oe,translated:Ie}},[F,K,Be,Ie,L,Te,Oe,N,B,we,Se,_e]),ns({...X,delta:H,draggingRect:Ie,pointerCoordinates:pn,scrollableAncestors:Se,scrollableAncestorRects:nt});const ro=f.useMemo(()=>({active:F,activeNode:K,activeNodeRect:Y,activatorEvent:R,collisions:Be,containerNodeRect:se,dragOverlay:be,draggableNodes:L,droppableContainers:B,droppableRects:N,over:we,measureDroppableContainers:V,scrollableAncestors:Se,scrollableAncestorRects:nt,measuringConfiguration:O,measuringScheduled:q,windowRect:Ot}),[F,K,Y,R,Be,se,be,L,B,N,we,V,Se,nt,O,q,Ot]),oo=f.useMemo(()=>({activatorEvent:R,activators:yn,active:F,activeNodeRect:Y,ariaDescribedById:{draggable:P},dispatch:T,draggableNodes:L,over:we,measureDroppableContainers:V}),[R,yn,F,Y,T,P,L,we,V]);return f.createElement(sr.Provider,{value:j},f.createElement(Et.Provider,{value:oo},f.createElement(xr.Provider,{value:ro},f.createElement(br.Provider,{value:to},d)),f.createElement(Es,{disabled:a?.restoreFocus===!1})),f.createElement(Do,{...a,hiddenTextDescribedById:P}));function so(){const oe=w?.autoScrollEnabled===!1,le=typeof c=="object"?c.enabled===!1:c===!1,ce=_&&!oe&&!le;return typeof c=="object"?{...c,enabled:ce}:{enabled:ce}}}),Ts=f.createContext(null),An="button",Os="Draggable";function _s(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=tt(Os),{activators:i,activatorEvent:a,active:c,activeNodeRect:d,ariaDescribedById:g,draggableNodes:h,over:v}=f.useContext(Et),{role:m=An,roleDescription:p="draggable",tabIndex:x=0}=o??{},y=c?.id===t,T=f.useContext(y?br:Ts),[D,j]=vt(),[I,$]=vt(),_=ps(i,t),k=Je(n);xe(()=>(h.set(t,{id:t,key:s,node:D,activatorNode:I,data:k}),()=>{const H=h.get(t);H&&H.key===s&&h.delete(t)}),[h,t]);const L=f.useMemo(()=>({role:m,tabIndex:x,"aria-disabled":r,"aria-pressed":y&&m===An?!0:void 0,"aria-roledescription":p,"aria-describedby":g.draggable}),[r,m,x,y,p,g.draggable]);return{active:c,activatorEvent:a,activeNodeRect:d,attributes:L,isDragging:y,listeners:r?void 0:_,node:D,over:v,setNodeRef:j,setActivatorNodeRef:$,transform:T}}function Is(){return f.useContext(xr)}const ks="Droppable",$s={timeout:25};function As(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=tt(ks),{active:i,dispatch:a,over:c,measureDroppableContainers:d}=f.useContext(Et),g=f.useRef({disabled:n}),h=f.useRef(!1),v=f.useRef(null),m=f.useRef(null),{disabled:p,updateMeasurementsFor:x,timeout:y}={...$s,...o},T=Je(x??r),D=f.useCallback(()=>{if(!h.current){h.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{d(Array.isArray(T.current)?T.current:[T.current]),m.current=null},y)},[y]),j=Dt({callback:D,disabled:p||!i}),I=f.useCallback((L,H)=>{j&&(H&&(j.unobserve(H),h.current=!1),L&&j.observe(L))},[j]),[$,_]=vt(I),k=Je(t);return f.useEffect(()=>{!j||!$.current||(j.disconnect(),h.current=!1,j.observe($.current))},[$,j]),f.useEffect(()=>(a({type:Z.RegisterDroppable,element:{id:r,key:s,disabled:n,node:$,rect:v,data:k}}),()=>a({type:Z.UnregisterDroppable,key:s,id:r})),[r]),f.useEffect(()=>{n!==g.current.disabled&&(a({type:Z.SetDroppableDisabled,id:r,key:s,disabled:n}),g.current.disabled=n)},[r,s,n,a]),{active:i,rect:v,isOver:c?.id===r,node:$,over:c,setNodeRef:_}}function jt(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function zs(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function st(e){return e!==null&&e>=0}function Ls(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 Ns(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const it={scaleX:1,scaleY:1},Ps=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:s,index:i}=e;const a=(t=n[o])!=null?t:r;if(!a)return null;const c=Fs(n,i,o);if(i===o){const d=n[s];return d?{x:o<s?d.left+d.width-(a.left+a.width):d.left-a.left,y:0,...it}:null}return i>o&&i<=s?{x:-a.width-c,y:0,...it}:i<o&&i>=s?{x:a.width+c,y:0,...it}:{x:0,y:0,...it}};function Fs(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 Sr=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const s=jt(t,r,n),i=t[o],a=s[o];return!a||!i?null:{x:a.left-i.left,y:a.top-i.top,scaleX:a.width/i.width,scaleY:a.height/i.height}},at={scaleX:1,scaleY:1},Ws=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:s,overIndex:i}=e;const a=(t=s[n])!=null?t:r;if(!a)return null;if(o===n){const d=s[i];return d?{x:0,y:n<i?d.top+d.height-(a.top+a.height):d.top-a.top,...at}:null}const c=Bs(s,o,n);return o>n&&o<=i?{x:0,y:-a.height-c,...at}:o<n&&o>=i?{x:0,y:a.height+c,...at}:{x:0,y:0,...at}};function Bs(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 wr="Sortable",Cr=f.createContext({activeIndex:-1,containerId:wr,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Sr,disabled:{draggable:!1,droppable:!1}});function Dr(e){let{children:t,id:n,items:r,strategy:o=Sr,disabled:s=!1}=e;const{active:i,dragOverlay:a,droppableRects:c,over:d,measureDroppableContainers:g}=Is(),h=tt(wr,n),v=a.rect!==null,m=f.useMemo(()=>r.map(_=>typeof _=="object"&&"id"in _?_.id:_),[r]),p=i!=null,x=i?m.indexOf(i.id):-1,y=d?m.indexOf(d.id):-1,T=f.useRef(m),D=!Ls(m,T.current),j=y!==-1&&x===-1||D,I=Ns(s);xe(()=>{D&&p&&g(m)},[D,m,p,g]),f.useEffect(()=>{T.current=m},[m]);const $=f.useMemo(()=>({activeIndex:x,containerId:h,disabled:I,disableTransforms:j,items:m,overIndex:y,useDragOverlay:v,sortedRects:zs(m,c),strategy:o}),[x,h,I.draggable,I.droppable,j,m,y,c,v,o]);return f.createElement(Cr.Provider,{value:$},t)}const Vs=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return jt(n,r,o).indexOf(t)},Ys=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:s,newIndex:i,previousItems:a,previousContainerId:c,transition:d}=e;return!d||!r||a!==s&&o===i?!1:n?!0:i!==o&&t===c},Hs={duration:200,easing:"ease"},Er="transform",Us=Le.Transition.toString({property:Er,duration:0,easing:"linear"}),Gs={roleDescription:"sortable"};function qs(e){let{disabled:t,index:n,node:r,rect:o}=e;const[s,i]=f.useState(null),a=f.useRef(n);return xe(()=>{if(!t&&n!==a.current&&r.current){const c=o.current;if(c){const d=Fe(r.current,{ignoreTransform:!0}),g={x:c.left-d.left,y:c.top-d.top,scaleX:c.width/d.width,scaleY:c.height/d.height};(g.x||g.y)&&i(g)}}n!==a.current&&(a.current=n)},[t,n,r,o]),f.useEffect(()=>{s&&i(null)},[s]),s}function jr(e){let{animateLayoutChanges:t=Ys,attributes:n,disabled:r,data:o,getNewIndex:s=Vs,id:i,strategy:a,resizeObserverConfig:c,transition:d=Hs}=e;const{items:g,containerId:h,activeIndex:v,disabled:m,disableTransforms:p,sortedRects:x,overIndex:y,useDragOverlay:T,strategy:D}=f.useContext(Cr),j=Ks(r,m),I=g.indexOf(i),$=f.useMemo(()=>({sortable:{containerId:h,index:I,items:g},...o}),[h,o,I,g]),_=f.useMemo(()=>g.slice(g.indexOf(i)),[g,i]),{rect:k,node:L,isOver:H,setNodeRef:B}=As({id:i,data:$,disabled:j.droppable,resizeObserverConfig:{updateMeasurementsFor:_,...c}}),{active:z,activatorEvent:W,activeNodeRect:F,attributes:M,setNodeRef:w,listeners:C,isDragging:R,over:E,setActivatorNodeRef:A,transform:P}=_s({id:i,data:$,attributes:{...Gs,...n},disabled:j.draggable}),b=uo(B,w),O=!!z,N=O&&!p&&st(v)&&st(y),V=!T&&R,q=V&&N?P:null,U=N?q??(a??D)({rects:x,activeNodeRect:F,activeIndex:v,overIndex:y,index:I}):null,X=st(v)&&st(y)?s({id:i,items:g,activeIndex:v,overIndex:y}):I,J=z?.id,Y=f.useRef({activeId:J,items:g,newIndex:X,containerId:h}),se=g!==Y.current.items,re=t({active:z,containerId:h,isDragging:R,isSorting:O,id:i,index:I,items:g,newIndex:Y.current.newIndex,previousItems:Y.current.items,previousContainerId:Y.current.containerId,transition:d,wasDragging:Y.current.activeId!=null}),ge=qs({disabled:!re,index:I,node:L,rect:k});return f.useEffect(()=>{O&&Y.current.newIndex!==X&&(Y.current.newIndex=X),h!==Y.current.containerId&&(Y.current.containerId=h),g!==Y.current.items&&(Y.current.items=g)},[O,X,h,g]),f.useEffect(()=>{if(J===Y.current.activeId)return;if(J!=null&&Y.current.activeId==null){Y.current.activeId=J;return}const Te=setTimeout(()=>{Y.current.activeId=J},50);return()=>clearTimeout(Te)},[J]),{active:z,activeIndex:v,attributes:M,data:$,rect:k,index:I,newIndex:X,items:g,isOver:H,isSorting:O,isDragging:R,listeners:C,node:L,overIndex:y,over:E,setNodeRef:b,setActivatorNodeRef:A,setDroppableNodeRef:B,setDraggableNodeRef:w,transform:ge??U,transition:be()};function be(){if(ge||se&&Y.current.newIndex===I)return Us;if(!(V&&!sn(W)||!d)&&(O||re))return Le.Transition.toString({...d,property:Er})}}function Ks(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}G.Down,G.Right,G.Up,G.Left;var lt={exports:{}},Lt={},ct={exports:{}},Nt={};var zn;function Xs(){if(zn)return Nt;zn=1;var e=f;function t(h,v){return h===v&&(h!==0||1/h===1/v)||h!==h&&v!==v}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function a(h,v){var m=v(),p=r({inst:{value:m,getSnapshot:v}}),x=p[0].inst,y=p[1];return s(function(){x.value=m,x.getSnapshot=v,c(x)&&y({inst:x})},[h,m,v]),o(function(){return c(x)&&y({inst:x}),h(function(){c(x)&&y({inst:x})})},[h]),i(m),m}function c(h){var v=h.getSnapshot;h=h.value;try{var m=v();return!n(h,m)}catch{return!0}}function d(h,v){return v()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:a;return Nt.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,Nt}var Pt={};var Ln;function Js(){return Ln||(Ln=1,process.env.NODE_ENV!=="production"&&(function(){function e(m,p){return m===p&&(m!==0||1/m===1/p)||m!==m&&p!==p}function t(m,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 y=p();s(x,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),h=!0)}y=i({inst:{value:x,getSnapshot:p}});var T=y[0].inst,D=y[1];return c(function(){T.value=x,T.getSnapshot=p,n(T)&&D({inst:T})},[m,x,p]),a(function(){return n(T)&&D({inst:T}),m(function(){n(T)&&D({inst:T})})},[m]),d(x),x}function n(m){var p=m.getSnapshot;m=m.value;try{var x=p();return!s(m,x)}catch{return!0}}function r(m,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,i=o.useState,a=o.useEffect,c=o.useLayoutEffect,d=o.useDebugValue,g=!1,h=!1,v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;Pt.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:v,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Pt}var Nn;function Mr(){return Nn||(Nn=1,process.env.NODE_ENV==="production"?ct.exports=Xs():ct.exports=Js()),ct.exports}var Pn;function Zs(){if(Pn)return Lt;Pn=1;var e=f,t=Mr();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,i=e.useEffect,a=e.useMemo,c=e.useDebugValue;return Lt.useSyncExternalStoreWithSelector=function(d,g,h,v,m){var p=s(null);if(p.current===null){var x={hasValue:!1,value:null};p.current=x}else x=p.current;p=a(function(){function T(_){if(!D){if(D=!0,j=_,_=v(_),m!==void 0&&x.hasValue){var k=x.value;if(m(k,_))return I=k}return I=_}if(k=I,r(j,_))return k;var L=v(_);return m!==void 0&&m(k,L)?(j=_,k):(j=_,I=L)}var D=!1,j,I,$=h===void 0?null:h;return[function(){return T(g())},$===null?void 0:function(){return T($())}]},[g,h,v,m]);var y=o(d,p[0],p[1]);return i(function(){x.hasValue=!0,x.value=y},[y]),c(y),y},Lt}var Ft={};var Fn;function Qs(){return Fn||(Fn=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=Mr(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,i=t.useEffect,a=t.useMemo,c=t.useDebugValue;Ft.useSyncExternalStoreWithSelector=function(d,g,h,v,m){var p=s(null);if(p.current===null){var x={hasValue:!1,value:null};p.current=x}else x=p.current;p=a(function(){function T(_){if(!D){if(D=!0,j=_,_=v(_),m!==void 0&&x.hasValue){var k=x.value;if(m(k,_))return I=k}return I=_}if(k=I,r(j,_))return k;var L=v(_);return m!==void 0&&m(k,L)?(j=_,k):(j=_,I=L)}var D=!1,j,I,$=h===void 0?null:h;return[function(){return T(g())},$===null?void 0:function(){return T($())}]},[g,h,v,m]);var y=o(d,p[0],p[1]);return i(function(){x.hasValue=!0,x.value=y},[y]),c(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Ft}var Wn;function ei(){return Wn||(Wn=1,process.env.NODE_ENV==="production"?lt.exports=Zs():lt.exports=Qs()),lt.exports}var ti=ei();const Xt=new WeakMap,ni=new WeakMap,St={current:[]};let Wt=!1;const ut=new Set,Bn=new Map;function Rr(e){for(const t of e){if(St.current.includes(t))continue;St.current.push(t),t.recompute();const n=ni.get(t);if(n)for(const r of n){const o=Xt.get(r);o?.length&&Rr(o)}}}function ri(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function oi(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function si(e){if(ut.add(e),!Wt)try{for(Wt=!0;ut.size>0;){const t=Array.from(ut);ut.clear();for(const n of t){const r=Bn.get(n)??n.prevState;n.prevState=r,ri(n)}for(const n of t){const r=Xt.get(n);r&&(St.current.push(n),Rr(r))}for(const n of t){const r=Xt.get(n);if(r)for(const o of r)oi(o)}}}finally{Wt=!1,St.current=[],Bn.clear()}}function ii(e){return typeof e=="function"}class ai{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var o,s;this.listeners.add(r);const i=(s=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:s.call(o,r,this);return()=>{this.listeners.delete(r),i?.()}},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):ii(t)?this.state=t(this.prevState):this.state=t,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),si(this)}}function We(e,t=r=>r,n={}){const r=n.equal??li;return ti.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,r)}function li(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=Vn(e);if(n.length!==Vn(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 Vn(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}function $e(e,t,n){let r=n.initialDeps??[],o,s=!0;function i(){var a,c,d;let g;n.key&&((a=n.debug)!=null&&a.call(n))&&(g=Date.now());const h=e();if(!(h.length!==r.length||h.some((p,x)=>r[x]!==p)))return o;r=h;let m;if(n.key&&((c=n.debug)!=null&&c.call(n))&&(m=Date.now()),o=t(...h),n.key&&((d=n.debug)!=null&&d.call(n))){const p=Math.round((Date.now()-g)*100)/100,x=Math.round((Date.now()-m)*100)/100,y=x/16,T=(D,j)=>{for(D=String(D);D.length<j;)D=" "+D;return D};console.info(`%c⏱ ${T(x,5)} /${T(p,5)} ms`,`
|
|
11
|
+
font-size: .6rem;
|
|
12
|
+
font-weight: bold;
|
|
13
|
+
color: hsl(${Math.max(0,Math.min(120-120*y,120))}deg 100% 31%);`,n?.key)}return n?.onChange&&!(s&&n.skipInitialOnChange)&&n.onChange(o),s=!1,o}return i.updateDeps=a=>{r=a},i}function Yn(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const ci=(e,t)=>Math.abs(e-t)<1.01,ui=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}},Hn=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},di=e=>e,fi=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let o=t;o<=n;o++)r.push(o);return r},hi=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const o=i=>{const{width:a,height:c}=i;t({width:Math.round(a),height:Math.round(c)})};if(o(Hn(n)),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(i=>{const a=()=>{const c=i[0];if(c?.borderBoxSize){const d=c.borderBoxSize[0];if(d){o({width:d.inlineSize,height:d.blockSize});return}}o(Hn(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},Un={passive:!0},Gn=typeof window>"u"?!0:"onscrollend"in window,gi=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let o=0;const s=e.options.useScrollendEvent&&Gn?()=>{}:ui(r,()=>{t(o,!1)},e.options.isScrollingResetDelay),i=g=>()=>{const{horizontal:h,isRtl:v}=e.options;o=h?n.scrollLeft*(v&&-1||1):n.scrollTop,s(),t(o,g)},a=i(!0),c=i(!1);n.addEventListener("scroll",a,Un);const d=e.options.useScrollendEvent&&Gn;return d&&n.addEventListener("scrollend",c,Un),()=>{n.removeEventListener("scroll",a),d&&n.removeEventListener("scrollend",c)}},pi=(e,t,n)=>{if(t?.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},mi=(e,{adjustments:t=0,behavior:n},r)=>{var o,s;const i=e+t;(s=(o=r.scrollElement)==null?void 0:o.scrollTo)==null||s.call(o,{[r.options.horizontal?"left":"top"]:i,behavior:n})};class vi{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.currentScrollToIndex=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(o=>{o.forEach(s=>{const i=()=>{this._measureElement(s.target,s)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var o;(o=r())==null||o.disconnect(),n=null},observe:o=>{var s;return(s=r())==null?void 0:s.observe(o,{box:"border-box"})},unobserve:o=>{var s;return(s=r())==null?void 0:s.unobserve(o)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,o])=>{typeof o>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:di,rangeExtractor:fi,onChange:()=>{},measureElement:pi,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var r,o;(o=(r=this.options).onChange)==null||o.call(r,this,n)},this.maybeNotify=$e(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,s)=>{this.scrollAdjustments=0,this.scrollDirection=s?this.getScrollOffset()<o?"forward":"backward":null,this.scrollOffset=o,this.isScrolling=s,this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const o=new Map,s=new Map;for(let i=r-1;i>=0;i--){const a=n[i];if(o.has(a.lane))continue;const c=s.get(a.lane);if(c==null||a.end>c.end?s.set(a.lane,a):a.end<c.end&&o.set(a.lane,!0),o.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((i,a)=>i.end===a.end?i.index-a.index:i.end-a.end)[0]:void 0},this.getMeasurementOptions=$e(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(n,r,o,s,i,a)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:i,lanes:a}),{key:!1}),this.getMeasurements=$e(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:i,lanes:a},c)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const v of this.laneAssignments.keys())v>=n&&this.laneAssignments.delete(v);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(v=>{this.itemSizeCache.set(v.key,v.size)}));const d=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1);const g=this.measurementsCache.slice(0,d),h=new Array(a).fill(void 0);for(let v=0;v<d;v++){const m=g[v];m&&(h[m.lane]=v)}for(let v=d;v<n;v++){const m=s(v),p=this.laneAssignments.get(v);let x,y;if(p!==void 0&&this.options.lanes>1){x=p;const I=h[x],$=I!==void 0?g[I]:void 0;y=$?$.end+this.options.gap:r+o}else{const I=this.options.lanes===1?g[v-1]:this.getFurthestMeasurement(g,v);y=I?I.end+this.options.gap:r+o,x=I?I.lane:v%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(v,x)}const T=c.get(m),D=typeof T=="number"?T:this.options.estimateSize(v),j=y+D;g[v]={index:v,start:y,size:D,end:j,key:m,lane:x},h[x]=v}return this.measurementsCache=g,g},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=$e(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,o,s)=>this.range=n.length>0&&r>0?xi({measurements:n,outerSize:r,scrollOffset:o,lanes:s}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=$e(()=>{let n=null,r=null;const o=this.calculateRange();return o&&(n=o.startIndex,r=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,o,s,i)=>s===null||i===null?[]:n({startIndex:s,endIndex:i,overscan:r,count:o}),{key:process.env.NODE_ENV!=="production"&&"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,o=n.getAttribute(r);return o?parseInt(o,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(n,r)=>{const o=this.indexFromElement(n),s=this.measurementsCache[o];if(!s)return;const i=s.key,a=this.elementsCache.get(i);a!==n&&(a&&this.observer.unobserve(a),this.observer.observe(n),this.elementsCache.set(i,n)),n.isConnected&&this.resizeItem(o,this.options.measureElement(n,r,this))},this.resizeItem=(n,r)=>{const o=this.measurementsCache[n];if(!o)return;const s=this.itemSizeCache.get(o.key)??o.size,i=r-s;i!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,i,this):o.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",i),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=i,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(o.index),this.itemSizeCache=new Map(this.itemSizeCache.set(o.key,r)),this.notify(!1))},this.measureElement=n=>{if(!n){this.elementsCache.forEach((r,o)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(o))});return}this._measureElement(n,void 0)},this.getVirtualItems=$e(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const o=[];for(let s=0,i=n.length;s<i;s++){const a=n[s],c=r[a];o.push(c)}return o},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return Yn(r[Tr(0,r.length-1,o=>Yn(r[o]).start,n)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(n,r,o=0)=>{if(!this.scrollElement)return 0;const s=this.getSize(),i=this.getScrollOffset();r==="auto"&&(r=n>=i+s?"end":"start"),r==="center"?n+=(o-s)/2:r==="end"&&(n-=s);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const o=this.measurementsCache[n];if(!o)return;const s=this.getSize(),i=this.getScrollOffset();if(r==="auto")if(o.end>=i+s-this.options.scrollPaddingEnd)r="end";else if(o.start<=i+this.options.scrollPaddingStart)r="start";else return[i,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const a=r==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,r,o.size),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(n,{align:r="start",behavior:o}={})=>{o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,r),{adjustments:void 0,behavior:o})},this.scrollToIndex=(n,{align:r="auto",behavior:o}={})=>{o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),n=Math.max(0,Math.min(n,this.options.count-1)),this.currentScrollToIndex=n;let s=0;const i=10,a=d=>{if(!this.targetWindow)return;const g=this.getOffsetForIndex(n,d);if(!g){console.warn("Failed to get offset for index:",n);return}const[h,v]=g;this._scrollToOffset(h,{adjustments:void 0,behavior:o}),this.targetWindow.requestAnimationFrame(()=>{const m=()=>{if(this.currentScrollToIndex!==n)return;const p=this.getScrollOffset(),x=this.getOffsetForIndex(n,v);if(!x){console.warn("Failed to get offset for index:",n);return}ci(x[0],p)||c(v)};this.isDynamicMode()?this.targetWindow.requestAnimationFrame(m):m()})},c=d=>{this.targetWindow&&this.currentScrollToIndex===n&&(s++,s<i?(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("Schedule retry",s,i),this.targetWindow.requestAnimationFrame(()=>a(d))):console.warn(`Failed to scroll to index ${n} after ${i} attempts.`))};a(r)},this.scrollBy=(n,{behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let o;if(r.length===0)o=this.options.paddingStart;else if(this.options.lanes===1)o=((n=r[r.length-1])==null?void 0:n.end)??0;else{const s=Array(this.options.lanes).fill(null);let i=r.length-1;for(;i>=0&&s.some(a=>a===null);){const a=r[i];s[a.lane]===null&&(s[a.lane]=a.end),i--}o=Math.max(...s.filter(a=>a!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:o})=>{this.options.scrollToFn(n,{behavior:o,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(t)}}const Tr=(e,t,n,r)=>{for(;e<=t;){const o=(e+t)/2|0,s=n(o);if(s<r)e=o+1;else if(s>r)t=o-1;else return o}return e>0?e-1:0};function xi({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){const o=e.length-1,s=c=>e[c].start;if(e.length<=r)return{startIndex:0,endIndex:o};let i=Tr(0,o,s,n),a=i;if(r===1)for(;a<o&&e[a].end<n+t;)a++;else if(r>1){const c=Array(r).fill(0);for(;a<o&&c.some(g=>g<n+t);){const g=e[a];c[g.lane]=g.end,a++}const d=Array(r).fill(n+t);for(;i>=0&&d.some(g=>g>=n);){const g=e[i];d[g.lane]=g.start,i--}i=Math.max(0,i-i%r),a=Math.min(o,a+(r-1-a%r))}return{startIndex:i,endIndex:a}}const qn=typeof document<"u"?mt.useLayoutEffect:mt.useEffect;function bi({useFlushSync:e=!0,...t}){const n=mt.useReducer(()=>({}),{})[1],r={...t,onChange:(s,i)=>{var a;e&&i?Ae.flushSync(n):n(),(a=t.onChange)==null||a.call(t,s,i)}},[o]=mt.useState(()=>new vi(r));return o.setOptions(r),qn(()=>o._didMount(),[]),qn(()=>o._willUpdate()),o}function yi(e){return bi({observeElementRect:hi,observeElementOffset:gi,scrollToFn:mi,...e})}const Re="__actions__",he="__visibility__",Si="__serial_number__",ne=new ai({tableId:"",sortColumn:null,sortDirection:null,visibility:{},columnOrder:[],columnWidths:{},data:[],sortableColumns:[],enableColumnVisibility:!0}),Mt=e=>`datatable:${e}:column-widths`;function Or(e,t,n=!0){const r=e[0]??{},o=180,i=(t&&t.length?t:Object.keys(r).map(p=>({id:p,label:p}))).filter(p=>p.id===Re||Object.prototype.hasOwnProperty.call(r,p.id)),{tableId:a}=ne.state,c=JSON.parse(localStorage.getItem(Ir(a))||"[]");let d=[...c.map(p=>i.find(x=>x.id===p)).filter(Boolean),...i.filter(p=>!c.includes(p.id))];n?d.some(x=>x.id===he)||(d=[...d,{type:"visibility",id:he,label:"",minWidth:20}]):d=d.filter(p=>p.id!==he);const g=JSON.parse(localStorage.getItem(Jt(a))||"{}"),h={};if(n){for(const p of d)p.id===he||p.id===Re?h[p.id]=!0:h[p.id]=g[p.id]??!0;localStorage.setItem(Jt(a),JSON.stringify(h))}const v=JSON.parse(localStorage.getItem(Mt(a))||"{}"),m={...v};d.forEach(p=>{p.id!==he&&p.id!==Re&&!(p.id in v)&&(m[p.id]=typeof p.minWidth=="number"?p.minWidth:o)}),ne.setState(p=>({...p,data:e,columnOrder:d,visibility:h,columnWidths:m,enableColumnVisibility:n,sortableColumns:d.filter(x=>x.id!==he).map(x=>({id:x.id,label:x.label,sortable:x.id!==Re,minWidth:x.minWidth}))}))}function _r(e){ne.setState(t=>({...t,tableId:e,sortColumn:null,sortDirection:"asc"}))}function wi(e,t){ne.setState(n=>{const r=typeof n.columnOrder.find(s=>s.id===e)?.minWidth=="number"?n.columnOrder.find(s=>s.id===e)?.minWidth:50,o={...n.columnWidths,[e]:Math.max(r,t)};return localStorage.setItem(Mt(n.tableId),JSON.stringify(o)),{...n,columnWidths:o}})}const Ir=e=>`table_column_order_v1:${e}`,Jt=e=>`table_column_visibility_v1:${e}`,Ci=e=>{const{tableId:t}=ne.state;localStorage.setItem(Ir(t),JSON.stringify(e.map(n=>n.id))),ne.setState(n=>({...n,columnOrder:e})),ne.setState(n=>({...n,columnOrder:e}))};function Di(e){ne.setState(t=>{if(t.sortColumn===e){if(t.sortDirection==="asc")return{...t,sortDirection:"desc"};if(t.sortDirection==="desc")return{...t,sortColumn:null,sortDirection:null}}return{...t,sortColumn:e,sortDirection:"asc"}})}const Ei=e=>{ne.setState(t=>{const n={...t.visibility,[e]:!t.visibility[e]};return t.tableId&&localStorage.setItem(Jt(t.tableId),JSON.stringify(n)),{...t,visibility:n}})};function ji(e,t){ne.setState(n=>{const r=n.columnOrder.find(i=>i.id===e),o=typeof r?.minWidth=="number"?r.minWidth:120,s={...n.columnWidths,[e]:Math.max(o,t)};return localStorage.setItem(Mt(n.tableId),JSON.stringify(s)),{...n,columnWidths:s}})}const Mi=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ri=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Kn=e=>{const t=Ri(e);return t.charAt(0).toUpperCase()+t.slice(1)},kr=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),Ti=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 _i=f.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...a},c)=>f.createElement("svg",{ref:c,...Oi,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:kr("lucide",o),...!s&&!Ti(a)&&{"aria-hidden":"true"},...a},[...i.map(([d,g])=>f.createElement(d,g)),...Array.isArray(s)?s:[s]]));const ae=(e,t)=>{const n=f.forwardRef(({className:r,...o},s)=>f.createElement(_i,{ref:s,iconNode:t,className:kr(`lucide-${Mi(Kn(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Kn(e),n};const Ii=[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]],ki=ae("arrow-left-right",Ii);const $i=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],Ai=ae("bookmark",$i);const zi=[["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"}]],$r=ae("calendar",zi);const Li=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Ni=ae("chevron-left",Li);const Pi=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Fi=ae("chevron-right",Pi);const Wi=[["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"}]],Bi=ae("delete",Wi);const Vi=[["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"}]],Yi=ae("funnel",Vi);const Hi=[["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"}]],Ar=ae("grip-vertical",Hi);const Ui=[["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"}]],Gi=ae("pen",Ui);const qi=[["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"}]],Ki=ae("refresh-ccw",qi);const Xi=[["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"}]],Ji=ae("settings",Xi);const Zi=[["rect",{width:"20",height:"6",x:"2",y:"4",rx:"2",key:"qdearl"}],["rect",{width:"20",height:"6",x:"2",y:"14",rx:"2",key:"1xrn6j"}]],Qi=ae("stretch-horizontal",Zi);const ea=[["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"}]],zr=ae("triangle-alert",ea);const ta=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Lr=ae("x",ta);function S(e){return f.forwardRef((t,n)=>{const{children:r,...o}=t;return l.jsx(e,{ref:n,...o,children:r})})}const na=S(u.Menu.Trigger),ra=S(u.Menu.Positioner),oa=S(u.Menu.Content),sa=S(u.Menu.Item),ia=S(u.Checkbox.Label),aa=S(u.Checkbox.HiddenInput),la=S(u.Checkbox.Control);function ca({visibility:e}){const{sortableColumns:t}=We(ne);return l.jsxs(u.Menu.Root,{closeOnSelect:!1,children:[l.jsx(na,{asChild:!0,children:l.jsx(u.IconButton,{"aria-label":"Toggle columns",variant:"ghost",ml:"1",size:"xs",children:l.jsx(Qi,{size:18})})}),l.jsx(u.Portal,{children:l.jsx(ra,{children:l.jsx(oa,{minW:"220px",children:t.map(n=>{const r=!!e[n.id];return l.jsx(sa,{value:n.id,closeOnSelect:!1,children:l.jsxs(u.Checkbox.Root,{checked:r,onCheckedChange:()=>Ei(n.id),children:[l.jsx(aa,{}),l.jsx(la,{}),l.jsx(ia,{children:n.label})]})},n.id)})})})})]})}function ua({id:e,children:t,onClick:n,cursor:r,borderRight:o,backgroundColor:s,minW:i}){const{columnWidths:a}=We(ne),h=`${a[e]??100}px`,v=f.useRef(0),m=f.useRef(0),{setNodeRef:p,attributes:x,listeners:y,transform:T,transition:D}=jr({id:e}),j=_=>{_.stopPropagation(),v.current=_.clientX;const k=_.currentTarget.closest("th");m.current=k?.getBoundingClientRect().width||a[e]||180;const L=B=>{let z=m.current+(B.clientX-v.current);ji(e,z)},H=()=>{document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",H)};document.addEventListener("mousemove",L),document.addEventListener("mouseup",H)},[I,$]=f.useState(!1);return l.jsx(u.Table.ColumnHeader,{ref:p,onClick:n,backgroundColor:s,width:h,minWidth:i||"20px",style:{transform:Le.Transform.toString(T),transition:D,cursor:r,borderRight:o,boxSizing:"border-box"},bg:"gray.100",...x,children:l.jsxs(u.HStack,{position:"relative",width:"100%",children:[l.jsx("span",{...y,children:l.jsx(Ar,{size:12,style:{cursor:"grab"}})}),t,l.jsx(u.Box,{position:"absolute",right:0,top:0,h:"100%",w:"10px",cursor:"col-resize",onMouseDown:j,onMouseEnter:()=>$(!0),onMouseLeave:()=>$(!1),display:"flex",alignItems:"center",justifyContent:"center",zIndex:2,children:I&&l.jsx(ki,{size:14,style:{pointerEvents:"none",opacity:.8}})})]})})}function da(){const{columnOrder:e,visibility:t,enableColumnVisibility:n,sortColumn:r,sortDirection:o}=We(ne),s=e.filter(i=>!n&&i.id===he?!1:i.id===he||i.id===Re?!0:t[i.id]!==!1).sort((i,a)=>i.id===he?1:a.id===he?-1:0);return l.jsx(u.Table.Header,{position:"sticky",top:0,zIndex:1,css:{contain:"layout style paint",backgroundColor:"white"},children:l.jsx(u.Table.Row,{height:"28px",children:s.map(i=>{if(i.id===he)return l.jsx(u.Table.ColumnHeader,{bg:"gray.100",w:100,children:l.jsx(ca,{visibility:t})},i.id);const a=i.type!=="actions"&&i.type!=="visibility",c=r===i.id;return l.jsx(ua,{id:i.id,minW:i.minWidth,onClick:a?()=>Di(i.id):void 0,cursor:a?"pointer":"default",borderRight:"2px solid #dcdcdc",children:l.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,userSelect:"none"},children:[i.label,a&&(c?o==="asc"?" ▲":" ▼":l.jsx("span",{style:{opacity:.4},children:" ⇅"}))]})},i.id)})})})}const fa=[10,20,50,100],ha=S(u.Select.Positioner),ga=S(u.Select.Content),pa=S(u.Select.Item),ma=S(u.Pagination.PrevTrigger),va=S(u.Pagination.NextTrigger),xa=S(u.Select.HiddenSelect),ba=S(u.Select.Control),ya=S(u.Select.Trigger),Sa=S(u.Select.ValueText),wa=S(u.Select.IndicatorGroup),Ca=S(u.Select.Indicator);function Da({totalCount:e,pageSize:t,currentPage:n,onPageChange:r,onPageSizeChange:o,siblingCount:s=2,pageSizeOptions:i=fa}){const a=u.createListCollection({items:i.map(c=>({label:String(c),value:String(c)}))});return l.jsx(u.Box,{width:"100%",children:l.jsxs(u.HStack,{justify:"space-between",mx:"auto",flexWrap:"wrap",children:[l.jsxs(u.HStack,{children:[l.jsx(u.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:"Rows per page:"}),l.jsxs(u.Select.Root,{collection:a,size:"sm",width:"60px",onValueChange:c=>o?.(Number(c.items[0].value)),value:[String(t)],children:[l.jsx(xa,{}),l.jsxs(ba,{children:[l.jsx(ya,{children:l.jsx(Sa,{placeholder:""})}),l.jsx(wa,{children:l.jsx(Ca,{})})]}),l.jsx(u.Portal,{children:l.jsx(ha,{children:l.jsx(ga,{children:a.items.map(c=>l.jsxs(pa,{item:c.value,children:[c.label,l.jsx(u.Select.ItemIndicator,{})]},c.value))})})})]}),l.jsxs(u.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:["of ",e]})]}),l.jsx(u.Pagination.Root,{count:e,pageSize:t,page:n,siblingCount:s,onPageChange:c=>r&&r(c.page),children:l.jsxs(u.ButtonGroup,{size:"sm",variant:"ghost",children:[l.jsx(ma,{asChild:!0,children:l.jsx(u.IconButton,{"aria-label":"Previous page",children:l.jsx(Ni,{size:18})})}),l.jsx(u.Pagination.Items,{render:c=>l.jsx(u.IconButton,{variant:c.type==="page"&&c.value===n?"outline":"ghost","aria-current":c.type==="page"&&c.value===n?"page":void 0,children:c.type==="page"?c.value:"…"},c.value??c.type)}),l.jsx(va,{asChild:!0,children:l.jsx(u.IconButton,{"aria-label":"Next page",children:l.jsx(Fi,{size:18})})})]})})]})})}function Ea({row:e,columns:t,visibility:n,onRowSelect:r,onRowSelectEvent:o,index:s,height:i}){const{columnWidths:a}=We(ne);return l.jsx(u.Table.Row,{"data-index":s,onClick:c=>o==="left"&&r?.(e,c),cursor:r?"pointer":"default",h:`${i}px`,_hover:{bg:"gray.50"},children:t.map(c=>c.id!==Re&&n[c.id]===!1?null:l.jsx(u.Table.Cell,{py:0,height:`${i}px`,width:`${a[c.id]??30}px`,minWidth:c.minWidth||"40px",maxWidth:`${a[c.id]??180}px`,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:"render"in c&&c.render?c.render(e):l.jsx("div",{children:String(e[c.id]??"")})},c.id))})}const ja=f.memo(Ea);function Ma({data:e,columns:t,rowVirtualizer:n,onRowSelect:r,onRowSelectEvent:o="left",rowHeight:s}){const{visibility:i}=We(ne),a=n.getVirtualItems(),c=a.length>0?a[0].start:0,d=a.length>0?n.getTotalSize()-a[a.length-1].end:0;return l.jsxs(u.Table.Body,{children:[c>0&&l.jsx(u.Table.Row,{h:`${c}px`,children:l.jsx(u.Table.Cell,{colSpan:t.length,p:0,border:"none",h:`${c}px`})}),a.map(g=>{const h=e[g.index];return h?l.jsx(ja,{index:g.index,row:h,columns:t,visibility:i,onRowSelect:r,onRowSelectEvent:o,height:s},h.id):null}),d>0&&l.jsx(u.Table.Row,{h:`${d}px`,children:l.jsx(u.Table.Cell,{colSpan:t.length,p:0,border:"none",h:`${d}px`})})]})}function Ra({rows:e=6,columns:t}){return l.jsx(u.Table.Body,{children:Array.from({length:e}).map((n,r)=>l.jsx(u.Table.Row,{children:Array.from({length:t}).map((o,s)=>l.jsx(u.Table.Cell,{children:l.jsx(u.Skeleton,{height:"25px"})},s))},r))})}function Ta(e,t,n){if(!t||!n||t.type==="actions"||t.type==="visibility")return e;const r="sortAccessor"in t&&t.sortAccessor?t.sortAccessor:s=>s[t.id],o="sortComparator"in t&&t.sortComparator?t.sortComparator:(s,i,a)=>{const c=r(s),d=r(i);return c==null&&d==null?0:c==null?1:d==null?-1:typeof c=="number"&&typeof d=="number"?a==="asc"?c-d:d-c:c instanceof Date&&d instanceof Date?a==="asc"?c.getTime()-d.getTime():d.getTime()-c.getTime():a==="asc"?String(c).localeCompare(String(d)):String(d).localeCompare(String(c))};return[...e].sort((s,i)=>o(s,i,n))}function Oa({tableId:e,data:t=[],headers:n=[],loading:r=!1,loadingChildren:o,skeletonLoading:s=!1,emptyMessage:i="No data",page:a=1,pageSize:c=10,onPageChange:d,onPageSizeChange:g,density:h="sm",totalCount:v=0,pageSizeOptions:m,onRowSelect:p,onRowSelectEvent:x="left",enableColumnVisibility:y=!0,dataType:T="pagination"}){const D=f.useRef(null);f.useEffect(()=>{_r(e)},[e]),f.useEffect(()=>{Or(t,n,y)},[t,n,y]);const{sortColumn:j,sortDirection:I,data:$,columnOrder:_}=We(ne),k=f.useMemo(()=>_.length?_:n,[_,n]),L=f.useMemo(()=>{if(!j||!I)return $;const E=k.find(A=>A.id===j);return Ta($,E,I)},[$,j,I,k]),H=(Math.max(1,a)-1)*c,B=f.useMemo(()=>T==="infinite"?L:L.slice(H,H+c),[L,H,c,T]),W=h==="sm"?45:h==="md"?56:64,F=yi({count:B.length,getScrollElement:()=>D.current,estimateSize:()=>W,overscan:25}),M=E=>{const{active:A,over:P}=E;if(!P||A.id===P.id)return;const b=k.findIndex(N=>N.id===A.id),O=k.findIndex(N=>N.id===P.id);Ci(jt(k,b,O))},w=r&&!s,C=s&&!r,R=!r&&!s&&B.length===0;return l.jsx(yr,{collisionDetection:ir,onDragEnd:M,children:l.jsx(Dr,{items:k.map(E=>E.id),strategy:Ps,children:l.jsxs(u.Box,{flex:"1",minH:0,display:"flex",flexDirection:"column",p:2,children:[l.jsxs(u.Box,{ref:D,flex:"1",minH:0,position:"relative",overflowX:"auto",css:{"&::-webkit-scrollbar":{width:"8px",height:"8px"},willChange:"transform"},children:[w&&l.jsx(u.Box,{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,bg:"whiteAlpha.600",children:o??l.jsx(u.Spinner,{})}),l.jsxs(u.Table.Root,{variant:"outline",w:"max-content",minW:"100%",size:h,tableLayout:"fixed",css:{borderCollapse:"collapse","& th, & td":{boxSizing:"border-box"}},children:[l.jsx(da,{}),C?l.jsx(Ra,{rows:c,columns:k.length}):R?l.jsx(u.Table.Body,{children:l.jsx(u.Table.Row,{children:l.jsx(u.Table.Cell,{colSpan:k.length,textAlign:"center",h:"200px",color:"gray.500",children:i})})}):l.jsx(Ma,{data:B,columns:k,rowVirtualizer:F,onRowSelect:p,onRowSelectEvent:x,rowHeight:W})]})]}),T==="pagination"&&l.jsx(u.Box,{mt:.5,children:l.jsx(Da,{totalCount:v,pageSize:c,currentPage:a,onPageChange:E=>{D.current&&(D.current.scrollTop=0),d?.(E)},onPageSizeChange:E=>{g?.(E),a>1&&d?.(1)},pageSizeOptions:m})}),T==="infinite"&&l.jsxs(u.Box,{mt:2,px:2,fontSize:"sm",color:"gray.500",children:["Showing ",B.length," rows"]})]})})})}const te=[];for(let e=0;e<256;++e)te.push((e+256).toString(16).slice(1));function _a(e,t=0){return(te[e[t+0]]+te[e[t+1]]+te[e[t+2]]+te[e[t+3]]+"-"+te[e[t+4]]+te[e[t+5]]+"-"+te[e[t+6]]+te[e[t+7]]+"-"+te[e[t+8]]+te[e[t+9]]+"-"+te[e[t+10]]+te[e[t+11]]+te[e[t+12]]+te[e[t+13]]+te[e[t+14]]+te[e[t+15]]).toLowerCase()}let Bt;const Ia=new Uint8Array(16);function ka(){if(!Bt){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Bt=crypto.getRandomValues.bind(crypto)}return Bt(Ia)}const $a=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Xn={randomUUID:$a};function Aa(e,t,n){e=e||{};const r=e.random??e.rng?.()??ka();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,_a(r)}function za(e,t,n){return Xn.randomUUID&&!e?Xn.randomUUID():Aa(e)}const La=S(u.Checkbox.Root),Na=S(u.Checkbox.HiddenInput),Pa=S(u.Checkbox.Control),Fa=S(u.Checkbox.Label),Nr=({value:e,onChange:t,size:n="sm",label:r,helperText:o,isDisabled:s,required:i,errorText:a})=>l.jsxs(La,{value:e,onChange:t,size:n,children:[l.jsx(Na,{}),l.jsx(Pa,{disabled:s,required:i,errorText:a,helperText:o}),r&&l.jsx(Fa,{children:r})]}),Wa=S(u.Combobox.Root),Ba=S(u.Combobox.Control),Va=S(u.Combobox.Input),Ya=S(u.Combobox.IndicatorGroup),Ha=S(u.Combobox.ClearTrigger),Ua=S(u.Combobox.Trigger),Ga=S(u.Combobox.Positioner),qa=S(u.Combobox.Content);function Pr({label:e,size:t="sm",width:n="100%",variant:r="outline",items:o=[],itemToString:s,itemToValue:i,renderItem:a,value:c,loading:d,error:g,errorMessage:h,placeholder:v,helpText:m,onInputChange:p,onSelect:x,visible:y=!0,rootProps:T,inputProps:D,controlProps:j,contentProps:I,itemProps:$}){const[_,k]=f.useState(""),L=f.useMemo(()=>Array.isArray(o)?o:[],[o]),{collection:H,set:B}=u.useListCollection({initialItems:L,itemToString:s,itemToValue:i}),z=f.useMemo(()=>{if(!_)return L;const W=_.toLowerCase();return L.filter(F=>s(F).toLowerCase().includes(W))},[o,_,s]);return f.useEffect(()=>{B(z)},[z,B]),f.useEffect(()=>{c&&k(s(c))},[c,s]),l.jsxs(Wa,{width:n,size:t,variant:r,collection:H,placeholder:v,onInputValueChange:W=>{p?.(W.inputValue),k(W.inputValue)},value:c?[i(c)]:[],onValueChange:W=>{const F=W.value?.[0];if(!F)return;const M=H.items.find(w=>i(w)===F);M&&x?.(M)},positioning:{sameWidth:!1,placement:"bottom-start"},...T,children:[y&&e&&l.jsx(u.Text,{fontSize:"sm",children:e}),l.jsxs(Ba,{...j,children:[l.jsx(Va,{placeholder:v??"Type to search",...D}),l.jsxs(Ya,{children:[l.jsx(Ha,{}),l.jsx(Ua,{})]})]}),l.jsx(Ga,{children:l.jsxs(qa,{minW:"sm",...I,children:[d?l.jsxs(u.HStack,{p:"2",children:[l.jsx(u.Spinner,{size:"xs",borderWidth:"1px"}),l.jsx(u.Span,{children:"Loading..."})]}):g?l.jsx(u.Text,{p:"2",color:"red.500",fontSize:"sm",children:h||"Something went wrong"}):H.items.map(W=>l.jsxs(u.Combobox.Item,{item:W,...$,children:[a(W),l.jsx(u.Combobox.ItemIndicator,{})]},i(W))),m&&!g&&!d&&l.jsx(u.Text,{p:"2",color:"fg.muted",fontSize:"sm",children:m})]})})]})}const Ka=S(u.Popover.Root),Xa=S(u.Popover.Content),Ja=S(u.Popover.Arrow),Za=S(u.Popover.Trigger),Qa=S(u.Popover.Positioner);function Me(e){if(!e)return"";const t=String(e.getDate()).padStart(2,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=e.getFullYear();return`${t}-${n}-${r}`}function Jn(e){const t=e.split(/\s+to\s+/i),n=t[0],r=t[1],o=a=>{if(!a)return null;const c=a.trim().split("-");if(c.length!==3)return null;const[d,g,h]=c,v=parseInt(d),m=parseInt(g)-1,p=parseInt(h);if(isNaN(v)||isNaN(m)||isNaN(p)||h.length!==4)return null;const x=new Date(p,m,v);return x.getDate()===v&&x.getMonth()===m?x:null},s=o(n),i=o(r);return{start:s,end:i}}function Fr({startDate:e,endDate:t,onChange:n,width:r="280px",showLabel:o=!0,label:s="Select date range",visible:i=!0}){const[a,c]=f.useState(!1),[d,g]=f.useState(e||new Date),[h,v]=f.useState(null),[m,p]=f.useState(e||null),[x,y]=f.useState(t||null),T=(W,F)=>W&&F?`${Me(W)} to ${Me(F)}`:W?`${Me(W)}`:"",[D,j]=f.useState(T(e,t));f.useEffect(()=>{p(e||null),y(t||null)},[e,t]);const I=new Date(d.getFullYear(),d.getMonth()+1,0).getDate(),$=new Date(d.getFullYear(),d.getMonth(),1).getDay(),_=()=>{g(new Date(d.getFullYear(),d.getMonth()-1,1))},k=()=>{g(new Date(d.getFullYear(),d.getMonth()+1,1))},L=W=>{const F=new Date(d.getFullYear(),d.getMonth(),W);if(!m||m&&x){p(F),y(null),n(F,null),j(Me(F));return}if(m&&!x){const M=F<m?F:m,w=F<m?m:F;p(M),y(w),n(M,w),j(`${Me(M)} to ${Me(w)}`),c(!1)}},H=W=>{const F=W.target.value;j(F);const{start:M,end:w}=Jn(F);if(M&&w){const C=M<w?M:w,R=M<w?w:M;n(C,R),g(C)}else M&&!F.toLowerCase().includes("to")&&n(M,null)},B=W=>{if(W.key!=="Enter")return;const{start:F,end:M}=Jn(D);if(F&&!M&&!D.toLowerCase().includes("to")){const w=`${Me(F)} to `;j(w),p(F),y(null),n(F,null),requestAnimationFrame(()=>{W.target.setSelectionRange(w.length,w.length)});return}if(F&&M){const w=F<M?F:M,C=F<M?M:F;p(w),y(C),n(w,C),c(!1)}},z=()=>{p(null),y(null),j(""),n(null,null)};return l.jsxs(u.Box,{width:r,onKeyDown:B,children:[o&&!i&&l.jsx(u.Text,{fontSize:"xs",color:"fg.muted",mb:1,fontWeight:"medium",children:s}),l.jsxs(Ka,{open:a,onOpenChange:W=>c(W.open),positioning:{placement:"bottom-start",gutter:4},children:[l.jsxs(u.Group,{attached:!0,w:"full",position:"relative",children:[l.jsx(u.Input,{placeholder:"DD-MM-YYYY to DD-MM-YYYY",value:D,onChange:H,size:"sm",autoComplete:"off"}),D&&l.jsx(u.IconButton,{size:"xs",variant:"ghost","aria-label":"Clear date",onClick:z,position:"absolute",right:"32px",top:"50%",transform:"translateY(-50%)",children:l.jsx(Lr,{size:14})}),l.jsx(Za,{asChild:!0,children:l.jsx(u.InputAddon,{cursor:"pointer",px:2,_hover:{bg:"gray.100"},transition:"background 0.2s",children:l.jsx($r,{size:16})})})]}),l.jsx(Qa,{children:l.jsxs(Xa,{width:"300px",p:4,boxShadow:"xl",zIndex:1e3,borderRadius:"md",outline:"none",children:[l.jsx(Ja,{}),l.jsxs(u.HStack,{justify:"space-between",mb:4,children:[l.jsx(u.IconButton,{size:"xs",variant:"ghost",onClick:_,"aria-label":"Previous month",children:"‹"}),l.jsx(u.Text,{fontWeight:"bold",fontSize:"sm",children:d.toLocaleString("default",{month:"long",year:"numeric"})}),l.jsx(u.IconButton,{size:"xs",variant:"ghost",onClick:k,"aria-label":"Next month",children:"›"})]}),l.jsxs(u.Grid,{templateColumns:"repeat(7, 1fr)",gap:1,textAlign:"center",children:[["S","M","T","W","T","F","S"].map((W,F)=>l.jsx(u.Text,{fontSize:"xs",fontWeight:"bold",color:"fg.subtle",py:1,children:W},`${W}-${F}`)),Array($).fill(null).map((W,F)=>l.jsx(u.Box,{},`empty-${F}`)),Array.from({length:I},(W,F)=>{const M=F+1,w=new Date(d.getFullYear(),d.getMonth(),M);let C=e,R=t;if(C&&R&&h)if(e&&t){const V=e.getTime()+(t.getTime()-e.getTime())/2;h.getTime()<=V?C=h:R=h,C>R&&([C,R]=[R,C])}else e&&!t&&(C=h<e?h:e,R=h<e?e:h);const E=C&&w.getTime()===C.getTime(),A=R&&w.getTime()===R.getTime(),P=C&&R&&w>C&&w<R;let b="transparent",O="gray";E||A?O="blue":P&&(b="blue.100");let N="md";return P&&(N="0"),E&&R&&(N=A?"md":"md 0 0 md"),A&&C&&(N=E?"md":"0 md md 0"),l.jsx(u.Button,{size:"xs",variant:"ghost",colorPalette:O,bg:b!=="transparent"?b:void 0,onClick:()=>L(M),onMouseEnter:()=>v(w),onMouseLeave:()=>v(null),minW:"32px",h:"32px",fontSize:"xs",borderRadius:N,_hover:{bg:E||A?void 0:"gray.100"},children:M},M)})]}),l.jsx(u.Text,{fontSize:"10px",color:"fg.muted",mt:3,textAlign:"center",children:"Select Start Date then End Date"})]})})]})]})}const el=S(u.Popover.Root),tl=S(u.Popover.Content),nl=S(u.Popover.Arrow),rl=S(u.Popover.Trigger),ol=S(u.Popover.Positioner);function Zn(e){if(!e)return"";const t=String(e.getDate()).padStart(2,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=e.getFullYear();return`${t}-${n}-${r}`}function sl(e){const t=e.split("-");if(t.length!==3)return null;const[n,r,o]=t,s=parseInt(n),i=parseInt(r)-1,a=parseInt(o);if(isNaN(s)||isNaN(i)||isNaN(a)||o.length!==4)return null;const c=new Date(a,i,s);return c.getDate()===s&&c.getMonth()===i?c:null}function Wr({value:e,onChange:t,width:n="220px",visible:r=!0,label:o="Select date"}){const[s,i]=f.useState(!1),[a,c]=f.useState(e||new Date),[d,g]=f.useState(Zn(e));f.useEffect(()=>{g(Zn(e))},[e]);const h=new Date(a.getFullYear(),a.getMonth()+1,0).getDate(),v=new Date(a.getFullYear(),a.getMonth(),1).getDay(),m=()=>{c(new Date(a.getFullYear(),a.getMonth()-1,1))},p=()=>{c(new Date(a.getFullYear(),a.getMonth()+1,1))},x=D=>{const j=new Date(a.getFullYear(),a.getMonth(),D);t(j),i(!1)},y=D=>{if(s)switch(D.key){case"ArrowLeft":m();break;case"ArrowRight":p();break;case"Escape":i(!1);break}},T=()=>{g(""),t(null)};return l.jsxs(u.Box,{width:n,onKeyDown:y,children:[!r&&l.jsx(u.Text,{fontSize:"xs",color:"fg.muted",mb:1,fontWeight:"medium",children:o}),l.jsxs(el,{open:s,onOpenChange:D=>i(D.open),positioning:{placement:"bottom-start",gutter:4},children:[l.jsxs(u.Group,{attached:!0,w:"full",position:"relative",children:[d&&l.jsx(u.IconButton,{size:"xs",variant:"ghost","aria-label":"Clear date",onClick:T,position:"absolute",right:"32px",top:"50%",transform:"translateY(-50%)",zIndex:1,children:l.jsx(Lr,{size:14})}),l.jsx(u.Input,{placeholder:"DD-MM-YYYY",value:d,onChange:D=>{const j=D.target.value;g(j);const I=sl(j);I&&(t(I),c(I))},size:"sm",autoComplete:"off"}),l.jsx(rl,{asChild:!0,children:l.jsx(u.InputAddon,{cursor:"pointer",px:2,_hover:{bg:"gray.100"},transition:"background 0.2s",children:l.jsx($r,{size:16})})})]}),l.jsx(ol,{children:l.jsxs(tl,{width:"300px",p:4,boxShadow:"xl",zIndex:1e3,borderRadius:"md",outline:"none",children:[l.jsx(nl,{}),l.jsxs(u.HStack,{justify:"space-between",mb:4,children:[l.jsx(u.IconButton,{size:"xs",variant:"ghost",onClick:m,"aria-label":"Previous month",children:"‹"}),l.jsx(u.Text,{fontWeight:"bold",fontSize:"sm",children:a.toLocaleString("default",{month:"long",year:"numeric"})}),l.jsx(u.IconButton,{size:"xs",variant:"ghost",onClick:p,"aria-label":"Next month",children:"›"})]}),l.jsxs(u.Grid,{templateColumns:"repeat(7, 1fr)",gap:1,textAlign:"center",children:[["S","M","T","W","T","F","S"].map((D,j)=>l.jsx(u.Text,{fontSize:"xs",fontWeight:"bold",color:"fg.subtle",py:1,children:D},`${D}-${j}`)),Array(v).fill(null).map((D,j)=>l.jsx(u.Box,{},`empty-${j}`)),Array.from({length:h},(D,j)=>{const I=j+1,$=e&&e.getDate()===I&&e.getMonth()===a.getMonth()&&e.getFullYear()===a.getFullYear();return l.jsx(u.Button,{size:"xs",variant:$?"solid":"ghost",colorPalette:$?"blue":"gray",onClick:()=>x(I),minW:"32px",h:"32px",fontSize:"xs",borderRadius:"md",children:I},I)})]}),l.jsx(u.Text,{fontSize:"10px",color:"fg.muted",mt:3,textAlign:"center",children:"Use Arrow Keys to change months • Esc to close"})]})})]})]})}const il=S(u.Field.Root),al=S(u.Field.Label),ll=S(u.Field.HelperText),cl=S(u.Field.ErrorText),Zt=({icon:e,value:t,onChange:n,placeholder:r,size:o="xs",variant:s="outline",width:i="100%",label:a,helperText:c,isDisabled:d=!1,required:g=!1,errorText:h,visible:v,type:m="text",min:p=0,max:x=100,step:y=1})=>l.jsxs(il,{width:i,children:[v&&l.jsx(al,{children:a}),l.jsx(u.InputGroup,{startElement:e,children:l.jsx(u.Input,{value:t,onChange:T=>n?.(T.target.value),placeholder:r,size:o,type:m,variant:s,disabled:d,required:g,min:p,max:x,step:y})}),h&&l.jsx(cl,{fontSize:"xs",children:h}),c&&l.jsx(ll,{fontSize:"xs",children:c})]}),ul=S(u.Field.Root),dl=S(u.Field.HelperText),fl=S(u.Field.ErrorText),hl=S(u.Select.Root),gl=S(u.Select.Label),pl=S(u.Select.Control),ml=S(u.Select.Trigger),vl=S(u.Select.ValueText),xl=S(u.Select.IndicatorGroup),bl=S(u.Select.Indicator),yl=S(u.Select.Content),Sl=S(u.Select.Item),wl=S(u.Select.ItemIndicator),Cl=S(u.Select.HiddenSelect),Dl=S(u.Select.Positioner),Br=({options:e=[],label:t,value:n,onChange:r,placeholder:o,size:s="xs",width:i="100%",variant:a="outline",helperText:c,isDisabled:d,required:g,errorText:h,visible:v})=>{const m=f.useMemo(()=>u.createListCollection({items:e}),[e]),p=e.find(y=>y.value===n),x=y=>{y.preventDefault(),y.stopPropagation(),r?.(void 0)};return l.jsxs(ul,{disabled:d,required:g,children:[l.jsxs(hl,{collection:m,variant:a,size:s,width:i,value:n?[n]:[],onValueChange:y=>{r?.(y.value[0])},children:[l.jsx(Cl,{}),v&&l.jsx(gl,{children:t}),l.jsxs(pl,{children:[l.jsx(ml,{children:l.jsx(vl,{placeholder:o,children:p?.displayValue??p?.label})}),l.jsxs(xl,{children:[n&&!d&&l.jsx("div",{style:{pointerEvents:"auto",display:"flex",alignItems:"center"},onPointerDown:y=>y.stopPropagation(),onClick:y=>y.stopPropagation(),children:l.jsx(u.CloseButton,{size:"sm",variant:"ghost",onPointerDown:x,onClick:x,position:"relative",zIndex:10})}),l.jsx(bl,{})]})]}),l.jsx(Dl,{children:l.jsx(yl,{children:m.items.map((y,T)=>l.jsxs(Sl,{item:y,children:[y.label,l.jsx(wl,{})]},T))})})]}),c&&l.jsx(dl,{children:c}),h&&l.jsx(fl,{children:h})]})},El="FILTER_PRESETS_",Vr=e=>`${El}${e}`,Rt=e=>{if(typeof window>"u")return[];const t=localStorage.getItem(Vr(e));try{return t?JSON.parse(t):[]}catch(n){return console.error("Failed to parse presets",n),[]}},dn=(e,t)=>{typeof window>"u"||(localStorage.setItem(Vr(e),JSON.stringify(t)),window.dispatchEvent(new Event("storage_updated")))},Yr=(e,t)=>{const n=Rt(e);dn(e,[t,...n])},Hr=(e,t)=>{const n=Rt(e).filter(r=>r.id!==t);dn(e,n)},jl=S(u.Checkbox.Root),Ml=S(u.Checkbox.HiddenInput),Rl=S(u.Checkbox.Control),Tl=S(u.Slider.Root),Ol=S(u.Slider.Track),_l=S(u.Slider.Range),Il=S(u.Slider.Thumbs),kl=S(u.Slider.Control),$l=({filter:e,onVisibilityChange:t,onSizeChange:n})=>{const{attributes:r,listeners:o,setNodeRef:s,transform:i,transition:a}=jr({id:e.id}),c={transform:Le.Transform.toString(i),transition:a};return l.jsxs(u.VStack,{ref:s,style:c,align:"stretch",border:"1px solid",borderColor:"gray.200",rounded:"md",p:3,mb:3,bg:"white",children:[l.jsxs(u.HStack,{...r,...o,cursor:"grab",userSelect:"none",gap:2,children:[l.jsx(Ar,{size:16}),l.jsx(u.Text,{fontWeight:"bold",fontSize:"sm",children:e.label||e.id})]}),l.jsxs(u.HStack,{justify:"space-between",children:[l.jsx(u.Text,{fontSize:"sm",children:"Visible"}),l.jsxs(jl,{checked:e.visible,size:"sm",onCheckedChange:d=>t?.(e.id,!!d.checked),children:[l.jsx(Ml,{}),l.jsx(Rl,{})]})]}),l.jsxs(u.VStack,{align:"stretch",gap:1,children:[l.jsx(u.Text,{fontSize:"sm",children:"Size"}),l.jsx(Tl,{min:1,max:5,step:.5,value:[e.size??1],onValueChange:d=>n?.(e.id,d.value[0]),children:l.jsxs(kl,{children:[l.jsx(Ol,{children:l.jsx(_l,{})}),l.jsx(Il,{})]})})]})]})},Al=S(u.Drawer.Root),zl=S(u.Drawer.Trigger),Ll=S(u.Drawer.Backdrop),Nl=S(u.Drawer.Positioner),Pl=S(u.Drawer.Content),Fl=S(u.Drawer.Header),Wl=S(u.Drawer.Title),Bl=S(u.Drawer.Body),Vl=S(u.Drawer.Footer),Yl=S(u.Drawer.CloseTrigger),Hl=S(u.Tabs.Root),Ul=S(u.Tabs.List),Vt=S(u.Tabs.Trigger),Yt=S(u.Tabs.Content),Ur=(e,t)=>{if(e.customComponent)return e.customComponent;switch(e.type){case"text":return l.jsx(Zt,{placeholder:e.label,value:e.value,onChange:e.onChange,label:e.label,visible:t});case"number":return l.jsx(Zt,{label:e.label,value:e.value,onChange:e.onChange});case"checkbox":return l.jsx(Nr,{label:e.label,value:e.value,onChange:e.onChange});case"select":return l.jsx(Br,{label:e.label,value:e.value,onChange:e.onChange,options:e.options??[],visible:t,placeholder:e.placeholder});case"date":return l.jsx(Wr,{value:e.value,onChange:e.onChange,visible:t,label:e.label});case"date-range":return l.jsx(Fr,{startDate:e.startDate?new Date(e.startDate):void 0,endDate:e.endDate?new Date(e.endDate):void 0,onChange:e.onChange,visible:t,label:e.label});case"combobox":return l.jsx(Pr,{visible:!0,label:e.label,itemToString:n=>String(n.label),itemToValue:n=>n.value,renderItem:n=>l.jsx("span",{children:n.label})});default:return null}},Gl=({filterDrawerSize:e="sm",onVisibilityChange:t,onSizeChange:n,onClear:r,filters:o,pageKey:s="default",onLoadPreset:i,activePresetName:a,onReorder:c,open:d,onOpenChange:g})=>{const[h,v]=f.useState([]);f.useEffect(()=>{const p=()=>{v(Rt(s))};return p(),window.addEventListener("storage",p),window.addEventListener("storage_updated",p),()=>{window.removeEventListener("storage",p),window.removeEventListener("storage_updated",p)}},[s]);const m=()=>{const p=prompt("Preset name?");if(!p)return;const x=o.reduce((y,T)=>(y[T.id]=T.value,y),{});Yr(s,{id:za(),name:p,date:new Date().toISOString(),values:x})};return l.jsx(u.HStack,{wrap:"wrap",children:l.jsxs(Al,{size:e,open:d,onOpenChange:g,children:[l.jsx(zl,{asChild:!0,children:l.jsxs(u.IconButton,{"aria-label":"Open filters",variant:"outline",size:"xs",ml:2,p:2,children:[l.jsx(Yi,{size:16}),"Filters"]})}),l.jsxs(u.Portal,{children:[l.jsx(Ll,{}),l.jsx(Nl,{children:l.jsxs(Pl,{children:[l.jsx(Fl,{children:l.jsx(Wl,{children:"Filters"})}),l.jsx(Bl,{overflowY:"auto",pt:1,children:l.jsxs(Hl,{defaultValue:"view",children:[l.jsxs(Ul,{mb:4,children:[l.jsxs(Vt,{value:"view",children:[l.jsx(Gi,{size:16}),"Edit"]}),l.jsxs(Vt,{value:"settings",children:[l.jsx(Ji,{size:16}),"Settings"]}),l.jsxs(Vt,{value:"presets",children:[l.jsx(Ai,{size:16}),"Presets"]})]}),l.jsx(Yt,{value:"view",children:o.filter(p=>p.visible).map(p=>l.jsx(u.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:Ur(p,d)},p.id))}),l.jsx(Yt,{value:"settings",children:l.jsx(yr,{sensors:jo(Eo(un)),collisionDetection:ir,onDragEnd:({active:p,over:x})=>{if(!x||p.id===x.id)return;const y=o.findIndex(j=>j.id===p.id),T=o.findIndex(j=>j.id===x.id),D=jt(o,y,T);c?.(D)},children:l.jsx(Dr,{items:o.map(p=>p.id),strategy:Ws,children:o.map(p=>l.jsx($l,{filter:p,onVisibilityChange:t,onSizeChange:n},p.id))})})}),l.jsx(Yt,{value:"presets",children:l.jsxs(u.VStack,{align:"stretch",mb:3,children:[h.length===0&&l.jsx(u.Text,{fontSize:"xs",color:"gray.500",children:"No presets saved yet."}),h.map(p=>l.jsxs(u.HStack,{justify:"space-between",border:"1px solid",borderColor:a===p.name?"blue.300":"gray.200",rounded:"md",p:2,children:[l.jsxs(u.VStack,{align:"start",gap:0,children:[l.jsx(u.Text,{fontWeight:"bold",fontSize:"sm",children:p.name}),l.jsx(u.Text,{fontSize:"xs",color:"gray.500",children:new Date(p.date).toLocaleDateString()})]}),l.jsxs(u.HStack,{children:[l.jsx(u.Button,{size:"xs",variant:"ghost",onClick:()=>{const x=o.map(y=>({...y,value:p.values[y.id]??y.value}));i?.(x,p.name)},children:"Load"}),l.jsx(u.IconButton,{size:"xs","aria-label":"Delete preset",variant:"ghost",onClick:()=>Hr(s,p.id),children:l.jsx(Bi,{size:14})})]})]},p.id)),l.jsx(u.Button,{size:"sm",colorScheme:"blue",onClick:m,children:"Save Current Filters"})]})})]})}),l.jsx(Vl,{justify:"space-between",children:l.jsx(Yl,{asChild:!0,children:l.jsx(u.CloseButton,{})})})]})})]})]})})},ql=({title:e,filters:t,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:i,pageKey:a,onLoadPreset:c,activePresetName:d,filterDrawerSize:g="sm"})=>{const[h,v]=f.useState(!1);return l.jsxs(u.HStack,{wrap:"wrap",pl:2,pr:2,width:"100%",justify:"space-between",children:[e,l.jsxs(u.HStack,{gapX:1,children:[t.filter(m=>m.visible!==!1).map(m=>l.jsx(u.HStack,{flex:m.size??1,minW:`${(m.size??1)*100}px`,alignItems:"center",children:Ur(m)},m.id)),l.jsx(Gl,{filterDrawerSize:g,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:i,pageKey:a,filters:t,onLoadPreset:c,activePresetName:d,open:h,onOpenChange:m=>{v(m.open)}})]})]})},Kl=(e,t)=>{localStorage.setItem(`FILTER_ORDER_${e}`,JSON.stringify(t))},Xl=e=>{try{return JSON.parse(localStorage.getItem(`FILTER_ORDER_${e}`)||"[]")}catch{return[]}},Jl=({onClick:e,size:t="xs",variant:n="solid",label:r,leftIcon:o,rightIcon:s,isDisabled:i,colorScheme:a,loading:c,loadingText:d,rounded:g,type:h="button",textColor:v="white",borderColor:m})=>l.jsx(u.Button,{onClick:e,size:t,variant:n,disabled:i,loading:c,loadingText:d,rounded:g,type:h,background:a,color:v,border:m,children:l.jsxs(u.HStack,{gap:1,children:[o,r,s]})}),Zl=S(u.Dialog.Root),Ql=S(u.Dialog.Backdrop),ec=S(u.Dialog.Positioner),tc=S(u.Dialog.Content),nc=S(u.Dialog.Header),rc=S(u.Dialog.Body),oc=S(u.Dialog.Footer),sc=S(u.Dialog.Title),ic=S(u.Dialog.CloseTrigger);function ac({open:e,onClose:t,onConfirm:n,title:r="Confirm Action",description:o="Are you sure you want to continue?",confirmLabel:s="Confirm",cancelLabel:i="Cancel",icon:a,isLoading:c=!1,confirmButtonColorScheme:d="#4169e1"}){return l.jsx(Zl,{open:e,placement:"center",onOpenChange:g=>!g.open&&t(),children:l.jsxs(u.Portal,{children:[l.jsx(Ql,{}),l.jsx(ec,{children:l.jsxs(tc,{maxW:"480px",children:[l.jsx(nc,{borderBottom:"1px solid",borderColor:"gray.200",children:l.jsx(sc,{children:r})}),l.jsx(rc,{p:6,children:l.jsxs(u.Stack,{gap:4,align:"center",textAlign:"center",children:[l.jsx(u.Box,{color:"orange.500",children:a??l.jsx(zr,{size:40})}),l.jsx(u.Text,{fontSize:"sm",color:"gray.600",children:o})]})}),l.jsxs(oc,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"gray.200",children:[l.jsx(u.Button,{variant:"outline",size:"sm",onClick:t,children:i}),l.jsx(u.Button,{size:"sm",style:{backgroundColor:d},loading:c,onClick:n,children:s})]}),l.jsx(ic,{asChild:!0,children:l.jsx(u.CloseButton,{size:"sm"})})]})})]})})}const lc=S(u.Dialog.Root),cc=S(u.Dialog.Backdrop),uc=S(u.Dialog.Positioner),dc=S(u.Dialog.Content),fc=S(u.Dialog.Header),hc=S(u.Dialog.Body),gc=S(u.Dialog.Footer),pc=S(u.Dialog.Title),mc=S(u.Dialog.CloseTrigger);function vc({open:e,onClose:t,onConfirm:n,title:r="Delete Company",entityName:o,confirmText:s="DELETE",confirmLabel:i="Delete",isLoading:a=!1}){const[c,d]=f.useState(""),g=c===s;return l.jsx(lc,{open:e,placement:"center",onOpenChange:h=>{!h.open&&t(),d("")},children:l.jsxs(u.Portal,{children:[l.jsx(cc,{}),l.jsx(uc,{children:l.jsxs(dc,{maxW:"550px",children:[l.jsx(fc,{borderBottom:"1px solid",borderColor:"#d3d3d3",children:l.jsx(pc,{color:"red.600",children:r})}),l.jsx(hc,{p:2,style:{padding:"16px"},children:l.jsxs(u.Stack,{gap:4,borderRadius:"md",p:4,bg:"white",children:[l.jsx(u.Box,{border:"1px solid",borderColor:"red.200",bg:"red.50",borderRadius:"md",p:4,children:l.jsxs(u.Stack,{direction:"row",gap:3,align:"flex-start",children:[l.jsx(u.Box,{color:"red.600",mt:"2px",children:l.jsx(zr,{size:20})}),l.jsxs(u.Box,{children:[l.jsx(u.Text,{fontWeight:"semibold",color:"red.700",children:"Are you sure?"}),l.jsxs(u.Text,{fontSize:"sm",color:"red.600",children:["All the data of ",l.jsx("b",{children:o})," will permanently be deleted."]})]})]})}),l.jsx(u.Text,{fontSize:"sm",color:"gray.600",children:"You can’t undo this action afterwards."}),l.jsxs(u.Box,{children:[l.jsxs(u.Text,{fontSize:"sm",mb:2,children:["Type ",l.jsx("b",{children:s})," to continue"]}),l.jsx(u.Input,{placeholder:`Type ${s} here`,value:c,onChange:h=>d(h.target.value),size:"xs"})]})]})}),l.jsxs(gc,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"#d3d3d3",children:[l.jsx(u.Button,{variant:"outline",size:"sm",onClick:()=>{t(),d("")},children:"Cancel"}),l.jsx(u.Button,{size:"sm",disabled:!g,style:{backgroundColor:"#FF0000"},loading:a,onClick:n,children:i})]}),l.jsx(mc,{asChild:!0,children:l.jsx(u.CloseButton,{size:"sm"})})]})})]})})}const Gr=({children:e})=>l.jsx(l.Fragment,{children:e}),qr=({children:e})=>l.jsx(l.Fragment,{children:e}),xc=u.Button,bc=S(u.Dialog.Root),yc=S(u.Dialog.Backdrop),Sc=S(u.Dialog.Positioner),wc=S(u.Dialog.Content),Cc=S(u.Dialog.Header),Dc=S(u.Dialog.Body),Ec=S(u.Dialog.Footer),jc=S(u.Dialog.Title),Mc=S(u.Dialog.CloseTrigger);function Rc(e){let t=null,n=null;return f.Children.forEach(e,r=>{f.isValidElement(r)&&(r.type===Gr&&(t=r.props.children),r.type===qr&&(n=r.props.children))}),{body:t,actions:n}}const Tc=({open:e,onClose:t,title:n,children:r,width:o,position:s,refetch:i,loading:a=!1})=>{const{body:c,actions:d}=Rc(r);return l.jsx(bc,{open:e,onOpenChange:g=>!g.open&&t(),placement:s??"center",children:l.jsxs(u.Portal,{children:[l.jsx(yc,{bg:"blackAlpha.400"}),l.jsx(Sc,{children:l.jsxs(wc,{w:o??"560px",maxW:o??"560px",borderRadius:"6px",overflow:"hidden",boxShadow:"lg",children:[l.jsx(Cc,{px:"20px",py:"16px",bg:"white",borderBottom:"1px solid",borderColor:"gray.200",children:l.jsxs(u.Flex,{align:"center",justify:"space-between",children:[l.jsx(jc,{fontSize:"16px",fontWeight:"600",children:n}),l.jsx(Mc,{asChild:!0,children:l.jsx(u.CloseButton,{size:"sm"})}),i&&l.jsx(fn,{label:"Refresh",refetch:i,isLoading:a})]})}),c&&l.jsx(Dc,{px:"20px",py:"16px",bg:"#F8FAFC",type:"submit",children:l.jsx(u.Flex,{direction:"column",gap:"16px",children:c})}),d&&l.jsx(Ec,{px:"20px",py:"16px",bg:"white",borderTop:"1px solid",borderColor:"gray.200",children:l.jsx(u.Flex,{ml:"auto",gap:"12px",children:d})})]})})]})})},Oc=S(u.Field.Root),_c=S(u.Field.Label),Ic=S(u.Field.HelperText),kc=S(u.Field.ErrorText),$c=S(u.PinInput.Input),Ac=S(u.PinInput.Control),zc=S(u.PinInput.HiddenInput),Lc=S(u.PinInput.Root),Nc=({value:e,onChange:t,length:n=4,size:r="xs",isDisabled:o=!1,label:s,helperText:i,errorText:a,required:c=!1,visible:d=!0})=>{const g=Array.from({length:n}).map((h,v)=>e?.[v]??"");return l.jsxs(Oc,{children:[d&&s&&l.jsxs(_c,{children:[s,c&&" *"]}),l.jsxs(Lc,{value:g,onValueChange:h=>t?.(h.value.join("")),disabled:o,size:r,children:[l.jsx(zc,{}),l.jsx(Ac,{children:l.jsx(u.HStack,{children:Array.from({length:n}).map((h,v)=>l.jsx($c,{index:v},v))})})]}),a&&l.jsx(kc,{fontSize:"xs",children:a}),i&&!a&&l.jsx(Ic,{fontSize:"xs",children:i})]})};function fn({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 l.jsx(u.IconButton,{"aria-label":n,size:"xs",variant:"outline",disabled:t||r,onClick:s,ml:2,children:l.jsx(Ki,{size:14,style:{animation:r?"spin 0.6s linear infinite":void 0}})})}var ft={exports:{}},Pc=ft.exports,Qn;function Fc(){return Qn||(Qn=1,(function(e,t){(function(n,r){e.exports=r()})(Pc,(function(){var n=1e3,r=6e4,o=36e5,s="millisecond",i="second",a="minute",c="hour",d="day",g="week",h="month",v="quarter",m="year",p="date",x="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,T=/\[([^\]]+)]|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,D={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(M){var w=["th","st","nd","rd"],C=M%100;return"["+M+(w[(C-20)%10]||w[C]||w[0])+"]"}},j=function(M,w,C){var R=String(M);return!R||R.length>=w?M:""+Array(w+1-R.length).join(C)+M},I={s:j,z:function(M){var w=-M.utcOffset(),C=Math.abs(w),R=Math.floor(C/60),E=C%60;return(w<=0?"+":"-")+j(R,2,"0")+":"+j(E,2,"0")},m:function M(w,C){if(w.date()<C.date())return-M(C,w);var R=12*(C.year()-w.year())+(C.month()-w.month()),E=w.clone().add(R,h),A=C-E<0,P=w.clone().add(R+(A?-1:1),h);return+(-(R+(C-E)/(A?E-P:P-E))||0)},a:function(M){return M<0?Math.ceil(M)||0:Math.floor(M)},p:function(M){return{M:h,y:m,w:g,d,D:p,h:c,m:a,s:i,ms:s,Q:v}[M]||String(M||"").toLowerCase().replace(/s$/,"")},u:function(M){return M===void 0}},$="en",_={};_[$]=D;var k="$isDayjsObject",L=function(M){return M instanceof W||!(!M||!M[k])},H=function M(w,C,R){var E;if(!w)return $;if(typeof w=="string"){var A=w.toLowerCase();_[A]&&(E=A),C&&(_[A]=C,E=A);var P=w.split("-");if(!E&&P.length>1)return M(P[0])}else{var b=w.name;_[b]=w,E=b}return!R&&E&&($=E),E||!R&&$},B=function(M,w){if(L(M))return M.clone();var C=typeof w=="object"?w:{};return C.date=M,C.args=arguments,new W(C)},z=I;z.l=H,z.i=L,z.w=function(M,w){return B(M,{locale:w.$L,utc:w.$u,x:w.$x,$offset:w.$offset})};var W=(function(){function M(C){this.$L=H(C.locale,null,!0),this.parse(C),this.$x=this.$x||C.x||{},this[k]=!0}var w=M.prototype;return w.parse=function(C){this.$d=(function(R){var E=R.date,A=R.utc;if(E===null)return new Date(NaN);if(z.u(E))return new Date;if(E instanceof Date)return new Date(E);if(typeof E=="string"&&!/Z$/i.test(E)){var P=E.match(y);if(P){var b=P[2]-1||0,O=(P[7]||"0").substring(0,3);return A?new Date(Date.UTC(P[1],b,P[3]||1,P[4]||0,P[5]||0,P[6]||0,O)):new Date(P[1],b,P[3]||1,P[4]||0,P[5]||0,P[6]||0,O)}}return new Date(E)})(C),this.init()},w.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()},w.$utils=function(){return z},w.isValid=function(){return this.$d.toString()!==x},w.isSame=function(C,R){var E=B(C);return this.startOf(R)<=E&&E<=this.endOf(R)},w.isAfter=function(C,R){return B(C)<this.startOf(R)},w.isBefore=function(C,R){return this.endOf(R)<B(C)},w.$g=function(C,R,E){return z.u(C)?this[R]:this.set(E,C)},w.unix=function(){return Math.floor(this.valueOf()/1e3)},w.valueOf=function(){return this.$d.getTime()},w.startOf=function(C,R){var E=this,A=!!z.u(R)||R,P=z.p(C),b=function(J,Y){var se=z.w(E.$u?Date.UTC(E.$y,Y,J):new Date(E.$y,Y,J),E);return A?se:se.endOf(d)},O=function(J,Y){return z.w(E.toDate()[J].apply(E.toDate("s"),(A?[0,0,0,0]:[23,59,59,999]).slice(Y)),E)},N=this.$W,V=this.$M,q=this.$D,K="set"+(this.$u?"UTC":"");switch(P){case m:return A?b(1,0):b(31,11);case h:return A?b(1,V):b(0,V+1);case g:var U=this.$locale().weekStart||0,X=(N<U?N+7:N)-U;return b(A?q-X:q+(6-X),V);case d:case p:return O(K+"Hours",0);case c:return O(K+"Minutes",1);case a:return O(K+"Seconds",2);case i:return O(K+"Milliseconds",3);default:return this.clone()}},w.endOf=function(C){return this.startOf(C,!1)},w.$set=function(C,R){var E,A=z.p(C),P="set"+(this.$u?"UTC":""),b=(E={},E[d]=P+"Date",E[p]=P+"Date",E[h]=P+"Month",E[m]=P+"FullYear",E[c]=P+"Hours",E[a]=P+"Minutes",E[i]=P+"Seconds",E[s]=P+"Milliseconds",E)[A],O=A===d?this.$D+(R-this.$W):R;if(A===h||A===m){var N=this.clone().set(p,1);N.$d[b](O),N.init(),this.$d=N.set(p,Math.min(this.$D,N.daysInMonth())).$d}else b&&this.$d[b](O);return this.init(),this},w.set=function(C,R){return this.clone().$set(C,R)},w.get=function(C){return this[z.p(C)]()},w.add=function(C,R){var E,A=this;C=Number(C);var P=z.p(R),b=function(V){var q=B(A);return z.w(q.date(q.date()+Math.round(V*C)),A)};if(P===h)return this.set(h,this.$M+C);if(P===m)return this.set(m,this.$y+C);if(P===d)return b(1);if(P===g)return b(7);var O=(E={},E[a]=r,E[c]=o,E[i]=n,E)[P]||1,N=this.$d.getTime()+C*O;return z.w(N,this)},w.subtract=function(C,R){return this.add(-1*C,R)},w.format=function(C){var R=this,E=this.$locale();if(!this.isValid())return E.invalidDate||x;var A=C||"YYYY-MM-DDTHH:mm:ssZ",P=z.z(this),b=this.$H,O=this.$m,N=this.$M,V=E.weekdays,q=E.months,K=E.meridiem,U=function(Y,se,re,ge){return Y&&(Y[se]||Y(R,A))||re[se].slice(0,ge)},X=function(Y){return z.s(b%12||12,Y,"0")},J=K||function(Y,se,re){var ge=Y<12?"AM":"PM";return re?ge.toLowerCase():ge};return A.replace(T,(function(Y,se){return se||(function(re){switch(re){case"YY":return String(R.$y).slice(-2);case"YYYY":return z.s(R.$y,4,"0");case"M":return N+1;case"MM":return z.s(N+1,2,"0");case"MMM":return U(E.monthsShort,N,q,3);case"MMMM":return U(q,N);case"D":return R.$D;case"DD":return z.s(R.$D,2,"0");case"d":return String(R.$W);case"dd":return U(E.weekdaysMin,R.$W,V,2);case"ddd":return U(E.weekdaysShort,R.$W,V,3);case"dddd":return V[R.$W];case"H":return String(b);case"HH":return z.s(b,2,"0");case"h":return X(1);case"hh":return X(2);case"a":return J(b,O,!0);case"A":return J(b,O,!1);case"m":return String(O);case"mm":return z.s(O,2,"0");case"s":return String(R.$s);case"ss":return z.s(R.$s,2,"0");case"SSS":return z.s(R.$ms,3,"0");case"Z":return P}return null})(Y)||P.replace(":","")}))},w.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},w.diff=function(C,R,E){var A,P=this,b=z.p(R),O=B(C),N=(O.utcOffset()-this.utcOffset())*r,V=this-O,q=function(){return z.m(P,O)};switch(b){case m:A=q()/12;break;case h:A=q();break;case v:A=q()/3;break;case g:A=(V-N)/6048e5;break;case d:A=(V-N)/864e5;break;case c:A=V/o;break;case a:A=V/r;break;case i:A=V/n;break;default:A=V}return E?A:z.a(A)},w.daysInMonth=function(){return this.endOf(h).$D},w.$locale=function(){return _[this.$L]},w.locale=function(C,R){if(!C)return this.$L;var E=this.clone(),A=H(C,R,!0);return A&&(E.$L=A),E},w.clone=function(){return z.w(this.$d,this)},w.toDate=function(){return new Date(this.valueOf())},w.toJSON=function(){return this.isValid()?this.toISOString():null},w.toISOString=function(){return this.$d.toISOString()},w.toString=function(){return this.$d.toUTCString()},M})(),F=W.prototype;return B.prototype=F,[["$ms",s],["$s",i],["$m",a],["$H",c],["$W",d],["$M",h],["$y",m],["$D",p]].forEach((function(M){F[M[1]]=function(w){return this.$g(w,M[0],M[1])}})),B.extend=function(M,w){return M.$i||(M(w,W,B),M.$i=!0),B},B.locale=H,B.isDayjs=L,B.unix=function(M){return B(1e3*M)},B.en=_[$],B.Ls=_,B.p={},B}))})(ft)),ft.exports}var Wc=Fc();const Tt=wt(Wc);var ht={exports:{}},Bc=ht.exports,er;function Vc(){return er||(er=1,(function(e,t){(function(n,r){e.exports=r()})(Bc,(function(){return function(n,r,o){n=n||{};var s=r.prototype,i={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function a(d,g,h,v){return s.fromToBase(d,g,h,v)}o.en.relativeTime=i,s.fromToBase=function(d,g,h,v,m){for(var p,x,y,T=h.$locale().relativeTime||i,D=n.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],j=D.length,I=0;I<j;I+=1){var $=D[I];$.d&&(p=v?o(d).diff(h,$.d,!0):h.diff(d,$.d,!0));var _=(n.rounding||Math.round)(Math.abs(p));if(y=p>0,_<=$.r||!$.r){_<=1&&I>0&&($=D[I-1]);var k=T[$.l];m&&(_=m(""+_)),x=typeof k=="string"?k.replace("%d",_):k(_,g,$.l,y);break}}if(g)return x;var L=y?T.future:T.past;return typeof L=="function"?L(x):L.replace("%s",x)},s.to=function(d,g){return a(d,g,this,!0)},s.from=function(d,g){return a(d,g,this)};var c=function(d){return d.$u?o.utc():o()};s.toNow=function(d){return this.to(c(this),d)},s.fromNow=function(d){return this.from(c(this),d)}}}))})(ht)),ht.exports}var Yc=Vc();const Hc=wt(Yc);var gt={exports:{}},Uc=gt.exports,tr;function Gc(){return tr||(tr=1,(function(e,t){(function(n,r){e.exports=r()})(Uc,(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 i=o.prototype,a=i.format;s.en.formats=n,i.format=function(c){c===void 0&&(c="YYYY-MM-DDTHH:mm:ssZ");var d=this.$locale().formats,g=(function(h,v){return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(m,p,x){var y=x&&x.toUpperCase();return p||v[x]||n[x]||v[y].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(T,D,j){return D||j.slice(1)}))}))})(c,d===void 0?{}:d);return a.call(this,g)}}}))})(gt)),gt.exports}var qc=Gc();const Kc=wt(qc);var pt={exports:{}},Xc=pt.exports,nr;function Jc(){return nr||(nr=1,(function(e,t){(function(n,r){e.exports=r()})(Xc,(function(){return function(n,r){var o=r.prototype,s=o.format;o.format=function(i){var a=this,c=this.$locale();if(!this.isValid())return s.bind(this)(i);var d=this.$utils(),g=(i||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(h){switch(h){case"Q":return Math.ceil((a.$M+1)/3);case"Do":return c.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return c.ordinal(a.week(),"W");case"w":case"ww":return d.s(a.week(),h==="w"?1:2,"0");case"W":case"WW":return d.s(a.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return d.s(String(a.$H===0?24:a.$H),h==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return h}}));return s.bind(this)(g)}}}))})(pt)),pt.exports}var Zc=Jc();const Qc=wt(Zc);Tt.extend(Hc);Tt.extend(Kc);Tt.extend(Qc);const eu={date:"DD MMM YYYY",time:"hh:mm A",dateTime:"DD MMM YYYY, hh:mm A",full:"dddd, DD MMM YYYY, hh:mm A",short:"DD/MM/YY",relative:""};function Qt({value:e,variant:t="dateTime",format:n,fallback:r="--"}){if(!e)return r;const o=Tt(e);return o.isValid()?t==="relative"?o.fromNow():o.format(n??eu[t]):r}function tu({value:e,dateVariant:t="date",timeVariant:n="time",dateFormat:r,timeFormat:o,align:s="start",dateColor:i="gray.700",dateFontSize:a="16px",dateFontWeight:c="500",timeColor:d="gray.500",timeFontSize:g="12px",timeFontWeight:h="400",showTime:v=!0}){return l.jsxs(u.Stack,{gap:.5,align:s,children:[l.jsx(u.Text,{fontSize:a,fontWeight:c,color:i,children:Qt({value:e,variant:t,format:r})}),v&&l.jsx(u.Text,{fontSize:g,fontWeight:h,color:d,children:Qt({value:e,variant:n,format:o})})]})}class Kr{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 en{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 tn{constructor(t){this.api=t}store=new Kr;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 Xr=f.createContext(null);function Jr(){const e=f.useContext(Xr);if(!e)throw new Error("OptionsProvider is missing. Wrap your app with <OptionsProvider />");return e}function nu({client:{apiUrl:e},children:t}){const n=f.useRef(new tn(new en(e)));return n.current||(n.current=new tn(new en(e))),l.jsx(Xr.Provider,{value:n.current,children:t})}function ru(e){const t=Jr(),[n,r]=f.useState(t.getRaw(e)?.value);return f.useEffect(()=>{let o=!0;t.getKey(e).then(i=>{o&&r(i)});const s=t.subscribe(e,i=>{r(i?.value)});return()=>{o=!1,s()}},[e,t]),n}function ou(e){const t=Jr(),[n,r]=f.useState({});return f.useEffect(()=>{let o=!0;t.getMultiKey(e).then(i=>{o&&r(i)});const s=e.map(i=>t.subscribe(i,a=>{r(c=>({...c,[i]:a?.value}))}));return()=>{o=!1,s.forEach(i=>i())}},[e.join("|"),t]),n}async function su(e,t){return e.getKey(t)}async function iu(e,t){await e.getMultiKey(t)}function au(e={}){const{initialPage:t=1,initialLimit:n=20}=e,[r,o]=f.useState(t),[s,i]=f.useState(n),a=f.useCallback(v=>{o(Math.max(1,v))},[]),c=f.useCallback(v=>{i(Math.max(1,v)),o(1)},[]),d=f.useCallback(()=>{o(v=>v+1)},[]),g=f.useCallback(()=>{o(v=>Math.max(1,v-1))},[]),h=f.useCallback(()=>{o(t),i(n)},[t,n]);return{page:r,limit:s,setPage:a,setLimit:c,nextPage:d,prevPage:g,reset:h}}function lu(e={}){const{initialValue:t="",delay:n=300}=e,[r,o]=f.useState(t),s=cu(r,n),i=f.useCallback(c=>{o(c)},[]),a=f.useCallback(()=>{o(t)},[t]);return{search:r,debouncedSearch:s,onSearchChange:i,reset:a}}function cu(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.ACTIONS_COLUMN_ID=Re;exports.DataTable=Oa;exports.Filters=ql;exports.HttpOptionsApi=en;exports.MDSButton=Jl;exports.MDSCheckbox=Nr;exports.MDSCombobox=Pr;exports.MDSConfirmActionDialog=ac;exports.MDSConfirmDeleteDialog=vc;exports.MDSDatePicker=Wr;exports.MDSDateRangePicker=Fr;exports.MDSDialogAction=xc;exports.MDSDialogActions=qr;exports.MDSDialogBody=Gr;exports.MDSDialogWrapper=Tc;exports.MDSInput=Zt;exports.MDSPinInput=Nc;exports.MDSRefreshButton=fn;exports.MDSSelectBox=Br;exports.OptionsClientImpl=tn;exports.OptionsProvider=nu;exports.OptionsStore=Kr;exports.RefreshButton=fn;exports.SERIAL_NUMBER_COLUMN_ID=Si;exports.StackedDateTime=tu;exports.VISIBILITY_COLUMN_ID=he;exports.addPreset=Yr;exports.deletePreset=Hr;exports.formatDateTime=Qt;exports.getColumnWidthKey=Mt;exports.getOption=su;exports.getPresets=Rt;exports.loadOrder=Xl;exports.prefetchOptions=iu;exports.saveOrder=Kl;exports.savePresets=dn;exports.setColumnWidth=wi;exports.setData=Or;exports.setTableId=_r;exports.tableStore=ne;exports.useDebouncedSearch=lu;exports.useOption=ru;exports.useOptions=ou;exports.usePagination=au;exports.withChildren=S;
|