@mdspl/mds-shared-ui 0.2.4 → 0.2.5
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 +3 -3
- package/dist/index.js +321 -321
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react"),c=require("@chakra-ui/react"),Ue=require("react-dom");var st={exports:{}},Be={};var ln;function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react"),c=require("@chakra-ui/react"),Ue=require("react-dom");var st={exports:{}},Be={};var ln;function Tr(){if(ln)return Be;ln=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,o,s){var i=null;if(s!==void 0&&(i=""+s),o.key!==void 0&&(i=""+o.key),"key"in o){s={};for(var l in o)l!=="key"&&(s[l]=o[l])}else s=o;return o=s.ref,{$$typeof:e,type:r,key:i,ref:o!==void 0?o:null,props:s}}return Be.Fragment=t,Be.jsx=n,Be.jsxs=n,Be}var He={};var cn;function jr(){return cn||(cn=1,process.env.NODE_ENV!=="production"&&(function(){function e(b){if(b==null)return null;if(typeof b=="function")return b.$$typeof===N?null:b.displayName||b.name||null;if(typeof b=="string")return b;switch(b){case y:return"Fragment";case C:return"Profiler";case S:return"StrictMode";case D:return"Suspense";case j:return"SuspenseList";case P:return"Activity"}if(typeof b=="object")switch(typeof b.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),b.$$typeof){case v:return"Portal";case T:return b.displayName||"Context";case R:return(b._context.displayName||"Context")+".Consumer";case _:var E=b.render;return b=b.displayName,b||(b=E.displayName||E.name||"",b=b!==""?"ForwardRef("+b+")":"ForwardRef"),b;case O:return E=b.displayName||null,E!==null?E:e(b.type)||"Memo";case L:E=b._payload,b=b._init;try{return e(b(E))}catch{}}return null}function t(b){return""+b}function n(b){try{t(b);var E=!1}catch{E=!0}if(E){E=console;var I=E.error,A=typeof Symbol=="function"&&Symbol.toStringTag&&b[Symbol.toStringTag]||b.constructor.name||"Object";return I.call(E,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",A),t(b)}}function r(b){if(b===y)return"<>";if(typeof b=="object"&&b!==null&&b.$$typeof===L)return"<...>";try{var E=e(b);return E?"<"+E+">":"<...>"}catch{return"<...>"}}function o(){var b=U.A;return b===null?null:b.getOwner()}function s(){return Error("react-stack-top-frame")}function i(b){if(X.call(b,"key")){var E=Object.getOwnPropertyDescriptor(b,"key").get;if(E&&E.isReactWarning)return!1}return b.key!==void 0}function l(b,E){function I(){Re||(Re=!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)",E))}I.isReactWarning=!0,Object.defineProperty(b,"key",{get:I,configurable:!0})}function u(){var b=e(this.type);return H[b]||(H[b]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),b=this.props.ref,b!==void 0?b:null}function f(b,E,I,A,le,Y){var $=I.ref;return b={$$typeof:x,type:b,key:E,props:I,_owner:A},($!==void 0?$:null)!==null?Object.defineProperty(b,"ref",{enumerable:!1,get:u}):Object.defineProperty(b,"ref",{enumerable:!1,value:null}),b._store={},Object.defineProperty(b._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(b,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(b,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:le}),Object.defineProperty(b,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Y}),Object.freeze&&(Object.freeze(b.props),Object.freeze(b)),b}function p(b,E,I,A,le,Y){var $=E.children;if($!==void 0)if(A)if(ne($)){for(A=0;A<$.length;A++)g($[A]);Object.freeze&&Object.freeze($)}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 g($);if(X.call(E,"key")){$=e(b);var G=Object.keys(E).filter(function(M){return M!=="key"});A=0<G.length?"{key: someKey, "+G.join(": ..., ")+": ...}":"{key: someKey}",ve[$+A]||(G=0<G.length?"{"+G.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} />`,A,$,G,$),ve[$+A]=!0)}if($=null,I!==void 0&&(n(I),$=""+I),i(E)&&(n(E.key),$=""+E.key),"key"in E){I={};for(var J in E)J!=="key"&&(I[J]=E[J])}else I=E;return $&&l(I,typeof b=="function"?b.displayName||b.name||"Unknown":b),f(b,$,I,o(),le,Y)}function g(b){m(b)?b._store&&(b._store.validated=1):typeof b=="object"&&b!==null&&b.$$typeof===L&&(b._payload.status==="fulfilled"?m(b._payload.value)&&b._payload.value._store&&(b._payload.value._store.validated=1):b._store&&(b._store.validated=1))}function m(b){return typeof b=="object"&&b!==null&&b.$$typeof===x}var h=d,x=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),T=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),P=Symbol.for("react.activity"),N=Symbol.for("react.client.reference"),U=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=Object.prototype.hasOwnProperty,ne=Array.isArray,he=console.createTask?console.createTask:function(){return null};h={react_stack_bottom_frame:function(b){return b()}};var Re,H={},Ee=h.react_stack_bottom_frame.bind(h,s)(),re=he(r(s)),ve={};He.Fragment=y,He.jsx=function(b,E,I){var A=1e4>U.recentlyCreatedOwnerStacks++;return p(b,E,I,!1,A?Error("react-stack-top-frame"):Ee,A?he(r(b)):re)},He.jsxs=function(b,E,I){var A=1e4>U.recentlyCreatedOwnerStacks++;return p(b,E,I,!0,A?Error("react-stack-top-frame"):Ee,A?he(r(b)):re)}})()),He}var un;function jr(){return un||(un=1,process.env.NODE_ENV==="production"?st.exports=Dr():st.exports=Tr()),st.exports}var a=jr(),it={exports:{}},Dt={},at={exports:{}},Tt={};var dn;function _r(){if(dn)return Tt;dn=1;var e=d;function t(g,m){return g===m&&(g!==0||1/g===1/m)||g!==g&&m!==m}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function l(g,m){var h=m(),x=r({inst:{value:h,getSnapshot:m}}),v=x[0].inst,y=x[1];return s(function(){v.value=h,v.getSnapshot=m,u(v)&&y({inst:v})},[g,h,m]),o(function(){return u(v)&&y({inst:v}),g(function(){u(v)&&y({inst:v})})},[g]),i(h),h}function u(g){var m=g.getSnapshot;g=g.value;try{var h=m();return!n(g,h)}catch{return!0}}function f(g,m){return m()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:l;return Tt.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,Tt}var jt={};var fn;function Or(){return fn||(fn=1,process.env.NODE_ENV!=="production"&&(function(){function e(h,x){return h===x&&(h!==0||1/h===1/x)||h!==h&&x!==x}function t(h,x){p||o.startTransition===void 0||(p=!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=x();if(!g){var y=x();s(v,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),g=!0)}y=i({inst:{value:v,getSnapshot:x}});var S=y[0].inst,C=y[1];return u(function(){S.value=v,S.getSnapshot=x,n(S)&&C({inst:S})},[h,v,x]),l(function(){return n(S)&&C({inst:S}),h(function(){n(S)&&C({inst:S})})},[h]),f(v),v}function n(h){var x=h.getSnapshot;h=h.value;try{var v=x();return!s(h,v)}catch{return!0}}function r(h,x){return x()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=d,s=typeof Object.is=="function"?Object.is:e,i=o.useState,l=o.useEffect,u=o.useLayoutEffect,f=o.useDebugValue,p=!1,g=!1,m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;jt.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:m,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),jt}var hn;function $n(){return hn||(hn=1,process.env.NODE_ENV==="production"?at.exports=_r():at.exports=Or()),at.exports}var gn;function Ir(){if(gn)return Dt;gn=1;var e=d,t=$n();function n(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,l=e.useMemo,u=e.useDebugValue;return Dt.useSyncExternalStoreWithSelector=function(f,p,g,m,h){var x=s(null);if(x.current===null){var v={hasValue:!1,value:null};x.current=v}else v=x.current;x=l(function(){function S(D){if(!C){if(C=!0,R=D,D=m(D),h!==void 0&&v.hasValue){var j=v.value;if(h(j,D))return T=j}return T=D}if(j=T,r(R,D))return j;var O=m(D);return h!==void 0&&h(j,O)?(R=D,j):(R=D,T=O)}var C=!1,R,T,_=g===void 0?null:g;return[function(){return S(p())},_===null?void 0:function(){return S(_())}]},[p,g,m,h]);var y=o(f,x[0],x[1]);return i(function(){v.hasValue=!0,v.value=y},[y]),u(y),y},Dt}var _t={};var pn;function kr(){return pn||(pn=1,process.env.NODE_ENV!=="production"&&(function(){function e(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=d,n=$n(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,i=t.useEffect,l=t.useMemo,u=t.useDebugValue;_t.useSyncExternalStoreWithSelector=function(f,p,g,m,h){var x=s(null);if(x.current===null){var v={hasValue:!1,value:null};x.current=v}else v=x.current;x=l(function(){function S(D){if(!C){if(C=!0,R=D,D=m(D),h!==void 0&&v.hasValue){var j=v.value;if(h(j,D))return T=j}return T=D}if(j=T,r(R,D))return j;var O=m(D);return h!==void 0&&h(j,O)?(R=D,j):(R=D,T=O)}var C=!1,R,T,_=g===void 0?null:g;return[function(){return S(p())},_===null?void 0:function(){return S(_())}]},[p,g,m,h]);var y=o(f,x[0],x[1]);return i(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())})()),_t}var vn;function Mr(){return vn||(vn=1,process.env.NODE_ENV==="production"?it.exports=Ir():it.exports=kr()),it.exports}var Ar=Mr();const $t=new WeakMap,Nr=new WeakMap,ht={current:[]};let Ot=!1;const lt=new Set,bn=new Map;function Pn(e){for(const t of e){if(ht.current.includes(t))continue;ht.current.push(t),t.recompute();const n=Nr.get(t);if(n)for(const r of n){const o=$t.get(r);o?.length&&Pn(o)}}}function Lr(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function $r(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Pr(e){if(lt.add(e),!Ot)try{for(Ot=!0;lt.size>0;){const t=Array.from(lt);lt.clear();for(const n of t){const r=bn.get(n)??n.prevState;n.prevState=r,Lr(n)}for(const n of t){const r=$t.get(n);r&&(ht.current.push(n),Pn(r))}for(const n of t){const r=$t.get(n);if(r)for(const o of r)$r(o)}}}finally{Ot=!1,ht.current=[],bn.clear()}}function zr(e){return typeof e=="function"}class zn{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var o,s;this.listeners.add(r);const i=(s=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:s.call(o,r,this);return()=>{this.listeners.delete(r),i?.()}},this.prevState=t,this.state=t,this.options=n}setState(t){var n,r,o;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(t):zr(t)?this.state=t(this.prevState):this.state=t,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),Pr(this)}}function Qe(e,t=r=>r,n={}){const r=n.equal??Fr;return Ar.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,r)}function Fr(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=mn(e);if(n.length!==mn(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 mn(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}function Vr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const mt=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 Ht(e){return"nodeType"in e}function q(e){var t,n;return e?Ae(e)?e:Ht(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Yt(e){const{Document:t}=q(e);return e instanceof t}function et(e){return Ae(e)?!1:e instanceof q(e).HTMLElement}function Fn(e){return e instanceof q(e).SVGElement}function Ne(e){return e?Ae(e)?e.document:Ht(e)?Yt(e)?e:et(e)||Fn(e)?e.ownerDocument:document:document:document}const fe=mt?d.useLayoutEffect:d.useEffect;function Wt(e){const t=d.useRef(e);return fe(()=>{t.current=e}),d.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 Br(){const e=d.useRef(null),t=d.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=d.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ke(e,t){t===void 0&&(t=[e]);const n=d.useRef(e);return fe(()=>{n.current!==e&&(n.current=e)},t),n}function tt(e,t){const n=d.useRef();return d.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function gt(e){const t=Wt(e),n=d.useRef(null),r=d.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function Pt(e){const t=d.useRef();return d.useEffect(()=>{t.current=e},[e]),t.current}let It={};function nt(e,t){return d.useMemo(()=>{if(t)return t;const n=It[e]==null?0:It[e]+1;return It[e]=n,e+"-"+n},[e,t])}function Vn(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((s,i)=>{const l=Object.entries(i);for(const[u,f]of l){const p=s[u];p!=null&&(s[u]=p+e*f)}return s},{...t})}}const ke=Vn(1),pt=Vn(-1);function Hr(e){return"clientX"in e&&"clientY"in e}function Ut(e){if(!e)return!1;const{KeyboardEvent:t}=q(e.target);return t&&e instanceof t}function Yr(e){if(!e)return!1;const{TouchEvent:t}=q(e.target);return t&&e instanceof t}function zt(e){if(Yr(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 Hr(e)?{x:e.clientX,y:e.clientY}:null}const Me=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[Me.Translate.toString(e),Me.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),xn="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Wr(e){return e.matches(xn)?e:e.querySelector(xn)}const Ur={display:"none"};function Gr(e){let{id:t,value:n}=e;return d.createElement("div",{id:t,style:Ur},n)}function Xr(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 d.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function qr(){const[e,t]=d.useState("");return{announce:d.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Bn=d.createContext(null);function Kr(e){const t=d.useContext(Bn);d.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Jr(){const[e]=d.useState(()=>new Set),t=d.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[d.useCallback(r=>{let{type:o,event:s}=r;e.forEach(i=>{var l;return(l=i[o])==null?void 0:l.call(i,s)})},[e]),t]}const Zr={draggable:`
|
|
6
|
+
<%s key={someKey} {...props} />`,A,$,G,$),ve[$+A]=!0)}if($=null,I!==void 0&&(n(I),$=""+I),i(E)&&(n(E.key),$=""+E.key),"key"in E){I={};for(var J in E)J!=="key"&&(I[J]=E[J])}else I=E;return $&&l(I,typeof b=="function"?b.displayName||b.name||"Unknown":b),f(b,$,I,o(),le,Y)}function g(b){m(b)?b._store&&(b._store.validated=1):typeof b=="object"&&b!==null&&b.$$typeof===L&&(b._payload.status==="fulfilled"?m(b._payload.value)&&b._payload.value._store&&(b._payload.value._store.validated=1):b._store&&(b._store.validated=1))}function m(b){return typeof b=="object"&&b!==null&&b.$$typeof===x}var h=d,x=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),T=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),P=Symbol.for("react.activity"),N=Symbol.for("react.client.reference"),U=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=Object.prototype.hasOwnProperty,ne=Array.isArray,he=console.createTask?console.createTask:function(){return null};h={react_stack_bottom_frame:function(b){return b()}};var Re,H={},Ee=h.react_stack_bottom_frame.bind(h,s)(),re=he(r(s)),ve={};He.Fragment=y,He.jsx=function(b,E,I){var A=1e4>U.recentlyCreatedOwnerStacks++;return p(b,E,I,!1,A?Error("react-stack-top-frame"):Ee,A?he(r(b)):re)},He.jsxs=function(b,E,I){var A=1e4>U.recentlyCreatedOwnerStacks++;return p(b,E,I,!0,A?Error("react-stack-top-frame"):Ee,A?he(r(b)):re)}})()),He}var un;function _r(){return un||(un=1,process.env.NODE_ENV==="production"?st.exports=Tr():st.exports=jr()),st.exports}var a=_r(),it={exports:{}},Dt={},at={exports:{}},Tt={};var dn;function Or(){if(dn)return Tt;dn=1;var e=d;function t(g,m){return g===m&&(g!==0||1/g===1/m)||g!==g&&m!==m}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function l(g,m){var h=m(),x=r({inst:{value:h,getSnapshot:m}}),v=x[0].inst,y=x[1];return s(function(){v.value=h,v.getSnapshot=m,u(v)&&y({inst:v})},[g,h,m]),o(function(){return u(v)&&y({inst:v}),g(function(){u(v)&&y({inst:v})})},[g]),i(h),h}function u(g){var m=g.getSnapshot;g=g.value;try{var h=m();return!n(g,h)}catch{return!0}}function f(g,m){return m()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:l;return Tt.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,Tt}var jt={};var fn;function Ir(){return fn||(fn=1,process.env.NODE_ENV!=="production"&&(function(){function e(h,x){return h===x&&(h!==0||1/h===1/x)||h!==h&&x!==x}function t(h,x){p||o.startTransition===void 0||(p=!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=x();if(!g){var y=x();s(v,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),g=!0)}y=i({inst:{value:v,getSnapshot:x}});var S=y[0].inst,C=y[1];return u(function(){S.value=v,S.getSnapshot=x,n(S)&&C({inst:S})},[h,v,x]),l(function(){return n(S)&&C({inst:S}),h(function(){n(S)&&C({inst:S})})},[h]),f(v),v}function n(h){var x=h.getSnapshot;h=h.value;try{var v=x();return!s(h,v)}catch{return!0}}function r(h,x){return x()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=d,s=typeof Object.is=="function"?Object.is:e,i=o.useState,l=o.useEffect,u=o.useLayoutEffect,f=o.useDebugValue,p=!1,g=!1,m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;jt.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:m,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),jt}var hn;function $n(){return hn||(hn=1,process.env.NODE_ENV==="production"?at.exports=Or():at.exports=Ir()),at.exports}var gn;function kr(){if(gn)return Dt;gn=1;var e=d,t=$n();function n(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,l=e.useMemo,u=e.useDebugValue;return Dt.useSyncExternalStoreWithSelector=function(f,p,g,m,h){var x=s(null);if(x.current===null){var v={hasValue:!1,value:null};x.current=v}else v=x.current;x=l(function(){function S(D){if(!C){if(C=!0,R=D,D=m(D),h!==void 0&&v.hasValue){var j=v.value;if(h(j,D))return T=j}return T=D}if(j=T,r(R,D))return j;var O=m(D);return h!==void 0&&h(j,O)?(R=D,j):(R=D,T=O)}var C=!1,R,T,_=g===void 0?null:g;return[function(){return S(p())},_===null?void 0:function(){return S(_())}]},[p,g,m,h]);var y=o(f,x[0],x[1]);return i(function(){v.hasValue=!0,v.value=y},[y]),u(y),y},Dt}var _t={};var pn;function Mr(){return pn||(pn=1,process.env.NODE_ENV!=="production"&&(function(){function e(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=d,n=$n(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,i=t.useEffect,l=t.useMemo,u=t.useDebugValue;_t.useSyncExternalStoreWithSelector=function(f,p,g,m,h){var x=s(null);if(x.current===null){var v={hasValue:!1,value:null};x.current=v}else v=x.current;x=l(function(){function S(D){if(!C){if(C=!0,R=D,D=m(D),h!==void 0&&v.hasValue){var j=v.value;if(h(j,D))return T=j}return T=D}if(j=T,r(R,D))return j;var O=m(D);return h!==void 0&&h(j,O)?(R=D,j):(R=D,T=O)}var C=!1,R,T,_=g===void 0?null:g;return[function(){return S(p())},_===null?void 0:function(){return S(_())}]},[p,g,m,h]);var y=o(f,x[0],x[1]);return i(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())})()),_t}var vn;function Ar(){return vn||(vn=1,process.env.NODE_ENV==="production"?it.exports=kr():it.exports=Mr()),it.exports}var Nr=Ar();const $t=new WeakMap,Lr=new WeakMap,ht={current:[]};let Ot=!1;const lt=new Set,bn=new Map;function Pn(e){for(const t of e){if(ht.current.includes(t))continue;ht.current.push(t),t.recompute();const n=Lr.get(t);if(n)for(const r of n){const o=$t.get(r);o?.length&&Pn(o)}}}function $r(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Pr(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function zr(e){if(lt.add(e),!Ot)try{for(Ot=!0;lt.size>0;){const t=Array.from(lt);lt.clear();for(const n of t){const r=bn.get(n)??n.prevState;n.prevState=r,$r(n)}for(const n of t){const r=$t.get(n);r&&(ht.current.push(n),Pn(r))}for(const n of t){const r=$t.get(n);if(r)for(const o of r)Pr(o)}}}finally{Ot=!1,ht.current=[],bn.clear()}}function Fr(e){return typeof e=="function"}class zn{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var o,s;this.listeners.add(r);const i=(s=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:s.call(o,r,this);return()=>{this.listeners.delete(r),i?.()}},this.prevState=t,this.state=t,this.options=n}setState(t){var n,r,o;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(t):Fr(t)?this.state=t(this.prevState):this.state=t,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),zr(this)}}function Qe(e,t=r=>r,n={}){const r=n.equal??Vr;return Nr.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,r)}function Vr(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=mn(e);if(n.length!==mn(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 mn(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}function Br(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const mt=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 Ht(e){return"nodeType"in e}function q(e){var t,n;return e?Ae(e)?e:Ht(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Yt(e){const{Document:t}=q(e);return e instanceof t}function et(e){return Ae(e)?!1:e instanceof q(e).HTMLElement}function Fn(e){return e instanceof q(e).SVGElement}function Ne(e){return e?Ae(e)?e.document:Ht(e)?Yt(e)?e:et(e)||Fn(e)?e.ownerDocument:document:document:document}const fe=mt?d.useLayoutEffect:d.useEffect;function Wt(e){const t=d.useRef(e);return fe(()=>{t.current=e}),d.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 Hr(){const e=d.useRef(null),t=d.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=d.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ke(e,t){t===void 0&&(t=[e]);const n=d.useRef(e);return fe(()=>{n.current!==e&&(n.current=e)},t),n}function tt(e,t){const n=d.useRef();return d.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function gt(e){const t=Wt(e),n=d.useRef(null),r=d.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function Pt(e){const t=d.useRef();return d.useEffect(()=>{t.current=e},[e]),t.current}let It={};function nt(e,t){return d.useMemo(()=>{if(t)return t;const n=It[e]==null?0:It[e]+1;return It[e]=n,e+"-"+n},[e,t])}function Vn(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((s,i)=>{const l=Object.entries(i);for(const[u,f]of l){const p=s[u];p!=null&&(s[u]=p+e*f)}return s},{...t})}}const ke=Vn(1),pt=Vn(-1);function Yr(e){return"clientX"in e&&"clientY"in e}function Ut(e){if(!e)return!1;const{KeyboardEvent:t}=q(e.target);return t&&e instanceof t}function Wr(e){if(!e)return!1;const{TouchEvent:t}=q(e.target);return t&&e instanceof t}function zt(e){if(Wr(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 Yr(e)?{x:e.clientX,y:e.clientY}:null}const Me=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[Me.Translate.toString(e),Me.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),xn="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Ur(e){return e.matches(xn)?e:e.querySelector(xn)}const Gr={display:"none"};function Xr(e){let{id:t,value:n}=e;return d.createElement("div",{id:t,style:Gr},n)}function qr(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 d.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function Kr(){const[e,t]=d.useState("");return{announce:d.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Bn=d.createContext(null);function Jr(e){const t=d.useContext(Bn);d.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Zr(){const[e]=d.useState(()=>new Set),t=d.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[d.useCallback(r=>{let{type:o,event:s}=r;e.forEach(i=>{var l;return(l=i[o])==null?void 0:l.call(i,s)})},[e]),t]}const Qr={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
|
-
`},Qr={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function eo(e){let{announcements:t=Qr,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Zr}=e;const{announce:s,announcement:i}=qr(),l=nt("DndLiveRegion"),[u,f]=d.useState(!1);if(d.useEffect(()=>{f(!0)},[]),Kr(d.useMemo(()=>({onDragStart(g){let{active:m}=g;s(t.onDragStart({active:m}))},onDragMove(g){let{active:m,over:h}=g;t.onDragMove&&s(t.onDragMove({active:m,over:h}))},onDragOver(g){let{active:m,over:h}=g;s(t.onDragOver({active:m,over:h}))},onDragEnd(g){let{active:m,over:h}=g;s(t.onDragEnd({active:m,over:h}))},onDragCancel(g){let{active:m,over:h}=g;s(t.onDragCancel({active:m,over:h}))}}),[s,t])),!u)return null;const p=d.createElement(d.Fragment,null,d.createElement(Gr,{id:r,value:o.draggable}),d.createElement(Xr,{id:l,announcement:i}));return n?Ue.createPortal(p,n):p}var F;(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"})(F||(F={}));function vt(){}function to(e,t){return d.useMemo(()=>({sensor:e,options:{}}),[e,t])}function no(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const ae=Object.freeze({x:0,y:0});function ro(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function oo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function so(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function io(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function yn(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const Hn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=yn(t,t.left,t.top),s=[];for(const i of r){const{id:l}=i,u=n.get(l);if(u){const f=ro(yn(u),o);s.push({id:l,data:{droppableContainer:i,value:f}})}}return s.sort(oo)};function ao(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),i=o-r,l=s-n;if(r<o&&n<s){const u=t.width*t.height,f=e.width*e.height,p=i*l,g=p/(u+f-p);return Number(g.toFixed(4))}return 0}const lo=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const s of r){const{id:i}=s,l=n.get(i);if(l){const u=ao(l,t);u>0&&o.push({id:i,data:{droppableContainer:s,value:u}})}}return o.sort(so)};function co(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Yn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ae}function uo(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];return o.reduce((i,l)=>({...i,top:i.top+e*l.y,bottom:i.bottom+e*l.y,left:i.left+e*l.x,right:i.right+e*l.x}),{...n})}}const fo=uo(1);function ho(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 go(e,t,n){const r=ho(t);if(!r)return e;const{scaleX:o,scaleY:s,x:i,y:l}=r,u=e.left-i-(1-o)*parseFloat(n),f=e.top-l-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),p=o?e.width/o:e.width,g=s?e.height/s:e.height;return{width:p,height:g,top:f,right:u+p,bottom:f+g,left:u}}const po={ignoreTransform:!1};function Le(e,t){t===void 0&&(t=po);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:f,transformOrigin:p}=q(e).getComputedStyle(e);f&&(n=go(n,f,p))}const{top:r,left:o,width:s,height:i,bottom:l,right:u}=n;return{top:r,left:o,width:s,height:i,bottom:l,right:u}}function Sn(e){return Le(e,{ignoreTransform:!0})}function vo(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function bo(e,t){return t===void 0&&(t=q(e).getComputedStyle(e)),t.position==="fixed"}function mo(e,t){t===void 0&&(t=q(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 Gt(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(Yt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!et(o)||Fn(o)||n.includes(o))return n;const s=q(e).getComputedStyle(o);return o!==e&&mo(o,s)&&n.push(o),bo(o,s)?n:r(o.parentNode)}return e?r(e):n}function Wn(e){const[t]=Gt(e,1);return t??null}function kt(e){return!mt||!e?null:Ae(e)?e:Ht(e)?Yt(e)||e===Ne(e).scrollingElement?window:et(e)?e:null:null}function Un(e){return Ae(e)?e.scrollX:e.scrollLeft}function Gn(e){return Ae(e)?e.scrollY:e.scrollTop}function Ft(e){return{x:Un(e),y:Gn(e)}}var V;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(V||(V={}));function Xn(e){return!mt||!e?!1:e===document.scrollingElement}function qn(e){const t={x:0,y:0},n=Xn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,i=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:o,isLeft:s,isBottom:i,isRight:l,maxScroll:r,minScroll:t}}const xo={x:.2,y:.2};function yo(e,t,n,r,o){let{top:s,left:i,right:l,bottom:u}=n;r===void 0&&(r=10),o===void 0&&(o=xo);const{isTop:f,isBottom:p,isLeft:g,isRight:m}=qn(e),h={x:0,y:0},x={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!f&&s<=t.top+v.height?(h.y=V.Backward,x.y=r*Math.abs((t.top+v.height-s)/v.height)):!p&&u>=t.bottom-v.height&&(h.y=V.Forward,x.y=r*Math.abs((t.bottom-v.height-u)/v.height)),!m&&l>=t.right-v.width?(h.x=V.Forward,x.x=r*Math.abs((t.right-v.width-l)/v.width)):!g&&i<=t.left+v.width&&(h.x=V.Backward,x.x=r*Math.abs((t.left+v.width-i)/v.width)),{direction:h,speed:x}}function So(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:i}=window;return{top:0,left:0,right:s,bottom:i,width:s,height:i}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Kn(e){return e.reduce((t,n)=>ke(t,Ft(n)),ae)}function wo(e){return e.reduce((t,n)=>t+Un(n),0)}function Co(e){return e.reduce((t,n)=>t+Gn(n),0)}function Ro(e,t){if(t===void 0&&(t=Le),!e)return;const{top:n,left:r,bottom:o,right:s}=t(e);Wn(e)&&(o<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Eo=[["x",["left","right"],wo],["y",["top","bottom"],Co]];class Xt{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=Gt(n),o=Kn(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,i,l]of Eo)for(const u of i)Object.defineProperty(this,u,{get:()=>{const f=l(r),p=o[s]-f;return this.rect[u]+p},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 Do(e){const{EventTarget:t}=q(e);return e instanceof t?e:Ne(e)}function Mt(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 se;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(se||(se={}));function wn(e){e.preventDefault()}function To(e){e.stopPropagation()}var k;(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"})(k||(k={}));const Jn={start:[k.Space,k.Enter],cancel:[k.Esc],end:[k.Space,k.Enter,k.Tab]},jo=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case k.Right:return{...n,x:n.x+25};case k.Left:return{...n,x:n.x-25};case k.Down:return{...n,y:n.y+25};case k.Up:return{...n,y:n.y-25}}};class Zn{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(Ne(n)),this.windowListeners=new Ge(q(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(se.Resize,this.handleCancel),this.windowListeners.add(se.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(se.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Ro(r),n(ae)}handleKeyDown(t){if(Ut(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=Jn,coordinateGetter:i=jo,scrollBehavior:l="smooth"}=o,{code:u}=t;if(s.end.includes(u)){this.handleEnd(t);return}if(s.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:f}=r.current,p=f?{x:f.left,y:f.top}:ae;this.referenceCoordinates||(this.referenceCoordinates=p);const g=i(t,{active:n,context:r.current,currentCoordinates:p});if(g){const m=pt(g,p),h={x:0,y:0},{scrollableAncestors:x}=r.current;for(const v of x){const y=t.code,{isTop:S,isRight:C,isLeft:R,isBottom:T,maxScroll:_,minScroll:D}=qn(v),j=So(v),O={x:Math.min(y===k.Right?j.right-j.width/2:j.right,Math.max(y===k.Right?j.left:j.left+j.width/2,g.x)),y:Math.min(y===k.Down?j.bottom-j.height/2:j.bottom,Math.max(y===k.Down?j.top:j.top+j.height/2,g.y))},L=y===k.Right&&!C||y===k.Left&&!R,P=y===k.Down&&!T||y===k.Up&&!S;if(L&&O.x!==g.x){const N=v.scrollLeft+m.x,U=y===k.Right&&N<=_.x||y===k.Left&&N>=D.x;if(U&&!m.y){v.scrollTo({left:N,behavior:l});return}U?h.x=v.scrollLeft-N:h.x=y===k.Right?v.scrollLeft-_.x:v.scrollLeft-D.x,h.x&&v.scrollBy({left:-h.x,behavior:l});break}else if(P&&O.y!==g.y){const N=v.scrollTop+m.y,U=y===k.Down&&N<=_.y||y===k.Up&&N>=D.y;if(U&&!m.x){v.scrollTo({top:N,behavior:l});return}U?h.y=v.scrollTop-N:h.y=y===k.Down?v.scrollTop-_.y:v.scrollTop-D.y,h.y&&v.scrollBy({top:-h.y,behavior:l});break}}this.handleMove(t,ke(pt(g,this.referenceCoordinates),h))}}}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()}}Zn.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Jn,onActivation:o}=t,{active:s}=n;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const l=s.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function Cn(e){return!!(e&&"distance"in e)}function Rn(e){return!!(e&&"delay"in e)}class qt{constructor(t,n,r){var o;r===void 0&&(r=Do(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:s}=t,{target:i}=s;this.props=t,this.events=n,this.document=Ne(i),this.documentListeners=new Ge(this.document),this.listeners=new Ge(r),this.windowListeners=new Ge(q(i)),this.initialCoordinates=(o=zt(s))!=null?o:ae,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(se.Resize,this.handleCancel),this.windowListeners.add(se.DragStart,wn),this.windowListeners.add(se.VisibilityChange,this.handleCancel),this.windowListeners.add(se.ContextMenu,wn),this.documentListeners.add(se.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(Cn(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(se.Click,To,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(se.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:s}=this,{onMove:i,options:{activationConstraint:l}}=s;if(!o)return;const u=(n=zt(t))!=null?n:ae,f=pt(o,u);if(!r&&l){if(Cn(l)){if(l.tolerance!=null&&Mt(f,l.tolerance))return this.handleCancel();if(Mt(f,l.distance))return this.handleStart()}if(Rn(l)&&Mt(f,l.tolerance))return this.handleCancel();this.handlePending(l,f);return}t.cancelable&&t.preventDefault(),i(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===k.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const _o={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Kt extends qt{constructor(t){const{event:n}=t,r=Ne(n.target);super(t,_o,r)}}Kt.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 Oo={move:{name:"mousemove"},end:{name:"mouseup"}};var Vt;(function(e){e[e.RightClick=2]="RightClick"})(Vt||(Vt={}));class Io extends qt{constructor(t){super(t,Oo,Ne(t.event.target))}}Io.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Vt.RightClick?!1:(r?.({event:n}),!0)}}];const At={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class ko extends qt{constructor(t){super(t,At)}static setup(){return window.addEventListener(At.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(At.move.name,t)};function t(){}}}ko.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var Xe;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Xe||(Xe={}));var bt;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(bt||(bt={}));function Mo(e){let{acceleration:t,activator:n=Xe.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:i=5,order:l=bt.TreeOrder,pointerCoordinates:u,scrollableAncestors:f,scrollableAncestorRects:p,delta:g,threshold:m}=e;const h=No({delta:g,disabled:!s}),[x,v]=Br(),y=d.useRef({x:0,y:0}),S=d.useRef({x:0,y:0}),C=d.useMemo(()=>{switch(n){case Xe.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case Xe.DraggableRect:return o}},[n,o,u]),R=d.useRef(null),T=d.useCallback(()=>{const D=R.current;if(!D)return;const j=y.current.x*S.current.x,O=y.current.y*S.current.y;D.scrollBy(j,O)},[]),_=d.useMemo(()=>l===bt.TreeOrder?[...f].reverse():f,[l,f]);d.useEffect(()=>{if(!s||!f.length||!C){v();return}for(const D of _){if(r?.(D)===!1)continue;const j=f.indexOf(D),O=p[j];if(!O)continue;const{direction:L,speed:P}=yo(D,O,C,t,m);for(const N of["x","y"])h[N][L[N]]||(P[N]=0,L[N]=0);if(P.x>0||P.y>0){v(),R.current=D,x(T,i),y.current=P,S.current=L;return}}y.current={x:0,y:0},S.current={x:0,y:0},v()},[t,T,r,v,s,i,JSON.stringify(C),JSON.stringify(h),x,f,_,p,JSON.stringify(m)])}const Ao={x:{[V.Backward]:!1,[V.Forward]:!1},y:{[V.Backward]:!1,[V.Forward]:!1}};function No(e){let{delta:t,disabled:n}=e;const r=Pt(t);return tt(o=>{if(n||!r||!o)return Ao;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[V.Backward]:o.x[V.Backward]||s.x===-1,[V.Forward]:o.x[V.Forward]||s.x===1},y:{[V.Backward]:o.y[V.Backward]||s.y===-1,[V.Forward]:o.y[V.Forward]||s.y===1}}},[n,t,r])}function Lo(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return tt(o=>{var s;return t==null?null:(s=r??o)!=null?s:null},[r,t])}function $o(e,t){return d.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,s=o.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,r)}));return[...n,...s]},[]),[e,t])}var Je;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Je||(Je={}));var Bt;(function(e){e.Optimized="optimized"})(Bt||(Bt={}));const En=new Map;function Po(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,i]=d.useState(null),{frequency:l,measure:u,strategy:f}=o,p=d.useRef(e),g=y(),m=Ke(g),h=d.useCallback(function(S){S===void 0&&(S=[]),!m.current&&i(C=>C===null?S:C.concat(S.filter(R=>!C.includes(R))))},[m]),x=d.useRef(null),v=tt(S=>{if(g&&!n)return En;if(!S||S===En||p.current!==e||s!=null){const C=new Map;for(let R of e){if(!R)continue;if(s&&s.length>0&&!s.includes(R.id)&&R.rect.current){C.set(R.id,R.rect.current);continue}const T=R.node.current,_=T?new Xt(u(T),T):null;R.rect.current=_,_&&C.set(R.id,_)}return C}return S},[e,s,n,g,u]);return d.useEffect(()=>{p.current=e},[e]),d.useEffect(()=>{g||h()},[n,g]),d.useEffect(()=>{s&&s.length>0&&i(null)},[JSON.stringify(s)]),d.useEffect(()=>{g||typeof l!="number"||x.current!==null||(x.current=setTimeout(()=>{h(),x.current=null},l))},[l,g,h,...r]),{droppableRects:v,measureDroppableContainers:h,measuringScheduled:s!=null};function y(){switch(f){case Je.Always:return!1;case Je.BeforeDragging:return n;default:return!n}}}function Qn(e,t){return tt(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function zo(e,t){return Qn(e,t)}function Fo(e){let{callback:t,disabled:n}=e;const r=Wt(t),o=d.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return d.useEffect(()=>()=>o?.disconnect(),[o]),o}function xt(e){let{callback:t,disabled:n}=e;const r=Wt(t),o=d.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return d.useEffect(()=>()=>o?.disconnect(),[o]),o}function Vo(e){return new Xt(Le(e),e)}function Dn(e,t,n){t===void 0&&(t=Vo);const[r,o]=d.useState(null);function s(){o(u=>{if(!e)return null;if(e.isConnected===!1){var f;return(f=u??n)!=null?f:null}const p=t(e);return JSON.stringify(u)===JSON.stringify(p)?u:p})}const i=Fo({callback(u){if(e)for(const f of u){const{type:p,target:g}=f;if(p==="childList"&&g instanceof HTMLElement&&g.contains(e)){s();break}}}}),l=xt({callback:s});return fe(()=>{s(),e?(l?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),i?.disconnect())},[e]),r}function Bo(e){const t=Qn(e);return Yn(e,t)}const Tn=[];function Ho(e){const t=d.useRef(e),n=tt(r=>e?r&&r!==Tn&&e&&t.current&&e.parentNode===t.current.parentNode?r:Gt(e):Tn,[e]);return d.useEffect(()=>{t.current=e},[e]),n}function Yo(e){const[t,n]=d.useState(null),r=d.useRef(e),o=d.useCallback(s=>{const i=kt(s.target);i&&n(l=>l?(l.set(i,Ft(i)),new Map(l)):null)},[]);return d.useEffect(()=>{const s=r.current;if(e!==s){i(s);const l=e.map(u=>{const f=kt(u);return f?(f.addEventListener("scroll",o,{passive:!0}),[f,Ft(f)]):null}).filter(u=>u!=null);n(l.length?new Map(l):null),r.current=e}return()=>{i(e),i(s)};function i(l){l.forEach(u=>{const f=kt(u);f?.removeEventListener("scroll",o)})}},[o,e]),d.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,i)=>ke(s,i),ae):Kn(e):ae,[e,t])}function jn(e,t){t===void 0&&(t=[]);const n=d.useRef(null);return d.useEffect(()=>{n.current=null},t),d.useEffect(()=>{const r=e!==ae;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?pt(e,n.current):ae}function Wo(e){d.useEffect(()=>{if(!mt)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 Uo(e,t){return d.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:s}=r;return n[o]=i=>{s(i,t)},n},{}),[e,t])}function er(e){return d.useMemo(()=>e?vo(e):null,[e])}const _n=[];function Go(e,t){t===void 0&&(t=Le);const[n]=e,r=er(n?q(n):null),[o,s]=d.useState(_n);function i(){s(()=>e.length?e.map(u=>Xn(u)?r:new Xt(t(u),u)):_n)}const l=xt({callback:i});return fe(()=>{l?.disconnect(),i(),e.forEach(u=>l?.observe(u))},[e]),o}function Xo(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return et(t)?t:e}function qo(e){let{measure:t}=e;const[n,r]=d.useState(null),o=d.useCallback(f=>{for(const{target:p}of f)if(et(p)){r(g=>{const m=t(p);return g?{...g,width:m.width,height:m.height}:m});break}},[t]),s=xt({callback:o}),i=d.useCallback(f=>{const p=Xo(f);s?.disconnect(),p&&s?.observe(p),r(p?t(p):null)},[t,s]),[l,u]=gt(i);return d.useMemo(()=>({nodeRef:l,rect:n,setRef:u}),[n,l,u])}const Ko=[{sensor:Kt,options:{}},{sensor:Zn,options:{}}],Jo={current:{}},ft={draggable:{measure:Sn},droppable:{measure:Sn,strategy:Je.WhileDragging,frequency:Bt.Optimized},dragOverlay:{measure:Le}};class qe 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 Zo={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new qe,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:vt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ft,measureDroppableContainers:vt,windowRect:null,measuringScheduled:!1},Qo={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:vt,draggableNodes:new Map,over:null,measureDroppableContainers:vt},yt=d.createContext(Qo),tr=d.createContext(Zo);function es(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new qe}}}function ts(e,t){switch(t.type){case F.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case F.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 F.DragEnd:case F.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case F.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new qe(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case F.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const i=new qe(e.droppable.containers);return i.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:i}}}case F.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new qe(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function ns(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=d.useContext(yt),s=Pt(r),i=Pt(n?.id);return d.useEffect(()=>{if(!t&&!r&&s&&i!=null){if(!Ut(s)||document.activeElement===s.target)return;const l=o.get(i);if(!l)return;const{activatorNode:u,node:f}=l;if(!u.current&&!f.current)return;requestAnimationFrame(()=>{for(const p of[u.current,f.current]){if(!p)continue;const g=Wr(p);if(g){g.focus();break}}})}},[r,t,o,i,s]),null}function rs(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,s)=>s({transform:o,...r}),n):n}function os(e){return d.useMemo(()=>({draggable:{...ft.draggable,...e?.draggable},droppable:{...ft.droppable,...e?.droppable},dragOverlay:{...ft.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function ss(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const s=d.useRef(!1),{x:i,y:l}=typeof o=="boolean"?{x:o,y:o}:o;fe(()=>{if(!i&&!l||!t){s.current=!1;return}if(s.current||!r)return;const f=t?.node.current;if(!f||f.isConnected===!1)return;const p=n(f),g=Yn(p,r);if(i||(g.x=0),l||(g.y=0),s.current=!0,Math.abs(g.x)>0||Math.abs(g.y)>0){const m=Wn(f);m&&m.scrollBy({top:g.y,left:g.x})}},[t,i,l,r,n])}const nr=d.createContext({...ae,scaleX:1,scaleY:1});var we;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(we||(we={}));const rr=d.memo(function(t){var n,r,o,s;let{id:i,accessibility:l,autoScroll:u=!0,children:f,sensors:p=Ko,collisionDetection:g=lo,measuring:m,modifiers:h,...x}=t;const v=d.useReducer(ts,void 0,es),[y,S]=v,[C,R]=Jr(),[T,_]=d.useState(we.Uninitialized),D=T===we.Initialized,{draggable:{active:j,nodes:O,translate:L},droppable:{containers:P}}=y,N=j!=null?O.get(j):null,U=d.useRef({initial:null,translated:null}),X=d.useMemo(()=>{var W;return j!=null?{id:j,data:(W=N?.data)!=null?W:Jo,rect:U}:null},[j,N]),ne=d.useRef(null),[he,Re]=d.useState(null),[H,Ee]=d.useState(null),re=Ke(x,Object.values(x)),ve=nt("DndDescribedBy",i),b=d.useMemo(()=>P.getEnabled(),[P]),E=os(m),{droppableRects:I,measureDroppableContainers:A,measuringScheduled:le}=Po(b,{dragging:D,dependencies:[L.x,L.y],config:E.droppable}),Y=Lo(O,j),$=d.useMemo(()=>H?zt(H):null,[H]),G=Er(),J=zo(Y,E.draggable.measure);ss({activeNode:j!=null?O.get(j):null,config:G.layoutShiftCompensation,initialRect:J,measure:E.draggable.measure});const M=Dn(Y,E.draggable.measure,J),$e=Dn(Y?Y.parentElement:null),ce=d.useRef({activatorEvent:null,active:null,activeNode:Y,collisionRect:null,collisions:null,droppableRects:I,draggableNodes:O,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),De=P.getNodeFor((n=ce.current.over)==null?void 0:n.id),ge=qo({measure:E.dragOverlay.measure}),Te=(r=ge.nodeRef.current)!=null?r:Y,je=D?(o=ge.rect)!=null?o:M:null,Qt=!!(ge.nodeRef.current&&ge.rect),en=Bo(Qt?null:M),Ct=er(Te?q(Te):null),be=Ho(D?De??Y:null),rt=Go(be),ot=rs(h,{transform:{x:L.x-en.x,y:L.y-en.y,scaleX:1,scaleY:1},activatorEvent:H,active:X,activeNodeRect:M,containerNodeRect:$e,draggingNodeRect:je,over:ce.current.over,overlayNodeRect:ge.rect,scrollableAncestors:be,scrollableAncestorRects:rt,windowRect:Ct}),tn=$?ke($,L):null,nn=Yo(be),mr=jn(nn),xr=jn(nn,[M]),_e=ke(ot,mr),Oe=je?fo(je,ot):null,Pe=X&&Oe?g({active:X,collisionRect:Oe,droppableRects:I,droppableContainers:b,pointerCoordinates:tn}):null,rn=io(Pe,"id"),[me,on]=d.useState(null),yr=Qt?ot:ke(ot,xr),Sr=co(yr,(s=me?.rect)!=null?s:null,M),Rt=d.useRef(null),sn=d.useCallback((W,Z)=>{let{sensor:Q,options:xe}=Z;if(ne.current==null)return;const oe=O.get(ne.current);if(!oe)return;const ee=W.nativeEvent,ue=new Q({active:ne.current,activeNode:oe,event:ee,options:xe,context:ce,onAbort(B){if(!O.get(B))return;const{onDragAbort:de}=re.current,pe={id:B};de?.(pe),C({type:"onDragAbort",event:pe})},onPending(B,ye,de,pe){if(!O.get(B))return;const{onDragPending:Fe}=re.current,Se={id:B,constraint:ye,initialCoordinates:de,offset:pe};Fe?.(Se),C({type:"onDragPending",event:Se})},onStart(B){const ye=ne.current;if(ye==null)return;const de=O.get(ye);if(!de)return;const{onDragStart:pe}=re.current,ze={activatorEvent:ee,active:{id:ye,data:de.data,rect:U}};Ue.unstable_batchedUpdates(()=>{pe?.(ze),_(we.Initializing),S({type:F.DragStart,initialCoordinates:B,active:ye}),C({type:"onDragStart",event:ze}),Re(Rt.current),Ee(ee)})},onMove(B){S({type:F.DragMove,coordinates:B})},onEnd:Ie(F.DragEnd),onCancel:Ie(F.DragCancel)});Rt.current=ue;function Ie(B){return async function(){const{active:de,collisions:pe,over:ze,scrollAdjustedTranslate:Fe}=ce.current;let Se=null;if(de&&Fe){const{cancelDrop:Ve}=re.current;Se={activatorEvent:ee,active:de,collisions:pe,delta:Fe,over:ze},B===F.DragEnd&&typeof Ve=="function"&&await Promise.resolve(Ve(Se))&&(B=F.DragCancel)}ne.current=null,Ue.unstable_batchedUpdates(()=>{S({type:B}),_(we.Uninitialized),on(null),Re(null),Ee(null),Rt.current=null;const Ve=B===F.DragEnd?"onDragEnd":"onDragCancel";if(Se){const Et=re.current[Ve];Et?.(Se),C({type:Ve,event:Se})}})}}},[O]),wr=d.useCallback((W,Z)=>(Q,xe)=>{const oe=Q.nativeEvent,ee=O.get(xe);if(ne.current!==null||!ee||oe.dndKit||oe.defaultPrevented)return;const ue={active:ee};W(Q,Z.options,ue)===!0&&(oe.dndKit={capturedBy:Z.sensor},ne.current=xe,sn(Q,Z))},[O,sn]),an=$o(p,wr);Wo(p),fe(()=>{M&&T===we.Initializing&&_(we.Initialized)},[M,T]),d.useEffect(()=>{const{onDragMove:W}=re.current,{active:Z,activatorEvent:Q,collisions:xe,over:oe}=ce.current;if(!Z||!Q)return;const ee={active:Z,activatorEvent:Q,collisions:xe,delta:{x:_e.x,y:_e.y},over:oe};Ue.unstable_batchedUpdates(()=>{W?.(ee),C({type:"onDragMove",event:ee})})},[_e.x,_e.y]),d.useEffect(()=>{const{active:W,activatorEvent:Z,collisions:Q,droppableContainers:xe,scrollAdjustedTranslate:oe}=ce.current;if(!W||ne.current==null||!Z||!oe)return;const{onDragOver:ee}=re.current,ue=xe.get(rn),Ie=ue&&ue.rect.current?{id:ue.id,rect:ue.rect.current,data:ue.data,disabled:ue.disabled}:null,B={active:W,activatorEvent:Z,collisions:Q,delta:{x:oe.x,y:oe.y},over:Ie};Ue.unstable_batchedUpdates(()=>{on(Ie),ee?.(B),C({type:"onDragOver",event:B})})},[rn]),fe(()=>{ce.current={activatorEvent:H,active:X,activeNode:Y,collisionRect:Oe,collisions:Pe,droppableRects:I,draggableNodes:O,draggingNode:Te,draggingNodeRect:je,droppableContainers:P,over:me,scrollableAncestors:be,scrollAdjustedTranslate:_e},U.current={initial:je,translated:Oe}},[X,Y,Pe,Oe,O,Te,je,I,P,me,be,_e]),Mo({...G,delta:L,draggingRect:Oe,pointerCoordinates:tn,scrollableAncestors:be,scrollableAncestorRects:rt});const Cr=d.useMemo(()=>({active:X,activeNode:Y,activeNodeRect:M,activatorEvent:H,collisions:Pe,containerNodeRect:$e,dragOverlay:ge,draggableNodes:O,droppableContainers:P,droppableRects:I,over:me,measureDroppableContainers:A,scrollableAncestors:be,scrollableAncestorRects:rt,measuringConfiguration:E,measuringScheduled:le,windowRect:Ct}),[X,Y,M,H,Pe,$e,ge,O,P,I,me,A,be,rt,E,le,Ct]),Rr=d.useMemo(()=>({activatorEvent:H,activators:an,active:X,activeNodeRect:M,ariaDescribedById:{draggable:ve},dispatch:S,draggableNodes:O,over:me,measureDroppableContainers:A}),[H,an,X,M,S,ve,O,me,A]);return d.createElement(Bn.Provider,{value:R},d.createElement(yt.Provider,{value:Rr},d.createElement(tr.Provider,{value:Cr},d.createElement(nr.Provider,{value:Sr},f)),d.createElement(ns,{disabled:l?.restoreFocus===!1})),d.createElement(eo,{...l,hiddenTextDescribedById:ve}));function Er(){const W=he?.autoScrollEnabled===!1,Z=typeof u=="object"?u.enabled===!1:u===!1,Q=D&&!W&&!Z;return typeof u=="object"?{...u,enabled:Q}:{enabled:Q}}}),is=d.createContext(null),On="button",as="Draggable";function ls(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=nt(as),{activators:i,activatorEvent:l,active:u,activeNodeRect:f,ariaDescribedById:p,draggableNodes:g,over:m}=d.useContext(yt),{role:h=On,roleDescription:x="draggable",tabIndex:v=0}=o??{},y=u?.id===t,S=d.useContext(y?nr:is),[C,R]=gt(),[T,_]=gt(),D=Uo(i,t),j=Ke(n);fe(()=>(g.set(t,{id:t,key:s,node:C,activatorNode:T,data:j}),()=>{const L=g.get(t);L&&L.key===s&&g.delete(t)}),[g,t]);const O=d.useMemo(()=>({role:h,tabIndex:v,"aria-disabled":r,"aria-pressed":y&&h===On?!0:void 0,"aria-roledescription":x,"aria-describedby":p.draggable}),[r,h,v,y,x,p.draggable]);return{active:u,activatorEvent:l,activeNodeRect:f,attributes:O,isDragging:y,listeners:r?void 0:D,node:C,over:m,setNodeRef:R,setActivatorNodeRef:_,transform:S}}function cs(){return d.useContext(tr)}const us="Droppable",ds={timeout:25};function fs(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=nt(us),{active:i,dispatch:l,over:u,measureDroppableContainers:f}=d.useContext(yt),p=d.useRef({disabled:n}),g=d.useRef(!1),m=d.useRef(null),h=d.useRef(null),{disabled:x,updateMeasurementsFor:v,timeout:y}={...ds,...o},S=Ke(v??r),C=d.useCallback(()=>{if(!g.current){g.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{f(Array.isArray(S.current)?S.current:[S.current]),h.current=null},y)},[y]),R=xt({callback:C,disabled:x||!i}),T=d.useCallback((O,L)=>{R&&(L&&(R.unobserve(L),g.current=!1),O&&R.observe(O))},[R]),[_,D]=gt(T),j=Ke(t);return d.useEffect(()=>{!R||!_.current||(R.disconnect(),g.current=!1,R.observe(_.current))},[_,R]),d.useEffect(()=>(l({type:F.RegisterDroppable,element:{id:r,key:s,disabled:n,node:_,rect:m,data:j}}),()=>l({type:F.UnregisterDroppable,key:s,id:r})),[r]),d.useEffect(()=>{n!==p.current.disabled&&(l({type:F.SetDroppableDisabled,id:r,key:s,disabled:n}),p.current.disabled=n)},[r,s,n,l]),{active:i,rect:m,isOver:u?.id===r,node:_,over:u,setNodeRef:D}}function St(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function hs(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function ct(e){return e!==null&&e>=0}function gs(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 ps(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const ut={scaleX:1,scaleY:1},vs=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:s,index:i}=e;const l=(t=n[o])!=null?t:r;if(!l)return null;const u=bs(n,i,o);if(i===o){const f=n[s];return f?{x:o<s?f.left+f.width-(l.left+l.width):f.left-l.left,y:0,...ut}:null}return i>o&&i<=s?{x:-l.width-u,y:0,...ut}:i<o&&i>=s?{x:l.width+u,y:0,...ut}:{x:0,y:0,...ut}};function bs(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return!r||!o&&!s?0:n<t?o?r.left-(o.left+o.width):s.left-(r.left+r.width):s?s.left-(r.left+r.width):r.left-(o.left+o.width)}const or=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const s=St(t,r,n),i=t[o],l=s[o];return!l||!i?null:{x:l.left-i.left,y:l.top-i.top,scaleX:l.width/i.width,scaleY:l.height/i.height}},dt={scaleX:1,scaleY:1},ms=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:s,overIndex:i}=e;const l=(t=s[n])!=null?t:r;if(!l)return null;if(o===n){const f=s[i];return f?{x:0,y:n<i?f.top+f.height-(l.top+l.height):f.top-l.top,...dt}:null}const u=xs(s,o,n);return o>n&&o<=i?{x:0,y:-l.height-u,...dt}:o<n&&o>=i?{x:0,y:l.height+u,...dt}:{x:0,y:0,...dt}};function xs(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 sr="Sortable",ir=d.createContext({activeIndex:-1,containerId:sr,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:or,disabled:{draggable:!1,droppable:!1}});function ar(e){let{children:t,id:n,items:r,strategy:o=or,disabled:s=!1}=e;const{active:i,dragOverlay:l,droppableRects:u,over:f,measureDroppableContainers:p}=cs(),g=nt(sr,n),m=l.rect!==null,h=d.useMemo(()=>r.map(D=>typeof D=="object"&&"id"in D?D.id:D),[r]),x=i!=null,v=i?h.indexOf(i.id):-1,y=f?h.indexOf(f.id):-1,S=d.useRef(h),C=!gs(h,S.current),R=y!==-1&&v===-1||C,T=ps(s);fe(()=>{C&&x&&p(h)},[C,h,x,p]),d.useEffect(()=>{S.current=h},[h]);const _=d.useMemo(()=>({activeIndex:v,containerId:g,disabled:T,disableTransforms:R,items:h,overIndex:y,useDragOverlay:m,sortedRects:hs(h,u),strategy:o}),[v,g,T.draggable,T.droppable,R,h,y,u,m,o]);return d.createElement(ir.Provider,{value:_},t)}const ys=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return St(n,r,o).indexOf(t)},Ss=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:s,newIndex:i,previousItems:l,previousContainerId:u,transition:f}=e;return!f||!r||l!==s&&o===i?!1:n?!0:i!==o&&t===u},ws={duration:200,easing:"ease"},lr="transform",Cs=Me.Transition.toString({property:lr,duration:0,easing:"linear"}),Rs={roleDescription:"sortable"};function Es(e){let{disabled:t,index:n,node:r,rect:o}=e;const[s,i]=d.useState(null),l=d.useRef(n);return fe(()=>{if(!t&&n!==l.current&&r.current){const u=o.current;if(u){const f=Le(r.current,{ignoreTransform:!0}),p={x:u.left-f.left,y:u.top-f.top,scaleX:u.width/f.width,scaleY:u.height/f.height};(p.x||p.y)&&i(p)}}n!==l.current&&(l.current=n)},[t,n,r,o]),d.useEffect(()=>{s&&i(null)},[s]),s}function cr(e){let{animateLayoutChanges:t=Ss,attributes:n,disabled:r,data:o,getNewIndex:s=ys,id:i,strategy:l,resizeObserverConfig:u,transition:f=ws}=e;const{items:p,containerId:g,activeIndex:m,disabled:h,disableTransforms:x,sortedRects:v,overIndex:y,useDragOverlay:S,strategy:C}=d.useContext(ir),R=Ds(r,h),T=p.indexOf(i),_=d.useMemo(()=>({sortable:{containerId:g,index:T,items:p},...o}),[g,o,T,p]),D=d.useMemo(()=>p.slice(p.indexOf(i)),[p,i]),{rect:j,node:O,isOver:L,setNodeRef:P}=fs({id:i,data:_,disabled:R.droppable,resizeObserverConfig:{updateMeasurementsFor:D,...u}}),{active:N,activatorEvent:U,activeNodeRect:X,attributes:ne,setNodeRef:he,listeners:Re,isDragging:H,over:Ee,setActivatorNodeRef:re,transform:ve}=ls({id:i,data:_,attributes:{...Rs,...n},disabled:R.draggable}),b=Vr(P,he),E=!!N,I=E&&!x&&ct(m)&&ct(y),A=!S&&H,le=A&&I?ve:null,$=I?le??(l??C)({rects:v,activeNodeRect:X,activeIndex:m,overIndex:y,index:T}):null,G=ct(m)&&ct(y)?s({id:i,items:p,activeIndex:m,overIndex:y}):T,J=N?.id,M=d.useRef({activeId:J,items:p,newIndex:G,containerId:g}),$e=p!==M.current.items,ce=t({active:N,containerId:g,isDragging:H,isSorting:E,id:i,index:T,items:p,newIndex:M.current.newIndex,previousItems:M.current.items,previousContainerId:M.current.containerId,transition:f,wasDragging:M.current.activeId!=null}),De=Es({disabled:!ce,index:T,node:O,rect:j});return d.useEffect(()=>{E&&M.current.newIndex!==G&&(M.current.newIndex=G),g!==M.current.containerId&&(M.current.containerId=g),p!==M.current.items&&(M.current.items=p)},[E,G,g,p]),d.useEffect(()=>{if(J===M.current.activeId)return;if(J!=null&&M.current.activeId==null){M.current.activeId=J;return}const Te=setTimeout(()=>{M.current.activeId=J},50);return()=>clearTimeout(Te)},[J]),{active:N,activeIndex:m,attributes:ne,data:_,rect:j,index:T,newIndex:G,items:p,isOver:L,isSorting:E,isDragging:H,listeners:Re,node:O,overIndex:y,over:Ee,setNodeRef:b,setActivatorNodeRef:re,setDroppableNodeRef:P,setDraggableNodeRef:he,transform:De??$,transition:ge()};function ge(){if(De||$e&&M.current.newIndex===T)return Cs;if(!(A&&!Ut(U)||!f)&&(E||ce))return Me.Transition.toString({...f,property:lr})}}function Ds(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}}k.Down,k.Right,k.Up,k.Left;const Ts=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),js=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),In=e=>{const t=js(e);return t.charAt(0).toUpperCase()+t.slice(1)},ur=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),_s=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var Os={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 Is=d.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...l},u)=>d.createElement("svg",{ref:u,...Os,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:ur("lucide",o),...!s&&!_s(l)&&{"aria-hidden":"true"},...l},[...i.map(([f,p])=>d.createElement(f,p)),...Array.isArray(s)?s:[s]]));const K=(e,t)=>{const n=d.forwardRef(({className:r,...o},s)=>d.createElement(Is,{ref:s,iconNode:t,className:ur(`lucide-${Ts(In(e))}`,`lucide-${e}`,r),...o}));return n.displayName=In(e),n};const ks=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Ms=K("arrow-down",ks);const As=[["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"}]],Ns=K("arrow-up-down",As);const Ls=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],$s=K("arrow-up",Ls);const Ps=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],zs=K("bookmark",Ps);const Fs=[["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"}]],kn=K("calendar",Fs);const Vs=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Bs=K("chevron-left",Vs);const Hs=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Ys=K("chevron-right",Hs);const Ws=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Us=K("columns-2",Ws);const Gs=[["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"}]],Xs=K("delete",Gs);const qs=[["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"}]],Ks=K("ellipsis",qs);const Js=[["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"}]],Zs=K("funnel",Js);const Qs=[["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"}]],ei=K("grip-vertical",Qs);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"}]],ni=K("pen",ti);const ri=[["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"}]],oi=K("settings",ri);function w(e){return d.forwardRef((t,n)=>{const{children:r,...o}=t;return a.jsx(e,{ref:n,...o,children:r})})}const dr=e=>`table_column_order_v1:${e}`,si=e=>{const{tableId:t}=te.state;localStorage.setItem(dr(t),JSON.stringify(e.map(n=>n.id))),te.setState(n=>({...n,columnOrder:e})),te.setState(n=>({...n,columnOrder:e}))},ii=e=>{te.setState(t=>({...t,visibility:{...t.visibility,[e]:!t.visibility[e]}}))};function ai(e){te.setState(t=>t.sortColumn===e?{...t,sortDirection:t.sortDirection==="asc"?"desc":"asc"}:{...t,sortColumn:e,sortDirection:"asc"})}const te=new zn({tableId:"",sortColumn:null,sortDirection:"asc",visibility:{},columnOrder:[],data:[],sortableColumns:[]});function fr(e,t){const n=e[0]??{},o=(t&&t.length?t:Object.keys(n).map(u=>({id:u,label:u}))).filter(u=>Object.prototype.hasOwnProperty.call(n,u.id)),{tableId:s}=te.state,i=JSON.parse(localStorage.getItem(dr(s))||"[]"),l=[...i.map(u=>o.find(f=>f.id===u)).filter(Boolean),...o.filter(u=>!i.includes(u.id))];te.setState(u=>({...u,data:e,columnOrder:l,visibility:l.reduce((f,p)=>(f[p.id]=!0,f),{}),sortableColumns:l.map(f=>({id:f.id,label:f.label,sortable:!0}))}))}function hr(e){te.setState(t=>({...t,tableId:e}))}const li=w(c.Menu.Trigger),ci=w(c.Menu.Positioner),ui=w(c.Menu.Content),di=w(c.Menu.Item),fi=w(c.Checkbox.Label),hi=w(c.Checkbox.HiddenInput),gi=w(c.Checkbox.Control);function pi({visibility:e,onToggle:t}){const{sortableColumns:n}=Qe(te);return a.jsxs(c.Menu.Root,{closeOnSelect:!1,children:[a.jsx(li,{asChild:!0,children:a.jsx(c.IconButton,{"aria-label":"Toggle columns",variant:"outline",size:"sm",ml:"1",children:a.jsx(Us,{size:18})})}),a.jsx(c.Portal,{children:a.jsx(ci,{children:a.jsx(ui,{minW:"220px",children:n.map(r=>{const o=!!e[r.id];return a.jsx(di,{value:r.id,closeOnSelect:!1,children:a.jsxs(c.Checkbox.Root,{checked:o,onCheckedChange:()=>t(r.id),children:[a.jsx(hi,{}),a.jsx(gi,{}),a.jsx(fi,{children:r.label})]})},r.id)})})})})]})}function vi({id:e,children:t,onClick:n,cursor:r,borderRight:o,borderRightColor:s}){const{setNodeRef:i,attributes:l,listeners:u,transform:f,transition:p}=cr({id:e});return a.jsx(c.Table.ColumnHeader,{ref:i,onClick:n,w:e==="id"?"80px":void 0,style:{transform:Me.Transform.toString(f),transition:p,cursor:r,borderRight:o,borderRightColor:s},...l,children:a.jsxs(c.HStack,{justify:"space-between",children:[t,a.jsx("span",{...u,children:a.jsx(ei,{size:12})})]})})}function bi(){const{columnOrder:e,visibility:t,sortColumn:n,sortDirection:r,sortableColumns:o}=Qe(te),s=e.map(l=>o.find(u=>u.id===l.id)).filter(l=>l!==void 0).filter(l=>t[l.id]),i=l=>{const{active:u,over:f}=l;if(!f||u.id===f.id)return;const p=e.findIndex(h=>h.id===u.id),g=e.findIndex(h=>h.id===f.id),m=St(e,p,g);si(m)};return a.jsx(c.Table.Header,{background:"gray.100",position:"sticky",top:0,p:"0",children:a.jsx(rr,{collisionDetection:Hn,onDragEnd:i,children:a.jsx(ar,{items:e.map(l=>l.id),strategy:vs,children:a.jsxs(c.Table.Row,{height:"28px",children:[s.map((l,u)=>{const f=n===l?.id;return a.jsx(vi,{id:l?.id,onClick:()=>l?.sortable&&ai(l?.id),cursor:l?.sortable?"pointer":"default",borderRight:"2px solid #dcdcdc",children:a.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,userSelect:"none"},children:[l?.label,l?.sortable&&(f?r==="asc"?a.jsx($s,{size:14}):a.jsx(Ms,{size:14}):a.jsx(Ns,{size:14,opacity:.4}))]})},l?.id)}),a.jsx(c.Table.ColumnHeader,{borderRight:"2px solid #dcdcdc",children:"Actions"}),a.jsx(c.Table.ColumnHeader,{boxSize:"0.5",children:a.jsx(pi,{visibility:t,onToggle:ii})})]})})})})}const Mn=c.createListCollection({items:[{label:"10",value:"10"},{label:"20",value:"20"},{label:"50",value:"50"},{label:"100",value:"100"}]}),mi=w(c.Select.Positioner),xi=w(c.Select.Content),yi=w(c.Select.Item),Si=w(c.Pagination.PrevTrigger),wi=w(c.Pagination.NextTrigger),Ci=w(c.Select.HiddenSelect),Ri=w(c.Select.Control),Ei=w(c.Select.Trigger),Di=w(c.Select.ValueText),Ti=w(c.Select.IndicatorGroup),ji=w(c.Select.Indicator);function _i({totalCount:e,pageSize:t,currentPage:n,onPageChange:r,onPageSizeChange:o,siblingCount:s=2}){return a.jsx(c.Box,{width:"100%",children:a.jsxs(c.HStack,{justify:"space-between",mx:"auto",flexWrap:"wrap",children:[a.jsxs(c.HStack,{children:[a.jsx(c.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:"Rows per page:"}),a.jsxs(c.Select.Root,{collection:Mn,size:"sm",width:"60px",onValueChange:i=>o&&o(Number(i.items[0].value)),value:[String(t)],children:[a.jsx(Ci,{}),a.jsxs(Ri,{children:[a.jsx(Ei,{children:a.jsx(Di,{placeholder:""})}),a.jsx(Ti,{children:a.jsx(ji,{})})]}),a.jsx(c.Portal,{children:a.jsx(mi,{children:a.jsx(xi,{children:Mn.items.map(i=>a.jsxs(yi,{item:i.value,children:[i.label,a.jsx(c.Select.ItemIndicator,{})]},i.value))})})})]})]}),a.jsx(c.Pagination.Root,{count:e,pageSize:t,page:n,siblingCount:s,onPageChange:i=>r&&r(i.page),children:a.jsxs(c.ButtonGroup,{size:"sm",variant:"ghost",children:[a.jsx(Si,{asChild:!0,children:a.jsx(c.IconButton,{"aria-label":"Previous page",children:a.jsx(Bs,{size:18})})}),a.jsx(c.Pagination.Items,{render:i=>a.jsx(c.IconButton,{variant:i.type==="page"&&i.value===n?"outline":"ghost","aria-current":i.type==="page"&&i.value===n?"page":void 0,children:i.type==="page"?i.value:"…"},i.value??i.type)}),a.jsx(wi,{asChild:!0,children:a.jsx(c.IconButton,{"aria-label":"Next page",children:a.jsx(Ys,{size:18})})})]})})]})})}const Oi=w(c.Menu.Item),Ii=w(c.Menu.Content),ki=w(c.Menu.Positioner),Mi=w(c.Menu.Trigger);function Ai({data:e=[],actions:t=[]}){const{columnOrder:n,visibility:r}=Qe(te);return a.jsx(c.Table.Body,{children:e.map(o=>a.jsxs(c.Table.Row,{children:[n.filter(s=>r[s.id]).map(s=>a.jsx(c.Table.Cell,{children:o[s.id]},s.id)),a.jsx(c.Table.Cell,{textAlign:"center",display:"flex",gap:2,children:a.jsxs(c.Menu.Root,{children:[a.jsx(Mi,{asChild:!0,children:a.jsx(c.IconButton,{"aria-label":"Open",variant:"ghost",size:"sm",children:a.jsx(Ks,{size:16})})}),a.jsx(c.Portal,{children:a.jsx(ki,{children:a.jsx(Ii,{children:t.map(s=>a.jsxs(Oi,{onClick:()=>s.onClick(o),colorScheme:s.colorScheme,value:s.label,children:[s.icon,s.label]},s.label))})})})]})})]},o.id))})}function Ni({tableId:e,data:t=[],headers:n=[],loading:r=!1,emptyMessage:o="No data",actions:s,page:i=1,pageSize:l=10,onPageChange:u,onPageSizeChange:f,density:p="sm",totalCount:g=0,paginationMode:m="client"}){d.useEffect(()=>{hr(e)},[e]),d.useEffect(()=>{fr(t,n)},[t,n]);const{sortColumn:h,sortDirection:x,data:v}=Qe(te),y=d.useMemo(()=>{const S=[...v];if(h&&S.sort((C,R)=>x==="asc"?String(C[h]).localeCompare(String(R[h])):String(R[h]).localeCompare(String(C[h]))),m==="client"){const C=i*l;return S.slice(C,C+l)}return S},[v,h,x,i,l,m]);return a.jsxs(c.Box,{h:"100%",display:"flex",flexDirection:"column",p:2,pt:2,minHeight:0,children:[a.jsx(c.Box,{flex:"1",minHeight:0,overflow:"auto",children:r?a.jsx(c.Box,{display:"flex",alignItems:"center",justifyContent:"center",h:"100%",color:"gray.500",children:"Loading..."}):y.length===0?a.jsx(c.Box,{display:"flex",alignItems:"center",justifyContent:"center",h:"100%",color:"gray.500",children:o}):a.jsxs(c.Table.Root,{variant:"outline",w:"100%",size:p,children:[a.jsx(bi,{}),a.jsx(Ai,{data:y,actions:s})]})}),a.jsx(c.Box,{mt:.5,children:a.jsx(_i,{totalCount:g,pageSize:l,currentPage:i,onPageChange:u,onPageSizeChange:S=>{f&&f(S),i>1&&u&&u(1)}})})]})}const Li=w(c.Checkbox.Root),$i=w(c.Checkbox.HiddenInput),Pi=w(c.Checkbox.Control),zi=w(c.Checkbox.Label),Fi=({value:e,onChange:t,size:n="sm",label:r,helperText:o,isDisabled:s,required:i,errorText:l})=>a.jsxs(Li,{value:e,onChange:t,size:n,children:[a.jsx($i,{}),a.jsx(Pi,{disabled:s,required:i,errorText:l,helperText:o}),r&&a.jsx(zi,{children:r})]}),z=" to ",An=10,Ce={DAY_MAX:31,MONTH_MAX:12,YEAR_MIN:1900,YEAR_MAX:2100},Jt=()=>{const e=new Date;return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}},Nn=()=>{const{year:e,month:t,day:n}=Jt();return`${String(n).padStart(2,"0")}-${String(t).padStart(2,"0")}-${e}`},Vi=()=>{const{year:e,month:t,day:n}=Jt();return`${e}-${String(t).padStart(2,"0")}-${String(n).padStart(2,"0")}`},Bi=(e,t)=>{const n=e.length,r=parseInt(e);if(!e||isNaN(r))return t;if(n===4)return r>=Ce.YEAR_MIN&&r<=Ce.YEAR_MAX?r:t;if(n>0&&n<4){const o=t.toString(),s=4-n,i=o.substring(0,s);return parseInt(i+e)}return t},Ye=e=>{if(!e?.trim())return null;const n=e.replace(/[^\d-]/g,"").split("-").filter(f=>f!=="");if(n.length===0)return null;const{year:r,month:o,day:s}=Jt();let i,l,u;return n.length===1?(i=parseInt(n[0])||s,l=o,u=r):n.length===2?(i=parseInt(n[0])||s,l=parseInt(n[1])||o,u=r):(i=parseInt(n[0])||s,l=parseInt(n[1])||o,u=Bi(n[2],r)),l=Math.max(1,Math.min(Ce.MONTH_MAX,l)),i=Math.max(1,Math.min(Ce.DAY_MAX,i)),`${u}-${String(l).padStart(2,"0")}-${String(i).padStart(2,"0")}`},ie=e=>{if(!e)return"";const[t,n,r]=e.split("-");return`${r}-${n}-${t}`},Hi=(e,t)=>{if(e[0]?.length>0){const n=parseInt(e[0]);if(isNaN(n)||n===0||e[0].length===2&&n>Ce.DAY_MAX)return t}if(e[1]?.length>0){const n=parseInt(e[1]);if(isNaN(n)||n===0||e[1].length===2&&n>Ce.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<Ce.YEAR_MIN||n>Ce.YEAR_MAX))return t}return null},We=e=>{let t=e.replace(/[^\d-]/g,"").substring(0,An);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,An),Hi(n,e)||t},Yi=w(c.Popover.Root),Wi=w(c.Popover.Trigger),Ui=w(c.Popover.Content),Gi=w(c.Popover.Positioner);function Xi({value:e,onChange:t,disabled:n=!1}){const[r="",o=""]=e?e.split("|"):[],[s,i]=d.useState(()=>r&&o?`${ie(r)}${z}${ie(o)}`:r?ie(r):""),[l,u]=d.useState(!1),f=d.useRef(null);d.useEffect(()=>{const x=v=>{v.ctrlKey&&v.key==="d"&&!v.shiftKey&&!v.metaKey&&(v.preventDefault(),f.current?.focus())};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[]);const p=x=>{let v=x;if(v.includes(z)){const[y,S=""]=v.split(z);v=`${We(y.trim())}${z}${We(S.trim())}`}else if(v.toLowerCase().includes(" to ")){const[y,S=""]=v.split(/\s+to\s+/i);v=`${We(y.trim())} to ${We(S.trim())}`}else v=We(v);i(v)},g=()=>{const x=s.trim();if(!x){t(void 0);return}if(x.includes(z)){const[v,y=""]=x.split(z).map(R=>R.trim()),S=Ye(v),C=y?Ye(y):null;if(S&&C){const[R,T]=C<S?[C,S]:[S,C],_=`${ie(R)}${z}${ie(T)}`;i(_),t(`${R}|${T}`)}else if(S&&!y)i(`${ie(S)}${z}`),t(void 0);else if(S&&y){const R=Vi(),[T,_]=R<S?[R,S]:[S,R],D=`${ie(T)}${z}${ie(_)}`;i(D),t(`${T}|${_}`)}else i(""),t(void 0)}else{const v=Ye(x);v?(i(`${ie(v)}${z}`),t(void 0)):(i(""),t(void 0))}},m=x=>{if(x.key!=="Enter")return;x.preventDefault();const v=f.current?.selectionStart||0,y=s.indexOf(z);if(!s.trim()){i(`${Nn()}${z}`);return}if(y===-1){const C=Ye(s.trim());C&&i(`${ie(C)}${z}`);return}if(v<=y+z.length){const C=s.substring(0,y).trim(),R=s.substring(y+z.length),T=Ye(C);T&&i(`${ie(T)}${z}${R}`);return}if(s.substring(y+z.length).trim())g(),f.current?.blur();else{const C=s.substring(0,y+z.length)+Nn();i(C),setTimeout(()=>{g(),f.current?.blur()},0)}},h=()=>{i(""),t(void 0)};return a.jsx(c.InputGroup,{children:a.jsx(a.Fragment,{children:a.jsxs(c.InputElement,{position:"revert",children:[a.jsxs(Yi,{open:l,onEscapeKeyDown:()=>{u(!1)},children:[a.jsx(Wi,{asChild:!0,children:a.jsx(c.IconButton,{size:"sm",variant:"ghost","aria-label":"Date range help",onClick:()=>u(x=>!x),children:a.jsx(kn,{size:16})})}),a.jsx(c.Portal,{children:a.jsx(Gi,{children:a.jsxs(Ui,{p:4,children:[a.jsx(c.PopoverArrow,{}),a.jsxs(c.VStack,{align:"start",gap:4,children:[a.jsxs(c.HStack,{children:[a.jsx(kn,{size:16}),a.jsx(c.Text,{fontWeight:"semibold",fontSize:"sm",children:"Date Range Filter"})]}),a.jsxs(c.VStack,{align:"start",gap:1,children:[a.jsx(c.Text,{fontSize:"sm",fontWeight:"medium",children:"Format:"}),a.jsxs(c.Text,{fontSize:"xs",color:"gray.600",children:["DD-MM-YYYY",z,"DD-MM-YYYY"]})]}),a.jsxs(c.VStack,{align:"start",gap:1,children:[a.jsx(c.Text,{fontSize:"sm",fontWeight:"medium",children:"Tips:"}),a.jsx(c.Text,{fontSize:"xs",children:'• "15 to 20" → assumes current month/year'}),a.jsx(c.Text,{fontSize:"xs",children:"• Leave end blank → up to today"}),a.jsx(c.Text,{fontSize:"xs",children:"• Dates auto-swapped if reversed"}),a.jsx(c.Text,{fontSize:"xs",children:"• Press Enter on empty end → fills today"})]}),a.jsxs(c.VStack,{align:"start",gap:1,children:[a.jsx(c.Text,{fontSize:"sm",fontWeight:"medium",children:"Shortcut:"}),a.jsxs(c.HStack,{children:[a.jsx(c.Kbd,{children:"Ctrl"}),a.jsx(c.Text,{children:"+"}),a.jsx(c.Kbd,{children:"D"})]})]})]})]})})})]}),a.jsx(c.Input,{ref:f,placeholder:"15-06-2025 to 20-06-2025",value:s,size:"sm",disabled:n,onChange:x=>p(x.target.value),onBlur:g,onKeyDown:m,pr:s?"10":void 0,w:"100%"}),s&&a.jsx(c.InputElement,{children:a.jsx(c.IconButton,{size:"sm",variant:"ghost","aria-label":"Clear date range",onClick:h,w:"100%"})})]})})})}const qi=w(c.Field.Root);w(c.Field.Label);const Ki=w(c.Field.HelperText),Ji=w(c.Field.ErrorText),Ln=({icon:e,value:t,onChange:n,placeholder:r,size:o="xs",variant:s="outline",width:i="100%",label:l,helperText:u,isDisabled:f=!1,required:p=!1,errorText:g})=>a.jsxs(qi,{width:i,children:[a.jsx(c.InputGroup,{startElement:e,children:a.jsx(c.Input,{value:t,onChange:m=>n?.(m.target.value),placeholder:r,size:o,variant:s,disabled:f,required:p})}),g&&a.jsx(Ji,{fontSize:"xs",children:g}),u&&a.jsx(Ki,{fontSize:"xs",children:u})]}),Zi=w(c.Field.Root),Qi=w(c.Field.HelperText),ea=w(c.Field.ErrorText),ta=w(c.Select.Root),na=w(c.Select.Label),ra=w(c.Select.Control),oa=w(c.Select.Trigger),sa=w(c.Select.ValueText),ia=w(c.Select.IndicatorGroup),aa=w(c.Select.Indicator),la=w(c.Select.Content),ca=w(c.Select.Item),ua=w(c.Select.ItemIndicator),da=w(c.Select.HiddenSelect),fa=w(c.Select.Positioner),ha=({options:e=[],label:t,value:n,onChange:r,placeholder:o,size:s="sm",width:i="100%",variant:l="outline",helperText:u,isDisabled:f,required:p,errorText:g})=>{const m=c.createListCollection({items:e});return a.jsxs(Zi,{disabled:f,required:p,children:[a.jsxs(ta,{collection:m,variant:l,size:s,width:i,value:n?[n]:[],onValueChange:h=>r?.(h.value[0]),children:[a.jsx(da,{}),t&&a.jsx(na,{children:t}),a.jsxs(ra,{children:[a.jsx(oa,{children:a.jsx(sa,{placeholder:o})}),a.jsx(ia,{children:a.jsx(aa,{})})]}),a.jsx(fa,{children:a.jsx(la,{children:m.items.map(h=>a.jsxs(ca,{item:h,children:[h.label,a.jsx(ua,{})]},h.value))})})]}),u&&a.jsx(Qi,{children:u}),g&&a.jsx(ea,{children:g})]})},gr=e=>`FILTER_PRESETS_${e??"default"}`;function ga(e){try{return JSON.parse(localStorage.getItem(gr(e))||"[]")}catch{return[]}}const Ze=new zn({}),wt=e=>{const t=Ze.state[e];if(t)return t;const n=ga(e);return Ze.setState(r=>({...r,[e]:n})),n},Zt=(e,t)=>{Ze.setState(n=>({...n,[e]:t})),localStorage.setItem(gr(e),JSON.stringify(t))},pr=(e,t)=>{const n=wt(e).filter(r=>r.id!==t);Zt(e,n)},vr=(e,t)=>{const n=[t,...wt(e)];Zt(e,n)},pa=w(c.Checkbox.Root),va=w(c.Checkbox.HiddenInput),ba=w(c.Checkbox.Control),ma=w(c.Slider.Root),xa=w(c.Slider.Track),ya=w(c.Slider.Range),Sa=w(c.Slider.Thumbs),wa=w(c.Slider.Control),Ca=({filter:e,onVisibilityChange:t,onSizeChange:n})=>{const{attributes:r,listeners:o,setNodeRef:s,transform:i,transition:l}=cr({id:e.id}),u={transform:Me.Transform.toString(i),transition:l,cursor:"grab"};return a.jsxs(c.VStack,{ref:s,style:u,align:"stretch",border:"1px solid",borderColor:"gray.200",rounded:"md",p:3,mb:3,...r,...o,children:[a.jsx(c.Text,{fontWeight:"bold",children:e.label}),a.jsxs(c.HStack,{justify:"space-between",children:[a.jsx(c.Text,{fontSize:"sm",children:"Visible"}),a.jsxs(pa,{checked:e.visible,onCheckedChange:f=>t&&t(e.id,!!f),size:"sm",children:[a.jsx(va,{}),a.jsx(ba,{})]})]}),a.jsxs(c.VStack,{align:"stretch",gap:1,children:[a.jsx(c.Text,{fontSize:"sm",children:"Size"}),a.jsx(ma,{width:"200px",min:1,max:5,step:.5,value:[e.size??1],onChange:f=>n&&n(e.id,f[0]),children:a.jsxs(wa,{children:[a.jsx(xa,{children:a.jsx(ya,{})}),a.jsx(Sa,{})]})})]})]})},Ra=w(c.Drawer.Root),Ea=w(c.Drawer.Trigger),Da=w(c.Drawer.Backdrop),Ta=w(c.Drawer.Positioner),ja=w(c.Drawer.Content),_a=w(c.Drawer.Header),Oa=w(c.Drawer.Title),Ia=w(c.Drawer.Body),ka=w(c.Drawer.Footer),Ma=w(c.Drawer.CloseTrigger),Aa=w(c.Tabs.Root),Na=w(c.Tabs.List),Nt=w(c.Tabs.Trigger),Lt=w(c.Tabs.Content),br=e=>{if(console.log(e),e.customComponent)return e.customComponent;switch(e.type){case"text":return a.jsx(Ln,{placeholder:e.label,value:e.value,onChange:e.onChange,label:""});case"number":return a.jsx(Ln,{label:e.label,value:e.value,onChange:e.onChange});case"checkbox":return a.jsx(Fi,{label:e.label,value:e.value,onChange:e.onChange});case"select":return a.jsx(ha,{label:e.label,value:e.value,onChange:e.onChange,options:e.options??[]});case"date":return a.jsx(Xi,{value:e.value,onChange:e.onChange});default:return null}},La=({filterDrawerSize:e="sm",onVisibilityChange:t,onSizeChange:n,onClear:r,filters:o,pageKey:s="default",currentFilters:i={},onLoadPreset:l,activePresetName:u,onReorder:f})=>{const g=Qe(Ze)[s]??wt(s),m=()=>{const h=prompt("Preset name?");h&&vr(s,{id:crypto.randomUUID(),name:h,date:new Date().toISOString(),filters:i})};return a.jsx(c.HStack,{wrap:"wrap",children:a.jsxs(Ra,{size:e,children:[a.jsx(Ea,{asChild:!0,children:a.jsxs(c.IconButton,{"aria-label":"Open filters",variant:"outline",size:"xs",ml:2,p:2,children:[a.jsx(Zs,{size:16}),"Filters"]})}),a.jsxs(c.Portal,{children:[a.jsx(Da,{}),a.jsx(Ta,{children:a.jsxs(ja,{children:[a.jsx(_a,{children:a.jsx(Oa,{children:"Filters"})}),a.jsx(Ia,{overflowY:"auto",pt:1,children:a.jsxs(Aa,{defaultValue:"view",children:[a.jsxs(Na,{mb:4,children:[a.jsxs(Nt,{value:"view",children:[a.jsx(ni,{size:16}),"Edit"]}),a.jsxs(Nt,{value:"settings",children:[a.jsx(oi,{size:16}),"Settings"]}),a.jsxs(Nt,{value:"presets",children:[a.jsx(zs,{size:16}),"Presets"]})]}),a.jsx(Lt,{value:"view",children:o.filter(h=>h.visible).map(h=>a.jsx(c.VStack,{align:"stretch",border:"1px solid",borderColor:"gray.200",flex:h.size??1,minW:`${(h.size??1)*100}px`,rounded:"md",p:3,mb:3,children:br(h)},h.id))}),a.jsx(Lt,{value:"settings",children:a.jsx(rr,{sensors:no(to(Kt)),collisionDetection:Hn,onDragEnd:({active:h,over:x})=>{if(!x||h.id===x.id)return;const v=o.findIndex(C=>C.id===h.id),y=o.findIndex(C=>C.id===x.id),S=St(o,v,y);f?.(S)},children:a.jsx(ar,{items:o.map(h=>h.id),strategy:ms,children:o.map(h=>a.jsx(Ca,{filter:h,onVisibilityChange:t,onSizeChange:n},h.id))})})}),a.jsx(Lt,{value:"presets",children:a.jsxs(c.VStack,{align:"stretch",mb:3,children:[a.jsx(c.Button,{size:"sm",colorScheme:"blue",onClick:m,children:"Save Current Filters"}),g.length===0&&a.jsx(c.Text,{fontSize:"xs",color:"gray.500",children:"No presets saved yet."}),g.map(h=>a.jsxs(c.HStack,{justify:"space-between",border:"1px solid",borderColor:u===h.name?"blue.300":"gray.200",rounded:"md",p:2,children:[a.jsxs(c.VStack,{align:"start",gap:0,children:[a.jsx(c.Text,{fontWeight:"bold",fontSize:"sm",children:h.name}),a.jsx(c.Text,{fontSize:"xs",color:"gray.500",children:new Date(h.date).toLocaleDateString()})]}),a.jsxs(c.HStack,{children:[a.jsx(c.Button,{size:"xs",variant:"ghost",onClick:()=>l?.(h.filters,h.name),children:"Load"}),a.jsx(c.IconButton,{size:"xs","aria-label":"Delete preset",variant:"ghost",onClick:()=>pr(s,h.id),children:a.jsx(Xs,{size:14})})]})]},h.id))]})})]})}),a.jsxs(ka,{justify:"space-between",children:[a.jsx(c.Button,{size:"sm",variant:"ghost",colorScheme:"red",onClick:()=>r&&r(),children:"Clear All"}),a.jsx(Ma,{asChild:!0,children:a.jsx(c.CloseButton,{})})]})]})})]})]})})},$a=({title:e,filters:t,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:i,pageKey:l,currentFilters:u,onLoadPreset:f,activePresetName:p,filterDrawerSize:g="sm"})=>a.jsxs(c.HStack,{wrap:"wrap",pl:2,pr:2,width:"100%",justify:"space-between",children:[e,a.jsxs(c.HStack,{gapX:1,children:[t.filter(m=>m.visible!==!1).map(m=>a.jsx(c.HStack,{flex:m.size??1,minW:`${(m.size??1)*100}px`,alignItems:"center",children:br(m)},m.id)),a.jsx(La,{filterDrawerSize:g,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:i,pageKey:l,filters:t,currentFilters:u,onLoadPreset:f,activePresetName:p})]})]}),Pa=(e,t)=>{localStorage.setItem(`FILTER_ORDER_${e}`,JSON.stringify(t))},za=e=>{try{return JSON.parse(localStorage.getItem(`FILTER_ORDER_${e}`)||"[]")}catch{return[]}},Fa=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));exports.DataTable=Ni;exports.Filters=$a;exports.MdsSharedUi=Fa;exports.addPreset=vr;exports.deletePreset=pr;exports.getPresets=wt;exports.loadOrder=za;exports.presetStore=Ze;exports.saveOrder=Pa;exports.savePresets=Zt;exports.setData=fr;exports.setTableId=hr;exports.tableStore=te;exports.withChildren=w;
|
|
10
|
+
`},eo={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function to(e){let{announcements:t=eo,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Qr}=e;const{announce:s,announcement:i}=Kr(),l=nt("DndLiveRegion"),[u,f]=d.useState(!1);if(d.useEffect(()=>{f(!0)},[]),Jr(d.useMemo(()=>({onDragStart(g){let{active:m}=g;s(t.onDragStart({active:m}))},onDragMove(g){let{active:m,over:h}=g;t.onDragMove&&s(t.onDragMove({active:m,over:h}))},onDragOver(g){let{active:m,over:h}=g;s(t.onDragOver({active:m,over:h}))},onDragEnd(g){let{active:m,over:h}=g;s(t.onDragEnd({active:m,over:h}))},onDragCancel(g){let{active:m,over:h}=g;s(t.onDragCancel({active:m,over:h}))}}),[s,t])),!u)return null;const p=d.createElement(d.Fragment,null,d.createElement(Xr,{id:r,value:o.draggable}),d.createElement(qr,{id:l,announcement:i}));return n?Ue.createPortal(p,n):p}var F;(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"})(F||(F={}));function vt(){}function no(e,t){return d.useMemo(()=>({sensor:e,options:{}}),[e,t])}function ro(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const ae=Object.freeze({x:0,y:0});function oo(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function so(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function io(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function ao(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function yn(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const Hn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=yn(t,t.left,t.top),s=[];for(const i of r){const{id:l}=i,u=n.get(l);if(u){const f=oo(yn(u),o);s.push({id:l,data:{droppableContainer:i,value:f}})}}return s.sort(so)};function lo(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),i=o-r,l=s-n;if(r<o&&n<s){const u=t.width*t.height,f=e.width*e.height,p=i*l,g=p/(u+f-p);return Number(g.toFixed(4))}return 0}const co=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const s of r){const{id:i}=s,l=n.get(i);if(l){const u=lo(l,t);u>0&&o.push({id:i,data:{droppableContainer:s,value:u}})}}return o.sort(io)};function uo(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Yn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ae}function fo(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];return o.reduce((i,l)=>({...i,top:i.top+e*l.y,bottom:i.bottom+e*l.y,left:i.left+e*l.x,right:i.right+e*l.x}),{...n})}}const ho=fo(1);function go(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function po(e,t,n){const r=go(t);if(!r)return e;const{scaleX:o,scaleY:s,x:i,y:l}=r,u=e.left-i-(1-o)*parseFloat(n),f=e.top-l-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),p=o?e.width/o:e.width,g=s?e.height/s:e.height;return{width:p,height:g,top:f,right:u+p,bottom:f+g,left:u}}const vo={ignoreTransform:!1};function Le(e,t){t===void 0&&(t=vo);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:f,transformOrigin:p}=q(e).getComputedStyle(e);f&&(n=po(n,f,p))}const{top:r,left:o,width:s,height:i,bottom:l,right:u}=n;return{top:r,left:o,width:s,height:i,bottom:l,right:u}}function Sn(e){return Le(e,{ignoreTransform:!0})}function bo(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function mo(e,t){return t===void 0&&(t=q(e).getComputedStyle(e)),t.position==="fixed"}function xo(e,t){t===void 0&&(t=q(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 Gt(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(Yt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!et(o)||Fn(o)||n.includes(o))return n;const s=q(e).getComputedStyle(o);return o!==e&&xo(o,s)&&n.push(o),mo(o,s)?n:r(o.parentNode)}return e?r(e):n}function Wn(e){const[t]=Gt(e,1);return t??null}function kt(e){return!mt||!e?null:Ae(e)?e:Ht(e)?Yt(e)||e===Ne(e).scrollingElement?window:et(e)?e:null:null}function Un(e){return Ae(e)?e.scrollX:e.scrollLeft}function Gn(e){return Ae(e)?e.scrollY:e.scrollTop}function Ft(e){return{x:Un(e),y:Gn(e)}}var V;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(V||(V={}));function Xn(e){return!mt||!e?!1:e===document.scrollingElement}function qn(e){const t={x:0,y:0},n=Xn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,i=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:o,isLeft:s,isBottom:i,isRight:l,maxScroll:r,minScroll:t}}const yo={x:.2,y:.2};function So(e,t,n,r,o){let{top:s,left:i,right:l,bottom:u}=n;r===void 0&&(r=10),o===void 0&&(o=yo);const{isTop:f,isBottom:p,isLeft:g,isRight:m}=qn(e),h={x:0,y:0},x={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!f&&s<=t.top+v.height?(h.y=V.Backward,x.y=r*Math.abs((t.top+v.height-s)/v.height)):!p&&u>=t.bottom-v.height&&(h.y=V.Forward,x.y=r*Math.abs((t.bottom-v.height-u)/v.height)),!m&&l>=t.right-v.width?(h.x=V.Forward,x.x=r*Math.abs((t.right-v.width-l)/v.width)):!g&&i<=t.left+v.width&&(h.x=V.Backward,x.x=r*Math.abs((t.left+v.width-i)/v.width)),{direction:h,speed:x}}function wo(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:i}=window;return{top:0,left:0,right:s,bottom:i,width:s,height:i}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Kn(e){return e.reduce((t,n)=>ke(t,Ft(n)),ae)}function Co(e){return e.reduce((t,n)=>t+Un(n),0)}function Ro(e){return e.reduce((t,n)=>t+Gn(n),0)}function Eo(e,t){if(t===void 0&&(t=Le),!e)return;const{top:n,left:r,bottom:o,right:s}=t(e);Wn(e)&&(o<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Do=[["x",["left","right"],Co],["y",["top","bottom"],Ro]];class Xt{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=Gt(n),o=Kn(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,i,l]of Do)for(const u of i)Object.defineProperty(this,u,{get:()=>{const f=l(r),p=o[s]-f;return this.rect[u]+p},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 To(e){const{EventTarget:t}=q(e);return e instanceof t?e:Ne(e)}function Mt(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 se;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(se||(se={}));function wn(e){e.preventDefault()}function jo(e){e.stopPropagation()}var k;(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"})(k||(k={}));const Jn={start:[k.Space,k.Enter],cancel:[k.Esc],end:[k.Space,k.Enter,k.Tab]},_o=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case k.Right:return{...n,x:n.x+25};case k.Left:return{...n,x:n.x-25};case k.Down:return{...n,y:n.y+25};case k.Up:return{...n,y:n.y-25}}};class Zn{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(Ne(n)),this.windowListeners=new Ge(q(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(se.Resize,this.handleCancel),this.windowListeners.add(se.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(se.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Eo(r),n(ae)}handleKeyDown(t){if(Ut(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=Jn,coordinateGetter:i=_o,scrollBehavior:l="smooth"}=o,{code:u}=t;if(s.end.includes(u)){this.handleEnd(t);return}if(s.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:f}=r.current,p=f?{x:f.left,y:f.top}:ae;this.referenceCoordinates||(this.referenceCoordinates=p);const g=i(t,{active:n,context:r.current,currentCoordinates:p});if(g){const m=pt(g,p),h={x:0,y:0},{scrollableAncestors:x}=r.current;for(const v of x){const y=t.code,{isTop:S,isRight:C,isLeft:R,isBottom:T,maxScroll:_,minScroll:D}=qn(v),j=wo(v),O={x:Math.min(y===k.Right?j.right-j.width/2:j.right,Math.max(y===k.Right?j.left:j.left+j.width/2,g.x)),y:Math.min(y===k.Down?j.bottom-j.height/2:j.bottom,Math.max(y===k.Down?j.top:j.top+j.height/2,g.y))},L=y===k.Right&&!C||y===k.Left&&!R,P=y===k.Down&&!T||y===k.Up&&!S;if(L&&O.x!==g.x){const N=v.scrollLeft+m.x,U=y===k.Right&&N<=_.x||y===k.Left&&N>=D.x;if(U&&!m.y){v.scrollTo({left:N,behavior:l});return}U?h.x=v.scrollLeft-N:h.x=y===k.Right?v.scrollLeft-_.x:v.scrollLeft-D.x,h.x&&v.scrollBy({left:-h.x,behavior:l});break}else if(P&&O.y!==g.y){const N=v.scrollTop+m.y,U=y===k.Down&&N<=_.y||y===k.Up&&N>=D.y;if(U&&!m.x){v.scrollTo({top:N,behavior:l});return}U?h.y=v.scrollTop-N:h.y=y===k.Down?v.scrollTop-_.y:v.scrollTop-D.y,h.y&&v.scrollBy({top:-h.y,behavior:l});break}}this.handleMove(t,ke(pt(g,this.referenceCoordinates),h))}}}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()}}Zn.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Jn,onActivation:o}=t,{active:s}=n;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const l=s.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function Cn(e){return!!(e&&"distance"in e)}function Rn(e){return!!(e&&"delay"in e)}class qt{constructor(t,n,r){var o;r===void 0&&(r=To(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:s}=t,{target:i}=s;this.props=t,this.events=n,this.document=Ne(i),this.documentListeners=new Ge(this.document),this.listeners=new Ge(r),this.windowListeners=new Ge(q(i)),this.initialCoordinates=(o=zt(s))!=null?o:ae,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(se.Resize,this.handleCancel),this.windowListeners.add(se.DragStart,wn),this.windowListeners.add(se.VisibilityChange,this.handleCancel),this.windowListeners.add(se.ContextMenu,wn),this.documentListeners.add(se.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(Cn(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(se.Click,jo,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(se.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:s}=this,{onMove:i,options:{activationConstraint:l}}=s;if(!o)return;const u=(n=zt(t))!=null?n:ae,f=pt(o,u);if(!r&&l){if(Cn(l)){if(l.tolerance!=null&&Mt(f,l.tolerance))return this.handleCancel();if(Mt(f,l.distance))return this.handleStart()}if(Rn(l)&&Mt(f,l.tolerance))return this.handleCancel();this.handlePending(l,f);return}t.cancelable&&t.preventDefault(),i(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===k.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Oo={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Kt extends qt{constructor(t){const{event:n}=t,r=Ne(n.target);super(t,Oo,r)}}Kt.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 Io={move:{name:"mousemove"},end:{name:"mouseup"}};var Vt;(function(e){e[e.RightClick=2]="RightClick"})(Vt||(Vt={}));class ko extends qt{constructor(t){super(t,Io,Ne(t.event.target))}}ko.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Vt.RightClick?!1:(r?.({event:n}),!0)}}];const At={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Mo extends qt{constructor(t){super(t,At)}static setup(){return window.addEventListener(At.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(At.move.name,t)};function t(){}}}Mo.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var Xe;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Xe||(Xe={}));var bt;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(bt||(bt={}));function Ao(e){let{acceleration:t,activator:n=Xe.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:i=5,order:l=bt.TreeOrder,pointerCoordinates:u,scrollableAncestors:f,scrollableAncestorRects:p,delta:g,threshold:m}=e;const h=Lo({delta:g,disabled:!s}),[x,v]=Hr(),y=d.useRef({x:0,y:0}),S=d.useRef({x:0,y:0}),C=d.useMemo(()=>{switch(n){case Xe.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case Xe.DraggableRect:return o}},[n,o,u]),R=d.useRef(null),T=d.useCallback(()=>{const D=R.current;if(!D)return;const j=y.current.x*S.current.x,O=y.current.y*S.current.y;D.scrollBy(j,O)},[]),_=d.useMemo(()=>l===bt.TreeOrder?[...f].reverse():f,[l,f]);d.useEffect(()=>{if(!s||!f.length||!C){v();return}for(const D of _){if(r?.(D)===!1)continue;const j=f.indexOf(D),O=p[j];if(!O)continue;const{direction:L,speed:P}=So(D,O,C,t,m);for(const N of["x","y"])h[N][L[N]]||(P[N]=0,L[N]=0);if(P.x>0||P.y>0){v(),R.current=D,x(T,i),y.current=P,S.current=L;return}}y.current={x:0,y:0},S.current={x:0,y:0},v()},[t,T,r,v,s,i,JSON.stringify(C),JSON.stringify(h),x,f,_,p,JSON.stringify(m)])}const No={x:{[V.Backward]:!1,[V.Forward]:!1},y:{[V.Backward]:!1,[V.Forward]:!1}};function Lo(e){let{delta:t,disabled:n}=e;const r=Pt(t);return tt(o=>{if(n||!r||!o)return No;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[V.Backward]:o.x[V.Backward]||s.x===-1,[V.Forward]:o.x[V.Forward]||s.x===1},y:{[V.Backward]:o.y[V.Backward]||s.y===-1,[V.Forward]:o.y[V.Forward]||s.y===1}}},[n,t,r])}function $o(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return tt(o=>{var s;return t==null?null:(s=r??o)!=null?s:null},[r,t])}function Po(e,t){return d.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,s=o.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,r)}));return[...n,...s]},[]),[e,t])}var Je;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Je||(Je={}));var Bt;(function(e){e.Optimized="optimized"})(Bt||(Bt={}));const En=new Map;function zo(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,i]=d.useState(null),{frequency:l,measure:u,strategy:f}=o,p=d.useRef(e),g=y(),m=Ke(g),h=d.useCallback(function(S){S===void 0&&(S=[]),!m.current&&i(C=>C===null?S:C.concat(S.filter(R=>!C.includes(R))))},[m]),x=d.useRef(null),v=tt(S=>{if(g&&!n)return En;if(!S||S===En||p.current!==e||s!=null){const C=new Map;for(let R of e){if(!R)continue;if(s&&s.length>0&&!s.includes(R.id)&&R.rect.current){C.set(R.id,R.rect.current);continue}const T=R.node.current,_=T?new Xt(u(T),T):null;R.rect.current=_,_&&C.set(R.id,_)}return C}return S},[e,s,n,g,u]);return d.useEffect(()=>{p.current=e},[e]),d.useEffect(()=>{g||h()},[n,g]),d.useEffect(()=>{s&&s.length>0&&i(null)},[JSON.stringify(s)]),d.useEffect(()=>{g||typeof l!="number"||x.current!==null||(x.current=setTimeout(()=>{h(),x.current=null},l))},[l,g,h,...r]),{droppableRects:v,measureDroppableContainers:h,measuringScheduled:s!=null};function y(){switch(f){case Je.Always:return!1;case Je.BeforeDragging:return n;default:return!n}}}function Qn(e,t){return tt(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Fo(e,t){return Qn(e,t)}function Vo(e){let{callback:t,disabled:n}=e;const r=Wt(t),o=d.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return d.useEffect(()=>()=>o?.disconnect(),[o]),o}function xt(e){let{callback:t,disabled:n}=e;const r=Wt(t),o=d.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return d.useEffect(()=>()=>o?.disconnect(),[o]),o}function Bo(e){return new Xt(Le(e),e)}function Dn(e,t,n){t===void 0&&(t=Bo);const[r,o]=d.useState(null);function s(){o(u=>{if(!e)return null;if(e.isConnected===!1){var f;return(f=u??n)!=null?f:null}const p=t(e);return JSON.stringify(u)===JSON.stringify(p)?u:p})}const i=Vo({callback(u){if(e)for(const f of u){const{type:p,target:g}=f;if(p==="childList"&&g instanceof HTMLElement&&g.contains(e)){s();break}}}}),l=xt({callback:s});return fe(()=>{s(),e?(l?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),i?.disconnect())},[e]),r}function Ho(e){const t=Qn(e);return Yn(e,t)}const Tn=[];function Yo(e){const t=d.useRef(e),n=tt(r=>e?r&&r!==Tn&&e&&t.current&&e.parentNode===t.current.parentNode?r:Gt(e):Tn,[e]);return d.useEffect(()=>{t.current=e},[e]),n}function Wo(e){const[t,n]=d.useState(null),r=d.useRef(e),o=d.useCallback(s=>{const i=kt(s.target);i&&n(l=>l?(l.set(i,Ft(i)),new Map(l)):null)},[]);return d.useEffect(()=>{const s=r.current;if(e!==s){i(s);const l=e.map(u=>{const f=kt(u);return f?(f.addEventListener("scroll",o,{passive:!0}),[f,Ft(f)]):null}).filter(u=>u!=null);n(l.length?new Map(l):null),r.current=e}return()=>{i(e),i(s)};function i(l){l.forEach(u=>{const f=kt(u);f?.removeEventListener("scroll",o)})}},[o,e]),d.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,i)=>ke(s,i),ae):Kn(e):ae,[e,t])}function jn(e,t){t===void 0&&(t=[]);const n=d.useRef(null);return d.useEffect(()=>{n.current=null},t),d.useEffect(()=>{const r=e!==ae;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?pt(e,n.current):ae}function Uo(e){d.useEffect(()=>{if(!mt)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 Go(e,t){return d.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:s}=r;return n[o]=i=>{s(i,t)},n},{}),[e,t])}function er(e){return d.useMemo(()=>e?bo(e):null,[e])}const _n=[];function Xo(e,t){t===void 0&&(t=Le);const[n]=e,r=er(n?q(n):null),[o,s]=d.useState(_n);function i(){s(()=>e.length?e.map(u=>Xn(u)?r:new Xt(t(u),u)):_n)}const l=xt({callback:i});return fe(()=>{l?.disconnect(),i(),e.forEach(u=>l?.observe(u))},[e]),o}function qo(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return et(t)?t:e}function Ko(e){let{measure:t}=e;const[n,r]=d.useState(null),o=d.useCallback(f=>{for(const{target:p}of f)if(et(p)){r(g=>{const m=t(p);return g?{...g,width:m.width,height:m.height}:m});break}},[t]),s=xt({callback:o}),i=d.useCallback(f=>{const p=qo(f);s?.disconnect(),p&&s?.observe(p),r(p?t(p):null)},[t,s]),[l,u]=gt(i);return d.useMemo(()=>({nodeRef:l,rect:n,setRef:u}),[n,l,u])}const Jo=[{sensor:Kt,options:{}},{sensor:Zn,options:{}}],Zo={current:{}},ft={draggable:{measure:Sn},droppable:{measure:Sn,strategy:Je.WhileDragging,frequency:Bt.Optimized},dragOverlay:{measure:Le}};class qe 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 Qo={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new qe,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:vt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ft,measureDroppableContainers:vt,windowRect:null,measuringScheduled:!1},es={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:vt,draggableNodes:new Map,over:null,measureDroppableContainers:vt},yt=d.createContext(es),tr=d.createContext(Qo);function ts(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new qe}}}function ns(e,t){switch(t.type){case F.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case F.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 F.DragEnd:case F.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case F.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new qe(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case F.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const i=new qe(e.droppable.containers);return i.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:i}}}case F.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new qe(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function rs(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=d.useContext(yt),s=Pt(r),i=Pt(n?.id);return d.useEffect(()=>{if(!t&&!r&&s&&i!=null){if(!Ut(s)||document.activeElement===s.target)return;const l=o.get(i);if(!l)return;const{activatorNode:u,node:f}=l;if(!u.current&&!f.current)return;requestAnimationFrame(()=>{for(const p of[u.current,f.current]){if(!p)continue;const g=Ur(p);if(g){g.focus();break}}})}},[r,t,o,i,s]),null}function os(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,s)=>s({transform:o,...r}),n):n}function ss(e){return d.useMemo(()=>({draggable:{...ft.draggable,...e?.draggable},droppable:{...ft.droppable,...e?.droppable},dragOverlay:{...ft.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function is(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const s=d.useRef(!1),{x:i,y:l}=typeof o=="boolean"?{x:o,y:o}:o;fe(()=>{if(!i&&!l||!t){s.current=!1;return}if(s.current||!r)return;const f=t?.node.current;if(!f||f.isConnected===!1)return;const p=n(f),g=Yn(p,r);if(i||(g.x=0),l||(g.y=0),s.current=!0,Math.abs(g.x)>0||Math.abs(g.y)>0){const m=Wn(f);m&&m.scrollBy({top:g.y,left:g.x})}},[t,i,l,r,n])}const nr=d.createContext({...ae,scaleX:1,scaleY:1});var we;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(we||(we={}));const rr=d.memo(function(t){var n,r,o,s;let{id:i,accessibility:l,autoScroll:u=!0,children:f,sensors:p=Jo,collisionDetection:g=co,measuring:m,modifiers:h,...x}=t;const v=d.useReducer(ns,void 0,ts),[y,S]=v,[C,R]=Zr(),[T,_]=d.useState(we.Uninitialized),D=T===we.Initialized,{draggable:{active:j,nodes:O,translate:L},droppable:{containers:P}}=y,N=j!=null?O.get(j):null,U=d.useRef({initial:null,translated:null}),X=d.useMemo(()=>{var W;return j!=null?{id:j,data:(W=N?.data)!=null?W:Zo,rect:U}:null},[j,N]),ne=d.useRef(null),[he,Re]=d.useState(null),[H,Ee]=d.useState(null),re=Ke(x,Object.values(x)),ve=nt("DndDescribedBy",i),b=d.useMemo(()=>P.getEnabled(),[P]),E=ss(m),{droppableRects:I,measureDroppableContainers:A,measuringScheduled:le}=zo(b,{dragging:D,dependencies:[L.x,L.y],config:E.droppable}),Y=$o(O,j),$=d.useMemo(()=>H?zt(H):null,[H]),G=Dr(),J=Fo(Y,E.draggable.measure);is({activeNode:j!=null?O.get(j):null,config:G.layoutShiftCompensation,initialRect:J,measure:E.draggable.measure});const M=Dn(Y,E.draggable.measure,J),$e=Dn(Y?Y.parentElement:null),ce=d.useRef({activatorEvent:null,active:null,activeNode:Y,collisionRect:null,collisions:null,droppableRects:I,draggableNodes:O,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),De=P.getNodeFor((n=ce.current.over)==null?void 0:n.id),ge=Ko({measure:E.dragOverlay.measure}),Te=(r=ge.nodeRef.current)!=null?r:Y,je=D?(o=ge.rect)!=null?o:M:null,Qt=!!(ge.nodeRef.current&&ge.rect),en=Ho(Qt?null:M),Ct=er(Te?q(Te):null),be=Yo(D?De??Y:null),rt=Xo(be),ot=os(h,{transform:{x:L.x-en.x,y:L.y-en.y,scaleX:1,scaleY:1},activatorEvent:H,active:X,activeNodeRect:M,containerNodeRect:$e,draggingNodeRect:je,over:ce.current.over,overlayNodeRect:ge.rect,scrollableAncestors:be,scrollableAncestorRects:rt,windowRect:Ct}),tn=$?ke($,L):null,nn=Wo(be),xr=jn(nn),yr=jn(nn,[M]),_e=ke(ot,xr),Oe=je?ho(je,ot):null,Pe=X&&Oe?g({active:X,collisionRect:Oe,droppableRects:I,droppableContainers:b,pointerCoordinates:tn}):null,rn=ao(Pe,"id"),[me,on]=d.useState(null),Sr=Qt?ot:ke(ot,yr),wr=uo(Sr,(s=me?.rect)!=null?s:null,M),Rt=d.useRef(null),sn=d.useCallback((W,Z)=>{let{sensor:Q,options:xe}=Z;if(ne.current==null)return;const oe=O.get(ne.current);if(!oe)return;const ee=W.nativeEvent,ue=new Q({active:ne.current,activeNode:oe,event:ee,options:xe,context:ce,onAbort(B){if(!O.get(B))return;const{onDragAbort:de}=re.current,pe={id:B};de?.(pe),C({type:"onDragAbort",event:pe})},onPending(B,ye,de,pe){if(!O.get(B))return;const{onDragPending:Fe}=re.current,Se={id:B,constraint:ye,initialCoordinates:de,offset:pe};Fe?.(Se),C({type:"onDragPending",event:Se})},onStart(B){const ye=ne.current;if(ye==null)return;const de=O.get(ye);if(!de)return;const{onDragStart:pe}=re.current,ze={activatorEvent:ee,active:{id:ye,data:de.data,rect:U}};Ue.unstable_batchedUpdates(()=>{pe?.(ze),_(we.Initializing),S({type:F.DragStart,initialCoordinates:B,active:ye}),C({type:"onDragStart",event:ze}),Re(Rt.current),Ee(ee)})},onMove(B){S({type:F.DragMove,coordinates:B})},onEnd:Ie(F.DragEnd),onCancel:Ie(F.DragCancel)});Rt.current=ue;function Ie(B){return async function(){const{active:de,collisions:pe,over:ze,scrollAdjustedTranslate:Fe}=ce.current;let Se=null;if(de&&Fe){const{cancelDrop:Ve}=re.current;Se={activatorEvent:ee,active:de,collisions:pe,delta:Fe,over:ze},B===F.DragEnd&&typeof Ve=="function"&&await Promise.resolve(Ve(Se))&&(B=F.DragCancel)}ne.current=null,Ue.unstable_batchedUpdates(()=>{S({type:B}),_(we.Uninitialized),on(null),Re(null),Ee(null),Rt.current=null;const Ve=B===F.DragEnd?"onDragEnd":"onDragCancel";if(Se){const Et=re.current[Ve];Et?.(Se),C({type:Ve,event:Se})}})}}},[O]),Cr=d.useCallback((W,Z)=>(Q,xe)=>{const oe=Q.nativeEvent,ee=O.get(xe);if(ne.current!==null||!ee||oe.dndKit||oe.defaultPrevented)return;const ue={active:ee};W(Q,Z.options,ue)===!0&&(oe.dndKit={capturedBy:Z.sensor},ne.current=xe,sn(Q,Z))},[O,sn]),an=Po(p,Cr);Uo(p),fe(()=>{M&&T===we.Initializing&&_(we.Initialized)},[M,T]),d.useEffect(()=>{const{onDragMove:W}=re.current,{active:Z,activatorEvent:Q,collisions:xe,over:oe}=ce.current;if(!Z||!Q)return;const ee={active:Z,activatorEvent:Q,collisions:xe,delta:{x:_e.x,y:_e.y},over:oe};Ue.unstable_batchedUpdates(()=>{W?.(ee),C({type:"onDragMove",event:ee})})},[_e.x,_e.y]),d.useEffect(()=>{const{active:W,activatorEvent:Z,collisions:Q,droppableContainers:xe,scrollAdjustedTranslate:oe}=ce.current;if(!W||ne.current==null||!Z||!oe)return;const{onDragOver:ee}=re.current,ue=xe.get(rn),Ie=ue&&ue.rect.current?{id:ue.id,rect:ue.rect.current,data:ue.data,disabled:ue.disabled}:null,B={active:W,activatorEvent:Z,collisions:Q,delta:{x:oe.x,y:oe.y},over:Ie};Ue.unstable_batchedUpdates(()=>{on(Ie),ee?.(B),C({type:"onDragOver",event:B})})},[rn]),fe(()=>{ce.current={activatorEvent:H,active:X,activeNode:Y,collisionRect:Oe,collisions:Pe,droppableRects:I,draggableNodes:O,draggingNode:Te,draggingNodeRect:je,droppableContainers:P,over:me,scrollableAncestors:be,scrollAdjustedTranslate:_e},U.current={initial:je,translated:Oe}},[X,Y,Pe,Oe,O,Te,je,I,P,me,be,_e]),Ao({...G,delta:L,draggingRect:Oe,pointerCoordinates:tn,scrollableAncestors:be,scrollableAncestorRects:rt});const Rr=d.useMemo(()=>({active:X,activeNode:Y,activeNodeRect:M,activatorEvent:H,collisions:Pe,containerNodeRect:$e,dragOverlay:ge,draggableNodes:O,droppableContainers:P,droppableRects:I,over:me,measureDroppableContainers:A,scrollableAncestors:be,scrollableAncestorRects:rt,measuringConfiguration:E,measuringScheduled:le,windowRect:Ct}),[X,Y,M,H,Pe,$e,ge,O,P,I,me,A,be,rt,E,le,Ct]),Er=d.useMemo(()=>({activatorEvent:H,activators:an,active:X,activeNodeRect:M,ariaDescribedById:{draggable:ve},dispatch:S,draggableNodes:O,over:me,measureDroppableContainers:A}),[H,an,X,M,S,ve,O,me,A]);return d.createElement(Bn.Provider,{value:R},d.createElement(yt.Provider,{value:Er},d.createElement(tr.Provider,{value:Rr},d.createElement(nr.Provider,{value:wr},f)),d.createElement(rs,{disabled:l?.restoreFocus===!1})),d.createElement(to,{...l,hiddenTextDescribedById:ve}));function Dr(){const W=he?.autoScrollEnabled===!1,Z=typeof u=="object"?u.enabled===!1:u===!1,Q=D&&!W&&!Z;return typeof u=="object"?{...u,enabled:Q}:{enabled:Q}}}),as=d.createContext(null),On="button",ls="Draggable";function cs(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=nt(ls),{activators:i,activatorEvent:l,active:u,activeNodeRect:f,ariaDescribedById:p,draggableNodes:g,over:m}=d.useContext(yt),{role:h=On,roleDescription:x="draggable",tabIndex:v=0}=o??{},y=u?.id===t,S=d.useContext(y?nr:as),[C,R]=gt(),[T,_]=gt(),D=Go(i,t),j=Ke(n);fe(()=>(g.set(t,{id:t,key:s,node:C,activatorNode:T,data:j}),()=>{const L=g.get(t);L&&L.key===s&&g.delete(t)}),[g,t]);const O=d.useMemo(()=>({role:h,tabIndex:v,"aria-disabled":r,"aria-pressed":y&&h===On?!0:void 0,"aria-roledescription":x,"aria-describedby":p.draggable}),[r,h,v,y,x,p.draggable]);return{active:u,activatorEvent:l,activeNodeRect:f,attributes:O,isDragging:y,listeners:r?void 0:D,node:C,over:m,setNodeRef:R,setActivatorNodeRef:_,transform:S}}function us(){return d.useContext(tr)}const ds="Droppable",fs={timeout:25};function hs(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=nt(ds),{active:i,dispatch:l,over:u,measureDroppableContainers:f}=d.useContext(yt),p=d.useRef({disabled:n}),g=d.useRef(!1),m=d.useRef(null),h=d.useRef(null),{disabled:x,updateMeasurementsFor:v,timeout:y}={...fs,...o},S=Ke(v??r),C=d.useCallback(()=>{if(!g.current){g.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{f(Array.isArray(S.current)?S.current:[S.current]),h.current=null},y)},[y]),R=xt({callback:C,disabled:x||!i}),T=d.useCallback((O,L)=>{R&&(L&&(R.unobserve(L),g.current=!1),O&&R.observe(O))},[R]),[_,D]=gt(T),j=Ke(t);return d.useEffect(()=>{!R||!_.current||(R.disconnect(),g.current=!1,R.observe(_.current))},[_,R]),d.useEffect(()=>(l({type:F.RegisterDroppable,element:{id:r,key:s,disabled:n,node:_,rect:m,data:j}}),()=>l({type:F.UnregisterDroppable,key:s,id:r})),[r]),d.useEffect(()=>{n!==p.current.disabled&&(l({type:F.SetDroppableDisabled,id:r,key:s,disabled:n}),p.current.disabled=n)},[r,s,n,l]),{active:i,rect:m,isOver:u?.id===r,node:_,over:u,setNodeRef:D}}function St(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function gs(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function ct(e){return e!==null&&e>=0}function ps(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function vs(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const ut={scaleX:1,scaleY:1},bs=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:s,index:i}=e;const l=(t=n[o])!=null?t:r;if(!l)return null;const u=ms(n,i,o);if(i===o){const f=n[s];return f?{x:o<s?f.left+f.width-(l.left+l.width):f.left-l.left,y:0,...ut}:null}return i>o&&i<=s?{x:-l.width-u,y:0,...ut}:i<o&&i>=s?{x:l.width+u,y:0,...ut}:{x:0,y:0,...ut}};function ms(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 or=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const s=St(t,r,n),i=t[o],l=s[o];return!l||!i?null:{x:l.left-i.left,y:l.top-i.top,scaleX:l.width/i.width,scaleY:l.height/i.height}},dt={scaleX:1,scaleY:1},xs=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:s,overIndex:i}=e;const l=(t=s[n])!=null?t:r;if(!l)return null;if(o===n){const f=s[i];return f?{x:0,y:n<i?f.top+f.height-(l.top+l.height):f.top-l.top,...dt}:null}const u=ys(s,o,n);return o>n&&o<=i?{x:0,y:-l.height-u,...dt}:o<n&&o>=i?{x:0,y:l.height+u,...dt}:{x:0,y:0,...dt}};function ys(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return r?n<t?o?r.top-(o.top+o.height):s?s.top-(r.top+r.height):0:s?s.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const sr="Sortable",ir=d.createContext({activeIndex:-1,containerId:sr,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:or,disabled:{draggable:!1,droppable:!1}});function ar(e){let{children:t,id:n,items:r,strategy:o=or,disabled:s=!1}=e;const{active:i,dragOverlay:l,droppableRects:u,over:f,measureDroppableContainers:p}=us(),g=nt(sr,n),m=l.rect!==null,h=d.useMemo(()=>r.map(D=>typeof D=="object"&&"id"in D?D.id:D),[r]),x=i!=null,v=i?h.indexOf(i.id):-1,y=f?h.indexOf(f.id):-1,S=d.useRef(h),C=!ps(h,S.current),R=y!==-1&&v===-1||C,T=vs(s);fe(()=>{C&&x&&p(h)},[C,h,x,p]),d.useEffect(()=>{S.current=h},[h]);const _=d.useMemo(()=>({activeIndex:v,containerId:g,disabled:T,disableTransforms:R,items:h,overIndex:y,useDragOverlay:m,sortedRects:gs(h,u),strategy:o}),[v,g,T.draggable,T.droppable,R,h,y,u,m,o]);return d.createElement(ir.Provider,{value:_},t)}const Ss=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return St(n,r,o).indexOf(t)},ws=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:s,newIndex:i,previousItems:l,previousContainerId:u,transition:f}=e;return!f||!r||l!==s&&o===i?!1:n?!0:i!==o&&t===u},Cs={duration:200,easing:"ease"},lr="transform",Rs=Me.Transition.toString({property:lr,duration:0,easing:"linear"}),Es={roleDescription:"sortable"};function Ds(e){let{disabled:t,index:n,node:r,rect:o}=e;const[s,i]=d.useState(null),l=d.useRef(n);return fe(()=>{if(!t&&n!==l.current&&r.current){const u=o.current;if(u){const f=Le(r.current,{ignoreTransform:!0}),p={x:u.left-f.left,y:u.top-f.top,scaleX:u.width/f.width,scaleY:u.height/f.height};(p.x||p.y)&&i(p)}}n!==l.current&&(l.current=n)},[t,n,r,o]),d.useEffect(()=>{s&&i(null)},[s]),s}function cr(e){let{animateLayoutChanges:t=ws,attributes:n,disabled:r,data:o,getNewIndex:s=Ss,id:i,strategy:l,resizeObserverConfig:u,transition:f=Cs}=e;const{items:p,containerId:g,activeIndex:m,disabled:h,disableTransforms:x,sortedRects:v,overIndex:y,useDragOverlay:S,strategy:C}=d.useContext(ir),R=Ts(r,h),T=p.indexOf(i),_=d.useMemo(()=>({sortable:{containerId:g,index:T,items:p},...o}),[g,o,T,p]),D=d.useMemo(()=>p.slice(p.indexOf(i)),[p,i]),{rect:j,node:O,isOver:L,setNodeRef:P}=hs({id:i,data:_,disabled:R.droppable,resizeObserverConfig:{updateMeasurementsFor:D,...u}}),{active:N,activatorEvent:U,activeNodeRect:X,attributes:ne,setNodeRef:he,listeners:Re,isDragging:H,over:Ee,setActivatorNodeRef:re,transform:ve}=cs({id:i,data:_,attributes:{...Es,...n},disabled:R.draggable}),b=Br(P,he),E=!!N,I=E&&!x&&ct(m)&&ct(y),A=!S&&H,le=A&&I?ve:null,$=I?le??(l??C)({rects:v,activeNodeRect:X,activeIndex:m,overIndex:y,index:T}):null,G=ct(m)&&ct(y)?s({id:i,items:p,activeIndex:m,overIndex:y}):T,J=N?.id,M=d.useRef({activeId:J,items:p,newIndex:G,containerId:g}),$e=p!==M.current.items,ce=t({active:N,containerId:g,isDragging:H,isSorting:E,id:i,index:T,items:p,newIndex:M.current.newIndex,previousItems:M.current.items,previousContainerId:M.current.containerId,transition:f,wasDragging:M.current.activeId!=null}),De=Ds({disabled:!ce,index:T,node:O,rect:j});return d.useEffect(()=>{E&&M.current.newIndex!==G&&(M.current.newIndex=G),g!==M.current.containerId&&(M.current.containerId=g),p!==M.current.items&&(M.current.items=p)},[E,G,g,p]),d.useEffect(()=>{if(J===M.current.activeId)return;if(J!=null&&M.current.activeId==null){M.current.activeId=J;return}const Te=setTimeout(()=>{M.current.activeId=J},50);return()=>clearTimeout(Te)},[J]),{active:N,activeIndex:m,attributes:ne,data:_,rect:j,index:T,newIndex:G,items:p,isOver:L,isSorting:E,isDragging:H,listeners:Re,node:O,overIndex:y,over:Ee,setNodeRef:b,setActivatorNodeRef:re,setDroppableNodeRef:P,setDraggableNodeRef:he,transform:De??$,transition:ge()};function ge(){if(De||$e&&M.current.newIndex===T)return Rs;if(!(A&&!Ut(U)||!f)&&(E||ce))return Me.Transition.toString({...f,property:lr})}}function Ts(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}}k.Down,k.Right,k.Up,k.Left;const js=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_s=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),In=e=>{const t=_s(e);return t.charAt(0).toUpperCase()+t.slice(1)},ur=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),Os=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var Is={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 ks=d.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...l},u)=>d.createElement("svg",{ref:u,...Is,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:ur("lucide",o),...!s&&!Os(l)&&{"aria-hidden":"true"},...l},[...i.map(([f,p])=>d.createElement(f,p)),...Array.isArray(s)?s:[s]]));const K=(e,t)=>{const n=d.forwardRef(({className:r,...o},s)=>d.createElement(ks,{ref:s,iconNode:t,className:ur(`lucide-${js(In(e))}`,`lucide-${e}`,r),...o}));return n.displayName=In(e),n};const Ms=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],As=K("arrow-down",Ms);const Ns=[["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"}]],Ls=K("arrow-up-down",Ns);const $s=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Ps=K("arrow-up",$s);const zs=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],Fs=K("bookmark",zs);const Vs=[["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"}]],kn=K("calendar",Vs);const Bs=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Hs=K("chevron-left",Bs);const Ys=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Ws=K("chevron-right",Ys);const Us=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Gs=K("columns-2",Us);const Xs=[["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"}]],qs=K("delete",Xs);const Ks=[["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"}]],Js=K("ellipsis",Ks);const Zs=[["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"}]],Qs=K("funnel",Zs);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"}]],dr=K("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"}]],ni=K("pen",ti);const ri=[["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"}]],oi=K("settings",ri);function w(e){return d.forwardRef((t,n)=>{const{children:r,...o}=t;return a.jsx(e,{ref:n,...o,children:r})})}const fr=e=>`table_column_order_v1:${e}`,si=e=>{const{tableId:t}=te.state;localStorage.setItem(fr(t),JSON.stringify(e.map(n=>n.id))),te.setState(n=>({...n,columnOrder:e})),te.setState(n=>({...n,columnOrder:e}))},ii=e=>{te.setState(t=>({...t,visibility:{...t.visibility,[e]:!t.visibility[e]}}))};function ai(e){te.setState(t=>t.sortColumn===e?{...t,sortDirection:t.sortDirection==="asc"?"desc":"asc"}:{...t,sortColumn:e,sortDirection:"asc"})}const te=new zn({tableId:"",sortColumn:null,sortDirection:"asc",visibility:{},columnOrder:[],data:[],sortableColumns:[]});function hr(e,t){const n=e[0]??{},o=(t&&t.length?t:Object.keys(n).map(u=>({id:u,label:u}))).filter(u=>Object.prototype.hasOwnProperty.call(n,u.id)),{tableId:s}=te.state,i=JSON.parse(localStorage.getItem(fr(s))||"[]"),l=[...i.map(u=>o.find(f=>f.id===u)).filter(Boolean),...o.filter(u=>!i.includes(u.id))];te.setState(u=>({...u,data:e,columnOrder:l,visibility:l.reduce((f,p)=>(f[p.id]=!0,f),{}),sortableColumns:l.map(f=>({id:f.id,label:f.label,sortable:!0}))}))}function gr(e){te.setState(t=>({...t,tableId:e}))}const li=w(c.Menu.Trigger),ci=w(c.Menu.Positioner),ui=w(c.Menu.Content),di=w(c.Menu.Item),fi=w(c.Checkbox.Label),hi=w(c.Checkbox.HiddenInput),gi=w(c.Checkbox.Control);function pi({visibility:e,onToggle:t}){const{sortableColumns:n}=Qe(te);return a.jsxs(c.Menu.Root,{closeOnSelect:!1,children:[a.jsx(li,{asChild:!0,children:a.jsx(c.IconButton,{"aria-label":"Toggle columns",variant:"outline",size:"sm",ml:"1",children:a.jsx(Gs,{size:18})})}),a.jsx(c.Portal,{children:a.jsx(ci,{children:a.jsx(ui,{minW:"220px",children:n.map(r=>{const o=!!e[r.id];return a.jsx(di,{value:r.id,closeOnSelect:!1,children:a.jsxs(c.Checkbox.Root,{checked:o,onCheckedChange:()=>t(r.id),children:[a.jsx(hi,{}),a.jsx(gi,{}),a.jsx(fi,{children:r.label})]})},r.id)})})})})]})}function vi({id:e,children:t,onClick:n,cursor:r,borderRight:o,borderRightColor:s}){const{setNodeRef:i,attributes:l,listeners:u,transform:f,transition:p}=cr({id:e});return a.jsx(c.Table.ColumnHeader,{ref:i,onClick:n,w:e==="id"?"80px":void 0,style:{transform:Me.Transform.toString(f),transition:p,cursor:r,borderRight:o,borderRightColor:s},...l,children:a.jsxs(c.HStack,{justify:"space-between",children:[t,a.jsx("span",{...u,children:a.jsx(dr,{size:12})})]})})}function bi(){const{columnOrder:e,visibility:t,sortColumn:n,sortDirection:r,sortableColumns:o}=Qe(te),s=e.map(l=>o.find(u=>u.id===l.id)).filter(l=>l!==void 0).filter(l=>t[l.id]),i=l=>{const{active:u,over:f}=l;if(!f||u.id===f.id)return;const p=e.findIndex(h=>h.id===u.id),g=e.findIndex(h=>h.id===f.id),m=St(e,p,g);si(m)};return a.jsx(c.Table.Header,{background:"gray.100",position:"sticky",top:0,p:"0",children:a.jsx(rr,{collisionDetection:Hn,onDragEnd:i,children:a.jsx(ar,{items:e.map(l=>l.id),strategy:bs,children:a.jsxs(c.Table.Row,{height:"28px",children:[s.map((l,u)=>{const f=n===l?.id;return a.jsx(vi,{id:l?.id,onClick:()=>l?.sortable&&ai(l?.id),cursor:l?.sortable?"pointer":"default",borderRight:"2px solid #dcdcdc",children:a.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,userSelect:"none"},children:[l?.label,l?.sortable&&(f?r==="asc"?a.jsx(Ps,{size:14}):a.jsx(As,{size:14}):a.jsx(Ls,{size:14,opacity:.4}))]})},l?.id)}),a.jsx(c.Table.ColumnHeader,{borderRight:"2px solid #dcdcdc",children:"Actions"}),a.jsx(c.Table.ColumnHeader,{boxSize:"0.5",children:a.jsx(pi,{visibility:t,onToggle:ii})})]})})})})}const Mn=c.createListCollection({items:[{label:"10",value:"10"},{label:"20",value:"20"},{label:"50",value:"50"},{label:"100",value:"100"}]}),mi=w(c.Select.Positioner),xi=w(c.Select.Content),yi=w(c.Select.Item),Si=w(c.Pagination.PrevTrigger),wi=w(c.Pagination.NextTrigger),Ci=w(c.Select.HiddenSelect),Ri=w(c.Select.Control),Ei=w(c.Select.Trigger),Di=w(c.Select.ValueText),Ti=w(c.Select.IndicatorGroup),ji=w(c.Select.Indicator);function _i({totalCount:e,pageSize:t,currentPage:n,onPageChange:r,onPageSizeChange:o,siblingCount:s=2}){return a.jsx(c.Box,{width:"100%",children:a.jsxs(c.HStack,{justify:"space-between",mx:"auto",flexWrap:"wrap",children:[a.jsxs(c.HStack,{children:[a.jsx(c.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:"Rows per page:"}),a.jsxs(c.Select.Root,{collection:Mn,size:"sm",width:"60px",onValueChange:i=>o&&o(Number(i.items[0].value)),value:[String(t)],children:[a.jsx(Ci,{}),a.jsxs(Ri,{children:[a.jsx(Ei,{children:a.jsx(Di,{placeholder:""})}),a.jsx(Ti,{children:a.jsx(ji,{})})]}),a.jsx(c.Portal,{children:a.jsx(mi,{children:a.jsx(xi,{children:Mn.items.map(i=>a.jsxs(yi,{item:i.value,children:[i.label,a.jsx(c.Select.ItemIndicator,{})]},i.value))})})})]})]}),a.jsx(c.Pagination.Root,{count:e,pageSize:t,page:n,siblingCount:s,onPageChange:i=>r&&r(i.page),children:a.jsxs(c.ButtonGroup,{size:"sm",variant:"ghost",children:[a.jsx(Si,{asChild:!0,children:a.jsx(c.IconButton,{"aria-label":"Previous page",children:a.jsx(Hs,{size:18})})}),a.jsx(c.Pagination.Items,{render:i=>a.jsx(c.IconButton,{variant:i.type==="page"&&i.value===n?"outline":"ghost","aria-current":i.type==="page"&&i.value===n?"page":void 0,children:i.type==="page"?i.value:"…"},i.value??i.type)}),a.jsx(wi,{asChild:!0,children:a.jsx(c.IconButton,{"aria-label":"Next page",children:a.jsx(Ws,{size:18})})})]})})]})})}const Oi=w(c.Menu.Item),Ii=w(c.Menu.Content),ki=w(c.Menu.Positioner),Mi=w(c.Menu.Trigger);function Ai({data:e=[],actions:t=[]}){const{columnOrder:n,visibility:r}=Qe(te);return a.jsx(c.Table.Body,{children:e.map(o=>a.jsxs(c.Table.Row,{children:[n.filter(s=>r[s.id]).map(s=>a.jsx(c.Table.Cell,{children:o[s.id]},s.id)),a.jsx(c.Table.Cell,{textAlign:"center",display:"flex",gap:2,children:a.jsxs(c.Menu.Root,{children:[a.jsx(Mi,{asChild:!0,children:a.jsx(c.IconButton,{"aria-label":"Open",variant:"ghost",size:"sm",children:a.jsx(Js,{size:16})})}),a.jsx(c.Portal,{children:a.jsx(ki,{children:a.jsx(Ii,{children:t.map(s=>a.jsxs(Oi,{onClick:()=>s.onClick(o),colorScheme:s.colorScheme,value:s.label,children:[s.icon,s.label]},s.label))})})})]})})]},o.id))})}function Ni({tableId:e,data:t=[],headers:n=[],loading:r=!1,emptyMessage:o="No data",actions:s,page:i=1,pageSize:l=10,onPageChange:u,onPageSizeChange:f,density:p="sm",totalCount:g=0,paginationMode:m="client"}){d.useEffect(()=>{gr(e)},[e]),d.useEffect(()=>{hr(t,n)},[t,n]);const{sortColumn:h,sortDirection:x,data:v}=Qe(te),y=d.useMemo(()=>{const S=[...v];if(h&&S.sort((C,R)=>x==="asc"?String(C[h]).localeCompare(String(R[h])):String(R[h]).localeCompare(String(C[h]))),m==="client"){const C=i*l;return S.slice(C,C+l)}return S},[v,h,x,i,l,m]);return a.jsxs(c.Box,{h:"100%",display:"flex",flexDirection:"column",p:2,pt:2,minHeight:0,children:[a.jsx(c.Box,{flex:"1",minHeight:0,overflow:"auto",children:r?a.jsx(c.Box,{display:"flex",alignItems:"center",justifyContent:"center",h:"100%",color:"gray.500",children:"Loading..."}):y.length===0?a.jsx(c.Box,{display:"flex",alignItems:"center",justifyContent:"center",h:"100%",color:"gray.500",children:o}):a.jsxs(c.Table.Root,{variant:"outline",w:"100%",size:p,children:[a.jsx(bi,{}),a.jsx(Ai,{data:y,actions:s})]})}),a.jsx(c.Box,{mt:.5,children:a.jsx(_i,{totalCount:g,pageSize:l,currentPage:i,onPageChange:u,onPageSizeChange:S=>{f&&f(S),i>1&&u&&u(1)}})})]})}const Li=w(c.Checkbox.Root),$i=w(c.Checkbox.HiddenInput),Pi=w(c.Checkbox.Control),zi=w(c.Checkbox.Label),Fi=({value:e,onChange:t,size:n="sm",label:r,helperText:o,isDisabled:s,required:i,errorText:l})=>a.jsxs(Li,{value:e,onChange:t,size:n,children:[a.jsx($i,{}),a.jsx(Pi,{disabled:s,required:i,errorText:l,helperText:o}),r&&a.jsx(zi,{children:r})]}),z=" to ",An=10,Ce={DAY_MAX:31,MONTH_MAX:12,YEAR_MIN:1900,YEAR_MAX:2100},Jt=()=>{const e=new Date;return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}},Nn=()=>{const{year:e,month:t,day:n}=Jt();return`${String(n).padStart(2,"0")}-${String(t).padStart(2,"0")}-${e}`},Vi=()=>{const{year:e,month:t,day:n}=Jt();return`${e}-${String(t).padStart(2,"0")}-${String(n).padStart(2,"0")}`},Bi=(e,t)=>{const n=e.length,r=parseInt(e);if(!e||isNaN(r))return t;if(n===4)return r>=Ce.YEAR_MIN&&r<=Ce.YEAR_MAX?r:t;if(n>0&&n<4){const o=t.toString(),s=4-n,i=o.substring(0,s);return parseInt(i+e)}return t},Ye=e=>{if(!e?.trim())return null;const n=e.replace(/[^\d-]/g,"").split("-").filter(f=>f!=="");if(n.length===0)return null;const{year:r,month:o,day:s}=Jt();let i,l,u;return n.length===1?(i=parseInt(n[0])||s,l=o,u=r):n.length===2?(i=parseInt(n[0])||s,l=parseInt(n[1])||o,u=r):(i=parseInt(n[0])||s,l=parseInt(n[1])||o,u=Bi(n[2],r)),l=Math.max(1,Math.min(Ce.MONTH_MAX,l)),i=Math.max(1,Math.min(Ce.DAY_MAX,i)),`${u}-${String(l).padStart(2,"0")}-${String(i).padStart(2,"0")}`},ie=e=>{if(!e)return"";const[t,n,r]=e.split("-");return`${r}-${n}-${t}`},Hi=(e,t)=>{if(e[0]?.length>0){const n=parseInt(e[0]);if(isNaN(n)||n===0||e[0].length===2&&n>Ce.DAY_MAX)return t}if(e[1]?.length>0){const n=parseInt(e[1]);if(isNaN(n)||n===0||e[1].length===2&&n>Ce.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<Ce.YEAR_MIN||n>Ce.YEAR_MAX))return t}return null},We=e=>{let t=e.replace(/[^\d-]/g,"").substring(0,An);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,An),Hi(n,e)||t},Yi=w(c.Popover.Root),Wi=w(c.Popover.Trigger),Ui=w(c.Popover.Content),Gi=w(c.Popover.Positioner);function Xi({value:e,onChange:t,disabled:n=!1}){const[r="",o=""]=e?e.split("|"):[],[s,i]=d.useState(()=>r&&o?`${ie(r)}${z}${ie(o)}`:r?ie(r):""),[l,u]=d.useState(!1),f=d.useRef(null);d.useEffect(()=>{const x=v=>{v.ctrlKey&&v.key==="d"&&!v.shiftKey&&!v.metaKey&&(v.preventDefault(),f.current?.focus())};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[]);const p=x=>{let v=x;if(v.includes(z)){const[y,S=""]=v.split(z);v=`${We(y.trim())}${z}${We(S.trim())}`}else if(v.toLowerCase().includes(" to ")){const[y,S=""]=v.split(/\s+to\s+/i);v=`${We(y.trim())} to ${We(S.trim())}`}else v=We(v);i(v)},g=()=>{const x=s.trim();if(!x){t(void 0);return}if(x.includes(z)){const[v,y=""]=x.split(z).map(R=>R.trim()),S=Ye(v),C=y?Ye(y):null;if(S&&C){const[R,T]=C<S?[C,S]:[S,C],_=`${ie(R)}${z}${ie(T)}`;i(_),t(`${R}|${T}`)}else if(S&&!y)i(`${ie(S)}${z}`),t(void 0);else if(S&&y){const R=Vi(),[T,_]=R<S?[R,S]:[S,R],D=`${ie(T)}${z}${ie(_)}`;i(D),t(`${T}|${_}`)}else i(""),t(void 0)}else{const v=Ye(x);v?(i(`${ie(v)}${z}`),t(void 0)):(i(""),t(void 0))}},m=x=>{if(x.key!=="Enter")return;x.preventDefault();const v=f.current?.selectionStart||0,y=s.indexOf(z);if(!s.trim()){i(`${Nn()}${z}`);return}if(y===-1){const C=Ye(s.trim());C&&i(`${ie(C)}${z}`);return}if(v<=y+z.length){const C=s.substring(0,y).trim(),R=s.substring(y+z.length),T=Ye(C);T&&i(`${ie(T)}${z}${R}`);return}if(s.substring(y+z.length).trim())g(),f.current?.blur();else{const C=s.substring(0,y+z.length)+Nn();i(C),setTimeout(()=>{g(),f.current?.blur()},0)}},h=()=>{i(""),t(void 0)};return a.jsx(c.InputGroup,{children:a.jsx(a.Fragment,{children:a.jsxs(c.InputElement,{position:"revert",children:[a.jsxs(Yi,{open:l,onEscapeKeyDown:()=>{u(!1)},children:[a.jsx(Wi,{asChild:!0,children:a.jsx(c.IconButton,{size:"sm",variant:"ghost","aria-label":"Date range help",onClick:()=>u(x=>!x),children:a.jsx(kn,{size:16})})}),a.jsx(c.Portal,{children:a.jsx(Gi,{children:a.jsxs(Ui,{p:4,children:[a.jsx(c.PopoverArrow,{}),a.jsxs(c.VStack,{align:"start",gap:4,children:[a.jsxs(c.HStack,{children:[a.jsx(kn,{size:16}),a.jsx(c.Text,{fontWeight:"semibold",fontSize:"sm",children:"Date Range Filter"})]}),a.jsxs(c.VStack,{align:"start",gap:1,children:[a.jsx(c.Text,{fontSize:"sm",fontWeight:"medium",children:"Format:"}),a.jsxs(c.Text,{fontSize:"xs",color:"gray.600",children:["DD-MM-YYYY",z,"DD-MM-YYYY"]})]}),a.jsxs(c.VStack,{align:"start",gap:1,children:[a.jsx(c.Text,{fontSize:"sm",fontWeight:"medium",children:"Tips:"}),a.jsx(c.Text,{fontSize:"xs",children:'• "15 to 20" → assumes current month/year'}),a.jsx(c.Text,{fontSize:"xs",children:"• Leave end blank → up to today"}),a.jsx(c.Text,{fontSize:"xs",children:"• Dates auto-swapped if reversed"}),a.jsx(c.Text,{fontSize:"xs",children:"• Press Enter on empty end → fills today"})]}),a.jsxs(c.VStack,{align:"start",gap:1,children:[a.jsx(c.Text,{fontSize:"sm",fontWeight:"medium",children:"Shortcut:"}),a.jsxs(c.HStack,{children:[a.jsx(c.Kbd,{children:"Ctrl"}),a.jsx(c.Text,{children:"+"}),a.jsx(c.Kbd,{children:"D"})]})]})]})]})})})]}),a.jsx(c.Input,{ref:f,placeholder:"15-06-2025 to 20-06-2025",value:s,size:"sm",disabled:n,onChange:x=>p(x.target.value),onBlur:g,onKeyDown:m,pr:s?"10":void 0,w:"100%"}),s&&a.jsx(c.InputElement,{children:a.jsx(c.IconButton,{size:"sm",variant:"ghost","aria-label":"Clear date range",onClick:h,w:"100%"})})]})})})}const qi=w(c.Field.Root);w(c.Field.Label);const Ki=w(c.Field.HelperText),Ji=w(c.Field.ErrorText),Ln=({icon:e,value:t,onChange:n,placeholder:r,size:o="xs",variant:s="outline",width:i="100%",label:l,helperText:u,isDisabled:f=!1,required:p=!1,errorText:g})=>a.jsxs(qi,{width:i,children:[a.jsx(c.InputGroup,{startElement:e,children:a.jsx(c.Input,{value:t,onChange:m=>n?.(m.target.value),placeholder:r,size:o,variant:s,disabled:f,required:p})}),g&&a.jsx(Ji,{fontSize:"xs",children:g}),u&&a.jsx(Ki,{fontSize:"xs",children:u})]}),Zi=w(c.Field.Root),Qi=w(c.Field.HelperText),ea=w(c.Field.ErrorText),ta=w(c.Select.Root),na=w(c.Select.Label),ra=w(c.Select.Control),oa=w(c.Select.Trigger),sa=w(c.Select.ValueText),ia=w(c.Select.IndicatorGroup),aa=w(c.Select.Indicator),la=w(c.Select.Content),ca=w(c.Select.Item),ua=w(c.Select.ItemIndicator),da=w(c.Select.HiddenSelect),fa=w(c.Select.Positioner),ha=({options:e=[],label:t,value:n,onChange:r,placeholder:o,size:s="sm",width:i="100%",variant:l="outline",helperText:u,isDisabled:f,required:p,errorText:g})=>{const m=c.createListCollection({items:e});return a.jsxs(Zi,{disabled:f,required:p,children:[a.jsxs(ta,{collection:m,variant:l,size:s,width:i,value:n?[n]:[],onValueChange:h=>r?.(h.value[0]),children:[a.jsx(da,{}),t&&a.jsx(na,{children:t}),a.jsxs(ra,{children:[a.jsx(oa,{children:a.jsx(sa,{placeholder:o})}),a.jsx(ia,{children:a.jsx(aa,{})})]}),a.jsx(fa,{children:a.jsx(la,{children:m.items.map(h=>a.jsxs(ca,{item:h,children:[h.label,a.jsx(ua,{})]},h.value))})})]}),u&&a.jsx(Qi,{children:u}),g&&a.jsx(ea,{children:g})]})},pr=e=>`FILTER_PRESETS_${e??"default"}`;function ga(e){try{return JSON.parse(localStorage.getItem(pr(e))||"[]")}catch{return[]}}const Ze=new zn({}),wt=e=>{const t=Ze.state[e];if(t)return t;const n=ga(e);return Ze.setState(r=>({...r,[e]:n})),n},Zt=(e,t)=>{Ze.setState(n=>({...n,[e]:t})),localStorage.setItem(pr(e),JSON.stringify(t))},vr=(e,t)=>{const n=wt(e).filter(r=>r.id!==t);Zt(e,n)},br=(e,t)=>{const n=[t,...wt(e)];Zt(e,n)},pa=w(c.Checkbox.Root),va=w(c.Checkbox.HiddenInput),ba=w(c.Checkbox.Control),ma=w(c.Slider.Root),xa=w(c.Slider.Track),ya=w(c.Slider.Range),Sa=w(c.Slider.Thumbs),wa=w(c.Slider.Control),Ca=({filter:e,onVisibilityChange:t,onSizeChange:n})=>{const{attributes:r,listeners:o,setNodeRef:s,transform:i,transition:l}=cr({id:e.id}),u={transform:Me.Transform.toString(i),transition:l};return a.jsxs(c.VStack,{ref:s,style:u,align:"stretch",border:"1px solid",borderColor:"gray.200",rounded:"md",p:3,mb:3,bg:"white",children:[a.jsxs(c.HStack,{...r,...o,cursor:"grab",userSelect:"none",gap:2,children:[a.jsx(dr,{size:16}),a.jsx(c.Text,{fontWeight:"bold",fontSize:"sm",children:e.label||e.id})]}),a.jsxs(c.HStack,{justify:"space-between",children:[a.jsx(c.Text,{fontSize:"sm",children:"Visible"}),a.jsxs(pa,{checked:e.visible,size:"sm",onCheckedChange:f=>t?.(e.id,!!f.checked),children:[a.jsx(va,{}),a.jsx(ba,{})]})]}),a.jsxs(c.VStack,{align:"stretch",gap:1,children:[a.jsx(c.Text,{fontSize:"sm",children:"Size"}),a.jsx(ma,{min:1,max:5,step:.5,value:[e.size??1],onValueChange:f=>n?.(e.id,f.value[0]),children:a.jsxs(wa,{children:[a.jsx(xa,{children:a.jsx(ya,{})}),a.jsx(Sa,{})]})})]})]})},Ra=w(c.Drawer.Root),Ea=w(c.Drawer.Trigger),Da=w(c.Drawer.Backdrop),Ta=w(c.Drawer.Positioner),ja=w(c.Drawer.Content),_a=w(c.Drawer.Header),Oa=w(c.Drawer.Title),Ia=w(c.Drawer.Body),ka=w(c.Drawer.Footer),Ma=w(c.Drawer.CloseTrigger),Aa=w(c.Tabs.Root),Na=w(c.Tabs.List),Nt=w(c.Tabs.Trigger),Lt=w(c.Tabs.Content),mr=e=>{if(e.customComponent)return e.customComponent;switch(e.type){case"text":return a.jsx(Ln,{placeholder:e.label,value:e.value,onChange:e.onChange,label:""});case"number":return a.jsx(Ln,{label:e.label,value:e.value,onChange:e.onChange});case"checkbox":return a.jsx(Fi,{label:e.label,value:e.value,onChange:e.onChange});case"select":return a.jsx(ha,{label:e.label,value:e.value,onChange:e.onChange,options:e.options??[]});case"date":return a.jsx(Xi,{value:e.value,onChange:e.onChange});default:return null}},La=({filterDrawerSize:e="sm",onVisibilityChange:t,onSizeChange:n,onClear:r,filters:o,pageKey:s="default",currentFilters:i={},onLoadPreset:l,activePresetName:u,onReorder:f})=>{const g=Qe(Ze)[s]??wt(s),m=()=>{const h=prompt("Preset name?");h&&br(s,{id:crypto.randomUUID(),name:h,date:new Date().toISOString(),filters:i})};return a.jsx(c.HStack,{wrap:"wrap",children:a.jsxs(Ra,{size:e,children:[a.jsx(Ea,{asChild:!0,children:a.jsxs(c.IconButton,{"aria-label":"Open filters",variant:"outline",size:"xs",ml:2,p:2,children:[a.jsx(Qs,{size:16}),"Filters"]})}),a.jsxs(c.Portal,{children:[a.jsx(Da,{}),a.jsx(Ta,{children:a.jsxs(ja,{children:[a.jsx(_a,{children:a.jsx(Oa,{children:"Filters"})}),a.jsx(Ia,{overflowY:"auto",pt:1,children:a.jsxs(Aa,{defaultValue:"view",children:[a.jsxs(Na,{mb:4,children:[a.jsxs(Nt,{value:"view",children:[a.jsx(ni,{size:16}),"Edit"]}),a.jsxs(Nt,{value:"settings",children:[a.jsx(oi,{size:16}),"Settings"]}),a.jsxs(Nt,{value:"presets",children:[a.jsx(Fs,{size:16}),"Presets"]})]}),a.jsx(Lt,{value:"view",children:o.filter(h=>h.visible).map(h=>a.jsx(c.VStack,{align:"stretch",border:"1px solid",borderColor:"gray.200",flex:h.size??1,minW:`${(h.size??1)*100}px`,rounded:"md",p:3,mb:3,children:mr(h)},h.id))}),a.jsx(Lt,{value:"settings",children:a.jsx(rr,{sensors:ro(no(Kt)),collisionDetection:Hn,onDragEnd:({active:h,over:x})=>{if(!x||h.id===x.id)return;const v=o.findIndex(C=>C.id===h.id),y=o.findIndex(C=>C.id===x.id),S=St(o,v,y);f?.(S)},children:a.jsx(ar,{items:o.map(h=>h.id),strategy:xs,children:o.map(h=>a.jsx(Ca,{filter:h,onVisibilityChange:t,onSizeChange:n},h.id))})})}),a.jsx(Lt,{value:"presets",children:a.jsxs(c.VStack,{align:"stretch",mb:3,children:[a.jsx(c.Button,{size:"sm",colorScheme:"blue",onClick:m,children:"Save Current Filters"}),g.length===0&&a.jsx(c.Text,{fontSize:"xs",color:"gray.500",children:"No presets saved yet."}),g.map(h=>a.jsxs(c.HStack,{justify:"space-between",border:"1px solid",borderColor:u===h.name?"blue.300":"gray.200",rounded:"md",p:2,children:[a.jsxs(c.VStack,{align:"start",gap:0,children:[a.jsx(c.Text,{fontWeight:"bold",fontSize:"sm",children:h.name}),a.jsx(c.Text,{fontSize:"xs",color:"gray.500",children:new Date(h.date).toLocaleDateString()})]}),a.jsxs(c.HStack,{children:[a.jsx(c.Button,{size:"xs",variant:"ghost",onClick:()=>l?.(h.filters,h.name),children:"Load"}),a.jsx(c.IconButton,{size:"xs","aria-label":"Delete preset",variant:"ghost",onClick:()=>vr(s,h.id),children:a.jsx(qs,{size:14})})]})]},h.id))]})})]})}),a.jsxs(ka,{justify:"space-between",children:[a.jsx(c.Button,{size:"sm",variant:"ghost",colorScheme:"red",onClick:()=>r&&r(),children:"Clear All"}),a.jsx(Ma,{asChild:!0,children:a.jsx(c.CloseButton,{})})]})]})})]})]})})},$a=({title:e,filters:t,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:i,pageKey:l,currentFilters:u,onLoadPreset:f,activePresetName:p,filterDrawerSize:g="sm"})=>a.jsxs(c.HStack,{wrap:"wrap",pl:2,pr:2,width:"100%",justify:"space-between",children:[e,a.jsxs(c.HStack,{gapX:1,children:[t.filter(m=>m.visible!==!1).map(m=>a.jsx(c.HStack,{flex:m.size??1,minW:`${(m.size??1)*100}px`,alignItems:"center",children:mr(m)},m.id)),a.jsx(La,{filterDrawerSize:g,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:i,pageKey:l,filters:t,currentFilters:u,onLoadPreset:f,activePresetName:p})]})]}),Pa=(e,t)=>{localStorage.setItem(`FILTER_ORDER_${e}`,JSON.stringify(t))},za=e=>{try{return JSON.parse(localStorage.getItem(`FILTER_ORDER_${e}`)||"[]")}catch{return[]}},Fa=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));exports.DataTable=Ni;exports.Filters=$a;exports.MdsSharedUi=Fa;exports.addPreset=br;exports.deletePreset=vr;exports.getPresets=wt;exports.loadOrder=za;exports.presetStore=Ze;exports.saveOrder=Pa;exports.savePresets=Zt;exports.setData=hr;exports.setTableId=gr;exports.tableStore=te;exports.withChildren=w;
|