"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5501],{61896:function(e,n,t){t.d(n,{NI:function(){return M},YF:function(){return x},bQ:function(){return C}});var r,o=t(2265),l=t(89750);t(57437);var i=t(17122);t(54887);var u=t(34826),c=t(97859);let s="active",f="selected",a={...r||(r=t.t(o,2))},d=!1,v=0,m=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+v++,p=a.useId||function(){let[e,n]=o.useState(()=>d?m():void 0);return(0,l.Xj)(()=>{null==e&&n(m())},[]),o.useEffect(()=>{d=!0},[]),e},g=o.createContext(null),E=o.createContext(null),k=()=>{var e;return(null==(e=o.useContext(g))?void 0:e.id)||null},w=()=>o.useContext(E),h={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},R={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},y=e=>{var n,t;return{escapeKey:"boolean"==typeof e?e:null!=(n=null==e?void 0:e.escapeKey)&&n,outsidePress:"boolean"==typeof e?e:null==(t=null==e?void 0:e.outsidePress)||t}};function C(e,n){void 0===n&&(n={});let{open:t,onOpenChange:r,elements:c,dataRef:s}=e,{enabled:f=!0,escapeKey:a=!0,outsidePress:d=!0,outsidePressEvent:v="pointerdown",referencePress:m=!1,referencePressEvent:p="pointerdown",ancestorScroll:g=!1,bubbles:E,capture:k}=n,C=w(),x=(0,l.iW)("function"==typeof d?d:()=>!1),b="function"==typeof d?x:d,M=o.useRef(!1),{escapeKey:K,outsidePress:P}=y(E),{escapeKey:L,outsidePress:W}=y(k),_=o.useRef(!1),D=(0,l.iW)(e=>{var n;if(!t||!f||!a||"Escape"!==e.key||_.current)return;let o=null==(n=s.current.floatingContext)?void 0:n.nodeId,i=C?(0,l.El)(C.nodesRef.current,o):[];if(!K&&(e.stopPropagation(),i.length>0)){let e=!0;if(i.forEach(n=>{var t;if(null!=(t=n.context)&&t.open&&!n.context.dataRef.current.__escapeKeyBubbles){e=!1;return}}),!e)return}r(!1,(0,l.MM)(e)?e.nativeEvent:e,"escape-key")}),S=(0,l.iW)(e=>{var n;let t=()=>{var n;D(e),null==(n=(0,l.U9)(e))||n.removeEventListener("keydown",t)};null==(n=(0,l.U9)(e))||n.addEventListener("keydown",t)}),T=(0,l.iW)(e=>{var n;let t=s.current.insideReactTree;s.current.insideReactTree=!1;let o=M.current;if(M.current=!1,"click"===v&&o||t||"function"==typeof b&&!b(e))return;let u=(0,l.U9)(e),f=(0,l.Me)(c.floating).querySelectorAll("[data-floating-ui-inert]"),a=(0,i.kK)(u)?u:null;for(;a&&!(0,i.Py)(a);){let e=(0,i.Ow)(a);if((0,i.Py)(e)||!(0,i.kK)(e))break;a=e}if(f.length&&(0,i.kK)(u)&&!(0,l.ex)(u)&&!(0,l.r3)(u,c.floating)&&Array.from(f).every(e=>!(0,l.r3)(a,e)))return;if((0,i.Re)(u)&&X){let n=(0,i.Py)(u),t=(0,i.Dx)(u),r=/auto|scroll/,o=n||r.test(t.overflowX),l=n||r.test(t.overflowY),c=o&&u.clientWidth>0&&u.scrollWidth>u.clientWidth,s=l&&u.clientHeight>0&&u.scrollHeight>u.clientHeight,f="rtl"===t.direction,a=s&&(f?e.offsetX<=u.offsetWidth-u.clientWidth:e.offsetX>u.clientWidth),d=c&&e.offsetY>u.clientHeight;if(a||d)return}let d=null==(n=s.current.floatingContext)?void 0:n.nodeId,m=C&&(0,l.El)(C.nodesRef.current,d).some(n=>{var t;return(0,l.Pe)(e,null==(t=n.context)?void 0:t.elements.floating)});if((0,l.Pe)(e,c.floating)||(0,l.Pe)(e,c.domReference)||m)return;let p=C?(0,l.El)(C.nodesRef.current,d):[];if(p.length>0){let e=!0;if(p.forEach(n=>{var t;if(null!=(t=n.context)&&t.open&&!n.context.dataRef.current.__outsidePressBubbles){e=!1;return}}),!e)return}r(!1,e,"outside-press")}),B=(0,l.iW)(e=>{var n;let t=()=>{var n;T(e),null==(n=(0,l.U9)(e))||n.removeEventListener(v,t)};null==(n=(0,l.U9)(e))||n.addEventListener(v,t)});o.useEffect(()=>{if(!t||!f)return;s.current.__escapeKeyBubbles=K,s.current.__outsidePressBubbles=P;let e=-1;function n(e){r(!1,e,"ancestor-scroll")}function o(){window.clearTimeout(e),_.current=!0}function d(){e=window.setTimeout(()=>{_.current=!1},(0,i.Pf)()?5:0)}let m=(0,l.Me)(c.floating);a&&(m.addEventListener("keydown",L?S:D,L),m.addEventListener("compositionstart",o),m.addEventListener("compositionend",d)),b&&m.addEventListener(v,W?B:T,W);let p=[];return g&&((0,i.kK)(c.domReference)&&(p=(0,u.Kx)(c.domReference)),(0,i.kK)(c.floating)&&(p=p.concat((0,u.Kx)(c.floating))),!(0,i.kK)(c.reference)&&c.reference&&c.reference.contextElement&&(p=p.concat((0,u.Kx)(c.reference.contextElement)))),(p=p.filter(e=>{var n;return e!==(null==(n=m.defaultView)?void 0:n.visualViewport)})).forEach(e=>{e.addEventListener("scroll",n,{passive:!0})}),()=>{a&&(m.removeEventListener("keydown",L?S:D,L),m.removeEventListener("compositionstart",o),m.removeEventListener("compositionend",d)),b&&m.removeEventListener(v,W?B:T,W),p.forEach(e=>{e.removeEventListener("scroll",n)}),window.clearTimeout(e)}},[s,c,a,b,v,t,r,g,f,K,P,D,L,S,T,W,B]),o.useEffect(()=>{s.current.insideReactTree=!1},[s,b,v]);let U=o.useMemo(()=>({onKeyDown:D,...m&&{[h[p]]:e=>{r(!1,e.nativeEvent,"reference-press")},..."click"!==p&&{onClick(e){r(!1,e.nativeEvent,"reference-press")}}}}),[D,r,m,p]),X=o.useMemo(()=>({onKeyDown:D,onMouseDown(){M.current=!0},onMouseUp(){M.current=!0},[R[v]]:()=>{s.current.insideReactTree=!0}}),[D,v,s]);return o.useMemo(()=>f?{reference:U,floating:X}:{},[f,U,X])}function x(e){void 0===e&&(e={});let{nodeId:n}=e,t=function(e){let{open:n=!1,onOpenChange:t,elements:r}=e,i=p(),u=o.useRef({}),[c]=o.useState(()=>(function(){let e=new Map;return{emit(n,t){var r;null==(r=e.get(n))||r.forEach(e=>e(t))},on(n,t){e.has(n)||e.set(n,new Set),e.get(n).add(t)},off(n,t){var r;null==(r=e.get(n))||r.delete(t)}}})()),s=null!=k(),[f,a]=o.useState(r.reference),d=(0,l.iW)((e,n,r)=>{u.current.openEvent=e?n:void 0,c.emit("openchange",{open:e,event:n,reason:r,nested:s}),null==t||t(e,n,r)}),v=o.useMemo(()=>({setPositionReference:a}),[]),m=o.useMemo(()=>({reference:f||r.reference||null,floating:r.floating||null,domReference:r.reference}),[f,r.reference,r.floating]);return o.useMemo(()=>({dataRef:u,open:n,onOpenChange:d,elements:m,events:c,floatingId:i,refs:v}),[n,d,m,c,i,v])}({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||t,u=r.elements,[s,f]=o.useState(null),[a,d]=o.useState(null),v=(null==u?void 0:u.domReference)||s,m=o.useRef(null),g=w();(0,l.Xj)(()=>{v&&(m.current=v)},[v]);let E=(0,c.YF)({...e,elements:{...u,...a&&{reference:a}}}),h=o.useCallback(e=>{let n=(0,i.kK)(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;d(n),E.refs.setReference(n)},[E.refs]),R=o.useCallback(e=>{((0,i.kK)(e)||null===e)&&(m.current=e,f(e)),((0,i.kK)(E.refs.reference.current)||null===E.refs.reference.current||null!==e&&!(0,i.kK)(e))&&E.refs.setReference(e)},[E.refs]),y=o.useMemo(()=>({...E.refs,setReference:R,setPositionReference:h,domReference:m}),[E.refs,R,h]),C=o.useMemo(()=>({...E.elements,domReference:v}),[E.elements,v]),x=o.useMemo(()=>({...E,...r,refs:y,elements:C,nodeId:n}),[E,y,C,n,r]);return(0,l.Xj)(()=>{r.dataRef.current.floatingContext=x;let e=null==g?void 0:g.nodesRef.current.find(e=>e.id===n);e&&(e.context=x)}),o.useMemo(()=>({...E,context:x,refs:y,elements:C}),[E,y,C,x])}function b(e,n,t){let r=new Map,o="item"===t,l=e;if(o&&e){let{[s]:n,[f]:t,...r}=e;l=r}return{..."floating"===t&&{tabIndex:-1,"data-floating-ui-focusable":""},...l,...n.map(n=>{let r=n?n[t]:null;return"function"==typeof r?e?r(e):null:r}).concat(e).reduce((e,n)=>(n&&Object.entries(n).forEach(n=>{let[t,l]=n;if(!(o&&[s,f].includes(t))){if(0===t.indexOf("on")){if(r.has(t)||r.set(t,[]),"function"==typeof l){var i;null==(i=r.get(t))||i.push(l),e[t]=function(){for(var e,n=arguments.length,o=Array(n),l=0;l<n;l++)o[l]=arguments[l];return null==(e=r.get(t))?void 0:e.map(e=>e(...o)).find(e=>void 0!==e)}}}else e[t]=l}}),e),{})}}function M(e){void 0===e&&(e=[]);let n=e.map(e=>null==e?void 0:e.reference),t=e.map(e=>null==e?void 0:e.floating),r=e.map(e=>null==e?void 0:e.item),l=o.useCallback(n=>b(n,e,"reference"),n),i=o.useCallback(n=>b(n,e,"floating"),t),u=o.useCallback(n=>b(n,e,"item"),r);return o.useMemo(()=>({getReferenceProps:l,getFloatingProps:i,getItemProps:u}),[l,i,u])}}}]);