@mdspl/mds-shared-ui 1.4.7 → 1.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,13 +1,13 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react"),u=require("@chakra-ui/react"),ze=require("react-dom");function ao(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 Ze=ao(f);function Ct(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var it={exports:{}},Ge={};var wn;function lo(){if(wn)return Ge;wn=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 Ge.Fragment=t,Ge.jsx=n,Ge.jsxs=n,Ge}var qe={};var Cn;function co(){return Cn||(Cn=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 j:return"Profiler";case S:return"StrictMode";case O:return"Suspense";case $:return"SuspenseList";case F: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 _:return b.displayName||"Context";case M:return(b._context.displayName||"Context")+".Consumer";case A:var I=b.render;return b=b.displayName,b||(b=I.displayName||I.name||"",b=b!==""?"ForwardRef("+b+")":"ForwardRef"),b;case L:return I=b.displayName||null,I!==null?I:e(b.type)||"Memo";case V:I=b._payload,b=b._init;try{return e(b(I))}catch{}}return null}function t(b){return""+b}function n(b){try{t(b);var I=!1}catch{I=!0}if(I){I=console;var N=I.error,W=typeof Symbol=="function"&&Symbol.toStringTag&&b[Symbol.toStringTag]||b.constructor.name||"Object";return N.call(I,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",W),t(b)}}function r(b){if(b===y)return"<>";if(typeof b=="object"&&b!==null&&b.$$typeof===V)return"<...>";try{var I=e(b);return I?"<"+I+">":"<...>"}catch{return"<...>"}}function o(){var b=q.A;return b===null?null:b.getOwner()}function s(){return Error("react-stack-top-frame")}function i(b){if(K.call(b,"key")){var I=Object.getOwnPropertyDescriptor(b,"key").get;if(I&&I.isReactWarning)return!1}return b.key!==void 0}function a(b,I){function N(){E||(E=!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)",I))}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,I,N,W,G,U){var Y=N.ref;return b={$$typeof:v,type:b,key:I,props:N,_owner:W},(Y!==void 0?Y: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:G}),Object.defineProperty(b,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:U}),Object.freeze&&(Object.freeze(b.props),Object.freeze(b)),b}function g(b,I,N,W,G,U){var Y=I.children;if(Y!==void 0)if(W)if(T(Y)){for(W=0;W<Y.length;W++)h(Y[W]);Object.freeze&&Object.freeze(Y)}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(Y);if(K.call(I,"key")){Y=e(b);var X=Object.keys(I).filter(function(B){return B!=="key"});W=0<X.length?"{key: someKey, "+X.join(": ..., ")+": ...}":"{key: someKey}",P[Y+W]||(X=0<X.length?"{"+X.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react"),c=require("@chakra-ui/react"),ze=require("react-dom");function lo(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 Ze=lo(f);function Ct(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var it={exports:{}},Ge={};var wn;function co(){if(wn)return Ge;wn=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,o,s){var a=null;if(s!==void 0&&(a=""+s),o.key!==void 0&&(a=""+o.key),"key"in o){s={};for(var l in o)l!=="key"&&(s[l]=o[l])}else s=o;return o=s.ref,{$$typeof:e,type:r,key:a,ref:o!==void 0?o:null,props:s}}return Ge.Fragment=t,Ge.jsx=n,Ge.jsxs=n,Ge}var qe={};var Cn;function uo(){return Cn||(Cn=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 S:return"Fragment";case j:return"Profiler";case w:return"StrictMode";case O:return"Suspense";case A:return"SuspenseList";case F: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 M:return(b._context.displayName||"Context")+".Consumer";case $:var _=b.render;return b=b.displayName,b||(b=_.displayName||_.name||"",b=b!==""?"ForwardRef("+b+")":"ForwardRef"),b;case L:return _=b.displayName||null,_!==null?_:e(b.type)||"Memo";case V:_=b._payload,b=b._init;try{return e(b(_))}catch{}}return null}function t(b){return""+b}function n(b){try{t(b);var _=!1}catch{_=!0}if(_){_=console;var N=_.error,W=typeof Symbol=="function"&&Symbol.toStringTag&&b[Symbol.toStringTag]||b.constructor.name||"Object";return N.call(_,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",W),t(b)}}function r(b){if(b===S)return"<>";if(typeof b=="object"&&b!==null&&b.$$typeof===V)return"<...>";try{var _=e(b);return _?"<"+_+">":"<...>"}catch{return"<...>"}}function o(){var b=q.A;return b===null?null:b.getOwner()}function s(){return Error("react-stack-top-frame")}function a(b){if(X.call(b,"key")){var _=Object.getOwnPropertyDescriptor(b,"key").get;if(_&&_.isReactWarning)return!1}return b.key!==void 0}function l(b,_){function N(){E||(E=!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)",_))}N.isReactWarning=!0,Object.defineProperty(b,"key",{get:N,configurable:!0})}function u(){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,_,N,W,G,U){var Y=N.ref;return b={$$typeof:v,type:b,key:_,props:N,_owner:W},(Y!==void 0?Y:null)!==null?Object.defineProperty(b,"ref",{enumerable:!1,get:u}):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:G}),Object.defineProperty(b,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:U}),Object.freeze&&(Object.freeze(b.props),Object.freeze(b)),b}function g(b,_,N,W,G,U){var Y=_.children;if(Y!==void 0)if(W)if(T(Y)){for(W=0;W<Y.length;W++)h(Y[W]);Object.freeze&&Object.freeze(Y)}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(Y);if(X.call(_,"key")){Y=e(b);var K=Object.keys(_).filter(function(B){return B!=="key"});W=0<K.length?"{key: someKey, "+K.join(": ..., ")+": ...}":"{key: someKey}",P[Y+W]||(K=0<K.length?"{"+K.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} />`,W,Y,X,Y),P[Y+W]=!0)}if(Y=null,N!==void 0&&(n(N),Y=""+N),i(I)&&(n(I.key),Y=""+I.key),"key"in I){N={};for(var J in I)J!=="key"&&(N[J]=I[J])}else N=I;return Y&&a(N,typeof b=="function"?b.displayName||b.name||"Unknown":b),d(b,Y,N,o(),G,U)}function h(b){p(b)?b._store&&(b._store.validated=1):typeof b=="object"&&b!==null&&b.$$typeof===V&&(b._payload.status==="fulfilled"?p(b._payload.value)&&b._payload.value._store&&(b._payload.value._store.validated=1):b._store&&(b._store.validated=1))}function p(b){return typeof b=="object"&&b!==null&&b.$$typeof===v}var m=f,v=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),_=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),F=Symbol.for("react.activity"),z=Symbol.for("react.client.reference"),q=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=Object.prototype.hasOwnProperty,T=Array.isArray,C=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(b){return b()}};var E,R={},D=m.react_stack_bottom_frame.bind(m,s)(),k=C(r(s)),P={};qe.Fragment=y,qe.jsx=function(b,I,N){var W=1e4>q.recentlyCreatedOwnerStacks++;return g(b,I,N,!1,W?Error("react-stack-top-frame"):D,W?C(r(b)):k)},qe.jsxs=function(b,I,N){var W=1e4>q.recentlyCreatedOwnerStacks++;return g(b,I,N,!0,W?Error("react-stack-top-frame"):D,W?C(r(b)):k)}})()),qe}var Dn;function uo(){return Dn||(Dn=1,process.env.NODE_ENV==="production"?it.exports=lo():it.exports=co()),it.exports}var l=uo();function fo(){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 Dt=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 rn(e){return"nodeType"in e}function ie(e){var t,n;return e?Ne(e)?e:rn(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function on(e){const{Document:t}=ie(e);return e instanceof t}function tt(e){return Ne(e)?!1:e instanceof ie(e).HTMLElement}function or(e){return e instanceof ie(e).SVGElement}function Fe(e){return e?Ne(e)?e.document:rn(e)?on(e)?e:tt(e)||or(e)?e.ownerDocument:document:document:document}const xe=Dt?f.useLayoutEffect:f.useEffect;function sn(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 ho(){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 Qe(e,t){t===void 0&&(t=[e]);const n=f.useRef(e);return xe(()=>{n.current!==e&&(n.current=e)},t),n}function nt(e,t){const n=f.useRef();return f.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function xt(e){const t=sn(e),n=f.useRef(null),r=f.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function Ut(e){const t=f.useRef();return f.useEffect(()=>{t.current=e},[e]),t.current}let At={};function rt(e,t){return f.useMemo(()=>{if(t)return t;const n=At[e]==null?0:At[e]+1;return At[e]=n,e+"-"+n},[e,t])}function sr(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 Le=sr(1),bt=sr(-1);function go(e){return"clientX"in e&&"clientY"in e}function an(e){if(!e)return!1;const{KeyboardEvent:t}=ie(e.target);return t&&e instanceof t}function po(e){if(!e)return!1;const{TouchEvent:t}=ie(e.target);return t&&e instanceof t}function Gt(e){if(po(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 go(e)?{x:e.clientX,y:e.clientY}:null}const Pe=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[Pe.Translate.toString(e),Pe.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),En="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function mo(e){return e.matches(En)?e:e.querySelector(En)}const vo={display:"none"};function xo(e){let{id:t,value:n}=e;return f.createElement("div",{id:t,style:vo},n)}function bo(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 yo(){const[e,t]=f.useState("");return{announce:f.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const ir=f.createContext(null);function So(e){const t=f.useContext(ir);f.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function wo(){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 Co={draggable:`
6
+ <%s key={someKey} {...props} />`,W,Y,K,Y),P[Y+W]=!0)}if(Y=null,N!==void 0&&(n(N),Y=""+N),a(_)&&(n(_.key),Y=""+_.key),"key"in _){N={};for(var J in _)J!=="key"&&(N[J]=_[J])}else N=_;return Y&&l(N,typeof b=="function"?b.displayName||b.name||"Unknown":b),d(b,Y,N,o(),G,U)}function h(b){p(b)?b._store&&(b._store.validated=1):typeof b=="object"&&b!==null&&b.$$typeof===V&&(b._payload.status==="fulfilled"?p(b._payload.value)&&b._payload.value._store&&(b._payload.value._store.validated=1):b._store&&(b._store.validated=1))}function p(b){return typeof b=="object"&&b!==null&&b.$$typeof===v}var m=f,v=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),I=Symbol.for("react.context"),$=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),F=Symbol.for("react.activity"),z=Symbol.for("react.client.reference"),q=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=Object.prototype.hasOwnProperty,T=Array.isArray,C=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(b){return b()}};var E,R={},D=m.react_stack_bottom_frame.bind(m,s)(),k=C(r(s)),P={};qe.Fragment=S,qe.jsx=function(b,_,N){var W=1e4>q.recentlyCreatedOwnerStacks++;return g(b,_,N,!1,W?Error("react-stack-top-frame"):D,W?C(r(b)):k)},qe.jsxs=function(b,_,N){var W=1e4>q.recentlyCreatedOwnerStacks++;return g(b,_,N,!0,W?Error("react-stack-top-frame"):D,W?C(r(b)):k)}})()),qe}var Dn;function fo(){return Dn||(Dn=1,process.env.NODE_ENV==="production"?it.exports=co():it.exports=uo()),it.exports}var i=fo();function ho(){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 Dt=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 rn(e){return"nodeType"in e}function ie(e){var t,n;return e?Ne(e)?e:rn(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function on(e){const{Document:t}=ie(e);return e instanceof t}function tt(e){return Ne(e)?!1:e instanceof ie(e).HTMLElement}function sr(e){return e instanceof ie(e).SVGElement}function Fe(e){return e?Ne(e)?e.document:rn(e)?on(e)?e:tt(e)||sr(e)?e.ownerDocument:document:document:document}const xe=Dt?f.useLayoutEffect:f.useEffect;function sn(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 go(){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 Qe(e,t){t===void 0&&(t=[e]);const n=f.useRef(e);return xe(()=>{n.current!==e&&(n.current=e)},t),n}function nt(e,t){const n=f.useRef();return f.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function xt(e){const t=sn(e),n=f.useRef(null),r=f.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function Ut(e){const t=f.useRef();return f.useEffect(()=>{t.current=e},[e]),t.current}let $t={};function rt(e,t){return f.useMemo(()=>{if(t)return t;const n=$t[e]==null?0:$t[e]+1;return $t[e]=n,e+"-"+n},[e,t])}function ir(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,a)=>{const l=Object.entries(a);for(const[u,d]of l){const g=s[u];g!=null&&(s[u]=g+e*d)}return s},{...t})}}const Le=ir(1),bt=ir(-1);function po(e){return"clientX"in e&&"clientY"in e}function an(e){if(!e)return!1;const{KeyboardEvent:t}=ie(e.target);return t&&e instanceof t}function mo(e){if(!e)return!1;const{TouchEvent:t}=ie(e.target);return t&&e instanceof t}function Gt(e){if(mo(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 po(e)?{x:e.clientX,y:e.clientY}:null}const Pe=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[Pe.Translate.toString(e),Pe.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),En="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function vo(e){return e.matches(En)?e:e.querySelector(En)}const xo={display:"none"};function bo(e){let{id:t,value:n}=e;return f.createElement("div",{id:t,style:xo},n)}function yo(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 So(){const[e,t]=f.useState("");return{announce:f.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const ar=f.createContext(null);function wo(e){const t=f.useContext(ar);f.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Co(){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(a=>{var l;return(l=a[o])==null?void 0:l.call(a,s)})},[e]),t]}const Do={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
- `},Do={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 Eo(e){let{announcements:t=Do,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Co}=e;const{announce:s,announcement:i}=yo(),a=rt("DndLiveRegion"),[c,d]=f.useState(!1);if(f.useEffect(()=>{d(!0)},[]),So(f.useMemo(()=>({onDragStart(h){let{active:p}=h;s(t.onDragStart({active:p}))},onDragMove(h){let{active:p,over:m}=h;t.onDragMove&&s(t.onDragMove({active:p,over:m}))},onDragOver(h){let{active:p,over:m}=h;s(t.onDragOver({active:p,over:m}))},onDragEnd(h){let{active:p,over:m}=h;s(t.onDragEnd({active:p,over:m}))},onDragCancel(h){let{active:p,over:m}=h;s(t.onDragCancel({active:p,over:m}))}}),[s,t])),!c)return null;const g=f.createElement(f.Fragment,null,f.createElement(xo,{id:r,value:o.draggable}),f.createElement(bo,{id:a,announcement:i}));return n?ze.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 yt(){}function jo(e,t){return f.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 f.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const pe=Object.freeze({x:0,y:0});function Ro(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function To(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Oo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function _o(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function jn(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const ar=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=jn(t,t.left,t.top),s=[];for(const i of r){const{id:a}=i,c=n.get(a);if(c){const d=Ro(jn(c),o);s.push({id:a,data:{droppableContainer:i,value:d}})}}return s.sort(To)};function Io(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 ko=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=Io(a,t);c>0&&o.push({id:i,data:{droppableContainer:s,value:c}})}}return o.sort(Oo)};function Ao(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function lr(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 zo=$o(1);function Lo(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 Po(e,t,n){const r=Lo(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 We(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=Po(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 Mn(e){return We(e,{ignoreTransform:!0})}function Fo(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Wo(e,t){return t===void 0&&(t=ie(e).getComputedStyle(e)),t.position==="fixed"}function Bo(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 ln(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(on(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!tt(o)||or(o)||n.includes(o))return n;const s=ie(e).getComputedStyle(o);return o!==e&&Bo(o,s)&&n.push(o),Wo(o,s)?n:r(o.parentNode)}return e?r(e):n}function cr(e){const[t]=ln(e,1);return t??null}function $t(e){return!Dt||!e?null:Ne(e)?e:rn(e)?on(e)||e===Fe(e).scrollingElement?window:tt(e)?e:null:null}function ur(e){return Ne(e)?e.scrollX:e.scrollLeft}function dr(e){return Ne(e)?e.scrollY:e.scrollTop}function qt(e){return{x:ur(e),y:dr(e)}}var Q;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Q||(Q={}));function fr(e){return!Dt||!e?!1:e===document.scrollingElement}function hr(e){const t={x:0,y:0},n=fr(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 Vo={x:.2,y:.2};function Yo(e,t,n,r,o){let{top:s,left:i,right:a,bottom:c}=n;r===void 0&&(r=10),o===void 0&&(o=Vo);const{isTop:d,isBottom:g,isLeft:h,isRight:p}=hr(e),m={x:0,y:0},v={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,v.y=r*Math.abs((t.top+x.height-s)/x.height)):!g&&c>=t.bottom-x.height&&(m.y=Q.Forward,v.y=r*Math.abs((t.bottom-x.height-c)/x.height)),!p&&a>=t.right-x.width?(m.x=Q.Forward,v.x=r*Math.abs((t.right-x.width-a)/x.width)):!h&&i<=t.left+x.width&&(m.x=Q.Backward,v.x=r*Math.abs((t.left+x.width-i)/x.width)),{direction:m,speed:v}}function Ho(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 gr(e){return e.reduce((t,n)=>Le(t,qt(n)),pe)}function Uo(e){return e.reduce((t,n)=>t+ur(n),0)}function Go(e){return e.reduce((t,n)=>t+dr(n),0)}function qo(e,t){if(t===void 0&&(t=We),!e)return;const{top:n,left:r,bottom:o,right:s}=t(e);cr(e)&&(o<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Ko=[["x",["left","right"],Uo],["y",["top","bottom"],Go]];class cn{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=ln(n),o=gr(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,i,a]of Ko)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 Ke{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 Xo(e){const{EventTarget:t}=ie(e);return e instanceof t?e:Fe(e)}function zt(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 Rn(e){e.preventDefault()}function Jo(e){e.stopPropagation()}var H;(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"})(H||(H={}));const pr={start:[H.Space,H.Enter],cancel:[H.Esc],end:[H.Space,H.Enter,H.Tab]},Zo=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case H.Right:return{...n,x:n.x+25};case H.Left:return{...n,x:n.x-25};case H.Down:return{...n,y:n.y+25};case H.Up:return{...n,y:n.y-25}}};class mr{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 Ke(Fe(n)),this.windowListeners=new Ke(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&&qo(r),n(pe)}handleKeyDown(t){if(an(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=pr,coordinateGetter:i=Zo,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 p=bt(h,g),m={x:0,y:0},{scrollableAncestors:v}=r.current;for(const x of v){const y=t.code,{isTop:S,isRight:j,isLeft:M,isBottom:_,maxScroll:A,minScroll:O}=hr(x),$=Ho(x),L={x:Math.min(y===H.Right?$.right-$.width/2:$.right,Math.max(y===H.Right?$.left:$.left+$.width/2,h.x)),y:Math.min(y===H.Down?$.bottom-$.height/2:$.bottom,Math.max(y===H.Down?$.top:$.top+$.height/2,h.y))},V=y===H.Right&&!j||y===H.Left&&!M,F=y===H.Down&&!_||y===H.Up&&!S;if(V&&L.x!==h.x){const z=x.scrollLeft+p.x,q=y===H.Right&&z<=A.x||y===H.Left&&z>=O.x;if(q&&!p.y){x.scrollTo({left:z,behavior:a});return}q?m.x=x.scrollLeft-z:m.x=y===H.Right?x.scrollLeft-A.x:x.scrollLeft-O.x,m.x&&x.scrollBy({left:-m.x,behavior:a});break}else if(F&&L.y!==h.y){const z=x.scrollTop+p.y,q=y===H.Down&&z<=A.y||y===H.Up&&z>=O.y;if(q&&!p.x){x.scrollTo({top:z,behavior:a});return}q?m.y=x.scrollTop-z:m.y=y===H.Down?x.scrollTop-A.y:x.scrollTop-O.y,m.y&&x.scrollBy({top:-m.y,behavior:a});break}}this.handleMove(t,Le(bt(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()}}mr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=pr,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 Tn(e){return!!(e&&"distance"in e)}function On(e){return!!(e&&"delay"in e)}class un{constructor(t,n,r){var o;r===void 0&&(r=Xo(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=Fe(i),this.documentListeners=new Ke(this.document),this.listeners=new Ke(r),this.windowListeners=new Ke(ie(i)),this.initialCoordinates=(o=Gt(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,Rn),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),this.windowListeners.add(fe.ContextMenu,Rn),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(On(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Tn(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,Jo,{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=Gt(t))!=null?n:pe,d=bt(o,c);if(!r&&a){if(Tn(a)){if(a.tolerance!=null&&zt(d,a.tolerance))return this.handleCancel();if(zt(d,a.distance))return this.handleStart()}if(On(a)&&zt(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===H.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Qo={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class dn extends un{constructor(t){const{event:n}=t,r=Fe(n.target);super(t,Qo,r)}}dn.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 es={move:{name:"mousemove"},end:{name:"mouseup"}};var Kt;(function(e){e[e.RightClick=2]="RightClick"})(Kt||(Kt={}));class ts extends un{constructor(t){super(t,es,Fe(t.event.target))}}ts.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Kt.RightClick?!1:(r?.({event:n}),!0)}}];const Lt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class ns extends un{constructor(t){super(t,Lt)}static setup(){return window.addEventListener(Lt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Lt.move.name,t)};function t(){}}}ns.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var Xe;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Xe||(Xe={}));var St;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(St||(St={}));function rs(e){let{acceleration:t,activator:n=Xe.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:i=5,order:a=St.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:g,delta:h,threshold:p}=e;const m=ss({delta:h,disabled:!s}),[v,x]=ho(),y=f.useRef({x:0,y:0}),S=f.useRef({x:0,y:0}),j=f.useMemo(()=>{switch(n){case Xe.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Xe.DraggableRect:return o}},[n,o,c]),M=f.useRef(null),_=f.useCallback(()=>{const O=M.current;if(!O)return;const $=y.current.x*S.current.x,L=y.current.y*S.current.y;O.scrollBy($,L)},[]),A=f.useMemo(()=>a===St.TreeOrder?[...d].reverse():d,[a,d]);f.useEffect(()=>{if(!s||!d.length||!j){x();return}for(const O of A){if(r?.(O)===!1)continue;const $=d.indexOf(O),L=g[$];if(!L)continue;const{direction:V,speed:F}=Yo(O,L,j,t,p);for(const z of["x","y"])m[z][V[z]]||(F[z]=0,V[z]=0);if(F.x>0||F.y>0){x(),M.current=O,v(_,i),y.current=F,S.current=V;return}}y.current={x:0,y:0},S.current={x:0,y:0},x()},[t,_,r,x,s,i,JSON.stringify(j),JSON.stringify(m),v,d,A,g,JSON.stringify(p)])}const os={x:{[Q.Backward]:!1,[Q.Forward]:!1},y:{[Q.Backward]:!1,[Q.Forward]:!1}};function ss(e){let{delta:t,disabled:n}=e;const r=Ut(t);return nt(o=>{if(n||!r||!o)return os;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 is(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return nt(o=>{var s;return t==null?null:(s=r??o)!=null?s:null},[r,t])}function as(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 et;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(et||(et={}));var Xt;(function(e){e.Optimized="optimized"})(Xt||(Xt={}));const _n=new Map;function ls(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(),p=Qe(h),m=f.useCallback(function(S){S===void 0&&(S=[]),!p.current&&i(j=>j===null?S:j.concat(S.filter(M=>!j.includes(M))))},[p]),v=f.useRef(null),x=nt(S=>{if(h&&!n)return _n;if(!S||S===_n||g.current!==e||s!=null){const j=new Map;for(let M of e){if(!M)continue;if(s&&s.length>0&&!s.includes(M.id)&&M.rect.current){j.set(M.id,M.rect.current);continue}const _=M.node.current,A=_?new cn(c(_),_):null;M.rect.current=A,A&&j.set(M.id,A)}return j}return S},[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"||v.current!==null||(v.current=setTimeout(()=>{m(),v.current=null},a))},[a,h,m,...r]),{droppableRects:x,measureDroppableContainers:m,measuringScheduled:s!=null};function y(){switch(d){case et.Always:return!1;case et.BeforeDragging:return n;default:return!n}}}function vr(e,t){return nt(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function cs(e,t){return vr(e,t)}function us(e){let{callback:t,disabled:n}=e;const r=sn(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 Et(e){let{callback:t,disabled:n}=e;const r=sn(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 ds(e){return new cn(We(e),e)}function In(e,t,n){t===void 0&&(t=ds);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=us({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=Et({callback:s});return xe(()=>{s(),e?(a?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),i?.disconnect())},[e]),r}function fs(e){const t=vr(e);return lr(e,t)}const kn=[];function hs(e){const t=f.useRef(e),n=nt(r=>e?r&&r!==kn&&e&&t.current&&e.parentNode===t.current.parentNode?r:ln(e):kn,[e]);return f.useEffect(()=>{t.current=e},[e]),n}function gs(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,qt(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,qt(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)=>Le(s,i),pe):gr(e):pe,[e,t])}function An(e,t){t===void 0&&(t=[]);const n=f.useRef(null);return f.useEffect(()=>{n.current=null},t),f.useEffect(()=>{const r=e!==pe;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?bt(e,n.current):pe}function ps(e){f.useEffect(()=>{if(!Dt)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function ms(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 xr(e){return f.useMemo(()=>e?Fo(e):null,[e])}const $n=[];function vs(e,t){t===void 0&&(t=We);const[n]=e,r=xr(n?ie(n):null),[o,s]=f.useState($n);function i(){s(()=>e.length?e.map(c=>fr(c)?r:new cn(t(c),c)):$n)}const a=Et({callback:i});return xe(()=>{a?.disconnect(),i(),e.forEach(c=>a?.observe(c))},[e]),o}function xs(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return tt(t)?t:e}function bs(e){let{measure:t}=e;const[n,r]=f.useState(null),o=f.useCallback(d=>{for(const{target:g}of d)if(tt(g)){r(h=>{const p=t(g);return h?{...h,width:p.width,height:p.height}:p});break}},[t]),s=Et({callback:o}),i=f.useCallback(d=>{const g=xs(d);s?.disconnect(),g&&s?.observe(g),r(g?t(g):null)},[t,s]),[a,c]=xt(i);return f.useMemo(()=>({nodeRef:a,rect:n,setRef:c}),[n,a,c])}const ys=[{sensor:dn,options:{}},{sensor:mr,options:{}}],Ss={current:{}},ht={draggable:{measure:Mn},droppable:{measure:Mn,strategy:et.WhileDragging,frequency:Xt.Optimized},dragOverlay:{measure:We}};class Je 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 ws={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Je,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:yt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ht,measureDroppableContainers:yt,windowRect:null,measuringScheduled:!1},Cs={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:yt,draggableNodes:new Map,over:null,measureDroppableContainers:yt},jt=f.createContext(Cs),br=f.createContext(ws);function Ds(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Je}}}function Es(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 Je(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 Je(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 Je(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function js(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=f.useContext(jt),s=Ut(r),i=Ut(n?.id);return f.useEffect(()=>{if(!t&&!r&&s&&i!=null){if(!an(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=mo(g);if(h){h.focus();break}}})}},[r,t,o,i,s]),null}function Ms(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,s)=>s({transform:o,...r}),n):n}function Rs(e){return f.useMemo(()=>({draggable:{...ht.draggable,...e?.draggable},droppable:{...ht.droppable,...e?.droppable},dragOverlay:{...ht.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ts(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=lr(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 p=cr(d);p&&p.scrollBy({top:h.y,left:h.x})}},[t,i,a,r,n])}const yr=f.createContext({...pe,scaleX:1,scaleY:1});var Me;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Me||(Me={}));const Sr=f.memo(function(t){var n,r,o,s;let{id:i,accessibility:a,autoScroll:c=!0,children:d,sensors:g=ys,collisionDetection:h=ko,measuring:p,modifiers:m,...v}=t;const x=f.useReducer(Es,void 0,Ds),[y,S]=x,[j,M]=wo(),[_,A]=f.useState(Me.Uninitialized),O=_===Me.Initialized,{draggable:{active:$,nodes:L,translate:V},droppable:{containers:F}}=y,z=$!=null?L.get($):null,q=f.useRef({initial:null,translated:null}),K=f.useMemo(()=>{var oe;return $!=null?{id:$,data:(oe=z?.data)!=null?oe:Ss,rect:q}:null},[$,z]),T=f.useRef(null),[C,E]=f.useState(null),[R,D]=f.useState(null),k=Qe(v,Object.values(v)),P=rt("DndDescribedBy",i),b=f.useMemo(()=>F.getEnabled(),[F]),I=Rs(p),{droppableRects:N,measureDroppableContainers:W,measuringScheduled:G}=ls(b,{dragging:O,dependencies:[V.x,V.y],config:I.droppable}),U=is(L,$),Y=f.useMemo(()=>R?Gt(R):null,[R]),X=io(),J=cs(U,I.draggable.measure);Ts({activeNode:$!=null?L.get($):null,config:X.layoutShiftCompensation,initialRect:J,measure:I.draggable.measure});const B=In(U,I.draggable.measure,J),se=In(U?U.parentElement:null),re=f.useRef({activatorEvent:null,active:null,activeNode:U,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:L,draggingNode:null,draggingNodeRect:null,droppableContainers:F,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ge=F.getNodeFor((n=re.current.over)==null?void 0:n.id),be=bs({measure:I.dragOverlay.measure}),Oe=(r=be.nodeRef.current)!=null?r:U,_e=O?(o=be.rect)!=null?o:B:null,gn=!!(be.nodeRef.current&&be.rect),pn=fs(gn?null:B),_t=xr(Oe?ie(Oe):null),we=hs(O?ge??U:null),ot=vs(we),st=Ms(m,{transform:{x:V.x-pn.x,y:V.y-pn.y,scaleX:1,scaleY:1},activatorEvent:R,active:K,activeNodeRect:B,containerNodeRect:se,draggingNodeRect:_e,over:re.current.over,overlayNodeRect:be.rect,scrollableAncestors:we,scrollableAncestorRects:ot,windowRect:_t}),mn=Y?Le(Y,V):null,vn=gs(we),Qr=An(vn),eo=An(vn,[B]),Ie=Le(st,Qr),ke=_e?zo(_e,st):null,Ve=K&&ke?h({active:K,collisionRect:ke,droppableRects:N,droppableContainers:b,pointerCoordinates:mn}):null,xn=_o(Ve,"id"),[Ce,bn]=f.useState(null),to=gn?st:Le(st,eo),no=Ao(to,(s=Ce?.rect)!=null?s:null,B),It=f.useRef(null),yn=f.useCallback((oe,le)=>{let{sensor:ce,options:De}=le;if(T.current==null)return;const de=L.get(T.current);if(!de)return;const ue=oe.nativeEvent,me=new ce({active:T.current,activeNode:de,event:ue,options:De,context:re,onAbort(ee){if(!L.get(ee))return;const{onDragAbort:ve}=k.current,ye={id:ee};ve?.(ye),j({type:"onDragAbort",event:ye})},onPending(ee,Ee,ve,ye){if(!L.get(ee))return;const{onDragPending:He}=k.current,je={id:ee,constraint:Ee,initialCoordinates:ve,offset:ye};He?.(je),j({type:"onDragPending",event:je})},onStart(ee){const Ee=T.current;if(Ee==null)return;const ve=L.get(Ee);if(!ve)return;const{onDragStart:ye}=k.current,Ye={activatorEvent:ue,active:{id:Ee,data:ve.data,rect:q}};ze.unstable_batchedUpdates(()=>{ye?.(Ye),A(Me.Initializing),S({type:Z.DragStart,initialCoordinates:ee,active:Ee}),j({type:"onDragStart",event:Ye}),E(It.current),D(ue)})},onMove(ee){S({type:Z.DragMove,coordinates:ee})},onEnd:Ae(Z.DragEnd),onCancel:Ae(Z.DragCancel)});It.current=me;function Ae(ee){return async function(){const{active:ve,collisions:ye,over:Ye,scrollAdjustedTranslate:He}=re.current;let je=null;if(ve&&He){const{cancelDrop:Ue}=k.current;je={activatorEvent:ue,active:ve,collisions:ye,delta:He,over:Ye},ee===Z.DragEnd&&typeof Ue=="function"&&await Promise.resolve(Ue(je))&&(ee=Z.DragCancel)}T.current=null,ze.unstable_batchedUpdates(()=>{S({type:ee}),A(Me.Uninitialized),bn(null),E(null),D(null),It.current=null;const Ue=ee===Z.DragEnd?"onDragEnd":"onDragCancel";if(je){const kt=k.current[Ue];kt?.(je),j({type:Ue,event:je})}})}}},[L]),ro=f.useCallback((oe,le)=>(ce,De)=>{const de=ce.nativeEvent,ue=L.get(De);if(T.current!==null||!ue||de.dndKit||de.defaultPrevented)return;const me={active:ue};oe(ce,le.options,me)===!0&&(de.dndKit={capturedBy:le.sensor},T.current=De,yn(ce,le))},[L,yn]),Sn=as(g,ro);ps(g),xe(()=>{B&&_===Me.Initializing&&A(Me.Initialized)},[B,_]),f.useEffect(()=>{const{onDragMove:oe}=k.current,{active:le,activatorEvent:ce,collisions:De,over:de}=re.current;if(!le||!ce)return;const ue={active:le,activatorEvent:ce,collisions:De,delta:{x:Ie.x,y:Ie.y},over:de};ze.unstable_batchedUpdates(()=>{oe?.(ue),j({type:"onDragMove",event:ue})})},[Ie.x,Ie.y]),f.useEffect(()=>{const{active:oe,activatorEvent:le,collisions:ce,droppableContainers:De,scrollAdjustedTranslate:de}=re.current;if(!oe||T.current==null||!le||!de)return;const{onDragOver:ue}=k.current,me=De.get(xn),Ae=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:Ae};ze.unstable_batchedUpdates(()=>{bn(Ae),ue?.(ee),j({type:"onDragOver",event:ee})})},[xn]),xe(()=>{re.current={activatorEvent:R,active:K,activeNode:U,collisionRect:ke,collisions:Ve,droppableRects:N,draggableNodes:L,draggingNode:Oe,draggingNodeRect:_e,droppableContainers:F,over:Ce,scrollableAncestors:we,scrollAdjustedTranslate:Ie},q.current={initial:_e,translated:ke}},[K,U,Ve,ke,L,Oe,_e,N,F,Ce,we,Ie]),rs({...X,delta:V,draggingRect:ke,pointerCoordinates:mn,scrollableAncestors:we,scrollableAncestorRects:ot});const oo=f.useMemo(()=>({active:K,activeNode:U,activeNodeRect:B,activatorEvent:R,collisions:Ve,containerNodeRect:se,dragOverlay:be,draggableNodes:L,droppableContainers:F,droppableRects:N,over:Ce,measureDroppableContainers:W,scrollableAncestors:we,scrollableAncestorRects:ot,measuringConfiguration:I,measuringScheduled:G,windowRect:_t}),[K,U,B,R,Ve,se,be,L,F,N,Ce,W,we,ot,I,G,_t]),so=f.useMemo(()=>({activatorEvent:R,activators:Sn,active:K,activeNodeRect:B,ariaDescribedById:{draggable:P},dispatch:S,draggableNodes:L,over:Ce,measureDroppableContainers:W}),[R,Sn,K,B,S,P,L,Ce,W]);return f.createElement(ir.Provider,{value:M},f.createElement(jt.Provider,{value:so},f.createElement(br.Provider,{value:oo},f.createElement(yr.Provider,{value:no},d)),f.createElement(js,{disabled:a?.restoreFocus===!1})),f.createElement(Eo,{...a,hiddenTextDescribedById:P}));function io(){const oe=C?.autoScrollEnabled===!1,le=typeof c=="object"?c.enabled===!1:c===!1,ce=O&&!oe&&!le;return typeof c=="object"?{...c,enabled:ce}:{enabled:ce}}}),Os=f.createContext(null),zn="button",_s="Draggable";function Is(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=rt(_s),{activators:i,activatorEvent:a,active:c,activeNodeRect:d,ariaDescribedById:g,draggableNodes:h,over:p}=f.useContext(jt),{role:m=zn,roleDescription:v="draggable",tabIndex:x=0}=o??{},y=c?.id===t,S=f.useContext(y?yr:Os),[j,M]=xt(),[_,A]=xt(),O=ms(i,t),$=Qe(n);xe(()=>(h.set(t,{id:t,key:s,node:j,activatorNode:_,data:$}),()=>{const V=h.get(t);V&&V.key===s&&h.delete(t)}),[h,t]);const L=f.useMemo(()=>({role:m,tabIndex:x,"aria-disabled":r,"aria-pressed":y&&m===zn?!0:void 0,"aria-roledescription":v,"aria-describedby":g.draggable}),[r,m,x,y,v,g.draggable]);return{active:c,activatorEvent:a,activeNodeRect:d,attributes:L,isDragging:y,listeners:r?void 0:O,node:j,over:p,setNodeRef:M,setActivatorNodeRef:A,transform:S}}function ks(){return f.useContext(br)}const As="Droppable",$s={timeout:25};function zs(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=rt(As),{active:i,dispatch:a,over:c,measureDroppableContainers:d}=f.useContext(jt),g=f.useRef({disabled:n}),h=f.useRef(!1),p=f.useRef(null),m=f.useRef(null),{disabled:v,updateMeasurementsFor:x,timeout:y}={...$s,...o},S=Qe(x??r),j=f.useCallback(()=>{if(!h.current){h.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{d(Array.isArray(S.current)?S.current:[S.current]),m.current=null},y)},[y]),M=Et({callback:j,disabled:v||!i}),_=f.useCallback((L,V)=>{M&&(V&&(M.unobserve(V),h.current=!1),L&&M.observe(L))},[M]),[A,O]=xt(_),$=Qe(t);return f.useEffect(()=>{!M||!A.current||(M.disconnect(),h.current=!1,M.observe(A.current))},[A,M]),f.useEffect(()=>(a({type:Z.RegisterDroppable,element:{id:r,key:s,disabled:n,node:A,rect:p,data:$}}),()=>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:p,isOver:c?.id===r,node:A,over:c,setNodeRef:O}}function Mt(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Ls(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function at(e){return e!==null&&e>=0}function Ps(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 lt={scaleX:1,scaleY:1},Fs=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=Ws(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,...lt}:null}return i>o&&i<=s?{x:-a.width-c,y:0,...lt}:i<o&&i>=s?{x:a.width+c,y:0,...lt}:{x:0,y:0,...lt}};function Ws(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 wr=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const s=Mt(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}},ct={scaleX:1,scaleY:1},Bs=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,...ct}:null}const c=Vs(s,o,n);return o>n&&o<=i?{x:0,y:-a.height-c,...ct}:o<n&&o>=i?{x:0,y:a.height+c,...ct}:{x:0,y:0,...ct}};function Vs(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 Cr="Sortable",Dr=f.createContext({activeIndex:-1,containerId:Cr,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:wr,disabled:{draggable:!1,droppable:!1}});function Er(e){let{children:t,id:n,items:r,strategy:o=wr,disabled:s=!1}=e;const{active:i,dragOverlay:a,droppableRects:c,over:d,measureDroppableContainers:g}=ks(),h=rt(Cr,n),p=a.rect!==null,m=f.useMemo(()=>r.map(O=>typeof O=="object"&&"id"in O?O.id:O),[r]),v=i!=null,x=i?m.indexOf(i.id):-1,y=d?m.indexOf(d.id):-1,S=f.useRef(m),j=!Ps(m,S.current),M=y!==-1&&x===-1||j,_=Ns(s);xe(()=>{j&&v&&g(m)},[j,m,v,g]),f.useEffect(()=>{S.current=m},[m]);const A=f.useMemo(()=>({activeIndex:x,containerId:h,disabled:_,disableTransforms:M,items:m,overIndex:y,useDragOverlay:p,sortedRects:Ls(m,c),strategy:o}),[x,h,_.draggable,_.droppable,M,m,y,c,p,o]);return f.createElement(Dr.Provider,{value:A},t)}const Ys=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Mt(n,r,o).indexOf(t)},Hs=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},Us={duration:200,easing:"ease"},jr="transform",Gs=Pe.Transition.toString({property:jr,duration:0,easing:"linear"}),qs={roleDescription:"sortable"};function Ks(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=We(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 Mr(e){let{animateLayoutChanges:t=Hs,attributes:n,disabled:r,data:o,getNewIndex:s=Ys,id:i,strategy:a,resizeObserverConfig:c,transition:d=Us}=e;const{items:g,containerId:h,activeIndex:p,disabled:m,disableTransforms:v,sortedRects:x,overIndex:y,useDragOverlay:S,strategy:j}=f.useContext(Dr),M=Xs(r,m),_=g.indexOf(i),A=f.useMemo(()=>({sortable:{containerId:h,index:_,items:g},...o}),[h,o,_,g]),O=f.useMemo(()=>g.slice(g.indexOf(i)),[g,i]),{rect:$,node:L,isOver:V,setNodeRef:F}=zs({id:i,data:A,disabled:M.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...c}}),{active:z,activatorEvent:q,activeNodeRect:K,attributes:T,setNodeRef:C,listeners:E,isDragging:R,over:D,setActivatorNodeRef:k,transform:P}=Is({id:i,data:A,attributes:{...qs,...n},disabled:M.draggable}),b=fo(F,C),I=!!z,N=I&&!v&&at(p)&&at(y),W=!S&&R,G=W&&N?P:null,Y=N?G??(a??j)({rects:x,activeNodeRect:K,activeIndex:p,overIndex:y,index:_}):null,X=at(p)&&at(y)?s({id:i,items:g,activeIndex:p,overIndex:y}):_,J=z?.id,B=f.useRef({activeId:J,items:g,newIndex:X,containerId:h}),se=g!==B.current.items,re=t({active:z,containerId:h,isDragging:R,isSorting:I,id:i,index:_,items:g,newIndex:B.current.newIndex,previousItems:B.current.items,previousContainerId:B.current.containerId,transition:d,wasDragging:B.current.activeId!=null}),ge=Ks({disabled:!re,index:_,node:L,rect:$});return f.useEffect(()=>{I&&B.current.newIndex!==X&&(B.current.newIndex=X),h!==B.current.containerId&&(B.current.containerId=h),g!==B.current.items&&(B.current.items=g)},[I,X,h,g]),f.useEffect(()=>{if(J===B.current.activeId)return;if(J!=null&&B.current.activeId==null){B.current.activeId=J;return}const Oe=setTimeout(()=>{B.current.activeId=J},50);return()=>clearTimeout(Oe)},[J]),{active:z,activeIndex:p,attributes:T,data:A,rect:$,index:_,newIndex:X,items:g,isOver:V,isSorting:I,isDragging:R,listeners:E,node:L,overIndex:y,over:D,setNodeRef:b,setActivatorNodeRef:k,setDroppableNodeRef:F,setDraggableNodeRef:C,transform:ge??Y,transition:be()};function be(){if(ge||se&&B.current.newIndex===_)return Gs;if(!(W&&!an(q)||!d)&&(I||re))return Pe.Transition.toString({...d,property:jr})}}function Xs(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}}H.Down,H.Right,H.Up,H.Left;var ut={exports:{}},Pt={},dt={exports:{}},Nt={};var Ln;function Js(){if(Ln)return Nt;Ln=1;var e=f;function t(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function a(h,p){var m=p(),v=r({inst:{value:m,getSnapshot:p}}),x=v[0].inst,y=v[1];return s(function(){x.value=m,x.getSnapshot=p,c(x)&&y({inst:x})},[h,m,p]),o(function(){return c(x)&&y({inst:x}),h(function(){c(x)&&y({inst:x})})},[h]),i(m),m}function c(h){var p=h.getSnapshot;h=h.value;try{var m=p();return!n(h,m)}catch{return!0}}function d(h,p){return p()}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 Ft={};var Pn;function Zs(){return Pn||(Pn=1,process.env.NODE_ENV!=="production"&&(function(){function e(m,v){return m===v&&(m!==0||1/m===1/v)||m!==m&&v!==v}function t(m,v){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=v();if(!h){var y=v();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:v}});var S=y[0].inst,j=y[1];return c(function(){S.value=x,S.getSnapshot=v,n(S)&&j({inst:S})},[m,x,v]),a(function(){return n(S)&&j({inst:S}),m(function(){n(S)&&j({inst:S})})},[m]),d(x),x}function n(m){var v=m.getSnapshot;m=m.value;try{var x=v();return!s(m,x)}catch{return!0}}function r(m,v){return v()}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,p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;Ft.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:p,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Ft}var Nn;function Rr(){return Nn||(Nn=1,process.env.NODE_ENV==="production"?dt.exports=Js():dt.exports=Zs()),dt.exports}var Fn;function Qs(){if(Fn)return Pt;Fn=1;var e=f,t=Rr();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 Pt.useSyncExternalStoreWithSelector=function(d,g,h,p,m){var v=s(null);if(v.current===null){var x={hasValue:!1,value:null};v.current=x}else x=v.current;v=a(function(){function S(O){if(!j){if(j=!0,M=O,O=p(O),m!==void 0&&x.hasValue){var $=x.value;if(m($,O))return _=$}return _=O}if($=_,r(M,O))return $;var L=p(O);return m!==void 0&&m($,L)?(M=O,$):(M=O,_=L)}var j=!1,M,_,A=h===void 0?null:h;return[function(){return S(g())},A===null?void 0:function(){return S(A())}]},[g,h,p,m]);var y=o(d,v[0],v[1]);return i(function(){x.hasValue=!0,x.value=y},[y]),c(y),y},Pt}var Wt={};var Wn;function ei(){return Wn||(Wn=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=Rr(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,i=t.useEffect,a=t.useMemo,c=t.useDebugValue;Wt.useSyncExternalStoreWithSelector=function(d,g,h,p,m){var v=s(null);if(v.current===null){var x={hasValue:!1,value:null};v.current=x}else x=v.current;v=a(function(){function S(O){if(!j){if(j=!0,M=O,O=p(O),m!==void 0&&x.hasValue){var $=x.value;if(m($,O))return _=$}return _=O}if($=_,r(M,O))return $;var L=p(O);return m!==void 0&&m($,L)?(M=O,$):(M=O,_=L)}var j=!1,M,_,A=h===void 0?null:h;return[function(){return S(g())},A===null?void 0:function(){return S(A())}]},[g,h,p,m]);var y=o(d,v[0],v[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())})()),Wt}var Bn;function ti(){return Bn||(Bn=1,process.env.NODE_ENV==="production"?ut.exports=Qs():ut.exports=ei()),ut.exports}var ni=ti();const Jt=new WeakMap,ri=new WeakMap,wt={current:[]};let Bt=!1;const ft=new Set,Vn=new Map;function Tr(e){for(const t of e){if(wt.current.includes(t))continue;wt.current.push(t),t.recompute();const n=ri.get(t);if(n)for(const r of n){const o=Jt.get(r);o?.length&&Tr(o)}}}function oi(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function si(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function ii(e){if(ft.add(e),!Bt)try{for(Bt=!0;ft.size>0;){const t=Array.from(ft);ft.clear();for(const n of t){const r=Vn.get(n)??n.prevState;n.prevState=r,oi(n)}for(const n of t){const r=Jt.get(n);r&&(wt.current.push(n),Tr(r))}for(const n of t){const r=Jt.get(n);if(r)for(const o of r)si(o)}}}finally{Bt=!1,wt.current=[],Vn.clear()}}function ai(e){return typeof e=="function"}class li{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):ai(t)?this.state=t(this.prevState):this.state=t,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),ii(this)}}function Be(e,t=r=>r,n={}){const r=n.equal??ci;return ni.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,r)}function ci(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=Yn(e);if(n.length!==Yn(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 Yn(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((v,x)=>r[x]!==v)))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 v=Math.round((Date.now()-g)*100)/100,x=Math.round((Date.now()-m)*100)/100,y=x/16,S=(j,M)=>{for(j=String(j);j.length<M;)j=" "+j;return j};console.info(`%c⏱ ${S(x,5)} /${S(v,5)} ms`,`
10
+ `},Eo={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 jo(e){let{announcements:t=Eo,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Do}=e;const{announce:s,announcement:a}=So(),l=rt("DndLiveRegion"),[u,d]=f.useState(!1);if(f.useEffect(()=>{d(!0)},[]),wo(f.useMemo(()=>({onDragStart(h){let{active:p}=h;s(t.onDragStart({active:p}))},onDragMove(h){let{active:p,over:m}=h;t.onDragMove&&s(t.onDragMove({active:p,over:m}))},onDragOver(h){let{active:p,over:m}=h;s(t.onDragOver({active:p,over:m}))},onDragEnd(h){let{active:p,over:m}=h;s(t.onDragEnd({active:p,over:m}))},onDragCancel(h){let{active:p,over:m}=h;s(t.onDragCancel({active:p,over:m}))}}),[s,t])),!u)return null;const g=f.createElement(f.Fragment,null,f.createElement(bo,{id:r,value:o.draggable}),f.createElement(yo,{id:l,announcement:a}));return n?ze.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 yt(){}function Mo(e,t){return f.useMemo(()=>({sensor:e,options:{}}),[e,t])}function Ro(){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 To(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Oo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Io(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function _o(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function jn(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const lr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=jn(t,t.left,t.top),s=[];for(const a of r){const{id:l}=a,u=n.get(l);if(u){const d=To(jn(u),o);s.push({id:l,data:{droppableContainer:a,value:d}})}}return s.sort(Oo)};function ko(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),a=o-r,l=s-n;if(r<o&&n<s){const u=t.width*t.height,d=e.width*e.height,g=a*l,h=g/(u+d-g);return Number(h.toFixed(4))}return 0}const $o=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const u=ko(l,t);u>0&&o.push({id:a,data:{droppableContainer:s,value:u}})}}return o.sort(Io)};function Ao(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function cr(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:pe}function zo(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];return o.reduce((a,l)=>({...a,top:a.top+e*l.y,bottom:a.bottom+e*l.y,left:a.left+e*l.x,right:a.right+e*l.x}),{...n})}}const Lo=zo(1);function Po(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 No(e,t,n){const r=Po(t);if(!r)return e;const{scaleX:o,scaleY:s,x:a,y:l}=r,u=e.left-a-(1-o)*parseFloat(n),d=e.top-l-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),g=o?e.width/o:e.width,h=s?e.height/s:e.height;return{width:g,height:h,top:d,right:u+g,bottom:d+h,left:u}}const Fo={ignoreTransform:!1};function We(e,t){t===void 0&&(t=Fo);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:g}=ie(e).getComputedStyle(e);d&&(n=No(n,d,g))}const{top:r,left:o,width:s,height:a,bottom:l,right:u}=n;return{top:r,left:o,width:s,height:a,bottom:l,right:u}}function Mn(e){return We(e,{ignoreTransform:!0})}function Wo(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Bo(e,t){return t===void 0&&(t=ie(e).getComputedStyle(e)),t.position==="fixed"}function Vo(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 ln(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(on(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!tt(o)||sr(o)||n.includes(o))return n;const s=ie(e).getComputedStyle(o);return o!==e&&Vo(o,s)&&n.push(o),Bo(o,s)?n:r(o.parentNode)}return e?r(e):n}function ur(e){const[t]=ln(e,1);return t??null}function At(e){return!Dt||!e?null:Ne(e)?e:rn(e)?on(e)||e===Fe(e).scrollingElement?window:tt(e)?e:null:null}function dr(e){return Ne(e)?e.scrollX:e.scrollLeft}function fr(e){return Ne(e)?e.scrollY:e.scrollTop}function qt(e){return{x:dr(e),y:fr(e)}}var Q;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Q||(Q={}));function hr(e){return!Dt||!e?!1:e===document.scrollingElement}function gr(e){const t={x:0,y:0},n=hr(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:o,isLeft:s,isBottom:a,isRight:l,maxScroll:r,minScroll:t}}const Yo={x:.2,y:.2};function Ho(e,t,n,r,o){let{top:s,left:a,right:l,bottom:u}=n;r===void 0&&(r=10),o===void 0&&(o=Yo);const{isTop:d,isBottom:g,isLeft:h,isRight:p}=gr(e),m={x:0,y:0},v={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,v.y=r*Math.abs((t.top+x.height-s)/x.height)):!g&&u>=t.bottom-x.height&&(m.y=Q.Forward,v.y=r*Math.abs((t.bottom-x.height-u)/x.height)),!p&&l>=t.right-x.width?(m.x=Q.Forward,v.x=r*Math.abs((t.right-x.width-l)/x.width)):!h&&a<=t.left+x.width&&(m.x=Q.Backward,v.x=r*Math.abs((t.left+x.width-a)/x.width)),{direction:m,speed:v}}function Uo(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:a}=window;return{top:0,left:0,right:s,bottom:a,width:s,height:a}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function pr(e){return e.reduce((t,n)=>Le(t,qt(n)),pe)}function Go(e){return e.reduce((t,n)=>t+dr(n),0)}function qo(e){return e.reduce((t,n)=>t+fr(n),0)}function Xo(e,t){if(t===void 0&&(t=We),!e)return;const{top:n,left:r,bottom:o,right:s}=t(e);ur(e)&&(o<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Ko=[["x",["left","right"],Go],["y",["top","bottom"],qo]];class cn{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=ln(n),o=pr(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,a,l]of Ko)for(const u of a)Object.defineProperty(this,u,{get:()=>{const d=l(r),g=o[s]-d;return this.rect[u]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Xe{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 Jo(e){const{EventTarget:t}=ie(e);return e instanceof t?e:Fe(e)}function zt(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 Rn(e){e.preventDefault()}function Zo(e){e.stopPropagation()}var H;(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"})(H||(H={}));const mr={start:[H.Space,H.Enter],cancel:[H.Esc],end:[H.Space,H.Enter,H.Tab]},Qo=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case H.Right:return{...n,x:n.x+25};case H.Left:return{...n,x:n.x-25};case H.Down:return{...n,y:n.y+25};case H.Up:return{...n,y:n.y-25}}};class vr{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 Xe(Fe(n)),this.windowListeners=new Xe(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&&Xo(r),n(pe)}handleKeyDown(t){if(an(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=mr,coordinateGetter:a=Qo,scrollBehavior:l="smooth"}=o,{code:u}=t;if(s.end.includes(u)){this.handleEnd(t);return}if(s.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:d}=r.current,g=d?{x:d.left,y:d.top}:pe;this.referenceCoordinates||(this.referenceCoordinates=g);const h=a(t,{active:n,context:r.current,currentCoordinates:g});if(h){const p=bt(h,g),m={x:0,y:0},{scrollableAncestors:v}=r.current;for(const x of v){const S=t.code,{isTop:w,isRight:j,isLeft:M,isBottom:I,maxScroll:$,minScroll:O}=gr(x),A=Uo(x),L={x:Math.min(S===H.Right?A.right-A.width/2:A.right,Math.max(S===H.Right?A.left:A.left+A.width/2,h.x)),y:Math.min(S===H.Down?A.bottom-A.height/2:A.bottom,Math.max(S===H.Down?A.top:A.top+A.height/2,h.y))},V=S===H.Right&&!j||S===H.Left&&!M,F=S===H.Down&&!I||S===H.Up&&!w;if(V&&L.x!==h.x){const z=x.scrollLeft+p.x,q=S===H.Right&&z<=$.x||S===H.Left&&z>=O.x;if(q&&!p.y){x.scrollTo({left:z,behavior:l});return}q?m.x=x.scrollLeft-z:m.x=S===H.Right?x.scrollLeft-$.x:x.scrollLeft-O.x,m.x&&x.scrollBy({left:-m.x,behavior:l});break}else if(F&&L.y!==h.y){const z=x.scrollTop+p.y,q=S===H.Down&&z<=$.y||S===H.Up&&z>=O.y;if(q&&!p.x){x.scrollTo({top:z,behavior:l});return}q?m.y=x.scrollTop-z:m.y=S===H.Down?x.scrollTop-$.y:x.scrollTop-O.y,m.y&&x.scrollBy({top:-m.y,behavior:l});break}}this.handleMove(t,Le(bt(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()}}vr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=mr,onActivation:o}=t,{active:s}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const l=s.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function Tn(e){return!!(e&&"distance"in e)}function On(e){return!!(e&&"delay"in e)}class un{constructor(t,n,r){var o;r===void 0&&(r=Jo(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:s}=t,{target:a}=s;this.props=t,this.events=n,this.document=Fe(a),this.documentListeners=new Xe(this.document),this.listeners=new Xe(r),this.windowListeners=new Xe(ie(a)),this.initialCoordinates=(o=Gt(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,Rn),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),this.windowListeners.add(fe.ContextMenu,Rn),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(On(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Tn(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,Zo,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(fe.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:s}=this,{onMove:a,options:{activationConstraint:l}}=s;if(!o)return;const u=(n=Gt(t))!=null?n:pe,d=bt(o,u);if(!r&&l){if(Tn(l)){if(l.tolerance!=null&&zt(d,l.tolerance))return this.handleCancel();if(zt(d,l.distance))return this.handleStart()}if(On(l)&&zt(d,l.tolerance))return this.handleCancel();this.handlePending(l,d);return}t.cancelable&&t.preventDefault(),a(u)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===H.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const es={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class dn extends un{constructor(t){const{event:n}=t,r=Fe(n.target);super(t,es,r)}}dn.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 ts={move:{name:"mousemove"},end:{name:"mouseup"}};var Xt;(function(e){e[e.RightClick=2]="RightClick"})(Xt||(Xt={}));class ns extends un{constructor(t){super(t,ts,Fe(t.event.target))}}ns.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Xt.RightClick?!1:(r?.({event:n}),!0)}}];const Lt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class rs extends un{constructor(t){super(t,Lt)}static setup(){return window.addEventListener(Lt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Lt.move.name,t)};function t(){}}}rs.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 St;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(St||(St={}));function os(e){let{acceleration:t,activator:n=Ke.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:a=5,order:l=St.TreeOrder,pointerCoordinates:u,scrollableAncestors:d,scrollableAncestorRects:g,delta:h,threshold:p}=e;const m=is({delta:h,disabled:!s}),[v,x]=go(),S=f.useRef({x:0,y:0}),w=f.useRef({x:0,y:0}),j=f.useMemo(()=>{switch(n){case Ke.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case Ke.DraggableRect:return o}},[n,o,u]),M=f.useRef(null),I=f.useCallback(()=>{const O=M.current;if(!O)return;const A=S.current.x*w.current.x,L=S.current.y*w.current.y;O.scrollBy(A,L)},[]),$=f.useMemo(()=>l===St.TreeOrder?[...d].reverse():d,[l,d]);f.useEffect(()=>{if(!s||!d.length||!j){x();return}for(const O of $){if(r?.(O)===!1)continue;const A=d.indexOf(O),L=g[A];if(!L)continue;const{direction:V,speed:F}=Ho(O,L,j,t,p);for(const z of["x","y"])m[z][V[z]]||(F[z]=0,V[z]=0);if(F.x>0||F.y>0){x(),M.current=O,v(I,a),S.current=F,w.current=V;return}}S.current={x:0,y:0},w.current={x:0,y:0},x()},[t,I,r,x,s,a,JSON.stringify(j),JSON.stringify(m),v,d,$,g,JSON.stringify(p)])}const ss={x:{[Q.Backward]:!1,[Q.Forward]:!1},y:{[Q.Backward]:!1,[Q.Forward]:!1}};function is(e){let{delta:t,disabled:n}=e;const r=Ut(t);return nt(o=>{if(n||!r||!o)return ss;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 as(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return nt(o=>{var s;return t==null?null:(s=r??o)!=null?s:null},[r,t])}function ls(e,t){return f.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,s=o.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...s]},[]),[e,t])}var et;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(et||(et={}));var Kt;(function(e){e.Optimized="optimized"})(Kt||(Kt={}));const In=new Map;function cs(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,a]=f.useState(null),{frequency:l,measure:u,strategy:d}=o,g=f.useRef(e),h=S(),p=Qe(h),m=f.useCallback(function(w){w===void 0&&(w=[]),!p.current&&a(j=>j===null?w:j.concat(w.filter(M=>!j.includes(M))))},[p]),v=f.useRef(null),x=nt(w=>{if(h&&!n)return In;if(!w||w===In||g.current!==e||s!=null){const j=new Map;for(let M of e){if(!M)continue;if(s&&s.length>0&&!s.includes(M.id)&&M.rect.current){j.set(M.id,M.rect.current);continue}const I=M.node.current,$=I?new cn(u(I),I):null;M.rect.current=$,$&&j.set(M.id,$)}return j}return w},[e,s,n,h,u]);return f.useEffect(()=>{g.current=e},[e]),f.useEffect(()=>{h||m()},[n,h]),f.useEffect(()=>{s&&s.length>0&&a(null)},[JSON.stringify(s)]),f.useEffect(()=>{h||typeof l!="number"||v.current!==null||(v.current=setTimeout(()=>{m(),v.current=null},l))},[l,h,m,...r]),{droppableRects:x,measureDroppableContainers:m,measuringScheduled:s!=null};function S(){switch(d){case et.Always:return!1;case et.BeforeDragging:return n;default:return!n}}}function xr(e,t){return nt(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function us(e,t){return xr(e,t)}function ds(e){let{callback:t,disabled:n}=e;const r=sn(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 Et(e){let{callback:t,disabled:n}=e;const r=sn(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 fs(e){return new cn(We(e),e)}function _n(e,t,n){t===void 0&&(t=fs);const[r,o]=f.useState(null);function s(){o(u=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=u??n)!=null?d:null}const g=t(e);return JSON.stringify(u)===JSON.stringify(g)?u:g})}const a=ds({callback(u){if(e)for(const d of u){const{type:g,target:h}=d;if(g==="childList"&&h instanceof HTMLElement&&h.contains(e)){s();break}}}}),l=Et({callback:s});return xe(()=>{s(),e?(l?.observe(e),a?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),a?.disconnect())},[e]),r}function hs(e){const t=xr(e);return cr(e,t)}const kn=[];function gs(e){const t=f.useRef(e),n=nt(r=>e?r&&r!==kn&&e&&t.current&&e.parentNode===t.current.parentNode?r:ln(e):kn,[e]);return f.useEffect(()=>{t.current=e},[e]),n}function ps(e){const[t,n]=f.useState(null),r=f.useRef(e),o=f.useCallback(s=>{const a=At(s.target);a&&n(l=>l?(l.set(a,qt(a)),new Map(l)):null)},[]);return f.useEffect(()=>{const s=r.current;if(e!==s){a(s);const l=e.map(u=>{const d=At(u);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,qt(d)]):null}).filter(u=>u!=null);n(l.length?new Map(l):null),r.current=e}return()=>{a(e),a(s)};function a(l){l.forEach(u=>{const d=At(u);d?.removeEventListener("scroll",o)})}},[o,e]),f.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,a)=>Le(s,a),pe):pr(e):pe,[e,t])}function $n(e,t){t===void 0&&(t=[]);const n=f.useRef(null);return f.useEffect(()=>{n.current=null},t),f.useEffect(()=>{const r=e!==pe;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?bt(e,n.current):pe}function ms(e){f.useEffect(()=>{if(!Dt)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function vs(e,t){return f.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:s}=r;return n[o]=a=>{s(a,t)},n},{}),[e,t])}function br(e){return f.useMemo(()=>e?Wo(e):null,[e])}const An=[];function xs(e,t){t===void 0&&(t=We);const[n]=e,r=br(n?ie(n):null),[o,s]=f.useState(An);function a(){s(()=>e.length?e.map(u=>hr(u)?r:new cn(t(u),u)):An)}const l=Et({callback:a});return xe(()=>{l?.disconnect(),a(),e.forEach(u=>l?.observe(u))},[e]),o}function bs(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return tt(t)?t:e}function ys(e){let{measure:t}=e;const[n,r]=f.useState(null),o=f.useCallback(d=>{for(const{target:g}of d)if(tt(g)){r(h=>{const p=t(g);return h?{...h,width:p.width,height:p.height}:p});break}},[t]),s=Et({callback:o}),a=f.useCallback(d=>{const g=bs(d);s?.disconnect(),g&&s?.observe(g),r(g?t(g):null)},[t,s]),[l,u]=xt(a);return f.useMemo(()=>({nodeRef:l,rect:n,setRef:u}),[n,l,u])}const Ss=[{sensor:dn,options:{}},{sensor:vr,options:{}}],ws={current:{}},ht={draggable:{measure:Mn},droppable:{measure:Mn,strategy:et.WhileDragging,frequency:Kt.Optimized},dragOverlay:{measure:We}};class Je extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Cs={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Je,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:yt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ht,measureDroppableContainers:yt,windowRect:null,measuringScheduled:!1},Ds={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:yt,draggableNodes:new Map,over:null,measureDroppableContainers:yt},jt=f.createContext(Ds),yr=f.createContext(Cs);function Es(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Je}}}function js(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 Je(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case Z.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const a=new Je(e.droppable.containers);return a.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case Z.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Je(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function Ms(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=f.useContext(jt),s=Ut(r),a=Ut(n?.id);return f.useEffect(()=>{if(!t&&!r&&s&&a!=null){if(!an(s)||document.activeElement===s.target)return;const l=o.get(a);if(!l)return;const{activatorNode:u,node:d}=l;if(!u.current&&!d.current)return;requestAnimationFrame(()=>{for(const g of[u.current,d.current]){if(!g)continue;const h=vo(g);if(h){h.focus();break}}})}},[r,t,o,a,s]),null}function Rs(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,s)=>s({transform:o,...r}),n):n}function Ts(e){return f.useMemo(()=>({draggable:{...ht.draggable,...e?.draggable},droppable:{...ht.droppable,...e?.droppable},dragOverlay:{...ht.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Os(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const s=f.useRef(!1),{x:a,y:l}=typeof o=="boolean"?{x:o,y:o}:o;xe(()=>{if(!a&&!l||!t){s.current=!1;return}if(s.current||!r)return;const d=t?.node.current;if(!d||d.isConnected===!1)return;const g=n(d),h=cr(g,r);if(a||(h.x=0),l||(h.y=0),s.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const p=ur(d);p&&p.scrollBy({top:h.y,left:h.x})}},[t,a,l,r,n])}const Sr=f.createContext({...pe,scaleX:1,scaleY:1});var Me;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Me||(Me={}));const wr=f.memo(function(t){var n,r,o,s;let{id:a,accessibility:l,autoScroll:u=!0,children:d,sensors:g=Ss,collisionDetection:h=$o,measuring:p,modifiers:m,...v}=t;const x=f.useReducer(js,void 0,Es),[S,w]=x,[j,M]=Co(),[I,$]=f.useState(Me.Uninitialized),O=I===Me.Initialized,{draggable:{active:A,nodes:L,translate:V},droppable:{containers:F}}=S,z=A!=null?L.get(A):null,q=f.useRef({initial:null,translated:null}),X=f.useMemo(()=>{var oe;return A!=null?{id:A,data:(oe=z?.data)!=null?oe:ws,rect:q}:null},[A,z]),T=f.useRef(null),[C,E]=f.useState(null),[R,D]=f.useState(null),k=Qe(v,Object.values(v)),P=rt("DndDescribedBy",a),b=f.useMemo(()=>F.getEnabled(),[F]),_=Ts(p),{droppableRects:N,measureDroppableContainers:W,measuringScheduled:G}=cs(b,{dragging:O,dependencies:[V.x,V.y],config:_.droppable}),U=as(L,A),Y=f.useMemo(()=>R?Gt(R):null,[R]),K=ao(),J=us(U,_.draggable.measure);Os({activeNode:A!=null?L.get(A):null,config:K.layoutShiftCompensation,initialRect:J,measure:_.draggable.measure});const B=_n(U,_.draggable.measure,J),se=_n(U?U.parentElement:null),re=f.useRef({activatorEvent:null,active:null,activeNode:U,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:L,draggingNode:null,draggingNodeRect:null,droppableContainers:F,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ge=F.getNodeFor((n=re.current.over)==null?void 0:n.id),be=ys({measure:_.dragOverlay.measure}),Oe=(r=be.nodeRef.current)!=null?r:U,Ie=O?(o=be.rect)!=null?o:B:null,gn=!!(be.nodeRef.current&&be.rect),pn=hs(gn?null:B),It=br(Oe?ie(Oe):null),we=gs(O?ge??U:null),ot=xs(we),st=Rs(m,{transform:{x:V.x-pn.x,y:V.y-pn.y,scaleX:1,scaleY:1},activatorEvent:R,active:X,activeNodeRect:B,containerNodeRect:se,draggingNodeRect:Ie,over:re.current.over,overlayNodeRect:be.rect,scrollableAncestors:we,scrollableAncestorRects:ot,windowRect:It}),mn=Y?Le(Y,V):null,vn=ps(we),eo=$n(vn),to=$n(vn,[B]),_e=Le(st,eo),ke=Ie?Lo(Ie,st):null,Ve=X&&ke?h({active:X,collisionRect:ke,droppableRects:N,droppableContainers:b,pointerCoordinates:mn}):null,xn=_o(Ve,"id"),[Ce,bn]=f.useState(null),no=gn?st:Le(st,to),ro=Ao(no,(s=Ce?.rect)!=null?s:null,B),_t=f.useRef(null),yn=f.useCallback((oe,le)=>{let{sensor:ce,options:De}=le;if(T.current==null)return;const de=L.get(T.current);if(!de)return;const ue=oe.nativeEvent,me=new ce({active:T.current,activeNode:de,event:ue,options:De,context:re,onAbort(ee){if(!L.get(ee))return;const{onDragAbort:ve}=k.current,ye={id:ee};ve?.(ye),j({type:"onDragAbort",event:ye})},onPending(ee,Ee,ve,ye){if(!L.get(ee))return;const{onDragPending:He}=k.current,je={id:ee,constraint:Ee,initialCoordinates:ve,offset:ye};He?.(je),j({type:"onDragPending",event:je})},onStart(ee){const Ee=T.current;if(Ee==null)return;const ve=L.get(Ee);if(!ve)return;const{onDragStart:ye}=k.current,Ye={activatorEvent:ue,active:{id:Ee,data:ve.data,rect:q}};ze.unstable_batchedUpdates(()=>{ye?.(Ye),$(Me.Initializing),w({type:Z.DragStart,initialCoordinates:ee,active:Ee}),j({type:"onDragStart",event:Ye}),E(_t.current),D(ue)})},onMove(ee){w({type:Z.DragMove,coordinates:ee})},onEnd:$e(Z.DragEnd),onCancel:$e(Z.DragCancel)});_t.current=me;function $e(ee){return async function(){const{active:ve,collisions:ye,over:Ye,scrollAdjustedTranslate:He}=re.current;let je=null;if(ve&&He){const{cancelDrop:Ue}=k.current;je={activatorEvent:ue,active:ve,collisions:ye,delta:He,over:Ye},ee===Z.DragEnd&&typeof Ue=="function"&&await Promise.resolve(Ue(je))&&(ee=Z.DragCancel)}T.current=null,ze.unstable_batchedUpdates(()=>{w({type:ee}),$(Me.Uninitialized),bn(null),E(null),D(null),_t.current=null;const Ue=ee===Z.DragEnd?"onDragEnd":"onDragCancel";if(je){const kt=k.current[Ue];kt?.(je),j({type:Ue,event:je})}})}}},[L]),oo=f.useCallback((oe,le)=>(ce,De)=>{const de=ce.nativeEvent,ue=L.get(De);if(T.current!==null||!ue||de.dndKit||de.defaultPrevented)return;const me={active:ue};oe(ce,le.options,me)===!0&&(de.dndKit={capturedBy:le.sensor},T.current=De,yn(ce,le))},[L,yn]),Sn=ls(g,oo);ms(g),xe(()=>{B&&I===Me.Initializing&&$(Me.Initialized)},[B,I]),f.useEffect(()=>{const{onDragMove:oe}=k.current,{active:le,activatorEvent:ce,collisions:De,over:de}=re.current;if(!le||!ce)return;const ue={active:le,activatorEvent:ce,collisions:De,delta:{x:_e.x,y:_e.y},over:de};ze.unstable_batchedUpdates(()=>{oe?.(ue),j({type:"onDragMove",event:ue})})},[_e.x,_e.y]),f.useEffect(()=>{const{active:oe,activatorEvent:le,collisions:ce,droppableContainers:De,scrollAdjustedTranslate:de}=re.current;if(!oe||T.current==null||!le||!de)return;const{onDragOver:ue}=k.current,me=De.get(xn),$e=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:$e};ze.unstable_batchedUpdates(()=>{bn($e),ue?.(ee),j({type:"onDragOver",event:ee})})},[xn]),xe(()=>{re.current={activatorEvent:R,active:X,activeNode:U,collisionRect:ke,collisions:Ve,droppableRects:N,draggableNodes:L,draggingNode:Oe,draggingNodeRect:Ie,droppableContainers:F,over:Ce,scrollableAncestors:we,scrollAdjustedTranslate:_e},q.current={initial:Ie,translated:ke}},[X,U,Ve,ke,L,Oe,Ie,N,F,Ce,we,_e]),os({...K,delta:V,draggingRect:ke,pointerCoordinates:mn,scrollableAncestors:we,scrollableAncestorRects:ot});const so=f.useMemo(()=>({active:X,activeNode:U,activeNodeRect:B,activatorEvent:R,collisions:Ve,containerNodeRect:se,dragOverlay:be,draggableNodes:L,droppableContainers:F,droppableRects:N,over:Ce,measureDroppableContainers:W,scrollableAncestors:we,scrollableAncestorRects:ot,measuringConfiguration:_,measuringScheduled:G,windowRect:It}),[X,U,B,R,Ve,se,be,L,F,N,Ce,W,we,ot,_,G,It]),io=f.useMemo(()=>({activatorEvent:R,activators:Sn,active:X,activeNodeRect:B,ariaDescribedById:{draggable:P},dispatch:w,draggableNodes:L,over:Ce,measureDroppableContainers:W}),[R,Sn,X,B,w,P,L,Ce,W]);return f.createElement(ar.Provider,{value:M},f.createElement(jt.Provider,{value:io},f.createElement(yr.Provider,{value:so},f.createElement(Sr.Provider,{value:ro},d)),f.createElement(Ms,{disabled:l?.restoreFocus===!1})),f.createElement(jo,{...l,hiddenTextDescribedById:P}));function ao(){const oe=C?.autoScrollEnabled===!1,le=typeof u=="object"?u.enabled===!1:u===!1,ce=O&&!oe&&!le;return typeof u=="object"?{...u,enabled:ce}:{enabled:ce}}}),Is=f.createContext(null),zn="button",_s="Draggable";function ks(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=rt(_s),{activators:a,activatorEvent:l,active:u,activeNodeRect:d,ariaDescribedById:g,draggableNodes:h,over:p}=f.useContext(jt),{role:m=zn,roleDescription:v="draggable",tabIndex:x=0}=o??{},S=u?.id===t,w=f.useContext(S?Sr:Is),[j,M]=xt(),[I,$]=xt(),O=vs(a,t),A=Qe(n);xe(()=>(h.set(t,{id:t,key:s,node:j,activatorNode:I,data:A}),()=>{const V=h.get(t);V&&V.key===s&&h.delete(t)}),[h,t]);const L=f.useMemo(()=>({role:m,tabIndex:x,"aria-disabled":r,"aria-pressed":S&&m===zn?!0:void 0,"aria-roledescription":v,"aria-describedby":g.draggable}),[r,m,x,S,v,g.draggable]);return{active:u,activatorEvent:l,activeNodeRect:d,attributes:L,isDragging:S,listeners:r?void 0:O,node:j,over:p,setNodeRef:M,setActivatorNodeRef:$,transform:w}}function $s(){return f.useContext(yr)}const As="Droppable",zs={timeout:25};function Ls(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=rt(As),{active:a,dispatch:l,over:u,measureDroppableContainers:d}=f.useContext(jt),g=f.useRef({disabled:n}),h=f.useRef(!1),p=f.useRef(null),m=f.useRef(null),{disabled:v,updateMeasurementsFor:x,timeout:S}={...zs,...o},w=Qe(x??r),j=f.useCallback(()=>{if(!h.current){h.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{d(Array.isArray(w.current)?w.current:[w.current]),m.current=null},S)},[S]),M=Et({callback:j,disabled:v||!a}),I=f.useCallback((L,V)=>{M&&(V&&(M.unobserve(V),h.current=!1),L&&M.observe(L))},[M]),[$,O]=xt(I),A=Qe(t);return f.useEffect(()=>{!M||!$.current||(M.disconnect(),h.current=!1,M.observe($.current))},[$,M]),f.useEffect(()=>(l({type:Z.RegisterDroppable,element:{id:r,key:s,disabled:n,node:$,rect:p,data:A}}),()=>l({type:Z.UnregisterDroppable,key:s,id:r})),[r]),f.useEffect(()=>{n!==g.current.disabled&&(l({type:Z.SetDroppableDisabled,id:r,key:s,disabled:n}),g.current.disabled=n)},[r,s,n,l]),{active:a,rect:p,isOver:u?.id===r,node:$,over:u,setNodeRef:O}}function Mt(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Ps(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function at(e){return e!==null&&e>=0}function Ns(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 Fs(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const lt={scaleX:1,scaleY:1},Ws=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:s,index:a}=e;const l=(t=n[o])!=null?t:r;if(!l)return null;const u=Bs(n,a,o);if(a===o){const d=n[s];return d?{x:o<s?d.left+d.width-(l.left+l.width):d.left-l.left,y:0,...lt}:null}return a>o&&a<=s?{x:-l.width-u,y:0,...lt}:a<o&&a>=s?{x:l.width+u,y:0,...lt}:{x:0,y:0,...lt}};function Bs(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 Cr=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const s=Mt(t,r,n),a=t[o],l=s[o];return!l||!a?null:{x:l.left-a.left,y:l.top-a.top,scaleX:l.width/a.width,scaleY:l.height/a.height}},ct={scaleX:1,scaleY:1},Vs=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:s,overIndex:a}=e;const l=(t=s[n])!=null?t:r;if(!l)return null;if(o===n){const d=s[a];return d?{x:0,y:n<a?d.top+d.height-(l.top+l.height):d.top-l.top,...ct}:null}const u=Ys(s,o,n);return o>n&&o<=a?{x:0,y:-l.height-u,...ct}:o<n&&o>=a?{x:0,y:l.height+u,...ct}:{x:0,y:0,...ct}};function Ys(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 Dr="Sortable",Er=f.createContext({activeIndex:-1,containerId:Dr,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Cr,disabled:{draggable:!1,droppable:!1}});function jr(e){let{children:t,id:n,items:r,strategy:o=Cr,disabled:s=!1}=e;const{active:a,dragOverlay:l,droppableRects:u,over:d,measureDroppableContainers:g}=$s(),h=rt(Dr,n),p=l.rect!==null,m=f.useMemo(()=>r.map(O=>typeof O=="object"&&"id"in O?O.id:O),[r]),v=a!=null,x=a?m.indexOf(a.id):-1,S=d?m.indexOf(d.id):-1,w=f.useRef(m),j=!Ns(m,w.current),M=S!==-1&&x===-1||j,I=Fs(s);xe(()=>{j&&v&&g(m)},[j,m,v,g]),f.useEffect(()=>{w.current=m},[m]);const $=f.useMemo(()=>({activeIndex:x,containerId:h,disabled:I,disableTransforms:M,items:m,overIndex:S,useDragOverlay:p,sortedRects:Ps(m,u),strategy:o}),[x,h,I.draggable,I.droppable,M,m,S,u,p,o]);return f.createElement(Er.Provider,{value:$},t)}const Hs=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Mt(n,r,o).indexOf(t)},Us=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:s,newIndex:a,previousItems:l,previousContainerId:u,transition:d}=e;return!d||!r||l!==s&&o===a?!1:n?!0:a!==o&&t===u},Gs={duration:200,easing:"ease"},Mr="transform",qs=Pe.Transition.toString({property:Mr,duration:0,easing:"linear"}),Xs={roleDescription:"sortable"};function Ks(e){let{disabled:t,index:n,node:r,rect:o}=e;const[s,a]=f.useState(null),l=f.useRef(n);return xe(()=>{if(!t&&n!==l.current&&r.current){const u=o.current;if(u){const d=We(r.current,{ignoreTransform:!0}),g={x:u.left-d.left,y:u.top-d.top,scaleX:u.width/d.width,scaleY:u.height/d.height};(g.x||g.y)&&a(g)}}n!==l.current&&(l.current=n)},[t,n,r,o]),f.useEffect(()=>{s&&a(null)},[s]),s}function Rr(e){let{animateLayoutChanges:t=Us,attributes:n,disabled:r,data:o,getNewIndex:s=Hs,id:a,strategy:l,resizeObserverConfig:u,transition:d=Gs}=e;const{items:g,containerId:h,activeIndex:p,disabled:m,disableTransforms:v,sortedRects:x,overIndex:S,useDragOverlay:w,strategy:j}=f.useContext(Er),M=Js(r,m),I=g.indexOf(a),$=f.useMemo(()=>({sortable:{containerId:h,index:I,items:g},...o}),[h,o,I,g]),O=f.useMemo(()=>g.slice(g.indexOf(a)),[g,a]),{rect:A,node:L,isOver:V,setNodeRef:F}=Ls({id:a,data:$,disabled:M.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...u}}),{active:z,activatorEvent:q,activeNodeRect:X,attributes:T,setNodeRef:C,listeners:E,isDragging:R,over:D,setActivatorNodeRef:k,transform:P}=ks({id:a,data:$,attributes:{...Xs,...n},disabled:M.draggable}),b=ho(F,C),_=!!z,N=_&&!v&&at(p)&&at(S),W=!w&&R,G=W&&N?P:null,Y=N?G??(l??j)({rects:x,activeNodeRect:X,activeIndex:p,overIndex:S,index:I}):null,K=at(p)&&at(S)?s({id:a,items:g,activeIndex:p,overIndex:S}):I,J=z?.id,B=f.useRef({activeId:J,items:g,newIndex:K,containerId:h}),se=g!==B.current.items,re=t({active:z,containerId:h,isDragging:R,isSorting:_,id:a,index:I,items:g,newIndex:B.current.newIndex,previousItems:B.current.items,previousContainerId:B.current.containerId,transition:d,wasDragging:B.current.activeId!=null}),ge=Ks({disabled:!re,index:I,node:L,rect:A});return f.useEffect(()=>{_&&B.current.newIndex!==K&&(B.current.newIndex=K),h!==B.current.containerId&&(B.current.containerId=h),g!==B.current.items&&(B.current.items=g)},[_,K,h,g]),f.useEffect(()=>{if(J===B.current.activeId)return;if(J!=null&&B.current.activeId==null){B.current.activeId=J;return}const Oe=setTimeout(()=>{B.current.activeId=J},50);return()=>clearTimeout(Oe)},[J]),{active:z,activeIndex:p,attributes:T,data:$,rect:A,index:I,newIndex:K,items:g,isOver:V,isSorting:_,isDragging:R,listeners:E,node:L,overIndex:S,over:D,setNodeRef:b,setActivatorNodeRef:k,setDroppableNodeRef:F,setDraggableNodeRef:C,transform:ge??Y,transition:be()};function be(){if(ge||se&&B.current.newIndex===I)return qs;if(!(W&&!an(q)||!d)&&(_||re))return Pe.Transition.toString({...d,property:Mr})}}function Js(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}}H.Down,H.Right,H.Up,H.Left;var ut={exports:{}},Pt={},dt={exports:{}},Nt={};var Ln;function Zs(){if(Ln)return Nt;Ln=1;var e=f;function t(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,a=e.useDebugValue;function l(h,p){var m=p(),v=r({inst:{value:m,getSnapshot:p}}),x=v[0].inst,S=v[1];return s(function(){x.value=m,x.getSnapshot=p,u(x)&&S({inst:x})},[h,m,p]),o(function(){return u(x)&&S({inst:x}),h(function(){u(x)&&S({inst:x})})},[h]),a(m),m}function u(h){var p=h.getSnapshot;h=h.value;try{var m=p();return!n(h,m)}catch{return!0}}function d(h,p){return p()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:l;return Nt.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,Nt}var Ft={};var Pn;function Qs(){return Pn||(Pn=1,process.env.NODE_ENV!=="production"&&(function(){function e(m,v){return m===v&&(m!==0||1/m===1/v)||m!==m&&v!==v}function t(m,v){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=v();if(!h){var S=v();s(x,S)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),h=!0)}S=a({inst:{value:x,getSnapshot:v}});var w=S[0].inst,j=S[1];return u(function(){w.value=x,w.getSnapshot=v,n(w)&&j({inst:w})},[m,x,v]),l(function(){return n(w)&&j({inst:w}),m(function(){n(w)&&j({inst:w})})},[m]),d(x),x}function n(m){var v=m.getSnapshot;m=m.value;try{var x=v();return!s(m,x)}catch{return!0}}function r(m,v){return v()}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,a=o.useState,l=o.useEffect,u=o.useLayoutEffect,d=o.useDebugValue,g=!1,h=!1,p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;Ft.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:p,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Ft}var Nn;function Tr(){return Nn||(Nn=1,process.env.NODE_ENV==="production"?dt.exports=Zs():dt.exports=Qs()),dt.exports}var Fn;function ei(){if(Fn)return Pt;Fn=1;var e=f,t=Tr();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,a=e.useEffect,l=e.useMemo,u=e.useDebugValue;return Pt.useSyncExternalStoreWithSelector=function(d,g,h,p,m){var v=s(null);if(v.current===null){var x={hasValue:!1,value:null};v.current=x}else x=v.current;v=l(function(){function w(O){if(!j){if(j=!0,M=O,O=p(O),m!==void 0&&x.hasValue){var A=x.value;if(m(A,O))return I=A}return I=O}if(A=I,r(M,O))return A;var L=p(O);return m!==void 0&&m(A,L)?(M=O,A):(M=O,I=L)}var j=!1,M,I,$=h===void 0?null:h;return[function(){return w(g())},$===null?void 0:function(){return w($())}]},[g,h,p,m]);var S=o(d,v[0],v[1]);return a(function(){x.hasValue=!0,x.value=S},[S]),u(S),S},Pt}var Wt={};var Wn;function ti(){return Wn||(Wn=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=Tr(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,a=t.useEffect,l=t.useMemo,u=t.useDebugValue;Wt.useSyncExternalStoreWithSelector=function(d,g,h,p,m){var v=s(null);if(v.current===null){var x={hasValue:!1,value:null};v.current=x}else x=v.current;v=l(function(){function w(O){if(!j){if(j=!0,M=O,O=p(O),m!==void 0&&x.hasValue){var A=x.value;if(m(A,O))return I=A}return I=O}if(A=I,r(M,O))return A;var L=p(O);return m!==void 0&&m(A,L)?(M=O,A):(M=O,I=L)}var j=!1,M,I,$=h===void 0?null:h;return[function(){return w(g())},$===null?void 0:function(){return w($())}]},[g,h,p,m]);var S=o(d,v[0],v[1]);return a(function(){x.hasValue=!0,x.value=S},[S]),u(S),S},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Wt}var Bn;function ni(){return Bn||(Bn=1,process.env.NODE_ENV==="production"?ut.exports=ei():ut.exports=ti()),ut.exports}var ri=ni();const Jt=new WeakMap,oi=new WeakMap,wt={current:[]};let Bt=!1;const ft=new Set,Vn=new Map;function Or(e){for(const t of e){if(wt.current.includes(t))continue;wt.current.push(t),t.recompute();const n=oi.get(t);if(n)for(const r of n){const o=Jt.get(r);o?.length&&Or(o)}}}function si(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function ii(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function ai(e){if(ft.add(e),!Bt)try{for(Bt=!0;ft.size>0;){const t=Array.from(ft);ft.clear();for(const n of t){const r=Vn.get(n)??n.prevState;n.prevState=r,si(n)}for(const n of t){const r=Jt.get(n);r&&(wt.current.push(n),Or(r))}for(const n of t){const r=Jt.get(n);if(r)for(const o of r)ii(o)}}}finally{Bt=!1,wt.current=[],Vn.clear()}}function li(e){return typeof e=="function"}class ci{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var o,s;this.listeners.add(r);const a=(s=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:s.call(o,r,this);return()=>{this.listeners.delete(r),a?.()}},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):li(t)?this.state=t(this.prevState):this.state=t,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),ai(this)}}function Be(e,t=r=>r,n={}){const r=n.equal??ui;return ri.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,r)}function ui(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=Yn(e);if(n.length!==Yn(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 Yn(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}function Ae(e,t,n){let r=n.initialDeps??[],o,s=!0;function a(){var l,u,d;let g;n.key&&((l=n.debug)!=null&&l.call(n))&&(g=Date.now());const h=e();if(!(h.length!==r.length||h.some((v,x)=>r[x]!==v)))return o;r=h;let m;if(n.key&&((u=n.debug)!=null&&u.call(n))&&(m=Date.now()),o=t(...h),n.key&&((d=n.debug)!=null&&d.call(n))){const v=Math.round((Date.now()-g)*100)/100,x=Math.round((Date.now()-m)*100)/100,S=x/16,w=(j,M)=>{for(j=String(j);j.length<M;)j=" "+j;return j};console.info(`%c⏱ ${w(x,5)} /${w(v,5)} ms`,`
11
11
  font-size: .6rem;
12
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 Hn(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const ui=(e,t)=>Math.abs(e-t)<1.01,di=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}},Un=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},fi=e=>e,hi=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},gi=(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(Un(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(Un(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},Gn={passive:!0},qn=typeof window>"u"?!0:"onscrollend"in window,pi=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let o=0;const s=e.options.useScrollendEvent&&qn?()=>{}:di(r,()=>{t(o,!1)},e.options.isScrollingResetDelay),i=g=>()=>{const{horizontal:h,isRtl:p}=e.options;o=h?n.scrollLeft*(p&&-1||1):n.scrollTop,s(),t(o,g)},a=i(!0),c=i(!1);n.addEventListener("scroll",a,Gn);const d=e.options.useScrollendEvent&&qn;return d&&n.addEventListener("scrollend",c,Gn),()=>{n.removeEventListener("scroll",a),d&&n.removeEventListener("scrollend",c)}},mi=(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"]},vi=(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 xi{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:fi,rangeExtractor:hi,onChange:()=>{},measureElement:mi,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 p of this.laneAssignments.keys())p>=n&&this.laneAssignments.delete(p);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(p=>{this.itemSizeCache.set(p.key,p.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 p=0;p<d;p++){const m=g[p];m&&(h[m.lane]=p)}for(let p=d;p<n;p++){const m=s(p),v=this.laneAssignments.get(p);let x,y;if(v!==void 0&&this.options.lanes>1){x=v;const _=h[x],A=_!==void 0?g[_]:void 0;y=A?A.end+this.options.gap:r+o}else{const _=this.options.lanes===1?g[p-1]:this.getFurthestMeasurement(g,p);y=_?_.end+this.options.gap:r+o,x=_?_.lane:p%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(p,x)}const S=c.get(m),j=typeof S=="number"?S:this.options.estimateSize(p),M=y+j;g[p]={index:p,start:y,size:j,end:M,key:m,lane:x},h[x]=p}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?bi({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 Hn(r[Or(0,r.length-1,o=>Hn(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,p]=g;this._scrollToOffset(h,{adjustments:void 0,behavior:o}),this.targetWindow.requestAnimationFrame(()=>{const m=()=>{if(this.currentScrollToIndex!==n)return;const v=this.getScrollOffset(),x=this.getOffsetForIndex(n,p);if(!x){console.warn("Failed to get offset for index:",n);return}ui(x[0],v)||c(p)};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 Or=(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 bi({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=Or(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 Kn=typeof document<"u"?Ze.useLayoutEffect:Ze.useEffect;function yi({useFlushSync:e=!0,...t}){const n=Ze.useReducer(()=>({}),{})[1],r={...t,onChange:(s,i)=>{var a;e&&i?ze.flushSync(n):n(),(a=t.onChange)==null||a.call(t,s,i)}},[o]=Ze.useState(()=>new xi(r));return o.setOptions(r),Kn(()=>o._didMount(),[]),Kn(()=>o._willUpdate()),o}function Si(e){return yi({observeElementRect:gi,observeElementOffset:pi,scrollToFn:vi,...e})}const Se="__actions__",he="__visibility__",ne=new li({tableId:"",sortColumn:null,sortDirection:null,visibility:{},columnOrder:[],columnWidths:{},data:[],sortableColumns:[],enableColumnVisibility:!0}),Rt=e=>`datatable:${e}:column-widths`;function _r(e,t,n=!0){const r=e[0]??{},o=180,i=(t&&t.length?t:Object.keys(r).map(v=>({id:v,label:v}))).filter(v=>v.id===Se||Object.prototype.hasOwnProperty.call(r,v.id)),{tableId:a}=ne.state,c=JSON.parse(localStorage.getItem(kr(a))||"[]");let d=[...c.map(v=>i.find(x=>x.id===v)).filter(Boolean),...i.filter(v=>!c.includes(v.id))];n?d.some(x=>x.id===he)||(d=[...d,{type:"visibility",id:he,label:"",minWidth:20}]):d=d.filter(v=>v.id!==he);const g=JSON.parse(localStorage.getItem(Zt(a))||"{}"),h={};if(n){for(const v of d)v.id===he||v.id===Se?h[v.id]=!0:h[v.id]=g[v.id]??!0;localStorage.setItem(Zt(a),JSON.stringify(h))}const p=JSON.parse(localStorage.getItem(Rt(a))||"{}"),m={...p};d.forEach(v=>{v.id!==he&&v.id!==Se&&!(v.id in p)&&(m[v.id]=typeof v.minWidth=="number"?v.minWidth:o)}),ne.setState(v=>({...v,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!==Se,minWidth:x.minWidth}))}))}function Ir(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(Rt(n.tableId),JSON.stringify(o)),{...n,columnWidths:o}})}const kr=e=>`table_column_order_v1:${e}`,Zt=e=>`table_column_visibility_v1:${e}`,Ci=e=>{const{tableId:t}=ne.state;localStorage.setItem(kr(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(Zt(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(Rt(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()),Xn=e=>{const t=Ri(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ar=(...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:Ar("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:Ar(`lucide-${Mi(Xn(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Xn(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 Ai=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],$i=ae("bookmark",Ai);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"}]],Pi=ae("chevron-left",Li);const Ni=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Fi=ae("chevron-right",Ni);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"}]],zr=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"}]],Lr=ae("triangle-alert",ea);const ta=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Pr=ae("x",ta);function w(e){return f.forwardRef((t,n)=>{const{children:r,...o}=t;return l.jsx(e,{ref:n,...o,children:r})})}const na=w(u.Menu.Trigger),ra=w(u.Menu.Positioner),oa=w(u.Menu.Content),sa=w(u.Menu.Item),ia=w(u.Checkbox.Label),aa=w(u.Checkbox.HiddenInput),la=w(u.Checkbox.Control);function ca({visibility:e}){const{sortableColumns:t}=Be(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}=Be(ne),c=e===Se,d=a[e],p=`${c?30:d??100}px`,m=f.useRef(0),v=f.useRef(0),{setNodeRef:x,attributes:y,listeners:S,transform:j,transition:M}=Mr({id:e}),_=$=>{if(c)return;$.stopPropagation(),m.current=$.clientX;const L=$.currentTarget.closest("th");v.current=L?.getBoundingClientRect().width||a[e]||180;const V=z=>{let q=v.current+(z.clientX-m.current);ji(e,q)},F=()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",F)};document.addEventListener("mousemove",V),document.addEventListener("mouseup",F)},[A,O]=f.useState(!1);return l.jsx(u.Table.ColumnHeader,{ref:x,onClick:n,backgroundColor:s,width:p,minWidth:c?"30px":i||"20px",maxWidth:c?"30px":void 0,px:2,py:1,h:"32px",style:{transform:Pe.Transform.toString(j),transition:M,cursor:r,borderRight:c?"none":o,boxSizing:"border-box"},bg:"gray.100",...y,children:l.jsxs(u.HStack,{position:"relative",width:"100%",gap:1,children:[!c&&l.jsx("span",{...S,style:{display:"flex",alignItems:"center"},children:l.jsx(zr,{size:12,style:{cursor:"grab",color:"#a0aebc"}})}),l.jsx(u.Box,{flex:"1",overflow:"hidden",display:"flex",justifyContent:c?"center":"flex-start",children:t}),!c&&l.jsx(u.Box,{position:"absolute",right:-2,top:0,h:"100%",w:"10px",cursor:"col-resize",onMouseDown:_,onMouseEnter:()=>O(!0),onMouseLeave:()=>O(!1),display:"flex",alignItems:"center",justifyContent:"center",zIndex:2,children:A&&l.jsx(ki,{size:14,style:{pointerEvents:"none",opacity:.8}})})]})})}function da(){const{columnOrder:e,visibility:t,enableColumnVisibility:n,sortColumn:r,sortDirection:o}=Be(ne),s=e.filter(i=>!n&&i.id===he?!1:i.id===he||i.id===Se?!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,{children:s.map(i=>{if(i.id===he)return l.jsx(u.Table.ColumnHeader,{bg:"gray.100",w:"40px",px:1,py:1,h:"32px",children:l.jsx(ca,{visibility:t})},i.id);const a=i.type!=="actions"&&i.type!=="visibility",c=r===i.id;return i.id,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:4,userSelect:"none",fontSize:"12px",whiteSpace:"nowrap"},children:[i.label,a&&(c?o==="asc"?" ▲":" ▼":l.jsx("span",{style:{opacity:.4},children:" ⇅"}))]})},i.id)})})})}const fa=[10,20,50,100],ha=w(u.Select.Positioner),ga=w(u.Select.Content),pa=w(u.Select.Item),ma=w(u.Pagination.PrevTrigger),va=w(u.Pagination.NextTrigger),xa=w(u.Select.HiddenSelect),ba=w(u.Select.Control),ya=w(u.Select.Trigger),Sa=w(u.Select.ValueText),wa=w(u.Select.IndicatorGroup),Ca=w(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",_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)],color:"gray.600",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",_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(Pi,{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}=Be(ne);return l.jsx(u.Table.Row,{"data-index":s,onClick:c=>{(o==="left"||o==="both")&&r?.(e,c)},cursor:r?"pointer":"default",h:`${i}px`,_hover:{bg:"gray.50"},onContextMenu:c=>{(o==="right"||o==="both")&&(c.preventDefault(),r?.(e,c))},children:t.map(c=>c.id!==Se&&n[c.id]===!1?null:l.jsx(u.Table.Cell,{py:0,height:`${i}px`,width:`${a[c.id]??20}px`,minWidth:c.minWidth??"20px",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,onRowSelect:n,onRowSelectEvent:r="left",rowHeight:o}){const{visibility:s}=Be(ne);return l.jsx(u.Table.Body,{children:e.map((i,a)=>l.jsx(ja,{index:a,row:i,columns:t,visibility:s,onRowSelect:n,onRowSelectEvent:r,height:o},i.id))})}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:p=0,pageSizeOptions:m,onRowSelect:v,onRowSelectEvent:x="left",enableColumnVisibility:y=!0,dataType:S="pagination",manualPagination:j=!1}){const M=f.useRef(null);f.useEffect(()=>{Ir(e)},[e]),f.useEffect(()=>{_r(t,n,y)},[t,n,y]);const{sortColumn:_,sortDirection:A,data:O,columnOrder:$}=Be(ne),L=f.useMemo(()=>$.length?$:n,[$,n]),V=f.useMemo(()=>{if(!_||!A)return O;const D=L.find(k=>k.id===_);return Ta(O,D,A)},[O,_,A,L]),F=(Math.max(1,a)-1)*c,z=f.useMemo(()=>S==="infinite"||j||p>V.length||a>1&&V.length>0&&V.length<=c?V:V.slice(F,F+c),[V,F,c,S,a,p,j]),K=h==="sm"?45:h==="md"?56:64;Si({count:z.length,getScrollElement:()=>M.current,estimateSize:()=>K,overscan:25});const T=D=>{const{active:k,over:P}=D;if(!P||k.id===P.id)return;const b=L.findIndex(N=>N.id===k.id),I=L.findIndex(N=>N.id===P.id);Ci(Mt(L,b,I))},C=r&&!s,E=s&&!r,R=!r&&!s&&z.length===0;return l.jsx(Sr,{collisionDetection:ar,onDragEnd:T,children:l.jsx(Er,{items:L.map(D=>D.id),strategy:Fs,children:l.jsxs(u.Box,{flex:"1",minH:0,display:"flex",flexDirection:"column",p:2,background:"white",borderRadius:"sm",children:[l.jsxs(u.Box,{ref:M,flex:"1",minH:0,position:"relative",overflowX:"auto",css:{"&::-webkit-scrollbar":{width:"8px",height:"8px"},willChange:"transform"},children:[C&&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,{}),E?l.jsx(Ra,{rows:c,columns:L.length}):R?l.jsx(u.Table.Body,{children:l.jsx(u.Table.Row,{children:l.jsx(u.Table.Cell,{colSpan:L.length,textAlign:"center",h:"200px",color:"gray.500",children:i})})}):l.jsx(Ma,{data:z,columns:L,onRowSelect:v,onRowSelectEvent:x,rowHeight:K})]})]}),S==="pagination"&&l.jsx(u.Box,{mt:.5,bg:"gray.100",color:"gray.600",p:2,children:l.jsx(Da,{totalCount:p,pageSize:c,currentPage:a,onPageChange:D=>{M.current&&(M.current.scrollTop=0),d?.(D)},onPageSizeChange:D=>{g?.(D),a>1&&d?.(1)},pageSizeOptions:m})}),S==="infinite"&&l.jsxs(u.Box,{mt:2,px:2,fontSize:"sm",color:"white",children:["Showing ",z.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 Vt;const Ia=new Uint8Array(16);function ka(){if(!Vt){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Vt=crypto.getRandomValues.bind(crypto)}return Vt(Ia)}const Aa=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Jn={randomUUID:Aa};function $a(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 Jn.randomUUID&&!e?Jn.randomUUID():$a(e)}const La=w(u.Checkbox.Root),Pa=w(u.Checkbox.HiddenInput),Na=w(u.Checkbox.Control),Fa=w(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(Pa,{}),l.jsx(Na,{disabled:s,required:i,errorText:a,helperText:o}),r&&l.jsx(Fa,{children:r})]}),Wa=w(u.Combobox.Root),Ba=w(u.Combobox.Input),Va=w(u.Combobox.Trigger),Ya=w(u.Combobox.Control),Ha=w(u.Combobox.Content),Ua=w(u.Combobox.Positioner),Ga=w(u.Combobox.Item),qa=w(u.Combobox.ItemText);function Fr({label:e="Select Option",size:t="sm",width:n="200px",items:r=[],itemToString:o=p=>p?.label||"",itemToValue:s=p=>p?.value||"",renderItem:i=p=>p?.label||"",value:a,loading:c,placeholder:d="Search...",onSelect:g,visible:h=!0}){const[p,m]=f.useState(""),v=f.useMemo(()=>[{label:"Option 1",value:"1"},{label:"Option 2",value:"2"},{label:"Option 3",value:"3"}],[]),x=r&&r.length>0?r:v;f.useEffect(()=>{m(a?o(a):"")},[a,o]);const y=f.useMemo(()=>u.createListCollection({items:x,itemToString:o,itemToValue:s}),[x,o,s]);return h?l.jsx(u.Box,{minW:n,children:l.jsxs(Wa,{width:"100%",size:t,collection:y,inputValue:p,onInputValueChange:S=>m(S.inputValue),value:a?[s(a)]:[],onValueChange:S=>{const j=S.value[0],M=x.find(_=>s(_)===j);M&&g?.(M)},children:[e&&l.jsx(u.Text,{fontSize:"xs",fontWeight:"medium",mb:"1",color:"gray.600",children:e}),l.jsxs(Ya,{children:[l.jsx(Ba,{placeholder:d,bg:"white",px:2}),l.jsx(Va,{})]}),l.jsx(u.Portal,{children:l.jsx(Ua,{zIndex:"max",children:l.jsx(Ha,{bg:"white",boxShadow:"md",py:1,borderRadius:"md",minW:"200px",children:c?l.jsxs(u.HStack,{p:"3",justify:"center",children:[l.jsx(u.Spinner,{size:"xs"}),l.jsx(u.Text,{fontSize:"sm",children:"Loading..."})]}):x.length===0?l.jsx(u.Text,{p:"3",fontSize:"sm",color:"gray.500",children:"No results found"}):y.items.map(S=>l.jsx(Ga,{item:S,px:2,py:1.5,_hover:{bg:"blue.50",cursor:"pointer"},children:l.jsx(qa,{children:i(S)})},s(S)))})})})]})}):null}const Ka=w(u.Popover.Root),Xa=w(u.Popover.Content),Ja=w(u.Popover.Arrow),Za=w(u.Popover.Trigger),Qa=w(u.Popover.Positioner),Re=e=>e?new Date(e.getFullYear(),e.getMonth(),e.getDate()):null;function Te(e){if(!e)return"";const t=String(e.getDate()).padStart(2,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=e.getFullYear();return`${t}-${n}-${r}`}function Zn(e){const t=e.split(/\s+to\s+/i),n=t[0],r=t[1],o=a=>{if(!a)return null;const c=a.trim().split("-");if(c.length!==3)return null;const[d,g,h]=c,p=parseInt(d),m=parseInt(g)-1,v=parseInt(h);if(isNaN(p)||isNaN(m)||isNaN(v)||h.length!==4)return null;const x=new Date(v,m,p);return x.getDate()===p&&x.getMonth()===m?x:null},s=o(n),i=o(r);return{start:s,end:i}}function Wr({startDate:e,endDate:t,onChange:n,width:r="100%",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,p]=f.useState(null),[m,v]=f.useState(Re(e)),[x,y]=f.useState(Re(t)),S=(T,C)=>T&&C?`${Te(T)} to ${Te(C)}`:T?`${Te(T)}`:"",[j,M]=f.useState(S(Re(e),Re(t))),_=e?.getTime(),A=t?.getTime();f.useEffect(()=>{const T=Re(e),C=Re(t);v(T),y(C),M(S(T,C)),T&&g(new Date(T.getFullYear(),T.getMonth(),1))},[_,A]);const O=new Date(d.getFullYear(),d.getMonth()+1,0).getDate(),$=new Date(d.getFullYear(),d.getMonth(),1).getDay(),L=()=>g(new Date(d.getFullYear(),d.getMonth()-1,1)),V=()=>g(new Date(d.getFullYear(),d.getMonth()+1,1)),F=T=>{const C=new Date(d.getFullYear(),d.getMonth(),T);if(!m||m&&x){v(C),y(null),n(C,null),M(Te(C));return}if(m&&!x){const E=C<m?C:m,R=C<m?m:C;v(E),y(R),n(E,R),M(`${Te(E)} to ${Te(R)}`),c(!1)}},z=T=>{const C=T.target.value;M(C);const{start:E,end:R}=Zn(C);if(E&&R){const D=E<R?E:R,k=E<R?R:E;v(D),y(k),n(D,k),g(D)}else E&&!C.toLowerCase().includes("to")?(v(E),y(null),n(E,null)):C.trim()||(v(null),y(null),n(null,null))},q=T=>{if(T.key!=="Enter")return;const{start:C,end:E}=Zn(j);if(C&&!E&&!j.toLowerCase().includes("to")){const R=`${Te(C)} to `;M(R),v(C),y(null),n(C,null),requestAnimationFrame(()=>{T.target.setSelectionRange(R.length,R.length)});return}if(C&&E){const R=C<E?C:E,D=C<E?E:C;v(R),y(D),n(R,D),c(!1)}},K=T=>{T&&(T.preventDefault(),T.stopPropagation()),v(null),y(null),M(""),n(null,null)};return l.jsxs(u.Box,{width:r,onKeyDown:q,children:[o&&!i&&l.jsx(u.Text,{fontSize:"xs",color:"fg.muted",mb:1,fontWeight:"medium",children:s}),l.jsxs(Ka,{open:a,onOpenChange:T=>c(T.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:j,onChange:z,size:"sm",autoComplete:"off"}),j&&l.jsx(u.IconButton,{size:"xs",variant:"ghost","aria-label":"Clear date",type:"button",onClick:K,position:"absolute",right:"32px",top:"50%",transform:"translateY(-50%)",zIndex:2,children:l.jsx(Pr,{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",type:"button",onClick:L,"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",type:"button",onClick:V,"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((T,C)=>l.jsx(u.Text,{fontSize:"xs",fontWeight:"bold",color:"fg.subtle",py:1,children:T},`${T}-${C}`)),Array($).fill(null).map((T,C)=>l.jsx(u.Box,{},`empty-${C}`)),Array.from({length:O},(T,C)=>{const E=C+1,R=new Date(d.getFullYear(),d.getMonth(),E);let D=m,k=x;const P=Re(h);if(P){if(D&&!k)P<D?(k=D,D=P):k=P;else if(D&&k){const Y=D.getTime()+(k.getTime()-D.getTime())/2;P.getTime()<=Y?D=P:k=P,D>k&&([D,k]=[k,D])}}const b=D&&R.getTime()===D.getTime(),I=k&&R.getTime()===k.getTime(),N=D&&k&&R>D&&R<k;let W="gray",G="ghost";(b||I)&&(G="solid",W="blue");let U="md";return N&&(U="0"),b&&k&&(U=I?"md":"md 0 0 md"),I&&D&&(U=b?"md":"0 md md 0"),l.jsx(u.Button,{size:"xs",variant:G,colorPalette:W,onClick:()=>F(E),onMouseEnter:()=>p(R),onMouseLeave:()=>p(null),minW:"32px",h:"32px",fontSize:"xs",borderRadius:U,_hover:{bg:b||I?void 0:"gray.100"},children:E},E)})]}),l.jsx(u.Text,{fontSize:"10px",color:"fg.muted",mt:3,textAlign:"center",children:"Select Start Date then End Date"})]})})]})]})}const el=w(u.Popover.Root),tl=w(u.Popover.Content),nl=w(u.Popover.Arrow),rl=w(u.Popover.Trigger),ol=w(u.Popover.Positioner);function Qn(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 Br({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(Qn(e));f.useEffect(()=>{g(Qn(e))},[e]);const h=new Date(a.getFullYear(),a.getMonth()+1,0).getDate(),p=new Date(a.getFullYear(),a.getMonth(),1).getDay(),m=()=>{c(new Date(a.getFullYear(),a.getMonth()-1,1))},v=()=>{c(new Date(a.getFullYear(),a.getMonth()+1,1))},x=j=>{const M=new Date(a.getFullYear(),a.getMonth(),j);t(M),i(!1)},y=j=>{if(s)switch(j.key){case"ArrowLeft":m();break;case"ArrowRight":v();break;case"Escape":i(!1);break}},S=()=>{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:j=>i(j.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:S,position:"absolute",right:"32px",top:"50%",transform:"translateY(-50%)",zIndex:1,children:l.jsx(Pr,{size:14})}),l.jsx(u.Input,{placeholder:"DD-MM-YYYY",value:d,onChange:j=>{const M=j.target.value;g(M);const _=sl(M);_&&(t(_),c(_))},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:v,"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((j,M)=>l.jsx(u.Text,{fontSize:"xs",fontWeight:"bold",color:"fg.subtle",py:1,children:j},`${j}-${M}`)),Array(p).fill(null).map((j,M)=>l.jsx(u.Box,{},`empty-${M}`)),Array.from({length:h},(j,M)=>{const _=M+1,A=e&&e.getDate()===_&&e.getMonth()===a.getMonth()&&e.getFullYear()===a.getFullYear();return l.jsx(u.Button,{size:"xs",variant:A?"solid":"ghost",colorPalette:A?"blue":"gray",onClick:()=>x(_),minW:"32px",h:"32px",fontSize:"xs",borderRadius:"md",children:_},_)})]}),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=w(u.Field.Root);w(u.Field.Label);const al=w(u.Field.HelperText),ll=w(u.Field.ErrorText),Qt=({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:p,type:m="text",min:v=0,max:x=100,step:y=1})=>l.jsxs(il,{width:i,children:[l.jsx(u.InputGroup,{startElement:e,children:l.jsx(u.Input,{value:t,onChange:S=>n?.(S.target.value),placeholder:r,size:o,type:m,variant:s,disabled:d,required:g,min:v,max:x,step:y})}),h&&l.jsx(ll,{fontSize:"xs",children:h}),c&&l.jsx(al,{fontSize:"xs",children:c})]}),cl=w(u.Field.Root),ul=w(u.Field.HelperText),dl=w(u.Field.ErrorText),fl=w(u.Select.Root),hl=w(u.Select.Label),gl=w(u.Select.Control),pl=w(u.Select.Trigger),ml=w(u.Select.ValueText),vl=w(u.Select.IndicatorGroup),xl=w(u.Select.Indicator),bl=w(u.Select.Content),yl=w(u.Select.Item),Sl=w(u.Select.ItemIndicator),wl=w(u.Select.HiddenSelect),Cl=w(u.Select.Positioner),Vr=({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:p})=>{const m=f.useMemo(()=>u.createListCollection({items:e}),[e]),v=e.find(y=>y.value===n),x=y=>{y.preventDefault(),y.stopPropagation(),r?.(void 0)};return l.jsxs(cl,{disabled:d,required:g,children:[l.jsxs(fl,{collection:m,variant:a,size:s,width:i,value:n?[n]:[],onValueChange:y=>{r?.(y.value[0])},children:[l.jsx(wl,{}),p&&l.jsx(hl,{children:t}),l.jsxs(gl,{children:[l.jsx(pl,{children:l.jsx(ml,{placeholder:o,children:v?v.displayValue??v.label:""})}),l.jsxs(vl,{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(xl,{})]})]}),l.jsx(Cl,{children:l.jsx(bl,{children:m.items.map((y,S)=>l.jsxs(yl,{item:y,children:[y.label,l.jsx(Sl,{})]},S))})})]}),c&&l.jsx(ul,{children:c}),h&&l.jsx(dl,{children:h})]})},Dl="FILTER_PRESETS_",Yr=e=>`${Dl}${e}`,Tt=e=>{if(typeof window>"u")return[];const t=localStorage.getItem(Yr(e));try{return t?JSON.parse(t):[]}catch(n){return console.error("Failed to parse presets",n),[]}},fn=(e,t)=>{typeof window>"u"||(localStorage.setItem(Yr(e),JSON.stringify(t)),window.dispatchEvent(new Event("storage_updated")))},Hr=(e,t)=>{const n=Tt(e);fn(e,[t,...n])},Ur=(e,t)=>{const n=Tt(e).filter(r=>r.id!==t);fn(e,n)},El=w(u.Checkbox.Root),jl=w(u.Checkbox.HiddenInput),Ml=w(u.Checkbox.Control),Rl=w(u.Slider.Root),Tl=w(u.Slider.Track),Ol=w(u.Slider.Range),_l=w(u.Slider.Thumbs),Il=w(u.Slider.Control),kl=({filter:e,onVisibilityChange:t,onSizeChange:n})=>{const{attributes:r,listeners:o,setNodeRef:s,transform:i,transition:a}=Mr({id:e.id}),c={transform:Pe.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(zr,{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(El,{checked:e.visible,size:"sm",onCheckedChange:d=>t?.(e.id,!!d.checked),children:[l.jsx(jl,{}),l.jsx(Ml,{})]})]}),l.jsxs(u.VStack,{align:"stretch",gap:1,children:[l.jsx(u.Text,{fontSize:"sm",children:"Size"}),l.jsx(Rl,{min:1,max:5,step:.5,value:[e.size??1],onValueChange:d=>n?.(e.id,d.value[0]),children:l.jsxs(Il,{children:[l.jsx(Tl,{children:l.jsx(Ol,{})}),l.jsx(_l,{})]})})]})]})},Al=w(u.Drawer.Root),$l=w(u.Drawer.Trigger),zl=w(u.Drawer.Backdrop),Ll=w(u.Drawer.Positioner),Pl=w(u.Drawer.Content),Nl=w(u.Drawer.Header),Fl=w(u.Drawer.Title),Wl=w(u.Drawer.Body),Bl=w(u.Drawer.Footer),Vl=w(u.Drawer.CloseTrigger),Yl=w(u.Tabs.Root),Hl=w(u.Tabs.List),Yt=w(u.Tabs.Trigger),Ht=w(u.Tabs.Content),Gr=(e,t)=>{if(e.customComponent)return e.customComponent;switch(e.type){case"text":return l.jsx(Qt,{placeholder:e.label,value:e.value,onChange:e.onChange,label:e.label,visible:t});case"number":return l.jsx(Qt,{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(Vr,{label:e.label,value:e.value,onChange:e.onChange,options:e.options??[],visible:t,placeholder:e.placeholder});case"date":return l.jsx(Br,{value:e.value,onChange:e.onChange,visible:t,label:e.label});case"date-range":const n=e.value,r=n?.startDate||e.startDate,o=n?.endDate||e.endDate;return l.jsx(Wr,{startDate:r?new Date(r):void 0,endDate:o?new Date(o):void 0,onChange:(s,i)=>{e.onChange&&e.onChange({startDate:s,endDate:i})},visible:t,label:e.label});case"combobox":return l.jsx(Fr,{label:e.label,value:e.value,items:e.options||[],itemToString:s=>s?.label||"",itemToValue:s=>s?.value||"",onSelect:s=>{e.onChange?.(s)},renderItem:s=>l.jsx(u.Text,{fontSize:"sm",children:s.label}),placeholder:e.placeholder||"Search...",visible:t});default:return null}},Ul=({filterDrawerSize:e="sm",onVisibilityChange:t,onSizeChange:n,onClear:r,filters:o,pageKey:s="default",onLoadPreset:i,activePresetName:a,onReorder:c,open:d,onOpenChange:g,maxToolbarUnits:h})=>{const[p,m]=f.useState([]);f.useEffect(()=>{const S=()=>{m(Tt(s))};return S(),window.addEventListener("storage",S),window.addEventListener("storage_updated",S),()=>{window.removeEventListener("storage",S),window.removeEventListener("storage_updated",S)}},[s]);const v=()=>{const S=prompt("Preset name?");if(!S)return;const j=o.reduce((M,_)=>(M[_.id]=_.value,M),{});Hr(s,{id:za(),name:S,date:new Date().toISOString(),values:j})},x=(S,j)=>{if(j&&h!==void 0){const M=o.filter(O=>O.visible).reduce((O,$)=>O+($.size??1),0),A=o.find(O=>O.id===S)?.size??1;if(M+A>h){alert(`Limit reached! You can only use up to ${h} toolbar units. Please disable another filter first.`);return}}t?.(S,j)},y=(S,j)=>{h!==void 0&&o.find(_=>_.id===S)?.visible&&o.filter(A=>A.visible&&A.id!==S).reduce((A,O)=>A+(O.size??1),0)+j>h||n?.(S,j)};return l.jsx(u.HStack,{wrap:"wrap",children:l.jsxs(Al,{size:e,open:d,onOpenChange:g,children:[l.jsx($l,{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(zl,{}),l.jsx(Ll,{children:l.jsxs(Pl,{children:[l.jsx(Nl,{children:l.jsx(Fl,{children:"Filters"})}),l.jsx(Wl,{overflowY:"auto",pt:1,children:l.jsxs(Yl,{defaultValue:"view",children:[l.jsxs(Hl,{mb:4,children:[l.jsxs(Yt,{value:"view",children:[l.jsx(Gi,{size:16}),"Edit"]}),l.jsxs(Yt,{value:"settings",children:[l.jsx(Ji,{size:16}),"Settings"]}),l.jsxs(Yt,{value:"presets",children:[l.jsx($i,{size:16}),"Presets"]})]}),l.jsx(Ht,{value:"view",children:o.map(S=>l.jsx(u.VStack,{align:"stretch",border:"1px solid",borderColor:"gray.200",flex:S.size??1,minW:`${(S.size??1)*100}px`,rounded:"md",p:3,mb:3,children:Gr(S,d)},S.id))}),l.jsx(Ht,{value:"settings",children:l.jsx(Sr,{sensors:Mo(jo(dn)),collisionDetection:ar,onDragEnd:({active:S,over:j})=>{if(!j||S.id===j.id)return;const M=o.findIndex(O=>O.id===S.id),_=o.findIndex(O=>O.id===j.id),A=Mt(o,M,_);c?.(A)},children:l.jsx(Er,{items:o.map(S=>S.id),strategy:Bs,children:o.map(S=>l.jsx(kl,{filter:S,onVisibilityChange:x,onSizeChange:y},S.id))})})}),l.jsx(Ht,{value:"presets",children:l.jsxs(u.VStack,{align:"stretch",mb:3,children:[p.length===0&&l.jsx(u.Text,{fontSize:"xs",color:"gray.500",children:"No presets saved yet."}),p.map(S=>l.jsxs(u.HStack,{justify:"space-between",border:"1px solid",borderColor:a===S.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:S.name}),l.jsx(u.Text,{fontSize:"xs",color:"gray.500",children:new Date(S.date).toLocaleDateString()})]}),l.jsxs(u.HStack,{children:[l.jsx(u.Button,{size:"xs",variant:"ghost",onClick:()=>{const j=o.map(M=>({...M,value:S.values[M.id]??M.value}));i?.(j,S.name)},children:"Load"}),l.jsx(u.IconButton,{size:"xs","aria-label":"Delete preset",variant:"ghost",onClick:()=>Ur(s,S.id),children:l.jsx(Bi,{size:14})})]})]},S.id)),l.jsx(u.Button,{size:"sm",colorScheme:"blue",onClick:v,children:"Save Current Filters"})]})})]})}),l.jsx(Bl,{justify:"space-between",children:l.jsx(Vl,{asChild:!0,children:l.jsx(u.CloseButton,{})})})]})})]})]})})},Gl=({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,p]=f.useState(!1);let m=0;return l.jsxs(u.HStack,{wrap:"wrap",pl:2,pr:2,width:"100%",justify:"space-between",alignItems:"center",children:[e,l.jsxs(u.HStack,{gapX:1,align:"center",children:[t.filter(v=>v.visible!==!1).map(v=>{const x=v.size??1,y=i!==void 0&&m+x>i;return y||(m+=x),l.jsx(u.HStack,{flex:x,minW:`${x*100}px`,opacity:y?.4:1,pointerEvents:y?"none":"auto",cursor:y?"not-allowed":"auto",children:Gr(v)},v.id)}),l.jsx(Ul,{filterDrawerSize:g,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:i,pageKey:a,filters:t,onLoadPreset:c,activePresetName:d,open:h,onOpenChange:v=>{p(v.open)}})]})]})},ql=(e,t)=>{localStorage.setItem(`FILTER_ORDER_${e}`,JSON.stringify(t))},Kl=e=>{try{return JSON.parse(localStorage.getItem(`FILTER_ORDER_${e}`)||"[]")}catch{return[]}},Xl=({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:p="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:p,border:m,children:l.jsxs(u.HStack,{gap:1,children:[o,r,s]})}),Jl=w(u.Dialog.Root),Zl=w(u.Dialog.Backdrop),Ql=w(u.Dialog.Positioner),ec=w(u.Dialog.Content),tc=w(u.Dialog.Header),nc=w(u.Dialog.Body),rc=w(u.Dialog.Footer),oc=w(u.Dialog.Title),sc=w(u.Dialog.CloseTrigger);function ic({open:e,onClose:t,onConfirm:n,title:r="Confirm Action",description:o="Are you sure you want to continue?",confirmLabel:s="Confirm",cancelLabel:i="Cancel",icon:a,isLoading:c=!1,confirmButtonColorScheme:d="#4169e1"}){return l.jsx(Jl,{open:e,placement:"center",onOpenChange:g=>!g.open&&t(),children:l.jsxs(u.Portal,{children:[l.jsx(Zl,{}),l.jsx(Ql,{children:l.jsxs(ec,{maxW:"480px",children:[l.jsx(tc,{borderBottom:"1px solid",borderColor:"gray.200",children:l.jsx(oc,{children:r})}),l.jsx(nc,{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(Lr,{size:40})}),l.jsx(u.Text,{fontSize:"sm",color:"gray.600",children:o})]})}),l.jsxs(rc,{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(sc,{asChild:!0,children:l.jsx(u.CloseButton,{size:"sm"})})]})})]})})}const ac=w(u.Dialog.Root),lc=w(u.Dialog.Backdrop),cc=w(u.Dialog.Positioner),uc=w(u.Dialog.Content),dc=w(u.Dialog.Header),fc=w(u.Dialog.Body),hc=w(u.Dialog.Footer),gc=w(u.Dialog.Title),pc=w(u.Dialog.CloseTrigger);function mc({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(ac,{open:e,placement:"center",onOpenChange:h=>{!h.open&&t(),d("")},children:l.jsxs(u.Portal,{children:[l.jsx(lc,{}),l.jsx(cc,{children:l.jsxs(uc,{maxW:"550px",children:[l.jsx(dc,{borderBottom:"1px solid",borderColor:"#d3d3d3",children:l.jsx(gc,{color:"red.600",children:r})}),l.jsx(fc,{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(Lr,{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(hc,{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(pc,{asChild:!0,children:l.jsx(u.CloseButton,{size:"sm"})})]})})]})})}const qr=({children:e})=>l.jsx(l.Fragment,{children:e}),Kr=({children:e})=>l.jsx(l.Fragment,{children:e}),vc=u.Button,xc=w(u.Dialog.Root),bc=w(u.Dialog.Backdrop),yc=w(u.Dialog.Positioner),Sc=w(u.Dialog.Content),wc=w(u.Dialog.Header),Cc=w(u.Dialog.Body),Dc=w(u.Dialog.Footer),Ec=w(u.Dialog.Title),jc=w(u.Dialog.CloseTrigger);function Mc(e){let t=null,n=null;return f.Children.forEach(e,r=>{f.isValidElement(r)&&(r.type===qr&&(t=r.props.children),r.type===Kr&&(n=r.props.children))}),{body:t,actions:n}}const Rc=({open:e,onClose:t,title:n,children:r,width:o,position:s,refetch:i,loading:a=!1})=>{const{body:c,actions:d}=Mc(r);return l.jsx(xc,{open:e,onOpenChange:g=>!g.open&&t(),placement:s??"center",children:l.jsxs(u.Portal,{children:[l.jsx(bc,{bg:"blackAlpha.400"}),l.jsx(yc,{children:l.jsxs(Sc,{w:o??"560px",maxW:o??"560px",borderRadius:"6px",overflow:"hidden",boxShadow:"lg",children:[l.jsx(wc,{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(Ec,{fontSize:"16px",fontWeight:"600",children:n}),l.jsx(jc,{asChild:!0,children:l.jsx(u.CloseButton,{size:"sm"})}),i&&l.jsx(hn,{label:"Refresh",refetch:i,isLoading:a})]})}),c&&l.jsx(Cc,{px:"20px",py:"16px",bg:"#F8FAFC",type:"submit",children:l.jsx(u.Flex,{direction:"column",gap:"16px",children:c})}),d&&l.jsx(Dc,{px:"20px",py:"16px",bg:"white",borderTop:"1px solid",borderColor:"gray.200",children:l.jsx(u.Flex,{ml:"auto",gap:"12px",children:d})})]})})]})})},Tc=w(u.Field.Root),Oc=w(u.Field.Label),_c=w(u.Field.HelperText),Ic=w(u.Field.ErrorText),kc=w(u.PinInput.Input),Ac=w(u.PinInput.Control),$c=w(u.PinInput.HiddenInput),zc=w(u.PinInput.Root),Lc=({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,p)=>e?.[p]??"");return l.jsxs(Tc,{children:[d&&s&&l.jsxs(Oc,{children:[s,c&&" *"]}),l.jsxs(zc,{value:g,onValueChange:h=>t?.(h.value.join("")),disabled:o,size:r,children:[l.jsx($c,{}),l.jsx(Ac,{children:l.jsx(u.HStack,{children:Array.from({length:n}).map((h,p)=>l.jsx(kc,{index:p},p))})})]}),a&&l.jsx(Ic,{fontSize:"xs",children:a}),i&&!a&&l.jsx(_c,{fontSize:"xs",children:i})]})};function hn({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 gt={exports:{}},Pc=gt.exports,er;function Nc(){return er||(er=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",p="quarter",m="year",v="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+)?$/,S=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,j={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(T){var C=["th","st","nd","rd"],E=T%100;return"["+T+(C[(E-20)%10]||C[E]||C[0])+"]"}},M=function(T,C,E){var R=String(T);return!R||R.length>=C?T:""+Array(C+1-R.length).join(E)+T},_={s:M,z:function(T){var C=-T.utcOffset(),E=Math.abs(C),R=Math.floor(E/60),D=E%60;return(C<=0?"+":"-")+M(R,2,"0")+":"+M(D,2,"0")},m:function T(C,E){if(C.date()<E.date())return-T(E,C);var R=12*(E.year()-C.year())+(E.month()-C.month()),D=C.clone().add(R,h),k=E-D<0,P=C.clone().add(R+(k?-1:1),h);return+(-(R+(E-D)/(k?D-P:P-D))||0)},a:function(T){return T<0?Math.ceil(T)||0:Math.floor(T)},p:function(T){return{M:h,y:m,w:g,d,D:v,h:c,m:a,s:i,ms:s,Q:p}[T]||String(T||"").toLowerCase().replace(/s$/,"")},u:function(T){return T===void 0}},A="en",O={};O[A]=j;var $="$isDayjsObject",L=function(T){return T instanceof q||!(!T||!T[$])},V=function T(C,E,R){var D;if(!C)return A;if(typeof C=="string"){var k=C.toLowerCase();O[k]&&(D=k),E&&(O[k]=E,D=k);var P=C.split("-");if(!D&&P.length>1)return T(P[0])}else{var b=C.name;O[b]=C,D=b}return!R&&D&&(A=D),D||!R&&A},F=function(T,C){if(L(T))return T.clone();var E=typeof C=="object"?C:{};return E.date=T,E.args=arguments,new q(E)},z=_;z.l=V,z.i=L,z.w=function(T,C){return F(T,{locale:C.$L,utc:C.$u,x:C.$x,$offset:C.$offset})};var q=(function(){function T(E){this.$L=V(E.locale,null,!0),this.parse(E),this.$x=this.$x||E.x||{},this[$]=!0}var C=T.prototype;return C.parse=function(E){this.$d=(function(R){var D=R.date,k=R.utc;if(D===null)return new Date(NaN);if(z.u(D))return new Date;if(D instanceof Date)return new Date(D);if(typeof D=="string"&&!/Z$/i.test(D)){var P=D.match(y);if(P){var b=P[2]-1||0,I=(P[7]||"0").substring(0,3);return k?new Date(Date.UTC(P[1],b,P[3]||1,P[4]||0,P[5]||0,P[6]||0,I)):new Date(P[1],b,P[3]||1,P[4]||0,P[5]||0,P[6]||0,I)}}return new Date(D)})(E),this.init()},C.init=function(){var E=this.$d;this.$y=E.getFullYear(),this.$M=E.getMonth(),this.$D=E.getDate(),this.$W=E.getDay(),this.$H=E.getHours(),this.$m=E.getMinutes(),this.$s=E.getSeconds(),this.$ms=E.getMilliseconds()},C.$utils=function(){return z},C.isValid=function(){return this.$d.toString()!==x},C.isSame=function(E,R){var D=F(E);return this.startOf(R)<=D&&D<=this.endOf(R)},C.isAfter=function(E,R){return F(E)<this.startOf(R)},C.isBefore=function(E,R){return this.endOf(R)<F(E)},C.$g=function(E,R,D){return z.u(E)?this[R]:this.set(D,E)},C.unix=function(){return Math.floor(this.valueOf()/1e3)},C.valueOf=function(){return this.$d.getTime()},C.startOf=function(E,R){var D=this,k=!!z.u(R)||R,P=z.p(E),b=function(J,B){var se=z.w(D.$u?Date.UTC(D.$y,B,J):new Date(D.$y,B,J),D);return k?se:se.endOf(d)},I=function(J,B){return z.w(D.toDate()[J].apply(D.toDate("s"),(k?[0,0,0,0]:[23,59,59,999]).slice(B)),D)},N=this.$W,W=this.$M,G=this.$D,U="set"+(this.$u?"UTC":"");switch(P){case m:return k?b(1,0):b(31,11);case h:return k?b(1,W):b(0,W+1);case g:var Y=this.$locale().weekStart||0,X=(N<Y?N+7:N)-Y;return b(k?G-X:G+(6-X),W);case d:case v:return I(U+"Hours",0);case c:return I(U+"Minutes",1);case a:return I(U+"Seconds",2);case i:return I(U+"Milliseconds",3);default:return this.clone()}},C.endOf=function(E){return this.startOf(E,!1)},C.$set=function(E,R){var D,k=z.p(E),P="set"+(this.$u?"UTC":""),b=(D={},D[d]=P+"Date",D[v]=P+"Date",D[h]=P+"Month",D[m]=P+"FullYear",D[c]=P+"Hours",D[a]=P+"Minutes",D[i]=P+"Seconds",D[s]=P+"Milliseconds",D)[k],I=k===d?this.$D+(R-this.$W):R;if(k===h||k===m){var N=this.clone().set(v,1);N.$d[b](I),N.init(),this.$d=N.set(v,Math.min(this.$D,N.daysInMonth())).$d}else b&&this.$d[b](I);return this.init(),this},C.set=function(E,R){return this.clone().$set(E,R)},C.get=function(E){return this[z.p(E)]()},C.add=function(E,R){var D,k=this;E=Number(E);var P=z.p(R),b=function(W){var G=F(k);return z.w(G.date(G.date()+Math.round(W*E)),k)};if(P===h)return this.set(h,this.$M+E);if(P===m)return this.set(m,this.$y+E);if(P===d)return b(1);if(P===g)return b(7);var I=(D={},D[a]=r,D[c]=o,D[i]=n,D)[P]||1,N=this.$d.getTime()+E*I;return z.w(N,this)},C.subtract=function(E,R){return this.add(-1*E,R)},C.format=function(E){var R=this,D=this.$locale();if(!this.isValid())return D.invalidDate||x;var k=E||"YYYY-MM-DDTHH:mm:ssZ",P=z.z(this),b=this.$H,I=this.$m,N=this.$M,W=D.weekdays,G=D.months,U=D.meridiem,Y=function(B,se,re,ge){return B&&(B[se]||B(R,k))||re[se].slice(0,ge)},X=function(B){return z.s(b%12||12,B,"0")},J=U||function(B,se,re){var ge=B<12?"AM":"PM";return re?ge.toLowerCase():ge};return k.replace(S,(function(B,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 Y(D.monthsShort,N,G,3);case"MMMM":return Y(G,N);case"D":return R.$D;case"DD":return z.s(R.$D,2,"0");case"d":return String(R.$W);case"dd":return Y(D.weekdaysMin,R.$W,W,2);case"ddd":return Y(D.weekdaysShort,R.$W,W,3);case"dddd":return W[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,I,!0);case"A":return J(b,I,!1);case"m":return String(I);case"mm":return z.s(I,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})(B)||P.replace(":","")}))},C.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},C.diff=function(E,R,D){var k,P=this,b=z.p(R),I=F(E),N=(I.utcOffset()-this.utcOffset())*r,W=this-I,G=function(){return z.m(P,I)};switch(b){case m:k=G()/12;break;case h:k=G();break;case p:k=G()/3;break;case g:k=(W-N)/6048e5;break;case d:k=(W-N)/864e5;break;case c:k=W/o;break;case a:k=W/r;break;case i:k=W/n;break;default:k=W}return D?k:z.a(k)},C.daysInMonth=function(){return this.endOf(h).$D},C.$locale=function(){return O[this.$L]},C.locale=function(E,R){if(!E)return this.$L;var D=this.clone(),k=V(E,R,!0);return k&&(D.$L=k),D},C.clone=function(){return z.w(this.$d,this)},C.toDate=function(){return new Date(this.valueOf())},C.toJSON=function(){return this.isValid()?this.toISOString():null},C.toISOString=function(){return this.$d.toISOString()},C.toString=function(){return this.$d.toUTCString()},T})(),K=q.prototype;return F.prototype=K,[["$ms",s],["$s",i],["$m",a],["$H",c],["$W",d],["$M",h],["$y",m],["$D",v]].forEach((function(T){K[T[1]]=function(C){return this.$g(C,T[0],T[1])}})),F.extend=function(T,C){return T.$i||(T(C,q,F),T.$i=!0),F},F.locale=V,F.isDayjs=L,F.unix=function(T){return F(1e3*T)},F.en=O[A],F.Ls=O,F.p={},F}))})(gt)),gt.exports}var Fc=Nc();const Ot=Ct(Fc);var pt={exports:{}},Wc=pt.exports,tr;function Bc(){return tr||(tr=1,(function(e,t){(function(n,r){e.exports=r()})(Wc,(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,p){return s.fromToBase(d,g,h,p)}o.en.relativeTime=i,s.fromToBase=function(d,g,h,p,m){for(var v,x,y,S=h.$locale().relativeTime||i,j=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=j.length,_=0;_<M;_+=1){var A=j[_];A.d&&(v=p?o(d).diff(h,A.d,!0):h.diff(d,A.d,!0));var O=(n.rounding||Math.round)(Math.abs(v));if(y=v>0,O<=A.r||!A.r){O<=1&&_>0&&(A=j[_-1]);var $=S[A.l];m&&(O=m(""+O)),x=typeof $=="string"?$.replace("%d",O):$(O,g,A.l,y);break}}if(g)return x;var L=y?S.future:S.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)}}}))})(pt)),pt.exports}var Vc=Bc();const Yc=Ct(Vc);var mt={exports:{}},Hc=mt.exports,nr;function Uc(){return nr||(nr=1,(function(e,t){(function(n,r){e.exports=r()})(Hc,(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,p){return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(m,v,x){var y=x&&x.toUpperCase();return v||p[x]||n[x]||p[y].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(S,j,M){return j||M.slice(1)}))}))})(c,d===void 0?{}:d);return a.call(this,g)}}}))})(mt)),mt.exports}var Gc=Uc();const qc=Ct(Gc);var vt={exports:{}},Kc=vt.exports,rr;function Xc(){return rr||(rr=1,(function(e,t){(function(n,r){e.exports=r()})(Kc,(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)}}}))})(vt)),vt.exports}var Jc=Xc();const Zc=Ct(Jc);Ot.extend(Yc);Ot.extend(qc);Ot.extend(Zc);const Qc={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 en({value:e,variant:t="dateTime",format:n,fallback:r="--"}){if(!e)return r;const o=Ot(e);return o.isValid()?t==="relative"?o.fromNow():o.format(n??Qc[t]):r}function eu({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:p=!0}){return l.jsxs(u.Stack,{gap:.5,align:s,children:[l.jsx(u.Text,{fontSize:a,fontWeight:c,color:i,children:en({value:e,variant:t,format:r})}),p&&l.jsx(u.Text,{fontSize:g,fontWeight:h,color:d,children:en({value:e,variant:n,format:o})})]})}class Xr{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 tn{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 nn{constructor(t){this.api=t}store=new Xr;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 Jr=f.createContext(null);function Zr(){const e=f.useContext(Jr);if(!e)throw new Error("OptionsProvider is missing. Wrap your app with <OptionsProvider />");return e}function tu({client:{apiUrl:e},children:t}){const n=f.useRef(new nn(new tn(e)));return n.current||(n.current=new nn(new tn(e))),l.jsx(Jr.Provider,{value:n.current,children:t})}function nu(e){const t=Zr(),[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 ru(e){const t=Zr(),[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 ou(e,t){return e.getKey(t)}async function su(e,t){await e.getMultiKey(t)}function iu(e={}){const{initialPage:t=1,initialLimit:n=20}=e,[r,o]=f.useState(t),[s,i]=f.useState(n),a=f.useCallback(p=>{o(Math.max(1,p))},[]),c=f.useCallback(p=>{i(Math.max(1,p)),o(1)},[]),d=f.useCallback(()=>{o(p=>p+1)},[]),g=f.useCallback(()=>{o(p=>Math.max(1,p-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 au(e={}){const{initialValue:t="",delay:n=300,len:r=3}=e,[o,s]=f.useState(t),a=o.length===0||o.length>=r?o:"",c=lu(a,n),d=f.useCallback(h=>{s(h)},[]),g=f.useCallback(()=>{s(t)},[t]);return{search:o,debouncedSearch:c,onSearchChange:d,reset:g,len:r}}function lu(e,t=300){const[n,r]=f.useState(e);return f.useEffect(()=>{const o=setTimeout(()=>{r(e)},t);return()=>clearTimeout(o)},[e,t]),n}const cu=w(u.Tooltip.Root),uu=w(u.Tooltip.Trigger),du=w(u.Tooltip.Positioner),fu=w(u.Tooltip.Content),hu=w(u.Tooltip.Arrow),gu=w(u.Tooltip.ArrowTip),pu=Ze.forwardRef(function(t,n){const{showArrow:r=!0,children:o,disabled:s,portalled:i=!0,content:a,contentProps:c,...d}=t;return s?l.jsx(l.Fragment,{children:o}):l.jsxs(cu,{...d,children:[l.jsx(uu,{asChild:!0,children:o}),l.jsx(u.Portal,{disabled:!i,children:l.jsx(du,{children:l.jsxs(fu,{ref:n,...c,children:[r&&l.jsx(hu,{children:l.jsx(gu,{})}),a]})})})]})});exports.ACTIONS_COLUMN_ID=Se;exports.DataTable=Oa;exports.Filters=Gl;exports.HttpOptionsApi=tn;exports.MDSButton=Xl;exports.MDSCheckbox=Nr;exports.MDSCombobox=Fr;exports.MDSConfirmActionDialog=ic;exports.MDSConfirmDeleteDialog=mc;exports.MDSDatePicker=Br;exports.MDSDateRangePicker=Wr;exports.MDSDialogAction=vc;exports.MDSDialogActions=Kr;exports.MDSDialogBody=qr;exports.MDSDialogWrapper=Rc;exports.MDSInput=Qt;exports.MDSPinInput=Lc;exports.MDSRefreshButton=hn;exports.MDSSelectBox=Vr;exports.MDSTooltip=pu;exports.OptionsClientImpl=nn;exports.OptionsProvider=tu;exports.OptionsStore=Xr;exports.RefreshButton=hn;exports.StackedDateTime=eu;exports.VISIBILITY_COLUMN_ID=he;exports.addPreset=Hr;exports.deletePreset=Ur;exports.formatDateTime=en;exports.getColumnWidthKey=Rt;exports.getOption=ou;exports.getPresets=Tt;exports.loadOrder=Kl;exports.prefetchOptions=su;exports.saveOrder=ql;exports.savePresets=fn;exports.setColumnWidth=wi;exports.setData=_r;exports.setTableId=Ir;exports.tableStore=ne;exports.useDebouncedSearch=au;exports.useOption=nu;exports.useOptions=ru;exports.usePagination=iu;exports.withChildren=w;
13
+ color: hsl(${Math.max(0,Math.min(120-120*S,120))}deg 100% 31%);`,n?.key)}return n?.onChange&&!(s&&n.skipInitialOnChange)&&n.onChange(o),s=!1,o}return a.updateDeps=l=>{r=l},a}function Hn(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const di=(e,t)=>Math.abs(e-t)<1.01,fi=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}},Un=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},hi=e=>e,gi=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},pi=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const o=a=>{const{width:l,height:u}=a;t({width:Math.round(l),height:Math.round(u)})};if(o(Un(n)),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(a=>{const l=()=>{const u=a[0];if(u?.borderBoxSize){const d=u.borderBoxSize[0];if(d){o({width:d.inlineSize,height:d.blockSize});return}}o(Un(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},Gn={passive:!0},qn=typeof window>"u"?!0:"onscrollend"in window,mi=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let o=0;const s=e.options.useScrollendEvent&&qn?()=>{}:fi(r,()=>{t(o,!1)},e.options.isScrollingResetDelay),a=g=>()=>{const{horizontal:h,isRtl:p}=e.options;o=h?n.scrollLeft*(p&&-1||1):n.scrollTop,s(),t(o,g)},l=a(!0),u=a(!1);n.addEventListener("scroll",l,Gn);const d=e.options.useScrollendEvent&&qn;return d&&n.addEventListener("scrollend",u,Gn),()=>{n.removeEventListener("scroll",l),d&&n.removeEventListener("scrollend",u)}},vi=(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"]},xi=(e,{adjustments:t=0,behavior:n},r)=>{var o,s;const a=e+t;(s=(o=r.scrollElement)==null?void 0:o.scrollTo)==null||s.call(o,{[r.options.horizontal?"left":"top"]:a,behavior:n})};class bi{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 a=()=>{this._measureElement(s.target,s)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));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:hi,rangeExtractor:gi,onChange:()=>{},measureElement:vi,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=Ae(()=>(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 a=r-1;a>=0;a--){const l=n[a];if(o.has(l.lane))continue;const u=s.get(l.lane);if(u==null||l.end>u.end?s.set(l.lane,l):l.end<u.end&&o.set(l.lane,!0),o.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((a,l)=>a.end===l.end?a.index-l.index:a.end-l.end)[0]:void 0},this.getMeasurementOptions=Ae(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(n,r,o,s,a,l)=>(this.prevLanes!==void 0&&this.prevLanes!==l&&(this.lanesChangedFlag=!0),this.prevLanes=l,this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:a,lanes:l}),{key:!1}),this.getMeasurements=Ae(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:a,lanes:l},u)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const p of this.laneAssignments.keys())p>=n&&this.laneAssignments.delete(p);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(p=>{this.itemSizeCache.set(p.key,p.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(l).fill(void 0);for(let p=0;p<d;p++){const m=g[p];m&&(h[m.lane]=p)}for(let p=d;p<n;p++){const m=s(p),v=this.laneAssignments.get(p);let x,S;if(v!==void 0&&this.options.lanes>1){x=v;const I=h[x],$=I!==void 0?g[I]:void 0;S=$?$.end+this.options.gap:r+o}else{const I=this.options.lanes===1?g[p-1]:this.getFurthestMeasurement(g,p);S=I?I.end+this.options.gap:r+o,x=I?I.lane:p%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(p,x)}const w=u.get(m),j=typeof w=="number"?w:this.options.estimateSize(p),M=S+j;g[p]={index:p,start:S,size:j,end:M,key:m,lane:x},h[x]=p}return this.measurementsCache=g,g},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=Ae(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,o,s)=>this.range=n.length>0&&r>0?yi({measurements:n,outerSize:r,scrollOffset:o,lanes:s}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=Ae(()=>{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,a)=>s===null||a===null?[]:n({startIndex:s,endIndex:a,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 a=s.key,l=this.elementsCache.get(a);l!==n&&(l&&this.observer.unobserve(l),this.observer.observe(n),this.elementsCache.set(a,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,a=r-s;a!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,a,this):o.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",a),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,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=Ae(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const o=[];for(let s=0,a=n.length;s<a;s++){const l=n[s],u=r[l];o.push(u)}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 Hn(r[Ir(0,r.length-1,o=>Hn(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(),a=this.getScrollOffset();r==="auto"&&(r=n>=a+s?"end":"start"),r==="center"?n+=(o-s)/2:r==="end"&&(n-=s);const l=this.getMaxScrollOffset();return Math.max(Math.min(l,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(),a=this.getScrollOffset();if(r==="auto")if(o.end>=a+s-this.options.scrollPaddingEnd)r="end";else if(o.start<=a+this.options.scrollPaddingStart)r="start";else return[a,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const l=r==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,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 a=10,l=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,p]=g;this._scrollToOffset(h,{adjustments:void 0,behavior:o}),this.targetWindow.requestAnimationFrame(()=>{const m=()=>{if(this.currentScrollToIndex!==n)return;const v=this.getScrollOffset(),x=this.getOffsetForIndex(n,p);if(!x){console.warn("Failed to get offset for index:",n);return}di(x[0],v)||u(p)};this.isDynamicMode()?this.targetWindow.requestAnimationFrame(m):m()})},u=d=>{this.targetWindow&&this.currentScrollToIndex===n&&(s++,s<a?(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("Schedule retry",s,a),this.targetWindow.requestAnimationFrame(()=>l(d))):console.warn(`Failed to scroll to index ${n} after ${a} attempts.`))};l(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 a=r.length-1;for(;a>=0&&s.some(l=>l===null);){const l=r[a];s[l.lane]===null&&(s[l.lane]=l.end),a--}o=Math.max(...s.filter(l=>l!==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 Ir=(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 yi({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){const o=e.length-1,s=u=>e[u].start;if(e.length<=r)return{startIndex:0,endIndex:o};let a=Ir(0,o,s,n),l=a;if(r===1)for(;l<o&&e[l].end<n+t;)l++;else if(r>1){const u=Array(r).fill(0);for(;l<o&&u.some(g=>g<n+t);){const g=e[l];u[g.lane]=g.end,l++}const d=Array(r).fill(n+t);for(;a>=0&&d.some(g=>g>=n);){const g=e[a];d[g.lane]=g.start,a--}a=Math.max(0,a-a%r),l=Math.min(o,l+(r-1-l%r))}return{startIndex:a,endIndex:l}}const Xn=typeof document<"u"?Ze.useLayoutEffect:Ze.useEffect;function Si({useFlushSync:e=!0,...t}){const n=Ze.useReducer(()=>({}),{})[1],r={...t,onChange:(s,a)=>{var l;e&&a?ze.flushSync(n):n(),(l=t.onChange)==null||l.call(t,s,a)}},[o]=Ze.useState(()=>new bi(r));return o.setOptions(r),Xn(()=>o._didMount(),[]),Xn(()=>o._willUpdate()),o}function wi(e){return Si({observeElementRect:pi,observeElementOffset:mi,scrollToFn:xi,...e})}const Se="__actions__",he="__visibility__",ne=new ci({tableId:"",sortColumn:null,sortDirection:null,visibility:{},columnOrder:[],columnWidths:{},data:[],sortableColumns:[],enableColumnVisibility:!0}),Rt=e=>`datatable:${e}:column-widths`;function _r(e,t,n=!0){const r=e[0]??{},o=180,a=(t&&t.length?t:Object.keys(r).map(v=>({id:v,label:v}))).filter(v=>v.id===Se||Object.prototype.hasOwnProperty.call(r,v.id)),{tableId:l}=ne.state,u=JSON.parse(localStorage.getItem($r(l))||"[]");let d=[...u.map(v=>a.find(x=>x.id===v)).filter(Boolean),...a.filter(v=>!u.includes(v.id))];n?d.some(x=>x.id===he)||(d=[...d,{type:"visibility",id:he,label:"",minWidth:20}]):d=d.filter(v=>v.id!==he);const g=JSON.parse(localStorage.getItem(Zt(l))||"{}"),h={};if(n){for(const v of d)v.id===he||v.id===Se?h[v.id]=!0:h[v.id]=g[v.id]??!0;localStorage.setItem(Zt(l),JSON.stringify(h))}const p=JSON.parse(localStorage.getItem(Rt(l))||"{}"),m={...p};d.forEach(v=>{v.id!==he&&v.id!==Se&&!(v.id in p)&&(m[v.id]=typeof v.minWidth=="number"?v.minWidth:o)}),ne.setState(v=>({...v,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!==Se,minWidth:x.minWidth}))}))}function kr(e){ne.setState(t=>({...t,tableId:e,sortColumn:null,sortDirection:"asc"}))}function Ci(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(Rt(n.tableId),JSON.stringify(o)),{...n,columnWidths:o}})}const $r=e=>`table_column_order_v1:${e}`,Zt=e=>`table_column_visibility_v1:${e}`,Di=e=>{const{tableId:t}=ne.state;localStorage.setItem($r(t),JSON.stringify(e.map(n=>n.id))),ne.setState(n=>({...n,columnOrder:e})),ne.setState(n=>({...n,columnOrder:e}))};function Ei(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 ji=e=>{ne.setState(t=>{const n={...t.visibility,[e]:!t.visibility[e]};return t.tableId&&localStorage.setItem(Zt(t.tableId),JSON.stringify(n)),{...t,visibility:n}})};function Mi(e,t){ne.setState(n=>{const r=n.columnOrder.find(a=>a.id===e),o=typeof r?.minWidth=="number"?r.minWidth:120,s={...n.columnWidths,[e]:Math.max(o,t)};return localStorage.setItem(Rt(n.tableId),JSON.stringify(s)),{...n,columnWidths:s}})}const Ri=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ti=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Kn=e=>{const t=Ti(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ar=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),Oi=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var Ii={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:a,...l},u)=>f.createElement("svg",{ref:u,...Ii,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Ar("lucide",o),...!s&&!Oi(l)&&{"aria-hidden":"true"},...l},[...a.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:Ar(`lucide-${Ri(Kn(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Kn(e),n};const ki=[["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"}]],$i=ae("arrow-left-right",ki);const Ai=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],zi=ae("bookmark",Ai);const Li=[["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"}]],zr=ae("calendar",Li);const Pi=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Ni=ae("chevron-left",Pi);const Fi=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Wi=ae("chevron-right",Fi);const Bi=[["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"}]],Vi=ae("delete",Bi);const Yi=[["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"}]],Hi=ae("funnel",Yi);const Ui=[["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"}]],Lr=ae("grip-vertical",Ui);const Gi=[["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"}]],qi=ae("pen",Gi);const Xi=[["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",Xi);const Ji=[["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"}]],Zi=ae("settings",Ji);const Qi=[["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"}]],ea=ae("stretch-horizontal",Qi);const ta=[["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"}]],Pr=ae("triangle-alert",ta);const na=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Nr=ae("x",na);function y(e){return f.forwardRef((t,n)=>{const{children:r,...o}=t;return i.jsx(e,{ref:n,...o,children:r})})}const ra=y(c.Menu.Trigger),oa=y(c.Menu.Positioner),sa=y(c.Menu.Content),ia=y(c.Menu.Item),aa=y(c.Checkbox.Label),la=y(c.Checkbox.HiddenInput),ca=y(c.Checkbox.Control);function ua({visibility:e}){const{sortableColumns:t}=Be(ne);return i.jsxs(c.Menu.Root,{closeOnSelect:!1,children:[i.jsx(ra,{asChild:!0,children:i.jsx(c.IconButton,{"aria-label":"Toggle columns",variant:"ghost",ml:"1",size:"xs",children:i.jsx(ea,{size:18})})}),i.jsx(c.Portal,{children:i.jsx(oa,{children:i.jsx(sa,{minW:"220px",children:t.map(n=>{const r=!!e[n.id];return i.jsx(ia,{value:n.id,closeOnSelect:!1,children:i.jsxs(c.Checkbox.Root,{checked:r,onCheckedChange:()=>ji(n.id),children:[i.jsx(la,{}),i.jsx(ca,{}),i.jsx(aa,{children:n.label})]})},n.id)})})})})]})}function da({id:e,children:t,onClick:n,cursor:r,borderRight:o,backgroundColor:s,minW:a}){const{columnWidths:l}=Be(ne),u=e===Se,d=l[e],p=`${u?30:d??100}px`,m=f.useRef(0),v=f.useRef(0),{setNodeRef:x,attributes:S,listeners:w,transform:j,transition:M}=Rr({id:e}),I=A=>{if(u)return;A.stopPropagation(),m.current=A.clientX;const L=A.currentTarget.closest("th");v.current=L?.getBoundingClientRect().width||l[e]||180;const V=z=>{let q=v.current+(z.clientX-m.current);Mi(e,q)},F=()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",F)};document.addEventListener("mousemove",V),document.addEventListener("mouseup",F)},[$,O]=f.useState(!1);return i.jsx(c.Table.ColumnHeader,{ref:x,onClick:n,backgroundColor:s,width:p,minWidth:u?"30px":a||"20px",maxWidth:u?"30px":void 0,px:2,py:1,h:"32px",style:{transform:Pe.Transform.toString(j),transition:M,cursor:r,borderRight:u?"none":o,boxSizing:"border-box"},bg:"gray.100",...S,children:i.jsxs(c.HStack,{position:"relative",width:"100%",gap:1,children:[!u&&i.jsx("span",{...w,style:{display:"flex",alignItems:"center"},children:i.jsx(Lr,{size:12,style:{cursor:"grab",color:"#a0aebc"}})}),i.jsx(c.Box,{flex:"1",overflow:"hidden",display:"flex",justifyContent:u?"center":"flex-start",children:t}),!u&&i.jsx(c.Box,{position:"absolute",right:-2,top:0,h:"100%",w:"10px",cursor:"col-resize",onMouseDown:I,onMouseEnter:()=>O(!0),onMouseLeave:()=>O(!1),display:"flex",alignItems:"center",justifyContent:"center",zIndex:2,children:$&&i.jsx($i,{size:14,style:{pointerEvents:"none",opacity:.8}})})]})})}function fa(){const{columnOrder:e,visibility:t,enableColumnVisibility:n,sortColumn:r,sortDirection:o}=Be(ne),s=e.filter(a=>!n&&a.id===he?!1:a.id===he||a.id===Se?!0:t[a.id]!==!1).sort((a,l)=>a.id===he?1:l.id===he?-1:0);return i.jsx(c.Table.Header,{position:"sticky",top:0,zIndex:1,css:{contain:"layout style paint",backgroundColor:"white"},children:i.jsx(c.Table.Row,{children:s.map(a=>{if(a.id===he)return i.jsx(c.Table.ColumnHeader,{bg:"gray.100",w:"40px",px:1,py:1,h:"32px",children:i.jsx(ua,{visibility:t})},a.id);const l=a.type!=="actions"&&a.type!=="visibility",u=r===a.id;return a.id,i.jsx(da,{id:a.id,minW:a.minWidth,onClick:l?()=>Ei(a.id):void 0,cursor:l?"pointer":"default",borderRight:"2px solid #dcdcdc",children:i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4,userSelect:"none",fontSize:"12px",whiteSpace:"nowrap"},children:[a.label,l&&(u?o==="asc"?" ▲":" ▼":i.jsx("span",{style:{opacity:.4},children:" ⇅"}))]})},a.id)})})})}const ha=[10,20,50,100],ga=y(c.Select.Positioner),pa=y(c.Select.Content),ma=y(c.Select.Item),va=y(c.Pagination.PrevTrigger),xa=y(c.Pagination.NextTrigger),ba=y(c.Select.HiddenSelect),ya=y(c.Select.Control),Sa=y(c.Select.Trigger),wa=y(c.Select.ValueText),Ca=y(c.Select.IndicatorGroup),Da=y(c.Select.Indicator);function Ea({totalCount:e,pageSize:t,currentPage:n,onPageChange:r,onPageSizeChange:o,siblingCount:s=2,pageSizeOptions:a=ha}){const l=c.createListCollection({items:a.map(u=>({label:String(u),value:String(u)}))});return i.jsx(c.Box,{width:"100%",children:i.jsxs(c.HStack,{justify:"space-between",mx:"auto",flexWrap:"wrap",children:[i.jsxs(c.HStack,{children:[i.jsx(c.Text,{fontSize:"sm",_dark:{color:"gray.400"},children:"Rows per page:"}),i.jsxs(c.Select.Root,{collection:l,size:"sm",width:"60px",onValueChange:u=>o?.(Number(u.items[0].value)),value:[String(t)],color:"gray.600",children:[i.jsx(ba,{}),i.jsxs(ya,{children:[i.jsx(Sa,{children:i.jsx(wa,{placeholder:""})}),i.jsx(Ca,{children:i.jsx(Da,{})})]}),i.jsx(c.Portal,{children:i.jsx(ga,{children:i.jsx(pa,{children:l.items.map(u=>i.jsxs(ma,{item:u.value,children:[u.label,i.jsx(c.Select.ItemIndicator,{})]},u.value))})})})]}),i.jsxs(c.Text,{fontSize:"sm",_dark:{color:"gray.400"},children:["of ",e]})]}),i.jsx(c.Pagination.Root,{count:e,pageSize:t,page:n,siblingCount:s,onPageChange:u=>r&&r(u.page),children:i.jsxs(c.ButtonGroup,{size:"sm",variant:"ghost",children:[i.jsx(va,{asChild:!0,children:i.jsx(c.IconButton,{"aria-label":"Previous page",children:i.jsx(Ni,{size:18})})}),i.jsx(c.Pagination.Items,{render:u=>i.jsx(c.IconButton,{variant:u.type==="page"&&u.value===n?"outline":"ghost","aria-current":u.type==="page"&&u.value===n?"page":void 0,children:u.type==="page"?u.value:"…"},u.value??u.type)}),i.jsx(xa,{asChild:!0,children:i.jsx(c.IconButton,{"aria-label":"Next page",children:i.jsx(Wi,{size:18})})})]})})]})})}function ja({row:e,columns:t,visibility:n,onRowSelect:r,onRowSelectEvent:o,index:s,height:a}){const{columnWidths:l}=Be(ne);return i.jsx(c.Table.Row,{"data-index":s,onClick:u=>{(o==="left"||o==="both")&&r?.(e,u)},cursor:r?"pointer":"default",h:`${a}px`,_hover:{bg:"gray.50"},onContextMenu:u=>{(o==="right"||o==="both")&&(u.preventDefault(),r?.(e,u))},children:t.map(u=>u.id!==Se&&n[u.id]===!1?null:i.jsx(c.Table.Cell,{py:0,height:`${a}px`,width:`${l[u.id]??20}px`,minWidth:u.minWidth??"20px",maxWidth:`${l[u.id]??180}px`,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:"render"in u&&u.render?u.render(e):i.jsx("div",{children:String(e[u.id]??"")})},u.id))})}const Ma=f.memo(ja);function Ra({data:e,columns:t,onRowSelect:n,onRowSelectEvent:r="left",rowHeight:o}){const{visibility:s}=Be(ne);return i.jsx(c.Table.Body,{children:e.map((a,l)=>i.jsx(Ma,{index:l,row:a,columns:t,visibility:s,onRowSelect:n,onRowSelectEvent:r,height:o},a.id))})}function Ta({rows:e=6,columns:t}){return i.jsx(c.Table.Body,{children:Array.from({length:e}).map((n,r)=>i.jsx(c.Table.Row,{children:Array.from({length:t}).map((o,s)=>i.jsx(c.Table.Cell,{children:i.jsx(c.Skeleton,{height:"25px"})},s))},r))})}function Oa(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,a,l)=>{const u=r(s),d=r(a);return u==null&&d==null?0:u==null?1:d==null?-1:typeof u=="number"&&typeof d=="number"?l==="asc"?u-d:d-u:u instanceof Date&&d instanceof Date?l==="asc"?u.getTime()-d.getTime():d.getTime()-u.getTime():l==="asc"?String(u).localeCompare(String(d)):String(d).localeCompare(String(u))};return[...e].sort((s,a)=>o(s,a,n))}function Ia({tableId:e,data:t=[],headers:n=[],loading:r=!1,loadingChildren:o,skeletonLoading:s=!1,emptyMessage:a="No data",page:l=1,pageSize:u=10,onPageChange:d,onPageSizeChange:g,density:h="sm",totalCount:p=0,pageSizeOptions:m,onRowSelect:v,onRowSelectEvent:x="left",enableColumnVisibility:S=!0,dataType:w="pagination",manualPagination:j=!1}){const M=f.useRef(null);f.useEffect(()=>{kr(e)},[e]),f.useEffect(()=>{_r(t,n,S)},[t,n,S]);const{sortColumn:I,sortDirection:$,data:O,columnOrder:A}=Be(ne),L=f.useMemo(()=>A.length?A:n,[A,n]),V=f.useMemo(()=>{if(!I||!$)return O;const D=L.find(k=>k.id===I);return Oa(O,D,$)},[O,I,$,L]),F=(Math.max(1,l)-1)*u,z=f.useMemo(()=>w==="infinite"||j||p>V.length||l>1&&V.length>0&&V.length<=u?V:V.slice(F,F+u),[V,F,u,w,l,p,j]),X=h==="sm"?45:h==="md"?56:64;wi({count:z.length,getScrollElement:()=>M.current,estimateSize:()=>X,overscan:25});const T=D=>{const{active:k,over:P}=D;if(!P||k.id===P.id)return;const b=L.findIndex(N=>N.id===k.id),_=L.findIndex(N=>N.id===P.id);Di(Mt(L,b,_))},C=r&&!s,E=s&&!r,R=!r&&!s&&z.length===0;return i.jsx(wr,{collisionDetection:lr,onDragEnd:T,children:i.jsx(jr,{items:L.map(D=>D.id),strategy:Ws,children:i.jsxs(c.Box,{flex:"1",minH:0,display:"flex",flexDirection:"column",p:2,background:"white",borderRadius:"sm",children:[i.jsxs(c.Box,{ref:M,flex:"1",minH:0,position:"relative",overflowX:"auto",css:{"&::-webkit-scrollbar":{width:"8px",height:"8px"},willChange:"transform"},children:[C&&i.jsx(c.Box,{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,bg:"whiteAlpha.600",children:o??i.jsx(c.Spinner,{})}),i.jsxs(c.Table.Root,{variant:"outline",w:"max-content",minW:"100%",size:h,tableLayout:"fixed",css:{borderCollapse:"collapse","& th, & td":{boxSizing:"border-box"}},children:[i.jsx(fa,{}),E?i.jsx(Ta,{rows:u,columns:L.length}):R?i.jsx(c.Table.Body,{children:i.jsx(c.Table.Row,{children:i.jsx(c.Table.Cell,{colSpan:L.length,textAlign:"center",h:"200px",color:"gray.500",children:a})})}):i.jsx(Ra,{data:z,columns:L,onRowSelect:v,onRowSelectEvent:x,rowHeight:X})]})]}),w==="pagination"&&i.jsx(c.Box,{mt:.5,bg:"gray.100",color:"gray.600",p:2,children:i.jsx(Ea,{totalCount:p,pageSize:u,currentPage:l,onPageChange:D=>{M.current&&(M.current.scrollTop=0),d?.(D)},onPageSizeChange:D=>{g?.(D),l>1&&d?.(1)},pageSizeOptions:m})}),w==="infinite"&&i.jsxs(c.Box,{mt:2,px:2,fontSize:"sm",color:"white",children:["Showing ",z.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 Vt;const ka=new Uint8Array(16);function $a(){if(!Vt){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Vt=crypto.getRandomValues.bind(crypto)}return Vt(ka)}const Aa=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Jn={randomUUID:Aa};function za(e,t,n){e=e||{};const r=e.random??e.rng?.()??$a();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 La(e,t,n){return Jn.randomUUID&&!e?Jn.randomUUID():za(e)}const Pa=y(c.Checkbox.Root),Na=y(c.Checkbox.HiddenInput),Fa=y(c.Checkbox.Control),Wa=y(c.Checkbox.Label),Fr=({value:e,onChange:t,size:n="sm",label:r,helperText:o,isDisabled:s,required:a,errorText:l})=>i.jsxs(Pa,{value:e,onChange:t,size:n,children:[i.jsx(Na,{}),i.jsx(Fa,{disabled:s,required:a,errorText:l,helperText:o}),r&&i.jsx(Wa,{children:r})]}),Ba=y(c.Combobox.Root),Va=y(c.Combobox.Input),Ya=y(c.Combobox.Trigger),Ha=y(c.Combobox.Control),Ua=y(c.Combobox.Content),Ga=y(c.Combobox.Positioner),qa=y(c.Combobox.Item),Xa=y(c.Combobox.ItemText);function Wr({label:e="Select Option",size:t="sm",width:n="200px",items:r=[],itemToString:o=p=>p?.label||"",itemToValue:s=p=>p?.value||"",renderItem:a=p=>p?.label||"",value:l,loading:u,placeholder:d="Search...",onSelect:g,visible:h=!0}){const[p,m]=f.useState(""),v=f.useMemo(()=>[{label:"Option 1",value:"1"},{label:"Option 2",value:"2"},{label:"Option 3",value:"3"}],[]),x=r&&r.length>0?r:v;f.useEffect(()=>{m(l?o(l):"")},[l,o]);const S=f.useMemo(()=>c.createListCollection({items:x,itemToString:o,itemToValue:s}),[x,o,s]);return h?i.jsx(c.Box,{minW:n,children:i.jsxs(Ba,{width:"100%",size:t,collection:S,inputValue:p,onInputValueChange:w=>m(w.inputValue),value:l?[s(l)]:[],onValueChange:w=>{const j=w.value[0],M=x.find(I=>s(I)===j);M&&g?.(M)},children:[e&&i.jsx(c.Text,{fontSize:"xs",fontWeight:"medium",mb:"1",color:"gray.600",children:e}),i.jsxs(Ha,{children:[i.jsx(Va,{placeholder:d,bg:"white",px:2}),i.jsx(Ya,{})]}),i.jsx(c.Portal,{children:i.jsx(Ga,{zIndex:"max",children:i.jsx(Ua,{bg:"white",boxShadow:"md",py:1,borderRadius:"md",minW:"200px",children:u?i.jsxs(c.HStack,{p:"3",justify:"center",children:[i.jsx(c.Spinner,{size:"xs"}),i.jsx(c.Text,{fontSize:"sm",children:"Loading..."})]}):x.length===0?i.jsx(c.Text,{p:"3",fontSize:"sm",color:"gray.500",children:"No results found"}):S.items.map(w=>i.jsx(qa,{item:w,px:2,py:1.5,_hover:{bg:"blue.50",cursor:"pointer"},children:i.jsx(Xa,{children:a(w)})},s(w)))})})})]})}):null}const Ka=y(c.Popover.Root),Ja=y(c.Popover.Content),Za=y(c.Popover.Arrow),Qa=y(c.Popover.Trigger),el=y(c.Popover.Positioner),Re=e=>e?new Date(e.getFullYear(),e.getMonth(),e.getDate()):null;function Te(e){if(!e)return"";const t=String(e.getDate()).padStart(2,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=e.getFullYear();return`${t}-${n}-${r}`}function Zn(e){const t=e.split(/\s+to\s+/i),n=t[0],r=t[1],o=l=>{if(!l)return null;const u=l.trim().split("-");if(u.length!==3)return null;const[d,g,h]=u,p=parseInt(d),m=parseInt(g)-1,v=parseInt(h);if(isNaN(p)||isNaN(m)||isNaN(v)||h.length!==4)return null;const x=new Date(v,m,p);return x.getDate()===p&&x.getMonth()===m?x:null},s=o(n),a=o(r);return{start:s,end:a}}function Br({startDate:e,endDate:t,onChange:n,width:r="100%",showLabel:o=!0,label:s="Select date range",visible:a=!0}){const[l,u]=f.useState(!1),[d,g]=f.useState(e||new Date),[h,p]=f.useState(null),[m,v]=f.useState(Re(e)),[x,S]=f.useState(Re(t)),w=(T,C)=>T&&C?`${Te(T)} to ${Te(C)}`:T?`${Te(T)}`:"",[j,M]=f.useState(w(Re(e),Re(t))),I=e?.getTime(),$=t?.getTime();f.useEffect(()=>{const T=Re(e),C=Re(t);v(T),S(C),M(w(T,C)),T&&g(new Date(T.getFullYear(),T.getMonth(),1))},[I,$]);const O=new Date(d.getFullYear(),d.getMonth()+1,0).getDate(),A=new Date(d.getFullYear(),d.getMonth(),1).getDay(),L=()=>g(new Date(d.getFullYear(),d.getMonth()-1,1)),V=()=>g(new Date(d.getFullYear(),d.getMonth()+1,1)),F=T=>{const C=new Date(d.getFullYear(),d.getMonth(),T);if(!m||m&&x){v(C),S(null),n(C,null),M(Te(C));return}if(m&&!x){const E=C<m?C:m,R=C<m?m:C;v(E),S(R),n(E,R),M(`${Te(E)} to ${Te(R)}`),u(!1)}},z=T=>{const C=T.target.value;M(C);const{start:E,end:R}=Zn(C);if(E&&R){const D=E<R?E:R,k=E<R?R:E;v(D),S(k),n(D,k),g(D)}else E&&!C.toLowerCase().includes("to")?(v(E),S(null),n(E,null)):C.trim()||(v(null),S(null),n(null,null))},q=T=>{if(T.key!=="Enter")return;const{start:C,end:E}=Zn(j);if(C&&!E&&!j.toLowerCase().includes("to")){const R=`${Te(C)} to `;M(R),v(C),S(null),n(C,null),requestAnimationFrame(()=>{T.target.setSelectionRange(R.length,R.length)});return}if(C&&E){const R=C<E?C:E,D=C<E?E:C;v(R),S(D),n(R,D),u(!1)}},X=T=>{T&&(T.preventDefault(),T.stopPropagation()),v(null),S(null),M(""),n(null,null)};return i.jsxs(c.Box,{width:r,onKeyDown:q,children:[o&&!a&&i.jsx(c.Text,{fontSize:"xs",color:"fg.muted",mb:1,fontWeight:"medium",children:s}),i.jsxs(Ka,{open:l,onOpenChange:T=>u(T.open),positioning:{placement:"bottom-start",gutter:4},children:[i.jsxs(c.Group,{attached:!0,w:"full",position:"relative",children:[i.jsx(c.Input,{placeholder:"DD-MM-YYYY to DD-MM-YYYY",value:j,onChange:z,size:"sm",autoComplete:"off"}),j&&i.jsx(c.IconButton,{size:"xs",variant:"ghost","aria-label":"Clear date",type:"button",onClick:X,position:"absolute",right:"32px",top:"50%",transform:"translateY(-50%)",zIndex:2,children:i.jsx(Nr,{size:14})}),i.jsx(Qa,{asChild:!0,children:i.jsx(c.InputAddon,{cursor:"pointer",px:2,_hover:{bg:"gray.100"},transition:"background 0.2s",children:i.jsx(zr,{size:16})})})]}),i.jsx(el,{children:i.jsxs(Ja,{width:"300px",p:4,boxShadow:"xl",zIndex:1e3,borderRadius:"md",outline:"none",children:[i.jsx(Za,{}),i.jsxs(c.HStack,{justify:"space-between",mb:4,children:[i.jsx(c.IconButton,{size:"xs",variant:"ghost",type:"button",onClick:L,"aria-label":"Previous month",children:"‹"}),i.jsx(c.Text,{fontWeight:"bold",fontSize:"sm",children:d.toLocaleString("default",{month:"long",year:"numeric"})}),i.jsx(c.IconButton,{size:"xs",variant:"ghost",type:"button",onClick:V,"aria-label":"Next month",children:"›"})]}),i.jsxs(c.Grid,{templateColumns:"repeat(7, 1fr)",gap:1,textAlign:"center",children:[["S","M","T","W","T","F","S"].map((T,C)=>i.jsx(c.Text,{fontSize:"xs",fontWeight:"bold",color:"fg.subtle",py:1,children:T},`${T}-${C}`)),Array(A).fill(null).map((T,C)=>i.jsx(c.Box,{},`empty-${C}`)),Array.from({length:O},(T,C)=>{const E=C+1,R=new Date(d.getFullYear(),d.getMonth(),E);let D=m,k=x;const P=Re(h);if(P){if(D&&!k)P<D?(k=D,D=P):k=P;else if(D&&k){const Y=D.getTime()+(k.getTime()-D.getTime())/2;P.getTime()<=Y?D=P:k=P,D>k&&([D,k]=[k,D])}}const b=D&&R.getTime()===D.getTime(),_=k&&R.getTime()===k.getTime(),N=D&&k&&R>D&&R<k;let W="gray",G="ghost";(b||_)&&(G="solid",W="blue");let U="md";return N&&(U="0"),b&&k&&(U=_?"md":"md 0 0 md"),_&&D&&(U=b?"md":"0 md md 0"),i.jsx(c.Button,{size:"xs",variant:G,colorPalette:W,onClick:()=>F(E),onMouseEnter:()=>p(R),onMouseLeave:()=>p(null),minW:"32px",h:"32px",fontSize:"xs",borderRadius:U,_hover:{bg:b||_?void 0:"gray.100"},children:E},E)})]}),i.jsx(c.Text,{fontSize:"10px",color:"fg.muted",mt:3,textAlign:"center",children:"Select Start Date then End Date"})]})})]})]})}const tl=y(c.Popover.Root),nl=y(c.Popover.Content),rl=y(c.Popover.Arrow),ol=y(c.Popover.Trigger),sl=y(c.Popover.Positioner);function Qn(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 il(e){const t=e.split("-");if(t.length!==3)return null;const[n,r,o]=t,s=parseInt(n),a=parseInt(r)-1,l=parseInt(o);if(isNaN(s)||isNaN(a)||isNaN(l)||o.length!==4)return null;const u=new Date(l,a,s);return u.getDate()===s&&u.getMonth()===a?u:null}function Vr({value:e,onChange:t,width:n="220px",visible:r=!0,label:o="Select date"}){const[s,a]=f.useState(!1),[l,u]=f.useState(e||new Date),[d,g]=f.useState(Qn(e));f.useEffect(()=>{g(Qn(e))},[e]);const h=new Date(l.getFullYear(),l.getMonth()+1,0).getDate(),p=new Date(l.getFullYear(),l.getMonth(),1).getDay(),m=()=>{u(new Date(l.getFullYear(),l.getMonth()-1,1))},v=()=>{u(new Date(l.getFullYear(),l.getMonth()+1,1))},x=j=>{const M=new Date(l.getFullYear(),l.getMonth(),j);t(M),a(!1)},S=j=>{if(s)switch(j.key){case"ArrowLeft":m();break;case"ArrowRight":v();break;case"Escape":a(!1);break}},w=()=>{g(""),t(null)};return i.jsxs(c.Box,{width:n,onKeyDown:S,children:[!r&&i.jsx(c.Text,{fontSize:"xs",color:"fg.muted",mb:1,fontWeight:"medium",children:o}),i.jsxs(tl,{open:s,onOpenChange:j=>a(j.open),positioning:{placement:"bottom-start",gutter:4},children:[i.jsxs(c.Group,{attached:!0,w:"full",position:"relative",children:[d&&i.jsx(c.IconButton,{size:"xs",variant:"ghost","aria-label":"Clear date",onClick:w,position:"absolute",right:"32px",top:"50%",transform:"translateY(-50%)",zIndex:1,children:i.jsx(Nr,{size:14})}),i.jsx(c.Input,{placeholder:"DD-MM-YYYY",value:d,onChange:j=>{const M=j.target.value;g(M);const I=il(M);I&&(t(I),u(I))},size:"sm",autoComplete:"off"}),i.jsx(ol,{asChild:!0,children:i.jsx(c.InputAddon,{cursor:"pointer",px:2,_hover:{bg:"gray.100"},transition:"background 0.2s",children:i.jsx(zr,{size:16})})})]}),i.jsx(sl,{children:i.jsxs(nl,{width:"300px",p:4,boxShadow:"xl",zIndex:1e3,borderRadius:"md",outline:"none",children:[i.jsx(rl,{}),i.jsxs(c.HStack,{justify:"space-between",mb:4,children:[i.jsx(c.IconButton,{size:"xs",variant:"ghost",onClick:m,"aria-label":"Previous month",children:"‹"}),i.jsx(c.Text,{fontWeight:"bold",fontSize:"sm",children:l.toLocaleString("default",{month:"long",year:"numeric"})}),i.jsx(c.IconButton,{size:"xs",variant:"ghost",onClick:v,"aria-label":"Next month",children:"›"})]}),i.jsxs(c.Grid,{templateColumns:"repeat(7, 1fr)",gap:1,textAlign:"center",children:[["S","M","T","W","T","F","S"].map((j,M)=>i.jsx(c.Text,{fontSize:"xs",fontWeight:"bold",color:"fg.subtle",py:1,children:j},`${j}-${M}`)),Array(p).fill(null).map((j,M)=>i.jsx(c.Box,{},`empty-${M}`)),Array.from({length:h},(j,M)=>{const I=M+1,$=e&&e.getDate()===I&&e.getMonth()===l.getMonth()&&e.getFullYear()===l.getFullYear();return i.jsx(c.Button,{size:"xs",variant:$?"solid":"ghost",colorPalette:$?"blue":"gray",onClick:()=>x(I),minW:"32px",h:"32px",fontSize:"xs",borderRadius:"md",children:I},I)})]}),i.jsx(c.Text,{fontSize:"10px",color:"fg.muted",mt:3,textAlign:"center",children:"Use Arrow Keys to change months • Esc to close"})]})})]})]})}const al=y(c.Field.Root);y(c.Field.Label);const ll=y(c.Field.HelperText),cl=y(c.Field.ErrorText),Qt=({icon:e,value:t,onChange:n,placeholder:r,size:o="xs",variant:s="outline",width:a="100%",label:l,helperText:u,isDisabled:d=!1,required:g=!1,errorText:h,visible:p,type:m="text",min:v=0,max:x=100,step:S=1})=>i.jsxs(al,{width:a,children:[i.jsx(c.InputGroup,{startElement:e,children:i.jsx(c.Input,{value:t,onChange:w=>n?.(w.target.value),placeholder:r,size:o,type:m,variant:s,disabled:d,required:g,min:v,max:x,step:S})}),h&&i.jsx(cl,{fontSize:"xs",children:h}),u&&i.jsx(ll,{fontSize:"xs",children:u})]}),ul=y(c.Field.Root),dl=y(c.Field.HelperText),fl=y(c.Field.ErrorText),hl=y(c.Select.Root),gl=y(c.Select.Label),pl=y(c.Select.Control),ml=y(c.Select.Trigger),vl=y(c.Select.ValueText),xl=y(c.Select.IndicatorGroup),bl=y(c.Select.Indicator),yl=y(c.Select.Content),Sl=y(c.Select.Item),wl=y(c.Select.ItemIndicator),Cl=y(c.Select.HiddenSelect),Dl=y(c.Select.Positioner),Yr=({options:e=[],label:t,value:n,onChange:r,placeholder:o,size:s="xs",width:a="100%",variant:l="outline",helperText:u,isDisabled:d,required:g,errorText:h,visible:p})=>{const m=f.useMemo(()=>c.createListCollection({items:e}),[e]),v=e.find(S=>S.value===n),x=S=>{S.preventDefault(),S.stopPropagation(),r?.(void 0)};return i.jsxs(ul,{disabled:d,required:g,children:[i.jsxs(hl,{collection:m,variant:l,size:s,width:a,value:n?[n]:[],onValueChange:S=>{r?.(S.value[0])},children:[i.jsx(Cl,{}),p&&i.jsx(gl,{children:t}),i.jsxs(pl,{children:[i.jsx(ml,{children:i.jsx(vl,{placeholder:o,children:v?v.displayValue??v.label:""})}),i.jsxs(xl,{children:[n&&!d&&i.jsx("div",{style:{pointerEvents:"auto",display:"flex",alignItems:"center"},onPointerDown:S=>S.stopPropagation(),onClick:S=>S.stopPropagation(),children:i.jsx(c.CloseButton,{size:"sm",variant:"ghost",onPointerDown:x,onClick:x,position:"relative",zIndex:10})}),i.jsx(bl,{})]})]}),i.jsx(Dl,{children:i.jsx(yl,{children:m.items.map((S,w)=>i.jsxs(Sl,{item:S,children:[S.label,i.jsx(wl,{})]},w))})})]}),u&&i.jsx(dl,{children:u}),h&&i.jsx(fl,{children:h})]})},El="FILTER_PRESETS_",Hr=e=>`${El}${e}`,Tt=e=>{if(typeof window>"u")return[];const t=localStorage.getItem(Hr(e));try{return t?JSON.parse(t):[]}catch(n){return console.error("Failed to parse presets",n),[]}},fn=(e,t)=>{typeof window>"u"||(localStorage.setItem(Hr(e),JSON.stringify(t)),window.dispatchEvent(new Event("storage_updated")))},Ur=(e,t)=>{const n=Tt(e);fn(e,[t,...n])},Gr=(e,t)=>{const n=Tt(e).filter(r=>r.id!==t);fn(e,n)},jl=y(c.Checkbox.Root),Ml=y(c.Checkbox.HiddenInput),Rl=y(c.Checkbox.Control),Tl=y(c.Slider.Root),Ol=y(c.Slider.Track),Il=y(c.Slider.Range),_l=y(c.Slider.Thumbs),kl=y(c.Slider.Control),$l=({filter:e,onVisibilityChange:t,onSizeChange:n})=>{const{attributes:r,listeners:o,setNodeRef:s,transform:a,transition:l}=Rr({id:e.id}),u={transform:Pe.Transform.toString(a),transition:l};return i.jsxs(c.VStack,{ref:s,style:u,align:"stretch",border:"1px solid",borderColor:"gray.200",rounded:"md",p:3,mb:3,bg:"white",children:[i.jsxs(c.HStack,{...r,...o,cursor:"grab",userSelect:"none",gap:2,children:[i.jsx(Lr,{size:16}),i.jsx(c.Text,{fontWeight:"bold",fontSize:"sm",children:e.label||e.id})]}),i.jsxs(c.HStack,{justify:"space-between",children:[i.jsx(c.Text,{fontSize:"sm",children:"Visible"}),i.jsxs(jl,{checked:e.visible,size:"sm",onCheckedChange:d=>t?.(e.id,!!d.checked),children:[i.jsx(Ml,{}),i.jsx(Rl,{})]})]}),i.jsxs(c.VStack,{align:"stretch",gap:1,children:[i.jsx(c.Text,{fontSize:"sm",children:"Size"}),i.jsx(Tl,{min:1,max:5,step:.5,value:[e.size??1],onValueChange:d=>n?.(e.id,d.value[0]),children:i.jsxs(kl,{children:[i.jsx(Ol,{children:i.jsx(Il,{})}),i.jsx(_l,{})]})})]})]})},Al=y(c.Drawer.Root),zl=y(c.Drawer.Trigger),Ll=y(c.Drawer.Backdrop),Pl=y(c.Drawer.Positioner),Nl=y(c.Drawer.Content),Fl=y(c.Drawer.Header),Wl=y(c.Drawer.Title),Bl=y(c.Drawer.Body),Vl=y(c.Drawer.Footer),Yl=y(c.Drawer.CloseTrigger),Hl=y(c.Tabs.Root),Ul=y(c.Tabs.List),Yt=y(c.Tabs.Trigger),Ht=y(c.Tabs.Content),qr=(e,t)=>{if(e.customComponent)return e.customComponent;switch(e.type){case"text":return i.jsx(Qt,{placeholder:e.label,value:e.value,onChange:e.onChange,label:e.label,visible:t});case"number":return i.jsx(Qt,{label:e.label,value:e.value,onChange:e.onChange});case"checkbox":return i.jsx(Fr,{label:e.label,value:e.value,onChange:e.onChange});case"select":return i.jsx(Yr,{label:e.label,value:e.value,onChange:e.onChange,options:e.options??[],visible:t,placeholder:e.placeholder});case"date":return i.jsx(Vr,{value:e.value,onChange:e.onChange,visible:t,label:e.label});case"date-range":const n=e.value,r=n?.startDate||e.startDate,o=n?.endDate||e.endDate;return i.jsx(Br,{startDate:r?new Date(r):void 0,endDate:o?new Date(o):void 0,onChange:(s,a)=>{e.onChange&&e.onChange({startDate:s,endDate:a})},visible:t,label:e.label});case"combobox":return i.jsx(Wr,{label:e.label,value:e.value,items:e.options||[],itemToString:s=>s?.label||"",itemToValue:s=>s?.value||"",onSelect:s=>{e.onChange?.(s)},renderItem:s=>i.jsx(c.Text,{fontSize:"sm",children:s.label}),placeholder:e.placeholder||"Search...",visible:t});default:return null}},Gl=({filterDrawerSize:e="sm",onVisibilityChange:t,onSizeChange:n,onClear:r,filters:o,pageKey:s="default",onLoadPreset:a,activePresetName:l,onReorder:u,open:d,onOpenChange:g,maxToolbarUnits:h})=>{const[p,m]=f.useState([]);f.useEffect(()=>{const w=()=>{m(Tt(s))};return w(),window.addEventListener("storage",w),window.addEventListener("storage_updated",w),()=>{window.removeEventListener("storage",w),window.removeEventListener("storage_updated",w)}},[s]);const v=()=>{const w=prompt("Preset name?");if(!w)return;const j=o.reduce((M,I)=>(M[I.id]=I.value,M),{});Ur(s,{id:La(),name:w,date:new Date().toISOString(),values:j})},x=(w,j)=>{if(j&&h!==void 0){const M=o.filter(O=>O.visible).reduce((O,A)=>O+(A.size??1),0),$=o.find(O=>O.id===w)?.size??1;if(M+$>h){alert(`Limit reached! You can only use up to ${h} toolbar units. Please disable another filter first.`);return}}t?.(w,j)},S=(w,j)=>{h!==void 0&&o.find(I=>I.id===w)?.visible&&o.filter($=>$.visible&&$.id!==w).reduce(($,O)=>$+(O.size??1),0)+j>h||n?.(w,j)};return i.jsx(c.HStack,{wrap:"wrap",children:i.jsxs(Al,{size:e,open:d,onOpenChange:g,children:[i.jsx(zl,{asChild:!0,children:i.jsxs(c.IconButton,{"aria-label":"Open filters",variant:"outline",size:"xs",ml:2,p:2,children:[i.jsx(Hi,{size:16}),"Filters"]})}),i.jsxs(c.Portal,{children:[i.jsx(Ll,{}),i.jsx(Pl,{children:i.jsxs(Nl,{children:[i.jsx(Fl,{children:i.jsx(Wl,{children:"Filters"})}),i.jsx(Bl,{overflowY:"auto",pt:1,children:i.jsxs(Hl,{defaultValue:"view",children:[i.jsxs(Ul,{mb:4,children:[i.jsxs(Yt,{value:"view",children:[i.jsx(qi,{size:16}),"Edit"]}),i.jsxs(Yt,{value:"settings",children:[i.jsx(Zi,{size:16}),"Settings"]}),i.jsxs(Yt,{value:"presets",children:[i.jsx(zi,{size:16}),"Presets"]})]}),i.jsx(Ht,{value:"view",children:o.map(w=>i.jsx(c.VStack,{align:"stretch",border:"1px solid",borderColor:"gray.200",flex:w.size??1,minW:`${(w.size??1)*100}px`,rounded:"md",p:3,mb:3,children:qr(w,d)},w.id))}),i.jsx(Ht,{value:"settings",children:i.jsx(wr,{sensors:Ro(Mo(dn)),collisionDetection:lr,onDragEnd:({active:w,over:j})=>{if(!j||w.id===j.id)return;const M=o.findIndex(O=>O.id===w.id),I=o.findIndex(O=>O.id===j.id),$=Mt(o,M,I);u?.($)},children:i.jsx(jr,{items:o.map(w=>w.id),strategy:Vs,children:o.map(w=>i.jsx($l,{filter:w,onVisibilityChange:x,onSizeChange:S},w.id))})})}),i.jsx(Ht,{value:"presets",children:i.jsxs(c.VStack,{align:"stretch",mb:3,children:[p.length===0&&i.jsx(c.Text,{fontSize:"xs",color:"gray.500",children:"No presets saved yet."}),p.map(w=>i.jsxs(c.HStack,{justify:"space-between",border:"1px solid",borderColor:l===w.name?"blue.300":"gray.200",rounded:"md",p:2,children:[i.jsxs(c.VStack,{align:"start",gap:0,children:[i.jsx(c.Text,{fontWeight:"bold",fontSize:"sm",children:w.name}),i.jsx(c.Text,{fontSize:"xs",color:"gray.500",children:new Date(w.date).toLocaleDateString()})]}),i.jsxs(c.HStack,{children:[i.jsx(c.Button,{size:"xs",variant:"ghost",onClick:()=>{const j=o.map(M=>({...M,value:w.values[M.id]??M.value}));a?.(j,w.name)},children:"Load"}),i.jsx(c.IconButton,{size:"xs","aria-label":"Delete preset",variant:"ghost",onClick:()=>Gr(s,w.id),children:i.jsx(Vi,{size:14})})]})]},w.id)),i.jsx(c.Button,{size:"sm",colorScheme:"blue",onClick:v,children:"Save Current Filters"})]})})]})}),i.jsx(Vl,{justify:"space-between",children:i.jsx(Yl,{asChild:!0,children:i.jsx(c.CloseButton,{})})})]})})]})]})})},ql=({title:e,filters:t,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:a,pageKey:l,onLoadPreset:u,activePresetName:d,filterDrawerSize:g="sm"})=>{const[h,p]=f.useState(!1);let m=0;return i.jsxs(c.HStack,{wrap:"wrap",pl:2,pr:2,width:"100%",justify:"space-between",alignItems:"center",children:[e,i.jsxs(c.HStack,{gapX:1,align:"center",children:[t.filter(v=>v.visible!==!1).map(v=>{const x=v.size??1,S=a!==void 0&&m+x>a;return S||(m+=x),i.jsx(c.HStack,{flex:x,minW:`${x*100}px`,opacity:S?.4:1,pointerEvents:S?"none":"auto",cursor:S?"not-allowed":"auto",children:qr(v)},v.id)}),i.jsx(Gl,{filterDrawerSize:g,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:a,pageKey:l,filters:t,onLoadPreset:u,activePresetName:d,open:h,onOpenChange:v=>{p(v.open)}})]})]})},Xl=(e,t)=>{localStorage.setItem(`FILTER_ORDER_${e}`,JSON.stringify(t))},Kl=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:a,colorScheme:l,loading:u,loadingText:d,rounded:g,type:h="button",textColor:p="white",borderColor:m})=>i.jsx(c.Button,{onClick:e,size:t,variant:n,disabled:a,loading:u,loadingText:d,rounded:g,type:h,background:l,color:p,border:m,children:i.jsxs(c.HStack,{gap:1,children:[o,r,s]})}),Zl=y(c.Dialog.Root),Ql=y(c.Dialog.Backdrop),ec=y(c.Dialog.Positioner),tc=y(c.Dialog.Content),nc=y(c.Dialog.Header),rc=y(c.Dialog.Body),oc=y(c.Dialog.Footer),sc=y(c.Dialog.Title),ic=y(c.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:a="Cancel",icon:l,isLoading:u=!1,confirmButtonColorScheme:d="#4169e1"}){return i.jsx(Zl,{open:e,placement:"center",onOpenChange:g=>!g.open&&t(),children:i.jsxs(c.Portal,{children:[i.jsx(Ql,{}),i.jsx(ec,{children:i.jsxs(tc,{maxW:"480px",children:[i.jsx(nc,{borderBottom:"1px solid",borderColor:"gray.200",children:i.jsx(sc,{children:r})}),i.jsx(rc,{p:6,children:i.jsxs(c.Stack,{gap:4,align:"center",textAlign:"center",children:[i.jsx(c.Box,{color:"orange.500",children:l??i.jsx(Pr,{size:40})}),i.jsx(c.Text,{fontSize:"sm",color:"gray.600",children:o})]})}),i.jsxs(oc,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"gray.200",children:[i.jsx(c.Button,{variant:"outline",size:"sm",onClick:t,children:a}),i.jsx(c.Button,{size:"sm",style:{backgroundColor:d},loading:u,onClick:n,children:s})]}),i.jsx(ic,{asChild:!0,children:i.jsx(c.CloseButton,{size:"sm"})})]})})]})})}const lc=y(c.Dialog.Root),cc=y(c.Dialog.Backdrop),uc=y(c.Dialog.Positioner),dc=y(c.Dialog.Content),fc=y(c.Dialog.Header),hc=y(c.Dialog.Body),gc=y(c.Dialog.Footer),pc=y(c.Dialog.Title),mc=y(c.Dialog.CloseTrigger);function vc({open:e,onClose:t,onConfirm:n,title:r="Delete Company",entityName:o,confirmText:s="DELETE",confirmLabel:a="Delete",isLoading:l=!1}){const[u,d]=f.useState(""),g=u===s;return i.jsx(lc,{open:e,placement:"center",onOpenChange:h=>{!h.open&&t(),d("")},children:i.jsxs(c.Portal,{children:[i.jsx(cc,{}),i.jsx(uc,{children:i.jsxs(dc,{maxW:"550px",children:[i.jsx(fc,{borderBottom:"1px solid",borderColor:"#d3d3d3",children:i.jsx(pc,{color:"red.600",children:r})}),i.jsx(hc,{p:2,style:{padding:"16px"},children:i.jsxs(c.Stack,{gap:4,borderRadius:"md",p:4,bg:"white",children:[i.jsx(c.Box,{border:"1px solid",borderColor:"red.200",bg:"red.50",borderRadius:"md",p:4,children:i.jsxs(c.Stack,{direction:"row",gap:3,align:"flex-start",children:[i.jsx(c.Box,{color:"red.600",mt:"2px",children:i.jsx(Pr,{size:20})}),i.jsxs(c.Box,{children:[i.jsx(c.Text,{fontWeight:"semibold",color:"red.700",children:"Are you sure?"}),i.jsxs(c.Text,{fontSize:"sm",color:"red.600",children:["All the data of ",i.jsx("b",{children:o})," will permanently be deleted."]})]})]})}),i.jsx(c.Text,{fontSize:"sm",color:"gray.600",children:"You can’t undo this action afterwards."}),i.jsxs(c.Box,{children:[i.jsxs(c.Text,{fontSize:"sm",mb:2,children:["Type ",i.jsx("b",{children:s})," to continue"]}),i.jsx(c.Input,{placeholder:`Type ${s} here`,value:u,onChange:h=>d(h.target.value),size:"xs"})]})]})}),i.jsxs(gc,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"#d3d3d3",children:[i.jsx(c.Button,{variant:"outline",size:"sm",onClick:()=>{t(),d("")},children:"Cancel"}),i.jsx(c.Button,{size:"sm",disabled:!g,style:{backgroundColor:"#FF0000"},loading:l,onClick:n,children:a})]}),i.jsx(mc,{asChild:!0,children:i.jsx(c.CloseButton,{size:"sm"})})]})})]})})}const Xr=({children:e})=>i.jsx(i.Fragment,{children:e}),Kr=({children:e})=>i.jsx(i.Fragment,{children:e}),xc=c.Button,bc=y(c.Dialog.Root),yc=y(c.Dialog.Backdrop),Sc=y(c.Dialog.Positioner),wc=y(c.Dialog.Content),Cc=y(c.Dialog.Header),Dc=y(c.Dialog.Body),Ec=y(c.Dialog.Footer),jc=y(c.Dialog.Title),Mc=y(c.Dialog.CloseTrigger);function Rc(e){let t=null,n=null;return f.Children.forEach(e,r=>{f.isValidElement(r)&&(r.type===Xr&&(t=r.props.children),r.type===Kr&&(n=r.props.children))}),{body:t,actions:n}}const Tc=({open:e,onClose:t,title:n,children:r,width:o,position:s,refetch:a,loading:l=!1})=>{const{body:u,actions:d}=Rc(r);return i.jsx(bc,{open:e,onOpenChange:g=>!g.open&&t(),placement:s??"center",children:i.jsxs(c.Portal,{children:[i.jsx(yc,{bg:"blackAlpha.400"}),i.jsx(Sc,{children:i.jsxs(wc,{w:o??"560px",maxW:o??"560px",borderRadius:"6px",overflow:"hidden",boxShadow:"lg",children:[i.jsx(Cc,{px:"20px",py:"16px",bg:"white",borderBottom:"1px solid",borderColor:"gray.200",children:i.jsxs(c.Flex,{align:"center",justify:"space-between",children:[i.jsx(jc,{fontSize:"16px",fontWeight:"600",children:n}),i.jsx(Mc,{asChild:!0,children:i.jsx(c.CloseButton,{size:"sm"})}),a&&i.jsx(hn,{label:"Refresh",refetch:a,isLoading:l})]})}),u&&i.jsx(Dc,{px:"20px",py:"16px",bg:"#F8FAFC",type:"submit",children:i.jsx(c.Flex,{direction:"column",gap:"16px",children:u})}),d&&i.jsx(Ec,{px:"20px",py:"16px",bg:"white",borderTop:"1px solid",borderColor:"gray.200",children:i.jsx(c.Flex,{ml:"auto",gap:"12px",children:d})})]})})]})})},Oc=y(c.Field.Root),Ic=y(c.Field.Label),_c=y(c.Field.HelperText),kc=y(c.Field.ErrorText),$c=y(c.PinInput.Input),Ac=y(c.PinInput.Control),zc=y(c.PinInput.HiddenInput),Lc=y(c.PinInput.Root),Pc=({value:e,onChange:t,length:n=4,size:r="xs",isDisabled:o=!1,label:s,helperText:a,errorText:l,required:u=!1,visible:d=!0})=>{const g=Array.from({length:n}).map((h,p)=>e?.[p]??"");return i.jsxs(Oc,{children:[d&&s&&i.jsxs(Ic,{children:[s,u&&" *"]}),i.jsxs(Lc,{value:g,onValueChange:h=>t?.(h.value.join("")),disabled:o,size:r,children:[i.jsx(zc,{}),i.jsx(Ac,{children:i.jsx(c.HStack,{children:Array.from({length:n}).map((h,p)=>i.jsx($c,{index:p},p))})})]}),l&&i.jsx(kc,{fontSize:"xs",children:l}),a&&!l&&i.jsx(_c,{fontSize:"xs",children:a})]})};function hn({refetch:e,isLoading:t=!1,label:n="Refresh"}){const[r,o]=f.useState(!1),s=async()=>{o(!0);try{await e()}finally{setTimeout(()=>o(!1),300)}};return i.jsx(c.IconButton,{"aria-label":n,size:"xs",variant:"outline",disabled:t||r,onClick:s,ml:2,children:i.jsx(Ki,{size:14,style:{animation:r?"spin 0.6s linear infinite":void 0}})})}var gt={exports:{}},Nc=gt.exports,er;function Fc(){return er||(er=1,(function(e,t){(function(n,r){e.exports=r()})(Nc,(function(){var n=1e3,r=6e4,o=36e5,s="millisecond",a="second",l="minute",u="hour",d="day",g="week",h="month",p="quarter",m="year",v="date",x="Invalid Date",S=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,w=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,j={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(T){var C=["th","st","nd","rd"],E=T%100;return"["+T+(C[(E-20)%10]||C[E]||C[0])+"]"}},M=function(T,C,E){var R=String(T);return!R||R.length>=C?T:""+Array(C+1-R.length).join(E)+T},I={s:M,z:function(T){var C=-T.utcOffset(),E=Math.abs(C),R=Math.floor(E/60),D=E%60;return(C<=0?"+":"-")+M(R,2,"0")+":"+M(D,2,"0")},m:function T(C,E){if(C.date()<E.date())return-T(E,C);var R=12*(E.year()-C.year())+(E.month()-C.month()),D=C.clone().add(R,h),k=E-D<0,P=C.clone().add(R+(k?-1:1),h);return+(-(R+(E-D)/(k?D-P:P-D))||0)},a:function(T){return T<0?Math.ceil(T)||0:Math.floor(T)},p:function(T){return{M:h,y:m,w:g,d,D:v,h:u,m:l,s:a,ms:s,Q:p}[T]||String(T||"").toLowerCase().replace(/s$/,"")},u:function(T){return T===void 0}},$="en",O={};O[$]=j;var A="$isDayjsObject",L=function(T){return T instanceof q||!(!T||!T[A])},V=function T(C,E,R){var D;if(!C)return $;if(typeof C=="string"){var k=C.toLowerCase();O[k]&&(D=k),E&&(O[k]=E,D=k);var P=C.split("-");if(!D&&P.length>1)return T(P[0])}else{var b=C.name;O[b]=C,D=b}return!R&&D&&($=D),D||!R&&$},F=function(T,C){if(L(T))return T.clone();var E=typeof C=="object"?C:{};return E.date=T,E.args=arguments,new q(E)},z=I;z.l=V,z.i=L,z.w=function(T,C){return F(T,{locale:C.$L,utc:C.$u,x:C.$x,$offset:C.$offset})};var q=(function(){function T(E){this.$L=V(E.locale,null,!0),this.parse(E),this.$x=this.$x||E.x||{},this[A]=!0}var C=T.prototype;return C.parse=function(E){this.$d=(function(R){var D=R.date,k=R.utc;if(D===null)return new Date(NaN);if(z.u(D))return new Date;if(D instanceof Date)return new Date(D);if(typeof D=="string"&&!/Z$/i.test(D)){var P=D.match(S);if(P){var b=P[2]-1||0,_=(P[7]||"0").substring(0,3);return k?new Date(Date.UTC(P[1],b,P[3]||1,P[4]||0,P[5]||0,P[6]||0,_)):new Date(P[1],b,P[3]||1,P[4]||0,P[5]||0,P[6]||0,_)}}return new Date(D)})(E),this.init()},C.init=function(){var E=this.$d;this.$y=E.getFullYear(),this.$M=E.getMonth(),this.$D=E.getDate(),this.$W=E.getDay(),this.$H=E.getHours(),this.$m=E.getMinutes(),this.$s=E.getSeconds(),this.$ms=E.getMilliseconds()},C.$utils=function(){return z},C.isValid=function(){return this.$d.toString()!==x},C.isSame=function(E,R){var D=F(E);return this.startOf(R)<=D&&D<=this.endOf(R)},C.isAfter=function(E,R){return F(E)<this.startOf(R)},C.isBefore=function(E,R){return this.endOf(R)<F(E)},C.$g=function(E,R,D){return z.u(E)?this[R]:this.set(D,E)},C.unix=function(){return Math.floor(this.valueOf()/1e3)},C.valueOf=function(){return this.$d.getTime()},C.startOf=function(E,R){var D=this,k=!!z.u(R)||R,P=z.p(E),b=function(J,B){var se=z.w(D.$u?Date.UTC(D.$y,B,J):new Date(D.$y,B,J),D);return k?se:se.endOf(d)},_=function(J,B){return z.w(D.toDate()[J].apply(D.toDate("s"),(k?[0,0,0,0]:[23,59,59,999]).slice(B)),D)},N=this.$W,W=this.$M,G=this.$D,U="set"+(this.$u?"UTC":"");switch(P){case m:return k?b(1,0):b(31,11);case h:return k?b(1,W):b(0,W+1);case g:var Y=this.$locale().weekStart||0,K=(N<Y?N+7:N)-Y;return b(k?G-K:G+(6-K),W);case d:case v:return _(U+"Hours",0);case u:return _(U+"Minutes",1);case l:return _(U+"Seconds",2);case a:return _(U+"Milliseconds",3);default:return this.clone()}},C.endOf=function(E){return this.startOf(E,!1)},C.$set=function(E,R){var D,k=z.p(E),P="set"+(this.$u?"UTC":""),b=(D={},D[d]=P+"Date",D[v]=P+"Date",D[h]=P+"Month",D[m]=P+"FullYear",D[u]=P+"Hours",D[l]=P+"Minutes",D[a]=P+"Seconds",D[s]=P+"Milliseconds",D)[k],_=k===d?this.$D+(R-this.$W):R;if(k===h||k===m){var N=this.clone().set(v,1);N.$d[b](_),N.init(),this.$d=N.set(v,Math.min(this.$D,N.daysInMonth())).$d}else b&&this.$d[b](_);return this.init(),this},C.set=function(E,R){return this.clone().$set(E,R)},C.get=function(E){return this[z.p(E)]()},C.add=function(E,R){var D,k=this;E=Number(E);var P=z.p(R),b=function(W){var G=F(k);return z.w(G.date(G.date()+Math.round(W*E)),k)};if(P===h)return this.set(h,this.$M+E);if(P===m)return this.set(m,this.$y+E);if(P===d)return b(1);if(P===g)return b(7);var _=(D={},D[l]=r,D[u]=o,D[a]=n,D)[P]||1,N=this.$d.getTime()+E*_;return z.w(N,this)},C.subtract=function(E,R){return this.add(-1*E,R)},C.format=function(E){var R=this,D=this.$locale();if(!this.isValid())return D.invalidDate||x;var k=E||"YYYY-MM-DDTHH:mm:ssZ",P=z.z(this),b=this.$H,_=this.$m,N=this.$M,W=D.weekdays,G=D.months,U=D.meridiem,Y=function(B,se,re,ge){return B&&(B[se]||B(R,k))||re[se].slice(0,ge)},K=function(B){return z.s(b%12||12,B,"0")},J=U||function(B,se,re){var ge=B<12?"AM":"PM";return re?ge.toLowerCase():ge};return k.replace(w,(function(B,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 Y(D.monthsShort,N,G,3);case"MMMM":return Y(G,N);case"D":return R.$D;case"DD":return z.s(R.$D,2,"0");case"d":return String(R.$W);case"dd":return Y(D.weekdaysMin,R.$W,W,2);case"ddd":return Y(D.weekdaysShort,R.$W,W,3);case"dddd":return W[R.$W];case"H":return String(b);case"HH":return z.s(b,2,"0");case"h":return K(1);case"hh":return K(2);case"a":return J(b,_,!0);case"A":return J(b,_,!1);case"m":return String(_);case"mm":return z.s(_,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})(B)||P.replace(":","")}))},C.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},C.diff=function(E,R,D){var k,P=this,b=z.p(R),_=F(E),N=(_.utcOffset()-this.utcOffset())*r,W=this-_,G=function(){return z.m(P,_)};switch(b){case m:k=G()/12;break;case h:k=G();break;case p:k=G()/3;break;case g:k=(W-N)/6048e5;break;case d:k=(W-N)/864e5;break;case u:k=W/o;break;case l:k=W/r;break;case a:k=W/n;break;default:k=W}return D?k:z.a(k)},C.daysInMonth=function(){return this.endOf(h).$D},C.$locale=function(){return O[this.$L]},C.locale=function(E,R){if(!E)return this.$L;var D=this.clone(),k=V(E,R,!0);return k&&(D.$L=k),D},C.clone=function(){return z.w(this.$d,this)},C.toDate=function(){return new Date(this.valueOf())},C.toJSON=function(){return this.isValid()?this.toISOString():null},C.toISOString=function(){return this.$d.toISOString()},C.toString=function(){return this.$d.toUTCString()},T})(),X=q.prototype;return F.prototype=X,[["$ms",s],["$s",a],["$m",l],["$H",u],["$W",d],["$M",h],["$y",m],["$D",v]].forEach((function(T){X[T[1]]=function(C){return this.$g(C,T[0],T[1])}})),F.extend=function(T,C){return T.$i||(T(C,q,F),T.$i=!0),F},F.locale=V,F.isDayjs=L,F.unix=function(T){return F(1e3*T)},F.en=O[$],F.Ls=O,F.p={},F}))})(gt)),gt.exports}var Wc=Fc();const Ot=Ct(Wc);var pt={exports:{}},Bc=pt.exports,tr;function Vc(){return tr||(tr=1,(function(e,t){(function(n,r){e.exports=r()})(Bc,(function(){return function(n,r,o){n=n||{};var s=r.prototype,a={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function l(d,g,h,p){return s.fromToBase(d,g,h,p)}o.en.relativeTime=a,s.fromToBase=function(d,g,h,p,m){for(var v,x,S,w=h.$locale().relativeTime||a,j=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=j.length,I=0;I<M;I+=1){var $=j[I];$.d&&(v=p?o(d).diff(h,$.d,!0):h.diff(d,$.d,!0));var O=(n.rounding||Math.round)(Math.abs(v));if(S=v>0,O<=$.r||!$.r){O<=1&&I>0&&($=j[I-1]);var A=w[$.l];m&&(O=m(""+O)),x=typeof A=="string"?A.replace("%d",O):A(O,g,$.l,S);break}}if(g)return x;var L=S?w.future:w.past;return typeof L=="function"?L(x):L.replace("%s",x)},s.to=function(d,g){return l(d,g,this,!0)},s.from=function(d,g){return l(d,g,this)};var u=function(d){return d.$u?o.utc():o()};s.toNow=function(d){return this.to(u(this),d)},s.fromNow=function(d){return this.from(u(this),d)}}}))})(pt)),pt.exports}var Yc=Vc();const Hc=Ct(Yc);var mt={exports:{}},Uc=mt.exports,nr;function Gc(){return nr||(nr=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 a=o.prototype,l=a.format;s.en.formats=n,a.format=function(u){u===void 0&&(u="YYYY-MM-DDTHH:mm:ssZ");var d=this.$locale().formats,g=(function(h,p){return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(m,v,x){var S=x&&x.toUpperCase();return v||p[x]||n[x]||p[S].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(w,j,M){return j||M.slice(1)}))}))})(u,d===void 0?{}:d);return l.call(this,g)}}}))})(mt)),mt.exports}var qc=Gc();const Xc=Ct(qc);var vt={exports:{}},Kc=vt.exports,rr;function Jc(){return rr||(rr=1,(function(e,t){(function(n,r){e.exports=r()})(Kc,(function(){return function(n,r){var o=r.prototype,s=o.format;o.format=function(a){var l=this,u=this.$locale();if(!this.isValid())return s.bind(this)(a);var d=this.$utils(),g=(a||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(h){switch(h){case"Q":return Math.ceil((l.$M+1)/3);case"Do":return u.ordinal(l.$D);case"gggg":return l.weekYear();case"GGGG":return l.isoWeekYear();case"wo":return u.ordinal(l.week(),"W");case"w":case"ww":return d.s(l.week(),h==="w"?1:2,"0");case"W":case"WW":return d.s(l.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return d.s(String(l.$H===0?24:l.$H),h==="k"?1:2,"0");case"X":return Math.floor(l.$d.getTime()/1e3);case"x":return l.$d.getTime();case"z":return"["+l.offsetName()+"]";case"zzz":return"["+l.offsetName("long")+"]";default:return h}}));return s.bind(this)(g)}}}))})(vt)),vt.exports}var Zc=Jc();const Qc=Ct(Zc);Ot.extend(Hc);Ot.extend(Xc);Ot.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 en({value:e,variant:t="dateTime",format:n,fallback:r="--"}){if(!e)return r;const o=Ot(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:a="gray.700",dateFontSize:l="16px",dateFontWeight:u="500",timeColor:d="gray.500",timeFontSize:g="12px",timeFontWeight:h="400",showTime:p=!0}){return i.jsxs(c.Stack,{gap:.5,align:s,children:[i.jsx(c.Text,{fontSize:l,fontWeight:u,color:a,children:en({value:e,variant:t,format:r})}),p&&i.jsx(c.Text,{fontSize:g,fontWeight:h,color:d,children:en({value:e,variant:n,format:o})})]})}class Jr{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 tn{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 nn{constructor(t){this.api=t}store=new Jr;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 Zr=f.createContext(null);function Qr(){const e=f.useContext(Zr);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 nn(new tn(e)));return n.current||(n.current=new nn(new tn(e))),i.jsx(Zr.Provider,{value:n.current,children:t})}function ru(e){const t=Qr(),[n,r]=f.useState(t.getRaw(e)?.value);return f.useEffect(()=>{let o=!0;t.getKey(e).then(a=>{o&&r(a)});const s=t.subscribe(e,a=>{r(a?.value)});return()=>{o=!1,s()}},[e,t]),n}function ou(e){const t=Qr(),[n,r]=f.useState({});return f.useEffect(()=>{let o=!0;t.getMultiKey(e).then(a=>{o&&r(a)});const s=e.map(a=>t.subscribe(a,l=>{r(u=>({...u,[a]:l?.value}))}));return()=>{o=!1,s.forEach(a=>a())}},[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,a]=f.useState(n),l=f.useCallback(p=>{o(Math.max(1,p))},[]),u=f.useCallback(p=>{a(Math.max(1,p)),o(1)},[]),d=f.useCallback(()=>{o(p=>p+1)},[]),g=f.useCallback(()=>{o(p=>Math.max(1,p-1))},[]),h=f.useCallback(()=>{o(t),a(n)},[t,n]);return{page:r,limit:s,setPage:l,setLimit:u,nextPage:d,prevPage:g,reset:h}}function lu(e={}){const{initialValue:t="",delay:n=300,len:r=3}=e,[o,s]=f.useState(t),l=o.length===0||o.length>=r?o:"",u=cu(l,n),d=f.useCallback(h=>{s(h)},[]),g=f.useCallback(()=>{s(t)},[t]);return{search:o,debouncedSearch:u,onSearchChange:d,reset:g,len:r}}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}const uu=y(c.Tooltip.Root),du=y(c.Tooltip.Trigger),fu=y(c.Tooltip.Positioner),hu=y(c.Tooltip.Content),gu=y(c.Tooltip.Arrow),pu=y(c.Tooltip.ArrowTip),mu=Ze.forwardRef(function(t,n){const{showArrow:r=!0,children:o,disabled:s,portalled:a=!0,content:l,contentProps:u,...d}=t;return s?i.jsx(i.Fragment,{children:o}):i.jsxs(uu,{...d,children:[i.jsx(du,{asChild:!0,children:o}),i.jsx(c.Portal,{disabled:!a,children:i.jsx(fu,{children:i.jsxs(hu,{ref:n,...u,children:[r&&i.jsx(gu,{children:i.jsx(pu,{})}),l]})})})]})}),vu=y(c.Combobox.Root),xu=y(c.Combobox.Trigger),bu=y(c.Combobox.Input),yu=y(c.Combobox.Control),Su=y(c.Combobox.Content),wu=y(c.Combobox.Positioner),Cu=y(c.Combobox.Item),or=y(c.Combobox.ItemText),Du=y(c.Combobox.Empty),Eu=y(c.Combobox.IndicatorGroup),ju=y(c.Combobox.ClearTrigger),Mu=y(c.Combobox.Label),Ru=({baseURL:e,filterKey:t,placeholder:n="Type to search...",label:r="Select Entry"})=>{const[o,s]=f.useState([]),[a,l]=f.useState(!0);f.useEffect(()=>{(async()=>{try{l(!0);const v=await(await fetch(e)).json();v.success&&s(v.data)}catch(m){console.error("Error fetching combobox data:",m)}finally{l(!1)}})()},[e]);const u=f.useMemo(()=>{const p=t?o.filter(v=>v.group_type===t):o,m={mo:1,district:2,partner:3};return[...p].sort((v,x)=>m[v.group_type]!==m[x.group_type]?m[v.group_type]-m[x.group_type]:v.label.localeCompare(x.label))},[o,t]),{contains:d}=c.useFilter({sensitivity:"base"}),{collection:g,filter:h}=c.useListCollection({initialItems:u,filter:d});return f.useEffect(()=>{h("")},[u,h]),a?i.jsx(c.Spinner,{size:"sm"}):i.jsxs(vu,{collection:g,onInputValueChange:p=>h(p.inputValue),width:"320px",children:[i.jsx(Mu,{children:r}),i.jsxs(yu,{children:[i.jsx(bu,{placeholder:n}),i.jsxs(Eu,{children:[i.jsx(ju,{}),i.jsx(xu,{})]})]}),i.jsx(c.Portal,{children:i.jsx(wu,{children:i.jsxs(Su,{maxHeight:"400px",overflowY:"auto",children:[i.jsx(Du,{children:"No results found"}),g.items.map(p=>i.jsxs(Cu,{item:p,px:"2",py:"1",children:[i.jsxs(c.VStack,{align:"start",gap:"0",children:[i.jsx(or,{fontSize:"sm",fontWeight:"medium",children:p.label}),i.jsxs(or,{fontSize:"xs",color:"fg.muted",children:[p.group_type.toUpperCase()," - ",p.identifier]})]}),i.jsx(c.Combobox.ItemIndicator,{})]},p.id))]})})})]})};exports.ACTIONS_COLUMN_ID=Se;exports.DataTable=Ia;exports.Filters=ql;exports.GroupedDataCombobox=Ru;exports.HttpOptionsApi=tn;exports.MDSButton=Jl;exports.MDSCheckbox=Fr;exports.MDSCombobox=Wr;exports.MDSConfirmActionDialog=ac;exports.MDSConfirmDeleteDialog=vc;exports.MDSDatePicker=Vr;exports.MDSDateRangePicker=Br;exports.MDSDialogAction=xc;exports.MDSDialogActions=Kr;exports.MDSDialogBody=Xr;exports.MDSDialogWrapper=Tc;exports.MDSInput=Qt;exports.MDSPinInput=Pc;exports.MDSRefreshButton=hn;exports.MDSSelectBox=Yr;exports.MDSTooltip=mu;exports.OptionsClientImpl=nn;exports.OptionsProvider=nu;exports.OptionsStore=Jr;exports.RefreshButton=hn;exports.StackedDateTime=tu;exports.VISIBILITY_COLUMN_ID=he;exports.addPreset=Ur;exports.deletePreset=Gr;exports.formatDateTime=en;exports.getColumnWidthKey=Rt;exports.getOption=su;exports.getPresets=Tt;exports.loadOrder=Kl;exports.prefetchOptions=iu;exports.saveOrder=Xl;exports.savePresets=fn;exports.setColumnWidth=Ci;exports.setData=_r;exports.setTableId=kr;exports.tableStore=ne;exports.useDebouncedSearch=lu;exports.useOption=ru;exports.useOptions=ou;exports.usePagination=au;exports.withChildren=y;