/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/@highlight-ui/utils-hooks@3.5.1/dist/cjs/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),ReactDOM=require("react-dom"),core=require("@popperjs/core"),utilsCommons=require("@highlight-ui/utils-commons");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var React__namespace=_interopNamespace(React),React__default=_interopDefaultLegacy(React),ReactDOM__namespace=_interopNamespace(ReactDOM),__assign$1=function(){return __assign$1=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},__assign$1.apply(this,arguments)};function __rest$1(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}var fromEntries=function(e){return e.reduce((function(e,t){var n=t[0],r=t[1];return e[n]=r,e}),{})},useIsomorphicLayoutEffect="undefined"!=typeof window&&window.document&&window.document.createElement?React__namespace.useLayoutEffect:React__namespace.useEffect,commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},hasElementType="undefined"!=typeof Element,hasMap="function"==typeof Map,hasSet="function"==typeof Set,hasArrayBuffer="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function equal(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;var n,r,o,i;if(Array.isArray(e)){if((n=e.length)!=t.length)return!1;for(r=n;0!=r--;)if(!equal(e[r],t[r]))return!1;return!0}if(hasMap&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(i=e.entries();!(r=i.next()).done;)if(!t.has(r.value[0]))return!1;for(i=e.entries();!(r=i.next()).done;)if(!equal(r.value[1],t.get(r.value[0])))return!1;return!0}if(hasSet&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(i=e.entries();!(r=i.next()).done;)if(!t.has(r.value[0]))return!1;return!0}if(hasArrayBuffer&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if((n=e.length)!=t.length)return!1;for(r=n;0!=r--;)if(e[r]!==t[r])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&"function"==typeof e.valueOf&&"function"==typeof t.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&"function"==typeof e.toString&&"function"==typeof t.toString)return e.toString()===t.toString();if((n=(o=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!Object.prototype.hasOwnProperty.call(t,o[r]))return!1;if(hasElementType&&e instanceof Element)return!1;for(r=n;0!=r--;)if(("_owner"!==o[r]&&"__v"!==o[r]&&"__o"!==o[r]||!e.$$typeof)&&!equal(e[o[r]],t[o[r]]))return!1;return!0}return e!=e&&t!=t}var reactFastCompare=function(e,t){try{return equal(e,t)}catch(e){if((e.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw e}},EMPTY_MODIFIERS=[],usePopper=function(e,t,n){void 0===n&&(n={});var r=React__namespace.useRef(null),o={onFirstUpdate:n.onFirstUpdate,placement:n.placement||"bottom",strategy:n.strategy||"absolute",modifiers:n.modifiers||EMPTY_MODIFIERS},i=React__namespace.useState({styles:{popper:{position:o.strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),s=i[0],a=i[1],c=React__namespace.useMemo((function(){return{name:"updateState",enabled:!0,phase:"write",fn:function(e){var t=e.state,n=Object.keys(t.elements);ReactDOM__namespace.flushSync((function(){a({styles:fromEntries(n.map((function(e){return[e,t.styles[e]||{}]}))),attributes:fromEntries(n.map((function(e){return[e,t.attributes[e]]})))})}))},requires:["computeStyles"]}}),[]),l=React__namespace.useMemo((function(){var e={onFirstUpdate:o.onFirstUpdate,placement:o.placement,strategy:o.strategy,modifiers:[].concat(o.modifiers,[c,{name:"applyStyles",enabled:!1}])};return reactFastCompare(r.current,e)?r.current||e:(r.current=e,e)}),[o.onFirstUpdate,o.placement,o.strategy,o.modifiers,c]),u=React__namespace.useRef();return useIsomorphicLayoutEffect((function(){u.current&&u.current.setOptions(l)}),[l]),useIsomorphicLayoutEffect((function(){if(null!=e&&null!=t){var r=(n.createPopper||core.createPopper)(e,t,l);return u.current=r,function(){r.destroy(),u.current=null}}}),[e,t,n.createPopper]),{state:u.current?u.current.state:null,styles:s.styles,attributes:s.attributes,update:u.current?u.current.update:null,forceUpdate:u.current?u.current.forceUpdate:null}};function isObject$4(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var isObject_1=isObject$4,freeGlobal$2="object"==typeof commonjsGlobal&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,_freeGlobal=freeGlobal$2,freeGlobal$1=_freeGlobal,freeSelf$1="object"==typeof self&&self&&self.Object===Object&&self,root$3=freeGlobal$1||freeSelf$1||Function("return this")(),_root=root$3,root$2=root$3,now$2=function(){return root$2.Date.now()},now_1=now$2,reWhitespace=/\s/;function trimmedEndIndex$1(e){for(var t=e.length;t--&&reWhitespace.test(e.charAt(t)););return t}var _trimmedEndIndex=trimmedEndIndex$1,trimmedEndIndex=_trimmedEndIndex,reTrimStart=/^\s+/;function baseTrim$1(e){return e?e.slice(0,trimmedEndIndex(e)+1).replace(reTrimStart,""):e}var _baseTrim=baseTrim$1,root$1=root$3,Symbol$2=root$1.Symbol,_Symbol=Symbol$2,Symbol$1=_Symbol,objectProto$2=Object.prototype,hasOwnProperty=objectProto$2.hasOwnProperty,nativeObjectToString$1=objectProto$2.toString,symToStringTag$1=Symbol$1?Symbol$1.toStringTag:void 0;function getRawTag$1(e){var t=hasOwnProperty.call(e,symToStringTag$1),n=e[symToStringTag$1];try{e[symToStringTag$1]=void 0;var r=!0}catch(e){}var o=nativeObjectToString$1.call(e);return r&&(t?e[symToStringTag$1]=n:delete e[symToStringTag$1]),o}var _getRawTag=getRawTag$1,objectProto$1=Object.prototype,nativeObjectToString=objectProto$1.toString;function objectToString$2(e){return nativeObjectToString.call(e)}var _objectToString=objectToString$2,Symbol=_Symbol,getRawTag=_getRawTag,objectToString$1=_objectToString,nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=_Symbol?_Symbol.toStringTag:void 0;function baseGetTag$1(e){return null==e?void 0===e?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(e)?getRawTag(e):objectToString$1(e)}var _baseGetTag=baseGetTag$1;function isObjectLike$2(e){return null!=e&&"object"==typeof e}var isObjectLike_1=isObjectLike$2,baseGetTag=_baseGetTag,isObjectLike$1=isObjectLike_1,symbolTag$1="[object Symbol]";function isSymbol$2(e){return"symbol"==typeof e||isObjectLike$1(e)&&baseGetTag(e)==symbolTag$1}var isSymbol_1=isSymbol$2,baseTrim=_baseTrim,isObject$3=isObject_1,isSymbol$1=isSymbol_1,NAN$1=NaN,reIsBadHex$1=/^[-+]0x[0-9a-f]+$/i,reIsBinary$1=/^0b[01]+$/i,reIsOctal$1=/^0o[0-7]+$/i,freeParseInt$1=parseInt;function toNumber$2(e){if("number"==typeof e)return e;if(isSymbol$1(e))return NAN$1;if(isObject$3(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=isObject$3(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=baseTrim(e);var n=reIsBinary$1.test(e);return n||reIsOctal$1.test(e)?freeParseInt$1(e.slice(2),n?2:8):reIsBadHex$1.test(e)?NAN$1:+e}var toNumber_1=toNumber$2,isObject$2=isObject_1,now$1=now_1,toNumber$1=toNumber_1,FUNC_ERROR_TEXT$2="Expected a function",nativeMax$1=Math.max,nativeMin$1=Math.min;function debounce$2(e,t,n){var r,o,i,s,a,c,l=0,u=!1,f=!1,d=!0;if("function"!=typeof e)throw new TypeError(FUNC_ERROR_TEXT$2);function m(t){var n=r,i=o;return r=o=void 0,l=t,s=e.apply(i,n)}function p(e){var n=e-c;return void 0===c||n>=t||n<0||f&&e-l>=i}function g(){var e=now$1();if(p(e))return v(e);a=setTimeout(g,function(e){var n=t-(e-c);return f?nativeMin$1(n,i-(e-l)):n}(e))}function v(e){return a=void 0,d&&r?m(e):(r=o=void 0,s)}function h(){var e=now$1(),n=p(e);if(r=arguments,o=this,c=e,n){if(void 0===a)return function(e){return l=e,a=setTimeout(g,t),u?m(e):s}(c);if(f)return clearTimeout(a),a=setTimeout(g,t),m(c)}return void 0===a&&(a=setTimeout(g,t)),s}return t=toNumber$1(t)||0,isObject$2(n)&&(u=!!n.leading,i=(f="maxWait"in n)?nativeMax$1(toNumber$1(n.maxWait)||0,t):i,d="trailing"in n?!!n.trailing:d),h.cancel=function(){void 0!==a&&clearTimeout(a),l=0,r=c=o=a=void 0},h.flush=function(){return void 0===a?s:v(now$1())},h}var debounce_1=debounce$2,debounce$1=debounce_1,isObject$1=isObject_1,FUNC_ERROR_TEXT$1="Expected a function";function throttle(e,t,n){var r=!0,o=!0;if("function"!=typeof e)throw new TypeError(FUNC_ERROR_TEXT$1);return isObject$1(n)&&(r="leading"in n?!!n.leading:r,o="trailing"in n?!!n.trailing:o),debounce$1(e,t,{leading:r,maxWait:t,trailing:o})}var throttle_1=throttle,extendStatics=function(e,t){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},extendStatics(e,t)};function __extends(e,t){function n(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var __assign=function(){return __assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},__assign.apply(this,arguments)};function __rest(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}var patchResizeCallback=function(e,t,n,r){switch(t){case"debounce":return debounce_1(e,n,r);case"throttle":return throttle_1(e,n,r);default:return e}},isFunction=function(e){return"function"==typeof e},isSSR=function(){return"undefined"==typeof window},isDOMElement=function(e){return e instanceof Element||e instanceof HTMLDocument};function useResizeDetector(e){var t=void 0===e?{}:e,n=t.skipOnMount,r=void 0!==n&&n,o=t.refreshMode,i=t.refreshRate,s=void 0===i?1e3:i,a=t.refreshOptions,c=t.handleWidth,l=void 0===c||c,u=t.handleHeight,f=void 0===u||u,d=t.targetRef,m=t.observerOptions,p=t.onResize,g=React.useRef(r),v=React.useState({width:void 0,height:void 0}),h=v[0],b=v[1],y=React.useState((null==d?void 0:d.current)||null),R=y[0],_=y[1];d&&setTimeout((function(){d.current!==R&&_(d.current)}),0);var w=React.useCallback((function(e){e!==R&&_(e)}),[R]);w.current=R,React.useEffect((function(){return function(){_(null),w.current=null}}),[]);var E=React.useCallback((function(e,t){return(e.width!==t.width||e.height!==t.height)&&!(e.width===t.width&&!f||e.height===t.height&&!l)}),[l,f]),O=React.useCallback((function(e){(l||f)&&(g.current?g.current=!1:e.forEach((function(e){var t=(null==e?void 0:e.contentRect)||{},n=t.width,r=t.height;b((function(e){return E(e,{width:n,height:r})?{width:n,height:r}:e}))})))}),[l,f,g,E]),x=React.useCallback(patchResizeCallback(O,o,s,a),[O,o,s,a]);return React.useEffect((function(){var e;return R?(e=new window.ResizeObserver(x)).observe(R,m):(h.width||h.height)&&b({width:void 0,height:void 0}),function(){var t,n,r;null===(t=null==e?void 0:e.disconnect)||void 0===t||t.call(e),null===(r=(n=x).cancel)||void 0===r||r.call(n)}}),[x,R]),React.useEffect((function(){null==p||p(h.width,h.height)}),[h]),__assign({ref:w},h)}function setRef(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function useForkRef(e){return React.useCallback((function(t){e.forEach((function(e){return setRef(e,t)}))}),e)}!function(e){function t(t){var n=e.call(this,t)||this;n.cancelHandler=function(){n.resizeHandler&&n.resizeHandler.cancel&&(n.resizeHandler.cancel(),n.resizeHandler=null)},n.attachObserver=function(){var e=n.props,t=e.targetRef,r=e.observerOptions;if(!isSSR()){t&&t.current&&(n.targetRef.current=t.current);var o=n.getElement();o&&(n.observableElement&&n.observableElement===o||(n.observableElement=o,n.resizeObserver.observe(o,r)))}},n.getElement=function(){var e=n.props,t=e.querySelector,r=e.targetDomEl;if(isSSR())return null;if(t)return document.querySelector(t);if(r&&isDOMElement(r))return r;if(n.targetRef&&isDOMElement(n.targetRef.current))return n.targetRef.current;var o=ReactDOM.findDOMNode(n);if(!o)return null;switch(n.getRenderType()){case"renderProp":case"childFunction":case"child":case"childArray":return o;default:return o.parentElement}},n.createResizeHandler=function(e){var t=n.props,r=t.handleWidth,o=void 0===r||r,i=t.handleHeight,s=void 0===i||i,a=t.onResize;if(o||s){e.forEach((function(e){var t=e&&e.contentRect||{},r=t.width,i=t.height;!n.skipOnMount&&!isSSR()&&function(e){var t=e.width,r=e.height;n.state.width===t&&n.state.height===r||n.state.width===t&&!s||n.state.height===r&&!o||(null==a||a(t,r),n.setState({width:t,height:r}))}({width:r,height:i}),n.skipOnMount=!1}))}},n.getRenderType=function(){var e=n.props,t=e.render,r=e.children;return isFunction(t)?"renderProp":isFunction(r)?"childFunction":React.isValidElement(r)?"child":Array.isArray(r)?"childArray":"parent"};var r=t.skipOnMount,o=t.refreshMode,i=t.refreshRate,s=void 0===i?1e3:i,a=t.refreshOptions;return n.state={width:void 0,height:void 0},n.sizeRef={current:n.state},n.skipOnMount=r,n.targetRef=React.createRef(),n.observableElement=null,isSSR()||(n.resizeHandler=patchResizeCallback(n.createResizeHandler,o,s,a),n.resizeObserver=new window.ResizeObserver(n.resizeHandler)),n}__extends(t,e),t.prototype.componentDidMount=function(){this.attachObserver()},t.prototype.componentDidUpdate=function(){this.attachObserver(),this.sizeRef.current=this.state},t.prototype.componentWillUnmount=function(){isSSR()||(this.observableElement=null,this.resizeObserver.disconnect(),this.cancelHandler())},t.prototype.render=function(){var e=this.props,t=e.render,n=e.children,r=e.nodeType,o=void 0===r?"div":r,i=this.state,s={width:i.width,height:i.height,targetRef:this.targetRef};switch(this.getRenderType()){case"renderProp":return null==t?void 0:t(s);case"childFunction":var a=n;return null==a?void 0:a(s);case"child":var c=n;if(c.type&&"string"==typeof c.type){var l=__rest(s,["targetRef"]);return React.cloneElement(c,l)}return React.cloneElement(c,s);case"childArray":return n.map((function(e){return!!e&&React.cloneElement(e,s)}));default:return React__default.default.createElement(o,null)}}}(React.PureComponent);var createPopper=core.popperGenerator({defaultModifiers:[core.preventOverflow,core.popperOffsets,core.eventListeners,core.computeStyles,core.applyStyles,__assign$1(__assign$1({},core.offset),{options:{offset:[0,6]}}),__assign$1(__assign$1({},core.flip),{options:{fallbackPlacements:["bottom-end","top-start","top-end"]}})]}),useAutoPositioner=function(e){void 0===e&&(e={});var t=React.useState(),n=t[0],r=t[1],o=React.useState(),i=o[0],s=o[1],a=usePopper(n,i,__assign$1(__assign$1({placement:"bottom-start"},e),{createPopper:createPopper})),c=a.styles,l=a.attributes,u=a.update;return{setReferenceElement:useForkRef([r,useResizeDetector({onResize:function(){u&&u()},refreshRate:100,refreshMode:"debounce"}).ref]),setPopperElement:s,styles:c,attributes:l}};const sides=["top","right","bottom","left"],alignments=["start","end"],placements=sides.reduce(((e,t)=>e.concat(t,t+"-"+alignments[0],t+"-"+alignments[1])),[]),min=Math.min,max=Math.max,round=Math.round,floor=Math.floor,createCoords=e=>({x:e,y:e}),oppositeSideMap={left:"right",right:"left",bottom:"top",top:"bottom"},oppositeAlignmentMap={start:"end",end:"start"};function clamp(e,t,n){return max(e,min(t,n))}function evaluate(e,t){return"function"==typeof e?e(t):e}function getSide(e){return e.split("-")[0]}function getAlignment(e){return e.split("-")[1]}function getOppositeAxis(e){return"x"===e?"y":"x"}function getAxisLength(e){return"y"===e?"height":"width"}function getSideAxis(e){return["top","bottom"].includes(getSide(e))?"y":"x"}function getAlignmentAxis(e){return getOppositeAxis(getSideAxis(e))}function getAlignmentSides(e,t,n){void 0===n&&(n=!1);const r=getAlignment(e),o=getAlignmentAxis(e),i=getAxisLength(o);let s="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=getOppositePlacement(s)),[s,getOppositePlacement(s)]}function getExpandedPlacements(e){const t=getOppositePlacement(e);return[getOppositeAlignmentPlacement(e),t,getOppositeAlignmentPlacement(t)]}function getOppositeAlignmentPlacement(e){return e.replace(/start|end/g,(e=>oppositeAlignmentMap[e]))}function getSideList(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}function getOppositeAxisPlacements(e,t,n,r){const o=getAlignment(e);let i=getSideList(getSide(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(getOppositeAlignmentPlacement)))),i}function getOppositePlacement(e){return e.replace(/left|right|bottom|top/g,(e=>oppositeSideMap[e]))}function expandPaddingObject(e){return{top:0,right:0,bottom:0,left:0,...e}}function getPaddingObject(e){return"number"!=typeof e?expandPaddingObject(e):{top:e,right:e,bottom:e,left:e}}function rectToClientRect(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function computeCoordsFromPlacement(e,t,n){let{reference:r,floating:o}=e;const i=getSideAxis(t),s=getAlignmentAxis(t),a=getAxisLength(s),c=getSide(t),l="y"===i,u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,d=r[a]/2-o[a]/2;let m;switch(c){case"top":m={x:u,y:r.y-o.height};break;case"bottom":m={x:u,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:f};break;case"left":m={x:r.x-o.width,y:f};break;default:m={x:r.x,y:r.y}}switch(getAlignment(t)){case"start":m[s]-=d*(n&&l?-1:1);break;case"end":m[s]+=d*(n&&l?-1:1)}return m}const computePosition$1=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),c=await(null==s.isRTL?void 0:s.isRTL(t));let l=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=computeCoordsFromPlacement(l,r,c),d=r,m={},p=0;for(let n=0;n<a.length;n++){const{name:i,fn:g}=a[n],{x:v,y:h,data:b,reset:y}=await g({x:u,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=null!=v?v:u,f=null!=h?h:f,m={...m,[i]:{...m[i],...b}},y&&p<=50&&(p++,"object"==typeof y&&(y.placement&&(d=y.placement),y.rects&&(l=!0===y.rects?await s.getElementRects({reference:e,floating:t,strategy:o}):y.rects),({x:u,y:f}=computeCoordsFromPlacement(l,d,c))),n=-1)}return{x:u,y:f,placement:d,strategy:o,middlewareData:m}};async function detectOverflow(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:d=!1,padding:m=0}=evaluate(t,e),p=getPaddingObject(m),g=a[d?"floating"===f?"reference":"floating":f],v=rectToClientRect(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(g)))||n?g:g.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(a.floating)),boundary:l,rootBoundary:u,strategy:c})),h="floating"===f?{...s.floating,x:r,y:o}:s.reference,b=await(null==i.getOffsetParent?void 0:i.getOffsetParent(a.floating)),y=await(null==i.isElement?void 0:i.isElement(b))&&await(null==i.getScale?void 0:i.getScale(b))||{x:1,y:1},R=rectToClientRect(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:h,offsetParent:b,strategy:c}):h);return{top:(v.top-R.top+p.top)/y.y,bottom:(R.bottom-v.bottom+p.bottom)/y.y,left:(v.left-R.left+p.left)/y.x,right:(R.right-v.right+p.right)/y.x}}function getPlacementList(e,t,n){return(e?[...n.filter((t=>getAlignment(t)===e)),...n.filter((t=>getAlignment(t)!==e))]:n.filter((e=>getSide(e)===e))).filter((n=>!e||(getAlignment(n)===e||!!t&&getOppositeAlignmentPlacement(n)!==n)))}const autoPlacement=function(e){return void 0===e&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,o;const{rects:i,middlewareData:s,placement:a,platform:c,elements:l}=t,{crossAxis:u=!1,alignment:f,allowedPlacements:d=placements,autoAlignment:m=!0,...p}=evaluate(e,t),g=void 0!==f||d===placements?getPlacementList(f||null,m,d):d,v=await detectOverflow(t,p),h=(null==(n=s.autoPlacement)?void 0:n.index)||0,b=g[h];if(null==b)return{};const y=getAlignmentSides(b,i,await(null==c.isRTL?void 0:c.isRTL(l.floating)));if(a!==b)return{reset:{placement:g[0]}};const R=[v[getSide(b)],v[y[0]],v[y[1]]],_=[...(null==(r=s.autoPlacement)?void 0:r.overflows)||[],{placement:b,overflows:R}],w=g[h+1];if(w)return{data:{index:h+1,overflows:_},reset:{placement:w}};const E=_.map((e=>{const t=getAlignment(e.placement);return[e.placement,t&&u?e.overflows.slice(0,2).reduce(((e,t)=>e+t),0):e.overflows[0],e.overflows]})).sort(((e,t)=>e[1]-t[1])),O=(null==(o=E.filter((e=>e[2].slice(0,getAlignment(e[0])?2:3).every((e=>e<=0))))[0])?void 0:o[0])||E[0][0];return O!==a?{data:{index:h+1,overflows:_},reset:{placement:O}}:{}}}},flip=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:c,elements:l}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...v}=evaluate(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const h=getSide(o),b=getSide(a)===a,y=await(null==c.isRTL?void 0:c.isRTL(l.floating)),R=d||(b||!g?[getOppositePlacement(a)]:getExpandedPlacements(a));d||"none"===p||R.push(...getOppositeAxisPlacements(a,g,p,y));const _=[a,...R],w=await detectOverflow(t,v),E=[];let O=(null==(r=i.flip)?void 0:r.overflows)||[];if(u&&E.push(w[h]),f){const e=getAlignmentSides(o,s,y);E.push(w[e[0]],w[e[1]])}if(O=[...O,{placement:o,overflows:E}],!E.every((e=>e<=0))){var x,T;const e=((null==(x=i.flip)?void 0:x.index)||0)+1,t=_[e];if(t)return{data:{index:e,overflows:O},reset:{placement:t}};let n=null==(T=O.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:T.placement;if(!n)switch(m){case"bestFit":{var S;const e=null==(S=O.map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:S[0];e&&(n=e);break}case"initialPlacement":n=a}if(o!==n)return{reset:{placement:n}}}return{}}}};async function convertValueToCoords(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),s=getSide(n),a=getAlignment(n),c="y"===getSideAxis(n),l=["left","top"].includes(s)?-1:1,u=i&&c?-1:1,f=evaluate(t,e);let{mainAxis:d,crossAxis:m,alignmentAxis:p}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return a&&"number"==typeof p&&(m="end"===a?-1*p:p),c?{x:m*u,y:d*l}:{x:d*l,y:m*u}}const offset=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:r}=t,o=await convertValueToCoords(t,e);return{x:n+o.x,y:r+o.y,data:o}}}},shift=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=evaluate(e,t),l={x:n,y:r},u=await detectOverflow(t,c),f=getSideAxis(getSide(o)),d=getOppositeAxis(f);let m=l[d],p=l[f];if(i){const e="y"===d?"bottom":"right";m=clamp(m+u["y"===d?"top":"left"],m,m-u[e])}if(s){const e="y"===f?"bottom":"right";p=clamp(p+u["y"===f?"top":"left"],p,p-u[e])}const g=a.fn({...t,[d]:m,[f]:p});return{...g,data:{x:g.x-n,y:g.y-r}}}}};function getNodeName(e){return isNode(e)?(e.nodeName||"").toLowerCase():"#document"}function getWindow$1(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function getDocumentElement(e){var t;return null==(t=(isNode(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function isNode(e){return e instanceof Node||e instanceof getWindow$1(e).Node}function isElement$1(e){return e instanceof Element||e instanceof getWindow$1(e).Element}function isHTMLElement$1(e){return e instanceof HTMLElement||e instanceof getWindow$1(e).HTMLElement}function isShadowRoot(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof getWindow$1(e).ShadowRoot)}function isOverflowElement(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=getComputedStyle(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function isTableElement(e){return["table","td","th"].includes(getNodeName(e))}function isContainingBlock(e){const t=isWebKit(),n=getComputedStyle(e);return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function getContainingBlock(e){let t=getParentNode(e);for(;isHTMLElement$1(t)&&!isLastTraversableNode(t);){if(isContainingBlock(t))return t;t=getParentNode(t)}return null}function isWebKit(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function isLastTraversableNode(e){return["html","body","#document"].includes(getNodeName(e))}function getComputedStyle(e){return getWindow$1(e).getComputedStyle(e)}function getNodeScroll(e){return isElement$1(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function getParentNode(e){if("html"===getNodeName(e))return e;const t=e.assignedSlot||e.parentNode||isShadowRoot(e)&&e.host||getDocumentElement(e);return isShadowRoot(t)?t.host:t}function getNearestOverflowAncestor(e){const t=getParentNode(e);return isLastTraversableNode(t)?e.ownerDocument?e.ownerDocument.body:e.body:isHTMLElement$1(t)&&isOverflowElement(t)?t:getNearestOverflowAncestor(t)}function getOverflowAncestors(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=getNearestOverflowAncestor(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),s=getWindow$1(o);return i?t.concat(s,s.visualViewport||[],isOverflowElement(o)?o:[],s.frameElement&&n?getOverflowAncestors(s.frameElement):[]):t.concat(o,getOverflowAncestors(o,[],n))}function getCssDimensions(e){const t=getComputedStyle(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=isHTMLElement$1(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=round(n)!==i||round(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function unwrapElement(e){return isElement$1(e)?e:e.contextElement}function getScale(e){const t=unwrapElement(e);if(!isHTMLElement$1(t))return createCoords(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=getCssDimensions(t);let s=(i?round(n.width):n.width)/r,a=(i?round(n.height):n.height)/o;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const noOffsets=createCoords(0);function getVisualOffsets(e){const t=getWindow$1(e);return isWebKit()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:noOffsets}function shouldAddVisualOffsets(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==getWindow$1(e))&&t}function getBoundingClientRect(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=unwrapElement(e);let s=createCoords(1);t&&(r?isElement$1(r)&&(s=getScale(r)):s=getScale(e));const a=shouldAddVisualOffsets(i,n,r)?getVisualOffsets(i):createCoords(0);let c=(o.left+a.x)/s.x,l=(o.top+a.y)/s.y,u=o.width/s.x,f=o.height/s.y;if(i){const e=getWindow$1(i),t=r&&isElement$1(r)?getWindow$1(r):r;let n=e.frameElement;for(;n&&r&&t!==e;){const e=getScale(n),t=n.getBoundingClientRect(),r=getComputedStyle(n),o=t.left+(n.clientLeft+parseFloat(r.paddingLeft))*e.x,i=t.top+(n.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,f*=e.y,c+=o,l+=i,n=getWindow$1(n).frameElement}}return rectToClientRect({width:u,height:f,x:c,y:l})}function convertOffsetParentRelativeRectToViewportRelativeRect(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=isHTMLElement$1(n),i=getDocumentElement(n);if(n===i)return t;let s={scrollLeft:0,scrollTop:0},a=createCoords(1);const c=createCoords(0);if((o||!o&&"fixed"!==r)&&(("body"!==getNodeName(n)||isOverflowElement(i))&&(s=getNodeScroll(n)),isHTMLElement$1(n))){const e=getBoundingClientRect(n);a=getScale(n),c.x=e.x+n.clientLeft,c.y=e.y+n.clientTop}return{width:t.width*a.x,height:t.height*a.y,x:t.x*a.x-s.scrollLeft*a.x+c.x,y:t.y*a.y-s.scrollTop*a.y+c.y}}function getClientRects(e){return Array.from(e.getClientRects())}function getWindowScrollBarX(e){return getBoundingClientRect(getDocumentElement(e)).left+getNodeScroll(e).scrollLeft}function getDocumentRect(e){const t=getDocumentElement(e),n=getNodeScroll(e),r=e.ownerDocument.body,o=max(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=max(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+getWindowScrollBarX(e);const a=-n.scrollTop;return"rtl"===getComputedStyle(r).direction&&(s+=max(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function getViewportRect(e,t){const n=getWindow$1(e),r=getDocumentElement(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,c=0;if(o){i=o.width,s=o.height;const e=isWebKit();(!e||e&&"fixed"===t)&&(a=o.offsetLeft,c=o.offsetTop)}return{width:i,height:s,x:a,y:c}}function getInnerBoundingClientRect(e,t){const n=getBoundingClientRect(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=isHTMLElement$1(e)?getScale(e):createCoords(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}function getClientRectFromClippingAncestor(e,t,n){let r;if("viewport"===t)r=getViewportRect(e,n);else if("document"===t)r=getDocumentRect(getDocumentElement(e));else if(isElement$1(t))r=getInnerBoundingClientRect(t,n);else{const n=getVisualOffsets(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return rectToClientRect(r)}function hasFixedPositionAncestor(e,t){const n=getParentNode(e);return!(n===t||!isElement$1(n)||isLastTraversableNode(n))&&("fixed"===getComputedStyle(n).position||hasFixedPositionAncestor(n,t))}function getClippingElementAncestors(e,t){const n=t.get(e);if(n)return n;let r=getOverflowAncestors(e,[],!1).filter((e=>isElement$1(e)&&"body"!==getNodeName(e))),o=null;const i="fixed"===getComputedStyle(e).position;let s=i?getParentNode(e):e;for(;isElement$1(s)&&!isLastTraversableNode(s);){const t=getComputedStyle(s),n=isContainingBlock(s);n||"fixed"!==t.position||(o=null);(i?!n&&!o:!n&&"static"===t.position&&!!o&&["absolute","fixed"].includes(o.position)||isOverflowElement(s)&&!n&&hasFixedPositionAncestor(e,s))?r=r.filter((e=>e!==s)):o=t,s=getParentNode(s)}return t.set(e,r),r}function getClippingRect(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?getClippingElementAncestors(t,this._c):[].concat(n),r],s=i[0],a=i.reduce(((e,n)=>{const r=getClientRectFromClippingAncestor(t,n,o);return e.top=max(r.top,e.top),e.right=min(r.right,e.right),e.bottom=min(r.bottom,e.bottom),e.left=max(r.left,e.left),e}),getClientRectFromClippingAncestor(t,s,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function getDimensions(e){return getCssDimensions(e)}function getRectRelativeToOffsetParent(e,t,n){const r=isHTMLElement$1(t),o=getDocumentElement(t),i="fixed"===n,s=getBoundingClientRect(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=createCoords(0);if(r||!r&&!i)if(("body"!==getNodeName(t)||isOverflowElement(o))&&(a=getNodeScroll(t)),r){const e=getBoundingClientRect(t,!0,i,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else o&&(c.x=getWindowScrollBarX(o));return{x:s.left+a.scrollLeft-c.x,y:s.top+a.scrollTop-c.y,width:s.width,height:s.height}}function getTrueOffsetParent(e,t){return isHTMLElement$1(e)&&"fixed"!==getComputedStyle(e).position?t?t(e):e.offsetParent:null}function getOffsetParent(e,t){const n=getWindow$1(e);if(!isHTMLElement$1(e))return n;let r=getTrueOffsetParent(e,t);for(;r&&isTableElement(r)&&"static"===getComputedStyle(r).position;)r=getTrueOffsetParent(r,t);return r&&("html"===getNodeName(r)||"body"===getNodeName(r)&&"static"===getComputedStyle(r).position&&!isContainingBlock(r))?n:r||getContainingBlock(e)||n}const getElementRects=async function(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||getOffsetParent,i=this.getDimensions;return{reference:getRectRelativeToOffsetParent(t,await o(n),r),floating:{x:0,y:0,...await i(n)}}};function isRTL(e){return"rtl"===getComputedStyle(e).direction}const platform={convertOffsetParentRelativeRectToViewportRelativeRect:convertOffsetParentRelativeRectToViewportRelativeRect,getDocumentElement:getDocumentElement,getClippingRect:getClippingRect,getOffsetParent:getOffsetParent,getElementRects:getElementRects,getClientRects:getClientRects,getDimensions:getDimensions,getScale:getScale,isElement:isElement$1,isRTL:isRTL};function observeMove(e,t){let n,r=null;const o=getDocumentElement(e);function i(){clearTimeout(n),r&&r.disconnect(),r=null}return function s(a,c){void 0===a&&(a=!1),void 0===c&&(c=1),i();const{left:l,top:u,width:f,height:d}=e.getBoundingClientRect();if(a||t(),!f||!d)return;const m={rootMargin:-floor(u)+"px "+-floor(o.clientWidth-(l+f))+"px "+-floor(o.clientHeight-(u+d))+"px "+-floor(l)+"px",threshold:max(0,min(1,c))||1};let p=!0;function g(e){const t=e[0].intersectionRatio;if(t!==c){if(!p)return s();t?s(!1,t):n=setTimeout((()=>{s(!1,1e-7)}),100)}p=!1}try{r=new IntersectionObserver(g,{...m,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(g,m)}r.observe(e)}(!0),i}function autoUpdate(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:c=!1}=r,l=unwrapElement(e),u=o||i?[...l?getOverflowAncestors(l):[],...getOverflowAncestors(t)]:[];u.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const f=l&&a?observeMove(l,n):null;let d,m=-1,p=null;s&&(p=new ResizeObserver((e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame((()=>{p&&p.observe(t)}))),n()})),l&&!c&&p.observe(l),p.observe(t));let g=c?getBoundingClientRect(e):null;return c&&function t(){const r=getBoundingClientRect(e);!g||r.x===g.x&&r.y===g.y&&r.width===g.width&&r.height===g.height||n();g=r,d=requestAnimationFrame(t)}(),n(),()=>{u.forEach((e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),f&&f(),p&&p.disconnect(),p=null,c&&cancelAnimationFrame(d)}}const computePosition=(e,t,n)=>{const r=new Map,o={platform:platform,...n},i={...o.platform,_c:r};return computePosition$1(e,t,{...o,platform:i})};var index$1="undefined"!=typeof document?React.useLayoutEffect:React.useEffect;function deepEqual(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;0!=r--;)if(!deepEqual(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!Object.prototype.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!deepEqual(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function useLatestRef$1(e){const t=React__namespace.useRef(e);return index$1((()=>{t.current=e})),t}function useFloating$1(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,whileElementsMounted:i,open:s}=e,[a,c]=React__namespace.useState({x:null,y:null,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[l,u]=React__namespace.useState(r);deepEqual(l,r)||u(r);const f=React__namespace.useRef(null),d=React__namespace.useRef(null),m=React__namespace.useRef(a),p=useLatestRef$1(i),g=useLatestRef$1(o),[v,h]=React__namespace.useState(null),[b,y]=React__namespace.useState(null),R=React__namespace.useCallback((e=>{f.current!==e&&(f.current=e,h(e))}),[]),_=React__namespace.useCallback((e=>{d.current!==e&&(d.current=e,y(e))}),[]),w=React__namespace.useCallback((()=>{if(!f.current||!d.current)return;const e={placement:t,strategy:n,middleware:l};g.current&&(e.platform=g.current),computePosition(f.current,d.current,e).then((e=>{const t={...e,isPositioned:!0};E.current&&!deepEqual(m.current,t)&&(m.current=t,ReactDOM__namespace.flushSync((()=>{c(t)})))}))}),[l,t,n,g]);index$1((()=>{!1===s&&m.current.isPositioned&&(m.current.isPositioned=!1,c((e=>({...e,isPositioned:!1}))))}),[s]);const E=React__namespace.useRef(!1);index$1((()=>(E.current=!0,()=>{E.current=!1})),[]),index$1((()=>{if(v&&b){if(p.current)return p.current(v,b,w);w()}}),[v,b,w,p]);const O=React__namespace.useMemo((()=>({reference:f,floating:d,setReference:R,setFloating:_})),[R,_]),x=React__namespace.useMemo((()=>({reference:v,floating:b})),[v,b]);return React__namespace.useMemo((()=>({...a,update:w,refs:O,elements:x,reference:R,floating:_})),[a,w,O,x,R,_])}var index="undefined"!=typeof document?React.useLayoutEffect:React.useEffect;function createPubSub(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){e.set(t,(e.get(t)||[]).filter((e=>e!==n)))}}}let serverHandoffComplete=!1,count=0;const genId=()=>"floating-ui-"+count++;function useFloatingId(){const[e,t]=React__namespace.useState((()=>serverHandoffComplete?genId():void 0));return index((()=>{null==e&&t(genId())}),[]),React__namespace.useEffect((()=>{serverHandoffComplete||(serverHandoffComplete=!0)}),[]),e}const useReactId=React__namespace["useId".toString()],useId$1=null!=useReactId?useReactId:useFloatingId,FloatingNodeContext=React__namespace.createContext(null),FloatingTreeContext=React__namespace.createContext(null),useFloatingParentNodeId=()=>{var e,t;return null!=(e=null==(t=React__namespace.useContext(FloatingNodeContext))?void 0:t.id)?e:null},useFloatingTree=()=>React__namespace.useContext(FloatingTreeContext);function getDocument(e){var t;return null!=(t=null==e?void 0:e.ownerDocument)?t:document}function getWindow(e){var t;return null!=(t=getDocument(e).defaultView)?t:window}function isElement(e){return!!e&&e instanceof getWindow(e).Element}function isHTMLElement(e){return!!e&&e instanceof getWindow(e).HTMLElement}const useInsertionEffect=React__namespace["useInsertionEffect".toString()];function useEvent(e){const t=React__namespace.useRef((()=>{if("production"!==process.env.NODE_ENV)throw new Error("Cannot call an event handler while rendering.")}));return useInsertionEffect?useInsertionEffect((()=>{t.current=e})):t.current=e,React__namespace.useCallback((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)}),[])}function useFloating(e){let{open:t=!1,onOpenChange:n,whileElementsMounted:r,placement:o,middleware:i,strategy:s,nodeId:a}=void 0===e?{}:e;const[c,l]=React__namespace.useState(null),u=useFloatingTree(),f=React__namespace.useRef(null),d=React__namespace.useRef({}),m=React__namespace.useState((()=>createPubSub()))[0],p=useFloating$1({placement:o,middleware:i,strategy:s,whileElementsMounted:r}),g=useEvent(n),v=React__namespace.useMemo((()=>({...p.refs,domReference:f})),[p.refs]),h=React__namespace.useMemo((()=>({...p,refs:v,dataRef:d,nodeId:a,events:m,open:t,onOpenChange:g,_:{domReference:c}})),[p,a,m,t,g,v,c]);index((()=>{const e=null==u?void 0:u.nodesRef.current.find((e=>e.id===a));e&&(e.context=h)}));const{reference:b}=p,y=React__namespace.useCallback((e=>{(isElement(e)||null===e)&&(h.refs.domReference.current=e,l(e)),b(e)}),[b,h.refs]);return React__namespace.useMemo((()=>({...p,context:h,refs:v,reference:y})),[p,v,h,y])}function mergeProps(e,t,n){const r=new Map;return{..."floating"===n&&{tabIndex:-1},...e,...t.map((e=>e?e[n]:null)).concat(e).reduce(((e,t)=>t?(Object.entries(t).forEach((t=>{let[n,o]=t;var i;0===n.indexOf("on")?(r.has(n)||r.set(n,[]),"function"==typeof o&&(null==(i=r.get(n))||i.push(o),e[n]=function(){for(var e,t=arguments.length,o=new Array(t),i=0;i<t;i++)o[i]=arguments[i];null==(e=r.get(n))||e.forEach((e=>e(...o)))})):e[n]=o})),e):e),{})}}const useInteractions=function(e){void 0===e&&(e=[]);const t=e,n=React__namespace.useCallback((t=>mergeProps(t,e,"reference")),t),r=React__namespace.useCallback((t=>mergeProps(t,e,"floating")),t),o=React__namespace.useCallback((t=>mergeProps(t,e,"item")),t);return React__namespace.useMemo((()=>({getReferenceProps:n,getFloatingProps:r,getItemProps:o})),[n,r,o])};function getChildren(e,t){var n;let r=null!=(n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})))?n:[],o=r;for(;o.length;){var i;o=null!=(i=e.filter((e=>{var t;return null==(t=o)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))})))?i:[],r=r.concat(o)}return r}function isPointInPolygon(e,t){const[n,r]=e;let o=!1;const i=t.length;for(let e=0,s=i-1;e<i;s=e++){const[i,a]=t[e]||[0,0],[c,l]=t[s]||[0,0];a>=r!=l>=r&&n<=(c-i)*(r-a)/(l-a)+i&&(o=!o)}return o}function safePolygon(e){let t,{restMs:n=0,buffer:r=.5,blockPointerEvents:o=!0,debug:i=null}=void 0===e?{}:e,s=!1;const a=e=>{let{x:o,y:a,placement:c,refs:l,onClose:u,nodeId:f,tree:d,leave:m=!1}=e;return function(e){var p,g,v;function h(){clearTimeout(t),u()}if(clearTimeout(t),e.pointerType&&"mouse"!==e.pointerType)return;const{clientX:b,clientY:y}=e,R="composedPath"in e?e.composedPath()[0]:e.target;if("pointermove"===e.type&&null!=(p=l.domReference.current)&&p.contains(R))return;if("mouseleave"===e.type&&isElement(e.relatedTarget)&&null!=(g=l.floating.current)&&g.contains(e.relatedTarget))return;if(d&&getChildren(d.nodesRef.current,f).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if(null!=(v=l.floating.current)&&v.contains(R)&&!m)return void(s=!0);if(!l.domReference.current||!l.floating.current||null==c||null==o||null==a)return;const _=l.domReference.current.getBoundingClientRect(),w=l.floating.current.getBoundingClientRect(),E=c.split("-")[0],O=o>w.right-w.width/2,x=a>w.bottom-w.height/2;if("top"===E&&a>=_.bottom-1||"bottom"===E&&a<=_.top+1||"left"===E&&o>=_.right-1||"right"===E&&o<=_.left+1)return h();switch(E){case"top":if(b>=w.left&&b<=w.right&&y>=w.top&&y<=_.top+1)return;break;case"bottom":if(b>=w.left&&b<=w.right&&y>=_.bottom-1&&y<=w.bottom)return;break;case"left":if(b>=w.left&&b<=_.left+1&&y>=w.top&&y<=w.bottom)return;break;case"right":if(b>=_.right-1&&b<=w.right&&y>=w.top&&y<=w.bottom)return}if(s)return h();const T=function(e){let[t,n]=e;const o=w.width>_.width,i=w.height>_.height;switch(E){case"top":return[[o?t+r/2:O?t+4*r:t-4*r,n+r+1],[o?t-r/2:O?t+4*r:t-4*r,n+r+1],...[[w.left,O||o?w.bottom-r:w.top],[w.right,O?o?w.bottom-r:w.top:w.bottom-r]]];case"bottom":return[[o?t+r/2:O?t+4*r:t-4*r,n-r],[o?t-r/2:O?t+4*r:t-4*r,n-r],...[[w.left,O||o?w.top+r:w.bottom],[w.right,O?o?w.top+r:w.bottom:w.top+r]]];case"left":{const e=[t+r+1,i?n+r/2:x?n+4*r:n-4*r],o=[t+r+1,i?n-r/2:x?n+4*r:n-4*r];return[...[[x||i?w.right-r:w.left,w.top],[x?i?w.right-r:w.left:w.right-r,w.bottom]],e,o]}case"right":return[[t-r,i?n+r/2:x?n+4*r:n-4*r],[t-r,i?n-r/2:x?n+4*r:n-4*r],...[[x||i?w.left+r:w.right,w.top],[x?i?w.left+r:w.right:w.left+r,w.bottom]]]}}([o,a]);"production"!==process.env.NODE_ENV&&(null==i||i(T.slice(0,4).join(", "))),isPointInPolygon([b,y],T)?n&&(t=setTimeout(u,n)):h()}};return a.__options={blockPointerEvents:o},a}function getTarget(e){return"composedPath"in e?e.composedPath()[0]:e.target}const TYPEABLE_SELECTOR="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function isTypeableElement(e){return isHTMLElement(e)&&e.matches(TYPEABLE_SELECTOR)}function useLatestRef(e){const t=React.useRef(e);return index((()=>{t.current=e})),t}function usePrevious(e){const t=React.useRef();return index((()=>{t.current=e}),[e]),t.current}function getDelay(e,t,n){return n&&"mouse"!==n?0:"number"==typeof e?e:null==e?void 0:e[t]}const useHover=function(e,t){let{enabled:n=!0,delay:r=0,handleClose:o=null,mouseOnly:i=!1,restMs:s=0,move:a=!0}=void 0===t?{}:t;const{open:c,onOpenChange:l,dataRef:u,events:f,refs:d,_:m}=e,p=useFloatingTree(),g=useFloatingParentNodeId(),v=useLatestRef(o),h=useLatestRef(r),b=usePrevious(c),y=React__namespace.useRef(),R=React__namespace.useRef(),_=React__namespace.useRef(),w=React__namespace.useRef(),E=React__namespace.useRef(!0),O=React__namespace.useRef(!1),x=React__namespace.useCallback((()=>{var e;const t=null==(e=u.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[u]);React__namespace.useEffect((()=>{if(n)return f.on("dismiss",e),()=>{f.off("dismiss",e)};function e(){clearTimeout(R.current),clearTimeout(w.current),E.current=!0}}),[n,f,d]),React__namespace.useEffect((()=>{if(!n||!v.current)return;function e(){x()&&l(!1)}const t=getDocument(d.floating.current).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[d,l,n,v,u,x]);const T=React__namespace.useCallback((function(e){void 0===e&&(e=!0);const t=getDelay(h.current,"close",y.current);t&&!_.current?(clearTimeout(R.current),R.current=setTimeout((()=>l(!1)),t)):e&&(clearTimeout(R.current),l(!1))}),[h,l]),S=React__namespace.useCallback((()=>{_.current&&(getDocument(d.floating.current).removeEventListener("pointermove",_.current),_.current=void 0)}),[d]),$=React__namespace.useCallback((()=>{getDocument(d.floating.current).body.style.pointerEvents="",O.current=!1}),[d]);return React__namespace.useEffect((()=>{if(!n)return;function t(){return!!u.current.openEvent&&["click","mousedown"].includes(u.current.openEvent.type)}function r(e){if(clearTimeout(R.current),E.current=!1,i&&"mouse"!==y.current||s>0&&0===getDelay(h.current,"open"))return;u.current.openEvent=e;const t=getDelay(h.current,"open",y.current);t?R.current=setTimeout((()=>{l(!0)}),t):l(!0)}function o(n){if(t())return;const r=getDocument(d.floating.current);if(clearTimeout(w.current),v.current)return clearTimeout(R.current),_.current&&r.removeEventListener("pointermove",_.current),_.current=v.current({...e,tree:p,x:n.clientX,y:n.clientY,onClose(){$(),S(),T()}}),void r.addEventListener("pointermove",_.current);T()}function f(n){t()||null==v.current||v.current({...e,tree:p,x:n.clientX,y:n.clientY,leave:!0,onClose(){$(),S(),T()}})(n)}const m=d.floating.current,g=d.domReference.current;return isElement(g)?(c&&g.addEventListener("mouseleave",f),null==m||m.addEventListener("mouseleave",f),a&&g.addEventListener("mousemove",r,{once:!0}),g.addEventListener("mouseenter",r),g.addEventListener("mouseleave",o),()=>{c&&g.removeEventListener("mouseleave",f),null==m||m.removeEventListener("mouseleave",f),a&&g.removeEventListener("mousemove",r),g.removeEventListener("mouseenter",r),g.removeEventListener("mouseleave",o)}):void 0}),[m.domReference,n,e,i,s,a,T,S,$,l,c,p,d,h,v,u]),index((()=>{if(n&&c&&v.current&&v.current.__options.blockPointerEvents&&x()){getDocument(d.floating.current).body.style.pointerEvents="none",O.current=!0;const n=d.domReference.current,r=d.floating.current;if(isElement(n)&&r){var e,t;const o=null==p||null==(e=p.nodesRef.current.find((e=>e.id===g)))||null==(t=e.context)?void 0:t.refs.floating.current;return o&&(o.style.pointerEvents=""),n.style.pointerEvents="auto",r.style.pointerEvents="auto",()=>{n.style.pointerEvents="",r.style.pointerEvents=""}}}}),[n,c,g,d,p,v,u,x]),index((()=>{b&&!c&&(y.current=void 0,S(),$())})),React__namespace.useEffect((()=>()=>{S(),clearTimeout(R.current),clearTimeout(w.current),O.current&&$()}),[n,S,$]),React__namespace.useMemo((()=>{if(!n)return{};function e(e){y.current=e.pointerType}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove(){c||0===s||(clearTimeout(w.current),w.current=setTimeout((()=>{E.current||l(!0)}),s))}},floating:{onMouseEnter(){clearTimeout(R.current)},onMouseLeave(){T(!1)}}}}),[n,s,c,l,T])},useRole=function(e,t){let{open:n}=e,{enabled:r=!0,role:o="dialog"}=void 0===t?{}:t;const i=useId$1(),s=useId$1();return React__namespace.useMemo((()=>{const e={id:i,role:o};return r?"tooltip"===o?{reference:{"aria-describedby":n?i:void 0},floating:e}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":"alertdialog"===o?"dialog":o,"aria-controls":n?i:void 0,..."listbox"===o&&{role:"combobox"},..."menu"===o&&{id:s}},floating:{...e,..."menu"===o&&{"aria-labelledby":s}}}:{}}),[r,o,n,i,s])};function isButtonTarget(e){return isHTMLElement(e.target)&&"BUTTON"===e.target.tagName}function isSpaceIgnored(e){return isTypeableElement(e)}const useClick=function(e,t){let{open:n,onOpenChange:r,dataRef:o,refs:i}=e,{enabled:s=!0,event:a="click",toggle:c=!0,ignoreMouse:l=!1,keyboardHandlers:u=!0}=void 0===t?{}:t;const f=React__namespace.useRef();return React__namespace.useMemo((()=>s?{reference:{onPointerDown(e){f.current=e.pointerType},onMouseDown(e){0===e.button&&("mouse"===f.current&&l||"click"!==a&&(n?!c||o.current.openEvent&&"mousedown"!==o.current.openEvent.type||r(!1):r(!0),o.current.openEvent=e.nativeEvent))},onClick(e){"mousedown"===a&&f.current?f.current=void 0:"mouse"===f.current&&l||(n?!c||o.current.openEvent&&"click"!==o.current.openEvent.type||r(!1):r(!0),o.current.openEvent=e.nativeEvent)},onKeyDown(e){f.current=void 0,u&&(isButtonTarget(e)||(" "!==e.key||isSpaceIgnored(i.domReference.current)||e.preventDefault(),"Enter"===e.key&&(n?c&&r(!1):r(!0))))},onKeyUp(e){u&&(isButtonTarget(e)||isSpaceIgnored(i.domReference.current)||" "===e.key&&(n?c&&r(!1):r(!0)))}}}:{}),[s,o,a,l,u,i,c,n,r])};function isEventTargetWithin(e,t){if(null==t)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return null!=n.target&&t.contains(n.target)}const bubbleHandlerKeys={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},captureHandlerKeys={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},useDismiss=function(e,t){let{open:n,onOpenChange:r,refs:o,events:i,nodeId:s}=e,{enabled:a=!0,escapeKey:c=!0,outsidePress:l=!0,outsidePressEvent:u="pointerdown",referencePress:f=!1,referencePressEvent:d="pointerdown",ancestorScroll:m=!1,bubbles:p=!0}=void 0===t?{}:t;const g=useFloatingTree(),v=null!=useFloatingParentNodeId(),h=React__namespace.useRef(!1);return React__namespace.useEffect((()=>{if(!n||!a)return;function e(e){if("Escape"===e.key){if(!p&&g&&getChildren(g.nodesRef.current,s).length>0)return;i.emit("dismiss",{preventScroll:!1}),r(!1)}}function t(e){const t=h.current;if(h.current=!1,t)return;const n=getTarget(e);if(isElement(n)&&o.floating.current){var a;const t=null!=(a=o.floating.current.ownerDocument.defaultView)?a:window,r=n.scrollWidth>n.clientWidth,i=n.scrollHeight>n.clientHeight;let s=i&&e.offsetX>n.clientWidth;if(i){"rtl"===t.getComputedStyle(n).direction&&(s=e.offsetX<=n.offsetWidth-n.clientWidth)}if(s||r&&e.offsetY>n.clientHeight)return}const c=g&&getChildren(g.nodesRef.current,s).some((t=>{var n;return isEventTargetWithin(e,null==(n=t.context)?void 0:n.refs.floating.current)}));isEventTargetWithin(e,o.floating.current)||isEventTargetWithin(e,o.domReference.current)||c||!p&&g&&getChildren(g.nodesRef.current,s).length>0||(i.emit("dismiss",!!v&&{preventScroll:!0}),r(!1))}function f(){r(!1)}const d=getDocument(o.floating.current);c&&d.addEventListener("keydown",e),l&&d.addEventListener(u,t);let b=[];return m&&(isElement(o.domReference.current)&&(b=getOverflowAncestors(o.domReference.current)),isElement(o.floating.current)&&(b=b.concat(getOverflowAncestors(o.floating.current))),!isElement(o.reference.current)&&o.reference.current&&o.reference.current.contextElement&&(b=b.concat(getOverflowAncestors(o.reference.current.contextElement)))),b=b.filter((e=>{var t;return e!==(null==(t=d.defaultView)?void 0:t.visualViewport)})),b.forEach((e=>{e.addEventListener("scroll",f,{passive:!0})})),()=>{c&&d.removeEventListener("keydown",e),l&&d.removeEventListener(u,t),b.forEach((e=>{e.removeEventListener("scroll",f)}))}}),[c,l,u,i,g,s,n,r,m,a,p,o,v]),React__namespace.useEffect((()=>{h.current=!1}),[l,u]),React__namespace.useMemo((()=>a?{reference:{[bubbleHandlerKeys[d]]:()=>{f&&(i.emit("dismiss"),r(!1))}},floating:{[captureHandlerKeys[u]]:()=>{h.current=!0}}}:{}),[a,i,f,u,d,r])},useFocus=function(e,t){let{open:n,onOpenChange:r,dataRef:o,refs:i,events:s}=e,{enabled:a=!0,keyboardOnly:c=!0}=void 0===t?{}:t;const l=React__namespace.useRef(""),u=React__namespace.useRef(!1),f=React__namespace.useRef();return React__namespace.useEffect((()=>{var e;if(!a)return;const t=null!=(e=getDocument(i.floating.current).defaultView)?e:window;function r(){!n&&isHTMLElement(i.domReference.current)&&i.domReference.current.blur()}return t.addEventListener("blur",r),()=>{t.removeEventListener("blur",r)}}),[i,n,a]),React__namespace.useEffect((()=>{if(a)return s.on("dismiss",e),()=>{s.off("dismiss",e)};function e(){u.current=!0}}),[s,a]),React__namespace.useEffect((()=>()=>{clearTimeout(f.current)}),[]),React__namespace.useMemo((()=>a?{reference:{onPointerDown(e){let{pointerType:t}=e;l.current=t,u.current=!(!t||!c)},onPointerLeave(){u.current=!1},onFocus(e){var t,n,s;u.current||"focus"===e.type&&"mousedown"===(null==(t=o.current.openEvent)?void 0:t.type)&&null!=(n=i.domReference.current)&&n.contains(null==(s=o.current.openEvent)?void 0:s.target)||(o.current.openEvent=e.nativeEvent,r(!0))},onBlur(e){const t=e.relatedTarget;f.current=setTimeout((()=>{var e,n;null!=(e=i.floating.current)&&e.contains(t)||null!=(n=i.domReference.current)&&n.contains(t)||(u.current=!1,r(!1))}))}}}:{}),[a,c,i,o,r])};var isEnabled=function(e,t){var n;return e?null!==(n=e.enabled)&&void 0!==n?n:t:null!==e&&!1!==e&&t},DefaultFlipConfig={enabled:!0,fallbackPlacements:void 0,padding:void 0},DefaultOffsetConfig={enabled:!0,offset:[6,0]},useAutoPosition=function(e){void 0===e&&(e={});var t=React.useState(!1),n=t[0],r=t[1],o={placement:e.placement||"bottom-start",auto:isEnabled(e.auto,!1)&&__assign$1({},e.auto),flip:isEnabled(e.flip,!0)&&__assign$1(__assign$1({},DefaultFlipConfig),e.flip),offset:isEnabled(e.offset,!0)&&__assign$1(__assign$1({},DefaultOffsetConfig),e.offset),shift:isEnabled(e.shift,!1)&&__assign$1({},e.shift)},i=[];if(o.flip&&!o.auto&&i.push(flip({fallbackPlacements:o.flip.fallbackPlacements,padding:o.flip.padding})),o.auto&&i.push(autoPlacement({alignment:o.auto.alignment})),o.offset){var s=o.offset.offset||DefaultOffsetConfig.offset,a=s[0],c=s[1];i.push(offset({mainAxis:a,crossAxis:c}))}o.shift&&i.push(shift());var l=useFloating({open:n,onOpenChange:r,placement:o.placement,middleware:i,whileElementsMounted:autoUpdate}),u=l.x,f=l.y,d=l.reference,m=l.floating,p=l.strategy;return{_context:l.context,_open:n,triggerRef:d,floatRef:m,styles:React.useMemo((function(){return{position:p,left:null!=u?u:"auto",top:null!=f?f:"auto"}}),[u,f,p])}},DefaultHoverConfig={enabled:!0,delay:null,interactive:!0},DefaultRoleConfig={enabled:!1,role:null},DefaultClickConfig={enabled:!1},DefaultFocusConfig={enabled:!0},DefaultDismissConfig={enabled:!0},useAutoInteractions=function(e){void 0===e&&(e={});var t=e.hover,n=e.click,r=e.focus,o=e.dismiss,i=e.role,s=__rest$1(e,["hover","click","focus","dismiss","role"]),a={hover:isEnabled(t,!0)&&__assign$1(__assign$1({},DefaultHoverConfig),t),click:isEnabled(n,!0)&&__assign$1(__assign$1({},DefaultClickConfig),e.click),focus:isEnabled(r,!0)&&__assign$1(__assign$1({},DefaultFocusConfig),r),role:isEnabled(i,!0)&&__assign$1(__assign$1({},DefaultRoleConfig),i),dismiss:isEnabled(o,!0)&&__assign$1(__assign$1({},DefaultDismissConfig),o)},c=useAutoPosition(s),l=c._context,u=c._open,f=__rest$1(c,["_context","_open"]),d=useHover(l,__assign$1(__assign$1({},a.hover||{enabled:!1}),{delay:a.hover&&a.hover.delay||void 0,handleClose:a.hover&&a.hover.interactive?safePolygon():null})),m=useFocus(l,__assign$1({},a.focus||{enabled:!1})),p=useClick(l,__assign$1({},a.click||{enabled:!1})),g=useDismiss(l,__assign$1({},a.dismiss||{enabled:!1})),v=useRole(l,__assign$1(__assign$1({},a.role||{enabled:!1}),{role:a.role&&a.role.role||void 0})),h=useInteractions([d,m,v,g,p]),b=h.getReferenceProps,y=h.getFloatingProps;return __assign$1({open:u,getTriggerProps:b,getFloatProps:y},f)};function useEventListener(e,t,n,r){void 0===n&&(n=global),void 0===r&&(r={});var o=React.useRef(),i=r.capture,s=r.passive,a=r.once;React.useEffect((function(){o.current=t}),[t]),React.useEffect((function(){if(n&&n.addEventListener){var t=function(e){return o.current(e)},r={capture:i,passive:s,once:a};return n.addEventListener(e,t,r),function(){n.removeEventListener(e,t,r)}}}),[e,n,i,s,a])}function useClickOutside(e){var t=React.useState(null),n=t[0],r=t[1];return useEventListener("click",(function(t){(null==n?void 0:n.contains(t.target))||e(t)}),document,{capture:!0}),r}var FUNC_ERROR_TEXT="Expected a function",NAN=NaN,symbolTag="[object Symbol]",reTrim=/^\s+|\s+$/g,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsOctal=/^0o[0-7]+$/i,freeParseInt=parseInt,freeGlobal="object"==typeof commonjsGlobal&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,freeSelf="object"==typeof self&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),objectProto=Object.prototype,objectToString=objectProto.toString,nativeMax=Math.max,nativeMin=Math.min,now=function(){return root.Date.now()};function debounce(e,t,n){var r,o,i,s,a,c,l=0,u=!1,f=!1,d=!0;if("function"!=typeof e)throw new TypeError(FUNC_ERROR_TEXT);function m(t){var n=r,i=o;return r=o=void 0,l=t,s=e.apply(i,n)}function p(e){var n=e-c;return void 0===c||n>=t||n<0||f&&e-l>=i}function g(){var e=now();if(p(e))return v(e);a=setTimeout(g,function(e){var n=t-(e-c);return f?nativeMin(n,i-(e-l)):n}(e))}function v(e){return a=void 0,d&&r?m(e):(r=o=void 0,s)}function h(){var e=now(),n=p(e);if(r=arguments,o=this,c=e,n){if(void 0===a)return function(e){return l=e,a=setTimeout(g,t),u?m(e):s}(c);if(f)return a=setTimeout(g,t),m(c)}return void 0===a&&(a=setTimeout(g,t)),s}return t=toNumber(t)||0,isObject(n)&&(u=!!n.leading,i=(f="maxWait"in n)?nativeMax(toNumber(n.maxWait)||0,t):i,d="trailing"in n?!!n.trailing:d),h.cancel=function(){void 0!==a&&clearTimeout(a),l=0,r=c=o=a=void 0},h.flush=function(){return void 0===a?s:v(now())},h}function isObject(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function isObjectLike(e){return!!e&&"object"==typeof e}function isSymbol(e){return"symbol"==typeof e||isObjectLike(e)&&objectToString.call(e)==symbolTag}function toNumber(e){if("number"==typeof e)return e;if(isSymbol(e))return NAN;if(isObject(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=isObject(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(reTrim,"");var n=reIsBinary.test(e);return n||reIsOctal.test(e)?freeParseInt(e.slice(2),n?2:8):reIsBadHex.test(e)?NAN:+e}var lodash_debounce=debounce,isScrollable=function(e){return e.scrollHeight>e.clientHeight},scrollHandler=function(e){return function(t){if(t.target instanceof HTMLElement){var n=t.target.clientHeight,r=t.target.scrollHeight,o=t.target.scrollTop/(r-n)*100;e(Math.round(o))}}},useScrollObserver=function(e){var t=React.useState(null),n=t[0],r=t[1];return React.useEffect((function(){if(n&&isScrollable(n)){var t=lodash_debounce(scrollHandler(e),50,{leading:!0,trailing:!0});return n.addEventListener("scroll",t),n.dispatchEvent(new Event("scroll")),function(){return n.removeEventListener("scroll",t)}}}),[n,e]),{setElement:r}},useId=function(e){return React.useMemo((function(){return utilsCommons.uniqueId(e)}),[e])};exports.useAutoInteractions=useAutoInteractions,exports.useAutoPosition=useAutoPosition,exports.useAutoPositioner=useAutoPositioner,exports.useClickOutside=useClickOutside,exports.useForkRef=useForkRef,exports.useId=useId,exports.useScrollObserver=useScrollObserver;
//# sourceMappingURL=/sm/30f389bff3f799fb918743155e09761fa2d0e4149481e10fe2f576df8fff1880.map