fansunited-management-components 1.33.1 → 1.33.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.es.js +1 -1
- package/index.umd.js +1 -1
- package/package.json +1 -1
package/index.es.js
CHANGED
|
@@ -39352,7 +39352,7 @@ const TC = Xe(/* @__PURE__ */ u.jsx("path", {
|
|
|
39352
39352
|
useDraggable: !n,
|
|
39353
39353
|
children: [
|
|
39354
39354
|
/* @__PURE__ */ u.jsx(ve, { ml: n ? 0 : 2.5, children: c.title || c.name }),
|
|
39355
|
-
c.type && /* @__PURE__ */ u.jsx(cn, { color: JU(c.type), sx: { marginLeft: 2 }, children: QU(c.type) })
|
|
39355
|
+
c.type && /* @__PURE__ */ u.jsx(cn, { color: JU(c.type), sx: { marginLeft: 2, marginRight: 4 }, children: QU(c.type) })
|
|
39356
39356
|
]
|
|
39357
39357
|
},
|
|
39358
39358
|
`sortable-item-${c.id}`
|
package/index.umd.js
CHANGED
|
@@ -3477,7 +3477,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
3477
3477
|
To pick up a draggable item, press the space bar.
|
|
3478
3478
|
While dragging, use the arrow keys to move the item.
|
|
3479
3479
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
3480
|
-
`},uU={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function dU(t){let{announcements:e=uU,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=cU}=t;const{announce:o,announcement:a}=aU(),l=Bo("DndLiveRegion"),[s,c]=x.useState(!1);if(x.useEffect(()=>{c(!0)},[]),sU(x.useMemo(()=>({onDragStart(f){let{active:h}=f;o(e.onDragStart({active:h}))},onDragMove(f){let{active:h,over:p}=f;e.onDragMove&&o(e.onDragMove({active:h,over:p}))},onDragOver(f){let{active:h,over:p}=f;o(e.onDragOver({active:h,over:p}))},onDragEnd(f){let{active:h,over:p}=f;o(e.onDragEnd({active:h,over:p}))},onDragCancel(f){let{active:h,over:p}=f;o(e.onDragCancel({active:h,over:p}))}}),[o,e])),!s)return null;const d=x.createElement(x.Fragment,null,x.createElement(iU,{id:r,value:i.draggable}),x.createElement(oU,{id:l,announcement:a}));return n?Le.createPortal(d,n):d}var vt;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(vt||(vt={}));function ll(){}function cl(t,e){return x.useMemo(()=>({sensor:t,options:e!=null?e:{}}),[t,e])}function S0(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return x.useMemo(()=>[...e].filter(r=>r!=null),[...e])}const hn=Object.freeze({x:0,y:0});function fU(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function hU(t,e){const n=sl(t);if(!n)return"0 0";const r={x:(n.x-e.left)/e.width*100,y:(n.y-e.top)/e.height*100};return r.x+"% "+r.y+"%"}function pU(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return n-r}function gU(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function A0(t){let{left:e,top:n,height:r,width:i}=t;return[{x:e,y:n},{x:e+i,y:n},{x:e,y:n+r},{x:e+i,y:n+r}]}function _0(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}const mU=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=A0(e),o=[];for(const a of r){const{id:l}=a,s=n.get(l);if(s){const c=A0(s),d=i.reduce((h,p,m)=>h+fU(c[m],p),0),f=Number((d/4).toFixed(4));o.push({id:l,data:{droppableContainer:a,value:f}})}}return o.sort(pU)};function vU(t,e){const n=Math.max(e.top,t.top),r=Math.max(e.left,t.left),i=Math.min(e.left+e.width,t.left+t.width),o=Math.min(e.top+e.height,t.top+t.height),a=i-r,l=o-n;if(r<i&&n<o){const s=e.width*e.height,c=t.width*t.height,d=a*l,f=d/(s+c-d);return Number(f.toFixed(4))}return 0}const bU=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=[];for(const o of r){const{id:a}=o,l=n.get(a);if(l){const s=vU(l,e);s>0&&i.push({id:a,data:{droppableContainer:o,value:s}})}}return i.sort(gU)};function yU(t,e,n){return X(U({},t),{scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1})}function T0(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:hn}function CU(t){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(U({},a),{top:a.top+t*l.y,bottom:a.bottom+t*l.y,left:a.left+t*l.x,right:a.right+t*l.x}),U({},n))}}const xU=CU(1);function E0(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function wU(t,e,n){const r=E0(e);if(!r)return t;const{scaleX:i,scaleY:o,x:a,y:l}=r,s=t.left-a-(1-i)*parseFloat(n),c=t.top-l-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),d=i?t.width/i:t.width,f=o?t.height/o:t.height;return{width:d,height:f,top:c,right:s+d,bottom:c+f,left:s}}const IU={ignoreTransform:!1};function Ti(t,e){e===void 0&&(e=IU);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:d}=Mt(t).getComputedStyle(t);c&&(n=wU(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 k0(t){return Ti(t,{ignoreTransform:!0})}function SU(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function AU(t,e){return e===void 0&&(e=Mt(t).getComputedStyle(t)),e.position==="fixed"}function _U(t,e){e===void 0&&(e=Mt(t).getComputedStyle(t));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=e[i];return typeof o=="string"?n.test(o):!1})}function ul(t,e){const n=[];function r(i){if(e!=null&&n.length>=e||!i)return n;if(kd(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Mo(i)||C0(i)||n.includes(i))return n;const o=Mt(t).getComputedStyle(i);return i!==t&&_U(i,o)&&n.push(i),AU(i,o)?n:r(i.parentNode)}return t?r(t):n}function P0(t){const[e]=ul(t,1);return e!=null?e:null}function Dd(t){return!nl||!t?null:Si(t)?t:Ed(t)?kd(t)||t===Ai(t).scrollingElement?window:Mo(t)?t:null:null}function D0(t){return Si(t)?t.scrollX:t.scrollLeft}function O0(t){return Si(t)?t.scrollY:t.scrollTop}function Od(t){return{x:D0(t),y:O0(t)}}var Ct;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Ct||(Ct={}));function R0(t){return!nl||!t?!1:t===document.scrollingElement}function L0(t){const e={x:0,y:0},n=R0(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height},i=t.scrollTop<=e.y,o=t.scrollLeft<=e.x,a=t.scrollTop>=r.y,l=t.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:a,isRight:l,maxScroll:r,minScroll:e}}const TU={x:.2,y:.2};function EU(t,e,n,r,i){let{top:o,left:a,right:l,bottom:s}=n;r===void 0&&(r=10),i===void 0&&(i=TU);const{isTop:c,isBottom:d,isLeft:f,isRight:h}=L0(t),p={x:0,y:0},m={x:0,y:0},g={height:e.height*i.y,width:e.width*i.x};return!c&&o<=e.top+g.height?(p.y=Ct.Backward,m.y=r*Math.abs((e.top+g.height-o)/g.height)):!d&&s>=e.bottom-g.height&&(p.y=Ct.Forward,m.y=r*Math.abs((e.bottom-g.height-s)/g.height)),!h&&l>=e.right-g.width?(p.x=Ct.Forward,m.x=r*Math.abs((e.right-g.width-l)/g.width)):!f&&a<=e.left+g.width&&(p.x=Ct.Backward,m.x=r*Math.abs((e.left+g.width-a)/g.width)),{direction:p,speed:m}}function kU(t){if(t===document.scrollingElement){const{innerWidth:o,innerHeight:a}=window;return{top:0,left:0,right:o,bottom:a,width:o,height:a}}const{top:e,left:n,right:r,bottom:i}=t.getBoundingClientRect();return{top:e,left:n,right:r,bottom:i,width:t.clientWidth,height:t.clientHeight}}function M0(t){return t.reduce((e,n)=>_i(e,Od(n)),hn)}function PU(t){return t.reduce((e,n)=>e+D0(n),0)}function DU(t){return t.reduce((e,n)=>e+O0(n),0)}function $0(t,e){if(e===void 0&&(e=Ti),!t)return;const{top:n,left:r,bottom:i,right:o}=e(t);P0(t)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const OU=[["x",["left","right"],PU],["y",["top","bottom"],DU]];class Rd{constructor(e,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=ul(n),i=M0(r);this.rect=U({},e),this.width=e.width,this.height=e.height;for(const[o,a,l]of OU)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 jo{constructor(e){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=e}add(e,n,r){var i;(i=this.target)==null||i.addEventListener(e,n,r),this.listeners.push([e,n,r])}}function RU(t){const{EventTarget:e}=Mt(t);return t instanceof e?t:Ai(t)}function Ld(t,e){const n=Math.abs(t.x),r=Math.abs(t.y);return typeof e=="number"?Math.sqrt(Pi(n,2)+Pi(r,2))>e:"x"in e&&"y"in e?n>e.x&&r>e.y:"x"in e?n>e.x:"y"in e?r>e.y:!1}var sn;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(sn||(sn={}));function N0(t){t.preventDefault()}function LU(t){t.stopPropagation()}var Pe;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(Pe||(Pe={}));const B0={start:[Pe.Space,Pe.Enter],cancel:[Pe.Esc],end:[Pe.Space,Pe.Enter,Pe.Tab]},MU=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case Pe.Right:return X(U({},n),{x:n.x+25});case Pe.Left:return X(U({},n),{x:n.x-25});case Pe.Down:return X(U({},n),{y:n.y+25});case Pe.Up:return X(U({},n),{y:n.y-25})}};class dl{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new jo(Ai(n)),this.windowListeners=new jo(Mt(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(sn.Resize,this.handleCancel),this.windowListeners.add(sn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(sn.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&$0(r),n(hn)}handleKeyDown(e){if(al(e)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=B0,coordinateGetter:a=MU,scrollBehavior:l="smooth"}=i,{code:s}=e;if(o.end.includes(s)){this.handleEnd(e);return}if(o.cancel.includes(s)){this.handleCancel(e);return}const{collisionRect:c}=r.current,d=c?{x:c.left,y:c.top}:hn;this.referenceCoordinates||(this.referenceCoordinates=d);const f=a(e,{active:n,context:r.current,currentCoordinates:d});if(f){const h=Fo(f,d),p={x:0,y:0},{scrollableAncestors:m}=r.current;for(const g of m){const v=e.code,{isTop:I,isRight:S,isLeft:y,isBottom:w,maxScroll:b,minScroll:_}=L0(g),E=kU(g),P={x:Math.min(v===Pe.Right?E.right-E.width/2:E.right,Math.max(v===Pe.Right?E.left:E.left+E.width/2,f.x)),y:Math.min(v===Pe.Down?E.bottom-E.height/2:E.bottom,Math.max(v===Pe.Down?E.top:E.top+E.height/2,f.y))},D=v===Pe.Right&&!S||v===Pe.Left&&!y,V=v===Pe.Down&&!w||v===Pe.Up&&!I;if(D&&P.x!==f.x){const j=g.scrollLeft+h.x,T=v===Pe.Right&&j<=b.x||v===Pe.Left&&j>=_.x;if(T&&!h.y){g.scrollTo({left:j,behavior:l});return}T?p.x=g.scrollLeft-j:p.x=v===Pe.Right?g.scrollLeft-b.x:g.scrollLeft-_.x,p.x&&g.scrollBy({left:-p.x,behavior:l});break}else if(V&&P.y!==f.y){const j=g.scrollTop+h.y,T=v===Pe.Down&&j<=b.y||v===Pe.Up&&j>=_.y;if(T&&!h.x){g.scrollTo({top:j,behavior:l});return}T?p.y=g.scrollTop-j:p.y=v===Pe.Down?g.scrollTop-b.y:g.scrollTop-_.y,p.y&&g.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(e,_i(Fo(f,this.referenceCoordinates),p))}}}handleMove(e,n){const{onMove:r}=this.props;e.preventDefault(),r(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}dl.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=B0,onActivation:i}=e,{active:o}=n;const{code:a}=t.nativeEvent;if(r.start.includes(a)){const l=o.activatorNode.current;return l&&t.target!==l?!1:(t.preventDefault(),i==null||i({event:t.nativeEvent}),!0)}return!1}}];function F0(t){return!!(t&&"distance"in t)}function j0(t){return!!(t&&"delay"in t)}class Md{constructor(e,n,r){var i;r===void 0&&(r=RU(e.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=e,this.events=n;const{event:o}=e,{target:a}=o;this.props=e,this.events=n,this.document=Ai(a),this.documentListeners=new jo(this.document),this.listeners=new jo(r),this.windowListeners=new jo(Mt(a)),this.initialCoordinates=(i=sl(o))!=null?i:hn,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:e,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(sn.Resize,this.handleCancel),this.windowListeners.add(sn.DragStart,N0),this.windowListeners.add(sn.VisibilityChange,this.handleCancel),this.windowListeners.add(sn.ContextMenu,N0),this.documentListeners.add(sn.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(j0(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(F0(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(e,n){const{active:r,onPending:i}=this.props;i(r,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(sn.Click,LU,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(sn.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:a,options:{activationConstraint:l}}=o;if(!i)return;const s=(n=sl(e))!=null?n:hn,c=Fo(i,s);if(!r&&l){if(F0(l)){if(l.tolerance!=null&&Ld(c,l.tolerance))return this.handleCancel();if(Ld(c,l.distance))return this.handleStart()}if(j0(l)&&Ld(c,l.tolerance))return this.handleCancel();this.handlePending(l,c);return}e.cancelable&&e.preventDefault(),a(s)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===Pe.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const $U={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class fl extends Md{constructor(e){const{event:n}=e,r=Ai(n.target);super(e,$U,r)}}fl.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const NU={move:{name:"mousemove"},end:{name:"mouseup"}};var $d;(function(t){t[t.RightClick=2]="RightClick"})($d||($d={}));class BU extends Md{constructor(e){super(e,NU,Ai(e.event.target))}}BU.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===$d.RightClick?!1:(r==null||r({event:n}),!0)}}];const Nd={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class FU extends Md{constructor(e){super(e,Nd)}static setup(){return window.addEventListener(Nd.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Nd.move.name,e)};function e(){}}}FU.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var Uo;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(Uo||(Uo={}));var hl;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(hl||(hl={}));function jU(t){let{acceleration:e,activator:n=Uo.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:a=5,order:l=hl.TreeOrder,pointerCoordinates:s,scrollableAncestors:c,scrollableAncestorRects:d,delta:f,threshold:h}=t;const p=zU({delta:f,disabled:!o}),[m,g]=Zj(),v=x.useRef({x:0,y:0}),I=x.useRef({x:0,y:0}),S=x.useMemo(()=>{switch(n){case Uo.Pointer:return s?{top:s.y,bottom:s.y,left:s.x,right:s.x}:null;case Uo.DraggableRect:return i}},[n,i,s]),y=x.useRef(null),w=x.useCallback(()=>{const _=y.current;if(!_)return;const E=v.current.x*I.current.x,P=v.current.y*I.current.y;_.scrollBy(E,P)},[]),b=x.useMemo(()=>l===hl.TreeOrder?[...c].reverse():c,[l,c]);x.useEffect(()=>{if(!o||!c.length||!S){g();return}for(const _ of b){if((r==null?void 0:r(_))===!1)continue;const E=c.indexOf(_),P=d[E];if(!P)continue;const{direction:D,speed:V}=EU(_,P,S,e,h);for(const j of["x","y"])p[j][D[j]]||(V[j]=0,D[j]=0);if(V.x>0||V.y>0){g(),y.current=_,m(w,a),v.current=V,I.current=D;return}}v.current={x:0,y:0},I.current={x:0,y:0},g()},[e,w,r,g,o,a,JSON.stringify(S),JSON.stringify(p),m,c,b,d,JSON.stringify(h)])}const UU={x:{[Ct.Backward]:!1,[Ct.Forward]:!1},y:{[Ct.Backward]:!1,[Ct.Forward]:!1}};function zU(t){let{delta:e,disabled:n}=t;const r=ol(e);return No(i=>{if(n||!r||!i)return UU;const o={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[Ct.Backward]:i.x[Ct.Backward]||o.x===-1,[Ct.Forward]:i.x[Ct.Forward]||o.x===1},y:{[Ct.Backward]:i.y[Ct.Backward]||o.y===-1,[Ct.Forward]:i.y[Ct.Forward]||o.y===1}}},[n,e,r])}function VU(t,e){const n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return No(i=>{var o;return e==null?null:(o=r!=null?r:i)!=null?o:null},[r,e])}function HU(t,e){return x.useMemo(()=>t.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(a=>({eventName:a.eventName,handler:e(a.handler,r)}));return[...n,...o]},[]),[t,e])}var zo;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(zo||(zo={}));var Bd;(function(t){t.Optimized="optimized"})(Bd||(Bd={}));const U0=new Map;function WU(t,e){let{dragging:n,dependencies:r,config:i}=e;const[o,a]=x.useState(null),{frequency:l,measure:s,strategy:c}=i,d=x.useRef(t),f=v(),h=$o(f),p=x.useCallback(function(I){I===void 0&&(I=[]),!h.current&&a(S=>S===null?I:S.concat(I.filter(y=>!S.includes(y))))},[h]),m=x.useRef(null),g=No(I=>{if(f&&!n)return U0;if(!I||I===U0||d.current!==t||o!=null){const S=new Map;for(let y of t){if(!y)continue;if(o&&o.length>0&&!o.includes(y.id)&&y.rect.current){S.set(y.id,y.rect.current);continue}const w=y.node.current,b=w?new Rd(s(w),w):null;y.rect.current=b,b&&S.set(y.id,b)}return S}return I},[t,o,n,f,s]);return x.useEffect(()=>{d.current=t},[t]),x.useEffect(()=>{f||p()},[n,f]),x.useEffect(()=>{o&&o.length>0&&a(null)},[JSON.stringify(o)]),x.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 zo.Always:return!1;case zo.BeforeDragging:return n;default:return!n}}}function Fd(t,e){return No(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function GU(t,e){return Fd(t,e)}function KU(t){let{callback:e,disabled:n}=t;const r=rl(e),i=x.useMemo(()=>{if(n||typeof window=="undefined"||typeof window.MutationObserver=="undefined")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return x.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function pl(t){let{callback:e,disabled:n}=t;const r=rl(e),i=x.useMemo(()=>{if(n||typeof window=="undefined"||typeof window.ResizeObserver=="undefined")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return x.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function YU(t){return new Rd(Ti(t),t)}function z0(t,e,n){e===void 0&&(e=YU);const[r,i]=x.useState(null);function o(){i(s=>{if(!t)return null;if(t.isConnected===!1){var c;return(c=s!=null?s:n)!=null?c:null}const d=e(t);return JSON.stringify(s)===JSON.stringify(d)?s:d})}const a=KU({callback(s){if(t)for(const c of s){const{type:d,target:f}=c;if(d==="childList"&&f instanceof HTMLElement&&f.contains(t)){o();break}}}}),l=pl({callback:o});return fn(()=>{o(),t?(l==null||l.observe(t),a==null||a.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),a==null||a.disconnect())},[t]),r}function qU(t){const e=Fd(t);return T0(t,e)}const V0=[];function JU(t){const e=x.useRef(t),n=No(r=>t?r&&r!==V0&&t&&e.current&&t.parentNode===e.current.parentNode?r:ul(t):V0,[t]);return x.useEffect(()=>{e.current=t},[t]),n}function QU(t){const[e,n]=x.useState(null),r=x.useRef(t),i=x.useCallback(o=>{const a=Dd(o.target);a&&n(l=>l?(l.set(a,Od(a)),new Map(l)):null)},[]);return x.useEffect(()=>{const o=r.current;if(t!==o){a(o);const l=t.map(s=>{const c=Dd(s);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,Od(c)]):null}).filter(s=>s!=null);n(l.length?new Map(l):null),r.current=t}return()=>{a(t),a(o)};function a(l){l.forEach(s=>{const c=Dd(s);c==null||c.removeEventListener("scroll",i)})}},[i,t]),x.useMemo(()=>t.length?e?Array.from(e.values()).reduce((o,a)=>_i(o,a),hn):M0(t):hn,[t,e])}function H0(t,e){e===void 0&&(e=[]);const n=x.useRef(null);return x.useEffect(()=>{n.current=null},e),x.useEffect(()=>{const r=t!==hn;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?Fo(t,n.current):hn}function XU(t){x.useEffect(()=>{if(!nl)return;const e=t.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of e)n==null||n()}},t.map(e=>{let{sensor:n}=e;return n}))}function ZU(t,e){return x.useMemo(()=>t.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=a=>{o(a,e)},n},{}),[t,e])}function W0(t){return x.useMemo(()=>t?SU(t):null,[t])}const G0=[];function ez(t,e){e===void 0&&(e=Ti);const[n]=t,r=W0(n?Mt(n):null),[i,o]=x.useState(G0);function a(){o(()=>t.length?t.map(s=>R0(s)?r:new Rd(e(s),s)):G0)}const l=pl({callback:a});return fn(()=>{l==null||l.disconnect(),a(),t.forEach(s=>l==null?void 0:l.observe(s))},[t]),i}function K0(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return Mo(e)?e:t}function tz(t){let{measure:e}=t;const[n,r]=x.useState(null),i=x.useCallback(c=>{for(const{target:d}of c)if(Mo(d)){r(f=>{const h=e(d);return f?X(U({},f),{width:h.width,height:h.height}):h});break}},[e]),o=pl({callback:i}),a=x.useCallback(c=>{const d=K0(c);o==null||o.disconnect(),d&&(o==null||o.observe(d)),r(d?e(d):null)},[e,o]),[l,s]=il(a);return x.useMemo(()=>({nodeRef:l,rect:n,setRef:s}),[n,l,s])}const nz=[{sensor:fl,options:{}},{sensor:dl,options:{}}],rz={current:{}},gl={draggable:{measure:k0},droppable:{measure:k0,strategy:zo.WhileDragging,frequency:Bd.Optimized},dragOverlay:{measure:Ti}};class Vo extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,r;return(n=(r=this.get(e))==null?void 0:r.node.current)!=null?n:void 0}}const iz={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Vo,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ll},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:gl,measureDroppableContainers:ll,windowRect:null,measuringScheduled:!1},Y0={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ll,draggableNodes:new Map,over:null,measureDroppableContainers:ll},Ho=x.createContext(Y0),q0=x.createContext(iz);function oz(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Vo}}}function az(t,e){switch(e.type){case vt.DragStart:return X(U({},t),{draggable:X(U({},t.draggable),{initialCoordinates:e.initialCoordinates,active:e.active})});case vt.DragMove:return t.draggable.active==null?t:X(U({},t),{draggable:X(U({},t.draggable),{translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}})});case vt.DragEnd:case vt.DragCancel:return X(U({},t),{draggable:X(U({},t.draggable),{active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}})});case vt.RegisterDroppable:{const{element:n}=e,{id:r}=n,i=new Vo(t.droppable.containers);return i.set(r,n),X(U({},t),{droppable:X(U({},t.droppable),{containers:i})})}case vt.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=e,o=t.droppable.containers.get(n);if(!o||r!==o.key)return t;const a=new Vo(t.droppable.containers);return a.set(n,X(U({},o),{disabled:i})),X(U({},t),{droppable:X(U({},t.droppable),{containers:a})})}case vt.UnregisterDroppable:{const{id:n,key:r}=e,i=t.droppable.containers.get(n);if(!i||r!==i.key)return t;const o=new Vo(t.droppable.containers);return o.delete(n),X(U({},t),{droppable:X(U({},t.droppable),{containers:o})})}default:return t}}function sz(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:i}=x.useContext(Ho),o=ol(r),a=ol(n==null?void 0:n.id);return x.useEffect(()=>{if(!e&&!r&&o&&a!=null){if(!al(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=nU(d);if(f){f.focus();break}}})}},[r,e,i,a,o]),null}function J0(t,e){let i=e,{transform:n}=i,r=Ye(i,["transform"]);return t!=null&&t.length?t.reduce((o,a)=>a(U({transform:o},r)),n):n}function lz(t){return x.useMemo(()=>({draggable:U(U({},gl.draggable),t==null?void 0:t.draggable),droppable:U(U({},gl.droppable),t==null?void 0:t.droppable),dragOverlay:U(U({},gl.dragOverlay),t==null?void 0:t.dragOverlay)}),[t==null?void 0:t.draggable,t==null?void 0:t.droppable,t==null?void 0:t.dragOverlay])}function cz(t){let{activeNode:e,measure:n,initialRect:r,config:i=!0}=t;const o=x.useRef(!1),{x:a,y:l}=typeof i=="boolean"?{x:i,y:i}:i;fn(()=>{if(!a&&!l||!e){o.current=!1;return}if(o.current||!r)return;const c=e==null?void 0:e.node.current;if(!c||c.isConnected===!1)return;const d=n(c),f=T0(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=P0(c);h&&h.scrollBy({top:f.y,left:f.x})}},[e,a,l,r,n])}const ml=x.createContext(X(U({},hn),{scaleX:1,scaleY:1}));var gr;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(gr||(gr={}));const Q0=x.memo(function(e){var n,r,i,o;let Il=e,{id:a,accessibility:l,autoScroll:s=!0,children:c,sensors:d=nz,collisionDetection:f=bU,measuring:h,modifiers:p}=Il,m=Ye(Il,["id","accessibility","autoScroll","children","sensors","collisionDetection","measuring","modifiers"]);const g=x.useReducer(az,void 0,oz),[v,I]=g,[S,y]=lU(),[w,b]=x.useState(gr.Uninitialized),_=w===gr.Initialized,{draggable:{active:E,nodes:P,translate:D},droppable:{containers:V}}=v,j=E!=null?P.get(E):null,T=x.useRef({initial:null,translated:null}),G=x.useMemo(()=>{var xt;return E!=null?{id:E,data:(xt=j==null?void 0:j.data)!=null?xt:rz,rect:T}:null},[E,j]),K=x.useRef(null),[B,N]=x.useState(null),[$,W]=x.useState(null),q=$o(m,Object.values(m)),ee=Bo("DndDescribedBy",a),R=x.useMemo(()=>V.getEnabled(),[V]),M=lz(h),{droppableRects:F,measureDroppableContainers:H,measuringScheduled:te}=WU(R,{dragging:_,dependencies:[D.x,D.y],config:M.droppable}),se=VU(P,E),ae=x.useMemo(()=>$?sl($):null,[$]),Q=pn(),le=GU(se,M.draggable.measure);cz({activeNode:E!=null?P.get(E):null,config:Q.layoutShiftCompensation,initialRect:le,measure:M.draggable.measure});const ne=z0(se,M.draggable.measure,le),ge=z0(se?se.parentElement:null),Ae=x.useRef({activatorEvent:null,active:null,activeNode:se,collisionRect:null,collisions:null,droppableRects:F,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:V,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ge=V.getNodeFor((n=Ae.current.over)==null?void 0:n.id),St=tz({measure:M.dragOverlay.measure}),lt=(r=St.nodeRef.current)!=null?r:se,Dt=_?(i=St.rect)!=null?i:ne:null,de=!!(St.nodeRef.current&&St.rect),he=qU(de?null:ne),Ce=W0(lt?Mt(lt):null),Ee=JU(_?Ge!=null?Ge:se:null),Ke=ez(Ee),De=J0(p,{transform:{x:D.x-he.x,y:D.y-he.y,scaleX:1,scaleY:1},activatorEvent:$,active:G,activeNodeRect:ne,containerNodeRect:ge,draggingNodeRect:Dt,over:Ae.current.over,overlayNodeRect:St.rect,scrollableAncestors:Ee,scrollableAncestorRects:Ke,windowRect:Ce}),ke=ae?_i(ae,D):null,At=QU(Ee),_t=H0(At),zt=H0(At,[ne]),$t=_i(De,_t),Jt=Dt?xU(Dt,De):null,mr=G&&Jt?f({active:G,collisionRect:Jt,droppableRects:F,droppableContainers:R,pointerCoordinates:ke}):null,xl=_0(mr,"id"),[_n,Wo]=x.useState(null),jd=de?De:_i(De,zt),Ud=yU(jd,(o=_n==null?void 0:_n.rect)!=null?o:null,ne),Ve=x.useRef(null),Ei=x.useCallback((xt,k)=>{let{sensor:L,options:Y}=k;if(K.current==null)return;const J=P.get(K.current);if(!J)return;const re=xt.nativeEvent,ce=new L({active:K.current,activeNode:J,event:re,options:Y,context:Ae,onAbort(ue){if(!P.get(ue))return;const{onDragAbort:fe}=q.current,me={id:ue};fe==null||fe(me),S({type:"onDragAbort",event:me})},onPending(ue,we,fe,me){if(!P.get(ue))return;const{onDragPending:Ot}=q.current,it={id:ue,constraint:we,initialCoordinates:fe,offset:me};Ot==null||Ot(it),S({type:"onDragPending",event:it})},onStart(ue){const we=K.current;if(we==null)return;const fe=P.get(we);if(!fe)return;const{onDragStart:me}=q.current,Oe={activatorEvent:re,active:{id:we,data:fe.data,rect:T}};Le.unstable_batchedUpdates(()=>{me==null||me(Oe),b(gr.Initializing),I({type:vt.DragStart,initialCoordinates:ue,active:we}),S({type:"onDragStart",event:Oe}),N(Ve.current),W(re)})},onMove(ue){I({type:vt.DragMove,coordinates:ue})},onEnd:xe(vt.DragEnd),onCancel:xe(vt.DragCancel)});Ve.current=ce;function xe(ue){return function(){return A(this,null,function*(){const{active:fe,collisions:me,over:Oe,scrollAdjustedTranslate:Ot}=Ae.current;let it=null;if(fe&&Ot){const{cancelDrop:gn}=q.current;it={activatorEvent:re,active:fe,collisions:me,delta:Ot,over:Oe},ue===vt.DragEnd&&typeof gn=="function"&&(yield Promise.resolve(gn(it)))&&(ue=vt.DragCancel)}K.current=null,Le.unstable_batchedUpdates(()=>{I({type:ue}),b(gr.Uninitialized),Wo(null),N(null),W(null),Ve.current=null;const gn=ue===vt.DragEnd?"onDragEnd":"onDragCancel";if(it){const Tn=q.current[gn];Tn==null||Tn(it),S({type:gn,event:it})}})})}}},[P]),Go=x.useCallback((xt,k)=>(L,Y)=>{const J=L.nativeEvent,re=P.get(Y);if(K.current!==null||!re||J.dndKit||J.defaultPrevented)return;const ce={active:re};xt(L,k.options,ce)===!0&&(J.dndKit={capturedBy:k.sensor},K.current=Y,Ei(L,k))},[P,Ei]),wl=HU(d,Go);XU(d),fn(()=>{ne&&w===gr.Initializing&&b(gr.Initialized)},[ne,w]),x.useEffect(()=>{const{onDragMove:xt}=q.current,{active:k,activatorEvent:L,collisions:Y,over:J}=Ae.current;if(!k||!L)return;const re={active:k,activatorEvent:L,collisions:Y,delta:{x:$t.x,y:$t.y},over:J};Le.unstable_batchedUpdates(()=>{xt==null||xt(re),S({type:"onDragMove",event:re})})},[$t.x,$t.y]),x.useEffect(()=>{const{active:xt,activatorEvent:k,collisions:L,droppableContainers:Y,scrollAdjustedTranslate:J}=Ae.current;if(!xt||K.current==null||!k||!J)return;const{onDragOver:re}=q.current,ce=Y.get(xl),xe=ce&&ce.rect.current?{id:ce.id,rect:ce.rect.current,data:ce.data,disabled:ce.disabled}:null,ue={active:xt,activatorEvent:k,collisions:L,delta:{x:J.x,y:J.y},over:xe};Le.unstable_batchedUpdates(()=>{Wo(xe),re==null||re(ue),S({type:"onDragOver",event:ue})})},[xl]),fn(()=>{Ae.current={activatorEvent:$,active:G,activeNode:se,collisionRect:Jt,collisions:mr,droppableRects:F,draggableNodes:P,draggingNode:lt,draggingNodeRect:Dt,droppableContainers:V,over:_n,scrollableAncestors:Ee,scrollAdjustedTranslate:$t},T.current={initial:Dt,translated:Jt}},[G,se,mr,Jt,P,lt,Dt,F,V,_n,Ee,$t]),jU(X(U({},Q),{delta:D,draggingRect:Jt,pointerCoordinates:ke,scrollableAncestors:Ee,scrollableAncestorRects:Ke}));const ki=x.useMemo(()=>({active:G,activeNode:se,activeNodeRect:ne,activatorEvent:$,collisions:mr,containerNodeRect:ge,dragOverlay:St,draggableNodes:P,droppableContainers:V,droppableRects:F,over:_n,measureDroppableContainers:H,scrollableAncestors:Ee,scrollableAncestorRects:Ke,measuringConfiguration:M,measuringScheduled:te,windowRect:Ce}),[G,se,ne,$,mr,ge,St,P,V,F,_n,H,Ee,Ke,M,te,Ce]),Ko=x.useMemo(()=>({activatorEvent:$,activators:wl,active:G,activeNodeRect:ne,ariaDescribedById:{draggable:ee},dispatch:I,draggableNodes:P,over:_n,measureDroppableContainers:H}),[$,wl,G,ne,I,ee,P,_n,H]);return x.createElement(I0.Provider,{value:y},x.createElement(Ho.Provider,{value:Ko},x.createElement(q0.Provider,{value:ki},x.createElement(ml.Provider,{value:Ud},c)),x.createElement(sz,{disabled:(l==null?void 0:l.restoreFocus)===!1})),x.createElement(dU,X(U({},l),{hiddenTextDescribedById:ee})));function pn(){const xt=(B==null?void 0:B.autoScrollEnabled)===!1,k=typeof s=="object"?s.enabled===!1:s===!1,L=_&&!xt&&!k;return typeof s=="object"?X(U({},s),{enabled:L}):{enabled:L}}}),uz=x.createContext(null),X0="button",dz="Draggable";function fz(t){let{id:e,data:n,disabled:r=!1,attributes:i}=t;const o=Bo(dz),{activators:a,activatorEvent:l,active:s,activeNodeRect:c,ariaDescribedById:d,draggableNodes:f,over:h}=x.useContext(Ho),{role:p=X0,roleDescription:m="draggable",tabIndex:g=0}=i!=null?i:{},v=(s==null?void 0:s.id)===e,I=x.useContext(v?ml:uz),[S,y]=il(),[w,b]=il(),_=ZU(a,e),E=$o(n);fn(()=>(f.set(e,{id:e,key:o,node:S,activatorNode:w,data:E}),()=>{const D=f.get(e);D&&D.key===o&&f.delete(e)}),[f,e]);const P=x.useMemo(()=>({role:p,tabIndex:g,"aria-disabled":r,"aria-pressed":v&&p===X0?!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:_,node:S,over:h,setNodeRef:y,setActivatorNodeRef:b,transform:I}}function Z0(){return x.useContext(q0)}const hz="Droppable",pz={timeout:25};function gz(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:i}=t;const o=Bo(hz),{active:a,dispatch:l,over:s,measureDroppableContainers:c}=x.useContext(Ho),d=x.useRef({disabled:n}),f=x.useRef(!1),h=x.useRef(null),p=x.useRef(null),{disabled:m,updateMeasurementsFor:g,timeout:v}=U(U({},pz),i),I=$o(g!=null?g:r),S=x.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{c(Array.isArray(I.current)?I.current:[I.current]),p.current=null},v)},[v]),y=pl({callback:S,disabled:m||!a}),w=x.useCallback((P,D)=>{y&&(D&&(y.unobserve(D),f.current=!1),P&&y.observe(P))},[y]),[b,_]=il(w),E=$o(e);return x.useEffect(()=>{!y||!b.current||(y.disconnect(),f.current=!1,y.observe(b.current))},[b,y]),x.useEffect(()=>(l({type:vt.RegisterDroppable,element:{id:r,key:o,disabled:n,node:b,rect:h,data:E}}),()=>l({type:vt.UnregisterDroppable,key:o,id:r})),[r]),x.useEffect(()=>{n!==d.current.disabled&&(l({type:vt.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:_}}function mz(t){let{animation:e,children:n}=t;const[r,i]=x.useState(null),[o,a]=x.useState(null),l=ol(n);return!n&&!r&&l&&i(l),fn(()=>{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(e(c,o)).then(()=>{i(null)})},[e,r,o]),x.createElement(x.Fragment,null,n,r?x.cloneElement(r,{ref:a}):null)}const vz={x:0,y:0,scaleX:1,scaleY:1};function bz(t){let{children:e}=t;return x.createElement(Ho.Provider,{value:Y0},x.createElement(ml.Provider,{value:vz},e))}const yz={position:"fixed",touchAction:"none"},Cz=t=>al(t)?"transform 250ms ease":void 0,xz=x.forwardRef((t,e)=>{let{as:n,activatorEvent:r,adjustScale:i,children:o,className:a,rect:l,style:s,transform:c,transition:d=Cz}=t;if(!l)return null;const f=i?c:X(U({},c),{scaleX:1,scaleY:1}),h=U(X(U({},yz),{width:l.width,height:l.height,top:l.top,left:l.left,transform:Qn.Transform.toString(f),transformOrigin:i&&r?hU(r,l):void 0,transition:typeof d=="function"?d(r):d}),s);return x.createElement(n,{className:a,style:h,ref:e},o)}),ey=t=>e=>{let{active:n,dragOverlay:r}=e;const i={},{styles:o,className:a}=t;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)}},wz={duration:250,easing:"ease",keyframes:t=>{let{transform:{initial:e,final:n}}=t;return[{transform:Qn.Transform.toString(e)},{transform:Qn.Transform.toString(n)}]},sideEffects:ey({styles:{active:{opacity:"0"}}})};function Iz(t){let{config:e,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=t;return rl((o,a)=>{if(e===null)return;const l=n.get(o);if(!l)return;const s=l.node.current;if(!s)return;const c=K0(a);if(!c)return;const{transform:d}=Mt(a).getComputedStyle(a),f=E0(d);if(!f)return;const h=typeof e=="function"?e:Sz(e);return $0(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 Sz(t){const{duration:e,easing:n,sideEffects:r,keyframes:i}=U(U({},wz),t);return o=>{let S=o,{active:a,dragOverlay:l,transform:s}=S,c=Ye(S,["active","dragOverlay","transform"]);if(!e)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=U({x:s.x-d.x,y:s.y-d.y},f),p=i(X(U({},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(U({active:a,dragOverlay:l},c)),I=l.node.animate(p,{duration:e,easing:n,fill:"forwards"});return new Promise(y=>{I.onfinish=()=>{v==null||v(),y()}})}}let ty=0;function Az(t){return x.useMemo(()=>{if(t!=null)return ty++,ty},[t])}const _z=x.memo(t=>{let{adjustScale:e=!1,children:n,dropAnimation:r,style:i,transition:o,modifiers:a,wrapperElement:l="div",className:s,zIndex:c=999}=t;const{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:p,draggableNodes:m,droppableContainers:g,dragOverlay:v,over:I,measuringConfiguration:S,scrollableAncestors:y,scrollableAncestorRects:w,windowRect:b}=Z0(),_=x.useContext(ml),E=Az(f==null?void 0:f.id),P=J0(a,{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:p,draggingNodeRect:v.rect,over:I,overlayNodeRect:v.rect,scrollableAncestors:y,scrollableAncestorRects:w,transform:_,windowRect:b}),D=Fd(h),V=Iz({config:r,draggableNodes:m,droppableContainers:g,measuringConfiguration:S}),j=D?v.setRef:void 0;return x.createElement(bz,null,x.createElement(mz,{animation:V},f&&E?x.createElement(xz,{key:E,id:f.id,ref:j,as:l,activatorEvent:d,adjustScale:e,className:s,transition:o,rect:D,style:U({zIndex:c},i),transform:P},n):null))});function vl(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function Tz(t,e){return t.reduce((n,r,i)=>{const o=e.get(r);return o&&(n[i]=o),n},Array(t.length))}function bl(t){return t!==null&&t>=0}function Ez(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function kz(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const ny=t=>{let{rects:e,activeIndex:n,overIndex:r,index:i}=t;const o=vl(e,r,n),a=e[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}},ry="Sortable",iy=x.createContext({activeIndex:-1,containerId:ry,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:ny,disabled:{draggable:!1,droppable:!1}});function oy(t){let{children:e,id:n,items:r,strategy:i=ny,disabled:o=!1}=t;const{active:a,dragOverlay:l,droppableRects:s,over:c,measureDroppableContainers:d}=Z0(),f=Bo(ry,n),h=l.rect!==null,p=x.useMemo(()=>r.map(_=>typeof _=="object"&&"id"in _?_.id:_),[r]),m=a!=null,g=a?p.indexOf(a.id):-1,v=c?p.indexOf(c.id):-1,I=x.useRef(p),S=!Ez(p,I.current),y=v!==-1&&g===-1||S,w=kz(o);fn(()=>{S&&m&&d(p)},[S,p,m,d]),x.useEffect(()=>{I.current=p},[p]);const b=x.useMemo(()=>({activeIndex:g,containerId:f,disabled:w,disableTransforms:y,items:p,overIndex:v,useDragOverlay:h,sortedRects:Tz(p,s),strategy:i}),[g,f,w.draggable,w.droppable,y,p,v,s,h,i]);return x.createElement(iy.Provider,{value:b},e)}const Pz=t=>{let{id:e,items:n,activeIndex:r,overIndex:i}=t;return vl(n,r,i).indexOf(e)},Dz=t=>{let{containerId:e,isSorting:n,wasDragging:r,index:i,items:o,newIndex:a,previousItems:l,previousContainerId:s,transition:c}=t;return!c||!r||l!==o&&i===a?!1:n?!0:a!==i&&e===s},Oz={duration:200,easing:"ease"},ay="transform",Rz=Qn.Transition.toString({property:ay,duration:0,easing:"linear"}),Lz={roleDescription:"sortable"};function Mz(t){let{disabled:e,index:n,node:r,rect:i}=t;const[o,a]=x.useState(null),l=x.useRef(n);return fn(()=>{if(!e&&n!==l.current&&r.current){const s=i.current;if(s){const c=Ti(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)},[e,n,r,i]),x.useEffect(()=>{o&&a(null)},[o]),o}function sy(t){let{animateLayoutChanges:e=Dz,attributes:n,disabled:r,data:i,getNewIndex:o=Pz,id:a,strategy:l,resizeObserverConfig:s,transition:c=Oz}=t;const{items:d,containerId:f,activeIndex:h,disabled:p,disableTransforms:m,sortedRects:g,overIndex:v,useDragOverlay:I,strategy:S}=x.useContext(iy),y=$z(r,p),w=d.indexOf(a),b=x.useMemo(()=>U({sortable:{containerId:f,index:w,items:d}},i),[f,i,w,d]),_=x.useMemo(()=>d.slice(d.indexOf(a)),[d,a]),{rect:E,node:P,isOver:D,setNodeRef:V}=gz({id:a,data:b,disabled:y.droppable,resizeObserverConfig:U({updateMeasurementsFor:_},s)}),{active:j,activatorEvent:T,activeNodeRect:G,attributes:K,setNodeRef:B,listeners:N,isDragging:$,over:W,setActivatorNodeRef:q,transform:ee}=fz({id:a,data:b,attributes:U(U({},Lz),n),disabled:y.draggable}),R=Xj(V,B),M=!!j,F=M&&!m&&bl(h)&&bl(v),H=!I&&$,te=H&&F?ee:null,se=l!=null?l:S,ae=F?te!=null?te:se({rects:g,activeNodeRect:G,activeIndex:h,overIndex:v,index:w}):null,Q=bl(h)&&bl(v)?o({id:a,items:d,activeIndex:h,overIndex:v}):w,le=j==null?void 0:j.id,ne=x.useRef({activeId:le,items:d,newIndex:Q,containerId:f}),ge=d!==ne.current.items,Ae=e({active:j,containerId:f,isDragging:$,isSorting:M,id:a,index:w,items:d,newIndex:ne.current.newIndex,previousItems:ne.current.items,previousContainerId:ne.current.containerId,transition:c,wasDragging:ne.current.activeId!=null}),Ge=Mz({disabled:!Ae,index:w,node:P,rect:E});return x.useEffect(()=>{M&&ne.current.newIndex!==Q&&(ne.current.newIndex=Q),f!==ne.current.containerId&&(ne.current.containerId=f),d!==ne.current.items&&(ne.current.items=d)},[M,Q,f,d]),x.useEffect(()=>{if(le===ne.current.activeId)return;if(le!=null&&ne.current.activeId==null){ne.current.activeId=le;return}const lt=setTimeout(()=>{ne.current.activeId=le},50);return()=>clearTimeout(lt)},[le]),{active:j,activeIndex:h,attributes:K,data:b,rect:E,index:w,newIndex:Q,items:d,isOver:D,isSorting:M,isDragging:$,listeners:N,node:P,overIndex:v,over:W,setNodeRef:R,setActivatorNodeRef:q,setDroppableNodeRef:V,setDraggableNodeRef:B,transform:Ge!=null?Ge:ae,transition:St()};function St(){if(Ge||ge&&ne.current.newIndex===w)return Rz;if(!(H&&!al(T)||!c)&&(M||Ae))return Qn.Transition.toString(X(U({},c),{property:ay}))}}function $z(t,e){var n,r;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(n=t==null?void 0:t.draggable)!=null?n:e.draggable,droppable:(r=t==null?void 0:t.droppable)!=null?r:e.droppable}}function yl(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const Nz=[Pe.Down,Pe.Right,Pe.Up,Pe.Left],ly=(t,e)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:o,over:a,scrollableAncestors:l}}=e;if(Nz.includes(t.code)){if(t.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(t.code){case Pe.Down:r.top<h.top&&s.push(f);break;case Pe.Up:r.top>h.top&&s.push(f);break;case Pe.Left:r.left>h.left&&s.push(f);break;case Pe.Right:r.left<h.left&&s.push(f);break}});const c=mU({active:n,collisionRect:r,droppableRects:i,droppableContainers:s,pointerCoordinates:null});let d=_0(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=ul(m).some((_,E)=>l[E]!==_),I=cy(f,h),S=Bz(f,h),y=v||!I?{x:0,y:0}:{x:S?r.width-p.width:0,y:S?r.height-p.height:0},w={x:p.left,y:p.top};return y.x&&y.y?w:Fo(w,y)}}}};function cy(t,e){return!yl(t)||!yl(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function Bz(t,e){return!yl(t)||!yl(e)||!cy(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}const uy=We(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"),Cl=x.createContext({attributes:{},listeners:void 0,ref(){}}),Fz=()=>{const{attributes:t,listeners:e,ref:n}=x.useContext(Cl);return u.jsx(C.Button,X(U(U({sx:{backgroundColor:"transparent",color:"#919eab",width:"10px",":hover":{backgroundColor:"transparent"},":active":{backgroundColor:"transparent"}}},t),e),{ref:n,children:u.jsx(uy,{})}))},dy=({children:t,id:e,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}=sy({id:e}),p=x.useMemo(()=>({attributes:a,listeners:s,ref:d}),[a,s,d]),m={opacity:l?.6:void 0,transform:Qn.Translate.toString(f),transition:h};return u.jsx(Cl.Provider,{value:p,children:u.jsx(C.ListItem,{variant:o,ref:c,style:m,startAction:i?u.jsx(Fz,{}):u.jsx(u.Fragment,{}),endAction:i?u.jsx(C.Tooltip,{title:n,children:u.jsx(C.Button,{variant:"outlined",color:"danger",onClick:r,sx:{ml:"auto",p:.5},size:"sm",children:u.jsx(Me.Remove,{})})}):u.jsx(u.Fragment,{}),sx:{p:2,borderRadius:"sm"},children:t})})},jz={sideEffects:ey({styles:{active:{opacity:"0.6"}}})},fy=({children:t})=>u.jsx(_z,{dropAnimation:jz,children:t}),Uz=({entities:t=[],labels:e,disabled:n,setEntities:r,removeItem:i})=>{const[o,a]=x.useState(null),l=x.useMemo(()=>t.find(c=>c.id===(o==null?void 0:o.id)),[o,t]),s=S0(cl(fl),cl(dl,{coordinateGetter:ly}));return u.jsxs(Q0,{sensors:s,onDragStart:({active:c})=>{a(c)},onDragEnd:({active:c,over:d})=>{if(d&&c.id!==(d==null?void 0:d.id)){const f=t.findIndex(({id:p})=>p===c.id),h=t.findIndex(({id:p})=>p===d.id);r(vl(t,f,h))}a(null)},onDragCancel:()=>{a(null)},children:[u.jsx(oy,{items:t,children:u.jsx(C.List,{sx:{gap:"10px",padding:0},children:t.map(c=>u.jsxs(dy,{id:c.id,variant:"outlined",removeItem:()=>i(c.id),tooltipTitle:e.removeEntity,useDraggable:!n,children:[u.jsx(C.Typography,{ml:n?0:2.5,children:c.title||c.name}),c.type&&u.jsx(C.Chip,{color:ij(c.type),sx:{marginLeft:2},children:oj(c.type)})]},`sortable-item-${c.id}`))})}),u.jsx(fy,{children:l?u.jsx(u.Fragment,{children:t.map(c=>u.jsx(dy,{id:c.id,useDraggable:!1,removeItem:()=>{},tooltipTitle:e.removeEntity},`sortable-overlay-item-${c.id}`))}):u.jsx(u.Fragment,{})})]})},zz=t=>u.jsxs(C.FormControl,{size:"sm",children:[u.jsx(C.FormLabel,{children:t.labels.itemsPerPage}),u.jsx(C.Select,{value:t.value,size:"sm",onChange:t.onChange,sx:{minHeight:"37px"},children:t.options.map((e,n)=>u.jsx(C.Option,{value:e,children:e},`items-per-page-${e}-${n}`))})]}),Vz=(t,e)=>{const[n,r]=x.useState(null),{sdk:i}=gt(),o=()=>A(this,null,function*(){let l=[];if(!t){r(l);return}try{switch(t){case"top_x":l=(yield i.topX.getGames({limit:50},!0)).data.map(v=>({id:v.id,name:v.title,status:v.status,type:t,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:t,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:t,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:t,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:t,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:t,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:t,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:t,relationship:"relatedTo"}));break}}catch(s){console.error(s),r(l),e();return}r(l)});return x.useEffect(()=>(o(),()=>r(null)),[t]),n},Hz=({status:t})=>{let e="neutral";switch(t){case"DYNAMIC":e="primary";break;case"CUSTOM":e="success";break;case"OPEN":e="primary";break;case"LIVE":e="primary";break;case"CANCELED":e="warning";break;case"SETTLED":e="success";break;case"INACTIVE":e="danger";break;case"ACTIVE":e="success";break;case"EXPIRED":e="neutral";break}return u.jsx(C.Chip,{color:e,variant:"solid",size:"sm",children:t})},Wz=We(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"),Gz=We(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"),Kz=We(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"),Yz=We(u.jsx("path",{d:"M9.01 14H2v2h7.01v3L13 15l-3.99-4zm5.98-1v-3H22V8h-7.01V5L11 9z"}),"CompareArrows"),qz=We(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"),Jz=t=>{switch(t.entityType){case"top_x":return u.jsx(C.Tooltip,{title:"Top X",children:u.jsx(Wz,{})});case"match_quiz":return u.jsx(C.Tooltip,{title:"Match Quiz",children:u.jsx(Gz,{})});case"template":return u.jsx(C.Tooltip,{title:"Leaderboard Templates",children:u.jsx(Me.EmojiEvents,{})});case"classic_quiz":return u.jsx(C.Tooltip,{title:"Classic Quiz",children:u.jsx(Kz,{})});case"either_or":return u.jsx(C.Tooltip,{title:"Either/Or",children:u.jsx(Yz,{})});case"poll":return u.jsx(C.Tooltip,{title:"Poll",children:u.jsx(qz,{})});case"bracket":return u.jsx(C.Tooltip,{title:"Custom Bracket Game",children:u.jsx(Me.EmojiEvents,{})});case"standing":return u.jsx(C.Tooltip,{title:"Custom Standings Game",children:u.jsx(Me.EmojiEvents,{})});default:return null}},Qz=({entity:t,deleteLabel:e,onDelete:n})=>u.jsx(u.Fragment,{children:u.jsx(C.Card,{sx:{p:2,mb:2},children:u.jsx(C.CardContent,{children:u.jsxs(C.Box,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},alignItems:"center",justifyContent:"space-between"},children:[u.jsx(C.Typography,{fontSize:"sm",startDecorator:u.jsx(Jz,{entityType:t.type}),children:t.name}),u.jsx(C.Box,{display:{xs:"none",md:"block"},children:u.jsx(Hz,{status:t.status})}),u.jsx(C.Box,{children:u.jsx(C.Tooltip,{title:e,children:u.jsx(C.IconButton,{onClick:()=>n(t.id,t.relationship),color:"danger",size:"sm",children:u.jsx(Me.Delete,{})})})})]})})})}),Xz=(t,e,n,r)=>A(this,null,function*(){let o=[];const a=new Map;e.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(([D])=>D),d=yield t.topX.getGames({limit:c.length,gameIds:c},!0);o=[...o,...d.data.map(D=>{var j;const V=((j=s.find(([T])=>T===D.id))==null?void 0:j[1])||"relatedTo";return{id:D.id,name:D.title,status:D.status,type:l,relationship:V}})];break;case"match_quiz":const f=s.map(([D])=>D),h=yield t.matchQuiz.getGames({limit:f.length,gameIds:f},!0);o=[...o,...h.data.map(D=>{var j;const V=((j=s.find(([T])=>T===D.id))==null?void 0:j[1])||"relatedTo";return{id:D.id,name:D.title,status:D.status,type:l,relationship:V}})];break;case"template":const p=s.map(([D])=>D),m=yield t.loyalty.getTemplates(void 0,!0);o=[...o,...m.data.filter(D=>p.includes(D.id)).map(D=>{var j;const V=((j=s.find(([T])=>T===D.id))==null?void 0:j[1])||"relatedTo";return{id:D.id,name:D.title,status:D.status,type:l,relationship:V}})];break;case"classic_quiz":const g=s.map(([D])=>D),v=yield t.miniGames.getClassicQuizzes({limit:g.length,classicQuizIds:g},!1,!0);o=[...o,...v.data.map(D=>{var j;const V=((j=s.find(([T])=>T===D.id))==null?void 0:j[1])||"relatedTo";return{id:D.id,name:D.title,status:D.status,type:l,relationship:V}})];break;case"either_or":const I=s.map(([D])=>D),S=yield t.miniGames.getEitherOrs({limit:I.length,eitherOrIds:I},!1,!0);o=[...o,...S.data.map(D=>{var j;const V=((j=s.find(([T])=>T===D.id))==null?void 0:j[1])||"relatedTo";return{id:D.id,name:D.title,status:D.status,type:l,relationship:V}})];break;case"poll":const y=s.map(([D])=>D),w=yield t.voting.getPolls({limit:y.length,pollIds:y},!0);o=[...o,...w.data.map(D=>{var j;const V=((j=s.find(([T])=>T===D.id))==null?void 0:j[1])||"relatedTo";return{id:D.id,name:D.title,status:D.status,type:l,relationship:V}})];break;case"bracket":const b=s.map(([D])=>D),_=yield t.bracketGame.getGames({limit:b.length,gameIds:b},!0);o=[...o,..._.data.map(D=>{var j;const V=((j=s.find(([T])=>T===D.id))==null?void 0:j[1])||"relatedTo";return{id:D.id,name:D.title,status:D.status,type:l,relationship:V}})];break;case"standing":const E=s.map(([D])=>D),P=yield t.standingGame.getGames({limit:E.length,gameIds:E},!0);o=[...o,...P.data.map(D=>{var j;const V=((j=s.find(([T])=>T===D.id))==null?void 0:j[1])||"relatedTo";return{id:D.id,name:D.title,status:D.status,type:l,relationship:V}})];break;default:}}catch(l){console.error("Error loading related entities",l),n(o),r()}n(o)}),Zz=["top_x","match_quiz","template","classic_quiz","poll","either_or","bracket","standing"],e5=["relatedTo","blocks","blockedBy","bonusPointsGame","nextInSeries","previousInSeries"],t5=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"),hy=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"),n5=({defaultValue:t=[],onChange:e,labels:n})=>{const[r,i]=x.useState([]),[o,a]=x.useState(""),[l,s]=x.useState(null),[c,d]=x.useState("relatedTo"),[f,h]=x.useState(!1),p=()=>h(!f),m=Vz(l,p),{sdk:g}=gt();x.useEffect(()=>(t.length>0&&Xz(g,t,i,p),()=>{i([]),a(""),s(null),d("relatedTo")}),[]);const v=()=>{if(t.some(E=>E.entity_id===o&&E.entity_relationship===c)){a("");return}const b=[...t,{entity_id:o,entity_type:l,entity_relationship:c}],_=(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,..._]),e(b),a("")},I=(w,b)=>{const _=t.filter(P=>!(P.entity_id===w&&P.entity_relationship===b)),E=r.filter(P=>!(P.id===w&&P.relationship===b));i(E),e(_)},S=r.reduce((w,b)=>{const _=b.relationship;return w[_]||(w[_]=[]),w[_].push(b),w},{}),y=Object.keys(S).sort();return u.jsxs(u.Fragment,{children:[y.map(w=>u.jsxs(C.Box,{sx:{mb:2},children:[u.jsx(C.Typography,{level:"title-md",sx:{fontWeight:"bold",mb:1},children:u.jsx(C.Chip,{variant:"outlined",size:"md",sx:{bgcolor:"background.surface"},children:hy.get(w)||"Unknown relationship"})}),S[w].map((b,_)=>u.jsx(Qz,{entity:b,deleteLabel:n.delete,onDelete:I},`related-entity-relationship-${b.id}-${_}`))]},`relationship-group-${w}`)),u.jsxs(C.Box,{sx:{display:"flex",flexDirection:"column",width:"100%",gap:1},children:[u.jsxs(C.FormControl,{children:[u.jsx(C.FormLabel,{required:!0,color:"primary",children:n.type}),u.jsx(C.Select,{value:l,size:"sm",name:"entity_type",onChange:(w,b)=>s(b),sx:{minHeight:"37px"},children:Zz.map(w=>u.jsx(C.Option,{value:w,children:t5.get(w)},`entity-type-option-${w}`))})]}),u.jsxs(C.FormControl,{children:[u.jsx(C.FormLabel,{required:!0,color:"primary",children:n.relationship}),u.jsx(C.Select,{value:c,size:"sm",name:"entity_relationship",onChange:(w,b)=>d(b),sx:{minHeight:"37px"},children:e5.map(w=>u.jsx(C.Option,{value:w,children:hy.get(w)},`entity-relationship-option-${w}`))})]}),u.jsxs(C.FormControl,{children:[u.jsx(C.FormLabel,{required:!0,color:"primary",children:n.entity}),u.jsx(C.Select,{value:o,size:"sm",name:"entity_id",onChange:(w,b)=>a(b),sx:{width:"100%",mr:{xs:0,md:1},mb:{xs:1,md:0},minHeight:"37px"},endDecorator:!m&&u.jsx(C.CircularProgress,{size:"sm"}),children:m&&m.map(w=>u.jsx(C.Option,{value:w.id,children:w.name},`entity--${w.id}`))})]}),u.jsx(C.Button,{startDecorator:u.jsx(Me.Add,{}),disabled:!o||!l,onClick:v,sx:{mb:1},children:n.add})]}),u.jsx(ft,{showToast:f,message:n.relatedEntitiesErrorMessage,color:"danger",hideToast:p})]})},r5=t=>{const[e,n]=x.useState(!1),[r,i]=x.useState(!1),[o,a]=x.useState("success"),[l,s]=x.useState(""),c=x.useContext(ja),d=(h,p)=>{a(h),s(p),i(!0)},f=()=>A(this,null,function*(){n(!0);const h=yield c==null?void 0:c.https.exportLeadsPerEntity(t.entityId);if(h!=null&&h.ok){const p=yield h.blob(),m=URL.createObjectURL(p),g=document.createElement("a");g.href=m,g.download=`${t.entityType}_${t.entityName}_exported_users_leads.csv`,document.body.appendChild(g),g.click(),document.body.removeChild(g),URL.revokeObjectURL(m),n(!1),d("success",t.labels.usersLeadsExportMessage)}else console.error("Failed to export all users leads: ",yield h==null?void 0:h.json()),n(!1),d("danger",t.labels.usersLeadsExportErrorMessage)});return u.jsxs(u.Fragment,{children:[u.jsxs(C.Box,{mb:2,children:[u.jsx(C.Box,{display:"flex",alignItems:"center",mb:1,children:u.jsx(C.Typography,{level:"body-lg",sx:{mx:"auto"},children:t.labels.exportUsersLeads})}),u.jsx(C.Sheet,{sx:{overflowX:"auto",minWidth:"700px"},children:u.jsxs(C.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:t.labels.category}),u.jsx("th",{children:t.labels.action})]})}),u.jsx("tbody",{children:u.jsxs("tr",{children:[u.jsxs("td",{children:[u.jsx(C.Typography,{level:"body-sm",fontWeight:"600",children:t.labels.exportAllUsersLeads}),u.jsx(C.Typography,{level:"body-xs",color:"neutral",children:t.labels.exportAllUsersLeadsDescription})]}),u.jsx("td",{children:u.jsx(C.Button,{loading:e,onClick:f,children:t.labels.exportAllUsersLeads})})]})})]})})]}),u.jsx(ft,{showToast:r,color:o,message:l,hideToast:()=>i(!1)})]})},i5=({tooltipContent:t="Drag to reorder"})=>{const{attributes:e,listeners:n,ref:r}=x.useContext(Cl);return u.jsx(C.Tooltip,{title:t,placement:"left",arrow:!0,children:u.jsx(C.IconButton,X(U(U({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"}}},e),n),{ref:r,children:u.jsx(uy,{})}))})},py=({id:t,useDraggable:e=!0,variant:n="outlined",item:r,tooltipContent:i})=>{const{attributes:o,isDragging:a,listeners:l,setNodeRef:s,setActivatorNodeRef:c,transform:d,transition:f}=sy({id:t}),h=x.useMemo(()=>({attributes:o,listeners:l,ref:c}),[o,l,c]),p={opacity:a?.6:void 0,transform:Qn.Translate.toString(d),transition:f},m=v=>v.split(" ").map(I=>I[0]).join("").toUpperCase().substring(0,2),g=v=>r!=null&&r.color?r.color:`hsl(${v.split("").reduce((y,w)=>w.charCodeAt(0)+((y<<5)-y),0)%360}, 70%, 80%)`;return u.jsx(Cl.Provider,{value:h,children:u.jsx(C.ListItem,{variant:n,ref:s,style:p,endAction:e?u.jsx(i5,{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(C.Box,{sx:{display:"flex",width:"100%",alignItems:"center",gap:2,p:0},children:[u.jsx(C.Sheet,{sx:{width:"8px",alignSelf:"stretch",bgcolor:g(r.name)}}),u.jsx(C.Avatar,{src:r.image,alt:r.name,sx:{bgcolor:g(r.name),my:2,ml:1},children:m(r.name)}),u.jsxs(C.Box,{sx:{py:2,pr:2,flexGrow:1,display:"flex",flexDirection:"column",gap:.5},children:[u.jsx(C.Typography,{level:"title-md",children:r.name}),r.description&&u.jsx(C.Typography,{level:"body-sm",sx:{color:"text.secondary",textOverflow:"ellipsis"},children:r.description}),u.jsx(C.Box,{sx:{mt:.5},children:r.type&&u.jsx(C.Chip,{variant:"soft",color:"primary",size:"sm",sx:{px:1,bgcolor:`${g(r.type)}40`},children:r.type})})]})]})})})},o5={Login:zN,InformationInput:In,RichText:yu,HeaderButtons:vL,MarketSelection:r2,Accordion:oP,DynamicFields:LL,BasicSelect:sP,BooleanSwitch:el,Branding:mL,ProfileSearchSelect:SB,RangeCalendar:OL,CompetitionSearchSelect:wB,Related:s2,Images:bN,Duration:DL,DatePickerComponent:Ao,Flags:pN,Spinner:Zs,Tags:Nb,Toast:ft,AdContent:aP,Match:i2,Winners:hj,CompetitionsSearchSelect:IB,TeamsSearchSelect:AB,CustomSelect:I2,Schedule:m2,NoPermissionCard:RL,CustomFlatpickrCalendar:rd,ContextSelectFilter:gj,NumberInput:Uj,EntityContext:Yj,MiniGamesImages:Jj,AuthRequirement:Qj,SortableList:Uz,ItemsPerPageFilter:zz,ImageCard:Do,RelatedRelationship:n5,ExportUsersLeads:r5,SignOutButton:dv,BasicSortableList:({items:t=[],labels:e,setItems:n})=>{const[r,i]=x.useState(null),o=x.useMemo(()=>t.find(l=>l.id===(r==null?void 0:r.id)),[r,t]),a=S0(cl(fl,{activationConstraint:{distance:8}}),cl(dl,{coordinateGetter:ly}));return t.length===0?u.jsx(C.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",border:"1px dashed",borderColor:"divider",borderRadius:"md"},children:u.jsx(C.Typography,{level:"body-lg",color:"neutral",children:(e==null?void 0:e.noItemsToDisplay)||"No items to display"})}):u.jsxs(Q0,{sensors:a,onDragStart:({active:l})=>{i(l)},onDragEnd:({active:l,over:s})=>{if(s&&l.id!==(s==null?void 0:s.id)){const c=t.findIndex(({id:f})=>f===l.id),d=t.findIndex(({id:f})=>f===s.id);n(vl(t,c,d))}i(null)},onDragCancel:()=>{i(null)},children:[u.jsx(oy,{items:t,children:u.jsx(C.List,{sx:{gap:2,maxHeight:"70vh",overflowY:"auto","&::-webkit-scrollbar":{width:"8px"},"&::-webkit-scrollbar-thumb":{backgroundColor:"action.focus",borderRadius:"4px"}},children:t.map(l=>u.jsx(py,{id:l.id,variant:"outlined",item:l,tooltipContent:e==null?void 0:e.dragToReorder},`sortable-item-${l.id}`))})}),u.jsx(fy,{children:o?u.jsx(py,{id:o.id,useDraggable:!1,item:o,tooltipContent:e.dragToReorder},`sortable-overlay-item-${o.id}`):null})]})},WidgetEmbedCode:({entityType:t,entityId:e,authRequirement:n,labels:r})=>{const[i,o]=x.useState(!1),[a,l]=x.useState([]),[s,c]=x.useState("before"),[d,f]=x.useState(!1),[h,p]=x.useState(""),[m,g]=x.useState(""),v=`
|
|
3480
|
+
`},uU={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function dU(t){let{announcements:e=uU,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=cU}=t;const{announce:o,announcement:a}=aU(),l=Bo("DndLiveRegion"),[s,c]=x.useState(!1);if(x.useEffect(()=>{c(!0)},[]),sU(x.useMemo(()=>({onDragStart(f){let{active:h}=f;o(e.onDragStart({active:h}))},onDragMove(f){let{active:h,over:p}=f;e.onDragMove&&o(e.onDragMove({active:h,over:p}))},onDragOver(f){let{active:h,over:p}=f;o(e.onDragOver({active:h,over:p}))},onDragEnd(f){let{active:h,over:p}=f;o(e.onDragEnd({active:h,over:p}))},onDragCancel(f){let{active:h,over:p}=f;o(e.onDragCancel({active:h,over:p}))}}),[o,e])),!s)return null;const d=x.createElement(x.Fragment,null,x.createElement(iU,{id:r,value:i.draggable}),x.createElement(oU,{id:l,announcement:a}));return n?Le.createPortal(d,n):d}var vt;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(vt||(vt={}));function ll(){}function cl(t,e){return x.useMemo(()=>({sensor:t,options:e!=null?e:{}}),[t,e])}function S0(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return x.useMemo(()=>[...e].filter(r=>r!=null),[...e])}const hn=Object.freeze({x:0,y:0});function fU(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function hU(t,e){const n=sl(t);if(!n)return"0 0";const r={x:(n.x-e.left)/e.width*100,y:(n.y-e.top)/e.height*100};return r.x+"% "+r.y+"%"}function pU(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return n-r}function gU(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function A0(t){let{left:e,top:n,height:r,width:i}=t;return[{x:e,y:n},{x:e+i,y:n},{x:e,y:n+r},{x:e+i,y:n+r}]}function _0(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}const mU=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=A0(e),o=[];for(const a of r){const{id:l}=a,s=n.get(l);if(s){const c=A0(s),d=i.reduce((h,p,m)=>h+fU(c[m],p),0),f=Number((d/4).toFixed(4));o.push({id:l,data:{droppableContainer:a,value:f}})}}return o.sort(pU)};function vU(t,e){const n=Math.max(e.top,t.top),r=Math.max(e.left,t.left),i=Math.min(e.left+e.width,t.left+t.width),o=Math.min(e.top+e.height,t.top+t.height),a=i-r,l=o-n;if(r<i&&n<o){const s=e.width*e.height,c=t.width*t.height,d=a*l,f=d/(s+c-d);return Number(f.toFixed(4))}return 0}const bU=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=[];for(const o of r){const{id:a}=o,l=n.get(a);if(l){const s=vU(l,e);s>0&&i.push({id:a,data:{droppableContainer:o,value:s}})}}return i.sort(gU)};function yU(t,e,n){return X(U({},t),{scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1})}function T0(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:hn}function CU(t){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(U({},a),{top:a.top+t*l.y,bottom:a.bottom+t*l.y,left:a.left+t*l.x,right:a.right+t*l.x}),U({},n))}}const xU=CU(1);function E0(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function wU(t,e,n){const r=E0(e);if(!r)return t;const{scaleX:i,scaleY:o,x:a,y:l}=r,s=t.left-a-(1-i)*parseFloat(n),c=t.top-l-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),d=i?t.width/i:t.width,f=o?t.height/o:t.height;return{width:d,height:f,top:c,right:s+d,bottom:c+f,left:s}}const IU={ignoreTransform:!1};function Ti(t,e){e===void 0&&(e=IU);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:d}=Mt(t).getComputedStyle(t);c&&(n=wU(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 k0(t){return Ti(t,{ignoreTransform:!0})}function SU(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function AU(t,e){return e===void 0&&(e=Mt(t).getComputedStyle(t)),e.position==="fixed"}function _U(t,e){e===void 0&&(e=Mt(t).getComputedStyle(t));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=e[i];return typeof o=="string"?n.test(o):!1})}function ul(t,e){const n=[];function r(i){if(e!=null&&n.length>=e||!i)return n;if(kd(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Mo(i)||C0(i)||n.includes(i))return n;const o=Mt(t).getComputedStyle(i);return i!==t&&_U(i,o)&&n.push(i),AU(i,o)?n:r(i.parentNode)}return t?r(t):n}function P0(t){const[e]=ul(t,1);return e!=null?e:null}function Dd(t){return!nl||!t?null:Si(t)?t:Ed(t)?kd(t)||t===Ai(t).scrollingElement?window:Mo(t)?t:null:null}function D0(t){return Si(t)?t.scrollX:t.scrollLeft}function O0(t){return Si(t)?t.scrollY:t.scrollTop}function Od(t){return{x:D0(t),y:O0(t)}}var Ct;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Ct||(Ct={}));function R0(t){return!nl||!t?!1:t===document.scrollingElement}function L0(t){const e={x:0,y:0},n=R0(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height},i=t.scrollTop<=e.y,o=t.scrollLeft<=e.x,a=t.scrollTop>=r.y,l=t.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:a,isRight:l,maxScroll:r,minScroll:e}}const TU={x:.2,y:.2};function EU(t,e,n,r,i){let{top:o,left:a,right:l,bottom:s}=n;r===void 0&&(r=10),i===void 0&&(i=TU);const{isTop:c,isBottom:d,isLeft:f,isRight:h}=L0(t),p={x:0,y:0},m={x:0,y:0},g={height:e.height*i.y,width:e.width*i.x};return!c&&o<=e.top+g.height?(p.y=Ct.Backward,m.y=r*Math.abs((e.top+g.height-o)/g.height)):!d&&s>=e.bottom-g.height&&(p.y=Ct.Forward,m.y=r*Math.abs((e.bottom-g.height-s)/g.height)),!h&&l>=e.right-g.width?(p.x=Ct.Forward,m.x=r*Math.abs((e.right-g.width-l)/g.width)):!f&&a<=e.left+g.width&&(p.x=Ct.Backward,m.x=r*Math.abs((e.left+g.width-a)/g.width)),{direction:p,speed:m}}function kU(t){if(t===document.scrollingElement){const{innerWidth:o,innerHeight:a}=window;return{top:0,left:0,right:o,bottom:a,width:o,height:a}}const{top:e,left:n,right:r,bottom:i}=t.getBoundingClientRect();return{top:e,left:n,right:r,bottom:i,width:t.clientWidth,height:t.clientHeight}}function M0(t){return t.reduce((e,n)=>_i(e,Od(n)),hn)}function PU(t){return t.reduce((e,n)=>e+D0(n),0)}function DU(t){return t.reduce((e,n)=>e+O0(n),0)}function $0(t,e){if(e===void 0&&(e=Ti),!t)return;const{top:n,left:r,bottom:i,right:o}=e(t);P0(t)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const OU=[["x",["left","right"],PU],["y",["top","bottom"],DU]];class Rd{constructor(e,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=ul(n),i=M0(r);this.rect=U({},e),this.width=e.width,this.height=e.height;for(const[o,a,l]of OU)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 jo{constructor(e){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=e}add(e,n,r){var i;(i=this.target)==null||i.addEventListener(e,n,r),this.listeners.push([e,n,r])}}function RU(t){const{EventTarget:e}=Mt(t);return t instanceof e?t:Ai(t)}function Ld(t,e){const n=Math.abs(t.x),r=Math.abs(t.y);return typeof e=="number"?Math.sqrt(Pi(n,2)+Pi(r,2))>e:"x"in e&&"y"in e?n>e.x&&r>e.y:"x"in e?n>e.x:"y"in e?r>e.y:!1}var sn;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(sn||(sn={}));function N0(t){t.preventDefault()}function LU(t){t.stopPropagation()}var Pe;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(Pe||(Pe={}));const B0={start:[Pe.Space,Pe.Enter],cancel:[Pe.Esc],end:[Pe.Space,Pe.Enter,Pe.Tab]},MU=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case Pe.Right:return X(U({},n),{x:n.x+25});case Pe.Left:return X(U({},n),{x:n.x-25});case Pe.Down:return X(U({},n),{y:n.y+25});case Pe.Up:return X(U({},n),{y:n.y-25})}};class dl{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new jo(Ai(n)),this.windowListeners=new jo(Mt(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(sn.Resize,this.handleCancel),this.windowListeners.add(sn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(sn.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&$0(r),n(hn)}handleKeyDown(e){if(al(e)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=B0,coordinateGetter:a=MU,scrollBehavior:l="smooth"}=i,{code:s}=e;if(o.end.includes(s)){this.handleEnd(e);return}if(o.cancel.includes(s)){this.handleCancel(e);return}const{collisionRect:c}=r.current,d=c?{x:c.left,y:c.top}:hn;this.referenceCoordinates||(this.referenceCoordinates=d);const f=a(e,{active:n,context:r.current,currentCoordinates:d});if(f){const h=Fo(f,d),p={x:0,y:0},{scrollableAncestors:m}=r.current;for(const g of m){const v=e.code,{isTop:I,isRight:S,isLeft:y,isBottom:w,maxScroll:b,minScroll:_}=L0(g),E=kU(g),P={x:Math.min(v===Pe.Right?E.right-E.width/2:E.right,Math.max(v===Pe.Right?E.left:E.left+E.width/2,f.x)),y:Math.min(v===Pe.Down?E.bottom-E.height/2:E.bottom,Math.max(v===Pe.Down?E.top:E.top+E.height/2,f.y))},D=v===Pe.Right&&!S||v===Pe.Left&&!y,V=v===Pe.Down&&!w||v===Pe.Up&&!I;if(D&&P.x!==f.x){const j=g.scrollLeft+h.x,T=v===Pe.Right&&j<=b.x||v===Pe.Left&&j>=_.x;if(T&&!h.y){g.scrollTo({left:j,behavior:l});return}T?p.x=g.scrollLeft-j:p.x=v===Pe.Right?g.scrollLeft-b.x:g.scrollLeft-_.x,p.x&&g.scrollBy({left:-p.x,behavior:l});break}else if(V&&P.y!==f.y){const j=g.scrollTop+h.y,T=v===Pe.Down&&j<=b.y||v===Pe.Up&&j>=_.y;if(T&&!h.x){g.scrollTo({top:j,behavior:l});return}T?p.y=g.scrollTop-j:p.y=v===Pe.Down?g.scrollTop-b.y:g.scrollTop-_.y,p.y&&g.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(e,_i(Fo(f,this.referenceCoordinates),p))}}}handleMove(e,n){const{onMove:r}=this.props;e.preventDefault(),r(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}dl.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=B0,onActivation:i}=e,{active:o}=n;const{code:a}=t.nativeEvent;if(r.start.includes(a)){const l=o.activatorNode.current;return l&&t.target!==l?!1:(t.preventDefault(),i==null||i({event:t.nativeEvent}),!0)}return!1}}];function F0(t){return!!(t&&"distance"in t)}function j0(t){return!!(t&&"delay"in t)}class Md{constructor(e,n,r){var i;r===void 0&&(r=RU(e.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=e,this.events=n;const{event:o}=e,{target:a}=o;this.props=e,this.events=n,this.document=Ai(a),this.documentListeners=new jo(this.document),this.listeners=new jo(r),this.windowListeners=new jo(Mt(a)),this.initialCoordinates=(i=sl(o))!=null?i:hn,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:e,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(sn.Resize,this.handleCancel),this.windowListeners.add(sn.DragStart,N0),this.windowListeners.add(sn.VisibilityChange,this.handleCancel),this.windowListeners.add(sn.ContextMenu,N0),this.documentListeners.add(sn.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(j0(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(F0(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(e,n){const{active:r,onPending:i}=this.props;i(r,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(sn.Click,LU,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(sn.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:a,options:{activationConstraint:l}}=o;if(!i)return;const s=(n=sl(e))!=null?n:hn,c=Fo(i,s);if(!r&&l){if(F0(l)){if(l.tolerance!=null&&Ld(c,l.tolerance))return this.handleCancel();if(Ld(c,l.distance))return this.handleStart()}if(j0(l)&&Ld(c,l.tolerance))return this.handleCancel();this.handlePending(l,c);return}e.cancelable&&e.preventDefault(),a(s)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===Pe.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const $U={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class fl extends Md{constructor(e){const{event:n}=e,r=Ai(n.target);super(e,$U,r)}}fl.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const NU={move:{name:"mousemove"},end:{name:"mouseup"}};var $d;(function(t){t[t.RightClick=2]="RightClick"})($d||($d={}));class BU extends Md{constructor(e){super(e,NU,Ai(e.event.target))}}BU.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===$d.RightClick?!1:(r==null||r({event:n}),!0)}}];const Nd={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class FU extends Md{constructor(e){super(e,Nd)}static setup(){return window.addEventListener(Nd.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Nd.move.name,e)};function e(){}}}FU.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var Uo;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(Uo||(Uo={}));var hl;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(hl||(hl={}));function jU(t){let{acceleration:e,activator:n=Uo.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:a=5,order:l=hl.TreeOrder,pointerCoordinates:s,scrollableAncestors:c,scrollableAncestorRects:d,delta:f,threshold:h}=t;const p=zU({delta:f,disabled:!o}),[m,g]=Zj(),v=x.useRef({x:0,y:0}),I=x.useRef({x:0,y:0}),S=x.useMemo(()=>{switch(n){case Uo.Pointer:return s?{top:s.y,bottom:s.y,left:s.x,right:s.x}:null;case Uo.DraggableRect:return i}},[n,i,s]),y=x.useRef(null),w=x.useCallback(()=>{const _=y.current;if(!_)return;const E=v.current.x*I.current.x,P=v.current.y*I.current.y;_.scrollBy(E,P)},[]),b=x.useMemo(()=>l===hl.TreeOrder?[...c].reverse():c,[l,c]);x.useEffect(()=>{if(!o||!c.length||!S){g();return}for(const _ of b){if((r==null?void 0:r(_))===!1)continue;const E=c.indexOf(_),P=d[E];if(!P)continue;const{direction:D,speed:V}=EU(_,P,S,e,h);for(const j of["x","y"])p[j][D[j]]||(V[j]=0,D[j]=0);if(V.x>0||V.y>0){g(),y.current=_,m(w,a),v.current=V,I.current=D;return}}v.current={x:0,y:0},I.current={x:0,y:0},g()},[e,w,r,g,o,a,JSON.stringify(S),JSON.stringify(p),m,c,b,d,JSON.stringify(h)])}const UU={x:{[Ct.Backward]:!1,[Ct.Forward]:!1},y:{[Ct.Backward]:!1,[Ct.Forward]:!1}};function zU(t){let{delta:e,disabled:n}=t;const r=ol(e);return No(i=>{if(n||!r||!i)return UU;const o={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[Ct.Backward]:i.x[Ct.Backward]||o.x===-1,[Ct.Forward]:i.x[Ct.Forward]||o.x===1},y:{[Ct.Backward]:i.y[Ct.Backward]||o.y===-1,[Ct.Forward]:i.y[Ct.Forward]||o.y===1}}},[n,e,r])}function VU(t,e){const n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return No(i=>{var o;return e==null?null:(o=r!=null?r:i)!=null?o:null},[r,e])}function HU(t,e){return x.useMemo(()=>t.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(a=>({eventName:a.eventName,handler:e(a.handler,r)}));return[...n,...o]},[]),[t,e])}var zo;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(zo||(zo={}));var Bd;(function(t){t.Optimized="optimized"})(Bd||(Bd={}));const U0=new Map;function WU(t,e){let{dragging:n,dependencies:r,config:i}=e;const[o,a]=x.useState(null),{frequency:l,measure:s,strategy:c}=i,d=x.useRef(t),f=v(),h=$o(f),p=x.useCallback(function(I){I===void 0&&(I=[]),!h.current&&a(S=>S===null?I:S.concat(I.filter(y=>!S.includes(y))))},[h]),m=x.useRef(null),g=No(I=>{if(f&&!n)return U0;if(!I||I===U0||d.current!==t||o!=null){const S=new Map;for(let y of t){if(!y)continue;if(o&&o.length>0&&!o.includes(y.id)&&y.rect.current){S.set(y.id,y.rect.current);continue}const w=y.node.current,b=w?new Rd(s(w),w):null;y.rect.current=b,b&&S.set(y.id,b)}return S}return I},[t,o,n,f,s]);return x.useEffect(()=>{d.current=t},[t]),x.useEffect(()=>{f||p()},[n,f]),x.useEffect(()=>{o&&o.length>0&&a(null)},[JSON.stringify(o)]),x.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 zo.Always:return!1;case zo.BeforeDragging:return n;default:return!n}}}function Fd(t,e){return No(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function GU(t,e){return Fd(t,e)}function KU(t){let{callback:e,disabled:n}=t;const r=rl(e),i=x.useMemo(()=>{if(n||typeof window=="undefined"||typeof window.MutationObserver=="undefined")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return x.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function pl(t){let{callback:e,disabled:n}=t;const r=rl(e),i=x.useMemo(()=>{if(n||typeof window=="undefined"||typeof window.ResizeObserver=="undefined")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return x.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function YU(t){return new Rd(Ti(t),t)}function z0(t,e,n){e===void 0&&(e=YU);const[r,i]=x.useState(null);function o(){i(s=>{if(!t)return null;if(t.isConnected===!1){var c;return(c=s!=null?s:n)!=null?c:null}const d=e(t);return JSON.stringify(s)===JSON.stringify(d)?s:d})}const a=KU({callback(s){if(t)for(const c of s){const{type:d,target:f}=c;if(d==="childList"&&f instanceof HTMLElement&&f.contains(t)){o();break}}}}),l=pl({callback:o});return fn(()=>{o(),t?(l==null||l.observe(t),a==null||a.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),a==null||a.disconnect())},[t]),r}function qU(t){const e=Fd(t);return T0(t,e)}const V0=[];function JU(t){const e=x.useRef(t),n=No(r=>t?r&&r!==V0&&t&&e.current&&t.parentNode===e.current.parentNode?r:ul(t):V0,[t]);return x.useEffect(()=>{e.current=t},[t]),n}function QU(t){const[e,n]=x.useState(null),r=x.useRef(t),i=x.useCallback(o=>{const a=Dd(o.target);a&&n(l=>l?(l.set(a,Od(a)),new Map(l)):null)},[]);return x.useEffect(()=>{const o=r.current;if(t!==o){a(o);const l=t.map(s=>{const c=Dd(s);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,Od(c)]):null}).filter(s=>s!=null);n(l.length?new Map(l):null),r.current=t}return()=>{a(t),a(o)};function a(l){l.forEach(s=>{const c=Dd(s);c==null||c.removeEventListener("scroll",i)})}},[i,t]),x.useMemo(()=>t.length?e?Array.from(e.values()).reduce((o,a)=>_i(o,a),hn):M0(t):hn,[t,e])}function H0(t,e){e===void 0&&(e=[]);const n=x.useRef(null);return x.useEffect(()=>{n.current=null},e),x.useEffect(()=>{const r=t!==hn;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?Fo(t,n.current):hn}function XU(t){x.useEffect(()=>{if(!nl)return;const e=t.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of e)n==null||n()}},t.map(e=>{let{sensor:n}=e;return n}))}function ZU(t,e){return x.useMemo(()=>t.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=a=>{o(a,e)},n},{}),[t,e])}function W0(t){return x.useMemo(()=>t?SU(t):null,[t])}const G0=[];function ez(t,e){e===void 0&&(e=Ti);const[n]=t,r=W0(n?Mt(n):null),[i,o]=x.useState(G0);function a(){o(()=>t.length?t.map(s=>R0(s)?r:new Rd(e(s),s)):G0)}const l=pl({callback:a});return fn(()=>{l==null||l.disconnect(),a(),t.forEach(s=>l==null?void 0:l.observe(s))},[t]),i}function K0(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return Mo(e)?e:t}function tz(t){let{measure:e}=t;const[n,r]=x.useState(null),i=x.useCallback(c=>{for(const{target:d}of c)if(Mo(d)){r(f=>{const h=e(d);return f?X(U({},f),{width:h.width,height:h.height}):h});break}},[e]),o=pl({callback:i}),a=x.useCallback(c=>{const d=K0(c);o==null||o.disconnect(),d&&(o==null||o.observe(d)),r(d?e(d):null)},[e,o]),[l,s]=il(a);return x.useMemo(()=>({nodeRef:l,rect:n,setRef:s}),[n,l,s])}const nz=[{sensor:fl,options:{}},{sensor:dl,options:{}}],rz={current:{}},gl={draggable:{measure:k0},droppable:{measure:k0,strategy:zo.WhileDragging,frequency:Bd.Optimized},dragOverlay:{measure:Ti}};class Vo extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,r;return(n=(r=this.get(e))==null?void 0:r.node.current)!=null?n:void 0}}const iz={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Vo,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ll},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:gl,measureDroppableContainers:ll,windowRect:null,measuringScheduled:!1},Y0={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ll,draggableNodes:new Map,over:null,measureDroppableContainers:ll},Ho=x.createContext(Y0),q0=x.createContext(iz);function oz(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Vo}}}function az(t,e){switch(e.type){case vt.DragStart:return X(U({},t),{draggable:X(U({},t.draggable),{initialCoordinates:e.initialCoordinates,active:e.active})});case vt.DragMove:return t.draggable.active==null?t:X(U({},t),{draggable:X(U({},t.draggable),{translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}})});case vt.DragEnd:case vt.DragCancel:return X(U({},t),{draggable:X(U({},t.draggable),{active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}})});case vt.RegisterDroppable:{const{element:n}=e,{id:r}=n,i=new Vo(t.droppable.containers);return i.set(r,n),X(U({},t),{droppable:X(U({},t.droppable),{containers:i})})}case vt.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=e,o=t.droppable.containers.get(n);if(!o||r!==o.key)return t;const a=new Vo(t.droppable.containers);return a.set(n,X(U({},o),{disabled:i})),X(U({},t),{droppable:X(U({},t.droppable),{containers:a})})}case vt.UnregisterDroppable:{const{id:n,key:r}=e,i=t.droppable.containers.get(n);if(!i||r!==i.key)return t;const o=new Vo(t.droppable.containers);return o.delete(n),X(U({},t),{droppable:X(U({},t.droppable),{containers:o})})}default:return t}}function sz(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:i}=x.useContext(Ho),o=ol(r),a=ol(n==null?void 0:n.id);return x.useEffect(()=>{if(!e&&!r&&o&&a!=null){if(!al(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=nU(d);if(f){f.focus();break}}})}},[r,e,i,a,o]),null}function J0(t,e){let i=e,{transform:n}=i,r=Ye(i,["transform"]);return t!=null&&t.length?t.reduce((o,a)=>a(U({transform:o},r)),n):n}function lz(t){return x.useMemo(()=>({draggable:U(U({},gl.draggable),t==null?void 0:t.draggable),droppable:U(U({},gl.droppable),t==null?void 0:t.droppable),dragOverlay:U(U({},gl.dragOverlay),t==null?void 0:t.dragOverlay)}),[t==null?void 0:t.draggable,t==null?void 0:t.droppable,t==null?void 0:t.dragOverlay])}function cz(t){let{activeNode:e,measure:n,initialRect:r,config:i=!0}=t;const o=x.useRef(!1),{x:a,y:l}=typeof i=="boolean"?{x:i,y:i}:i;fn(()=>{if(!a&&!l||!e){o.current=!1;return}if(o.current||!r)return;const c=e==null?void 0:e.node.current;if(!c||c.isConnected===!1)return;const d=n(c),f=T0(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=P0(c);h&&h.scrollBy({top:f.y,left:f.x})}},[e,a,l,r,n])}const ml=x.createContext(X(U({},hn),{scaleX:1,scaleY:1}));var gr;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(gr||(gr={}));const Q0=x.memo(function(e){var n,r,i,o;let Il=e,{id:a,accessibility:l,autoScroll:s=!0,children:c,sensors:d=nz,collisionDetection:f=bU,measuring:h,modifiers:p}=Il,m=Ye(Il,["id","accessibility","autoScroll","children","sensors","collisionDetection","measuring","modifiers"]);const g=x.useReducer(az,void 0,oz),[v,I]=g,[S,y]=lU(),[w,b]=x.useState(gr.Uninitialized),_=w===gr.Initialized,{draggable:{active:E,nodes:P,translate:D},droppable:{containers:V}}=v,j=E!=null?P.get(E):null,T=x.useRef({initial:null,translated:null}),G=x.useMemo(()=>{var xt;return E!=null?{id:E,data:(xt=j==null?void 0:j.data)!=null?xt:rz,rect:T}:null},[E,j]),K=x.useRef(null),[B,N]=x.useState(null),[$,W]=x.useState(null),q=$o(m,Object.values(m)),ee=Bo("DndDescribedBy",a),R=x.useMemo(()=>V.getEnabled(),[V]),M=lz(h),{droppableRects:F,measureDroppableContainers:H,measuringScheduled:te}=WU(R,{dragging:_,dependencies:[D.x,D.y],config:M.droppable}),se=VU(P,E),ae=x.useMemo(()=>$?sl($):null,[$]),Q=pn(),le=GU(se,M.draggable.measure);cz({activeNode:E!=null?P.get(E):null,config:Q.layoutShiftCompensation,initialRect:le,measure:M.draggable.measure});const ne=z0(se,M.draggable.measure,le),ge=z0(se?se.parentElement:null),Ae=x.useRef({activatorEvent:null,active:null,activeNode:se,collisionRect:null,collisions:null,droppableRects:F,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:V,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ge=V.getNodeFor((n=Ae.current.over)==null?void 0:n.id),St=tz({measure:M.dragOverlay.measure}),lt=(r=St.nodeRef.current)!=null?r:se,Dt=_?(i=St.rect)!=null?i:ne:null,de=!!(St.nodeRef.current&&St.rect),he=qU(de?null:ne),Ce=W0(lt?Mt(lt):null),Ee=JU(_?Ge!=null?Ge:se:null),Ke=ez(Ee),De=J0(p,{transform:{x:D.x-he.x,y:D.y-he.y,scaleX:1,scaleY:1},activatorEvent:$,active:G,activeNodeRect:ne,containerNodeRect:ge,draggingNodeRect:Dt,over:Ae.current.over,overlayNodeRect:St.rect,scrollableAncestors:Ee,scrollableAncestorRects:Ke,windowRect:Ce}),ke=ae?_i(ae,D):null,At=QU(Ee),_t=H0(At),zt=H0(At,[ne]),$t=_i(De,_t),Jt=Dt?xU(Dt,De):null,mr=G&&Jt?f({active:G,collisionRect:Jt,droppableRects:F,droppableContainers:R,pointerCoordinates:ke}):null,xl=_0(mr,"id"),[_n,Wo]=x.useState(null),jd=de?De:_i(De,zt),Ud=yU(jd,(o=_n==null?void 0:_n.rect)!=null?o:null,ne),Ve=x.useRef(null),Ei=x.useCallback((xt,k)=>{let{sensor:L,options:Y}=k;if(K.current==null)return;const J=P.get(K.current);if(!J)return;const re=xt.nativeEvent,ce=new L({active:K.current,activeNode:J,event:re,options:Y,context:Ae,onAbort(ue){if(!P.get(ue))return;const{onDragAbort:fe}=q.current,me={id:ue};fe==null||fe(me),S({type:"onDragAbort",event:me})},onPending(ue,we,fe,me){if(!P.get(ue))return;const{onDragPending:Ot}=q.current,it={id:ue,constraint:we,initialCoordinates:fe,offset:me};Ot==null||Ot(it),S({type:"onDragPending",event:it})},onStart(ue){const we=K.current;if(we==null)return;const fe=P.get(we);if(!fe)return;const{onDragStart:me}=q.current,Oe={activatorEvent:re,active:{id:we,data:fe.data,rect:T}};Le.unstable_batchedUpdates(()=>{me==null||me(Oe),b(gr.Initializing),I({type:vt.DragStart,initialCoordinates:ue,active:we}),S({type:"onDragStart",event:Oe}),N(Ve.current),W(re)})},onMove(ue){I({type:vt.DragMove,coordinates:ue})},onEnd:xe(vt.DragEnd),onCancel:xe(vt.DragCancel)});Ve.current=ce;function xe(ue){return function(){return A(this,null,function*(){const{active:fe,collisions:me,over:Oe,scrollAdjustedTranslate:Ot}=Ae.current;let it=null;if(fe&&Ot){const{cancelDrop:gn}=q.current;it={activatorEvent:re,active:fe,collisions:me,delta:Ot,over:Oe},ue===vt.DragEnd&&typeof gn=="function"&&(yield Promise.resolve(gn(it)))&&(ue=vt.DragCancel)}K.current=null,Le.unstable_batchedUpdates(()=>{I({type:ue}),b(gr.Uninitialized),Wo(null),N(null),W(null),Ve.current=null;const gn=ue===vt.DragEnd?"onDragEnd":"onDragCancel";if(it){const Tn=q.current[gn];Tn==null||Tn(it),S({type:gn,event:it})}})})}}},[P]),Go=x.useCallback((xt,k)=>(L,Y)=>{const J=L.nativeEvent,re=P.get(Y);if(K.current!==null||!re||J.dndKit||J.defaultPrevented)return;const ce={active:re};xt(L,k.options,ce)===!0&&(J.dndKit={capturedBy:k.sensor},K.current=Y,Ei(L,k))},[P,Ei]),wl=HU(d,Go);XU(d),fn(()=>{ne&&w===gr.Initializing&&b(gr.Initialized)},[ne,w]),x.useEffect(()=>{const{onDragMove:xt}=q.current,{active:k,activatorEvent:L,collisions:Y,over:J}=Ae.current;if(!k||!L)return;const re={active:k,activatorEvent:L,collisions:Y,delta:{x:$t.x,y:$t.y},over:J};Le.unstable_batchedUpdates(()=>{xt==null||xt(re),S({type:"onDragMove",event:re})})},[$t.x,$t.y]),x.useEffect(()=>{const{active:xt,activatorEvent:k,collisions:L,droppableContainers:Y,scrollAdjustedTranslate:J}=Ae.current;if(!xt||K.current==null||!k||!J)return;const{onDragOver:re}=q.current,ce=Y.get(xl),xe=ce&&ce.rect.current?{id:ce.id,rect:ce.rect.current,data:ce.data,disabled:ce.disabled}:null,ue={active:xt,activatorEvent:k,collisions:L,delta:{x:J.x,y:J.y},over:xe};Le.unstable_batchedUpdates(()=>{Wo(xe),re==null||re(ue),S({type:"onDragOver",event:ue})})},[xl]),fn(()=>{Ae.current={activatorEvent:$,active:G,activeNode:se,collisionRect:Jt,collisions:mr,droppableRects:F,draggableNodes:P,draggingNode:lt,draggingNodeRect:Dt,droppableContainers:V,over:_n,scrollableAncestors:Ee,scrollAdjustedTranslate:$t},T.current={initial:Dt,translated:Jt}},[G,se,mr,Jt,P,lt,Dt,F,V,_n,Ee,$t]),jU(X(U({},Q),{delta:D,draggingRect:Jt,pointerCoordinates:ke,scrollableAncestors:Ee,scrollableAncestorRects:Ke}));const ki=x.useMemo(()=>({active:G,activeNode:se,activeNodeRect:ne,activatorEvent:$,collisions:mr,containerNodeRect:ge,dragOverlay:St,draggableNodes:P,droppableContainers:V,droppableRects:F,over:_n,measureDroppableContainers:H,scrollableAncestors:Ee,scrollableAncestorRects:Ke,measuringConfiguration:M,measuringScheduled:te,windowRect:Ce}),[G,se,ne,$,mr,ge,St,P,V,F,_n,H,Ee,Ke,M,te,Ce]),Ko=x.useMemo(()=>({activatorEvent:$,activators:wl,active:G,activeNodeRect:ne,ariaDescribedById:{draggable:ee},dispatch:I,draggableNodes:P,over:_n,measureDroppableContainers:H}),[$,wl,G,ne,I,ee,P,_n,H]);return x.createElement(I0.Provider,{value:y},x.createElement(Ho.Provider,{value:Ko},x.createElement(q0.Provider,{value:ki},x.createElement(ml.Provider,{value:Ud},c)),x.createElement(sz,{disabled:(l==null?void 0:l.restoreFocus)===!1})),x.createElement(dU,X(U({},l),{hiddenTextDescribedById:ee})));function pn(){const xt=(B==null?void 0:B.autoScrollEnabled)===!1,k=typeof s=="object"?s.enabled===!1:s===!1,L=_&&!xt&&!k;return typeof s=="object"?X(U({},s),{enabled:L}):{enabled:L}}}),uz=x.createContext(null),X0="button",dz="Draggable";function fz(t){let{id:e,data:n,disabled:r=!1,attributes:i}=t;const o=Bo(dz),{activators:a,activatorEvent:l,active:s,activeNodeRect:c,ariaDescribedById:d,draggableNodes:f,over:h}=x.useContext(Ho),{role:p=X0,roleDescription:m="draggable",tabIndex:g=0}=i!=null?i:{},v=(s==null?void 0:s.id)===e,I=x.useContext(v?ml:uz),[S,y]=il(),[w,b]=il(),_=ZU(a,e),E=$o(n);fn(()=>(f.set(e,{id:e,key:o,node:S,activatorNode:w,data:E}),()=>{const D=f.get(e);D&&D.key===o&&f.delete(e)}),[f,e]);const P=x.useMemo(()=>({role:p,tabIndex:g,"aria-disabled":r,"aria-pressed":v&&p===X0?!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:_,node:S,over:h,setNodeRef:y,setActivatorNodeRef:b,transform:I}}function Z0(){return x.useContext(q0)}const hz="Droppable",pz={timeout:25};function gz(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:i}=t;const o=Bo(hz),{active:a,dispatch:l,over:s,measureDroppableContainers:c}=x.useContext(Ho),d=x.useRef({disabled:n}),f=x.useRef(!1),h=x.useRef(null),p=x.useRef(null),{disabled:m,updateMeasurementsFor:g,timeout:v}=U(U({},pz),i),I=$o(g!=null?g:r),S=x.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{c(Array.isArray(I.current)?I.current:[I.current]),p.current=null},v)},[v]),y=pl({callback:S,disabled:m||!a}),w=x.useCallback((P,D)=>{y&&(D&&(y.unobserve(D),f.current=!1),P&&y.observe(P))},[y]),[b,_]=il(w),E=$o(e);return x.useEffect(()=>{!y||!b.current||(y.disconnect(),f.current=!1,y.observe(b.current))},[b,y]),x.useEffect(()=>(l({type:vt.RegisterDroppable,element:{id:r,key:o,disabled:n,node:b,rect:h,data:E}}),()=>l({type:vt.UnregisterDroppable,key:o,id:r})),[r]),x.useEffect(()=>{n!==d.current.disabled&&(l({type:vt.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:_}}function mz(t){let{animation:e,children:n}=t;const[r,i]=x.useState(null),[o,a]=x.useState(null),l=ol(n);return!n&&!r&&l&&i(l),fn(()=>{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(e(c,o)).then(()=>{i(null)})},[e,r,o]),x.createElement(x.Fragment,null,n,r?x.cloneElement(r,{ref:a}):null)}const vz={x:0,y:0,scaleX:1,scaleY:1};function bz(t){let{children:e}=t;return x.createElement(Ho.Provider,{value:Y0},x.createElement(ml.Provider,{value:vz},e))}const yz={position:"fixed",touchAction:"none"},Cz=t=>al(t)?"transform 250ms ease":void 0,xz=x.forwardRef((t,e)=>{let{as:n,activatorEvent:r,adjustScale:i,children:o,className:a,rect:l,style:s,transform:c,transition:d=Cz}=t;if(!l)return null;const f=i?c:X(U({},c),{scaleX:1,scaleY:1}),h=U(X(U({},yz),{width:l.width,height:l.height,top:l.top,left:l.left,transform:Qn.Transform.toString(f),transformOrigin:i&&r?hU(r,l):void 0,transition:typeof d=="function"?d(r):d}),s);return x.createElement(n,{className:a,style:h,ref:e},o)}),ey=t=>e=>{let{active:n,dragOverlay:r}=e;const i={},{styles:o,className:a}=t;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)}},wz={duration:250,easing:"ease",keyframes:t=>{let{transform:{initial:e,final:n}}=t;return[{transform:Qn.Transform.toString(e)},{transform:Qn.Transform.toString(n)}]},sideEffects:ey({styles:{active:{opacity:"0"}}})};function Iz(t){let{config:e,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=t;return rl((o,a)=>{if(e===null)return;const l=n.get(o);if(!l)return;const s=l.node.current;if(!s)return;const c=K0(a);if(!c)return;const{transform:d}=Mt(a).getComputedStyle(a),f=E0(d);if(!f)return;const h=typeof e=="function"?e:Sz(e);return $0(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 Sz(t){const{duration:e,easing:n,sideEffects:r,keyframes:i}=U(U({},wz),t);return o=>{let S=o,{active:a,dragOverlay:l,transform:s}=S,c=Ye(S,["active","dragOverlay","transform"]);if(!e)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=U({x:s.x-d.x,y:s.y-d.y},f),p=i(X(U({},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(U({active:a,dragOverlay:l},c)),I=l.node.animate(p,{duration:e,easing:n,fill:"forwards"});return new Promise(y=>{I.onfinish=()=>{v==null||v(),y()}})}}let ty=0;function Az(t){return x.useMemo(()=>{if(t!=null)return ty++,ty},[t])}const _z=x.memo(t=>{let{adjustScale:e=!1,children:n,dropAnimation:r,style:i,transition:o,modifiers:a,wrapperElement:l="div",className:s,zIndex:c=999}=t;const{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:p,draggableNodes:m,droppableContainers:g,dragOverlay:v,over:I,measuringConfiguration:S,scrollableAncestors:y,scrollableAncestorRects:w,windowRect:b}=Z0(),_=x.useContext(ml),E=Az(f==null?void 0:f.id),P=J0(a,{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:p,draggingNodeRect:v.rect,over:I,overlayNodeRect:v.rect,scrollableAncestors:y,scrollableAncestorRects:w,transform:_,windowRect:b}),D=Fd(h),V=Iz({config:r,draggableNodes:m,droppableContainers:g,measuringConfiguration:S}),j=D?v.setRef:void 0;return x.createElement(bz,null,x.createElement(mz,{animation:V},f&&E?x.createElement(xz,{key:E,id:f.id,ref:j,as:l,activatorEvent:d,adjustScale:e,className:s,transition:o,rect:D,style:U({zIndex:c},i),transform:P},n):null))});function vl(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function Tz(t,e){return t.reduce((n,r,i)=>{const o=e.get(r);return o&&(n[i]=o),n},Array(t.length))}function bl(t){return t!==null&&t>=0}function Ez(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function kz(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const ny=t=>{let{rects:e,activeIndex:n,overIndex:r,index:i}=t;const o=vl(e,r,n),a=e[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}},ry="Sortable",iy=x.createContext({activeIndex:-1,containerId:ry,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:ny,disabled:{draggable:!1,droppable:!1}});function oy(t){let{children:e,id:n,items:r,strategy:i=ny,disabled:o=!1}=t;const{active:a,dragOverlay:l,droppableRects:s,over:c,measureDroppableContainers:d}=Z0(),f=Bo(ry,n),h=l.rect!==null,p=x.useMemo(()=>r.map(_=>typeof _=="object"&&"id"in _?_.id:_),[r]),m=a!=null,g=a?p.indexOf(a.id):-1,v=c?p.indexOf(c.id):-1,I=x.useRef(p),S=!Ez(p,I.current),y=v!==-1&&g===-1||S,w=kz(o);fn(()=>{S&&m&&d(p)},[S,p,m,d]),x.useEffect(()=>{I.current=p},[p]);const b=x.useMemo(()=>({activeIndex:g,containerId:f,disabled:w,disableTransforms:y,items:p,overIndex:v,useDragOverlay:h,sortedRects:Tz(p,s),strategy:i}),[g,f,w.draggable,w.droppable,y,p,v,s,h,i]);return x.createElement(iy.Provider,{value:b},e)}const Pz=t=>{let{id:e,items:n,activeIndex:r,overIndex:i}=t;return vl(n,r,i).indexOf(e)},Dz=t=>{let{containerId:e,isSorting:n,wasDragging:r,index:i,items:o,newIndex:a,previousItems:l,previousContainerId:s,transition:c}=t;return!c||!r||l!==o&&i===a?!1:n?!0:a!==i&&e===s},Oz={duration:200,easing:"ease"},ay="transform",Rz=Qn.Transition.toString({property:ay,duration:0,easing:"linear"}),Lz={roleDescription:"sortable"};function Mz(t){let{disabled:e,index:n,node:r,rect:i}=t;const[o,a]=x.useState(null),l=x.useRef(n);return fn(()=>{if(!e&&n!==l.current&&r.current){const s=i.current;if(s){const c=Ti(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)},[e,n,r,i]),x.useEffect(()=>{o&&a(null)},[o]),o}function sy(t){let{animateLayoutChanges:e=Dz,attributes:n,disabled:r,data:i,getNewIndex:o=Pz,id:a,strategy:l,resizeObserverConfig:s,transition:c=Oz}=t;const{items:d,containerId:f,activeIndex:h,disabled:p,disableTransforms:m,sortedRects:g,overIndex:v,useDragOverlay:I,strategy:S}=x.useContext(iy),y=$z(r,p),w=d.indexOf(a),b=x.useMemo(()=>U({sortable:{containerId:f,index:w,items:d}},i),[f,i,w,d]),_=x.useMemo(()=>d.slice(d.indexOf(a)),[d,a]),{rect:E,node:P,isOver:D,setNodeRef:V}=gz({id:a,data:b,disabled:y.droppable,resizeObserverConfig:U({updateMeasurementsFor:_},s)}),{active:j,activatorEvent:T,activeNodeRect:G,attributes:K,setNodeRef:B,listeners:N,isDragging:$,over:W,setActivatorNodeRef:q,transform:ee}=fz({id:a,data:b,attributes:U(U({},Lz),n),disabled:y.draggable}),R=Xj(V,B),M=!!j,F=M&&!m&&bl(h)&&bl(v),H=!I&&$,te=H&&F?ee:null,se=l!=null?l:S,ae=F?te!=null?te:se({rects:g,activeNodeRect:G,activeIndex:h,overIndex:v,index:w}):null,Q=bl(h)&&bl(v)?o({id:a,items:d,activeIndex:h,overIndex:v}):w,le=j==null?void 0:j.id,ne=x.useRef({activeId:le,items:d,newIndex:Q,containerId:f}),ge=d!==ne.current.items,Ae=e({active:j,containerId:f,isDragging:$,isSorting:M,id:a,index:w,items:d,newIndex:ne.current.newIndex,previousItems:ne.current.items,previousContainerId:ne.current.containerId,transition:c,wasDragging:ne.current.activeId!=null}),Ge=Mz({disabled:!Ae,index:w,node:P,rect:E});return x.useEffect(()=>{M&&ne.current.newIndex!==Q&&(ne.current.newIndex=Q),f!==ne.current.containerId&&(ne.current.containerId=f),d!==ne.current.items&&(ne.current.items=d)},[M,Q,f,d]),x.useEffect(()=>{if(le===ne.current.activeId)return;if(le!=null&&ne.current.activeId==null){ne.current.activeId=le;return}const lt=setTimeout(()=>{ne.current.activeId=le},50);return()=>clearTimeout(lt)},[le]),{active:j,activeIndex:h,attributes:K,data:b,rect:E,index:w,newIndex:Q,items:d,isOver:D,isSorting:M,isDragging:$,listeners:N,node:P,overIndex:v,over:W,setNodeRef:R,setActivatorNodeRef:q,setDroppableNodeRef:V,setDraggableNodeRef:B,transform:Ge!=null?Ge:ae,transition:St()};function St(){if(Ge||ge&&ne.current.newIndex===w)return Rz;if(!(H&&!al(T)||!c)&&(M||Ae))return Qn.Transition.toString(X(U({},c),{property:ay}))}}function $z(t,e){var n,r;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(n=t==null?void 0:t.draggable)!=null?n:e.draggable,droppable:(r=t==null?void 0:t.droppable)!=null?r:e.droppable}}function yl(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const Nz=[Pe.Down,Pe.Right,Pe.Up,Pe.Left],ly=(t,e)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:o,over:a,scrollableAncestors:l}}=e;if(Nz.includes(t.code)){if(t.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(t.code){case Pe.Down:r.top<h.top&&s.push(f);break;case Pe.Up:r.top>h.top&&s.push(f);break;case Pe.Left:r.left>h.left&&s.push(f);break;case Pe.Right:r.left<h.left&&s.push(f);break}});const c=mU({active:n,collisionRect:r,droppableRects:i,droppableContainers:s,pointerCoordinates:null});let d=_0(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=ul(m).some((_,E)=>l[E]!==_),I=cy(f,h),S=Bz(f,h),y=v||!I?{x:0,y:0}:{x:S?r.width-p.width:0,y:S?r.height-p.height:0},w={x:p.left,y:p.top};return y.x&&y.y?w:Fo(w,y)}}}};function cy(t,e){return!yl(t)||!yl(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function Bz(t,e){return!yl(t)||!yl(e)||!cy(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}const uy=We(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"),Cl=x.createContext({attributes:{},listeners:void 0,ref(){}}),Fz=()=>{const{attributes:t,listeners:e,ref:n}=x.useContext(Cl);return u.jsx(C.Button,X(U(U({sx:{backgroundColor:"transparent",color:"#919eab",width:"10px",":hover":{backgroundColor:"transparent"},":active":{backgroundColor:"transparent"}}},t),e),{ref:n,children:u.jsx(uy,{})}))},dy=({children:t,id:e,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}=sy({id:e}),p=x.useMemo(()=>({attributes:a,listeners:s,ref:d}),[a,s,d]),m={opacity:l?.6:void 0,transform:Qn.Translate.toString(f),transition:h};return u.jsx(Cl.Provider,{value:p,children:u.jsx(C.ListItem,{variant:o,ref:c,style:m,startAction:i?u.jsx(Fz,{}):u.jsx(u.Fragment,{}),endAction:i?u.jsx(C.Tooltip,{title:n,children:u.jsx(C.Button,{variant:"outlined",color:"danger",onClick:r,sx:{ml:"auto",p:.5},size:"sm",children:u.jsx(Me.Remove,{})})}):u.jsx(u.Fragment,{}),sx:{p:2,borderRadius:"sm"},children:t})})},jz={sideEffects:ey({styles:{active:{opacity:"0.6"}}})},fy=({children:t})=>u.jsx(_z,{dropAnimation:jz,children:t}),Uz=({entities:t=[],labels:e,disabled:n,setEntities:r,removeItem:i})=>{const[o,a]=x.useState(null),l=x.useMemo(()=>t.find(c=>c.id===(o==null?void 0:o.id)),[o,t]),s=S0(cl(fl),cl(dl,{coordinateGetter:ly}));return u.jsxs(Q0,{sensors:s,onDragStart:({active:c})=>{a(c)},onDragEnd:({active:c,over:d})=>{if(d&&c.id!==(d==null?void 0:d.id)){const f=t.findIndex(({id:p})=>p===c.id),h=t.findIndex(({id:p})=>p===d.id);r(vl(t,f,h))}a(null)},onDragCancel:()=>{a(null)},children:[u.jsx(oy,{items:t,children:u.jsx(C.List,{sx:{gap:"10px",padding:0},children:t.map(c=>u.jsxs(dy,{id:c.id,variant:"outlined",removeItem:()=>i(c.id),tooltipTitle:e.removeEntity,useDraggable:!n,children:[u.jsx(C.Typography,{ml:n?0:2.5,children:c.title||c.name}),c.type&&u.jsx(C.Chip,{color:ij(c.type),sx:{marginLeft:2,marginRight:4},children:oj(c.type)})]},`sortable-item-${c.id}`))})}),u.jsx(fy,{children:l?u.jsx(u.Fragment,{children:t.map(c=>u.jsx(dy,{id:c.id,useDraggable:!1,removeItem:()=>{},tooltipTitle:e.removeEntity},`sortable-overlay-item-${c.id}`))}):u.jsx(u.Fragment,{})})]})},zz=t=>u.jsxs(C.FormControl,{size:"sm",children:[u.jsx(C.FormLabel,{children:t.labels.itemsPerPage}),u.jsx(C.Select,{value:t.value,size:"sm",onChange:t.onChange,sx:{minHeight:"37px"},children:t.options.map((e,n)=>u.jsx(C.Option,{value:e,children:e},`items-per-page-${e}-${n}`))})]}),Vz=(t,e)=>{const[n,r]=x.useState(null),{sdk:i}=gt(),o=()=>A(this,null,function*(){let l=[];if(!t){r(l);return}try{switch(t){case"top_x":l=(yield i.topX.getGames({limit:50},!0)).data.map(v=>({id:v.id,name:v.title,status:v.status,type:t,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:t,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:t,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:t,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:t,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:t,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:t,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:t,relationship:"relatedTo"}));break}}catch(s){console.error(s),r(l),e();return}r(l)});return x.useEffect(()=>(o(),()=>r(null)),[t]),n},Hz=({status:t})=>{let e="neutral";switch(t){case"DYNAMIC":e="primary";break;case"CUSTOM":e="success";break;case"OPEN":e="primary";break;case"LIVE":e="primary";break;case"CANCELED":e="warning";break;case"SETTLED":e="success";break;case"INACTIVE":e="danger";break;case"ACTIVE":e="success";break;case"EXPIRED":e="neutral";break}return u.jsx(C.Chip,{color:e,variant:"solid",size:"sm",children:t})},Wz=We(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"),Gz=We(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"),Kz=We(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"),Yz=We(u.jsx("path",{d:"M9.01 14H2v2h7.01v3L13 15l-3.99-4zm5.98-1v-3H22V8h-7.01V5L11 9z"}),"CompareArrows"),qz=We(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"),Jz=t=>{switch(t.entityType){case"top_x":return u.jsx(C.Tooltip,{title:"Top X",children:u.jsx(Wz,{})});case"match_quiz":return u.jsx(C.Tooltip,{title:"Match Quiz",children:u.jsx(Gz,{})});case"template":return u.jsx(C.Tooltip,{title:"Leaderboard Templates",children:u.jsx(Me.EmojiEvents,{})});case"classic_quiz":return u.jsx(C.Tooltip,{title:"Classic Quiz",children:u.jsx(Kz,{})});case"either_or":return u.jsx(C.Tooltip,{title:"Either/Or",children:u.jsx(Yz,{})});case"poll":return u.jsx(C.Tooltip,{title:"Poll",children:u.jsx(qz,{})});case"bracket":return u.jsx(C.Tooltip,{title:"Custom Bracket Game",children:u.jsx(Me.EmojiEvents,{})});case"standing":return u.jsx(C.Tooltip,{title:"Custom Standings Game",children:u.jsx(Me.EmojiEvents,{})});default:return null}},Qz=({entity:t,deleteLabel:e,onDelete:n})=>u.jsx(u.Fragment,{children:u.jsx(C.Card,{sx:{p:2,mb:2},children:u.jsx(C.CardContent,{children:u.jsxs(C.Box,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},alignItems:"center",justifyContent:"space-between"},children:[u.jsx(C.Typography,{fontSize:"sm",startDecorator:u.jsx(Jz,{entityType:t.type}),children:t.name}),u.jsx(C.Box,{display:{xs:"none",md:"block"},children:u.jsx(Hz,{status:t.status})}),u.jsx(C.Box,{children:u.jsx(C.Tooltip,{title:e,children:u.jsx(C.IconButton,{onClick:()=>n(t.id,t.relationship),color:"danger",size:"sm",children:u.jsx(Me.Delete,{})})})})]})})})}),Xz=(t,e,n,r)=>A(this,null,function*(){let o=[];const a=new Map;e.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(([D])=>D),d=yield t.topX.getGames({limit:c.length,gameIds:c},!0);o=[...o,...d.data.map(D=>{var j;const V=((j=s.find(([T])=>T===D.id))==null?void 0:j[1])||"relatedTo";return{id:D.id,name:D.title,status:D.status,type:l,relationship:V}})];break;case"match_quiz":const f=s.map(([D])=>D),h=yield t.matchQuiz.getGames({limit:f.length,gameIds:f},!0);o=[...o,...h.data.map(D=>{var j;const V=((j=s.find(([T])=>T===D.id))==null?void 0:j[1])||"relatedTo";return{id:D.id,name:D.title,status:D.status,type:l,relationship:V}})];break;case"template":const p=s.map(([D])=>D),m=yield t.loyalty.getTemplates(void 0,!0);o=[...o,...m.data.filter(D=>p.includes(D.id)).map(D=>{var j;const V=((j=s.find(([T])=>T===D.id))==null?void 0:j[1])||"relatedTo";return{id:D.id,name:D.title,status:D.status,type:l,relationship:V}})];break;case"classic_quiz":const g=s.map(([D])=>D),v=yield t.miniGames.getClassicQuizzes({limit:g.length,classicQuizIds:g},!1,!0);o=[...o,...v.data.map(D=>{var j;const V=((j=s.find(([T])=>T===D.id))==null?void 0:j[1])||"relatedTo";return{id:D.id,name:D.title,status:D.status,type:l,relationship:V}})];break;case"either_or":const I=s.map(([D])=>D),S=yield t.miniGames.getEitherOrs({limit:I.length,eitherOrIds:I},!1,!0);o=[...o,...S.data.map(D=>{var j;const V=((j=s.find(([T])=>T===D.id))==null?void 0:j[1])||"relatedTo";return{id:D.id,name:D.title,status:D.status,type:l,relationship:V}})];break;case"poll":const y=s.map(([D])=>D),w=yield t.voting.getPolls({limit:y.length,pollIds:y},!0);o=[...o,...w.data.map(D=>{var j;const V=((j=s.find(([T])=>T===D.id))==null?void 0:j[1])||"relatedTo";return{id:D.id,name:D.title,status:D.status,type:l,relationship:V}})];break;case"bracket":const b=s.map(([D])=>D),_=yield t.bracketGame.getGames({limit:b.length,gameIds:b},!0);o=[...o,..._.data.map(D=>{var j;const V=((j=s.find(([T])=>T===D.id))==null?void 0:j[1])||"relatedTo";return{id:D.id,name:D.title,status:D.status,type:l,relationship:V}})];break;case"standing":const E=s.map(([D])=>D),P=yield t.standingGame.getGames({limit:E.length,gameIds:E},!0);o=[...o,...P.data.map(D=>{var j;const V=((j=s.find(([T])=>T===D.id))==null?void 0:j[1])||"relatedTo";return{id:D.id,name:D.title,status:D.status,type:l,relationship:V}})];break;default:}}catch(l){console.error("Error loading related entities",l),n(o),r()}n(o)}),Zz=["top_x","match_quiz","template","classic_quiz","poll","either_or","bracket","standing"],e5=["relatedTo","blocks","blockedBy","bonusPointsGame","nextInSeries","previousInSeries"],t5=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"),hy=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"),n5=({defaultValue:t=[],onChange:e,labels:n})=>{const[r,i]=x.useState([]),[o,a]=x.useState(""),[l,s]=x.useState(null),[c,d]=x.useState("relatedTo"),[f,h]=x.useState(!1),p=()=>h(!f),m=Vz(l,p),{sdk:g}=gt();x.useEffect(()=>(t.length>0&&Xz(g,t,i,p),()=>{i([]),a(""),s(null),d("relatedTo")}),[]);const v=()=>{if(t.some(E=>E.entity_id===o&&E.entity_relationship===c)){a("");return}const b=[...t,{entity_id:o,entity_type:l,entity_relationship:c}],_=(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,..._]),e(b),a("")},I=(w,b)=>{const _=t.filter(P=>!(P.entity_id===w&&P.entity_relationship===b)),E=r.filter(P=>!(P.id===w&&P.relationship===b));i(E),e(_)},S=r.reduce((w,b)=>{const _=b.relationship;return w[_]||(w[_]=[]),w[_].push(b),w},{}),y=Object.keys(S).sort();return u.jsxs(u.Fragment,{children:[y.map(w=>u.jsxs(C.Box,{sx:{mb:2},children:[u.jsx(C.Typography,{level:"title-md",sx:{fontWeight:"bold",mb:1},children:u.jsx(C.Chip,{variant:"outlined",size:"md",sx:{bgcolor:"background.surface"},children:hy.get(w)||"Unknown relationship"})}),S[w].map((b,_)=>u.jsx(Qz,{entity:b,deleteLabel:n.delete,onDelete:I},`related-entity-relationship-${b.id}-${_}`))]},`relationship-group-${w}`)),u.jsxs(C.Box,{sx:{display:"flex",flexDirection:"column",width:"100%",gap:1},children:[u.jsxs(C.FormControl,{children:[u.jsx(C.FormLabel,{required:!0,color:"primary",children:n.type}),u.jsx(C.Select,{value:l,size:"sm",name:"entity_type",onChange:(w,b)=>s(b),sx:{minHeight:"37px"},children:Zz.map(w=>u.jsx(C.Option,{value:w,children:t5.get(w)},`entity-type-option-${w}`))})]}),u.jsxs(C.FormControl,{children:[u.jsx(C.FormLabel,{required:!0,color:"primary",children:n.relationship}),u.jsx(C.Select,{value:c,size:"sm",name:"entity_relationship",onChange:(w,b)=>d(b),sx:{minHeight:"37px"},children:e5.map(w=>u.jsx(C.Option,{value:w,children:hy.get(w)},`entity-relationship-option-${w}`))})]}),u.jsxs(C.FormControl,{children:[u.jsx(C.FormLabel,{required:!0,color:"primary",children:n.entity}),u.jsx(C.Select,{value:o,size:"sm",name:"entity_id",onChange:(w,b)=>a(b),sx:{width:"100%",mr:{xs:0,md:1},mb:{xs:1,md:0},minHeight:"37px"},endDecorator:!m&&u.jsx(C.CircularProgress,{size:"sm"}),children:m&&m.map(w=>u.jsx(C.Option,{value:w.id,children:w.name},`entity--${w.id}`))})]}),u.jsx(C.Button,{startDecorator:u.jsx(Me.Add,{}),disabled:!o||!l,onClick:v,sx:{mb:1},children:n.add})]}),u.jsx(ft,{showToast:f,message:n.relatedEntitiesErrorMessage,color:"danger",hideToast:p})]})},r5=t=>{const[e,n]=x.useState(!1),[r,i]=x.useState(!1),[o,a]=x.useState("success"),[l,s]=x.useState(""),c=x.useContext(ja),d=(h,p)=>{a(h),s(p),i(!0)},f=()=>A(this,null,function*(){n(!0);const h=yield c==null?void 0:c.https.exportLeadsPerEntity(t.entityId);if(h!=null&&h.ok){const p=yield h.blob(),m=URL.createObjectURL(p),g=document.createElement("a");g.href=m,g.download=`${t.entityType}_${t.entityName}_exported_users_leads.csv`,document.body.appendChild(g),g.click(),document.body.removeChild(g),URL.revokeObjectURL(m),n(!1),d("success",t.labels.usersLeadsExportMessage)}else console.error("Failed to export all users leads: ",yield h==null?void 0:h.json()),n(!1),d("danger",t.labels.usersLeadsExportErrorMessage)});return u.jsxs(u.Fragment,{children:[u.jsxs(C.Box,{mb:2,children:[u.jsx(C.Box,{display:"flex",alignItems:"center",mb:1,children:u.jsx(C.Typography,{level:"body-lg",sx:{mx:"auto"},children:t.labels.exportUsersLeads})}),u.jsx(C.Sheet,{sx:{overflowX:"auto",minWidth:"700px"},children:u.jsxs(C.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:t.labels.category}),u.jsx("th",{children:t.labels.action})]})}),u.jsx("tbody",{children:u.jsxs("tr",{children:[u.jsxs("td",{children:[u.jsx(C.Typography,{level:"body-sm",fontWeight:"600",children:t.labels.exportAllUsersLeads}),u.jsx(C.Typography,{level:"body-xs",color:"neutral",children:t.labels.exportAllUsersLeadsDescription})]}),u.jsx("td",{children:u.jsx(C.Button,{loading:e,onClick:f,children:t.labels.exportAllUsersLeads})})]})})]})})]}),u.jsx(ft,{showToast:r,color:o,message:l,hideToast:()=>i(!1)})]})},i5=({tooltipContent:t="Drag to reorder"})=>{const{attributes:e,listeners:n,ref:r}=x.useContext(Cl);return u.jsx(C.Tooltip,{title:t,placement:"left",arrow:!0,children:u.jsx(C.IconButton,X(U(U({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"}}},e),n),{ref:r,children:u.jsx(uy,{})}))})},py=({id:t,useDraggable:e=!0,variant:n="outlined",item:r,tooltipContent:i})=>{const{attributes:o,isDragging:a,listeners:l,setNodeRef:s,setActivatorNodeRef:c,transform:d,transition:f}=sy({id:t}),h=x.useMemo(()=>({attributes:o,listeners:l,ref:c}),[o,l,c]),p={opacity:a?.6:void 0,transform:Qn.Translate.toString(d),transition:f},m=v=>v.split(" ").map(I=>I[0]).join("").toUpperCase().substring(0,2),g=v=>r!=null&&r.color?r.color:`hsl(${v.split("").reduce((y,w)=>w.charCodeAt(0)+((y<<5)-y),0)%360}, 70%, 80%)`;return u.jsx(Cl.Provider,{value:h,children:u.jsx(C.ListItem,{variant:n,ref:s,style:p,endAction:e?u.jsx(i5,{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(C.Box,{sx:{display:"flex",width:"100%",alignItems:"center",gap:2,p:0},children:[u.jsx(C.Sheet,{sx:{width:"8px",alignSelf:"stretch",bgcolor:g(r.name)}}),u.jsx(C.Avatar,{src:r.image,alt:r.name,sx:{bgcolor:g(r.name),my:2,ml:1},children:m(r.name)}),u.jsxs(C.Box,{sx:{py:2,pr:2,flexGrow:1,display:"flex",flexDirection:"column",gap:.5},children:[u.jsx(C.Typography,{level:"title-md",children:r.name}),r.description&&u.jsx(C.Typography,{level:"body-sm",sx:{color:"text.secondary",textOverflow:"ellipsis"},children:r.description}),u.jsx(C.Box,{sx:{mt:.5},children:r.type&&u.jsx(C.Chip,{variant:"soft",color:"primary",size:"sm",sx:{px:1,bgcolor:`${g(r.type)}40`},children:r.type})})]})]})})})},o5={Login:zN,InformationInput:In,RichText:yu,HeaderButtons:vL,MarketSelection:r2,Accordion:oP,DynamicFields:LL,BasicSelect:sP,BooleanSwitch:el,Branding:mL,ProfileSearchSelect:SB,RangeCalendar:OL,CompetitionSearchSelect:wB,Related:s2,Images:bN,Duration:DL,DatePickerComponent:Ao,Flags:pN,Spinner:Zs,Tags:Nb,Toast:ft,AdContent:aP,Match:i2,Winners:hj,CompetitionsSearchSelect:IB,TeamsSearchSelect:AB,CustomSelect:I2,Schedule:m2,NoPermissionCard:RL,CustomFlatpickrCalendar:rd,ContextSelectFilter:gj,NumberInput:Uj,EntityContext:Yj,MiniGamesImages:Jj,AuthRequirement:Qj,SortableList:Uz,ItemsPerPageFilter:zz,ImageCard:Do,RelatedRelationship:n5,ExportUsersLeads:r5,SignOutButton:dv,BasicSortableList:({items:t=[],labels:e,setItems:n})=>{const[r,i]=x.useState(null),o=x.useMemo(()=>t.find(l=>l.id===(r==null?void 0:r.id)),[r,t]),a=S0(cl(fl,{activationConstraint:{distance:8}}),cl(dl,{coordinateGetter:ly}));return t.length===0?u.jsx(C.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",border:"1px dashed",borderColor:"divider",borderRadius:"md"},children:u.jsx(C.Typography,{level:"body-lg",color:"neutral",children:(e==null?void 0:e.noItemsToDisplay)||"No items to display"})}):u.jsxs(Q0,{sensors:a,onDragStart:({active:l})=>{i(l)},onDragEnd:({active:l,over:s})=>{if(s&&l.id!==(s==null?void 0:s.id)){const c=t.findIndex(({id:f})=>f===l.id),d=t.findIndex(({id:f})=>f===s.id);n(vl(t,c,d))}i(null)},onDragCancel:()=>{i(null)},children:[u.jsx(oy,{items:t,children:u.jsx(C.List,{sx:{gap:2,maxHeight:"70vh",overflowY:"auto","&::-webkit-scrollbar":{width:"8px"},"&::-webkit-scrollbar-thumb":{backgroundColor:"action.focus",borderRadius:"4px"}},children:t.map(l=>u.jsx(py,{id:l.id,variant:"outlined",item:l,tooltipContent:e==null?void 0:e.dragToReorder},`sortable-item-${l.id}`))})}),u.jsx(fy,{children:o?u.jsx(py,{id:o.id,useDraggable:!1,item:o,tooltipContent:e.dragToReorder},`sortable-overlay-item-${o.id}`):null})]})},WidgetEmbedCode:({entityType:t,entityId:e,authRequirement:n,labels:r})=>{const[i,o]=x.useState(!1),[a,l]=x.useState([]),[s,c]=x.useState("before"),[d,f]=x.useState(!1),[h,p]=x.useState(""),[m,g]=x.useState(""),v=`
|
|
3481
3481
|
data-content-type="${t}"`,I=`
|
|
3482
3482
|
data-content-id="${e}"`,S=a.length>0?`
|
|
3483
3483
|
data-lead-fields="${a.join(", ")}"`:"",y=i?`
|