fansunited-management-components 1.31.3-RC2 → 1.31.3-RC3

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/index.es.js CHANGED
@@ -34819,7 +34819,7 @@ const b0 = Qe(/* @__PURE__ */ u.jsx("path", {
34819
34819
  variant: o,
34820
34820
  ref: c,
34821
34821
  style: m,
34822
- startAction: i ? /* @__PURE__ */ u.jsx(MF, { disabled: !i }) : /* @__PURE__ */ u.jsx(u.Fragment, {}),
34822
+ startAction: /* @__PURE__ */ u.jsx(MF, { disabled: !i }),
34823
34823
  endAction: i ? /* @__PURE__ */ u.jsx(Ne, { title: n, children: /* @__PURE__ */ u.jsx(ze, { variant: "outlined", color: "danger", onClick: r, sx: { ml: "auto", p: 0.5 }, size: "sm", children: /* @__PURE__ */ u.jsx(Pp, {}) }) }) : /* @__PURE__ */ u.jsx(u.Fragment, {}),
34824
34824
  sx: { p: 2, borderRadius: "sm" },
34825
34825
  children: e
package/index.umd.js CHANGED
@@ -2472,4 +2472,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
2472
2472
  To pick up a draggable item, press the space bar.
2473
2473
  While dragging, use the arrow keys to move the item.
2474
2474
  Press space again to drop the item in its new position, or press escape to cancel.
2475
- `},p$={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 g$(e){let{announcements:t=p$,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=h$}=e;const{announce:o,announcement:a}=u$(),l=go("DndLiveRegion"),[s,c]=C.useState(!1);if(C.useEffect(()=>{c(!0)},[]),d$(C.useMemo(()=>({onDragStart(f){let{active:h}=f;o(t.onDragStart({active:h}))},onDragMove(f){let{active:h,over:p}=f;t.onDragMove&&o(t.onDragMove({active:h,over:p}))},onDragOver(f){let{active:h,over:p}=f;o(t.onDragOver({active:h,over:p}))},onDragEnd(f){let{active:h,over:p}=f;o(t.onDragEnd({active:h,over:p}))},onDragCancel(f){let{active:h,over:p}=f;o(t.onDragCancel({active:h,over:p}))}}),[o,t])),!s)return null;const d=C.createElement(C.Fragment,null,C.createElement(l$,{id:r,value:i.draggable}),C.createElement(c$,{id:l,announcement:a}));return n?Oe.createPortal(d,n):d}var mt;(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"})(mt||(mt={}));function bs(){}function ys(e,t){return C.useMemo(()=>({sensor:e,options:t!=null?t:{}}),[e,t])}function bv(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return C.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const cn=Object.freeze({x:0,y:0});function m$(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function v$(e,t){const n=vs(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function b$(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function y$(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function yv(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function xv(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}const x$=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=yv(t),o=[];for(const a of r){const{id:l}=a,s=n.get(l);if(s){const c=yv(s),d=i.reduce((h,p,m)=>h+m$(c[m],p),0),f=Number((d/4).toFixed(4));o.push({id:l,data:{droppableContainer:a,value:f}})}}return o.sort(b$)};function C$(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),a=i-r,l=o-n;if(r<i&&n<o){const s=t.width*t.height,c=e.width*e.height,d=a*l,f=d/(s+c-d);return Number(f.toFixed(4))}return 0}const w$=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:a}=o,l=n.get(a);if(l){const s=C$(l,t);s>0&&i.push({id:a,data:{droppableContainer:o,value:s}})}}return i.sort(y$)};function I$(e,t,n){return X(z({},e),{scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1})}function Cv(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:cn}function S$(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return i.reduce((a,l)=>X(z({},a),{top:a.top+e*l.y,bottom:a.bottom+e*l.y,left:a.left+e*l.x,right:a.right+e*l.x}),z({},n))}}const A$=S$(1);function wv(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 T$(e,t,n){const r=wv(t);if(!r)return e;const{scaleX:i,scaleY:o,x:a,y:l}=r,s=e.left-a-(1-i)*parseFloat(n),c=e.top-l-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),d=i?e.width/i:e.width,f=o?e.height/o:e.height;return{width:d,height:f,top:c,right:s+d,bottom:c+f,left:s}}const E$={ignoreTransform:!1};function hi(e,t){t===void 0&&(t=E$);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:d}=Rt(e).getComputedStyle(e);c&&(n=T$(n,c,d))}const{top:r,left:i,width:o,height:a,bottom:l,right:s}=n;return{top:r,left:i,width:o,height:a,bottom:l,right:s}}function Iv(e){return hi(e,{ignoreTransform:!0})}function _$(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function k$(e,t){return t===void 0&&(t=Rt(e).getComputedStyle(e)),t.position==="fixed"}function P$(e,t){t===void 0&&(t=Rt(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})}function xs(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(yu(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!fo(i)||pv(i)||n.includes(i))return n;const o=Rt(e).getComputedStyle(i);return i!==e&&P$(i,o)&&n.push(i),k$(i,o)?n:r(i.parentNode)}return e?r(e):n}function Sv(e){const[t]=xs(e,1);return t!=null?t:null}function Cu(e){return!fs||!e?null:ui(e)?e:bu(e)?yu(e)||e===di(e).scrollingElement?window:fo(e)?e:null:null}function Av(e){return ui(e)?e.scrollX:e.scrollLeft}function Tv(e){return ui(e)?e.scrollY:e.scrollTop}function wu(e){return{x:Av(e),y:Tv(e)}}var xt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(xt||(xt={}));function Ev(e){return!fs||!e?!1:e===document.scrollingElement}function _v(e){const t={x:0,y:0},n=Ev(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:a,isRight:l,maxScroll:r,minScroll:t}}const D$={x:.2,y:.2};function O$(e,t,n,r,i){let{top:o,left:a,right:l,bottom:s}=n;r===void 0&&(r=10),i===void 0&&(i=D$);const{isTop:c,isBottom:d,isLeft:f,isRight:h}=_v(e),p={x:0,y:0},m={x:0,y:0},g={height:t.height*i.y,width:t.width*i.x};return!c&&o<=t.top+g.height?(p.y=xt.Backward,m.y=r*Math.abs((t.top+g.height-o)/g.height)):!d&&s>=t.bottom-g.height&&(p.y=xt.Forward,m.y=r*Math.abs((t.bottom-g.height-s)/g.height)),!h&&l>=t.right-g.width?(p.x=xt.Forward,m.x=r*Math.abs((t.right-g.width-l)/g.width)):!f&&a<=t.left+g.width&&(p.x=xt.Backward,m.x=r*Math.abs((t.left+g.width-a)/g.width)),{direction:p,speed:m}}function R$(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:a}=window;return{top:0,left:0,right:o,bottom:a,width:o,height:a}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function kv(e){return e.reduce((t,n)=>fi(t,wu(n)),cn)}function M$(e){return e.reduce((t,n)=>t+Av(n),0)}function L$(e){return e.reduce((t,n)=>t+Tv(n),0)}function Pv(e,t){if(t===void 0&&(t=hi),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);Sv(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const B$=[["x",["left","right"],M$],["y",["top","bottom"],L$]];class Iu{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=xs(n),i=kv(r);this.rect=z({},t),this.width=t.width,this.height=t.height;for(const[o,a,l]of B$)for(const s of a)Object.defineProperty(this,s,{get:()=>{const c=l(r),d=i[o]-c;return this.rect[s]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class vo{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 i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function $$(e){const{EventTarget:t}=Rt(e);return e instanceof t?e:di(e)}function Su(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(mi(n,2)+mi(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 on;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(on||(on={}));function Dv(e){e.preventDefault()}function N$(e){e.stopPropagation()}var _e;(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"})(_e||(_e={}));const Ov={start:[_e.Space,_e.Enter],cancel:[_e.Esc],end:[_e.Space,_e.Enter,_e.Tab]},F$=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case _e.Right:return X(z({},n),{x:n.x+25});case _e.Left:return X(z({},n),{x:n.x-25});case _e.Down:return X(z({},n),{y:n.y+25});case _e.Up:return X(z({},n),{y:n.y-25})}};class Cs{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 vo(di(n)),this.windowListeners=new vo(Rt(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(on.Resize,this.handleCancel),this.windowListeners.add(on.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(on.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Pv(r),n(cn)}handleKeyDown(t){if(ms(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=Ov,coordinateGetter:a=F$,scrollBehavior:l="smooth"}=i,{code:s}=t;if(o.end.includes(s)){this.handleEnd(t);return}if(o.cancel.includes(s)){this.handleCancel(t);return}const{collisionRect:c}=r.current,d=c?{x:c.left,y:c.top}:cn;this.referenceCoordinates||(this.referenceCoordinates=d);const f=a(t,{active:n,context:r.current,currentCoordinates:d});if(f){const h=mo(f,d),p={x:0,y:0},{scrollableAncestors:m}=r.current;for(const g of m){const v=t.code,{isTop:S,isRight:I,isLeft:y,isBottom:x,maxScroll:b,minScroll:T}=_v(g),E=R$(g),P={x:Math.min(v===_e.Right?E.right-E.width/2:E.right,Math.max(v===_e.Right?E.left:E.left+E.width/2,f.x)),y:Math.min(v===_e.Down?E.bottom-E.height/2:E.bottom,Math.max(v===_e.Down?E.top:E.top+E.height/2,f.y))},O=v===_e.Right&&!I||v===_e.Left&&!y,G=v===_e.Down&&!x||v===_e.Up&&!S;if(O&&P.x!==f.x){const j=g.scrollLeft+h.x,A=v===_e.Right&&j<=b.x||v===_e.Left&&j>=T.x;if(A&&!h.y){g.scrollTo({left:j,behavior:l});return}A?p.x=g.scrollLeft-j:p.x=v===_e.Right?g.scrollLeft-b.x:g.scrollLeft-T.x,p.x&&g.scrollBy({left:-p.x,behavior:l});break}else if(G&&P.y!==f.y){const j=g.scrollTop+h.y,A=v===_e.Down&&j<=b.y||v===_e.Up&&j>=T.y;if(A&&!h.x){g.scrollTo({top:j,behavior:l});return}A?p.y=g.scrollTop-j:p.y=v===_e.Down?g.scrollTop-b.y:g.scrollTop-T.y,p.y&&g.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(t,fi(mo(f,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()}}Cs.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Ov,onActivation:i}=t,{active:o}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const l=o.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function Rv(e){return!!(e&&"distance"in e)}function Mv(e){return!!(e&&"delay"in e)}class Au{constructor(t,n,r){var i;r===void 0&&(r=$$(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:o}=t,{target:a}=o;this.props=t,this.events=n,this.document=di(a),this.documentListeners=new vo(this.document),this.listeners=new vo(r),this.windowListeners=new vo(Rt(a)),this.initialCoordinates=(i=vs(o))!=null?i:cn,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(on.Resize,this.handleCancel),this.windowListeners.add(on.DragStart,Dv),this.windowListeners.add(on.VisibilityChange,this.handleCancel),this.windowListeners.add(on.ContextMenu,Dv),this.documentListeners.add(on.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Mv(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Rv(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:i}=this.props;i(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(on.Click,N$,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(on.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:a,options:{activationConstraint:l}}=o;if(!i)return;const s=(n=vs(t))!=null?n:cn,c=mo(i,s);if(!r&&l){if(Rv(l)){if(l.tolerance!=null&&Su(c,l.tolerance))return this.handleCancel();if(Su(c,l.distance))return this.handleStart()}if(Mv(l)&&Su(c,l.tolerance))return this.handleCancel();this.handlePending(l,c);return}t.cancelable&&t.preventDefault(),a(s)}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===_e.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const j$={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class ws extends Au{constructor(t){const{event:n}=t,r=di(n.target);super(t,j$,r)}}ws.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const z$={move:{name:"mousemove"},end:{name:"mouseup"}};var Tu;(function(e){e[e.RightClick=2]="RightClick"})(Tu||(Tu={}));class V$ extends Au{constructor(t){super(t,z$,di(t.event.target))}}V$.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Tu.RightClick?!1:(r==null||r({event:n}),!0)}}];const Eu={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class U$ extends Au{constructor(t){super(t,Eu)}static setup(){return window.addEventListener(Eu.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Eu.move.name,t)};function t(){}}}U$.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var bo;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(bo||(bo={}));var Is;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Is||(Is={}));function H$(e){let{acceleration:t,activator:n=bo.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:a=5,order:l=Is.TreeOrder,pointerCoordinates:s,scrollableAncestors:c,scrollableAncestorRects:d,delta:f,threshold:h}=e;const p=G$({delta:f,disabled:!o}),[m,g]=r$(),v=C.useRef({x:0,y:0}),S=C.useRef({x:0,y:0}),I=C.useMemo(()=>{switch(n){case bo.Pointer:return s?{top:s.y,bottom:s.y,left:s.x,right:s.x}:null;case bo.DraggableRect:return i}},[n,i,s]),y=C.useRef(null),x=C.useCallback(()=>{const T=y.current;if(!T)return;const E=v.current.x*S.current.x,P=v.current.y*S.current.y;T.scrollBy(E,P)},[]),b=C.useMemo(()=>l===Is.TreeOrder?[...c].reverse():c,[l,c]);C.useEffect(()=>{if(!o||!c.length||!I){g();return}for(const T of b){if((r==null?void 0:r(T))===!1)continue;const E=c.indexOf(T),P=d[E];if(!P)continue;const{direction:O,speed:G}=O$(T,P,I,t,h);for(const j of["x","y"])p[j][O[j]]||(G[j]=0,O[j]=0);if(G.x>0||G.y>0){g(),y.current=T,m(x,a),v.current=G,S.current=O;return}}v.current={x:0,y:0},S.current={x:0,y:0},g()},[t,x,r,g,o,a,JSON.stringify(I),JSON.stringify(p),m,c,b,d,JSON.stringify(h)])}const W$={x:{[xt.Backward]:!1,[xt.Forward]:!1},y:{[xt.Backward]:!1,[xt.Forward]:!1}};function G$(e){let{delta:t,disabled:n}=e;const r=gs(t);return po(i=>{if(n||!r||!i)return W$;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[xt.Backward]:i.x[xt.Backward]||o.x===-1,[xt.Forward]:i.x[xt.Forward]||o.x===1},y:{[xt.Backward]:i.y[xt.Backward]||o.y===-1,[xt.Forward]:i.y[xt.Forward]||o.y===1}}},[n,t,r])}function Y$(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return po(i=>{var o;return t==null?null:(o=r!=null?r:i)!=null?o:null},[r,t])}function K$(e,t){return C.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...o]},[]),[e,t])}var yo;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(yo||(yo={}));var _u;(function(e){e.Optimized="optimized"})(_u||(_u={}));const Lv=new Map;function q$(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,a]=C.useState(null),{frequency:l,measure:s,strategy:c}=i,d=C.useRef(e),f=v(),h=ho(f),p=C.useCallback(function(S){S===void 0&&(S=[]),!h.current&&a(I=>I===null?S:I.concat(S.filter(y=>!I.includes(y))))},[h]),m=C.useRef(null),g=po(S=>{if(f&&!n)return Lv;if(!S||S===Lv||d.current!==e||o!=null){const I=new Map;for(let y of e){if(!y)continue;if(o&&o.length>0&&!o.includes(y.id)&&y.rect.current){I.set(y.id,y.rect.current);continue}const x=y.node.current,b=x?new Iu(s(x),x):null;y.rect.current=b,b&&I.set(y.id,b)}return I}return S},[e,o,n,f,s]);return C.useEffect(()=>{d.current=e},[e]),C.useEffect(()=>{f||p()},[n,f]),C.useEffect(()=>{o&&o.length>0&&a(null)},[JSON.stringify(o)]),C.useEffect(()=>{f||typeof l!="number"||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},l))},[l,f,p,...r]),{droppableRects:g,measureDroppableContainers:p,measuringScheduled:o!=null};function v(){switch(c){case yo.Always:return!1;case yo.BeforeDragging:return n;default:return!n}}}function ku(e,t){return po(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Q$(e,t){return ku(e,t)}function J$(e){let{callback:t,disabled:n}=e;const r=hs(t),i=C.useMemo(()=>{if(n||typeof window=="undefined"||typeof window.MutationObserver=="undefined")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return C.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function Ss(e){let{callback:t,disabled:n}=e;const r=hs(t),i=C.useMemo(()=>{if(n||typeof window=="undefined"||typeof window.ResizeObserver=="undefined")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return C.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function X$(e){return new Iu(hi(e),e)}function Bv(e,t,n){t===void 0&&(t=X$);const[r,i]=C.useState(null);function o(){i(s=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=s!=null?s:n)!=null?c:null}const d=t(e);return JSON.stringify(s)===JSON.stringify(d)?s:d})}const a=J$({callback(s){if(e)for(const c of s){const{type:d,target:f}=c;if(d==="childList"&&f instanceof HTMLElement&&f.contains(e)){o();break}}}}),l=Ss({callback:o});return ln(()=>{o(),e?(l==null||l.observe(e),a==null||a.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),a==null||a.disconnect())},[e]),r}function Z$(e){const t=ku(e);return Cv(e,t)}const $v=[];function eN(e){const t=C.useRef(e),n=po(r=>e?r&&r!==$v&&e&&t.current&&e.parentNode===t.current.parentNode?r:xs(e):$v,[e]);return C.useEffect(()=>{t.current=e},[e]),n}function tN(e){const[t,n]=C.useState(null),r=C.useRef(e),i=C.useCallback(o=>{const a=Cu(o.target);a&&n(l=>l?(l.set(a,wu(a)),new Map(l)):null)},[]);return C.useEffect(()=>{const o=r.current;if(e!==o){a(o);const l=e.map(s=>{const c=Cu(s);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,wu(c)]):null}).filter(s=>s!=null);n(l.length?new Map(l):null),r.current=e}return()=>{a(e),a(o)};function a(l){l.forEach(s=>{const c=Cu(s);c==null||c.removeEventListener("scroll",i)})}},[i,e]),C.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,a)=>fi(o,a),cn):kv(e):cn,[e,t])}function Nv(e,t){t===void 0&&(t=[]);const n=C.useRef(null);return C.useEffect(()=>{n.current=null},t),C.useEffect(()=>{const r=e!==cn;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?mo(e,n.current):cn}function nN(e){C.useEffect(()=>{if(!fs)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==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function rN(e,t){return C.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=a=>{o(a,t)},n},{}),[e,t])}function Fv(e){return C.useMemo(()=>e?_$(e):null,[e])}const jv=[];function iN(e,t){t===void 0&&(t=hi);const[n]=e,r=Fv(n?Rt(n):null),[i,o]=C.useState(jv);function a(){o(()=>e.length?e.map(s=>Ev(s)?r:new Iu(t(s),s)):jv)}const l=Ss({callback:a});return ln(()=>{l==null||l.disconnect(),a(),e.forEach(s=>l==null?void 0:l.observe(s))},[e]),i}function zv(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return fo(t)?t:e}function oN(e){let{measure:t}=e;const[n,r]=C.useState(null),i=C.useCallback(c=>{for(const{target:d}of c)if(fo(d)){r(f=>{const h=t(d);return f?X(z({},f),{width:h.width,height:h.height}):h});break}},[t]),o=Ss({callback:i}),a=C.useCallback(c=>{const d=zv(c);o==null||o.disconnect(),d&&(o==null||o.observe(d)),r(d?t(d):null)},[t,o]),[l,s]=ps(a);return C.useMemo(()=>({nodeRef:l,rect:n,setRef:s}),[n,l,s])}const aN=[{sensor:ws,options:{}},{sensor:Cs,options:{}}],sN={current:{}},As={draggable:{measure:Iv},droppable:{measure:Iv,strategy:yo.WhileDragging,frequency:_u.Optimized},dragOverlay:{measure:hi}};class xo 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 lN={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new xo,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:bs},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:As,measureDroppableContainers:bs,windowRect:null,measuringScheduled:!1},Vv={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:bs,draggableNodes:new Map,over:null,measureDroppableContainers:bs},Co=C.createContext(Vv),Uv=C.createContext(lN);function cN(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new xo}}}function uN(e,t){switch(t.type){case mt.DragStart:return X(z({},e),{draggable:X(z({},e.draggable),{initialCoordinates:t.initialCoordinates,active:t.active})});case mt.DragMove:return e.draggable.active==null?e:X(z({},e),{draggable:X(z({},e.draggable),{translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}})});case mt.DragEnd:case mt.DragCancel:return X(z({},e),{draggable:X(z({},e.draggable),{active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}})});case mt.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new xo(e.droppable.containers);return i.set(r,n),X(z({},e),{droppable:X(z({},e.droppable),{containers:i})})}case mt.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const a=new xo(e.droppable.containers);return a.set(n,X(z({},o),{disabled:i})),X(z({},e),{droppable:X(z({},e.droppable),{containers:a})})}case mt.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new xo(e.droppable.containers);return o.delete(n),X(z({},e),{droppable:X(z({},e.droppable),{containers:o})})}default:return e}}function dN(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=C.useContext(Co),o=gs(r),a=gs(n==null?void 0:n.id);return C.useEffect(()=>{if(!t&&!r&&o&&a!=null){if(!ms(o)||document.activeElement===o.target)return;const l=i.get(a);if(!l)return;const{activatorNode:s,node:c}=l;if(!s.current&&!c.current)return;requestAnimationFrame(()=>{for(const d of[s.current,c.current]){if(!d)continue;const f=a$(d);if(f){f.focus();break}}})}},[r,t,i,a,o]),null}function Hv(e,t){let i=t,{transform:n}=i,r=We(i,["transform"]);return e!=null&&e.length?e.reduce((o,a)=>a(z({transform:o},r)),n):n}function fN(e){return C.useMemo(()=>({draggable:z(z({},As.draggable),e==null?void 0:e.draggable),droppable:z(z({},As.droppable),e==null?void 0:e.droppable),dragOverlay:z(z({},As.dragOverlay),e==null?void 0:e.dragOverlay)}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function hN(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=C.useRef(!1),{x:a,y:l}=typeof i=="boolean"?{x:i,y:i}:i;ln(()=>{if(!a&&!l||!t){o.current=!1;return}if(o.current||!r)return;const c=t==null?void 0:t.node.current;if(!c||c.isConnected===!1)return;const d=n(c),f=Cv(d,r);if(a||(f.x=0),l||(f.y=0),o.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=Sv(c);h&&h.scrollBy({top:f.y,left:f.x})}},[t,a,l,r,n])}const Ts=C.createContext(X(z({},cn),{scaleX:1,scaleY:1}));var ir;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ir||(ir={}));const Wv=C.memo(function(t){var n,r,i,o;let Rs=t,{id:a,accessibility:l,autoScroll:s=!0,children:c,sensors:d=aN,collisionDetection:f=w$,measuring:h,modifiers:p}=Rs,m=We(Rs,["id","accessibility","autoScroll","children","sensors","collisionDetection","measuring","modifiers"]);const g=C.useReducer(uN,void 0,cN),[v,S]=g,[I,y]=f$(),[x,b]=C.useState(ir.Uninitialized),T=x===ir.Initialized,{draggable:{active:E,nodes:P,translate:O},droppable:{containers:G}}=v,j=E!=null?P.get(E):null,A=C.useRef({initial:null,translated:null}),W=C.useMemo(()=>{var Ct;return E!=null?{id:E,data:(Ct=j==null?void 0:j.data)!=null?Ct:sN,rect:A}:null},[E,j]),Y=C.useRef(null),[N,$]=C.useState(null),[B,H]=C.useState(null),q=ho(m,Object.values(m)),ee=go("DndDescribedBy",a),R=C.useMemo(()=>G.getEnabled(),[G]),L=fN(h),{droppableRects:F,measureDroppableContainers:U,measuringScheduled:te}=q$(R,{dragging:T,dependencies:[O.x,O.y],config:L.droppable}),se=Y$(P,E),ae=C.useMemo(()=>B?vs(B):null,[B]),J=un(),le=Q$(se,L.draggable.measure);hN({activeNode:E!=null?P.get(E):null,config:J.layoutShiftCompensation,initialRect:le,measure:L.draggable.measure});const ne=Bv(se,L.draggable.measure,le),ge=Bv(se?se.parentElement:null),Se=C.useRef({activatorEvent:null,active:null,activeNode:se,collisionRect:null,collisions:null,droppableRects:F,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:G,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ue=G.getNodeFor((n=Se.current.over)==null?void 0:n.id),wt=oN({measure:L.dragOverlay.measure}),at=(r=wt.nodeRef.current)!=null?r:se,kt=T?(i=wt.rect)!=null?i:ne:null,de=!!(wt.nodeRef.current&&wt.rect),he=Z$(de?null:ne),xe=Fv(at?Rt(at):null),Te=eN(T?Ue!=null?Ue:se:null),He=iN(Te),Pe=Hv(p,{transform:{x:O.x-he.x,y:O.y-he.y,scaleX:1,scaleY:1},activatorEvent:B,active:W,activeNodeRect:ne,containerNodeRect:ge,draggingNodeRect:kt,over:Se.current.over,overlayNodeRect:wt.rect,scrollableAncestors:Te,scrollableAncestorRects:He,windowRect:xe}),Ee=ae?fi(ae,O):null,It=tN(Te),St=Nv(It),zt=Nv(It,[ne]),Mt=fi(Pe,St),qt=kt?A$(kt,Pe):null,or=W&&qt?f({active:W,collisionRect:qt,droppableRects:F,droppableContainers:R,pointerCoordinates:Ee}):null,Ds=xv(or,"id"),[wn,wo]=C.useState(null),Pu=de?Pe:fi(Pe,zt),Du=I$(Pu,(o=wn==null?void 0:wn.rect)!=null?o:null,ne),je=C.useRef(null),pi=C.useCallback((Ct,_)=>{let{sensor:M,options:K}=_;if(Y.current==null)return;const Q=P.get(Y.current);if(!Q)return;const re=Ct.nativeEvent,ce=new M({active:Y.current,activeNode:Q,event:re,options:K,context:Se,onAbort(ue){if(!P.get(ue))return;const{onDragAbort:fe}=q.current,me={id:ue};fe==null||fe(me),I({type:"onDragAbort",event:me})},onPending(ue,we,fe,me){if(!P.get(ue))return;const{onDragPending:Pt}=q.current,nt={id:ue,constraint:we,initialCoordinates:fe,offset:me};Pt==null||Pt(nt),I({type:"onDragPending",event:nt})},onStart(ue){const we=Y.current;if(we==null)return;const fe=P.get(we);if(!fe)return;const{onDragStart:me}=q.current,De={activatorEvent:re,active:{id:we,data:fe.data,rect:A}};Oe.unstable_batchedUpdates(()=>{me==null||me(De),b(ir.Initializing),S({type:mt.DragStart,initialCoordinates:ue,active:we}),I({type:"onDragStart",event:De}),$(je.current),H(re)})},onMove(ue){S({type:mt.DragMove,coordinates:ue})},onEnd:Ce(mt.DragEnd),onCancel:Ce(mt.DragCancel)});je.current=ce;function Ce(ue){return function(){return k(this,null,function*(){const{active:fe,collisions:me,over:De,scrollAdjustedTranslate:Pt}=Se.current;let nt=null;if(fe&&Pt){const{cancelDrop:dn}=q.current;nt={activatorEvent:re,active:fe,collisions:me,delta:Pt,over:De},ue===mt.DragEnd&&typeof dn=="function"&&(yield Promise.resolve(dn(nt)))&&(ue=mt.DragCancel)}Y.current=null,Oe.unstable_batchedUpdates(()=>{S({type:ue}),b(ir.Uninitialized),wo(null),$(null),H(null),je.current=null;const dn=ue===mt.DragEnd?"onDragEnd":"onDragCancel";if(nt){const In=q.current[dn];In==null||In(nt),I({type:dn,event:nt})}})})}}},[P]),Io=C.useCallback((Ct,_)=>(M,K)=>{const Q=M.nativeEvent,re=P.get(K);if(Y.current!==null||!re||Q.dndKit||Q.defaultPrevented)return;const ce={active:re};Ct(M,_.options,ce)===!0&&(Q.dndKit={capturedBy:_.sensor},Y.current=K,pi(M,_))},[P,pi]),Os=K$(d,Io);nN(d),ln(()=>{ne&&x===ir.Initializing&&b(ir.Initialized)},[ne,x]),C.useEffect(()=>{const{onDragMove:Ct}=q.current,{active:_,activatorEvent:M,collisions:K,over:Q}=Se.current;if(!_||!M)return;const re={active:_,activatorEvent:M,collisions:K,delta:{x:Mt.x,y:Mt.y},over:Q};Oe.unstable_batchedUpdates(()=>{Ct==null||Ct(re),I({type:"onDragMove",event:re})})},[Mt.x,Mt.y]),C.useEffect(()=>{const{active:Ct,activatorEvent:_,collisions:M,droppableContainers:K,scrollAdjustedTranslate:Q}=Se.current;if(!Ct||Y.current==null||!_||!Q)return;const{onDragOver:re}=q.current,ce=K.get(Ds),Ce=ce&&ce.rect.current?{id:ce.id,rect:ce.rect.current,data:ce.data,disabled:ce.disabled}:null,ue={active:Ct,activatorEvent:_,collisions:M,delta:{x:Q.x,y:Q.y},over:Ce};Oe.unstable_batchedUpdates(()=>{wo(Ce),re==null||re(ue),I({type:"onDragOver",event:ue})})},[Ds]),ln(()=>{Se.current={activatorEvent:B,active:W,activeNode:se,collisionRect:qt,collisions:or,droppableRects:F,draggableNodes:P,draggingNode:at,draggingNodeRect:kt,droppableContainers:G,over:wn,scrollableAncestors:Te,scrollAdjustedTranslate:Mt},A.current={initial:kt,translated:qt}},[W,se,or,qt,P,at,kt,F,G,wn,Te,Mt]),H$(X(z({},J),{delta:O,draggingRect:qt,pointerCoordinates:Ee,scrollableAncestors:Te,scrollableAncestorRects:He}));const gi=C.useMemo(()=>({active:W,activeNode:se,activeNodeRect:ne,activatorEvent:B,collisions:or,containerNodeRect:ge,dragOverlay:wt,draggableNodes:P,droppableContainers:G,droppableRects:F,over:wn,measureDroppableContainers:U,scrollableAncestors:Te,scrollableAncestorRects:He,measuringConfiguration:L,measuringScheduled:te,windowRect:xe}),[W,se,ne,B,or,ge,wt,P,G,F,wn,U,Te,He,L,te,xe]),So=C.useMemo(()=>({activatorEvent:B,activators:Os,active:W,activeNodeRect:ne,ariaDescribedById:{draggable:ee},dispatch:S,draggableNodes:P,over:wn,measureDroppableContainers:U}),[B,Os,W,ne,S,ee,P,wn,U]);return C.createElement(vv.Provider,{value:y},C.createElement(Co.Provider,{value:So},C.createElement(Uv.Provider,{value:gi},C.createElement(Ts.Provider,{value:Du},c)),C.createElement(dN,{disabled:(l==null?void 0:l.restoreFocus)===!1})),C.createElement(g$,X(z({},l),{hiddenTextDescribedById:ee})));function un(){const Ct=(N==null?void 0:N.autoScrollEnabled)===!1,_=typeof s=="object"?s.enabled===!1:s===!1,M=T&&!Ct&&!_;return typeof s=="object"?X(z({},s),{enabled:M}):{enabled:M}}}),pN=C.createContext(null),Gv="button",gN="Draggable";function mN(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=go(gN),{activators:a,activatorEvent:l,active:s,activeNodeRect:c,ariaDescribedById:d,draggableNodes:f,over:h}=C.useContext(Co),{role:p=Gv,roleDescription:m="draggable",tabIndex:g=0}=i!=null?i:{},v=(s==null?void 0:s.id)===t,S=C.useContext(v?Ts:pN),[I,y]=ps(),[x,b]=ps(),T=rN(a,t),E=ho(n);ln(()=>(f.set(t,{id:t,key:o,node:I,activatorNode:x,data:E}),()=>{const O=f.get(t);O&&O.key===o&&f.delete(t)}),[f,t]);const P=C.useMemo(()=>({role:p,tabIndex:g,"aria-disabled":r,"aria-pressed":v&&p===Gv?!0:void 0,"aria-roledescription":m,"aria-describedby":d.draggable}),[r,p,g,v,m,d.draggable]);return{active:s,activatorEvent:l,activeNodeRect:c,attributes:P,isDragging:v,listeners:r?void 0:T,node:I,over:h,setNodeRef:y,setActivatorNodeRef:b,transform:S}}function Yv(){return C.useContext(Uv)}const vN="Droppable",bN={timeout:25};function yN(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=go(vN),{active:a,dispatch:l,over:s,measureDroppableContainers:c}=C.useContext(Co),d=C.useRef({disabled:n}),f=C.useRef(!1),h=C.useRef(null),p=C.useRef(null),{disabled:m,updateMeasurementsFor:g,timeout:v}=z(z({},bN),i),S=ho(g!=null?g:r),I=C.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{c(Array.isArray(S.current)?S.current:[S.current]),p.current=null},v)},[v]),y=Ss({callback:I,disabled:m||!a}),x=C.useCallback((P,O)=>{y&&(O&&(y.unobserve(O),f.current=!1),P&&y.observe(P))},[y]),[b,T]=ps(x),E=ho(t);return C.useEffect(()=>{!y||!b.current||(y.disconnect(),f.current=!1,y.observe(b.current))},[b,y]),C.useEffect(()=>(l({type:mt.RegisterDroppable,element:{id:r,key:o,disabled:n,node:b,rect:h,data:E}}),()=>l({type:mt.UnregisterDroppable,key:o,id:r})),[r]),C.useEffect(()=>{n!==d.current.disabled&&(l({type:mt.SetDroppableDisabled,id:r,key:o,disabled:n}),d.current.disabled=n)},[r,o,n,l]),{active:a,rect:h,isOver:(s==null?void 0:s.id)===r,node:b,over:s,setNodeRef:T}}function xN(e){let{animation:t,children:n}=e;const[r,i]=C.useState(null),[o,a]=C.useState(null),l=gs(n);return!n&&!r&&l&&i(l),ln(()=>{if(!o)return;const s=r==null?void 0:r.key,c=r==null?void 0:r.props.id;if(s==null||c==null){i(null);return}Promise.resolve(t(c,o)).then(()=>{i(null)})},[t,r,o]),C.createElement(C.Fragment,null,n,r?C.cloneElement(r,{ref:a}):null)}const CN={x:0,y:0,scaleX:1,scaleY:1};function wN(e){let{children:t}=e;return C.createElement(Co.Provider,{value:Vv},C.createElement(Ts.Provider,{value:CN},t))}const IN={position:"fixed",touchAction:"none"},SN=e=>ms(e)?"transform 250ms ease":void 0,AN=C.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:o,className:a,rect:l,style:s,transform:c,transition:d=SN}=e;if(!l)return null;const f=i?c:X(z({},c),{scaleX:1,scaleY:1}),h=z(X(z({},IN),{width:l.width,height:l.height,top:l.top,left:l.left,transform:Un.Transform.toString(f),transformOrigin:i&&r?v$(r,l):void 0,transition:typeof d=="function"?d(r):d}),s);return C.createElement(n,{className:a,style:h,ref:t},o)}),Kv=e=>t=>{let{active:n,dragOverlay:r}=t;const i={},{styles:o,className:a}=e;if(o!=null&&o.active)for(const[l,s]of Object.entries(o.active))s!==void 0&&(i[l]=n.node.style.getPropertyValue(l),n.node.style.setProperty(l,s));if(o!=null&&o.dragOverlay)for(const[l,s]of Object.entries(o.dragOverlay))s!==void 0&&r.node.style.setProperty(l,s);return a!=null&&a.active&&n.node.classList.add(a.active),a!=null&&a.dragOverlay&&r.node.classList.add(a.dragOverlay),function(){for(const[s,c]of Object.entries(i))n.node.style.setProperty(s,c);a!=null&&a.active&&n.node.classList.remove(a.active)}},TN={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Un.Transform.toString(t)},{transform:Un.Transform.toString(n)}]},sideEffects:Kv({styles:{active:{opacity:"0"}}})};function EN(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return hs((o,a)=>{if(t===null)return;const l=n.get(o);if(!l)return;const s=l.node.current;if(!s)return;const c=zv(a);if(!c)return;const{transform:d}=Rt(a).getComputedStyle(a),f=wv(d);if(!f)return;const h=typeof t=="function"?t:_N(t);return Pv(s,i.draggable.measure),h({active:{id:o,data:l.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:f})})}function _N(e){const{duration:t,easing:n,sideEffects:r,keyframes:i}=z(z({},TN),e);return o=>{let I=o,{active:a,dragOverlay:l,transform:s}=I,c=We(I,["active","dragOverlay","transform"]);if(!t)return;const d={x:l.rect.left-a.rect.left,y:l.rect.top-a.rect.top},f={scaleX:s.scaleX!==1?a.rect.width*s.scaleX/l.rect.width:1,scaleY:s.scaleY!==1?a.rect.height*s.scaleY/l.rect.height:1},h=z({x:s.x-d.x,y:s.y-d.y},f),p=i(X(z({},c),{active:a,dragOverlay:l,transform:{initial:s,final:h}})),[m]=p,g=p[p.length-1];if(JSON.stringify(m)===JSON.stringify(g))return;const v=r==null?void 0:r(z({active:a,dragOverlay:l},c)),S=l.node.animate(p,{duration:t,easing:n,fill:"forwards"});return new Promise(y=>{S.onfinish=()=>{v==null||v(),y()}})}}let qv=0;function kN(e){return C.useMemo(()=>{if(e!=null)return qv++,qv},[e])}const PN=C.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:o,modifiers:a,wrapperElement:l="div",className:s,zIndex:c=999}=e;const{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:p,draggableNodes:m,droppableContainers:g,dragOverlay:v,over:S,measuringConfiguration:I,scrollableAncestors:y,scrollableAncestorRects:x,windowRect:b}=Yv(),T=C.useContext(Ts),E=kN(f==null?void 0:f.id),P=Hv(a,{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:p,draggingNodeRect:v.rect,over:S,overlayNodeRect:v.rect,scrollableAncestors:y,scrollableAncestorRects:x,transform:T,windowRect:b}),O=ku(h),G=EN({config:r,draggableNodes:m,droppableContainers:g,measuringConfiguration:I}),j=O?v.setRef:void 0;return C.createElement(wN,null,C.createElement(xN,{animation:G},f&&E?C.createElement(AN,{key:E,id:f.id,ref:j,as:l,activatorEvent:d,adjustScale:t,className:s,transition:o,rect:O,style:z({zIndex:c},i),transform:P},n):null))});function Es(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function DN(e,t){return e.reduce((n,r,i)=>{const o=t.get(r);return o&&(n[i]=o),n},Array(e.length))}function _s(e){return e!==null&&e>=0}function ON(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 RN(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Qv=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const o=Es(t,r,n),a=t[i],l=o[i];return!l||!a?null:{x:l.left-a.left,y:l.top-a.top,scaleX:l.width/a.width,scaleY:l.height/a.height}},Jv="Sortable",Xv=C.createContext({activeIndex:-1,containerId:Jv,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Qv,disabled:{draggable:!1,droppable:!1}});function Zv(e){let{children:t,id:n,items:r,strategy:i=Qv,disabled:o=!1}=e;const{active:a,dragOverlay:l,droppableRects:s,over:c,measureDroppableContainers:d}=Yv(),f=go(Jv,n),h=l.rect!==null,p=C.useMemo(()=>r.map(T=>typeof T=="object"&&"id"in T?T.id:T),[r]),m=a!=null,g=a?p.indexOf(a.id):-1,v=c?p.indexOf(c.id):-1,S=C.useRef(p),I=!ON(p,S.current),y=v!==-1&&g===-1||I,x=RN(o);ln(()=>{I&&m&&d(p)},[I,p,m,d]),C.useEffect(()=>{S.current=p},[p]);const b=C.useMemo(()=>({activeIndex:g,containerId:f,disabled:x,disableTransforms:y,items:p,overIndex:v,useDragOverlay:h,sortedRects:DN(p,s),strategy:i}),[g,f,x.draggable,x.droppable,y,p,v,s,h,i]);return C.createElement(Xv.Provider,{value:b},t)}const MN=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return Es(n,r,i).indexOf(t)},LN=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:o,newIndex:a,previousItems:l,previousContainerId:s,transition:c}=e;return!c||!r||l!==o&&i===a?!1:n?!0:a!==i&&t===s},BN={duration:200,easing:"ease"},eb="transform",$N=Un.Transition.toString({property:eb,duration:0,easing:"linear"}),NN={roleDescription:"sortable"};function FN(e){let{disabled:t,index:n,node:r,rect:i}=e;const[o,a]=C.useState(null),l=C.useRef(n);return ln(()=>{if(!t&&n!==l.current&&r.current){const s=i.current;if(s){const c=hi(r.current,{ignoreTransform:!0}),d={x:s.left-c.left,y:s.top-c.top,scaleX:s.width/c.width,scaleY:s.height/c.height};(d.x||d.y)&&a(d)}}n!==l.current&&(l.current=n)},[t,n,r,i]),C.useEffect(()=>{o&&a(null)},[o]),o}function tb(e){let{animateLayoutChanges:t=LN,attributes:n,disabled:r,data:i,getNewIndex:o=MN,id:a,strategy:l,resizeObserverConfig:s,transition:c=BN}=e;const{items:d,containerId:f,activeIndex:h,disabled:p,disableTransforms:m,sortedRects:g,overIndex:v,useDragOverlay:S,strategy:I}=C.useContext(Xv),y=jN(r,p),x=d.indexOf(a),b=C.useMemo(()=>z({sortable:{containerId:f,index:x,items:d}},i),[f,i,x,d]),T=C.useMemo(()=>d.slice(d.indexOf(a)),[d,a]),{rect:E,node:P,isOver:O,setNodeRef:G}=yN({id:a,data:b,disabled:y.droppable,resizeObserverConfig:z({updateMeasurementsFor:T},s)}),{active:j,activatorEvent:A,activeNodeRect:W,attributes:Y,setNodeRef:N,listeners:$,isDragging:B,over:H,setActivatorNodeRef:q,transform:ee}=mN({id:a,data:b,attributes:z(z({},NN),n),disabled:y.draggable}),R=n$(G,N),L=!!j,F=L&&!m&&_s(h)&&_s(v),U=!S&&B,te=U&&F?ee:null,se=l!=null?l:I,ae=F?te!=null?te:se({rects:g,activeNodeRect:W,activeIndex:h,overIndex:v,index:x}):null,J=_s(h)&&_s(v)?o({id:a,items:d,activeIndex:h,overIndex:v}):x,le=j==null?void 0:j.id,ne=C.useRef({activeId:le,items:d,newIndex:J,containerId:f}),ge=d!==ne.current.items,Se=t({active:j,containerId:f,isDragging:B,isSorting:L,id:a,index:x,items:d,newIndex:ne.current.newIndex,previousItems:ne.current.items,previousContainerId:ne.current.containerId,transition:c,wasDragging:ne.current.activeId!=null}),Ue=FN({disabled:!Se,index:x,node:P,rect:E});return C.useEffect(()=>{L&&ne.current.newIndex!==J&&(ne.current.newIndex=J),f!==ne.current.containerId&&(ne.current.containerId=f),d!==ne.current.items&&(ne.current.items=d)},[L,J,f,d]),C.useEffect(()=>{if(le===ne.current.activeId)return;if(le!=null&&ne.current.activeId==null){ne.current.activeId=le;return}const at=setTimeout(()=>{ne.current.activeId=le},50);return()=>clearTimeout(at)},[le]),{active:j,activeIndex:h,attributes:Y,data:b,rect:E,index:x,newIndex:J,items:d,isOver:O,isSorting:L,isDragging:B,listeners:$,node:P,overIndex:v,over:H,setNodeRef:R,setActivatorNodeRef:q,setDroppableNodeRef:G,setDraggableNodeRef:N,transform:Ue!=null?Ue:ae,transition:wt()};function wt(){if(Ue||ge&&ne.current.newIndex===x)return $N;if(!(U&&!ms(A)||!c)&&(L||Se))return Un.Transition.toString(X(z({},c),{property:eb}))}}function jN(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}function ks(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const zN=[_e.Down,_e.Right,_e.Up,_e.Left],nb=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:o,over:a,scrollableAncestors:l}}=t;if(zN.includes(e.code)){if(e.preventDefault(),!n||!r)return;const s=[];o.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const h=i.get(f.id);if(h)switch(e.code){case _e.Down:r.top<h.top&&s.push(f);break;case _e.Up:r.top>h.top&&s.push(f);break;case _e.Left:r.left>h.left&&s.push(f);break;case _e.Right:r.left<h.left&&s.push(f);break}});const c=x$({active:n,collisionRect:r,droppableRects:i,droppableContainers:s,pointerCoordinates:null});let d=xv(c,"id");if(d===(a==null?void 0:a.id)&&c.length>1&&(d=c[1].id),d!=null){const f=o.get(n.id),h=o.get(d),p=h?i.get(h.id):null,m=h==null?void 0:h.node.current;if(m&&p&&f&&h){const v=xs(m).some((T,E)=>l[E]!==T),S=rb(f,h),I=VN(f,h),y=v||!S?{x:0,y:0}:{x:I?r.width-p.width:0,y:I?r.height-p.height:0},x={x:p.left,y:p.top};return y.x&&y.y?x:mo(x,y)}}}};function rb(e,t){return!ks(e)||!ks(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function VN(e,t){return!ks(e)||!ks(t)||!rb(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const ib=Ve(u.jsx("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator"),Ps=C.createContext({attributes:{},listeners:void 0,ref(){}}),UN=({disabled:e=!1})=>{const{attributes:t,listeners:n,ref:r}=C.useContext(Ps);return u.jsx(w.Button,X(z(z({sx:{backgroundColor:"transparent",color:"#919eab",width:"10px",":hover":{backgroundColor:"transparent"},":active":{backgroundColor:"transparent"}}},t),n),{ref:r,disabled:e,children:u.jsx(ib,{})}))},ob=({children:e,id:t,tooltipTitle:n,removeItem:r,useDraggable:i=!0,variant:o="plain"})=>{const{attributes:a,isDragging:l,listeners:s,setNodeRef:c,setActivatorNodeRef:d,transform:f,transition:h}=tb({id:t}),p=C.useMemo(()=>({attributes:a,listeners:s,ref:d}),[a,s,d]),m={opacity:l?.6:void 0,transform:Un.Translate.toString(f),transition:h};return u.jsx(Ps.Provider,{value:p,children:u.jsx(w.ListItem,{variant:o,ref:c,style:m,startAction:i?u.jsx(UN,{disabled:!i}):u.jsx(u.Fragment,{}),endAction:i?u.jsx(w.Tooltip,{title:n,children:u.jsx(w.Button,{variant:"outlined",color:"danger",onClick:r,sx:{ml:"auto",p:.5},size:"sm",children:u.jsx(Le.Remove,{})})}):u.jsx(u.Fragment,{}),sx:{p:2,borderRadius:"sm"},children:e})})},HN={sideEffects:Kv({styles:{active:{opacity:"0.6"}}})},ab=({children:e})=>u.jsx(PN,{dropAnimation:HN,children:e}),WN=({entities:e=[],labels:t,disabled:n,setEntities:r,removeItem:i})=>{const[o,a]=C.useState(null),l=C.useMemo(()=>e.find(c=>c.id===(o==null?void 0:o.id)),[o,e]),s=bv(ys(ws),ys(Cs,{coordinateGetter:nb}));return u.jsxs(Wv,{sensors:s,onDragStart:({active:c})=>{a(c)},onDragEnd:({active:c,over:d})=>{if(d&&c.id!==(d==null?void 0:d.id)){const f=e.findIndex(({id:p})=>p===c.id),h=e.findIndex(({id:p})=>p===d.id);r(Es(e,f,h))}a(null)},onDragCancel:()=>{a(null)},children:[u.jsx(Zv,{items:e,children:u.jsx(w.List,{sx:{gap:"10px",padding:0},children:e.map(c=>u.jsxs(ob,{id:c.id,variant:"outlined",removeItem:()=>i(c.id),tooltipTitle:t.removeEntity,useDraggable:!n,children:[u.jsx(w.Typography,{ml:2.5,children:c.title||c.name}),c.type&&u.jsx(w.Chip,{color:lB(c.type),sx:{marginLeft:2},children:cB(c.type)})]},`sortable-item-${c.id}`))})}),u.jsx(ab,{children:l?u.jsx(u.Fragment,{children:e.map(c=>u.jsx(ob,{id:c.id,useDraggable:!1,removeItem:()=>{},tooltipTitle:t.removeEntity},`sortable-overlay-item-${c.id}`))}):u.jsx(u.Fragment,{})})]})},GN=e=>u.jsxs(w.FormControl,{size:"sm",children:[u.jsx(w.FormLabel,{children:e.labels.itemsPerPage}),u.jsx(w.Select,{value:e.value,size:"sm",onChange:e.onChange,sx:{minHeight:"37px"},children:e.options.map((t,n)=>u.jsx(w.Option,{value:t,children:t},`items-per-page-${t}-${n}`))})]}),YN=(e,t)=>{const[n,r]=C.useState(null),{sdk:i}=pt(),o=()=>k(this,null,function*(){let l=[];if(!e){r(l);return}try{switch(e){case"top_x":l=(yield i.topX.getGames({limit:50},!0)).data.map(v=>({id:v.id,name:v.title,status:v.status,type:e,relationship:"relatedTo"}));break;case"match_quiz":l=(yield i.matchQuiz.getGames({limit:50},!0)).data.map(v=>({id:v.id,name:v.title,status:v.status,type:e,relationship:"relatedTo"}));break;case"template":l=(yield i.loyalty.getTemplates(void 0,!0)).data.map(v=>({id:v.id,name:v.name,status:v.status,type:e,relationship:"relatedTo"}));break;case"classic_quiz":l=(yield i.miniGames.getClassicQuizzes({limit:50},!1,!0)).data.map(v=>({id:v.id,name:v.title,status:v.status,type:e,relationship:"relatedTo"}));break;case"either_or":l=(yield i.miniGames.getEitherOrs({limit:50},!1,!0)).data.map(v=>({id:v.id,name:v.title,status:v.status,type:e,relationship:"relatedTo"}));break;case"poll":l=(yield i.voting.getPolls({limit:50},!0)).data.map(v=>({id:v.id,name:v.title,status:v.status,type:e,relationship:"relatedTo"}));break;case"bracket":l=(yield i.bracketGame.getGames({limit:50},!0)).data.map(v=>({id:v.id,name:v.title,status:v.status,type:e,relationship:"relatedTo"}));break;case"standing":l=(yield i.standingGame.getGames({limit:50},!0)).data.map(v=>({id:v.id,name:v.title,status:v.status,type:e,relationship:"relatedTo"}));break}}catch(s){console.error(s),r(l),t();return}r(l)});return C.useEffect(()=>(o(),()=>r(null)),[e]),n},KN=({status:e})=>{let t="neutral";switch(e){case"DYNAMIC":t="primary";break;case"CUSTOM":t="success";break;case"OPEN":t="primary";break;case"LIVE":t="primary";break;case"CANCELED":t="warning";break;case"SETTLED":t="success";break;case"INACTIVE":t="danger";break;case"ACTIVE":t="success";break;case"EXPIRED":t="neutral";break}return u.jsx(w.Chip,{color:t,variant:"solid",size:"sm",children:e})},qN=Ve(u.jsx("path",{d:"M12.16 3h-.32L9.21 8.25h5.58zm4.3 5.25h5.16L19 3h-5.16zm4.92 1.5h-8.63V20.1zM11.25 20.1V9.75H2.62zM7.54 8.25 10.16 3H5L2.38 8.25z"}),"Diamond"),QN=Ve(u.jsx("path",{d:"m21.58 16.09-1.09-7.66C20.21 6.46 18.52 5 16.53 5H7.47C5.48 5 3.79 6.46 3.51 8.43l-1.09 7.66C2.2 17.63 3.39 19 4.94 19c.68 0 1.32-.27 1.8-.75L9 16h6l2.25 2.25c.48.48 1.13.75 1.8.75 1.56 0 2.75-1.37 2.53-2.91M11 11H9v2H8v-2H6v-1h2V8h1v2h2zm4-1c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1m2 3c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1"}),"SportsEsports"),JN=Ve(u.jsx("path",{d:"M11.07 12.85c.77-1.39 2.25-2.21 3.11-3.44.91-1.29.4-3.7-2.18-3.7-1.69 0-2.52 1.28-2.87 2.34L6.54 6.96C7.25 4.83 9.18 3 11.99 3c2.35 0 3.96 1.07 4.78 2.41.7 1.15 1.11 3.3.03 4.9-1.2 1.77-2.35 2.31-2.97 3.45-.25.46-.35.76-.35 2.24h-2.89c-.01-.78-.13-2.05.48-3.15M14 20c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2"}),"QuestionMark"),XN=Ve(u.jsx("path",{d:"M9.01 14H2v2h7.01v3L13 15l-3.99-4zm5.98-1v-3H22V8h-7.01V5L11 9z"}),"CompareArrows"),ZN=Ve(u.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2M9 17H7v-7h2zm4 0h-2V7h2zm4 0h-2v-4h2z"}),"Poll"),eF=e=>{switch(e.entityType){case"top_x":return u.jsx(w.Tooltip,{title:"Top X",children:u.jsx(qN,{})});case"match_quiz":return u.jsx(w.Tooltip,{title:"Match Quiz",children:u.jsx(QN,{})});case"template":return u.jsx(w.Tooltip,{title:"Leaderboard Templates",children:u.jsx(Le.EmojiEvents,{})});case"classic_quiz":return u.jsx(w.Tooltip,{title:"Classic Quiz",children:u.jsx(JN,{})});case"either_or":return u.jsx(w.Tooltip,{title:"Either/Or",children:u.jsx(XN,{})});case"poll":return u.jsx(w.Tooltip,{title:"Poll",children:u.jsx(ZN,{})});case"bracket":return u.jsx(w.Tooltip,{title:"Custom Bracket Game",children:u.jsx(Le.EmojiEvents,{})});case"standing":return u.jsx(w.Tooltip,{title:"Custom Standings Game",children:u.jsx(Le.EmojiEvents,{})});default:return null}},tF=({entity:e,deleteLabel:t,onDelete:n})=>u.jsx(u.Fragment,{children:u.jsx(w.Card,{sx:{p:2,mb:2},children:u.jsx(w.CardContent,{children:u.jsxs(w.Box,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},alignItems:"center",justifyContent:"space-between"},children:[u.jsx(w.Typography,{fontSize:"sm",startDecorator:u.jsx(eF,{entityType:e.type}),children:e.name}),u.jsx(w.Box,{display:{xs:"none",md:"block"},children:u.jsx(KN,{status:e.status})}),u.jsx(w.Box,{children:u.jsx(w.Tooltip,{title:t,children:u.jsx(w.IconButton,{onClick:()=>n(e.id,e.relationship),color:"danger",size:"sm",children:u.jsx(Le.Delete,{})})})})]})})})}),nF=(e,t,n,r)=>k(this,null,function*(){let o=[];const a=new Map;t.forEach(l=>{if(a.has(l.entity_type)){const s=a.get(l.entity_type);a.set(l.entity_type,[...s,[l.entity_id,l.entity_relationship]])}else a.set(l.entity_type,[[l.entity_id,l.entity_relationship]])});try{for(const[l,s]of a)switch(l){case"top_x":const c=s.map(([O])=>O),d=yield e.topX.getGames({limit:c.length,gameIds:c},!0);o=[...o,...d.data.map(O=>{var j;const G=((j=s.find(([A])=>A===O.id))==null?void 0:j[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;case"match_quiz":const f=s.map(([O])=>O),h=yield e.matchQuiz.getGames({limit:f.length,gameIds:f},!0);o=[...o,...h.data.map(O=>{var j;const G=((j=s.find(([A])=>A===O.id))==null?void 0:j[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;case"template":const p=s.map(([O])=>O),m=yield e.loyalty.getTemplates(void 0,!0);o=[...o,...m.data.filter(O=>p.includes(O.id)).map(O=>{var j;const G=((j=s.find(([A])=>A===O.id))==null?void 0:j[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;case"classic_quiz":const g=s.map(([O])=>O),v=yield e.miniGames.getClassicQuizzes({limit:g.length,classicQuizIds:g},!1,!0);o=[...o,...v.data.map(O=>{var j;const G=((j=s.find(([A])=>A===O.id))==null?void 0:j[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;case"either_or":const S=s.map(([O])=>O),I=yield e.miniGames.getEitherOrs({limit:S.length,eitherOrIds:S},!1,!0);o=[...o,...I.data.map(O=>{var j;const G=((j=s.find(([A])=>A===O.id))==null?void 0:j[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;case"poll":const y=s.map(([O])=>O),x=yield e.voting.getPolls({limit:y.length,pollIds:y},!0);o=[...o,...x.data.map(O=>{var j;const G=((j=s.find(([A])=>A===O.id))==null?void 0:j[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;case"bracket":const b=s.map(([O])=>O),T=yield e.bracketGame.getGames({limit:b.length,gameIds:b},!0);o=[...o,...T.data.map(O=>{var j;const G=((j=s.find(([A])=>A===O.id))==null?void 0:j[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;case"standing":const E=s.map(([O])=>O),P=yield e.standingGame.getGames({limit:E.length,gameIds:E},!0);o=[...o,...P.data.map(O=>{var j;const G=((j=s.find(([A])=>A===O.id))==null?void 0:j[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;default:}}catch(l){console.error("Error loading related entities",l),n(o),r()}n(o)}),rF=["top_x","match_quiz","template","classic_quiz","poll","either_or","bracket","standing"],iF=["relatedTo","blocks","blockedBy","bonusPointsGame","nextInSeries","previousInSeries"],oF=new Map().set("template","Leaderboard Templates").set("classic_quiz","Classic Quiz").set("either_or","Either/Or").set("match_quiz","Match Quiz").set("top_x","Top X").set("bracket","Custom Bracket Game").set("standing","Custom Standing Game").set("poll","Poll"),sb=new Map().set("relatedTo","Related to").set("blocks","Blocks").set("blockedBy","Blocked by").set("nextInSeries","Next in series").set("previousInSeries","Previous in series").set("bonusPointsGame","Bonus points game"),aF=({defaultValue:e=[],onChange:t,labels:n})=>{const[r,i]=C.useState([]),[o,a]=C.useState(""),[l,s]=C.useState(null),[c,d]=C.useState("relatedTo"),[f,h]=C.useState(!1),p=()=>h(!f),m=YN(l,p),{sdk:g}=pt();C.useEffect(()=>(e.length>0&&nF(g,e,i,p),()=>{i([]),a(""),s(null),d("relatedTo")}),[]);const v=()=>{if(e.some(E=>E.entity_id===o&&E.entity_relationship===c)){a("");return}const b=[...e,{entity_id:o,entity_type:l,entity_relationship:c}],T=(m==null?void 0:m.filter(E=>E.id===o).map(E=>({id:E.id,name:E.name,type:l,status:E.status,relationship:c})))||[];i([...r,...T]),t(b),a("")},S=(x,b)=>{const T=e.filter(P=>!(P.entity_id===x&&P.entity_relationship===b)),E=r.filter(P=>!(P.id===x&&P.relationship===b));i(E),t(T)},I=r.reduce((x,b)=>{const T=b.relationship;return x[T]||(x[T]=[]),x[T].push(b),x},{}),y=Object.keys(I).sort();return u.jsxs(u.Fragment,{children:[y.map(x=>u.jsxs(w.Box,{sx:{mb:2},children:[u.jsx(w.Typography,{level:"title-md",sx:{fontWeight:"bold",mb:1},children:u.jsx(w.Chip,{variant:"outlined",size:"md",sx:{bgcolor:"background.surface"},children:sb.get(x)||"Unknown relationship"})}),I[x].map((b,T)=>u.jsx(tF,{entity:b,deleteLabel:n.delete,onDelete:S},`related-entity-relationship-${b.id}-${T}`))]},`relationship-group-${x}`)),u.jsxs(w.Box,{sx:{display:"flex",flexDirection:"column",width:"100%",gap:1},children:[u.jsxs(w.FormControl,{children:[u.jsx(w.FormLabel,{required:!0,color:"primary",children:n.type}),u.jsx(w.Select,{value:l,size:"sm",name:"entity_type",onChange:(x,b)=>s(b),sx:{minHeight:"37px"},children:rF.map(x=>u.jsx(w.Option,{value:x,children:oF.get(x)},`entity-type-option-${x}`))})]}),u.jsxs(w.FormControl,{children:[u.jsx(w.FormLabel,{required:!0,color:"primary",children:n.relationship}),u.jsx(w.Select,{value:c,size:"sm",name:"entity_relationship",onChange:(x,b)=>d(b),sx:{minHeight:"37px"},children:iF.map(x=>u.jsx(w.Option,{value:x,children:sb.get(x)},`entity-relationship-option-${x}`))})]}),u.jsxs(w.FormControl,{children:[u.jsx(w.FormLabel,{required:!0,color:"primary",children:n.entity}),u.jsx(w.Select,{value:o,size:"sm",name:"entity_id",onChange:(x,b)=>a(b),sx:{width:"100%",mr:{xs:0,md:1},mb:{xs:1,md:0},minHeight:"37px"},endDecorator:!m&&u.jsx(w.CircularProgress,{size:"sm"}),children:m&&m.map(x=>u.jsx(w.Option,{value:x.id,children:x.name},`entity--${x.id}`))})]}),u.jsx(w.Button,{startDecorator:u.jsx(Le.Add,{}),disabled:!o||!l,onClick:v,sx:{mb:1},children:n.add})]}),u.jsx(ut,{showToast:f,message:n.relatedEntitiesErrorMessage,color:"danger",hideToast:p})]})},sF=e=>{const[t,n]=C.useState(!1),[r,i]=C.useState(!1),[o,a]=C.useState("success"),[l,s]=C.useState(""),c=C.useContext(Xo),d=(h,p)=>{a(h),s(p),i(!0)},f=()=>k(this,null,function*(){n(!0);const h=yield c==null?void 0:c.https.exportLeadsPerEntity(e.entityId);if(h!=null&&h.ok){const p=yield h.blob(),m=URL.createObjectURL(p),g=document.createElement("a");g.href=m,g.download=`${e.entityType}_${e.entityName}_exported_users_leads.csv`,document.body.appendChild(g),g.click(),document.body.removeChild(g),URL.revokeObjectURL(m),n(!1),d("success",e.labels.usersLeadsExportMessage)}else console.error("Failed to export all users leads: ",yield h==null?void 0:h.json()),n(!1),d("danger",e.labels.usersLeadsExportErrorMessage)});return u.jsxs(u.Fragment,{children:[u.jsxs(w.Box,{mb:2,children:[u.jsx(w.Box,{display:"flex",alignItems:"center",mb:1,children:u.jsx(w.Typography,{level:"body-lg",sx:{mx:"auto"},children:e.labels.exportUsersLeads})}),u.jsx(w.Sheet,{sx:{overflowX:"auto",minWidth:"700px"},children:u.jsxs(w.Table,{variant:"outlined",hoverRow:!1,borderAxis:"bothBetween",size:"sm",sx:{backgroundColor:"#fff","& > thead > tr > th:first-child, & > tbody > tr > td:first-child":{textAlign:"left",width:"50%"},"--TableCell-paddingX":"0.5rem",cursor:"default","& > tbody > tr:hover":{backgroundColor:"transparent"},"& > thead > tr > th":{backgroundColor:"#fff",verticalAlign:"middle"},"& > thead > tr > th, & > tbody > tr > td":{textAlign:"right"}},children:[u.jsx("thead",{children:u.jsxs("tr",{children:[u.jsx("th",{children:e.labels.category}),u.jsx("th",{children:e.labels.action})]})}),u.jsx("tbody",{children:u.jsxs("tr",{children:[u.jsxs("td",{children:[u.jsx(w.Typography,{level:"body-sm",fontWeight:"600",children:e.labels.exportAllUsersLeads}),u.jsx(w.Typography,{level:"body-xs",color:"neutral",children:e.labels.exportAllUsersLeadsDescription})]}),u.jsx("td",{children:u.jsx(w.Button,{loading:t,onClick:f,children:e.labels.exportAllUsersLeads})})]})})]})})]}),u.jsx(ut,{showToast:r,color:o,message:l,hideToast:()=>i(!1)})]})},lF=({tooltipContent:e="Drag to reorder"})=>{const{attributes:t,listeners:n,ref:r}=C.useContext(Ps);return u.jsx(w.Tooltip,{title:e,placement:"left",arrow:!0,children:u.jsx(w.IconButton,X(z(z({variant:"plain",color:"neutral",size:"sm",sx:{color:"text.tertiary",my:"auto",mr:1,":hover":{bgcolor:"action.hover"},":active":{bgcolor:"action.selected"},transition:"all 0.2s",cursor:"grab","&:active":{cursor:"grabbing"}}},t),n),{ref:r,children:u.jsx(ib,{})}))})},lb=({id:e,useDraggable:t=!0,variant:n="outlined",item:r,tooltipContent:i})=>{const{attributes:o,isDragging:a,listeners:l,setNodeRef:s,setActivatorNodeRef:c,transform:d,transition:f}=tb({id:e}),h=C.useMemo(()=>({attributes:o,listeners:l,ref:c}),[o,l,c]),p={opacity:a?.6:void 0,transform:Un.Translate.toString(d),transition:f},m=v=>v.split(" ").map(S=>S[0]).join("").toUpperCase().substring(0,2),g=v=>r!=null&&r.color?r.color:`hsl(${v.split("").reduce((y,x)=>x.charCodeAt(0)+((y<<5)-y),0)%360}, 70%, 80%)`;return u.jsx(Ps.Provider,{value:h,children:u.jsx(w.ListItem,{variant:n,ref:s,style:p,endAction:t?u.jsx(lF,{tooltipContent:i}):null,sx:{p:0,borderRadius:"md",overflow:"hidden",transition:"all 0.2s",boxShadow:a?"md":"sm",transform:`scale(${a?1.02:1})`,border:"1px solid",borderColor:"divider"},children:u.jsxs(w.Box,{sx:{display:"flex",width:"100%",alignItems:"center",gap:2,p:0},children:[u.jsx(w.Sheet,{sx:{width:"8px",alignSelf:"stretch",bgcolor:g(r.name)}}),u.jsx(w.Avatar,{src:r.image,alt:r.name,sx:{bgcolor:g(r.name),my:2,ml:1},children:m(r.name)}),u.jsxs(w.Box,{sx:{py:2,pr:2,flexGrow:1,display:"flex",flexDirection:"column",gap:.5},children:[u.jsx(w.Typography,{level:"title-md",children:r.name}),r.description&&u.jsx(w.Typography,{level:"body-sm",sx:{color:"text.secondary",textOverflow:"ellipsis"},children:r.description}),u.jsx(w.Box,{sx:{mt:.5},children:r.type&&u.jsx(w.Chip,{variant:"soft",color:"primary",size:"sm",sx:{px:1,bgcolor:`${g(r.type)}40`},children:r.type})})]})]})})})},cF={Login:GR,InformationInput:eo,RichText:cc,HeaderButtons:CP,MarketSelection:sM,Accordion:lT,DynamicFields:NP,BasicSelect:uT,BooleanSwitch:PL,Branding:xP,ProfileSearchSelect:_L,RangeCalendar:BP,CompetitionSearchSelect:TL,Related:dM,Images:wR,Duration:LP,DatePickerComponent:to,Flags:bR,Spinner:us,Tags:Dm,Toast:ut,AdContent:cT,Match:lM,Winners:vB,CompetitionsSearchSelect:EL,TeamsSearchSelect:kL,CustomSelect:EM,Schedule:xM,NoPermissionCard:$P,CustomFlatpickrCalendar:Yc,ContextSelectFilter:yB,NumberInput:WB,EntityContext:XB,MiniGamesImages:e$,AuthRequirement:t$,SortableList:WN,ItemsPerPageFilter:GN,ImageCard:so,RelatedRelationship:aF,ExportUsersLeads:sF,SignOutButton:ig,BasicSortableList:({items:e=[],labels:t,setItems:n})=>{const[r,i]=C.useState(null),o=C.useMemo(()=>e.find(l=>l.id===(r==null?void 0:r.id)),[r,e]),a=bv(ys(ws,{activationConstraint:{distance:8}}),ys(Cs,{coordinateGetter:nb}));return e.length===0?u.jsx(w.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",border:"1px dashed",borderColor:"divider",borderRadius:"md"},children:u.jsx(w.Typography,{level:"body-lg",color:"neutral",children:(t==null?void 0:t.noItemsToDisplay)||"No items to display"})}):u.jsxs(Wv,{sensors:a,onDragStart:({active:l})=>{i(l)},onDragEnd:({active:l,over:s})=>{if(s&&l.id!==(s==null?void 0:s.id)){const c=e.findIndex(({id:f})=>f===l.id),d=e.findIndex(({id:f})=>f===s.id);n(Es(e,c,d))}i(null)},onDragCancel:()=>{i(null)},children:[u.jsx(Zv,{items:e,children:u.jsx(w.List,{sx:{gap:2,maxHeight:"70vh",overflowY:"auto","&::-webkit-scrollbar":{width:"8px"},"&::-webkit-scrollbar-thumb":{backgroundColor:"action.focus",borderRadius:"4px"}},children:e.map(l=>u.jsx(lb,{id:l.id,variant:"outlined",item:l,tooltipContent:t==null?void 0:t.dragToReorder},`sortable-item-${l.id}`))})}),u.jsx(ab,{children:o?u.jsx(lb,{id:o.id,useDraggable:!1,item:o,tooltipContent:t.dragToReorder},`sortable-overlay-item-${o.id}`):null})]})}},cb=C.createContext(null),uF=({children:e})=>u.jsx(cb.Provider,{value:cF,children:e}),dF=()=>{const e=C.useContext(cb);if(!e)throw new Error("useComponentContext must be used within a ComponentProvider");return e},ub=425,db=1024;return{APIProvider:CI,AuthProvider:wI,AuthContext:Nf,ComponentProvider:uF,useComponentContext:dF,useAPIContext:pt,useIsMobile:()=>{const[e,t]=C.useState(window.innerWidth<=db),[n,r]=C.useState(window.innerWidth<=ub);return C.useLayoutEffect(()=>{const i=()=>{t(window.innerWidth<=db),r(window.innerWidth<=ub)};return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]),{isMobile:e,isPhone:n}}}});
2475
+ `},p$={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 g$(e){let{announcements:t=p$,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=h$}=e;const{announce:o,announcement:a}=u$(),l=go("DndLiveRegion"),[s,c]=C.useState(!1);if(C.useEffect(()=>{c(!0)},[]),d$(C.useMemo(()=>({onDragStart(f){let{active:h}=f;o(t.onDragStart({active:h}))},onDragMove(f){let{active:h,over:p}=f;t.onDragMove&&o(t.onDragMove({active:h,over:p}))},onDragOver(f){let{active:h,over:p}=f;o(t.onDragOver({active:h,over:p}))},onDragEnd(f){let{active:h,over:p}=f;o(t.onDragEnd({active:h,over:p}))},onDragCancel(f){let{active:h,over:p}=f;o(t.onDragCancel({active:h,over:p}))}}),[o,t])),!s)return null;const d=C.createElement(C.Fragment,null,C.createElement(l$,{id:r,value:i.draggable}),C.createElement(c$,{id:l,announcement:a}));return n?Oe.createPortal(d,n):d}var mt;(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"})(mt||(mt={}));function bs(){}function ys(e,t){return C.useMemo(()=>({sensor:e,options:t!=null?t:{}}),[e,t])}function bv(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return C.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const cn=Object.freeze({x:0,y:0});function m$(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function v$(e,t){const n=vs(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function b$(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function y$(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function yv(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function xv(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}const x$=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=yv(t),o=[];for(const a of r){const{id:l}=a,s=n.get(l);if(s){const c=yv(s),d=i.reduce((h,p,m)=>h+m$(c[m],p),0),f=Number((d/4).toFixed(4));o.push({id:l,data:{droppableContainer:a,value:f}})}}return o.sort(b$)};function C$(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),a=i-r,l=o-n;if(r<i&&n<o){const s=t.width*t.height,c=e.width*e.height,d=a*l,f=d/(s+c-d);return Number(f.toFixed(4))}return 0}const w$=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:a}=o,l=n.get(a);if(l){const s=C$(l,t);s>0&&i.push({id:a,data:{droppableContainer:o,value:s}})}}return i.sort(y$)};function I$(e,t,n){return X(z({},e),{scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1})}function Cv(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:cn}function S$(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return i.reduce((a,l)=>X(z({},a),{top:a.top+e*l.y,bottom:a.bottom+e*l.y,left:a.left+e*l.x,right:a.right+e*l.x}),z({},n))}}const A$=S$(1);function wv(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 T$(e,t,n){const r=wv(t);if(!r)return e;const{scaleX:i,scaleY:o,x:a,y:l}=r,s=e.left-a-(1-i)*parseFloat(n),c=e.top-l-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),d=i?e.width/i:e.width,f=o?e.height/o:e.height;return{width:d,height:f,top:c,right:s+d,bottom:c+f,left:s}}const E$={ignoreTransform:!1};function hi(e,t){t===void 0&&(t=E$);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:d}=Rt(e).getComputedStyle(e);c&&(n=T$(n,c,d))}const{top:r,left:i,width:o,height:a,bottom:l,right:s}=n;return{top:r,left:i,width:o,height:a,bottom:l,right:s}}function Iv(e){return hi(e,{ignoreTransform:!0})}function _$(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function k$(e,t){return t===void 0&&(t=Rt(e).getComputedStyle(e)),t.position==="fixed"}function P$(e,t){t===void 0&&(t=Rt(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})}function xs(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(yu(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!fo(i)||pv(i)||n.includes(i))return n;const o=Rt(e).getComputedStyle(i);return i!==e&&P$(i,o)&&n.push(i),k$(i,o)?n:r(i.parentNode)}return e?r(e):n}function Sv(e){const[t]=xs(e,1);return t!=null?t:null}function Cu(e){return!fs||!e?null:ui(e)?e:bu(e)?yu(e)||e===di(e).scrollingElement?window:fo(e)?e:null:null}function Av(e){return ui(e)?e.scrollX:e.scrollLeft}function Tv(e){return ui(e)?e.scrollY:e.scrollTop}function wu(e){return{x:Av(e),y:Tv(e)}}var xt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(xt||(xt={}));function Ev(e){return!fs||!e?!1:e===document.scrollingElement}function _v(e){const t={x:0,y:0},n=Ev(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:a,isRight:l,maxScroll:r,minScroll:t}}const D$={x:.2,y:.2};function O$(e,t,n,r,i){let{top:o,left:a,right:l,bottom:s}=n;r===void 0&&(r=10),i===void 0&&(i=D$);const{isTop:c,isBottom:d,isLeft:f,isRight:h}=_v(e),p={x:0,y:0},m={x:0,y:0},g={height:t.height*i.y,width:t.width*i.x};return!c&&o<=t.top+g.height?(p.y=xt.Backward,m.y=r*Math.abs((t.top+g.height-o)/g.height)):!d&&s>=t.bottom-g.height&&(p.y=xt.Forward,m.y=r*Math.abs((t.bottom-g.height-s)/g.height)),!h&&l>=t.right-g.width?(p.x=xt.Forward,m.x=r*Math.abs((t.right-g.width-l)/g.width)):!f&&a<=t.left+g.width&&(p.x=xt.Backward,m.x=r*Math.abs((t.left+g.width-a)/g.width)),{direction:p,speed:m}}function R$(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:a}=window;return{top:0,left:0,right:o,bottom:a,width:o,height:a}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function kv(e){return e.reduce((t,n)=>fi(t,wu(n)),cn)}function M$(e){return e.reduce((t,n)=>t+Av(n),0)}function L$(e){return e.reduce((t,n)=>t+Tv(n),0)}function Pv(e,t){if(t===void 0&&(t=hi),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);Sv(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const B$=[["x",["left","right"],M$],["y",["top","bottom"],L$]];class Iu{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=xs(n),i=kv(r);this.rect=z({},t),this.width=t.width,this.height=t.height;for(const[o,a,l]of B$)for(const s of a)Object.defineProperty(this,s,{get:()=>{const c=l(r),d=i[o]-c;return this.rect[s]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class vo{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 i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function $$(e){const{EventTarget:t}=Rt(e);return e instanceof t?e:di(e)}function Su(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(mi(n,2)+mi(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 on;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(on||(on={}));function Dv(e){e.preventDefault()}function N$(e){e.stopPropagation()}var _e;(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"})(_e||(_e={}));const Ov={start:[_e.Space,_e.Enter],cancel:[_e.Esc],end:[_e.Space,_e.Enter,_e.Tab]},F$=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case _e.Right:return X(z({},n),{x:n.x+25});case _e.Left:return X(z({},n),{x:n.x-25});case _e.Down:return X(z({},n),{y:n.y+25});case _e.Up:return X(z({},n),{y:n.y-25})}};class Cs{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 vo(di(n)),this.windowListeners=new vo(Rt(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(on.Resize,this.handleCancel),this.windowListeners.add(on.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(on.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Pv(r),n(cn)}handleKeyDown(t){if(ms(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=Ov,coordinateGetter:a=F$,scrollBehavior:l="smooth"}=i,{code:s}=t;if(o.end.includes(s)){this.handleEnd(t);return}if(o.cancel.includes(s)){this.handleCancel(t);return}const{collisionRect:c}=r.current,d=c?{x:c.left,y:c.top}:cn;this.referenceCoordinates||(this.referenceCoordinates=d);const f=a(t,{active:n,context:r.current,currentCoordinates:d});if(f){const h=mo(f,d),p={x:0,y:0},{scrollableAncestors:m}=r.current;for(const g of m){const v=t.code,{isTop:S,isRight:I,isLeft:y,isBottom:x,maxScroll:b,minScroll:T}=_v(g),E=R$(g),P={x:Math.min(v===_e.Right?E.right-E.width/2:E.right,Math.max(v===_e.Right?E.left:E.left+E.width/2,f.x)),y:Math.min(v===_e.Down?E.bottom-E.height/2:E.bottom,Math.max(v===_e.Down?E.top:E.top+E.height/2,f.y))},O=v===_e.Right&&!I||v===_e.Left&&!y,G=v===_e.Down&&!x||v===_e.Up&&!S;if(O&&P.x!==f.x){const j=g.scrollLeft+h.x,A=v===_e.Right&&j<=b.x||v===_e.Left&&j>=T.x;if(A&&!h.y){g.scrollTo({left:j,behavior:l});return}A?p.x=g.scrollLeft-j:p.x=v===_e.Right?g.scrollLeft-b.x:g.scrollLeft-T.x,p.x&&g.scrollBy({left:-p.x,behavior:l});break}else if(G&&P.y!==f.y){const j=g.scrollTop+h.y,A=v===_e.Down&&j<=b.y||v===_e.Up&&j>=T.y;if(A&&!h.x){g.scrollTo({top:j,behavior:l});return}A?p.y=g.scrollTop-j:p.y=v===_e.Down?g.scrollTop-b.y:g.scrollTop-T.y,p.y&&g.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(t,fi(mo(f,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()}}Cs.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Ov,onActivation:i}=t,{active:o}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const l=o.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function Rv(e){return!!(e&&"distance"in e)}function Mv(e){return!!(e&&"delay"in e)}class Au{constructor(t,n,r){var i;r===void 0&&(r=$$(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:o}=t,{target:a}=o;this.props=t,this.events=n,this.document=di(a),this.documentListeners=new vo(this.document),this.listeners=new vo(r),this.windowListeners=new vo(Rt(a)),this.initialCoordinates=(i=vs(o))!=null?i:cn,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(on.Resize,this.handleCancel),this.windowListeners.add(on.DragStart,Dv),this.windowListeners.add(on.VisibilityChange,this.handleCancel),this.windowListeners.add(on.ContextMenu,Dv),this.documentListeners.add(on.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Mv(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Rv(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:i}=this.props;i(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(on.Click,N$,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(on.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:a,options:{activationConstraint:l}}=o;if(!i)return;const s=(n=vs(t))!=null?n:cn,c=mo(i,s);if(!r&&l){if(Rv(l)){if(l.tolerance!=null&&Su(c,l.tolerance))return this.handleCancel();if(Su(c,l.distance))return this.handleStart()}if(Mv(l)&&Su(c,l.tolerance))return this.handleCancel();this.handlePending(l,c);return}t.cancelable&&t.preventDefault(),a(s)}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===_e.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const j$={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class ws extends Au{constructor(t){const{event:n}=t,r=di(n.target);super(t,j$,r)}}ws.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const z$={move:{name:"mousemove"},end:{name:"mouseup"}};var Tu;(function(e){e[e.RightClick=2]="RightClick"})(Tu||(Tu={}));class V$ extends Au{constructor(t){super(t,z$,di(t.event.target))}}V$.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Tu.RightClick?!1:(r==null||r({event:n}),!0)}}];const Eu={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class U$ extends Au{constructor(t){super(t,Eu)}static setup(){return window.addEventListener(Eu.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Eu.move.name,t)};function t(){}}}U$.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var bo;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(bo||(bo={}));var Is;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Is||(Is={}));function H$(e){let{acceleration:t,activator:n=bo.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:a=5,order:l=Is.TreeOrder,pointerCoordinates:s,scrollableAncestors:c,scrollableAncestorRects:d,delta:f,threshold:h}=e;const p=G$({delta:f,disabled:!o}),[m,g]=r$(),v=C.useRef({x:0,y:0}),S=C.useRef({x:0,y:0}),I=C.useMemo(()=>{switch(n){case bo.Pointer:return s?{top:s.y,bottom:s.y,left:s.x,right:s.x}:null;case bo.DraggableRect:return i}},[n,i,s]),y=C.useRef(null),x=C.useCallback(()=>{const T=y.current;if(!T)return;const E=v.current.x*S.current.x,P=v.current.y*S.current.y;T.scrollBy(E,P)},[]),b=C.useMemo(()=>l===Is.TreeOrder?[...c].reverse():c,[l,c]);C.useEffect(()=>{if(!o||!c.length||!I){g();return}for(const T of b){if((r==null?void 0:r(T))===!1)continue;const E=c.indexOf(T),P=d[E];if(!P)continue;const{direction:O,speed:G}=O$(T,P,I,t,h);for(const j of["x","y"])p[j][O[j]]||(G[j]=0,O[j]=0);if(G.x>0||G.y>0){g(),y.current=T,m(x,a),v.current=G,S.current=O;return}}v.current={x:0,y:0},S.current={x:0,y:0},g()},[t,x,r,g,o,a,JSON.stringify(I),JSON.stringify(p),m,c,b,d,JSON.stringify(h)])}const W$={x:{[xt.Backward]:!1,[xt.Forward]:!1},y:{[xt.Backward]:!1,[xt.Forward]:!1}};function G$(e){let{delta:t,disabled:n}=e;const r=gs(t);return po(i=>{if(n||!r||!i)return W$;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[xt.Backward]:i.x[xt.Backward]||o.x===-1,[xt.Forward]:i.x[xt.Forward]||o.x===1},y:{[xt.Backward]:i.y[xt.Backward]||o.y===-1,[xt.Forward]:i.y[xt.Forward]||o.y===1}}},[n,t,r])}function Y$(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return po(i=>{var o;return t==null?null:(o=r!=null?r:i)!=null?o:null},[r,t])}function K$(e,t){return C.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...o]},[]),[e,t])}var yo;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(yo||(yo={}));var _u;(function(e){e.Optimized="optimized"})(_u||(_u={}));const Lv=new Map;function q$(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,a]=C.useState(null),{frequency:l,measure:s,strategy:c}=i,d=C.useRef(e),f=v(),h=ho(f),p=C.useCallback(function(S){S===void 0&&(S=[]),!h.current&&a(I=>I===null?S:I.concat(S.filter(y=>!I.includes(y))))},[h]),m=C.useRef(null),g=po(S=>{if(f&&!n)return Lv;if(!S||S===Lv||d.current!==e||o!=null){const I=new Map;for(let y of e){if(!y)continue;if(o&&o.length>0&&!o.includes(y.id)&&y.rect.current){I.set(y.id,y.rect.current);continue}const x=y.node.current,b=x?new Iu(s(x),x):null;y.rect.current=b,b&&I.set(y.id,b)}return I}return S},[e,o,n,f,s]);return C.useEffect(()=>{d.current=e},[e]),C.useEffect(()=>{f||p()},[n,f]),C.useEffect(()=>{o&&o.length>0&&a(null)},[JSON.stringify(o)]),C.useEffect(()=>{f||typeof l!="number"||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},l))},[l,f,p,...r]),{droppableRects:g,measureDroppableContainers:p,measuringScheduled:o!=null};function v(){switch(c){case yo.Always:return!1;case yo.BeforeDragging:return n;default:return!n}}}function ku(e,t){return po(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Q$(e,t){return ku(e,t)}function J$(e){let{callback:t,disabled:n}=e;const r=hs(t),i=C.useMemo(()=>{if(n||typeof window=="undefined"||typeof window.MutationObserver=="undefined")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return C.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function Ss(e){let{callback:t,disabled:n}=e;const r=hs(t),i=C.useMemo(()=>{if(n||typeof window=="undefined"||typeof window.ResizeObserver=="undefined")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return C.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function X$(e){return new Iu(hi(e),e)}function Bv(e,t,n){t===void 0&&(t=X$);const[r,i]=C.useState(null);function o(){i(s=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=s!=null?s:n)!=null?c:null}const d=t(e);return JSON.stringify(s)===JSON.stringify(d)?s:d})}const a=J$({callback(s){if(e)for(const c of s){const{type:d,target:f}=c;if(d==="childList"&&f instanceof HTMLElement&&f.contains(e)){o();break}}}}),l=Ss({callback:o});return ln(()=>{o(),e?(l==null||l.observe(e),a==null||a.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),a==null||a.disconnect())},[e]),r}function Z$(e){const t=ku(e);return Cv(e,t)}const $v=[];function eN(e){const t=C.useRef(e),n=po(r=>e?r&&r!==$v&&e&&t.current&&e.parentNode===t.current.parentNode?r:xs(e):$v,[e]);return C.useEffect(()=>{t.current=e},[e]),n}function tN(e){const[t,n]=C.useState(null),r=C.useRef(e),i=C.useCallback(o=>{const a=Cu(o.target);a&&n(l=>l?(l.set(a,wu(a)),new Map(l)):null)},[]);return C.useEffect(()=>{const o=r.current;if(e!==o){a(o);const l=e.map(s=>{const c=Cu(s);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,wu(c)]):null}).filter(s=>s!=null);n(l.length?new Map(l):null),r.current=e}return()=>{a(e),a(o)};function a(l){l.forEach(s=>{const c=Cu(s);c==null||c.removeEventListener("scroll",i)})}},[i,e]),C.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,a)=>fi(o,a),cn):kv(e):cn,[e,t])}function Nv(e,t){t===void 0&&(t=[]);const n=C.useRef(null);return C.useEffect(()=>{n.current=null},t),C.useEffect(()=>{const r=e!==cn;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?mo(e,n.current):cn}function nN(e){C.useEffect(()=>{if(!fs)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==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function rN(e,t){return C.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=a=>{o(a,t)},n},{}),[e,t])}function Fv(e){return C.useMemo(()=>e?_$(e):null,[e])}const jv=[];function iN(e,t){t===void 0&&(t=hi);const[n]=e,r=Fv(n?Rt(n):null),[i,o]=C.useState(jv);function a(){o(()=>e.length?e.map(s=>Ev(s)?r:new Iu(t(s),s)):jv)}const l=Ss({callback:a});return ln(()=>{l==null||l.disconnect(),a(),e.forEach(s=>l==null?void 0:l.observe(s))},[e]),i}function zv(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return fo(t)?t:e}function oN(e){let{measure:t}=e;const[n,r]=C.useState(null),i=C.useCallback(c=>{for(const{target:d}of c)if(fo(d)){r(f=>{const h=t(d);return f?X(z({},f),{width:h.width,height:h.height}):h});break}},[t]),o=Ss({callback:i}),a=C.useCallback(c=>{const d=zv(c);o==null||o.disconnect(),d&&(o==null||o.observe(d)),r(d?t(d):null)},[t,o]),[l,s]=ps(a);return C.useMemo(()=>({nodeRef:l,rect:n,setRef:s}),[n,l,s])}const aN=[{sensor:ws,options:{}},{sensor:Cs,options:{}}],sN={current:{}},As={draggable:{measure:Iv},droppable:{measure:Iv,strategy:yo.WhileDragging,frequency:_u.Optimized},dragOverlay:{measure:hi}};class xo 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 lN={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new xo,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:bs},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:As,measureDroppableContainers:bs,windowRect:null,measuringScheduled:!1},Vv={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:bs,draggableNodes:new Map,over:null,measureDroppableContainers:bs},Co=C.createContext(Vv),Uv=C.createContext(lN);function cN(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new xo}}}function uN(e,t){switch(t.type){case mt.DragStart:return X(z({},e),{draggable:X(z({},e.draggable),{initialCoordinates:t.initialCoordinates,active:t.active})});case mt.DragMove:return e.draggable.active==null?e:X(z({},e),{draggable:X(z({},e.draggable),{translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}})});case mt.DragEnd:case mt.DragCancel:return X(z({},e),{draggable:X(z({},e.draggable),{active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}})});case mt.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new xo(e.droppable.containers);return i.set(r,n),X(z({},e),{droppable:X(z({},e.droppable),{containers:i})})}case mt.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const a=new xo(e.droppable.containers);return a.set(n,X(z({},o),{disabled:i})),X(z({},e),{droppable:X(z({},e.droppable),{containers:a})})}case mt.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new xo(e.droppable.containers);return o.delete(n),X(z({},e),{droppable:X(z({},e.droppable),{containers:o})})}default:return e}}function dN(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=C.useContext(Co),o=gs(r),a=gs(n==null?void 0:n.id);return C.useEffect(()=>{if(!t&&!r&&o&&a!=null){if(!ms(o)||document.activeElement===o.target)return;const l=i.get(a);if(!l)return;const{activatorNode:s,node:c}=l;if(!s.current&&!c.current)return;requestAnimationFrame(()=>{for(const d of[s.current,c.current]){if(!d)continue;const f=a$(d);if(f){f.focus();break}}})}},[r,t,i,a,o]),null}function Hv(e,t){let i=t,{transform:n}=i,r=We(i,["transform"]);return e!=null&&e.length?e.reduce((o,a)=>a(z({transform:o},r)),n):n}function fN(e){return C.useMemo(()=>({draggable:z(z({},As.draggable),e==null?void 0:e.draggable),droppable:z(z({},As.droppable),e==null?void 0:e.droppable),dragOverlay:z(z({},As.dragOverlay),e==null?void 0:e.dragOverlay)}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function hN(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=C.useRef(!1),{x:a,y:l}=typeof i=="boolean"?{x:i,y:i}:i;ln(()=>{if(!a&&!l||!t){o.current=!1;return}if(o.current||!r)return;const c=t==null?void 0:t.node.current;if(!c||c.isConnected===!1)return;const d=n(c),f=Cv(d,r);if(a||(f.x=0),l||(f.y=0),o.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=Sv(c);h&&h.scrollBy({top:f.y,left:f.x})}},[t,a,l,r,n])}const Ts=C.createContext(X(z({},cn),{scaleX:1,scaleY:1}));var ir;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ir||(ir={}));const Wv=C.memo(function(t){var n,r,i,o;let Rs=t,{id:a,accessibility:l,autoScroll:s=!0,children:c,sensors:d=aN,collisionDetection:f=w$,measuring:h,modifiers:p}=Rs,m=We(Rs,["id","accessibility","autoScroll","children","sensors","collisionDetection","measuring","modifiers"]);const g=C.useReducer(uN,void 0,cN),[v,S]=g,[I,y]=f$(),[x,b]=C.useState(ir.Uninitialized),T=x===ir.Initialized,{draggable:{active:E,nodes:P,translate:O},droppable:{containers:G}}=v,j=E!=null?P.get(E):null,A=C.useRef({initial:null,translated:null}),W=C.useMemo(()=>{var Ct;return E!=null?{id:E,data:(Ct=j==null?void 0:j.data)!=null?Ct:sN,rect:A}:null},[E,j]),Y=C.useRef(null),[N,$]=C.useState(null),[B,H]=C.useState(null),q=ho(m,Object.values(m)),ee=go("DndDescribedBy",a),R=C.useMemo(()=>G.getEnabled(),[G]),L=fN(h),{droppableRects:F,measureDroppableContainers:U,measuringScheduled:te}=q$(R,{dragging:T,dependencies:[O.x,O.y],config:L.droppable}),se=Y$(P,E),ae=C.useMemo(()=>B?vs(B):null,[B]),J=un(),le=Q$(se,L.draggable.measure);hN({activeNode:E!=null?P.get(E):null,config:J.layoutShiftCompensation,initialRect:le,measure:L.draggable.measure});const ne=Bv(se,L.draggable.measure,le),ge=Bv(se?se.parentElement:null),Se=C.useRef({activatorEvent:null,active:null,activeNode:se,collisionRect:null,collisions:null,droppableRects:F,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:G,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ue=G.getNodeFor((n=Se.current.over)==null?void 0:n.id),wt=oN({measure:L.dragOverlay.measure}),at=(r=wt.nodeRef.current)!=null?r:se,kt=T?(i=wt.rect)!=null?i:ne:null,de=!!(wt.nodeRef.current&&wt.rect),he=Z$(de?null:ne),xe=Fv(at?Rt(at):null),Te=eN(T?Ue!=null?Ue:se:null),He=iN(Te),Pe=Hv(p,{transform:{x:O.x-he.x,y:O.y-he.y,scaleX:1,scaleY:1},activatorEvent:B,active:W,activeNodeRect:ne,containerNodeRect:ge,draggingNodeRect:kt,over:Se.current.over,overlayNodeRect:wt.rect,scrollableAncestors:Te,scrollableAncestorRects:He,windowRect:xe}),Ee=ae?fi(ae,O):null,It=tN(Te),St=Nv(It),zt=Nv(It,[ne]),Mt=fi(Pe,St),qt=kt?A$(kt,Pe):null,or=W&&qt?f({active:W,collisionRect:qt,droppableRects:F,droppableContainers:R,pointerCoordinates:Ee}):null,Ds=xv(or,"id"),[wn,wo]=C.useState(null),Pu=de?Pe:fi(Pe,zt),Du=I$(Pu,(o=wn==null?void 0:wn.rect)!=null?o:null,ne),je=C.useRef(null),pi=C.useCallback((Ct,_)=>{let{sensor:M,options:K}=_;if(Y.current==null)return;const Q=P.get(Y.current);if(!Q)return;const re=Ct.nativeEvent,ce=new M({active:Y.current,activeNode:Q,event:re,options:K,context:Se,onAbort(ue){if(!P.get(ue))return;const{onDragAbort:fe}=q.current,me={id:ue};fe==null||fe(me),I({type:"onDragAbort",event:me})},onPending(ue,we,fe,me){if(!P.get(ue))return;const{onDragPending:Pt}=q.current,nt={id:ue,constraint:we,initialCoordinates:fe,offset:me};Pt==null||Pt(nt),I({type:"onDragPending",event:nt})},onStart(ue){const we=Y.current;if(we==null)return;const fe=P.get(we);if(!fe)return;const{onDragStart:me}=q.current,De={activatorEvent:re,active:{id:we,data:fe.data,rect:A}};Oe.unstable_batchedUpdates(()=>{me==null||me(De),b(ir.Initializing),S({type:mt.DragStart,initialCoordinates:ue,active:we}),I({type:"onDragStart",event:De}),$(je.current),H(re)})},onMove(ue){S({type:mt.DragMove,coordinates:ue})},onEnd:Ce(mt.DragEnd),onCancel:Ce(mt.DragCancel)});je.current=ce;function Ce(ue){return function(){return k(this,null,function*(){const{active:fe,collisions:me,over:De,scrollAdjustedTranslate:Pt}=Se.current;let nt=null;if(fe&&Pt){const{cancelDrop:dn}=q.current;nt={activatorEvent:re,active:fe,collisions:me,delta:Pt,over:De},ue===mt.DragEnd&&typeof dn=="function"&&(yield Promise.resolve(dn(nt)))&&(ue=mt.DragCancel)}Y.current=null,Oe.unstable_batchedUpdates(()=>{S({type:ue}),b(ir.Uninitialized),wo(null),$(null),H(null),je.current=null;const dn=ue===mt.DragEnd?"onDragEnd":"onDragCancel";if(nt){const In=q.current[dn];In==null||In(nt),I({type:dn,event:nt})}})})}}},[P]),Io=C.useCallback((Ct,_)=>(M,K)=>{const Q=M.nativeEvent,re=P.get(K);if(Y.current!==null||!re||Q.dndKit||Q.defaultPrevented)return;const ce={active:re};Ct(M,_.options,ce)===!0&&(Q.dndKit={capturedBy:_.sensor},Y.current=K,pi(M,_))},[P,pi]),Os=K$(d,Io);nN(d),ln(()=>{ne&&x===ir.Initializing&&b(ir.Initialized)},[ne,x]),C.useEffect(()=>{const{onDragMove:Ct}=q.current,{active:_,activatorEvent:M,collisions:K,over:Q}=Se.current;if(!_||!M)return;const re={active:_,activatorEvent:M,collisions:K,delta:{x:Mt.x,y:Mt.y},over:Q};Oe.unstable_batchedUpdates(()=>{Ct==null||Ct(re),I({type:"onDragMove",event:re})})},[Mt.x,Mt.y]),C.useEffect(()=>{const{active:Ct,activatorEvent:_,collisions:M,droppableContainers:K,scrollAdjustedTranslate:Q}=Se.current;if(!Ct||Y.current==null||!_||!Q)return;const{onDragOver:re}=q.current,ce=K.get(Ds),Ce=ce&&ce.rect.current?{id:ce.id,rect:ce.rect.current,data:ce.data,disabled:ce.disabled}:null,ue={active:Ct,activatorEvent:_,collisions:M,delta:{x:Q.x,y:Q.y},over:Ce};Oe.unstable_batchedUpdates(()=>{wo(Ce),re==null||re(ue),I({type:"onDragOver",event:ue})})},[Ds]),ln(()=>{Se.current={activatorEvent:B,active:W,activeNode:se,collisionRect:qt,collisions:or,droppableRects:F,draggableNodes:P,draggingNode:at,draggingNodeRect:kt,droppableContainers:G,over:wn,scrollableAncestors:Te,scrollAdjustedTranslate:Mt},A.current={initial:kt,translated:qt}},[W,se,or,qt,P,at,kt,F,G,wn,Te,Mt]),H$(X(z({},J),{delta:O,draggingRect:qt,pointerCoordinates:Ee,scrollableAncestors:Te,scrollableAncestorRects:He}));const gi=C.useMemo(()=>({active:W,activeNode:se,activeNodeRect:ne,activatorEvent:B,collisions:or,containerNodeRect:ge,dragOverlay:wt,draggableNodes:P,droppableContainers:G,droppableRects:F,over:wn,measureDroppableContainers:U,scrollableAncestors:Te,scrollableAncestorRects:He,measuringConfiguration:L,measuringScheduled:te,windowRect:xe}),[W,se,ne,B,or,ge,wt,P,G,F,wn,U,Te,He,L,te,xe]),So=C.useMemo(()=>({activatorEvent:B,activators:Os,active:W,activeNodeRect:ne,ariaDescribedById:{draggable:ee},dispatch:S,draggableNodes:P,over:wn,measureDroppableContainers:U}),[B,Os,W,ne,S,ee,P,wn,U]);return C.createElement(vv.Provider,{value:y},C.createElement(Co.Provider,{value:So},C.createElement(Uv.Provider,{value:gi},C.createElement(Ts.Provider,{value:Du},c)),C.createElement(dN,{disabled:(l==null?void 0:l.restoreFocus)===!1})),C.createElement(g$,X(z({},l),{hiddenTextDescribedById:ee})));function un(){const Ct=(N==null?void 0:N.autoScrollEnabled)===!1,_=typeof s=="object"?s.enabled===!1:s===!1,M=T&&!Ct&&!_;return typeof s=="object"?X(z({},s),{enabled:M}):{enabled:M}}}),pN=C.createContext(null),Gv="button",gN="Draggable";function mN(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=go(gN),{activators:a,activatorEvent:l,active:s,activeNodeRect:c,ariaDescribedById:d,draggableNodes:f,over:h}=C.useContext(Co),{role:p=Gv,roleDescription:m="draggable",tabIndex:g=0}=i!=null?i:{},v=(s==null?void 0:s.id)===t,S=C.useContext(v?Ts:pN),[I,y]=ps(),[x,b]=ps(),T=rN(a,t),E=ho(n);ln(()=>(f.set(t,{id:t,key:o,node:I,activatorNode:x,data:E}),()=>{const O=f.get(t);O&&O.key===o&&f.delete(t)}),[f,t]);const P=C.useMemo(()=>({role:p,tabIndex:g,"aria-disabled":r,"aria-pressed":v&&p===Gv?!0:void 0,"aria-roledescription":m,"aria-describedby":d.draggable}),[r,p,g,v,m,d.draggable]);return{active:s,activatorEvent:l,activeNodeRect:c,attributes:P,isDragging:v,listeners:r?void 0:T,node:I,over:h,setNodeRef:y,setActivatorNodeRef:b,transform:S}}function Yv(){return C.useContext(Uv)}const vN="Droppable",bN={timeout:25};function yN(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=go(vN),{active:a,dispatch:l,over:s,measureDroppableContainers:c}=C.useContext(Co),d=C.useRef({disabled:n}),f=C.useRef(!1),h=C.useRef(null),p=C.useRef(null),{disabled:m,updateMeasurementsFor:g,timeout:v}=z(z({},bN),i),S=ho(g!=null?g:r),I=C.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{c(Array.isArray(S.current)?S.current:[S.current]),p.current=null},v)},[v]),y=Ss({callback:I,disabled:m||!a}),x=C.useCallback((P,O)=>{y&&(O&&(y.unobserve(O),f.current=!1),P&&y.observe(P))},[y]),[b,T]=ps(x),E=ho(t);return C.useEffect(()=>{!y||!b.current||(y.disconnect(),f.current=!1,y.observe(b.current))},[b,y]),C.useEffect(()=>(l({type:mt.RegisterDroppable,element:{id:r,key:o,disabled:n,node:b,rect:h,data:E}}),()=>l({type:mt.UnregisterDroppable,key:o,id:r})),[r]),C.useEffect(()=>{n!==d.current.disabled&&(l({type:mt.SetDroppableDisabled,id:r,key:o,disabled:n}),d.current.disabled=n)},[r,o,n,l]),{active:a,rect:h,isOver:(s==null?void 0:s.id)===r,node:b,over:s,setNodeRef:T}}function xN(e){let{animation:t,children:n}=e;const[r,i]=C.useState(null),[o,a]=C.useState(null),l=gs(n);return!n&&!r&&l&&i(l),ln(()=>{if(!o)return;const s=r==null?void 0:r.key,c=r==null?void 0:r.props.id;if(s==null||c==null){i(null);return}Promise.resolve(t(c,o)).then(()=>{i(null)})},[t,r,o]),C.createElement(C.Fragment,null,n,r?C.cloneElement(r,{ref:a}):null)}const CN={x:0,y:0,scaleX:1,scaleY:1};function wN(e){let{children:t}=e;return C.createElement(Co.Provider,{value:Vv},C.createElement(Ts.Provider,{value:CN},t))}const IN={position:"fixed",touchAction:"none"},SN=e=>ms(e)?"transform 250ms ease":void 0,AN=C.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:o,className:a,rect:l,style:s,transform:c,transition:d=SN}=e;if(!l)return null;const f=i?c:X(z({},c),{scaleX:1,scaleY:1}),h=z(X(z({},IN),{width:l.width,height:l.height,top:l.top,left:l.left,transform:Un.Transform.toString(f),transformOrigin:i&&r?v$(r,l):void 0,transition:typeof d=="function"?d(r):d}),s);return C.createElement(n,{className:a,style:h,ref:t},o)}),Kv=e=>t=>{let{active:n,dragOverlay:r}=t;const i={},{styles:o,className:a}=e;if(o!=null&&o.active)for(const[l,s]of Object.entries(o.active))s!==void 0&&(i[l]=n.node.style.getPropertyValue(l),n.node.style.setProperty(l,s));if(o!=null&&o.dragOverlay)for(const[l,s]of Object.entries(o.dragOverlay))s!==void 0&&r.node.style.setProperty(l,s);return a!=null&&a.active&&n.node.classList.add(a.active),a!=null&&a.dragOverlay&&r.node.classList.add(a.dragOverlay),function(){for(const[s,c]of Object.entries(i))n.node.style.setProperty(s,c);a!=null&&a.active&&n.node.classList.remove(a.active)}},TN={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Un.Transform.toString(t)},{transform:Un.Transform.toString(n)}]},sideEffects:Kv({styles:{active:{opacity:"0"}}})};function EN(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return hs((o,a)=>{if(t===null)return;const l=n.get(o);if(!l)return;const s=l.node.current;if(!s)return;const c=zv(a);if(!c)return;const{transform:d}=Rt(a).getComputedStyle(a),f=wv(d);if(!f)return;const h=typeof t=="function"?t:_N(t);return Pv(s,i.draggable.measure),h({active:{id:o,data:l.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:f})})}function _N(e){const{duration:t,easing:n,sideEffects:r,keyframes:i}=z(z({},TN),e);return o=>{let I=o,{active:a,dragOverlay:l,transform:s}=I,c=We(I,["active","dragOverlay","transform"]);if(!t)return;const d={x:l.rect.left-a.rect.left,y:l.rect.top-a.rect.top},f={scaleX:s.scaleX!==1?a.rect.width*s.scaleX/l.rect.width:1,scaleY:s.scaleY!==1?a.rect.height*s.scaleY/l.rect.height:1},h=z({x:s.x-d.x,y:s.y-d.y},f),p=i(X(z({},c),{active:a,dragOverlay:l,transform:{initial:s,final:h}})),[m]=p,g=p[p.length-1];if(JSON.stringify(m)===JSON.stringify(g))return;const v=r==null?void 0:r(z({active:a,dragOverlay:l},c)),S=l.node.animate(p,{duration:t,easing:n,fill:"forwards"});return new Promise(y=>{S.onfinish=()=>{v==null||v(),y()}})}}let qv=0;function kN(e){return C.useMemo(()=>{if(e!=null)return qv++,qv},[e])}const PN=C.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:o,modifiers:a,wrapperElement:l="div",className:s,zIndex:c=999}=e;const{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:p,draggableNodes:m,droppableContainers:g,dragOverlay:v,over:S,measuringConfiguration:I,scrollableAncestors:y,scrollableAncestorRects:x,windowRect:b}=Yv(),T=C.useContext(Ts),E=kN(f==null?void 0:f.id),P=Hv(a,{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:p,draggingNodeRect:v.rect,over:S,overlayNodeRect:v.rect,scrollableAncestors:y,scrollableAncestorRects:x,transform:T,windowRect:b}),O=ku(h),G=EN({config:r,draggableNodes:m,droppableContainers:g,measuringConfiguration:I}),j=O?v.setRef:void 0;return C.createElement(wN,null,C.createElement(xN,{animation:G},f&&E?C.createElement(AN,{key:E,id:f.id,ref:j,as:l,activatorEvent:d,adjustScale:t,className:s,transition:o,rect:O,style:z({zIndex:c},i),transform:P},n):null))});function Es(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function DN(e,t){return e.reduce((n,r,i)=>{const o=t.get(r);return o&&(n[i]=o),n},Array(e.length))}function _s(e){return e!==null&&e>=0}function ON(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 RN(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Qv=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const o=Es(t,r,n),a=t[i],l=o[i];return!l||!a?null:{x:l.left-a.left,y:l.top-a.top,scaleX:l.width/a.width,scaleY:l.height/a.height}},Jv="Sortable",Xv=C.createContext({activeIndex:-1,containerId:Jv,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Qv,disabled:{draggable:!1,droppable:!1}});function Zv(e){let{children:t,id:n,items:r,strategy:i=Qv,disabled:o=!1}=e;const{active:a,dragOverlay:l,droppableRects:s,over:c,measureDroppableContainers:d}=Yv(),f=go(Jv,n),h=l.rect!==null,p=C.useMemo(()=>r.map(T=>typeof T=="object"&&"id"in T?T.id:T),[r]),m=a!=null,g=a?p.indexOf(a.id):-1,v=c?p.indexOf(c.id):-1,S=C.useRef(p),I=!ON(p,S.current),y=v!==-1&&g===-1||I,x=RN(o);ln(()=>{I&&m&&d(p)},[I,p,m,d]),C.useEffect(()=>{S.current=p},[p]);const b=C.useMemo(()=>({activeIndex:g,containerId:f,disabled:x,disableTransforms:y,items:p,overIndex:v,useDragOverlay:h,sortedRects:DN(p,s),strategy:i}),[g,f,x.draggable,x.droppable,y,p,v,s,h,i]);return C.createElement(Xv.Provider,{value:b},t)}const MN=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return Es(n,r,i).indexOf(t)},LN=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:o,newIndex:a,previousItems:l,previousContainerId:s,transition:c}=e;return!c||!r||l!==o&&i===a?!1:n?!0:a!==i&&t===s},BN={duration:200,easing:"ease"},eb="transform",$N=Un.Transition.toString({property:eb,duration:0,easing:"linear"}),NN={roleDescription:"sortable"};function FN(e){let{disabled:t,index:n,node:r,rect:i}=e;const[o,a]=C.useState(null),l=C.useRef(n);return ln(()=>{if(!t&&n!==l.current&&r.current){const s=i.current;if(s){const c=hi(r.current,{ignoreTransform:!0}),d={x:s.left-c.left,y:s.top-c.top,scaleX:s.width/c.width,scaleY:s.height/c.height};(d.x||d.y)&&a(d)}}n!==l.current&&(l.current=n)},[t,n,r,i]),C.useEffect(()=>{o&&a(null)},[o]),o}function tb(e){let{animateLayoutChanges:t=LN,attributes:n,disabled:r,data:i,getNewIndex:o=MN,id:a,strategy:l,resizeObserverConfig:s,transition:c=BN}=e;const{items:d,containerId:f,activeIndex:h,disabled:p,disableTransforms:m,sortedRects:g,overIndex:v,useDragOverlay:S,strategy:I}=C.useContext(Xv),y=jN(r,p),x=d.indexOf(a),b=C.useMemo(()=>z({sortable:{containerId:f,index:x,items:d}},i),[f,i,x,d]),T=C.useMemo(()=>d.slice(d.indexOf(a)),[d,a]),{rect:E,node:P,isOver:O,setNodeRef:G}=yN({id:a,data:b,disabled:y.droppable,resizeObserverConfig:z({updateMeasurementsFor:T},s)}),{active:j,activatorEvent:A,activeNodeRect:W,attributes:Y,setNodeRef:N,listeners:$,isDragging:B,over:H,setActivatorNodeRef:q,transform:ee}=mN({id:a,data:b,attributes:z(z({},NN),n),disabled:y.draggable}),R=n$(G,N),L=!!j,F=L&&!m&&_s(h)&&_s(v),U=!S&&B,te=U&&F?ee:null,se=l!=null?l:I,ae=F?te!=null?te:se({rects:g,activeNodeRect:W,activeIndex:h,overIndex:v,index:x}):null,J=_s(h)&&_s(v)?o({id:a,items:d,activeIndex:h,overIndex:v}):x,le=j==null?void 0:j.id,ne=C.useRef({activeId:le,items:d,newIndex:J,containerId:f}),ge=d!==ne.current.items,Se=t({active:j,containerId:f,isDragging:B,isSorting:L,id:a,index:x,items:d,newIndex:ne.current.newIndex,previousItems:ne.current.items,previousContainerId:ne.current.containerId,transition:c,wasDragging:ne.current.activeId!=null}),Ue=FN({disabled:!Se,index:x,node:P,rect:E});return C.useEffect(()=>{L&&ne.current.newIndex!==J&&(ne.current.newIndex=J),f!==ne.current.containerId&&(ne.current.containerId=f),d!==ne.current.items&&(ne.current.items=d)},[L,J,f,d]),C.useEffect(()=>{if(le===ne.current.activeId)return;if(le!=null&&ne.current.activeId==null){ne.current.activeId=le;return}const at=setTimeout(()=>{ne.current.activeId=le},50);return()=>clearTimeout(at)},[le]),{active:j,activeIndex:h,attributes:Y,data:b,rect:E,index:x,newIndex:J,items:d,isOver:O,isSorting:L,isDragging:B,listeners:$,node:P,overIndex:v,over:H,setNodeRef:R,setActivatorNodeRef:q,setDroppableNodeRef:G,setDraggableNodeRef:N,transform:Ue!=null?Ue:ae,transition:wt()};function wt(){if(Ue||ge&&ne.current.newIndex===x)return $N;if(!(U&&!ms(A)||!c)&&(L||Se))return Un.Transition.toString(X(z({},c),{property:eb}))}}function jN(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}function ks(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const zN=[_e.Down,_e.Right,_e.Up,_e.Left],nb=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:o,over:a,scrollableAncestors:l}}=t;if(zN.includes(e.code)){if(e.preventDefault(),!n||!r)return;const s=[];o.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const h=i.get(f.id);if(h)switch(e.code){case _e.Down:r.top<h.top&&s.push(f);break;case _e.Up:r.top>h.top&&s.push(f);break;case _e.Left:r.left>h.left&&s.push(f);break;case _e.Right:r.left<h.left&&s.push(f);break}});const c=x$({active:n,collisionRect:r,droppableRects:i,droppableContainers:s,pointerCoordinates:null});let d=xv(c,"id");if(d===(a==null?void 0:a.id)&&c.length>1&&(d=c[1].id),d!=null){const f=o.get(n.id),h=o.get(d),p=h?i.get(h.id):null,m=h==null?void 0:h.node.current;if(m&&p&&f&&h){const v=xs(m).some((T,E)=>l[E]!==T),S=rb(f,h),I=VN(f,h),y=v||!S?{x:0,y:0}:{x:I?r.width-p.width:0,y:I?r.height-p.height:0},x={x:p.left,y:p.top};return y.x&&y.y?x:mo(x,y)}}}};function rb(e,t){return!ks(e)||!ks(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function VN(e,t){return!ks(e)||!ks(t)||!rb(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const ib=Ve(u.jsx("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator"),Ps=C.createContext({attributes:{},listeners:void 0,ref(){}}),UN=({disabled:e=!1})=>{const{attributes:t,listeners:n,ref:r}=C.useContext(Ps);return u.jsx(w.Button,X(z(z({sx:{backgroundColor:"transparent",color:"#919eab",width:"10px",":hover":{backgroundColor:"transparent"},":active":{backgroundColor:"transparent"}}},t),n),{ref:r,disabled:e,children:u.jsx(ib,{})}))},ob=({children:e,id:t,tooltipTitle:n,removeItem:r,useDraggable:i=!0,variant:o="plain"})=>{const{attributes:a,isDragging:l,listeners:s,setNodeRef:c,setActivatorNodeRef:d,transform:f,transition:h}=tb({id:t}),p=C.useMemo(()=>({attributes:a,listeners:s,ref:d}),[a,s,d]),m={opacity:l?.6:void 0,transform:Un.Translate.toString(f),transition:h};return u.jsx(Ps.Provider,{value:p,children:u.jsx(w.ListItem,{variant:o,ref:c,style:m,startAction:u.jsx(UN,{disabled:!i}),endAction:i?u.jsx(w.Tooltip,{title:n,children:u.jsx(w.Button,{variant:"outlined",color:"danger",onClick:r,sx:{ml:"auto",p:.5},size:"sm",children:u.jsx(Le.Remove,{})})}):u.jsx(u.Fragment,{}),sx:{p:2,borderRadius:"sm"},children:e})})},HN={sideEffects:Kv({styles:{active:{opacity:"0.6"}}})},ab=({children:e})=>u.jsx(PN,{dropAnimation:HN,children:e}),WN=({entities:e=[],labels:t,disabled:n,setEntities:r,removeItem:i})=>{const[o,a]=C.useState(null),l=C.useMemo(()=>e.find(c=>c.id===(o==null?void 0:o.id)),[o,e]),s=bv(ys(ws),ys(Cs,{coordinateGetter:nb}));return u.jsxs(Wv,{sensors:s,onDragStart:({active:c})=>{a(c)},onDragEnd:({active:c,over:d})=>{if(d&&c.id!==(d==null?void 0:d.id)){const f=e.findIndex(({id:p})=>p===c.id),h=e.findIndex(({id:p})=>p===d.id);r(Es(e,f,h))}a(null)},onDragCancel:()=>{a(null)},children:[u.jsx(Zv,{items:e,children:u.jsx(w.List,{sx:{gap:"10px",padding:0},children:e.map(c=>u.jsxs(ob,{id:c.id,variant:"outlined",removeItem:()=>i(c.id),tooltipTitle:t.removeEntity,useDraggable:!n,children:[u.jsx(w.Typography,{ml:2.5,children:c.title||c.name}),c.type&&u.jsx(w.Chip,{color:lB(c.type),sx:{marginLeft:2},children:cB(c.type)})]},`sortable-item-${c.id}`))})}),u.jsx(ab,{children:l?u.jsx(u.Fragment,{children:e.map(c=>u.jsx(ob,{id:c.id,useDraggable:!1,removeItem:()=>{},tooltipTitle:t.removeEntity},`sortable-overlay-item-${c.id}`))}):u.jsx(u.Fragment,{})})]})},GN=e=>u.jsxs(w.FormControl,{size:"sm",children:[u.jsx(w.FormLabel,{children:e.labels.itemsPerPage}),u.jsx(w.Select,{value:e.value,size:"sm",onChange:e.onChange,sx:{minHeight:"37px"},children:e.options.map((t,n)=>u.jsx(w.Option,{value:t,children:t},`items-per-page-${t}-${n}`))})]}),YN=(e,t)=>{const[n,r]=C.useState(null),{sdk:i}=pt(),o=()=>k(this,null,function*(){let l=[];if(!e){r(l);return}try{switch(e){case"top_x":l=(yield i.topX.getGames({limit:50},!0)).data.map(v=>({id:v.id,name:v.title,status:v.status,type:e,relationship:"relatedTo"}));break;case"match_quiz":l=(yield i.matchQuiz.getGames({limit:50},!0)).data.map(v=>({id:v.id,name:v.title,status:v.status,type:e,relationship:"relatedTo"}));break;case"template":l=(yield i.loyalty.getTemplates(void 0,!0)).data.map(v=>({id:v.id,name:v.name,status:v.status,type:e,relationship:"relatedTo"}));break;case"classic_quiz":l=(yield i.miniGames.getClassicQuizzes({limit:50},!1,!0)).data.map(v=>({id:v.id,name:v.title,status:v.status,type:e,relationship:"relatedTo"}));break;case"either_or":l=(yield i.miniGames.getEitherOrs({limit:50},!1,!0)).data.map(v=>({id:v.id,name:v.title,status:v.status,type:e,relationship:"relatedTo"}));break;case"poll":l=(yield i.voting.getPolls({limit:50},!0)).data.map(v=>({id:v.id,name:v.title,status:v.status,type:e,relationship:"relatedTo"}));break;case"bracket":l=(yield i.bracketGame.getGames({limit:50},!0)).data.map(v=>({id:v.id,name:v.title,status:v.status,type:e,relationship:"relatedTo"}));break;case"standing":l=(yield i.standingGame.getGames({limit:50},!0)).data.map(v=>({id:v.id,name:v.title,status:v.status,type:e,relationship:"relatedTo"}));break}}catch(s){console.error(s),r(l),t();return}r(l)});return C.useEffect(()=>(o(),()=>r(null)),[e]),n},KN=({status:e})=>{let t="neutral";switch(e){case"DYNAMIC":t="primary";break;case"CUSTOM":t="success";break;case"OPEN":t="primary";break;case"LIVE":t="primary";break;case"CANCELED":t="warning";break;case"SETTLED":t="success";break;case"INACTIVE":t="danger";break;case"ACTIVE":t="success";break;case"EXPIRED":t="neutral";break}return u.jsx(w.Chip,{color:t,variant:"solid",size:"sm",children:e})},qN=Ve(u.jsx("path",{d:"M12.16 3h-.32L9.21 8.25h5.58zm4.3 5.25h5.16L19 3h-5.16zm4.92 1.5h-8.63V20.1zM11.25 20.1V9.75H2.62zM7.54 8.25 10.16 3H5L2.38 8.25z"}),"Diamond"),QN=Ve(u.jsx("path",{d:"m21.58 16.09-1.09-7.66C20.21 6.46 18.52 5 16.53 5H7.47C5.48 5 3.79 6.46 3.51 8.43l-1.09 7.66C2.2 17.63 3.39 19 4.94 19c.68 0 1.32-.27 1.8-.75L9 16h6l2.25 2.25c.48.48 1.13.75 1.8.75 1.56 0 2.75-1.37 2.53-2.91M11 11H9v2H8v-2H6v-1h2V8h1v2h2zm4-1c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1m2 3c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1"}),"SportsEsports"),JN=Ve(u.jsx("path",{d:"M11.07 12.85c.77-1.39 2.25-2.21 3.11-3.44.91-1.29.4-3.7-2.18-3.7-1.69 0-2.52 1.28-2.87 2.34L6.54 6.96C7.25 4.83 9.18 3 11.99 3c2.35 0 3.96 1.07 4.78 2.41.7 1.15 1.11 3.3.03 4.9-1.2 1.77-2.35 2.31-2.97 3.45-.25.46-.35.76-.35 2.24h-2.89c-.01-.78-.13-2.05.48-3.15M14 20c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2"}),"QuestionMark"),XN=Ve(u.jsx("path",{d:"M9.01 14H2v2h7.01v3L13 15l-3.99-4zm5.98-1v-3H22V8h-7.01V5L11 9z"}),"CompareArrows"),ZN=Ve(u.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2M9 17H7v-7h2zm4 0h-2V7h2zm4 0h-2v-4h2z"}),"Poll"),eF=e=>{switch(e.entityType){case"top_x":return u.jsx(w.Tooltip,{title:"Top X",children:u.jsx(qN,{})});case"match_quiz":return u.jsx(w.Tooltip,{title:"Match Quiz",children:u.jsx(QN,{})});case"template":return u.jsx(w.Tooltip,{title:"Leaderboard Templates",children:u.jsx(Le.EmojiEvents,{})});case"classic_quiz":return u.jsx(w.Tooltip,{title:"Classic Quiz",children:u.jsx(JN,{})});case"either_or":return u.jsx(w.Tooltip,{title:"Either/Or",children:u.jsx(XN,{})});case"poll":return u.jsx(w.Tooltip,{title:"Poll",children:u.jsx(ZN,{})});case"bracket":return u.jsx(w.Tooltip,{title:"Custom Bracket Game",children:u.jsx(Le.EmojiEvents,{})});case"standing":return u.jsx(w.Tooltip,{title:"Custom Standings Game",children:u.jsx(Le.EmojiEvents,{})});default:return null}},tF=({entity:e,deleteLabel:t,onDelete:n})=>u.jsx(u.Fragment,{children:u.jsx(w.Card,{sx:{p:2,mb:2},children:u.jsx(w.CardContent,{children:u.jsxs(w.Box,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},alignItems:"center",justifyContent:"space-between"},children:[u.jsx(w.Typography,{fontSize:"sm",startDecorator:u.jsx(eF,{entityType:e.type}),children:e.name}),u.jsx(w.Box,{display:{xs:"none",md:"block"},children:u.jsx(KN,{status:e.status})}),u.jsx(w.Box,{children:u.jsx(w.Tooltip,{title:t,children:u.jsx(w.IconButton,{onClick:()=>n(e.id,e.relationship),color:"danger",size:"sm",children:u.jsx(Le.Delete,{})})})})]})})})}),nF=(e,t,n,r)=>k(this,null,function*(){let o=[];const a=new Map;t.forEach(l=>{if(a.has(l.entity_type)){const s=a.get(l.entity_type);a.set(l.entity_type,[...s,[l.entity_id,l.entity_relationship]])}else a.set(l.entity_type,[[l.entity_id,l.entity_relationship]])});try{for(const[l,s]of a)switch(l){case"top_x":const c=s.map(([O])=>O),d=yield e.topX.getGames({limit:c.length,gameIds:c},!0);o=[...o,...d.data.map(O=>{var j;const G=((j=s.find(([A])=>A===O.id))==null?void 0:j[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;case"match_quiz":const f=s.map(([O])=>O),h=yield e.matchQuiz.getGames({limit:f.length,gameIds:f},!0);o=[...o,...h.data.map(O=>{var j;const G=((j=s.find(([A])=>A===O.id))==null?void 0:j[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;case"template":const p=s.map(([O])=>O),m=yield e.loyalty.getTemplates(void 0,!0);o=[...o,...m.data.filter(O=>p.includes(O.id)).map(O=>{var j;const G=((j=s.find(([A])=>A===O.id))==null?void 0:j[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;case"classic_quiz":const g=s.map(([O])=>O),v=yield e.miniGames.getClassicQuizzes({limit:g.length,classicQuizIds:g},!1,!0);o=[...o,...v.data.map(O=>{var j;const G=((j=s.find(([A])=>A===O.id))==null?void 0:j[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;case"either_or":const S=s.map(([O])=>O),I=yield e.miniGames.getEitherOrs({limit:S.length,eitherOrIds:S},!1,!0);o=[...o,...I.data.map(O=>{var j;const G=((j=s.find(([A])=>A===O.id))==null?void 0:j[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;case"poll":const y=s.map(([O])=>O),x=yield e.voting.getPolls({limit:y.length,pollIds:y},!0);o=[...o,...x.data.map(O=>{var j;const G=((j=s.find(([A])=>A===O.id))==null?void 0:j[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;case"bracket":const b=s.map(([O])=>O),T=yield e.bracketGame.getGames({limit:b.length,gameIds:b},!0);o=[...o,...T.data.map(O=>{var j;const G=((j=s.find(([A])=>A===O.id))==null?void 0:j[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;case"standing":const E=s.map(([O])=>O),P=yield e.standingGame.getGames({limit:E.length,gameIds:E},!0);o=[...o,...P.data.map(O=>{var j;const G=((j=s.find(([A])=>A===O.id))==null?void 0:j[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;default:}}catch(l){console.error("Error loading related entities",l),n(o),r()}n(o)}),rF=["top_x","match_quiz","template","classic_quiz","poll","either_or","bracket","standing"],iF=["relatedTo","blocks","blockedBy","bonusPointsGame","nextInSeries","previousInSeries"],oF=new Map().set("template","Leaderboard Templates").set("classic_quiz","Classic Quiz").set("either_or","Either/Or").set("match_quiz","Match Quiz").set("top_x","Top X").set("bracket","Custom Bracket Game").set("standing","Custom Standing Game").set("poll","Poll"),sb=new Map().set("relatedTo","Related to").set("blocks","Blocks").set("blockedBy","Blocked by").set("nextInSeries","Next in series").set("previousInSeries","Previous in series").set("bonusPointsGame","Bonus points game"),aF=({defaultValue:e=[],onChange:t,labels:n})=>{const[r,i]=C.useState([]),[o,a]=C.useState(""),[l,s]=C.useState(null),[c,d]=C.useState("relatedTo"),[f,h]=C.useState(!1),p=()=>h(!f),m=YN(l,p),{sdk:g}=pt();C.useEffect(()=>(e.length>0&&nF(g,e,i,p),()=>{i([]),a(""),s(null),d("relatedTo")}),[]);const v=()=>{if(e.some(E=>E.entity_id===o&&E.entity_relationship===c)){a("");return}const b=[...e,{entity_id:o,entity_type:l,entity_relationship:c}],T=(m==null?void 0:m.filter(E=>E.id===o).map(E=>({id:E.id,name:E.name,type:l,status:E.status,relationship:c})))||[];i([...r,...T]),t(b),a("")},S=(x,b)=>{const T=e.filter(P=>!(P.entity_id===x&&P.entity_relationship===b)),E=r.filter(P=>!(P.id===x&&P.relationship===b));i(E),t(T)},I=r.reduce((x,b)=>{const T=b.relationship;return x[T]||(x[T]=[]),x[T].push(b),x},{}),y=Object.keys(I).sort();return u.jsxs(u.Fragment,{children:[y.map(x=>u.jsxs(w.Box,{sx:{mb:2},children:[u.jsx(w.Typography,{level:"title-md",sx:{fontWeight:"bold",mb:1},children:u.jsx(w.Chip,{variant:"outlined",size:"md",sx:{bgcolor:"background.surface"},children:sb.get(x)||"Unknown relationship"})}),I[x].map((b,T)=>u.jsx(tF,{entity:b,deleteLabel:n.delete,onDelete:S},`related-entity-relationship-${b.id}-${T}`))]},`relationship-group-${x}`)),u.jsxs(w.Box,{sx:{display:"flex",flexDirection:"column",width:"100%",gap:1},children:[u.jsxs(w.FormControl,{children:[u.jsx(w.FormLabel,{required:!0,color:"primary",children:n.type}),u.jsx(w.Select,{value:l,size:"sm",name:"entity_type",onChange:(x,b)=>s(b),sx:{minHeight:"37px"},children:rF.map(x=>u.jsx(w.Option,{value:x,children:oF.get(x)},`entity-type-option-${x}`))})]}),u.jsxs(w.FormControl,{children:[u.jsx(w.FormLabel,{required:!0,color:"primary",children:n.relationship}),u.jsx(w.Select,{value:c,size:"sm",name:"entity_relationship",onChange:(x,b)=>d(b),sx:{minHeight:"37px"},children:iF.map(x=>u.jsx(w.Option,{value:x,children:sb.get(x)},`entity-relationship-option-${x}`))})]}),u.jsxs(w.FormControl,{children:[u.jsx(w.FormLabel,{required:!0,color:"primary",children:n.entity}),u.jsx(w.Select,{value:o,size:"sm",name:"entity_id",onChange:(x,b)=>a(b),sx:{width:"100%",mr:{xs:0,md:1},mb:{xs:1,md:0},minHeight:"37px"},endDecorator:!m&&u.jsx(w.CircularProgress,{size:"sm"}),children:m&&m.map(x=>u.jsx(w.Option,{value:x.id,children:x.name},`entity--${x.id}`))})]}),u.jsx(w.Button,{startDecorator:u.jsx(Le.Add,{}),disabled:!o||!l,onClick:v,sx:{mb:1},children:n.add})]}),u.jsx(ut,{showToast:f,message:n.relatedEntitiesErrorMessage,color:"danger",hideToast:p})]})},sF=e=>{const[t,n]=C.useState(!1),[r,i]=C.useState(!1),[o,a]=C.useState("success"),[l,s]=C.useState(""),c=C.useContext(Xo),d=(h,p)=>{a(h),s(p),i(!0)},f=()=>k(this,null,function*(){n(!0);const h=yield c==null?void 0:c.https.exportLeadsPerEntity(e.entityId);if(h!=null&&h.ok){const p=yield h.blob(),m=URL.createObjectURL(p),g=document.createElement("a");g.href=m,g.download=`${e.entityType}_${e.entityName}_exported_users_leads.csv`,document.body.appendChild(g),g.click(),document.body.removeChild(g),URL.revokeObjectURL(m),n(!1),d("success",e.labels.usersLeadsExportMessage)}else console.error("Failed to export all users leads: ",yield h==null?void 0:h.json()),n(!1),d("danger",e.labels.usersLeadsExportErrorMessage)});return u.jsxs(u.Fragment,{children:[u.jsxs(w.Box,{mb:2,children:[u.jsx(w.Box,{display:"flex",alignItems:"center",mb:1,children:u.jsx(w.Typography,{level:"body-lg",sx:{mx:"auto"},children:e.labels.exportUsersLeads})}),u.jsx(w.Sheet,{sx:{overflowX:"auto",minWidth:"700px"},children:u.jsxs(w.Table,{variant:"outlined",hoverRow:!1,borderAxis:"bothBetween",size:"sm",sx:{backgroundColor:"#fff","& > thead > tr > th:first-child, & > tbody > tr > td:first-child":{textAlign:"left",width:"50%"},"--TableCell-paddingX":"0.5rem",cursor:"default","& > tbody > tr:hover":{backgroundColor:"transparent"},"& > thead > tr > th":{backgroundColor:"#fff",verticalAlign:"middle"},"& > thead > tr > th, & > tbody > tr > td":{textAlign:"right"}},children:[u.jsx("thead",{children:u.jsxs("tr",{children:[u.jsx("th",{children:e.labels.category}),u.jsx("th",{children:e.labels.action})]})}),u.jsx("tbody",{children:u.jsxs("tr",{children:[u.jsxs("td",{children:[u.jsx(w.Typography,{level:"body-sm",fontWeight:"600",children:e.labels.exportAllUsersLeads}),u.jsx(w.Typography,{level:"body-xs",color:"neutral",children:e.labels.exportAllUsersLeadsDescription})]}),u.jsx("td",{children:u.jsx(w.Button,{loading:t,onClick:f,children:e.labels.exportAllUsersLeads})})]})})]})})]}),u.jsx(ut,{showToast:r,color:o,message:l,hideToast:()=>i(!1)})]})},lF=({tooltipContent:e="Drag to reorder"})=>{const{attributes:t,listeners:n,ref:r}=C.useContext(Ps);return u.jsx(w.Tooltip,{title:e,placement:"left",arrow:!0,children:u.jsx(w.IconButton,X(z(z({variant:"plain",color:"neutral",size:"sm",sx:{color:"text.tertiary",my:"auto",mr:1,":hover":{bgcolor:"action.hover"},":active":{bgcolor:"action.selected"},transition:"all 0.2s",cursor:"grab","&:active":{cursor:"grabbing"}}},t),n),{ref:r,children:u.jsx(ib,{})}))})},lb=({id:e,useDraggable:t=!0,variant:n="outlined",item:r,tooltipContent:i})=>{const{attributes:o,isDragging:a,listeners:l,setNodeRef:s,setActivatorNodeRef:c,transform:d,transition:f}=tb({id:e}),h=C.useMemo(()=>({attributes:o,listeners:l,ref:c}),[o,l,c]),p={opacity:a?.6:void 0,transform:Un.Translate.toString(d),transition:f},m=v=>v.split(" ").map(S=>S[0]).join("").toUpperCase().substring(0,2),g=v=>r!=null&&r.color?r.color:`hsl(${v.split("").reduce((y,x)=>x.charCodeAt(0)+((y<<5)-y),0)%360}, 70%, 80%)`;return u.jsx(Ps.Provider,{value:h,children:u.jsx(w.ListItem,{variant:n,ref:s,style:p,endAction:t?u.jsx(lF,{tooltipContent:i}):null,sx:{p:0,borderRadius:"md",overflow:"hidden",transition:"all 0.2s",boxShadow:a?"md":"sm",transform:`scale(${a?1.02:1})`,border:"1px solid",borderColor:"divider"},children:u.jsxs(w.Box,{sx:{display:"flex",width:"100%",alignItems:"center",gap:2,p:0},children:[u.jsx(w.Sheet,{sx:{width:"8px",alignSelf:"stretch",bgcolor:g(r.name)}}),u.jsx(w.Avatar,{src:r.image,alt:r.name,sx:{bgcolor:g(r.name),my:2,ml:1},children:m(r.name)}),u.jsxs(w.Box,{sx:{py:2,pr:2,flexGrow:1,display:"flex",flexDirection:"column",gap:.5},children:[u.jsx(w.Typography,{level:"title-md",children:r.name}),r.description&&u.jsx(w.Typography,{level:"body-sm",sx:{color:"text.secondary",textOverflow:"ellipsis"},children:r.description}),u.jsx(w.Box,{sx:{mt:.5},children:r.type&&u.jsx(w.Chip,{variant:"soft",color:"primary",size:"sm",sx:{px:1,bgcolor:`${g(r.type)}40`},children:r.type})})]})]})})})},cF={Login:GR,InformationInput:eo,RichText:cc,HeaderButtons:CP,MarketSelection:sM,Accordion:lT,DynamicFields:NP,BasicSelect:uT,BooleanSwitch:PL,Branding:xP,ProfileSearchSelect:_L,RangeCalendar:BP,CompetitionSearchSelect:TL,Related:dM,Images:wR,Duration:LP,DatePickerComponent:to,Flags:bR,Spinner:us,Tags:Dm,Toast:ut,AdContent:cT,Match:lM,Winners:vB,CompetitionsSearchSelect:EL,TeamsSearchSelect:kL,CustomSelect:EM,Schedule:xM,NoPermissionCard:$P,CustomFlatpickrCalendar:Yc,ContextSelectFilter:yB,NumberInput:WB,EntityContext:XB,MiniGamesImages:e$,AuthRequirement:t$,SortableList:WN,ItemsPerPageFilter:GN,ImageCard:so,RelatedRelationship:aF,ExportUsersLeads:sF,SignOutButton:ig,BasicSortableList:({items:e=[],labels:t,setItems:n})=>{const[r,i]=C.useState(null),o=C.useMemo(()=>e.find(l=>l.id===(r==null?void 0:r.id)),[r,e]),a=bv(ys(ws,{activationConstraint:{distance:8}}),ys(Cs,{coordinateGetter:nb}));return e.length===0?u.jsx(w.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",border:"1px dashed",borderColor:"divider",borderRadius:"md"},children:u.jsx(w.Typography,{level:"body-lg",color:"neutral",children:(t==null?void 0:t.noItemsToDisplay)||"No items to display"})}):u.jsxs(Wv,{sensors:a,onDragStart:({active:l})=>{i(l)},onDragEnd:({active:l,over:s})=>{if(s&&l.id!==(s==null?void 0:s.id)){const c=e.findIndex(({id:f})=>f===l.id),d=e.findIndex(({id:f})=>f===s.id);n(Es(e,c,d))}i(null)},onDragCancel:()=>{i(null)},children:[u.jsx(Zv,{items:e,children:u.jsx(w.List,{sx:{gap:2,maxHeight:"70vh",overflowY:"auto","&::-webkit-scrollbar":{width:"8px"},"&::-webkit-scrollbar-thumb":{backgroundColor:"action.focus",borderRadius:"4px"}},children:e.map(l=>u.jsx(lb,{id:l.id,variant:"outlined",item:l,tooltipContent:t==null?void 0:t.dragToReorder},`sortable-item-${l.id}`))})}),u.jsx(ab,{children:o?u.jsx(lb,{id:o.id,useDraggable:!1,item:o,tooltipContent:t.dragToReorder},`sortable-overlay-item-${o.id}`):null})]})}},cb=C.createContext(null),uF=({children:e})=>u.jsx(cb.Provider,{value:cF,children:e}),dF=()=>{const e=C.useContext(cb);if(!e)throw new Error("useComponentContext must be used within a ComponentProvider");return e},ub=425,db=1024;return{APIProvider:CI,AuthProvider:wI,AuthContext:Nf,ComponentProvider:uF,useComponentContext:dF,useAPIContext:pt,useIsMobile:()=>{const[e,t]=C.useState(window.innerWidth<=db),[n,r]=C.useState(window.innerWidth<=ub);return C.useLayoutEffect(()=>{const i=()=>{t(window.innerWidth<=db),r(window.innerWidth<=ub)};return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]),{isMobile:e,isPhone:n}}}});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fansunited-management-components",
3
- "version": "1.31.3-RC2",
3
+ "version": "1.31.3-RC3",
4
4
  "main": "index.es.js",
5
5
  "author": "Fans United",
6
6
  "description": "",