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