@mdspl/mds-shared-ui 1.4.8 → 1.4.9

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