@mdspl/mds-shared-ui 0.8.1 → 0.8.2

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