Socket
Socket
Sign inDemoInstall

@floating-ui/react-dom-interactions

Package Overview
Dependencies
Maintainers
2
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@floating-ui/react-dom-interactions - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

LICENSE

309

dist/floating-ui.react-dom-interactions.esm.js

@@ -1,3 +0,3 @@

import * as React from 'react';
import React__default, { useLayoutEffect, useEffect, useContext, useMemo, useRef, useCallback, useState, createContext, forwardRef } from 'react';
import * as React$1 from 'react';
import React__default, { useLayoutEffect, useEffect, useContext, useMemo, useRef, useCallback, useState, createContext, forwardRef, cloneElement } from 'react';
import { getOverflowAncestors, useFloating as useFloating$1 } from '@floating-ui/react-dom';

@@ -37,3 +37,3 @@ export * from '@floating-ui/react-dom';

function useFloatingId() {
const [id, setId] = React.useState(() => serverHandoffComplete ? genId() : undefined);
const [id, setId] = React$1.useState(() => serverHandoffComplete ? genId() : undefined);
index(() => {

@@ -45,3 +45,3 @@ if (id == null) {

}, []);
React.useEffect(() => {
React$1.useEffect(() => {
if (!serverHandoffComplete) {

@@ -55,3 +55,3 @@ serverHandoffComplete = true;

const useReactId = React[/*#__PURE__*/'useId'.toString()];
const useReactId = React$1[/*#__PURE__*/'useId'.toString()];
/**

@@ -526,2 +526,7 @@ * Uses React 18's built-in `useId()` when available, or falls back to a

function stopEvent(event) {
event.preventDefault();
event.stopPropagation();
}
function useLatestRef(value) {

@@ -535,2 +540,185 @@ const ref = useRef(value);

function focus$1(el) {
requestAnimationFrame(() => {
el == null ? void 0 : el.focus();
});
}
const SELECTOR = "input:not([type='hidden']):not([disabled]),select:not([disabled])," + 'textarea:not([disabled]),a[href],button:not([disabled]),[tabindex],' + 'iframe,object,embed,area[href],audio[controls],video[controls],' + "[contenteditable]:not([contenteditable='false'])";
const FocusGuard = /*#__PURE__*/forwardRef(function FocusGuard(props, ref) {
return /*#__PURE__*/React.createElement("span", _extends({}, props, {
ref: ref,
tabIndex: 0,
style: {
position: 'fixed',
opacity: '0',
pointerEvents: 'none',
outline: '0'
}
}));
});
/**
* Provides focus management for the floating element.
* @see https://floating-ui.com/docs/FloatingFocusManager
*/
function FloatingFocusManager(_ref) {
let {
context: {
refs,
nodeId,
onOpenChange
},
children,
order = ['content'],
endGuard = true,
preventTabbing = false,
initialFocus = 0,
returnFocus = true,
modal = true
} = _ref;
const orderRef = useLatestRef(order);
const onOpenChangeRef = useLatestRef(onOpenChange);
const tree = useFloatingTree();
const getTabbableElements = useCallback(() => {
return orderRef.current.map(type => {
if (isHTMLElement(refs.reference.current) && type === 'reference') {
return refs.reference.current;
}
if (refs.floating.current && type === 'floating') {
return refs.floating.current;
}
if (type === 'content') {
var _refs$floating$curren, _refs$floating$curren2;
return Array.from((_refs$floating$curren = (_refs$floating$curren2 = refs.floating.current) == null ? void 0 : _refs$floating$curren2.querySelectorAll(SELECTOR)) != null ? _refs$floating$curren : []);
}
return null;
}).flat().filter(el => {
if (el === refs.floating.current || el === refs.reference.current) {
return true;
}
if (isHTMLElement(el)) {
var _el$getAttribute;
const tabIndex = (_el$getAttribute = el.getAttribute('tabindex')) != null ? _el$getAttribute : '0';
return tabIndex[0].trim() !== '-';
}
});
}, [orderRef, refs.floating, refs.reference]);
useEffect(() => {
// If the floating element has no focusable elements inside it, fallback
// to focusing the floating element and preventing tab navigation
const noTabbableContentElements = getTabbableElements().filter(el => el !== refs.floating.current && // @ts-expect-error
el !== refs.reference.current).length === 0;
function onKeyDown(event) {
if (event.key === 'Tab') {
if (preventTabbing || noTabbableContentElements) {
stopEvent(event);
}
const els = getTabbableElements();
if (orderRef.current[0] === 'reference' && event.target === refs.reference.current) {
stopEvent(event);
if (event.shiftKey) {
focus$1(els[els.length - 1]);
} else {
focus$1(els[1]);
}
}
if (orderRef.current[1] === 'floating' && event.target === refs.floating.current && event.shiftKey) {
stopEvent(event);
focus$1(els[0]);
}
}
}
const doc = getDocument(refs.floating.current);
doc.addEventListener('keydown', onKeyDown);
return () => {
doc.removeEventListener('keydown', onKeyDown);
};
}, [preventTabbing, getTabbableElements, orderRef, refs.floating, refs.reference]);
useEffect(() => {
function onFloatingFocusOut(event) {
var _refs$floating$curren3;
const target = event.relatedTarget;
if (!((_refs$floating$curren3 = refs.floating.current) != null && _refs$floating$curren3.contains(target)) && isElement(refs.reference.current) && !refs.reference.current.contains(target) && !(tree && getChildren(tree, nodeId).some(child => {
var _child$context, _child$context$refs$f;
return (_child$context = child.context) == null ? void 0 : (_child$context$refs$f = _child$context.refs.floating.current) == null ? void 0 : _child$context$refs$f.contains(target);
}))) {
onOpenChangeRef.current(false);
}
}
const floating = refs.floating.current;
const reference = refs.reference.current;
if (floating && isHTMLElement(reference)) {
!modal && floating.addEventListener('focusout', onFloatingFocusOut);
const cleanup = modal ? hideOthers(floating) : null;
return () => {
!modal && floating.removeEventListener('focusout', onFloatingFocusOut);
cleanup == null ? void 0 : cleanup();
};
}
}, [nodeId, tree, modal, onOpenChangeRef, getTabbableElements, initialFocus, refs.floating, refs.reference]);
useEffect(() => {
var _getDocument$activeEl;
if (preventTabbing) {
return;
}
const floating = refs.floating.current;
const previouslyFocusedElement = (_getDocument$activeEl = getDocument(floating).activeElement) != null ? _getDocument$activeEl : document.activeElement;
if (typeof initialFocus === 'number') {
var _getTabbableElements$;
focus$1((_getTabbableElements$ = getTabbableElements()[initialFocus]) != null ? _getTabbableElements$ : floating);
} else if (isHTMLElement(initialFocus == null ? void 0 : initialFocus.current)) {
var _initialFocus$current;
focus$1((_initialFocus$current = initialFocus.current) != null ? _initialFocus$current : floating);
}
return () => {
if (returnFocus && isHTMLElement(previouslyFocusedElement)) {
focus$1(previouslyFocusedElement);
}
};
}, [preventTabbing, getTabbableElements, initialFocus, modal, returnFocus, refs.floating]);
return /*#__PURE__*/React.createElement(React.Fragment, null, modal && /*#__PURE__*/React.createElement(FocusGuard, {
onFocus: event => {
stopEvent(event);
const els = getTabbableElements();
if (order[0] === 'reference') {
focus$1(els[0]);
} else {
focus$1(els[els.length - 1]);
}
}
}), /*#__PURE__*/cloneElement(children, order.includes('floating') ? {
tabIndex: 0
} : {}), modal && endGuard && /*#__PURE__*/React.createElement(FocusGuard, {
onFocus: event => {
stopEvent(event);
focus$1(getTabbableElements()[0]);
}
}));
}
function getDelay(value, prop, pointerType) {

@@ -887,3 +1075,4 @@ if (pointerType && pointerType !== 'mouse') {

enabled = true,
pointerDown = false
pointerDown = false,
toggle = true
} = _temp === void 0 ? {} : _temp;

@@ -904,3 +1093,3 @@ const pointerTypeRef = useRef();

if (((_dataRef$current$open = dataRef.current.openEvent) == null ? void 0 : _dataRef$current$open.type) === 'pointerdown') {
if (toggle && ((_dataRef$current$open = dataRef.current.openEvent) == null ? void 0 : _dataRef$current$open.type) === 'pointerdown') {
onOpenChange(false);

@@ -926,3 +1115,3 @@ }

if (((_dataRef$current$open2 = dataRef.current.openEvent) == null ? void 0 : _dataRef$current$open2.type) === 'click') {
if (toggle && ((_dataRef$current$open2 = dataRef.current.openEvent) == null ? void 0 : _dataRef$current$open2.type) === 'click') {
onOpenChange(false);

@@ -1057,3 +1246,3 @@ }

/**
* Adds hover event listeners that change the open state, like CSS :focus.
* Adds focus event listeners that change the open state, like CSS :focus.
* @see https://floating-ui.com/docs/useFocus

@@ -1168,7 +1357,2 @@ */

function stopEvent(event) {
event.preventDefault();
event.stopPropagation();
}
const FOCUSABLE_ELEMENT_SELECTOR = 'a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,*[tabindex],*[contenteditable]';

@@ -1185,5 +1369,3 @@ const DEFAULT_ORDER = ['content'];

/**
* Traps focus in a loop of focusable elements while the floating element is
* open.
* @see https://floating-ui.com/docs/useFocusTrap
* @deprecated Use `<FloatingFocusManager />` instead.
*/

@@ -1406,2 +1588,10 @@

function usePrevious(value) {
const ref = useRef();
index(() => {
ref.current = value;
}, [value]);
return ref.current;
}
const ARROW_UP = 'ArrowUp';

@@ -1417,3 +1607,3 @@ const ARROW_DOWN = 'ArrowDown';

} = _temp === void 0 ? {} : _temp;
const list = getPresentListItems(listRef);
const list = listRef.current;
let index = startingIndex;

@@ -1425,5 +1615,5 @@

index = index + (decrement ? -1 : 1);
} while ((_list$index = list[index]) != null && _list$index.hasAttribute('disabled') || ((_list$index2 = list[index]) == null ? void 0 : _list$index2.getAttribute('aria-disabled')) === 'true');
} while (index >= 0 && index <= list.length - 1 && (list[index] == null || (_list$index = list[index]) != null && _list$index.hasAttribute('disabled') || ((_list$index2 = list[index]) == null ? void 0 : _list$index2.getAttribute('aria-disabled')) === 'true'));
return index === -1 ? 0 : index;
return index;
}

@@ -1481,10 +1671,6 @@

decrement: true,
startingIndex: getPresentListItems(listRef).length
startingIndex: listRef.current.length
});
}
function getPresentListItems(listRef) {
return listRef.current.filter(item => item != null);
}
/**

@@ -1507,2 +1693,3 @@ * Adds focus-managed indexed navigation via arrow keys to a list of items

selectedIndex = null,
allowEscape = false,
loop = false,

@@ -1522,4 +1709,12 @@ nested = false,

} : _temp2;
if (process.env.NODE_ENV !== "production") {
if (!loop && allowEscape) {
console.warn(['Floating UI: `useListNavigation` looping must be enabled to allow', 'escaping.'].join(' '));
}
}
const parentId = useFloatingParentNodeId();
const tree = useFloatingTree();
const previousOpen = usePrevious(open);
const focusOnOpenRef = useRef(focusItemOnOpen);

@@ -1534,9 +1729,9 @@ const indexRef = useRef(selectedIndex != null ? selectedIndex : -1);

if (virtual) {
var _getPresentListItems$;
var _listRef$current$inde;
setActiveId((_getPresentListItems$ = getPresentListItems(listRef)[indexRef.current]) == null ? void 0 : _getPresentListItems$.id);
setActiveId((_listRef$current$inde = listRef.current[indexRef.current]) == null ? void 0 : _listRef$current$inde.id);
} else {
var _getPresentListItems$2;
var _listRef$current$inde2;
(_getPresentListItems$2 = getPresentListItems(listRef)[indexRef.current]) == null ? void 0 : _getPresentListItems$2.focus({
(_listRef$current$inde2 = listRef.current[indexRef.current]) == null ? void 0 : _listRef$current$inde2.focus({
preventScroll: true

@@ -1555,7 +1750,7 @@ });

if (open && focusOnOpenRef.current) {
if (!previousOpen && open && focusOnOpenRef.current) {
onNavigateRef.current(indexRef.current);
focusItem(listRef, indexRef);
}
}, [open, selectedIndex, listRef, onNavigateRef, focusItem, enabled]);
}, [open, previousOpen, selectedIndex, listRef, onNavigateRef, focusItem, enabled]);
index(() => {

@@ -1566,8 +1761,16 @@ if (!enabled) {

if (open && activeIndex != null) {
indexRef.current = activeIndex;
onNavigateRef.current(indexRef.current);
focusItem(listRef, indexRef);
if (open) {
if (activeIndex === null) {
if (!previousOpen && focusOnOpenRef.current && selectedIndex == null || allowEscape) {
indexRef.current = allowEscape ? -1 : getMinIndex(listRef);
onNavigateRef.current(activeIndex);
focusItem(listRef, indexRef);
}
} else {
indexRef.current = activeIndex;
onNavigateRef.current(activeIndex);
focusItem(listRef, indexRef);
}
}
}, [open, activeIndex, selectedIndex, listRef, onNavigateRef, focusItem, enabled, parentId, refs.floating, tree == null ? void 0 : tree.nodesRef]);
}, [open, previousOpen, activeIndex, selectedIndex, nested, listRef, onNavigateRef, focusItem, enabled, parentId, allowEscape, refs.floating, tree == null ? void 0 : tree.nodesRef]);
index(() => {

@@ -1580,3 +1783,5 @@ if (selectedIndex != null || !enabled) {

if (isMainOrientationKey(keyRef.current, orientation) || focusOnOpenRef.current && (keyRef.current === ' ' || keyRef.current === 'Enter')) {
indexRef.current = isMainOrientationToStartKey(keyRef.current, orientation, rtl) ? getMaxIndex(listRef) : getMinIndex(listRef);
const minIndex = getMinIndex(listRef);
const maxIndex = getMaxIndex(listRef);
indexRef.current = isMainOrientationToStartKey(keyRef.current, orientation, rtl) ? allowEscape ? listRef.current.length : maxIndex : allowEscape ? -1 : minIndex;
onNavigateRef.current(indexRef.current);

@@ -1588,3 +1793,3 @@ focusItem(listRef, indexRef);

keyRef.current = '';
}, [open, listRef, selectedIndex, onNavigateRef, focusItem, enabled, orientation, rtl]);
}, [open, listRef, selectedIndex, onNavigateRef, focusItem, enabled, orientation, rtl, allowEscape]);
index(() => {

@@ -1668,3 +1873,3 @@ if (!enabled) {

if (loop) {
indexRef.current = currentIndex >= maxIndex ? minIndex : findNonDisabledIndex(listRef, {
indexRef.current = currentIndex >= maxIndex ? allowEscape && currentIndex !== listRef.current.length ? -1 : minIndex : findNonDisabledIndex(listRef, {
startingIndex: currentIndex

@@ -1679,3 +1884,3 @@ });

if (loop) {
indexRef.current = currentIndex <= minIndex ? maxIndex : findNonDisabledIndex(listRef, {
indexRef.current = currentIndex <= minIndex ? allowEscape && currentIndex !== -1 ? listRef.current.length : maxIndex : findNonDisabledIndex(listRef, {
startingIndex: currentIndex,

@@ -1701,3 +1906,3 @@ decrement: true

return {
reference: { ...(virtual && open && {
reference: { ...(virtual && open && activeIndex != null && {
'aria-activedescendant': activeId

@@ -1723,6 +1928,10 @@ }),

if (isCrossOrientationOpenKey(event.key, orientation, rtl)) {
indexRef.current = getMinIndex(listRef);
stopEvent(event);
onOpenChange(true);
onNavigate(indexRef.current);
if (open) {
indexRef.current = getMinIndex(listRef);
onNavigate(indexRef.current);
} else {
onOpenChange(true);
}
}

@@ -1753,3 +1962,3 @@

'aria-orientation': orientation === 'both' ? undefined : orientation,
...(virtual && {
...(virtual && activeIndex != null && {
'aria-activedescendant': activeId

@@ -1782,3 +1991,3 @@ }),

if (target) {
const index = getPresentListItems(listRef).indexOf(target);
const index = listRef.current.indexOf(target);

@@ -1865,3 +2074,3 @@ if (index !== -1) {

if (stringRef.current.length > 0) {
if (stringRef.current.length > 0 && stringRef.current[0] !== ' ') {
dataRef.current.typing = true;

@@ -1885,3 +2094,3 @@

return text ? ((_text$ = text[0]) == null ? void 0 : _text$.toLowerCase()) !== ((_text$2 = text[1]) == null ? void 0 : _text$2.toLowerCase()) : true;
return text ? ((_text$ = text[0]) == null ? void 0 : _text$.toLocaleLowerCase()) !== ((_text$2 = text[1]) == null ? void 0 : _text$2.toLocaleLowerCase()) : true;
}); // Allows the user to cycle through items that start with the same letter

@@ -1904,3 +2113,3 @@ // in rapid succession

const orderedList = [...listContent.slice((prevIndex != null ? prevIndex : 0) + 1), ...listContent.slice(0, (prevIndex != null ? prevIndex : 0) + 1)];
const str = findMatch ? findMatch(orderedList, stringRef.current) : orderedList.find(text => (text == null ? void 0 : text.toLowerCase().indexOf(stringRef.current)) === 0);
const str = findMatch ? findMatch(orderedList, stringRef.current) : orderedList.find(text => (text == null ? void 0 : text.toLocaleLowerCase().indexOf(stringRef.current)) === 0);
const index = str ? listContent.indexOf(str) : -1;

@@ -1965,2 +2174,2 @@

export { FloatingDelayGroup, FloatingNode, FloatingOverlay, FloatingPortal, FloatingTree, safePolygon, useClick, useDelayGroup, useDelayGroupContext, useDismiss, useFloating, useFloatingNodeId, useFloatingParentNodeId, useFloatingTree, useFocus, useFocusTrap, useHover, useId, useInteractions, useListNavigation, useRole, useTypeahead };
export { FloatingDelayGroup, FloatingFocusManager, FloatingNode, FloatingOverlay, FloatingPortal, FloatingTree, safePolygon, useClick, useDelayGroup, useDelayGroupContext, useDismiss, useFloating, useFloatingNodeId, useFloatingParentNodeId, useFloatingTree, useFocus, useFocusTrap, useHover, useId, useInteractions, useListNavigation, useRole, useTypeahead };

2

dist/floating-ui.react-dom-interactions.esm.min.js

@@ -1,1 +0,1 @@

import*as e from"react";import n,{useLayoutEffect as t,useEffect as r,useContext as o,useMemo as u,useRef as c,useCallback as i,useState as l,createContext as a,forwardRef as f}from"react";import{getOverflowAncestors as s,useFloating as d}from"@floating-ui/react-dom";export*from"@floating-ui/react-dom";import v from"point-in-polygon";import{createPortal as m}from"react-dom";import{hideOthers as g}from"aria-hidden";var p="undefined"!=typeof document?t:r;function h(){const e=new Map;return{emit(n,t){var r;null==(r=e.get(n))||r.forEach((e=>e(t)))},on(n,t){e.set(n,[...e.get(n)||[],t])},off(n,t){e.set(n,(e.get(n)||[]).filter((e=>e!==t)))}}}let y=!1,w=0;const b=()=>"floating-ui-"+w++;const E=e["useId".toString()],x=null!=E?E:function(){const[n,t]=e.useState((()=>y?b():void 0));return p((()=>{null==n&&t(b())}),[]),e.useEffect((()=>{y||(y=!0)}),[]),n},L=a(null),T=a(null),I=()=>{var e,n;return null!=(e=null==(n=o(L))?void 0:n.id)?e:null},A=()=>o(T),k=()=>{const e=x(),n=A(),t=I();return p((()=>{const r={id:e,parentId:t};return null==n||n.addNode(r),()=>{null==n||n.removeNode(r)}}),[n,e,t]),e},O=e=>{let{children:t,id:r}=e;const o=I();return n.createElement(L.Provider,{value:u((()=>({id:r,parentId:o})),[r,o])},t)},C=e=>{let{children:t}=e;const r=c([]),o=i((e=>{r.current=[...r.current,e]}),[]),a=i((e=>{r.current=r.current.filter((n=>n!==e))}),[]),f=l((()=>h()))[0];return n.createElement(T.Provider,{value:u((()=>({nodesRef:r,addNode:o,removeNode:a,events:f})),[r,o,a,f])},t)};function R(e,n,t){const r={};return{..."floating"===t&&{tabIndex:-1},...e,...n.map((e=>e?e[t]:null)).concat(e).reduce(((e,n)=>n?(Object.entries(n).forEach((n=>{let[t,o]=n;0===t.indexOf("on")?(r[t]||(r[t]=[]),"function"==typeof o&&r[t].push(o),e[t]=function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];r[t].forEach((e=>e(...n)))}):e[t]=o})),e):e),{})}}const D=function(e){return void 0===e&&(e=[]),{getReferenceProps:n=>R(n,e,"reference"),getFloatingProps:n=>R(n,e,"floating"),getItemProps:n=>R(n,e,"item")}};function P(e){var n;return null!=(n=null==e?void 0:e.ownerDocument)?n:document}function M(e){var n;return null!=(n=P(e).defaultView)?n:window}function S(e){return!!e&&e instanceof M(e).Element}function N(e){return!!e&&e instanceof M(e).HTMLElement}function j(e,n){var t;let r=null!=(t=null==e?void 0:e.nodesRef.current.filter((e=>{var t;return e.parentId===n&&(null==(t=e.context)?void 0:t.open)})))?t:[],o=r;for(;o.length;){var u;o=null!=(u=null==e?void 0:e.nodesRef.current.filter((e=>{var n;return null==(n=o)?void 0:n.some((n=>{var t;return e.parentId===n.id&&(null==(t=e.context)?void 0:t.open)}))})))?u:[],r=r.concat(o)}return r}function B(e){let n,{restMs:t=0,buffer:r=1,debug:o=null}=void 0===e?{}:e;return e=>{let{x:o,y:u,placement:c,refs:i,onClose:l,nodeId:a,tree:f}=e;return function(e){var s;if(clearTimeout(n),e.pointerType&&"mouse"!==e.pointerType)return;const{target:d,clientX:m,clientY:g}=e,p=d;if("pointermove"===e.type&&S(i.reference.current)&&i.reference.current.contains(p)||null!=(s=i.floating.current)&&s.contains(p))return;if(f&&j(f,a).some((e=>{let{context:n}=e;return null==n?void 0:n.open})))return;if(!i.reference.current||!i.floating.current||null==c||null==o||null==u)return;const h=i.reference.current.getBoundingClientRect(),y=i.floating.current.getBoundingClientRect(),w=c.split("-")[0],b=o>y.right-y.width/2,E=u>y.bottom-y.height/2;switch(w){case"top":if(m>=y.left&&m<=y.right&&g>=y.bottom&&g<=h.top)return;break;case"bottom":if(m>=y.left&&m<=y.right&&g>=h.bottom&&g<=y.top)return;break;case"left":if(m>=y.right&&m<=h.left&&g>=y.left&&g<=y.right)return;break;case"right":if(m>=y.right&&m<=h.left&&g>=y.right&&g<=h.left)return}const x=function(e){let[n,t]=e;const o=y.width>h.width,u=y.height>h.height;switch(w){case"top":{const e=[o?n:b?n+r:n-r,t+r],u=[o?n:b?n-r:n+r,t+r],c=[[y.left,b||o?y.bottom-r:y.top],[y.right,b?o?y.bottom-r:y.top:y.bottom-r]];return b?[e,u,...c]:[e,...c,u]}case"bottom":{const e=[o?n:b?n+r:n-r,t-r],u=[o?n:b?n-r:n+r,t-r],c=[[y.left,b||o?y.top+r:y.bottom],[y.right,b?o?y.top+r:y.bottom:y.top+r]];return b?[e,u,...c]:[e,...c,u]}case"left":{const e=[n+r,u?t:E?t-r:t+r],o=[n+r,u?t:E?t+r:t-r],c=[[E||u?y.right-r:y.left,y.top],[E?u?y.right-r:y.left:y.right-r,y.bottom]];return E?[e,...c,o]:[...c,e,o]}case"right":{const e=[n-r,u?t:E?t+r:t-r],o=[n-r,u?t:E?t-r:t+r],c=[[E||u?y.left+r:y.right,y.top],[E?u?y.left+r:y.right:y.left+r,y.bottom]];return E?[e,o,...c]:[e,...c,o]}}}([o,u]);v([m,g],x)?t&&(n=setTimeout(l,t)):(clearTimeout(n),l())}}}const K="floating-ui-root",F=e=>{let{children:n,id:t=K}=e;const[r,o]=l(!1),u=c(null);return p((()=>{const e=document.getElementById(t);e?u.current=e:(u.current=document.createElement("div"),u.current.id=t);const n=u.current;document.body.contains(n)||document.body.appendChild(n),o(!0)}),[t]),r&&u.current?m(n,u.current):null};function H(){return H=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},H.apply(this,arguments)}const U="data-floating-ui-scroll-lock",V=f((function(e,t){let{lockScroll:r=!1,...o}=e;return p((()=>{if(!r)return;const e=window.pageXOffset,n=window.pageYOffset,t=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth;return document.body.hasAttribute(U)?void 0:(Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:"-"+n+"px",left:"-"+e+"px",right:"0",[t]:o+"px"}),document.body.setAttribute(U,""),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[t]:""}),document.body.removeAttribute(U),window.scrollTo(e,n)})}),[r]),n.createElement("div",H({ref:t},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))}));function X(e){const n=c(e);return p((()=>{n.current=e})),n}function Y(e,n,t){return t&&"mouse"!==t?0:"number"==typeof e?e:null==e?void 0:e[n]}const q=function(e,n){let{enabled:t=!0,delay:o=0,handleClose:u=null,mouseOnly:l=!1,restMs:a=0}=void 0===n?{}:n;const{open:f,onOpenChange:s,dataRef:d,events:v,refs:m}=e,g=A(),h=X(s),y=X(u),w=c(),b=c(),E=c(),x=c(),L=c(!0);p((()=>{t&&(f||(w.current=void 0))})),r((()=>{if(t)return v.on("dismiss",e),()=>{v.off("dismiss",e)};function e(){clearTimeout(b.current),clearTimeout(x.current),L.current=!0}}),[t,v,m.floating]),r((()=>{if(!t||!y.current)return;function e(){var e;null!=(e=d.current.openEvent)&&e.type.includes("mouse")&&h.current(!1)}const n=P(m.floating.current).documentElement;return n.addEventListener("mouseleave",e),()=>{n.removeEventListener("mouseleave",e)}}),[m.floating,h,t,y,d]);const T=i((function(e){void 0===e&&(e=!0),o&&!E.current?(clearTimeout(b.current),b.current=setTimeout((()=>h.current(!1)),Y(o,"close",w.current))):e&&h.current(!1)}),[o,h]),I=i((()=>{E.current&&(P(m.floating.current).removeEventListener("pointermove",E.current),E.current=void 0)}),[m.floating]);if(r((()=>{f||I()}),[f,t,I]),r((()=>{if(!t)return;function n(e){clearTimeout(b.current),L.current=!1,f||l&&"mouse"!==w.current||a>0&&0===Y(o,"open")||(d.current.openEvent=e,o?b.current=setTimeout((()=>{h.current(!0)}),Y(o,"open",w.current)):h.current(!0))}function r(n){var t,r;if("click"===(null==(t=d.current.openEvent)?void 0:t.type)||"pointerdown"===(null==(r=d.current.openEvent)?void 0:r.type))return;const o=P(m.floating.current);if(clearTimeout(x.current),y.current)return clearTimeout(b.current),E.current&&o.removeEventListener("pointermove",E.current),E.current=y.current({...e,tree:g,x:n.clientX,y:n.clientY,onClose(){I(),T()}}),void o.addEventListener("pointermove",E.current);T()}const u=m.reference.current;return S(u)?(u.addEventListener("mouseenter",n),u.addEventListener("mouseleave",r),()=>{u.removeEventListener("mouseenter",n),u.removeEventListener("mouseleave",r)}):void 0}),[t,T,e,o,y,d,l,h,f,g,a,I,m.reference,m.floating]),!t)return{};function k(e){w.current=e.pointerType}return{reference:{onPointerDown:k,onPointerEnter:k,onMouseMove(){f||0===a||(clearTimeout(x.current),x.current=setTimeout((()=>{L.current||s(!0)}),a))}},floating:{onMouseEnter(){clearTimeout(b.current)},onMouseLeave:()=>T(!1)}}},W=a({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),z=()=>o(W),G=e=>{let{children:t,delay:r}=e;const[o,c]=l({delay:r,initialDelay:r,currentId:null}),a=i((e=>{c((n=>({...n,currentId:e})))}),[]);return n.createElement(W.Provider,{value:u((()=>({...o,setState:c,setCurrentId:a})),[o,c,a])},t)},J=(e,n)=>{let{open:t,onOpenChange:o}=e,{id:u}=n;const{currentId:c,initialDelay:i,setState:l}=z();r((()=>{c&&o&&(l((e=>({...e,delay:{open:0,close:Y(i,"close")}}))),c!==u&&o(!1))}),[u,o,l,c,i]),r((()=>{!t&&c===u&&o&&(o(!1),l((e=>({...e,delay:i,currentId:null}))))}),[t,l,c,u,o,i])},Q=function(e,n){let{open:t}=e,{enabled:r=!0,role:o="dialog"}=void 0===n?{}:n;const u=x(),c=x(),i={id:u,role:o};return r?"tooltip"===o?{reference:{"aria-describedby":t?u:void 0},floating:i}:{reference:{"aria-expanded":t?"true":"false","aria-haspopup":o,"aria-controls":t?u:void 0,..."listbox"===o&&{role:"combobox"},..."menu"===o&&{id:c}},floating:{...i,..."menu"===o&&{"aria-labelledby":c}}}:{}},Z=function(e,n){let{open:t,onOpenChange:r,dataRef:o}=e,{enabled:u=!0,pointerDown:i=!1}=void 0===n?{}:n;const l=c();return u?{reference:{...i&&{onPointerDown(e){var n;(l.current=e.pointerType,t)?"pointerdown"===(null==(n=o.current.openEvent)?void 0:n.type)&&r(!1):r(!0);o.current.openEvent=e.nativeEvent}},onClick(e){if(i&&l.current)l.current=void 0;else{var n;if(t)"click"===(null==(n=o.current.openEvent)?void 0:n.type)&&r(!1);else r(!0);o.current.openEvent=e.nativeEvent}}}}:{}},$=function(e,n){let{open:t,onOpenChange:o,refs:u,events:c,nodeId:l}=e,{enabled:a=!0,escapeKey:f=!0,outsidePointerDown:d=!0,referencePointerDown:v=!1,ancestorScroll:m=!1,bubbles:g=!0}=void 0===n?{}:n;const p=A(),h=X(o),y=i((()=>{var e;return null==(e=u.floating.current)?void 0:e.contains(P(u.floating.current).activeElement)}),[u.floating]),w=i((()=>{N(u.reference.current)&&u.reference.current.focus()}),[u.reference]);return r((()=>{if(!t||!a)return;function e(e){if("Escape"===e.key){if(!g&&!y())return;c.emit("dismiss"),h.current(!1),w()}}function n(e){var n;const t=p&&j(p,l).some((n=>{var t,r;return null==(t=n.context)||null==(r=t.refs.floating.current)?void 0:r.contains(e.target)}));null!=(n=u.floating.current)&&n.contains(e.target)||S(u.reference.current)&&u.reference.current.contains(e.target)||t||(g||y())&&(c.emit("dismiss"),h.current(!1),w())}function r(){h.current(!1)}const o=P(u.floating.current);f&&o.addEventListener("keydown",e),d&&o.addEventListener("mousedown",n);const i=(m?[...S(u.reference.current)?s(u.reference.current):[],...S(u.floating.current)?s(u.floating.current):[]]:[]).filter((e=>{var n;return e!==(null==(n=o.defaultView)?void 0:n.visualViewport)}));return i.forEach((e=>e.addEventListener("scroll",r,{passive:!0}))),()=>{f&&o.removeEventListener("keydown",e),d&&o.removeEventListener("mousedown",n),i.forEach((e=>e.removeEventListener("scroll",r)))}}),[f,d,c,p,l,t,h,w,m,a,g,y,u.floating,u.reference]),a?{reference:{onPointerDown(){v&&(c.emit("dismiss"),o(!1))}}}:{}},_=function(e,n){let{open:t,onOpenChange:o,dataRef:u,refs:i,events:l}=e,{enabled:a=!0,keyboardOnly:f=!0}=void 0===n?{}:n;const s=c(!1);return r((()=>{var e;if(!a)return;const n=null!=(e=P(i.floating.current).defaultView)?e:window;function r(){s.current=!t}function o(){setTimeout((()=>{s.current=!1}))}return n.addEventListener("focus",o),n.addEventListener("blur",r),()=>{n.removeEventListener("focus",o),n.removeEventListener("blur",r)}}),[i.floating,t,a]),r((()=>{if(a)return l.on("dismiss",e),()=>{l.off("dismiss",e)};function e(){s.current=!0}}),[l,a]),a?{reference:{onPointerDown(e){let{pointerType:n}=e;s.current=!(!n||!f)},onFocus(e){var n,t,r;s.current||"focus"===e.type&&"mousedown"===(null==(n=u.current.openEvent)?void 0:n.type)&&S(i.reference.current)&&null!=(t=i.reference.current)&&t.contains(null==(r=u.current.openEvent)?void 0:r.target)||(u.current.openEvent=e.nativeEvent,o(!0))},onBlur(e){var n;const t=e.relatedTarget;null!=(n=i.floating.current)&&n.contains(t)||S(i.reference.current)&&i.reference.current.contains(t)||(s.current=!1,o(!1))}}}:{}};function ee(e){e.preventDefault(),e.stopPropagation()}const ne=["content"];function te(e){requestAnimationFrame((()=>{null==e||e.focus()}))}const re=function(e,n){let{open:t,onOpenChange:o,refs:u,nodeId:l}=e,{enabled:a=!0,initialContentFocus:f=0,order:s=ne,modal:d=!0,inert:v=!1}=void 0===n?{}:n;const m=c(!1),h=c(null),y=c(null),w=X(d),b=X(s),E=i((()=>b.current.map((e=>{return N(u.reference.current)&&"reference"===e?u.reference.current:u.floating.current&&"floating"===e?u.floating.current:"content"===e?Array.from(null!=(n=null==(t=u.floating.current)?void 0:t.querySelectorAll("a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,*[tabindex],*[contenteditable]"))?n:[]):null;var n,t})).filter(Boolean).flat()),[u.floating,u.reference]);p((()=>{const e=u.floating.current;if(!(a&&t&&e&&d))return;function n(){const n=P(e).createElement("div");return n.tabIndex=0,Object.assign(n.style,{position:"fixed",outline:"0",pointerEvents:"none"}),n.setAttribute("aria-hidden","true"),n}h.current||(h.current=n()),y.current||(y.current=n());const r=h.current,o=y.current;function c(e){var n;ee(e);const t=E();null==(n=t[e.target===o?0:t.length-1])||n.focus()}return e.insertAdjacentElement("beforebegin",r),e.insertAdjacentElement("afterend",o),r.addEventListener("focus",c),o.addEventListener("focus",c),()=>{var e,n;r.removeEventListener("focus",c),o.removeEventListener("focus",c),null!=(e=r.parentNode)&&e.contains(r)&&r.parentNode.removeChild(r),null!=(n=o.parentNode)&&n.contains(o)&&o.parentNode.removeChild(o)}}),[a,t,d,v,E,u.floating]),r((()=>{if(!a||!t||!v)return;function e(e){"Tab"===e.key&&ee(e)}const n=P(u.floating.current);return n.addEventListener("keydown",e),()=>{n.removeEventListener("keydown",e)}}),[a,t,v,u.floating]),r((()=>{if(!a)return;const e=E();if(v){if(t){const n=e[0];n!==u.floating.current||n.contains(n.ownerDocument.activeElement)||te(n)}}else t&&("number"==typeof f?te(e[f]):f.current&&te(e.find((e=>e===f.current))))}),[E,t,v,d,f,a,u.reference,u.floating]),r((()=>{a&&!v&&!t&&w.current&&m.current&&N(u.reference.current)&&te(u.reference.current)}),[t,a,v,w,u.reference]),r((()=>{if(t&&d&&a&&u.floating.current)return g(u.floating.current)}),[t,d,a,u.floating]),r((()=>(m.current=!0,()=>{m.current=!1})),[]);const x=A();function L(e){var n;const t=e.relatedTarget;null!=(n=u.floating.current)&&n.contains(t)||!S(u.reference.current)||u.reference.current.contains(t)||x&&j(x,l).some((e=>{var n,r,o;return null==(n=e.context)||null==(r=n.refs.floating)||null==(o=r.current)?void 0:o.contains(t)}))||o(!1)}return a?d?{floating:{"aria-modal":"true"}}:{reference:{onBlur:L},floating:{onBlur:L}}:{}};function oe(e,n){let{startingIndex:t=-1,decrement:r=!1}=void 0===n?{}:n;const o=fe(e);let u=t;do{var c,i;u+=r?-1:1}while(null!=(c=o[u])&&c.hasAttribute("disabled")||"true"===(null==(i=o[u])?void 0:i.getAttribute("aria-disabled")));return-1===u?0:u}function ue(e,n,t){switch(e){case"vertical":return n;case"horizontal":return t;default:return n||t}}function ce(e,n){return ue(n,"ArrowUp"===e||"ArrowDown"===e,"ArrowLeft"===e||"ArrowRight"===e)}function ie(e,n,t){return ue(n,"ArrowDown"===e,t?"ArrowLeft"===e:"ArrowRight"===e)}function le(e){return oe(e)}function ae(e){return oe(e,{decrement:!0,startingIndex:fe(e).length})}function fe(e){return e.current.filter((e=>null!=e))}const se=function(e,n){let{open:t,onOpenChange:r,refs:o}=e,{listRef:u,activeIndex:a,onNavigate:f,enabled:s=!0,selectedIndex:d=null,loop:v=!1,nested:m=!1,rtl:g=!1,virtual:h=!1,focusItemOnOpen:y="auto",focusItemOnHover:w=!0,orientation:b="vertical"}=void 0===n?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:n;const E=I(),x=A(),L=c(y),T=c(null!=d?d:-1),k=c(""),O=c(!1),C=X(f),R=c(!1),[D,P]=l(),M=i(((e,n)=>{var t,r;h?P(null==(t=fe(e)[n.current])?void 0:t.id):null==(r=fe(e)[n.current])||r.focus({preventScroll:!0})}),[h]);function S(e){"auto"===y&&(L.current=!e.pointerType)}function j(e){if(R.current=!0,m&&function(e,n,t){return ue(n,t?"ArrowRight"===e:"ArrowLeft"===e,"ArrowUp"===e)}(e.key,b,g))return ee(e),r(!1),void(N(o.reference.current)&&o.reference.current.focus());const n=T.current,t=le(u),c=ae(u);if("Home"===e.key&&(T.current=t,f(T.current)),"End"===e.key&&(T.current=c,f(T.current)),ce(e.key,b)){if(ee(e),!h&&e.currentTarget.ownerDocument.activeElement===e.currentTarget)return T.current=null!=d?d:ie(e.key,b,g)?t:c,void f(T.current);ie(e.key,b,g)?T.current=v?n>=c?t:oe(u,{startingIndex:n}):Math.min(c,oe(u,{startingIndex:n})):T.current=v?n<=t?c:oe(u,{startingIndex:n,decrement:!0}):Math.max(t,oe(u,{startingIndex:n,decrement:!0})),f(T.current)}}return p((()=>{s&&(null!=d&&(T.current=d),t&&L.current&&(C.current(T.current),M(u,T)))}),[t,d,u,C,M,s]),p((()=>{s&&t&&null!=a&&(T.current=a,C.current(T.current),M(u,T))}),[t,a,d,u,C,M,s,E,o.floating,null==x?void 0:x.nodesRef]),p((()=>{null==d&&s&&(t&&(ce(k.current,b)||L.current&&(" "===k.current||"Enter"===k.current))&&(T.current=function(e,n,t){return ue(n,"ArrowUp"===e,t?"ArrowRight"===e:"ArrowLeft"===e)}(k.current,b,g)?ae(u):le(u),C.current(T.current),M(u,T)),k.current="")}),[t,u,d,C,M,s,b,g]),p((()=>{s&&!t&&O.current&&null!=d&&N(o.reference.current)&&o.reference.current.focus()}),[o.reference,d,t,s]),p((()=>(O.current=!0,()=>{O.current=!1})),[]),p((()=>{var e;s&&(t||("auto"===y&&(L.current=!0),T.current=null!=(e=null!=d?d:a)?e:-1,C.current(null)))}),[t,d,a,s,y,C]),s?{reference:{...h&&t&&{"aria-activedescendant":D},onPointerEnter:S,onPointerDown:S,onKeyDown(e){if(R.current=!0,h&&t)return j(e);"auto"===y&&(L.current=!0),k.current=e.key,m?function(e,n,t){return ue(n,t?"ArrowLeft"===e:"ArrowRight"===e,"ArrowDown"===e)}(e.key,b,g)&&(T.current=le(u),ee(e),r(!0),f(T.current)):(ce(e.key,b)&&(T.current=null==d?ie(e.key,b,g)?le(u):ae(u):d,ee(e),r(!0),f(T.current)),h&&!t&&j(e))}},floating:{"aria-orientation":"both"===b?void 0:b,...h&&{"aria-activedescendant":D},onKeyDown:j,onPointerMove(){R.current=!1}},item:{onClick:e=>{let{currentTarget:n}=e;return n.focus({preventScroll:!0})},...w&&{onPointerMove(e){let{currentTarget:n}=e;const t=n;if(t){const e=fe(u).indexOf(t);-1!==e&&f(e)}},onPointerLeave(){var e;R.current||(f(null),h?(T.current=-1,M(u,T)):null==(e=o.floating.current)||e.focus({preventScroll:!0}))}}}}:{}},de=function(e,n){var t;let{open:r,dataRef:o}=e,{listRef:u,activeIndex:i,onMatch:l=(()=>{}),enabled:a=!0,findMatch:f=null,resetMs:s=1e3,ignoreKeys:d=[],selectedIndex:v=null}=void 0===n?{listRef:{current:[]},activeIndex:null}:n;const m=c(),g=c(""),h=c(null!=(t=null!=v?v:i)?t:-1),y=c(null);function w(e){if(!e.currentTarget.contains(P(e.currentTarget).activeElement))return;g.current.length>0&&(o.current.typing=!0," "===e.key&&ee(e));const n=u.current;if(null==n||["Home","End","Escape","Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight",...d].includes(e.key))return;n.every((e=>{var n,t;return!e||(null==(n=e[0])?void 0:n.toLowerCase())!==(null==(t=e[1])?void 0:t.toLowerCase())}))&&g.current===e.key&&(g.current="",h.current=y.current),g.current+=e.key,clearTimeout(m.current),m.current=setTimeout((()=>{g.current="",h.current=y.current,o.current.typing=!1}),s);const t=h.current,r=[...n.slice((null!=t?t:0)+1),...n.slice(0,(null!=t?t:0)+1)],c=f?f(r,g.current):r.find((e=>0===(null==e?void 0:e.toLowerCase().indexOf(g.current)))),i=c?n.indexOf(c):-1;-1!==i&&(l(i),y.current=i)}return p((()=>{r&&(clearTimeout(m.current),y.current=null,g.current="")}),[r]),p((()=>{var e;r&&""===g.current&&(h.current=null!=(e=null!=v?v:i)?e:-1)}),[r,v,i]),a?{reference:{onKeyDown:w},floating:{onKeyDown:w}}:{}};function ve(e){let{open:n=!1,onOpenChange:t=(()=>{}),placement:r,middleware:o,strategy:i,nodeId:a}=void 0===e?{}:e;const f=A(),s=c({}),v=l((()=>h()))[0],m=d({placement:r,middleware:o,strategy:i}),g=u((()=>({...m,dataRef:s,nodeId:a,events:v,open:n,onOpenChange:t})),[m,s,a,v,n,t]);return p((()=>{const e=null==f?void 0:f.nodesRef.current.find((e=>e.id===a));e&&(e.context=g)})),u((()=>({context:g,...m})),[m,g])}export{G as FloatingDelayGroup,O as FloatingNode,V as FloatingOverlay,F as FloatingPortal,C as FloatingTree,B as safePolygon,Z as useClick,J as useDelayGroup,z as useDelayGroupContext,$ as useDismiss,ve as useFloating,k as useFloatingNodeId,I as useFloatingParentNodeId,A as useFloatingTree,_ as useFocus,re as useFocusTrap,q as useHover,x as useId,D as useInteractions,se as useListNavigation,Q as useRole,de as useTypeahead};
import*as e from"react";import n,{useLayoutEffect as t,useEffect as r,useContext as o,useMemo as u,useRef as c,useCallback as i,useState as l,createContext as a,forwardRef as f,cloneElement as s}from"react";import{getOverflowAncestors as d,useFloating as v}from"@floating-ui/react-dom";export*from"@floating-ui/react-dom";import m from"point-in-polygon";import{createPortal as g}from"react-dom";import{hideOthers as p}from"aria-hidden";var h="undefined"!=typeof document?t:r;function b(){const e=new Map;return{emit(n,t){var r;null==(r=e.get(n))||r.forEach((e=>e(t)))},on(n,t){e.set(n,[...e.get(n)||[],t])},off(n,t){e.set(n,(e.get(n)||[]).filter((e=>e!==t)))}}}let y=!1,E=0;const w=()=>"floating-ui-"+E++;const x=e["useId".toString()],L=null!=x?x:function(){const[n,t]=e.useState((()=>y?w():void 0));return h((()=>{null==n&&t(w())}),[]),e.useEffect((()=>{y||(y=!0)}),[]),n},T=a(null),I=a(null),A=()=>{var e,n;return null!=(e=null==(n=o(T))?void 0:n.id)?e:null},k=()=>o(I),R=()=>{const e=L(),n=k(),t=A();return h((()=>{const r={id:e,parentId:t};return null==n||n.addNode(r),()=>{null==n||n.removeNode(r)}}),[n,e,t]),e},O=e=>{let{children:t,id:r}=e;const o=A();return n.createElement(T.Provider,{value:u((()=>({id:r,parentId:o})),[r,o])},t)},C=e=>{let{children:t}=e;const r=c([]),o=i((e=>{r.current=[...r.current,e]}),[]),a=i((e=>{r.current=r.current.filter((n=>n!==e))}),[]),f=l((()=>b()))[0];return n.createElement(I.Provider,{value:u((()=>({nodesRef:r,addNode:o,removeNode:a,events:f})),[r,o,a,f])},t)};function D(e,n,t){const r={};return{..."floating"===t&&{tabIndex:-1},...e,...n.map((e=>e?e[t]:null)).concat(e).reduce(((e,n)=>n?(Object.entries(n).forEach((n=>{let[t,o]=n;0===t.indexOf("on")?(r[t]||(r[t]=[]),"function"==typeof o&&r[t].push(o),e[t]=function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];r[t].forEach((e=>e(...n)))}):e[t]=o})),e):e),{})}}const P=function(e){return void 0===e&&(e=[]),{getReferenceProps:n=>D(n,e,"reference"),getFloatingProps:n=>D(n,e,"floating"),getItemProps:n=>D(n,e,"item")}};function M(e){var n;return null!=(n=null==e?void 0:e.ownerDocument)?n:document}function S(e){var n;return null!=(n=M(e).defaultView)?n:window}function F(e){return!!e&&e instanceof S(e).Element}function j(e){return!!e&&e instanceof S(e).HTMLElement}function N(e,n){var t;let r=null!=(t=null==e?void 0:e.nodesRef.current.filter((e=>{var t;return e.parentId===n&&(null==(t=e.context)?void 0:t.open)})))?t:[],o=r;for(;o.length;){var u;o=null!=(u=null==e?void 0:e.nodesRef.current.filter((e=>{var n;return null==(n=o)?void 0:n.some((n=>{var t;return e.parentId===n.id&&(null==(t=e.context)?void 0:t.open)}))})))?u:[],r=r.concat(o)}return r}function B(e){let n,{restMs:t=0,buffer:r=1,debug:o=null}=void 0===e?{}:e;return e=>{let{x:o,y:u,placement:c,refs:i,onClose:l,nodeId:a,tree:f}=e;return function(e){var s;if(clearTimeout(n),e.pointerType&&"mouse"!==e.pointerType)return;const{target:d,clientX:v,clientY:g}=e,p=d;if("pointermove"===e.type&&F(i.reference.current)&&i.reference.current.contains(p)||null!=(s=i.floating.current)&&s.contains(p))return;if(f&&N(f,a).some((e=>{let{context:n}=e;return null==n?void 0:n.open})))return;if(!i.reference.current||!i.floating.current||null==c||null==o||null==u)return;const h=i.reference.current.getBoundingClientRect(),b=i.floating.current.getBoundingClientRect(),y=c.split("-")[0],E=o>b.right-b.width/2,w=u>b.bottom-b.height/2;switch(y){case"top":if(v>=b.left&&v<=b.right&&g>=b.bottom&&g<=h.top)return;break;case"bottom":if(v>=b.left&&v<=b.right&&g>=h.bottom&&g<=b.top)return;break;case"left":if(v>=b.right&&v<=h.left&&g>=b.left&&g<=b.right)return;break;case"right":if(v>=b.right&&v<=h.left&&g>=b.right&&g<=h.left)return}const x=function(e){let[n,t]=e;const o=b.width>h.width,u=b.height>h.height;switch(y){case"top":{const e=[o?n:E?n+r:n-r,t+r],u=[o?n:E?n-r:n+r,t+r],c=[[b.left,E||o?b.bottom-r:b.top],[b.right,E?o?b.bottom-r:b.top:b.bottom-r]];return E?[e,u,...c]:[e,...c,u]}case"bottom":{const e=[o?n:E?n+r:n-r,t-r],u=[o?n:E?n-r:n+r,t-r],c=[[b.left,E||o?b.top+r:b.bottom],[b.right,E?o?b.top+r:b.bottom:b.top+r]];return E?[e,u,...c]:[e,...c,u]}case"left":{const e=[n+r,u?t:w?t-r:t+r],o=[n+r,u?t:w?t+r:t-r],c=[[w||u?b.right-r:b.left,b.top],[w?u?b.right-r:b.left:b.right-r,b.bottom]];return w?[e,...c,o]:[...c,e,o]}case"right":{const e=[n-r,u?t:w?t+r:t-r],o=[n-r,u?t:w?t-r:t+r],c=[[w||u?b.left+r:b.right,b.top],[w?u?b.left+r:b.right:b.left+r,b.bottom]];return w?[e,o,...c]:[e,...c,o]}}}([o,u]);m([v,g],x)?t&&(n=setTimeout(l,t)):(clearTimeout(n),l())}}}const K="floating-ui-root",q=e=>{let{children:n,id:t=K}=e;const[r,o]=l(!1),u=c(null);return h((()=>{const e=document.getElementById(t);e?u.current=e:(u.current=document.createElement("div"),u.current.id=t);const n=u.current;document.body.contains(n)||document.body.appendChild(n),o(!0)}),[t]),r&&u.current?g(n,u.current):null};function H(){return H=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},H.apply(this,arguments)}const U="data-floating-ui-scroll-lock",V=f((function(e,t){let{lockScroll:r=!1,...o}=e;return h((()=>{if(!r)return;const e=window.pageXOffset,n=window.pageYOffset,t=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth;return document.body.hasAttribute(U)?void 0:(Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:"-"+n+"px",left:"-"+e+"px",right:"0",[t]:o+"px"}),document.body.setAttribute(U,""),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[t]:""}),document.body.removeAttribute(U),window.scrollTo(e,n)})}),[r]),n.createElement("div",H({ref:t},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))}));function X(e){e.preventDefault(),e.stopPropagation()}function Y(e){const n=c(e);return h((()=>{n.current=e})),n}function W(e){requestAnimationFrame((()=>{null==e||e.focus()}))}const z=f((function(e,n){return React.createElement("span",H({},e,{ref:n,tabIndex:0,style:{position:"fixed",opacity:"0",pointerEvents:"none",outline:"0"}}))}));function G(e){let{context:{refs:n,nodeId:t,onOpenChange:o},children:u,order:c=["content"],endGuard:l=!0,preventTabbing:a=!1,initialFocus:f=0,returnFocus:d=!0,modal:v=!0}=e;const m=Y(c),g=Y(o),h=k(),b=i((()=>m.current.map((e=>{return j(n.reference.current)&&"reference"===e?n.reference.current:n.floating.current&&"floating"===e?n.floating.current:"content"===e?Array.from(null!=(t=null==(r=n.floating.current)?void 0:r.querySelectorAll("input:not([type='hidden']):not([disabled]),select:not([disabled]),textarea:not([disabled]),a[href],button:not([disabled]),[tabindex],iframe,object,embed,area[href],audio[controls],video[controls],[contenteditable]:not([contenteditable='false'])"))?t:[]):null;var t,r})).flat().filter((e=>{if(e===n.floating.current||e===n.reference.current)return!0;if(j(e)){var t;return"-"!==(null!=(t=e.getAttribute("tabindex"))?t:"0")[0].trim()}}))),[m,n.floating,n.reference]);return r((()=>{const e=0===b().filter((e=>e!==n.floating.current&&e!==n.reference.current)).length;function t(t){if("Tab"===t.key){(a||e)&&X(t);const r=b();"reference"===m.current[0]&&t.target===n.reference.current&&(X(t),t.shiftKey?W(r[r.length-1]):W(r[1])),"floating"===m.current[1]&&t.target===n.floating.current&&t.shiftKey&&(X(t),W(r[0]))}}const r=M(n.floating.current);return r.addEventListener("keydown",t),()=>{r.removeEventListener("keydown",t)}}),[a,b,m,n.floating,n.reference]),r((()=>{function e(e){var r;const o=e.relatedTarget;null!=(r=n.floating.current)&&r.contains(o)||!F(n.reference.current)||n.reference.current.contains(o)||h&&N(h,t).some((e=>{var n,t;return null==(n=e.context)||null==(t=n.refs.floating.current)?void 0:t.contains(o)}))||g.current(!1)}const r=n.floating.current,o=n.reference.current;if(r&&j(o)){!v&&r.addEventListener("focusout",e);const n=v?p(r):null;return()=>{!v&&r.removeEventListener("focusout",e),null==n||n()}}}),[t,h,v,g,b,f,n.floating,n.reference]),r((()=>{var e;if(a)return;const t=n.floating.current,r=null!=(e=M(t).activeElement)?e:document.activeElement;var o;if("number"==typeof f)W(null!=(o=b()[f])?o:t);else if(j(null==f?void 0:f.current)){var u;W(null!=(u=f.current)?u:t)}return()=>{d&&j(r)&&W(r)}}),[a,b,f,v,d,n.floating]),React.createElement(React.Fragment,null,v&&React.createElement(z,{onFocus:e=>{X(e);const n=b();"reference"===c[0]?W(n[0]):W(n[n.length-1])}}),s(u,c.includes("floating")?{tabIndex:0}:{}),v&&l&&React.createElement(z,{onFocus:e=>{X(e),W(b()[0])}}))}function J(e,n,t){return t&&"mouse"!==t?0:"number"==typeof e?e:null==e?void 0:e[n]}const Q=function(e,n){let{enabled:t=!0,delay:o=0,handleClose:u=null,mouseOnly:l=!1,restMs:a=0}=void 0===n?{}:n;const{open:f,onOpenChange:s,dataRef:d,events:v,refs:m}=e,g=k(),p=Y(s),b=Y(u),y=c(),E=c(),w=c(),x=c(),L=c(!0);h((()=>{t&&(f||(y.current=void 0))})),r((()=>{if(t)return v.on("dismiss",e),()=>{v.off("dismiss",e)};function e(){clearTimeout(E.current),clearTimeout(x.current),L.current=!0}}),[t,v,m.floating]),r((()=>{if(!t||!b.current)return;function e(){var e;null!=(e=d.current.openEvent)&&e.type.includes("mouse")&&p.current(!1)}const n=M(m.floating.current).documentElement;return n.addEventListener("mouseleave",e),()=>{n.removeEventListener("mouseleave",e)}}),[m.floating,p,t,b,d]);const T=i((function(e){void 0===e&&(e=!0),o&&!w.current?(clearTimeout(E.current),E.current=setTimeout((()=>p.current(!1)),J(o,"close",y.current))):e&&p.current(!1)}),[o,p]),I=i((()=>{w.current&&(M(m.floating.current).removeEventListener("pointermove",w.current),w.current=void 0)}),[m.floating]);if(r((()=>{f||I()}),[f,t,I]),r((()=>{if(!t)return;function n(e){clearTimeout(E.current),L.current=!1,f||l&&"mouse"!==y.current||a>0&&0===J(o,"open")||(d.current.openEvent=e,o?E.current=setTimeout((()=>{p.current(!0)}),J(o,"open",y.current)):p.current(!0))}function r(n){var t,r;if("click"===(null==(t=d.current.openEvent)?void 0:t.type)||"pointerdown"===(null==(r=d.current.openEvent)?void 0:r.type))return;const o=M(m.floating.current);if(clearTimeout(x.current),b.current)return clearTimeout(E.current),w.current&&o.removeEventListener("pointermove",w.current),w.current=b.current({...e,tree:g,x:n.clientX,y:n.clientY,onClose(){I(),T()}}),void o.addEventListener("pointermove",w.current);T()}const u=m.reference.current;return F(u)?(u.addEventListener("mouseenter",n),u.addEventListener("mouseleave",r),()=>{u.removeEventListener("mouseenter",n),u.removeEventListener("mouseleave",r)}):void 0}),[t,T,e,o,b,d,l,p,f,g,a,I,m.reference,m.floating]),!t)return{};function A(e){y.current=e.pointerType}return{reference:{onPointerDown:A,onPointerEnter:A,onMouseMove(){f||0===a||(clearTimeout(x.current),x.current=setTimeout((()=>{L.current||s(!0)}),a))}},floating:{onMouseEnter(){clearTimeout(E.current)},onMouseLeave:()=>T(!1)}}},Z=a({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),$=()=>o(Z),_=e=>{let{children:t,delay:r}=e;const[o,c]=l({delay:r,initialDelay:r,currentId:null}),a=i((e=>{c((n=>({...n,currentId:e})))}),[]);return n.createElement(Z.Provider,{value:u((()=>({...o,setState:c,setCurrentId:a})),[o,c,a])},t)},ee=(e,n)=>{let{open:t,onOpenChange:o}=e,{id:u}=n;const{currentId:c,initialDelay:i,setState:l}=$();r((()=>{c&&o&&(l((e=>({...e,delay:{open:0,close:J(i,"close")}}))),c!==u&&o(!1))}),[u,o,l,c,i]),r((()=>{!t&&c===u&&o&&(o(!1),l((e=>({...e,delay:i,currentId:null}))))}),[t,l,c,u,o,i])},ne=function(e,n){let{open:t}=e,{enabled:r=!0,role:o="dialog"}=void 0===n?{}:n;const u=L(),c=L(),i={id:u,role:o};return r?"tooltip"===o?{reference:{"aria-describedby":t?u:void 0},floating:i}:{reference:{"aria-expanded":t?"true":"false","aria-haspopup":o,"aria-controls":t?u:void 0,..."listbox"===o&&{role:"combobox"},..."menu"===o&&{id:c}},floating:{...i,..."menu"===o&&{"aria-labelledby":c}}}:{}},te=function(e,n){let{open:t,onOpenChange:r,dataRef:o}=e,{enabled:u=!0,pointerDown:i=!1,toggle:l=!0}=void 0===n?{}:n;const a=c();return u?{reference:{...i&&{onPointerDown(e){var n;(a.current=e.pointerType,t)?l&&"pointerdown"===(null==(n=o.current.openEvent)?void 0:n.type)&&r(!1):r(!0);o.current.openEvent=e.nativeEvent}},onClick(e){if(i&&a.current)a.current=void 0;else{var n;if(t)l&&"click"===(null==(n=o.current.openEvent)?void 0:n.type)&&r(!1);else r(!0);o.current.openEvent=e.nativeEvent}}}}:{}},re=function(e,n){let{open:t,onOpenChange:o,refs:u,events:c,nodeId:l}=e,{enabled:a=!0,escapeKey:f=!0,outsidePointerDown:s=!0,referencePointerDown:v=!1,ancestorScroll:m=!1,bubbles:g=!0}=void 0===n?{}:n;const p=k(),h=Y(o),b=i((()=>{var e;return null==(e=u.floating.current)?void 0:e.contains(M(u.floating.current).activeElement)}),[u.floating]),y=i((()=>{j(u.reference.current)&&u.reference.current.focus()}),[u.reference]);return r((()=>{if(!t||!a)return;function e(e){if("Escape"===e.key){if(!g&&!b())return;c.emit("dismiss"),h.current(!1),y()}}function n(e){var n;const t=p&&N(p,l).some((n=>{var t,r;return null==(t=n.context)||null==(r=t.refs.floating.current)?void 0:r.contains(e.target)}));null!=(n=u.floating.current)&&n.contains(e.target)||F(u.reference.current)&&u.reference.current.contains(e.target)||t||(g||b())&&(c.emit("dismiss"),h.current(!1),y())}function r(){h.current(!1)}const o=M(u.floating.current);f&&o.addEventListener("keydown",e),s&&o.addEventListener("mousedown",n);const i=(m?[...F(u.reference.current)?d(u.reference.current):[],...F(u.floating.current)?d(u.floating.current):[]]:[]).filter((e=>{var n;return e!==(null==(n=o.defaultView)?void 0:n.visualViewport)}));return i.forEach((e=>e.addEventListener("scroll",r,{passive:!0}))),()=>{f&&o.removeEventListener("keydown",e),s&&o.removeEventListener("mousedown",n),i.forEach((e=>e.removeEventListener("scroll",r)))}}),[f,s,c,p,l,t,h,y,m,a,g,b,u.floating,u.reference]),a?{reference:{onPointerDown(){v&&(c.emit("dismiss"),o(!1))}}}:{}},oe=function(e,n){let{open:t,onOpenChange:o,dataRef:u,refs:i,events:l}=e,{enabled:a=!0,keyboardOnly:f=!0}=void 0===n?{}:n;const s=c(!1);return r((()=>{var e;if(!a)return;const n=null!=(e=M(i.floating.current).defaultView)?e:window;function r(){s.current=!t}function o(){setTimeout((()=>{s.current=!1}))}return n.addEventListener("focus",o),n.addEventListener("blur",r),()=>{n.removeEventListener("focus",o),n.removeEventListener("blur",r)}}),[i.floating,t,a]),r((()=>{if(a)return l.on("dismiss",e),()=>{l.off("dismiss",e)};function e(){s.current=!0}}),[l,a]),a?{reference:{onPointerDown(e){let{pointerType:n}=e;s.current=!(!n||!f)},onFocus(e){var n,t,r;s.current||"focus"===e.type&&"mousedown"===(null==(n=u.current.openEvent)?void 0:n.type)&&F(i.reference.current)&&null!=(t=i.reference.current)&&t.contains(null==(r=u.current.openEvent)?void 0:r.target)||(u.current.openEvent=e.nativeEvent,o(!0))},onBlur(e){var n;const t=e.relatedTarget;null!=(n=i.floating.current)&&n.contains(t)||F(i.reference.current)&&i.reference.current.contains(t)||(s.current=!1,o(!1))}}}:{}},ue=["content"];function ce(e){requestAnimationFrame((()=>{null==e||e.focus()}))}const ie=function(e,n){let{open:t,onOpenChange:o,refs:u,nodeId:l}=e,{enabled:a=!0,initialContentFocus:f=0,order:s=ue,modal:d=!0,inert:v=!1}=void 0===n?{}:n;const m=c(!1),g=c(null),b=c(null),y=Y(d),E=Y(s),w=i((()=>E.current.map((e=>{return j(u.reference.current)&&"reference"===e?u.reference.current:u.floating.current&&"floating"===e?u.floating.current:"content"===e?Array.from(null!=(n=null==(t=u.floating.current)?void 0:t.querySelectorAll("a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,*[tabindex],*[contenteditable]"))?n:[]):null;var n,t})).filter(Boolean).flat()),[u.floating,u.reference]);h((()=>{const e=u.floating.current;if(!(a&&t&&e&&d))return;function n(){const n=M(e).createElement("div");return n.tabIndex=0,Object.assign(n.style,{position:"fixed",outline:"0",pointerEvents:"none"}),n.setAttribute("aria-hidden","true"),n}g.current||(g.current=n()),b.current||(b.current=n());const r=g.current,o=b.current;function c(e){var n;X(e);const t=w();null==(n=t[e.target===o?0:t.length-1])||n.focus()}return e.insertAdjacentElement("beforebegin",r),e.insertAdjacentElement("afterend",o),r.addEventListener("focus",c),o.addEventListener("focus",c),()=>{var e,n;r.removeEventListener("focus",c),o.removeEventListener("focus",c),null!=(e=r.parentNode)&&e.contains(r)&&r.parentNode.removeChild(r),null!=(n=o.parentNode)&&n.contains(o)&&o.parentNode.removeChild(o)}}),[a,t,d,v,w,u.floating]),r((()=>{if(!a||!t||!v)return;function e(e){"Tab"===e.key&&X(e)}const n=M(u.floating.current);return n.addEventListener("keydown",e),()=>{n.removeEventListener("keydown",e)}}),[a,t,v,u.floating]),r((()=>{if(!a)return;const e=w();if(v){if(t){const n=e[0];n!==u.floating.current||n.contains(n.ownerDocument.activeElement)||ce(n)}}else t&&("number"==typeof f?ce(e[f]):f.current&&ce(e.find((e=>e===f.current))))}),[w,t,v,d,f,a,u.reference,u.floating]),r((()=>{a&&!v&&!t&&y.current&&m.current&&j(u.reference.current)&&ce(u.reference.current)}),[t,a,v,y,u.reference]),r((()=>{if(t&&d&&a&&u.floating.current)return p(u.floating.current)}),[t,d,a,u.floating]),r((()=>(m.current=!0,()=>{m.current=!1})),[]);const x=k();function L(e){var n;const t=e.relatedTarget;null!=(n=u.floating.current)&&n.contains(t)||!F(u.reference.current)||u.reference.current.contains(t)||x&&N(x,l).some((e=>{var n,r,o;return null==(n=e.context)||null==(r=n.refs.floating)||null==(o=r.current)?void 0:o.contains(t)}))||o(!1)}return a?d?{floating:{"aria-modal":"true"}}:{reference:{onBlur:L},floating:{onBlur:L}}:{}};function le(e,n){let{startingIndex:t=-1,decrement:r=!1}=void 0===n?{}:n;const o=e.current;let u=t;do{var c,i;u+=r?-1:1}while(u>=0&&u<=o.length-1&&(null==o[u]||null!=(c=o[u])&&c.hasAttribute("disabled")||"true"===(null==(i=o[u])?void 0:i.getAttribute("aria-disabled"))));return u}function ae(e,n,t){switch(e){case"vertical":return n;case"horizontal":return t;default:return n||t}}function fe(e,n){return ae(n,"ArrowUp"===e||"ArrowDown"===e,"ArrowLeft"===e||"ArrowRight"===e)}function se(e,n,t){return ae(n,"ArrowDown"===e,t?"ArrowLeft"===e:"ArrowRight"===e)}function de(e){return le(e)}function ve(e){return le(e,{decrement:!0,startingIndex:e.current.length})}const me=function(e,n){let{open:t,onOpenChange:r,refs:o}=e,{listRef:u,activeIndex:a,onNavigate:f,enabled:s=!0,selectedIndex:d=null,allowEscape:v=!1,loop:m=!1,nested:g=!1,rtl:p=!1,virtual:b=!1,focusItemOnOpen:y="auto",focusItemOnHover:E=!0,orientation:w="vertical"}=void 0===n?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:n;const x=A(),L=k(),T=function(e){const n=c();return h((()=>{n.current=e}),[e]),n.current}(t),I=c(y),R=c(null!=d?d:-1),O=c(""),C=c(!1),D=Y(f),P=c(!1),[M,S]=l(),F=i(((e,n)=>{var t,r;b?S(null==(t=e.current[n.current])?void 0:t.id):null==(r=e.current[n.current])||r.focus({preventScroll:!0})}),[b]);function N(e){"auto"===y&&(I.current=!e.pointerType)}function B(e){if(P.current=!0,g&&function(e,n,t){return ae(n,t?"ArrowRight"===e:"ArrowLeft"===e,"ArrowUp"===e)}(e.key,w,p))return X(e),r(!1),void(j(o.reference.current)&&o.reference.current.focus());const n=R.current,t=de(u),c=ve(u);if("Home"===e.key&&(R.current=t,f(R.current)),"End"===e.key&&(R.current=c,f(R.current)),fe(e.key,w)){if(X(e),!b&&e.currentTarget.ownerDocument.activeElement===e.currentTarget)return R.current=null!=d?d:se(e.key,w,p)?t:c,void f(R.current);se(e.key,w,p)?R.current=m?n>=c?v&&n!==u.current.length?-1:t:le(u,{startingIndex:n}):Math.min(c,le(u,{startingIndex:n})):R.current=m?n<=t?v&&-1!==n?u.current.length:c:le(u,{startingIndex:n,decrement:!0}):Math.max(t,le(u,{startingIndex:n,decrement:!0})),f(R.current)}}return h((()=>{s&&(null!=d&&(R.current=d),!T&&t&&I.current&&(D.current(R.current),F(u,R)))}),[t,T,d,u,D,F,s]),h((()=>{s&&t&&(null===a?(!T&&I.current&&null==d||v)&&(R.current=v?-1:de(u),D.current(a),F(u,R)):(R.current=a,D.current(a),F(u,R)))}),[t,T,a,d,g,u,D,F,s,x,v,o.floating,null==L?void 0:L.nodesRef]),h((()=>{if(null==d&&s){if(t&&(fe(O.current,w)||I.current&&(" "===O.current||"Enter"===O.current))){const e=de(u),n=ve(u);R.current=function(e,n,t){return ae(n,"ArrowUp"===e,t?"ArrowRight"===e:"ArrowLeft"===e)}(O.current,w,p)?v?u.current.length:n:v?-1:e,D.current(R.current),F(u,R)}O.current=""}}),[t,u,d,D,F,s,w,p,v]),h((()=>{s&&!t&&C.current&&null!=d&&j(o.reference.current)&&o.reference.current.focus()}),[o.reference,d,t,s]),h((()=>(C.current=!0,()=>{C.current=!1})),[]),h((()=>{var e;s&&(t||("auto"===y&&(I.current=!0),R.current=null!=(e=null!=d?d:a)?e:-1,D.current(null)))}),[t,d,a,s,y,D]),s?{reference:{...b&&t&&null!=a&&{"aria-activedescendant":M},onPointerEnter:N,onPointerDown:N,onKeyDown(e){if(P.current=!0,b&&t)return B(e);"auto"===y&&(I.current=!0),O.current=e.key,g?function(e,n,t){return ae(n,t?"ArrowLeft"===e:"ArrowRight"===e,"ArrowDown"===e)}(e.key,w,p)&&(X(e),t?(R.current=de(u),f(R.current)):r(!0)):(fe(e.key,w)&&(R.current=null==d?se(e.key,w,p)?de(u):ve(u):d,X(e),r(!0),f(R.current)),b&&!t&&B(e))}},floating:{"aria-orientation":"both"===w?void 0:w,...b&&null!=a&&{"aria-activedescendant":M},onKeyDown:B,onPointerMove(){P.current=!1}},item:{onClick:e=>{let{currentTarget:n}=e;return n.focus({preventScroll:!0})},...E&&{onPointerMove(e){let{currentTarget:n}=e;const t=n;if(t){const e=u.current.indexOf(t);-1!==e&&f(e)}},onPointerLeave(){var e;P.current||(f(null),b?(R.current=-1,F(u,R)):null==(e=o.floating.current)||e.focus({preventScroll:!0}))}}}}:{}},ge=function(e,n){var t;let{open:r,dataRef:o}=e,{listRef:u,activeIndex:i,onMatch:l=(()=>{}),enabled:a=!0,findMatch:f=null,resetMs:s=1e3,ignoreKeys:d=[],selectedIndex:v=null}=void 0===n?{listRef:{current:[]},activeIndex:null}:n;const m=c(),g=c(""),p=c(null!=(t=null!=v?v:i)?t:-1),b=c(null);function y(e){if(!e.currentTarget.contains(M(e.currentTarget).activeElement))return;g.current.length>0&&" "!==g.current[0]&&(o.current.typing=!0," "===e.key&&X(e));const n=u.current;if(null==n||["Home","End","Escape","Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight",...d].includes(e.key))return;n.every((e=>{var n,t;return!e||(null==(n=e[0])?void 0:n.toLocaleLowerCase())!==(null==(t=e[1])?void 0:t.toLocaleLowerCase())}))&&g.current===e.key&&(g.current="",p.current=b.current),g.current+=e.key,clearTimeout(m.current),m.current=setTimeout((()=>{g.current="",p.current=b.current,o.current.typing=!1}),s);const t=p.current,r=[...n.slice((null!=t?t:0)+1),...n.slice(0,(null!=t?t:0)+1)],c=f?f(r,g.current):r.find((e=>0===(null==e?void 0:e.toLocaleLowerCase().indexOf(g.current)))),i=c?n.indexOf(c):-1;-1!==i&&(l(i),b.current=i)}return h((()=>{r&&(clearTimeout(m.current),b.current=null,g.current="")}),[r]),h((()=>{var e;r&&""===g.current&&(p.current=null!=(e=null!=v?v:i)?e:-1)}),[r,v,i]),a?{reference:{onKeyDown:y},floating:{onKeyDown:y}}:{}};function pe(e){let{open:n=!1,onOpenChange:t=(()=>{}),placement:r,middleware:o,strategy:i,nodeId:a}=void 0===e?{}:e;const f=k(),s=c({}),d=l((()=>b()))[0],m=v({placement:r,middleware:o,strategy:i}),g=u((()=>({...m,dataRef:s,nodeId:a,events:d,open:n,onOpenChange:t})),[m,s,a,d,n,t]);return h((()=>{const e=null==f?void 0:f.nodesRef.current.find((e=>e.id===a));e&&(e.context=g)})),u((()=>({context:g,...m})),[m,g])}export{_ as FloatingDelayGroup,G as FloatingFocusManager,O as FloatingNode,V as FloatingOverlay,q as FloatingPortal,C as FloatingTree,B as safePolygon,te as useClick,ee as useDelayGroup,$ as useDelayGroupContext,re as useDismiss,pe as useFloating,R as useFloatingNodeId,A as useFloatingParentNodeId,k as useFloatingTree,oe as useFocus,ie as useFocusTrap,Q as useHover,L as useId,P as useInteractions,me as useListNavigation,ne as useRole,ge as useTypeahead};

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("@floating-ui/react-dom"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","@floating-ui/react-dom","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).FloatingUIReactDOM={},e.React,e.FloatingUIReactDOM,e.ReactDOM)}(this,(function(e,t,n,r){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function u(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 c=u(t),i=o(t),l="undefined"!=typeof document?t.useLayoutEffect:t.useEffect;function a(){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 s=!1,f=0;const d=()=>"floating-ui-"+f++;const v=c["useId".toString()],g=null!=v?v:function(){const[e,t]=c.useState((()=>s?d():void 0));return l((()=>{null==e&&t(d())}),[]),c.useEffect((()=>{s||(s=!0)}),[]),e},p=t.createContext(null),m=t.createContext(null),y=()=>{var e,n;return null!=(e=null==(n=t.useContext(p))?void 0:n.id)?e:null},b=()=>t.useContext(m);function h(e,t,n){const r={};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;0===n.indexOf("on")?(r[n]||(r[n]=[]),"function"==typeof o&&r[n].push(o),e[n]=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];r[n].forEach((e=>e(...t)))}):e[n]=o})),e):e),{})}}var E={exports:{}},w=function(e,t,n,r){var o=e[0],u=e[1],c=!1;void 0===n&&(n=0),void 0===r&&(r=t.length);for(var i=(r-n)/2,l=0,a=i-1;l<i;a=l++){var s=t[n+2*l+0],f=t[n+2*l+1],d=t[n+2*a+0],v=t[n+2*a+1];f>u!=v>u&&o<(d-s)*(u-f)/(v-f)+s&&(c=!c)}return c},x=function(e,t,n,r){var o=e[0],u=e[1],c=!1;void 0===n&&(n=0),void 0===r&&(r=t.length);for(var i=r-n,l=0,a=i-1;l<i;a=l++){var s=t[l+n][0],f=t[l+n][1],d=t[a+n][0],v=t[a+n][1];f>u!=v>u&&o<(d-s)*(u-f)/(v-f)+s&&(c=!c)}return c};E.exports=function(e,t,n,r){return t.length>0&&Array.isArray(t[0])?x(e,t,n,r):w(e,t,n,r)},E.exports.nested=x,E.exports.flat=w;var R=E.exports;function k(e){var t;return null!=(t=null==e?void 0:e.ownerDocument)?t:document}function O(e){var t;return null!=(t=k(e).defaultView)?t:window}function C(e){return!!e&&e instanceof O(e).Element}function T(e){return!!e&&e instanceof O(e).HTMLElement}function I(e,t){var n;let r=null!=(n=null==e?void 0:e.nodesRef.current.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})))?n:[],o=r;for(;o.length;){var u;o=null!=(u=null==e?void 0:e.nodesRef.current.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)}))})))?u:[],r=r.concat(o)}return r}const L="floating-ui-root";function A(){return A=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},A.apply(this,arguments)}const M="data-floating-ui-scroll-lock",D=t.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;return l((()=>{if(!n)return;const e=window.pageXOffset,t=window.pageYOffset,r=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth;return document.body.hasAttribute(M)?void 0:(Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:"-"+t+"px",left:"-"+e+"px",right:"0",[r]:o+"px"}),document.body.setAttribute(M,""),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[r]:""}),document.body.removeAttribute(M),window.scrollTo(e,t)})}),[n]),i.default.createElement("div",A({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function P(e){const n=t.useRef(e);return l((()=>{n.current=e})),n}function j(e,t,n){return n&&"mouse"!==n?0:"number"==typeof e?e:null==e?void 0:e[t]}const F=t.createContext({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),S=()=>t.useContext(F);var N=new WeakMap,B=new WeakMap,W={},K=0,q=function(e,t,n){void 0===t&&(t=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e)),void 0===n&&(n="data-aria-hidden");var r=Array.isArray(e)?e:[e];W[n]||(W[n]=new WeakMap);var o=W[n],u=[],c=new Set,i=function(e){e&&!c.has(e)&&(c.add(e),i(e.parentNode))};r.forEach(i);var l=function(e){!e||r.indexOf(e)>=0||Array.prototype.forEach.call(e.children,(function(e){if(c.has(e))l(e);else{var t=e.getAttribute("aria-hidden"),r=null!==t&&"false"!==t,i=(N.get(e)||0)+1,a=(o.get(e)||0)+1;N.set(e,i),o.set(e,a),u.push(e),1===i&&r&&B.set(e,!0),1===a&&e.setAttribute(n,"true"),r||e.setAttribute("aria-hidden","true")}}))};return l(t),c.clear(),K++,function(){u.forEach((function(e){var t=N.get(e)-1,r=o.get(e)-1;N.set(e,t),o.set(e,r),t||(B.has(e)||e.removeAttribute("aria-hidden"),B.delete(e)),r||e.removeAttribute(n)})),--K||(N=new WeakMap,N=new WeakMap,B=new WeakMap,W={})}};function H(e){e.preventDefault(),e.stopPropagation()}const U=["content"];function V(e){requestAnimationFrame((()=>{null==e||e.focus()}))}const _="ArrowUp",G="ArrowDown",X="ArrowLeft",Y="ArrowRight";function z(e,t){let{startingIndex:n=-1,decrement:r=!1}=void 0===t?{}:t;const o=te(e);let u=n;do{var c,i;u+=r?-1:1}while(null!=(c=o[u])&&c.hasAttribute("disabled")||"true"===(null==(i=o[u])?void 0:i.getAttribute("aria-disabled")));return-1===u?0:u}function J(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Q(e,t){return J(t,e===_||e===G,e===X||e===Y)}function Z(e,t,n){return J(t,e===G,n?e===X:e===Y)}function $(e){return z(e)}function ee(e){return z(e,{decrement:!0,startingIndex:te(e).length})}function te(e){return e.current.filter((e=>null!=e))}e.FloatingDelayGroup=e=>{let{children:n,delay:r}=e;const[o,u]=t.useState({delay:r,initialDelay:r,currentId:null}),c=t.useCallback((e=>{u((t=>({...t,currentId:e})))}),[]);return i.default.createElement(F.Provider,{value:t.useMemo((()=>({...o,setState:u,setCurrentId:c})),[o,u,c])},n)},e.FloatingNode=e=>{let{children:n,id:r}=e;const o=y();return i.default.createElement(p.Provider,{value:t.useMemo((()=>({id:r,parentId:o})),[r,o])},n)},e.FloatingOverlay=D,e.FloatingPortal=e=>{let{children:n,id:o=L}=e;const[u,c]=t.useState(!1),i=t.useRef(null);return l((()=>{const e=document.getElementById(o);e?i.current=e:(i.current=document.createElement("div"),i.current.id=o);const t=i.current;document.body.contains(t)||document.body.appendChild(t),c(!0)}),[o]),u&&i.current?r.createPortal(n,i.current):null},e.FloatingTree=e=>{let{children:n}=e;const r=t.useRef([]),o=t.useCallback((e=>{r.current=[...r.current,e]}),[]),u=t.useCallback((e=>{r.current=r.current.filter((t=>t!==e))}),[]),c=t.useState((()=>a()))[0];return i.default.createElement(m.Provider,{value:t.useMemo((()=>({nodesRef:r,addNode:o,removeNode:u,events:c})),[r,o,u,c])},n)},e.safePolygon=function(e){let t,{restMs:n=0,buffer:r=1,debug:o=null}=void 0===e?{}:e;return e=>{let{x:o,y:u,placement:c,refs:i,onClose:l,nodeId:a,tree:s}=e;return function(e){var f;if(clearTimeout(t),e.pointerType&&"mouse"!==e.pointerType)return;const{target:d,clientX:v,clientY:g}=e,p=d;if("pointermove"===e.type&&C(i.reference.current)&&i.reference.current.contains(p)||null!=(f=i.floating.current)&&f.contains(p))return;if(s&&I(s,a).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if(!i.reference.current||!i.floating.current||null==c||null==o||null==u)return;const m=i.reference.current.getBoundingClientRect(),y=i.floating.current.getBoundingClientRect(),b=c.split("-")[0],h=o>y.right-y.width/2,E=u>y.bottom-y.height/2;switch(b){case"top":if(v>=y.left&&v<=y.right&&g>=y.bottom&&g<=m.top)return;break;case"bottom":if(v>=y.left&&v<=y.right&&g>=m.bottom&&g<=y.top)return;break;case"left":if(v>=y.right&&v<=m.left&&g>=y.left&&g<=y.right)return;break;case"right":if(v>=y.right&&v<=m.left&&g>=y.right&&g<=m.left)return}const w=function(e){let[t,n]=e;const o=y.width>m.width,u=y.height>m.height;switch(b){case"top":{const e=[o?t:h?t+r:t-r,n+r],u=[o?t:h?t-r:t+r,n+r],c=[[y.left,h||o?y.bottom-r:y.top],[y.right,h?o?y.bottom-r:y.top:y.bottom-r]];return h?[e,u,...c]:[e,...c,u]}case"bottom":{const e=[o?t:h?t+r:t-r,n-r],u=[o?t:h?t-r:t+r,n-r],c=[[y.left,h||o?y.top+r:y.bottom],[y.right,h?o?y.top+r:y.bottom:y.top+r]];return h?[e,u,...c]:[e,...c,u]}case"left":{const e=[t+r,u?n:E?n-r:n+r],o=[t+r,u?n:E?n+r:n-r],c=[[E||u?y.right-r:y.left,y.top],[E?u?y.right-r:y.left:y.right-r,y.bottom]];return E?[e,...c,o]:[...c,e,o]}case"right":{const e=[t-r,u?n:E?n+r:n-r],o=[t-r,u?n:E?n-r:n+r],c=[[E||u?y.left+r:y.right,y.top],[E?u?y.left+r:y.right:y.left+r,y.bottom]];return E?[e,o,...c]:[e,...c,o]}}}([o,u]);R([v,g],w)?n&&(t=setTimeout(l,n)):(clearTimeout(t),l())}}},e.useClick=function(e,n){let{open:r,onOpenChange:o,dataRef:u}=e,{enabled:c=!0,pointerDown:i=!1}=void 0===n?{}:n;const l=t.useRef();return c?{reference:{...i&&{onPointerDown(e){var t;(l.current=e.pointerType,r)?"pointerdown"===(null==(t=u.current.openEvent)?void 0:t.type)&&o(!1):o(!0);u.current.openEvent=e.nativeEvent}},onClick(e){if(i&&l.current)l.current=void 0;else{var t;if(r)"click"===(null==(t=u.current.openEvent)?void 0:t.type)&&o(!1);else o(!0);u.current.openEvent=e.nativeEvent}}}}:{}},e.useDelayGroup=(e,n)=>{let{open:r,onOpenChange:o}=e,{id:u}=n;const{currentId:c,initialDelay:i,setState:l}=S();t.useEffect((()=>{c&&o&&(l((e=>({...e,delay:{open:0,close:j(i,"close")}}))),c!==u&&o(!1))}),[u,o,l,c,i]),t.useEffect((()=>{!r&&c===u&&o&&(o(!1),l((e=>({...e,delay:i,currentId:null}))))}),[r,l,c,u,o,i])},e.useDelayGroupContext=S,e.useDismiss=function(e,r){let{open:o,onOpenChange:u,refs:c,events:i,nodeId:l}=e,{enabled:a=!0,escapeKey:s=!0,outsidePointerDown:f=!0,referencePointerDown:d=!1,ancestorScroll:v=!1,bubbles:g=!0}=void 0===r?{}:r;const p=b(),m=P(u),y=t.useCallback((()=>{var e;return null==(e=c.floating.current)?void 0:e.contains(k(c.floating.current).activeElement)}),[c.floating]),h=t.useCallback((()=>{T(c.reference.current)&&c.reference.current.focus()}),[c.reference]);return t.useEffect((()=>{if(!o||!a)return;function e(e){if("Escape"===e.key){if(!g&&!y())return;i.emit("dismiss"),m.current(!1),h()}}function t(e){var t;const n=p&&I(p,l).some((t=>{var n,r;return null==(n=t.context)||null==(r=n.refs.floating.current)?void 0:r.contains(e.target)}));null!=(t=c.floating.current)&&t.contains(e.target)||C(c.reference.current)&&c.reference.current.contains(e.target)||n||(g||y())&&(i.emit("dismiss"),m.current(!1),h())}function r(){m.current(!1)}const u=k(c.floating.current);s&&u.addEventListener("keydown",e),f&&u.addEventListener("mousedown",t);const d=(v?[...C(c.reference.current)?n.getOverflowAncestors(c.reference.current):[],...C(c.floating.current)?n.getOverflowAncestors(c.floating.current):[]]:[]).filter((e=>{var t;return e!==(null==(t=u.defaultView)?void 0:t.visualViewport)}));return d.forEach((e=>e.addEventListener("scroll",r,{passive:!0}))),()=>{s&&u.removeEventListener("keydown",e),f&&u.removeEventListener("mousedown",t),d.forEach((e=>e.removeEventListener("scroll",r)))}}),[s,f,i,p,l,o,m,h,v,a,g,y,c.floating,c.reference]),a?{reference:{onPointerDown(){d&&(i.emit("dismiss"),u(!1))}}}:{}},e.useFloating=function(e){let{open:r=!1,onOpenChange:o=(()=>{}),placement:u,middleware:c,strategy:i,nodeId:s}=void 0===e?{}:e;const f=b(),d=t.useRef({}),v=t.useState((()=>a()))[0],g=n.useFloating({placement:u,middleware:c,strategy:i}),p=t.useMemo((()=>({...g,dataRef:d,nodeId:s,events:v,open:r,onOpenChange:o})),[g,d,s,v,r,o]);return l((()=>{const e=null==f?void 0:f.nodesRef.current.find((e=>e.id===s));e&&(e.context=p)})),t.useMemo((()=>({context:p,...g})),[g,p])},e.useFloatingNodeId=()=>{const e=g(),t=b(),n=y();return l((()=>{const r={id:e,parentId:n};return null==t||t.addNode(r),()=>{null==t||t.removeNode(r)}}),[t,e,n]),e},e.useFloatingParentNodeId=y,e.useFloatingTree=b,e.useFocus=function(e,n){let{open:r,onOpenChange:o,dataRef:u,refs:c,events:i}=e,{enabled:l=!0,keyboardOnly:a=!0}=void 0===n?{}:n;const s=t.useRef(!1);return t.useEffect((()=>{var e;if(!l)return;const t=null!=(e=k(c.floating.current).defaultView)?e:window;function n(){s.current=!r}function o(){setTimeout((()=>{s.current=!1}))}return t.addEventListener("focus",o),t.addEventListener("blur",n),()=>{t.removeEventListener("focus",o),t.removeEventListener("blur",n)}}),[c.floating,r,l]),t.useEffect((()=>{if(l)return i.on("dismiss",e),()=>{i.off("dismiss",e)};function e(){s.current=!0}}),[i,l]),l?{reference:{onPointerDown(e){let{pointerType:t}=e;s.current=!(!t||!a)},onFocus(e){var t,n,r;s.current||"focus"===e.type&&"mousedown"===(null==(t=u.current.openEvent)?void 0:t.type)&&C(c.reference.current)&&null!=(n=c.reference.current)&&n.contains(null==(r=u.current.openEvent)?void 0:r.target)||(u.current.openEvent=e.nativeEvent,o(!0))},onBlur(e){var t;const n=e.relatedTarget;null!=(t=c.floating.current)&&t.contains(n)||C(c.reference.current)&&c.reference.current.contains(n)||(s.current=!1,o(!1))}}}:{}},e.useFocusTrap=function(e,n){let{open:r,onOpenChange:o,refs:u,nodeId:c}=e,{enabled:i=!0,initialContentFocus:a=0,order:s=U,modal:f=!0,inert:d=!1}=void 0===n?{}:n;const v=t.useRef(!1),g=t.useRef(null),p=t.useRef(null),m=P(f),y=P(s),h=t.useCallback((()=>y.current.map((e=>{return T(u.reference.current)&&"reference"===e?u.reference.current:u.floating.current&&"floating"===e?u.floating.current:"content"===e?Array.from(null!=(t=null==(n=u.floating.current)?void 0:n.querySelectorAll("a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,*[tabindex],*[contenteditable]"))?t:[]):null;var t,n})).filter(Boolean).flat()),[u.floating,u.reference]);l((()=>{const e=u.floating.current;if(!(i&&r&&e&&f))return;function t(){const t=k(e).createElement("div");return t.tabIndex=0,Object.assign(t.style,{position:"fixed",outline:"0",pointerEvents:"none"}),t.setAttribute("aria-hidden","true"),t}g.current||(g.current=t()),p.current||(p.current=t());const n=g.current,o=p.current;function c(e){var t;H(e);const n=h();null==(t=n[e.target===o?0:n.length-1])||t.focus()}return e.insertAdjacentElement("beforebegin",n),e.insertAdjacentElement("afterend",o),n.addEventListener("focus",c),o.addEventListener("focus",c),()=>{var e,t;n.removeEventListener("focus",c),o.removeEventListener("focus",c),null!=(e=n.parentNode)&&e.contains(n)&&n.parentNode.removeChild(n),null!=(t=o.parentNode)&&t.contains(o)&&o.parentNode.removeChild(o)}}),[i,r,f,d,h,u.floating]),t.useEffect((()=>{if(!i||!r||!d)return;function e(e){"Tab"===e.key&&H(e)}const t=k(u.floating.current);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[i,r,d,u.floating]),t.useEffect((()=>{if(!i)return;const e=h();if(d){if(r){const t=e[0];t!==u.floating.current||t.contains(t.ownerDocument.activeElement)||V(t)}}else r&&("number"==typeof a?V(e[a]):a.current&&V(e.find((e=>e===a.current))))}),[h,r,d,f,a,i,u.reference,u.floating]),t.useEffect((()=>{i&&!d&&!r&&m.current&&v.current&&T(u.reference.current)&&V(u.reference.current)}),[r,i,d,m,u.reference]),t.useEffect((()=>{if(r&&f&&i&&u.floating.current)return q(u.floating.current)}),[r,f,i,u.floating]),t.useEffect((()=>(v.current=!0,()=>{v.current=!1})),[]);const E=b();function w(e){var t;const n=e.relatedTarget;null!=(t=u.floating.current)&&t.contains(n)||!C(u.reference.current)||u.reference.current.contains(n)||E&&I(E,c).some((e=>{var t,r,o;return null==(t=e.context)||null==(r=t.refs.floating)||null==(o=r.current)?void 0:o.contains(n)}))||o(!1)}return i?f?{floating:{"aria-modal":"true"}}:{reference:{onBlur:w},floating:{onBlur:w}}:{}},e.useHover=function(e,n){let{enabled:r=!0,delay:o=0,handleClose:u=null,mouseOnly:c=!1,restMs:i=0}=void 0===n?{}:n;const{open:a,onOpenChange:s,dataRef:f,events:d,refs:v}=e,g=b(),p=P(s),m=P(u),y=t.useRef(),h=t.useRef(),E=t.useRef(),w=t.useRef(),x=t.useRef(!0);l((()=>{r&&(a||(y.current=void 0))})),t.useEffect((()=>{if(r)return d.on("dismiss",e),()=>{d.off("dismiss",e)};function e(){clearTimeout(h.current),clearTimeout(w.current),x.current=!0}}),[r,d,v.floating]),t.useEffect((()=>{if(!r||!m.current)return;function e(){var e;null!=(e=f.current.openEvent)&&e.type.includes("mouse")&&p.current(!1)}const t=k(v.floating.current).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[v.floating,p,r,m,f]);const R=t.useCallback((function(e){void 0===e&&(e=!0),o&&!E.current?(clearTimeout(h.current),h.current=setTimeout((()=>p.current(!1)),j(o,"close",y.current))):e&&p.current(!1)}),[o,p]),O=t.useCallback((()=>{E.current&&(k(v.floating.current).removeEventListener("pointermove",E.current),E.current=void 0)}),[v.floating]);if(t.useEffect((()=>{a||O()}),[a,r,O]),t.useEffect((()=>{if(!r)return;function t(e){clearTimeout(h.current),x.current=!1,a||c&&"mouse"!==y.current||i>0&&0===j(o,"open")||(f.current.openEvent=e,o?h.current=setTimeout((()=>{p.current(!0)}),j(o,"open",y.current)):p.current(!0))}function n(t){var n,r;if("click"===(null==(n=f.current.openEvent)?void 0:n.type)||"pointerdown"===(null==(r=f.current.openEvent)?void 0:r.type))return;const o=k(v.floating.current);if(clearTimeout(w.current),m.current)return clearTimeout(h.current),E.current&&o.removeEventListener("pointermove",E.current),E.current=m.current({...e,tree:g,x:t.clientX,y:t.clientY,onClose(){O(),R()}}),void o.addEventListener("pointermove",E.current);R()}const u=v.reference.current;return C(u)?(u.addEventListener("mouseenter",t),u.addEventListener("mouseleave",n),()=>{u.removeEventListener("mouseenter",t),u.removeEventListener("mouseleave",n)}):void 0}),[r,R,e,o,m,f,c,p,a,g,i,O,v.reference,v.floating]),!r)return{};function T(e){y.current=e.pointerType}return{reference:{onPointerDown:T,onPointerEnter:T,onMouseMove(){a||0===i||(clearTimeout(w.current),w.current=setTimeout((()=>{x.current||s(!0)}),i))}},floating:{onMouseEnter(){clearTimeout(h.current)},onMouseLeave:()=>R(!1)}}},e.useId=g,e.useInteractions=function(e){return void 0===e&&(e=[]),{getReferenceProps:t=>h(t,e,"reference"),getFloatingProps:t=>h(t,e,"floating"),getItemProps:t=>h(t,e,"item")}},e.useListNavigation=function(e,n){let{open:r,onOpenChange:o,refs:u}=e,{listRef:c,activeIndex:i,onNavigate:a,enabled:s=!0,selectedIndex:f=null,loop:d=!1,nested:v=!1,rtl:g=!1,virtual:p=!1,focusItemOnOpen:m="auto",focusItemOnHover:h=!0,orientation:E="vertical"}=void 0===n?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:n;const w=y(),x=b(),R=t.useRef(m),k=t.useRef(null!=f?f:-1),O=t.useRef(""),C=t.useRef(!1),I=P(a),L=t.useRef(!1),[A,M]=t.useState(),D=t.useCallback(((e,t)=>{var n,r;p?M(null==(n=te(e)[t.current])?void 0:n.id):null==(r=te(e)[t.current])||r.focus({preventScroll:!0})}),[p]);function j(e){"auto"===m&&(R.current=!e.pointerType)}function F(e){if(L.current=!0,v&&function(e,t,n){return J(t,n?e===Y:e===X,e===_)}(e.key,E,g))return H(e),o(!1),void(T(u.reference.current)&&u.reference.current.focus());const t=k.current,n=$(c),r=ee(c);if("Home"===e.key&&(k.current=n,a(k.current)),"End"===e.key&&(k.current=r,a(k.current)),Q(e.key,E)){if(H(e),!p&&e.currentTarget.ownerDocument.activeElement===e.currentTarget)return k.current=null!=f?f:Z(e.key,E,g)?n:r,void a(k.current);Z(e.key,E,g)?k.current=d?t>=r?n:z(c,{startingIndex:t}):Math.min(r,z(c,{startingIndex:t})):k.current=d?t<=n?r:z(c,{startingIndex:t,decrement:!0}):Math.max(n,z(c,{startingIndex:t,decrement:!0})),a(k.current)}}return l((()=>{s&&(null!=f&&(k.current=f),r&&R.current&&(I.current(k.current),D(c,k)))}),[r,f,c,I,D,s]),l((()=>{s&&r&&null!=i&&(k.current=i,I.current(k.current),D(c,k))}),[r,i,f,c,I,D,s,w,u.floating,null==x?void 0:x.nodesRef]),l((()=>{null==f&&s&&(r&&(Q(O.current,E)||R.current&&(" "===O.current||"Enter"===O.current))&&(k.current=function(e,t,n){return J(t,e===_,n?e===Y:e===X)}(O.current,E,g)?ee(c):$(c),I.current(k.current),D(c,k)),O.current="")}),[r,c,f,I,D,s,E,g]),l((()=>{s&&!r&&C.current&&null!=f&&T(u.reference.current)&&u.reference.current.focus()}),[u.reference,f,r,s]),l((()=>(C.current=!0,()=>{C.current=!1})),[]),l((()=>{var e;s&&(r||("auto"===m&&(R.current=!0),k.current=null!=(e=null!=f?f:i)?e:-1,I.current(null)))}),[r,f,i,s,m,I]),s?{reference:{...p&&r&&{"aria-activedescendant":A},onPointerEnter:j,onPointerDown:j,onKeyDown(e){if(L.current=!0,p&&r)return F(e);"auto"===m&&(R.current=!0),O.current=e.key,v?function(e,t,n){return J(t,n?e===X:e===Y,e===G)}(e.key,E,g)&&(k.current=$(c),H(e),o(!0),a(k.current)):(Q(e.key,E)&&(k.current=null==f?Z(e.key,E,g)?$(c):ee(c):f,H(e),o(!0),a(k.current)),p&&!r&&F(e))}},floating:{"aria-orientation":"both"===E?void 0:E,...p&&{"aria-activedescendant":A},onKeyDown:F,onPointerMove(){L.current=!1}},item:{onClick:e=>{let{currentTarget:t}=e;return t.focus({preventScroll:!0})},...h&&{onPointerMove(e){let{currentTarget:t}=e;const n=t;if(n){const e=te(c).indexOf(n);-1!==e&&a(e)}},onPointerLeave(){var e;L.current||(a(null),p?(k.current=-1,D(c,k)):null==(e=u.floating.current)||e.focus({preventScroll:!0}))}}}}:{}},e.useRole=function(e,t){let{open:n}=e,{enabled:r=!0,role:o="dialog"}=void 0===t?{}:t;const u=g(),c=g(),i={id:u,role:o};return r?"tooltip"===o?{reference:{"aria-describedby":n?u:void 0},floating:i}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":o,"aria-controls":n?u:void 0,..."listbox"===o&&{role:"combobox"},..."menu"===o&&{id:c}},floating:{...i,..."menu"===o&&{"aria-labelledby":c}}}:{}},e.useTypeahead=function(e,n){var r;let{open:o,dataRef:u}=e,{listRef:c,activeIndex:i,onMatch:a=(()=>{}),enabled:s=!0,findMatch:f=null,resetMs:d=1e3,ignoreKeys:v=[],selectedIndex:g=null}=void 0===n?{listRef:{current:[]},activeIndex:null}:n;const p=t.useRef(),m=t.useRef(""),y=t.useRef(null!=(r=null!=g?g:i)?r:-1),b=t.useRef(null);function h(e){if(!e.currentTarget.contains(k(e.currentTarget).activeElement))return;m.current.length>0&&(u.current.typing=!0," "===e.key&&H(e));const t=c.current;if(null==t||["Home","End","Escape","Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight",...v].includes(e.key))return;t.every((e=>{var t,n;return!e||(null==(t=e[0])?void 0:t.toLowerCase())!==(null==(n=e[1])?void 0:n.toLowerCase())}))&&m.current===e.key&&(m.current="",y.current=b.current),m.current+=e.key,clearTimeout(p.current),p.current=setTimeout((()=>{m.current="",y.current=b.current,u.current.typing=!1}),d);const n=y.current,r=[...t.slice((null!=n?n:0)+1),...t.slice(0,(null!=n?n:0)+1)],o=f?f(r,m.current):r.find((e=>0===(null==e?void 0:e.toLowerCase().indexOf(m.current)))),i=o?t.indexOf(o):-1;-1!==i&&(a(i),b.current=i)}return l((()=>{o&&(clearTimeout(p.current),b.current=null,m.current="")}),[o]),l((()=>{var e;o&&""===m.current&&(y.current=null!=(e=null!=g?g:i)?e:-1)}),[o,g,i]),s?{reference:{onKeyDown:h},floating:{onKeyDown:h}}:{}},Object.keys(n).forEach((function(t){"default"===t||e.hasOwnProperty(t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})})),Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react"),require("@floating-ui/react-dom"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","@floating-ui/react-dom","react-dom"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).FloatingUIReactDOM={},e.React,e.FloatingUIReactDOM,e.ReactDOM)}(this,(function(e,n,t,r){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function u(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}})),n.default=e,Object.freeze(n)}var c=u(n),i=o(n),l="undefined"!=typeof document?n.useLayoutEffect:n.useEffect;function a(){const e=new Map;return{emit(n,t){var r;null==(r=e.get(n))||r.forEach((e=>e(t)))},on(n,t){e.set(n,[...e.get(n)||[],t])},off(n,t){e.set(n,(e.get(n)||[]).filter((e=>e!==t)))}}}let f=!1,s=0;const d=()=>"floating-ui-"+s++;const v=c["useId".toString()],g=null!=v?v:function(){const[e,n]=c.useState((()=>f?d():void 0));return l((()=>{null==e&&n(d())}),[]),c.useEffect((()=>{f||(f=!0)}),[]),e},m=n.createContext(null),p=n.createContext(null),b=()=>{var e,t;return null!=(e=null==(t=n.useContext(m))?void 0:t.id)?e:null},y=()=>n.useContext(p);function h(e,n,t){const r={};return{..."floating"===t&&{tabIndex:-1},...e,...n.map((e=>e?e[t]:null)).concat(e).reduce(((e,n)=>n?(Object.entries(n).forEach((n=>{let[t,o]=n;0===t.indexOf("on")?(r[t]||(r[t]=[]),"function"==typeof o&&r[t].push(o),e[t]=function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];r[t].forEach((e=>e(...n)))}):e[t]=o})),e):e),{})}}var E={exports:{}},w=function(e,n,t,r){var o=e[0],u=e[1],c=!1;void 0===t&&(t=0),void 0===r&&(r=n.length);for(var i=(r-t)/2,l=0,a=i-1;l<i;a=l++){var f=n[t+2*l+0],s=n[t+2*l+1],d=n[t+2*a+0],v=n[t+2*a+1];s>u!=v>u&&o<(d-f)*(u-s)/(v-s)+f&&(c=!c)}return c},x=function(e,n,t,r){var o=e[0],u=e[1],c=!1;void 0===t&&(t=0),void 0===r&&(r=n.length);for(var i=r-t,l=0,a=i-1;l<i;a=l++){var f=n[l+t][0],s=n[l+t][1],d=n[a+t][0],v=n[a+t][1];s>u!=v>u&&o<(d-f)*(u-s)/(v-s)+f&&(c=!c)}return c};E.exports=function(e,n,t,r){return n.length>0&&Array.isArray(n[0])?x(e,n,t,r):w(e,n,t,r)},E.exports.nested=x,E.exports.flat=w;var R=E.exports;function k(e){var n;return null!=(n=null==e?void 0:e.ownerDocument)?n:document}function C(e){var n;return null!=(n=k(e).defaultView)?n:window}function O(e){return!!e&&e instanceof C(e).Element}function T(e){return!!e&&e instanceof C(e).HTMLElement}function I(e,n){var t;let r=null!=(t=null==e?void 0:e.nodesRef.current.filter((e=>{var t;return e.parentId===n&&(null==(t=e.context)?void 0:t.open)})))?t:[],o=r;for(;o.length;){var u;o=null!=(u=null==e?void 0:e.nodesRef.current.filter((e=>{var n;return null==(n=o)?void 0:n.some((n=>{var t;return e.parentId===n.id&&(null==(t=e.context)?void 0:t.open)}))})))?u:[],r=r.concat(o)}return r}const L="floating-ui-root";function A(){return A=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},A.apply(this,arguments)}const M="data-floating-ui-scroll-lock",D=n.forwardRef((function(e,n){let{lockScroll:t=!1,...r}=e;return l((()=>{if(!t)return;const e=window.pageXOffset,n=window.pageYOffset,r=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth;return document.body.hasAttribute(M)?void 0:(Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:"-"+n+"px",left:"-"+e+"px",right:"0",[r]:o+"px"}),document.body.setAttribute(M,""),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[r]:""}),document.body.removeAttribute(M),window.scrollTo(e,n)})}),[t]),i.default.createElement("div",A({ref:n},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));var P=new WeakMap,F=new WeakMap,j={},S=0,N=function(e,n,t){void 0===n&&(n=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e)),void 0===t&&(t="data-aria-hidden");var r=Array.isArray(e)?e:[e];j[t]||(j[t]=new WeakMap);var o=j[t],u=[],c=new Set,i=function(e){e&&!c.has(e)&&(c.add(e),i(e.parentNode))};r.forEach(i);var l=function(e){!e||r.indexOf(e)>=0||Array.prototype.forEach.call(e.children,(function(e){if(c.has(e))l(e);else{var n=e.getAttribute("aria-hidden"),r=null!==n&&"false"!==n,i=(P.get(e)||0)+1,a=(o.get(e)||0)+1;P.set(e,i),o.set(e,a),u.push(e),1===i&&r&&F.set(e,!0),1===a&&e.setAttribute(t,"true"),r||e.setAttribute("aria-hidden","true")}}))};return l(n),c.clear(),S++,function(){u.forEach((function(e){var n=P.get(e)-1,r=o.get(e)-1;P.set(e,n),o.set(e,r),n||(F.has(e)||e.removeAttribute("aria-hidden"),F.delete(e)),r||e.removeAttribute(t)})),--S||(P=new WeakMap,P=new WeakMap,F=new WeakMap,j={})}};function B(e){e.preventDefault(),e.stopPropagation()}function K(e){const t=n.useRef(e);return l((()=>{t.current=e})),t}function W(e){requestAnimationFrame((()=>{null==e||e.focus()}))}const q=n.forwardRef((function(e,n){return React.createElement("span",A({},e,{ref:n,tabIndex:0,style:{position:"fixed",opacity:"0",pointerEvents:"none",outline:"0"}}))}));function H(e,n,t){return t&&"mouse"!==t?0:"number"==typeof e?e:null==e?void 0:e[n]}const G=n.createContext({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),U=()=>n.useContext(G),V=["content"];function _(e){requestAnimationFrame((()=>{null==e||e.focus()}))}const X="ArrowUp",Y="ArrowDown",z="ArrowLeft",J="ArrowRight";function Q(e,n){let{startingIndex:t=-1,decrement:r=!1}=void 0===n?{}:n;const o=e.current;let u=t;do{var c,i;u+=r?-1:1}while(u>=0&&u<=o.length-1&&(null==o[u]||null!=(c=o[u])&&c.hasAttribute("disabled")||"true"===(null==(i=o[u])?void 0:i.getAttribute("aria-disabled"))));return u}function Z(e,n,t){switch(e){case"vertical":return n;case"horizontal":return t;default:return n||t}}function $(e,n){return Z(n,e===X||e===Y,e===z||e===J)}function ee(e,n,t){return Z(n,e===Y,t?e===z:e===J)}function ne(e){return Q(e)}function te(e){return Q(e,{decrement:!0,startingIndex:e.current.length})}e.FloatingDelayGroup=e=>{let{children:t,delay:r}=e;const[o,u]=n.useState({delay:r,initialDelay:r,currentId:null}),c=n.useCallback((e=>{u((n=>({...n,currentId:e})))}),[]);return i.default.createElement(G.Provider,{value:n.useMemo((()=>({...o,setState:u,setCurrentId:c})),[o,u,c])},t)},e.FloatingFocusManager=function(e){let{context:{refs:t,nodeId:r,onOpenChange:o},children:u,order:c=["content"],endGuard:i=!0,preventTabbing:l=!1,initialFocus:a=0,returnFocus:f=!0,modal:s=!0}=e;const d=K(c),v=K(o),g=y(),m=n.useCallback((()=>d.current.map((e=>{return T(t.reference.current)&&"reference"===e?t.reference.current:t.floating.current&&"floating"===e?t.floating.current:"content"===e?Array.from(null!=(n=null==(r=t.floating.current)?void 0:r.querySelectorAll("input:not([type='hidden']):not([disabled]),select:not([disabled]),textarea:not([disabled]),a[href],button:not([disabled]),[tabindex],iframe,object,embed,area[href],audio[controls],video[controls],[contenteditable]:not([contenteditable='false'])"))?n:[]):null;var n,r})).flat().filter((e=>{if(e===t.floating.current||e===t.reference.current)return!0;if(T(e)){var n;return"-"!==(null!=(n=e.getAttribute("tabindex"))?n:"0")[0].trim()}}))),[d,t.floating,t.reference]);return n.useEffect((()=>{const e=0===m().filter((e=>e!==t.floating.current&&e!==t.reference.current)).length;function n(n){if("Tab"===n.key){(l||e)&&B(n);const r=m();"reference"===d.current[0]&&n.target===t.reference.current&&(B(n),n.shiftKey?W(r[r.length-1]):W(r[1])),"floating"===d.current[1]&&n.target===t.floating.current&&n.shiftKey&&(B(n),W(r[0]))}}const r=k(t.floating.current);return r.addEventListener("keydown",n),()=>{r.removeEventListener("keydown",n)}}),[l,m,d,t.floating,t.reference]),n.useEffect((()=>{function e(e){var n;const o=e.relatedTarget;null!=(n=t.floating.current)&&n.contains(o)||!O(t.reference.current)||t.reference.current.contains(o)||g&&I(g,r).some((e=>{var n,t;return null==(n=e.context)||null==(t=n.refs.floating.current)?void 0:t.contains(o)}))||v.current(!1)}const n=t.floating.current,o=t.reference.current;if(n&&T(o)){!s&&n.addEventListener("focusout",e);const t=s?N(n):null;return()=>{!s&&n.removeEventListener("focusout",e),null==t||t()}}}),[r,g,s,v,m,a,t.floating,t.reference]),n.useEffect((()=>{var e;if(l)return;const n=t.floating.current,r=null!=(e=k(n).activeElement)?e:document.activeElement;var o;if("number"==typeof a)W(null!=(o=m()[a])?o:n);else if(T(null==a?void 0:a.current)){var u;W(null!=(u=a.current)?u:n)}return()=>{f&&T(r)&&W(r)}}),[l,m,a,s,f,t.floating]),React.createElement(React.Fragment,null,s&&React.createElement(q,{onFocus:e=>{B(e);const n=m();"reference"===c[0]?W(n[0]):W(n[n.length-1])}}),n.cloneElement(u,c.includes("floating")?{tabIndex:0}:{}),s&&i&&React.createElement(q,{onFocus:e=>{B(e),W(m()[0])}}))},e.FloatingNode=e=>{let{children:t,id:r}=e;const o=b();return i.default.createElement(m.Provider,{value:n.useMemo((()=>({id:r,parentId:o})),[r,o])},t)},e.FloatingOverlay=D,e.FloatingPortal=e=>{let{children:t,id:o=L}=e;const[u,c]=n.useState(!1),i=n.useRef(null);return l((()=>{const e=document.getElementById(o);e?i.current=e:(i.current=document.createElement("div"),i.current.id=o);const n=i.current;document.body.contains(n)||document.body.appendChild(n),c(!0)}),[o]),u&&i.current?r.createPortal(t,i.current):null},e.FloatingTree=e=>{let{children:t}=e;const r=n.useRef([]),o=n.useCallback((e=>{r.current=[...r.current,e]}),[]),u=n.useCallback((e=>{r.current=r.current.filter((n=>n!==e))}),[]),c=n.useState((()=>a()))[0];return i.default.createElement(p.Provider,{value:n.useMemo((()=>({nodesRef:r,addNode:o,removeNode:u,events:c})),[r,o,u,c])},t)},e.safePolygon=function(e){let n,{restMs:t=0,buffer:r=1,debug:o=null}=void 0===e?{}:e;return e=>{let{x:o,y:u,placement:c,refs:i,onClose:l,nodeId:a,tree:f}=e;return function(e){var s;if(clearTimeout(n),e.pointerType&&"mouse"!==e.pointerType)return;const{target:d,clientX:v,clientY:g}=e,m=d;if("pointermove"===e.type&&O(i.reference.current)&&i.reference.current.contains(m)||null!=(s=i.floating.current)&&s.contains(m))return;if(f&&I(f,a).some((e=>{let{context:n}=e;return null==n?void 0:n.open})))return;if(!i.reference.current||!i.floating.current||null==c||null==o||null==u)return;const p=i.reference.current.getBoundingClientRect(),b=i.floating.current.getBoundingClientRect(),y=c.split("-")[0],h=o>b.right-b.width/2,E=u>b.bottom-b.height/2;switch(y){case"top":if(v>=b.left&&v<=b.right&&g>=b.bottom&&g<=p.top)return;break;case"bottom":if(v>=b.left&&v<=b.right&&g>=p.bottom&&g<=b.top)return;break;case"left":if(v>=b.right&&v<=p.left&&g>=b.left&&g<=b.right)return;break;case"right":if(v>=b.right&&v<=p.left&&g>=b.right&&g<=p.left)return}const w=function(e){let[n,t]=e;const o=b.width>p.width,u=b.height>p.height;switch(y){case"top":{const e=[o?n:h?n+r:n-r,t+r],u=[o?n:h?n-r:n+r,t+r],c=[[b.left,h||o?b.bottom-r:b.top],[b.right,h?o?b.bottom-r:b.top:b.bottom-r]];return h?[e,u,...c]:[e,...c,u]}case"bottom":{const e=[o?n:h?n+r:n-r,t-r],u=[o?n:h?n-r:n+r,t-r],c=[[b.left,h||o?b.top+r:b.bottom],[b.right,h?o?b.top+r:b.bottom:b.top+r]];return h?[e,u,...c]:[e,...c,u]}case"left":{const e=[n+r,u?t:E?t-r:t+r],o=[n+r,u?t:E?t+r:t-r],c=[[E||u?b.right-r:b.left,b.top],[E?u?b.right-r:b.left:b.right-r,b.bottom]];return E?[e,...c,o]:[...c,e,o]}case"right":{const e=[n-r,u?t:E?t+r:t-r],o=[n-r,u?t:E?t-r:t+r],c=[[E||u?b.left+r:b.right,b.top],[E?u?b.left+r:b.right:b.left+r,b.bottom]];return E?[e,o,...c]:[e,...c,o]}}}([o,u]);R([v,g],w)?t&&(n=setTimeout(l,t)):(clearTimeout(n),l())}}},e.useClick=function(e,t){let{open:r,onOpenChange:o,dataRef:u}=e,{enabled:c=!0,pointerDown:i=!1,toggle:l=!0}=void 0===t?{}:t;const a=n.useRef();return c?{reference:{...i&&{onPointerDown(e){var n;(a.current=e.pointerType,r)?l&&"pointerdown"===(null==(n=u.current.openEvent)?void 0:n.type)&&o(!1):o(!0);u.current.openEvent=e.nativeEvent}},onClick(e){if(i&&a.current)a.current=void 0;else{var n;if(r)l&&"click"===(null==(n=u.current.openEvent)?void 0:n.type)&&o(!1);else o(!0);u.current.openEvent=e.nativeEvent}}}}:{}},e.useDelayGroup=(e,t)=>{let{open:r,onOpenChange:o}=e,{id:u}=t;const{currentId:c,initialDelay:i,setState:l}=U();n.useEffect((()=>{c&&o&&(l((e=>({...e,delay:{open:0,close:H(i,"close")}}))),c!==u&&o(!1))}),[u,o,l,c,i]),n.useEffect((()=>{!r&&c===u&&o&&(o(!1),l((e=>({...e,delay:i,currentId:null}))))}),[r,l,c,u,o,i])},e.useDelayGroupContext=U,e.useDismiss=function(e,r){let{open:o,onOpenChange:u,refs:c,events:i,nodeId:l}=e,{enabled:a=!0,escapeKey:f=!0,outsidePointerDown:s=!0,referencePointerDown:d=!1,ancestorScroll:v=!1,bubbles:g=!0}=void 0===r?{}:r;const m=y(),p=K(u),b=n.useCallback((()=>{var e;return null==(e=c.floating.current)?void 0:e.contains(k(c.floating.current).activeElement)}),[c.floating]),h=n.useCallback((()=>{T(c.reference.current)&&c.reference.current.focus()}),[c.reference]);return n.useEffect((()=>{if(!o||!a)return;function e(e){if("Escape"===e.key){if(!g&&!b())return;i.emit("dismiss"),p.current(!1),h()}}function n(e){var n;const t=m&&I(m,l).some((n=>{var t,r;return null==(t=n.context)||null==(r=t.refs.floating.current)?void 0:r.contains(e.target)}));null!=(n=c.floating.current)&&n.contains(e.target)||O(c.reference.current)&&c.reference.current.contains(e.target)||t||(g||b())&&(i.emit("dismiss"),p.current(!1),h())}function r(){p.current(!1)}const u=k(c.floating.current);f&&u.addEventListener("keydown",e),s&&u.addEventListener("mousedown",n);const d=(v?[...O(c.reference.current)?t.getOverflowAncestors(c.reference.current):[],...O(c.floating.current)?t.getOverflowAncestors(c.floating.current):[]]:[]).filter((e=>{var n;return e!==(null==(n=u.defaultView)?void 0:n.visualViewport)}));return d.forEach((e=>e.addEventListener("scroll",r,{passive:!0}))),()=>{f&&u.removeEventListener("keydown",e),s&&u.removeEventListener("mousedown",n),d.forEach((e=>e.removeEventListener("scroll",r)))}}),[f,s,i,m,l,o,p,h,v,a,g,b,c.floating,c.reference]),a?{reference:{onPointerDown(){d&&(i.emit("dismiss"),u(!1))}}}:{}},e.useFloating=function(e){let{open:r=!1,onOpenChange:o=(()=>{}),placement:u,middleware:c,strategy:i,nodeId:f}=void 0===e?{}:e;const s=y(),d=n.useRef({}),v=n.useState((()=>a()))[0],g=t.useFloating({placement:u,middleware:c,strategy:i}),m=n.useMemo((()=>({...g,dataRef:d,nodeId:f,events:v,open:r,onOpenChange:o})),[g,d,f,v,r,o]);return l((()=>{const e=null==s?void 0:s.nodesRef.current.find((e=>e.id===f));e&&(e.context=m)})),n.useMemo((()=>({context:m,...g})),[g,m])},e.useFloatingNodeId=()=>{const e=g(),n=y(),t=b();return l((()=>{const r={id:e,parentId:t};return null==n||n.addNode(r),()=>{null==n||n.removeNode(r)}}),[n,e,t]),e},e.useFloatingParentNodeId=b,e.useFloatingTree=y,e.useFocus=function(e,t){let{open:r,onOpenChange:o,dataRef:u,refs:c,events:i}=e,{enabled:l=!0,keyboardOnly:a=!0}=void 0===t?{}:t;const f=n.useRef(!1);return n.useEffect((()=>{var e;if(!l)return;const n=null!=(e=k(c.floating.current).defaultView)?e:window;function t(){f.current=!r}function o(){setTimeout((()=>{f.current=!1}))}return n.addEventListener("focus",o),n.addEventListener("blur",t),()=>{n.removeEventListener("focus",o),n.removeEventListener("blur",t)}}),[c.floating,r,l]),n.useEffect((()=>{if(l)return i.on("dismiss",e),()=>{i.off("dismiss",e)};function e(){f.current=!0}}),[i,l]),l?{reference:{onPointerDown(e){let{pointerType:n}=e;f.current=!(!n||!a)},onFocus(e){var n,t,r;f.current||"focus"===e.type&&"mousedown"===(null==(n=u.current.openEvent)?void 0:n.type)&&O(c.reference.current)&&null!=(t=c.reference.current)&&t.contains(null==(r=u.current.openEvent)?void 0:r.target)||(u.current.openEvent=e.nativeEvent,o(!0))},onBlur(e){var n;const t=e.relatedTarget;null!=(n=c.floating.current)&&n.contains(t)||O(c.reference.current)&&c.reference.current.contains(t)||(f.current=!1,o(!1))}}}:{}},e.useFocusTrap=function(e,t){let{open:r,onOpenChange:o,refs:u,nodeId:c}=e,{enabled:i=!0,initialContentFocus:a=0,order:f=V,modal:s=!0,inert:d=!1}=void 0===t?{}:t;const v=n.useRef(!1),g=n.useRef(null),m=n.useRef(null),p=K(s),b=K(f),h=n.useCallback((()=>b.current.map((e=>{return T(u.reference.current)&&"reference"===e?u.reference.current:u.floating.current&&"floating"===e?u.floating.current:"content"===e?Array.from(null!=(n=null==(t=u.floating.current)?void 0:t.querySelectorAll("a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,*[tabindex],*[contenteditable]"))?n:[]):null;var n,t})).filter(Boolean).flat()),[u.floating,u.reference]);l((()=>{const e=u.floating.current;if(!(i&&r&&e&&s))return;function n(){const n=k(e).createElement("div");return n.tabIndex=0,Object.assign(n.style,{position:"fixed",outline:"0",pointerEvents:"none"}),n.setAttribute("aria-hidden","true"),n}g.current||(g.current=n()),m.current||(m.current=n());const t=g.current,o=m.current;function c(e){var n;B(e);const t=h();null==(n=t[e.target===o?0:t.length-1])||n.focus()}return e.insertAdjacentElement("beforebegin",t),e.insertAdjacentElement("afterend",o),t.addEventListener("focus",c),o.addEventListener("focus",c),()=>{var e,n;t.removeEventListener("focus",c),o.removeEventListener("focus",c),null!=(e=t.parentNode)&&e.contains(t)&&t.parentNode.removeChild(t),null!=(n=o.parentNode)&&n.contains(o)&&o.parentNode.removeChild(o)}}),[i,r,s,d,h,u.floating]),n.useEffect((()=>{if(!i||!r||!d)return;function e(e){"Tab"===e.key&&B(e)}const n=k(u.floating.current);return n.addEventListener("keydown",e),()=>{n.removeEventListener("keydown",e)}}),[i,r,d,u.floating]),n.useEffect((()=>{if(!i)return;const e=h();if(d){if(r){const n=e[0];n!==u.floating.current||n.contains(n.ownerDocument.activeElement)||_(n)}}else r&&("number"==typeof a?_(e[a]):a.current&&_(e.find((e=>e===a.current))))}),[h,r,d,s,a,i,u.reference,u.floating]),n.useEffect((()=>{i&&!d&&!r&&p.current&&v.current&&T(u.reference.current)&&_(u.reference.current)}),[r,i,d,p,u.reference]),n.useEffect((()=>{if(r&&s&&i&&u.floating.current)return N(u.floating.current)}),[r,s,i,u.floating]),n.useEffect((()=>(v.current=!0,()=>{v.current=!1})),[]);const E=y();function w(e){var n;const t=e.relatedTarget;null!=(n=u.floating.current)&&n.contains(t)||!O(u.reference.current)||u.reference.current.contains(t)||E&&I(E,c).some((e=>{var n,r,o;return null==(n=e.context)||null==(r=n.refs.floating)||null==(o=r.current)?void 0:o.contains(t)}))||o(!1)}return i?s?{floating:{"aria-modal":"true"}}:{reference:{onBlur:w},floating:{onBlur:w}}:{}},e.useHover=function(e,t){let{enabled:r=!0,delay:o=0,handleClose:u=null,mouseOnly:c=!1,restMs:i=0}=void 0===t?{}:t;const{open:a,onOpenChange:f,dataRef:s,events:d,refs:v}=e,g=y(),m=K(f),p=K(u),b=n.useRef(),h=n.useRef(),E=n.useRef(),w=n.useRef(),x=n.useRef(!0);l((()=>{r&&(a||(b.current=void 0))})),n.useEffect((()=>{if(r)return d.on("dismiss",e),()=>{d.off("dismiss",e)};function e(){clearTimeout(h.current),clearTimeout(w.current),x.current=!0}}),[r,d,v.floating]),n.useEffect((()=>{if(!r||!p.current)return;function e(){var e;null!=(e=s.current.openEvent)&&e.type.includes("mouse")&&m.current(!1)}const n=k(v.floating.current).documentElement;return n.addEventListener("mouseleave",e),()=>{n.removeEventListener("mouseleave",e)}}),[v.floating,m,r,p,s]);const R=n.useCallback((function(e){void 0===e&&(e=!0),o&&!E.current?(clearTimeout(h.current),h.current=setTimeout((()=>m.current(!1)),H(o,"close",b.current))):e&&m.current(!1)}),[o,m]),C=n.useCallback((()=>{E.current&&(k(v.floating.current).removeEventListener("pointermove",E.current),E.current=void 0)}),[v.floating]);if(n.useEffect((()=>{a||C()}),[a,r,C]),n.useEffect((()=>{if(!r)return;function n(e){clearTimeout(h.current),x.current=!1,a||c&&"mouse"!==b.current||i>0&&0===H(o,"open")||(s.current.openEvent=e,o?h.current=setTimeout((()=>{m.current(!0)}),H(o,"open",b.current)):m.current(!0))}function t(n){var t,r;if("click"===(null==(t=s.current.openEvent)?void 0:t.type)||"pointerdown"===(null==(r=s.current.openEvent)?void 0:r.type))return;const o=k(v.floating.current);if(clearTimeout(w.current),p.current)return clearTimeout(h.current),E.current&&o.removeEventListener("pointermove",E.current),E.current=p.current({...e,tree:g,x:n.clientX,y:n.clientY,onClose(){C(),R()}}),void o.addEventListener("pointermove",E.current);R()}const u=v.reference.current;return O(u)?(u.addEventListener("mouseenter",n),u.addEventListener("mouseleave",t),()=>{u.removeEventListener("mouseenter",n),u.removeEventListener("mouseleave",t)}):void 0}),[r,R,e,o,p,s,c,m,a,g,i,C,v.reference,v.floating]),!r)return{};function T(e){b.current=e.pointerType}return{reference:{onPointerDown:T,onPointerEnter:T,onMouseMove(){a||0===i||(clearTimeout(w.current),w.current=setTimeout((()=>{x.current||f(!0)}),i))}},floating:{onMouseEnter(){clearTimeout(h.current)},onMouseLeave:()=>R(!1)}}},e.useId=g,e.useInteractions=function(e){return void 0===e&&(e=[]),{getReferenceProps:n=>h(n,e,"reference"),getFloatingProps:n=>h(n,e,"floating"),getItemProps:n=>h(n,e,"item")}},e.useListNavigation=function(e,t){let{open:r,onOpenChange:o,refs:u}=e,{listRef:c,activeIndex:i,onNavigate:a,enabled:f=!0,selectedIndex:s=null,allowEscape:d=!1,loop:v=!1,nested:g=!1,rtl:m=!1,virtual:p=!1,focusItemOnOpen:h="auto",focusItemOnHover:E=!0,orientation:w="vertical"}=void 0===t?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:t;const x=b(),R=y(),k=function(e){const t=n.useRef();return l((()=>{t.current=e}),[e]),t.current}(r),C=n.useRef(h),O=n.useRef(null!=s?s:-1),I=n.useRef(""),L=n.useRef(!1),A=K(a),M=n.useRef(!1),[D,P]=n.useState(),F=n.useCallback(((e,n)=>{var t,r;p?P(null==(t=e.current[n.current])?void 0:t.id):null==(r=e.current[n.current])||r.focus({preventScroll:!0})}),[p]);function j(e){"auto"===h&&(C.current=!e.pointerType)}function S(e){if(M.current=!0,g&&function(e,n,t){return Z(n,t?e===J:e===z,e===X)}(e.key,w,m))return B(e),o(!1),void(T(u.reference.current)&&u.reference.current.focus());const n=O.current,t=ne(c),r=te(c);if("Home"===e.key&&(O.current=t,a(O.current)),"End"===e.key&&(O.current=r,a(O.current)),$(e.key,w)){if(B(e),!p&&e.currentTarget.ownerDocument.activeElement===e.currentTarget)return O.current=null!=s?s:ee(e.key,w,m)?t:r,void a(O.current);ee(e.key,w,m)?O.current=v?n>=r?d&&n!==c.current.length?-1:t:Q(c,{startingIndex:n}):Math.min(r,Q(c,{startingIndex:n})):O.current=v?n<=t?d&&-1!==n?c.current.length:r:Q(c,{startingIndex:n,decrement:!0}):Math.max(t,Q(c,{startingIndex:n,decrement:!0})),a(O.current)}}return l((()=>{f&&(null!=s&&(O.current=s),!k&&r&&C.current&&(A.current(O.current),F(c,O)))}),[r,k,s,c,A,F,f]),l((()=>{f&&r&&(null===i?(!k&&C.current&&null==s||d)&&(O.current=d?-1:ne(c),A.current(i),F(c,O)):(O.current=i,A.current(i),F(c,O)))}),[r,k,i,s,g,c,A,F,f,x,d,u.floating,null==R?void 0:R.nodesRef]),l((()=>{if(null==s&&f){if(r&&($(I.current,w)||C.current&&(" "===I.current||"Enter"===I.current))){const e=ne(c),n=te(c);O.current=function(e,n,t){return Z(n,e===X,t?e===J:e===z)}(I.current,w,m)?d?c.current.length:n:d?-1:e,A.current(O.current),F(c,O)}I.current=""}}),[r,c,s,A,F,f,w,m,d]),l((()=>{f&&!r&&L.current&&null!=s&&T(u.reference.current)&&u.reference.current.focus()}),[u.reference,s,r,f]),l((()=>(L.current=!0,()=>{L.current=!1})),[]),l((()=>{var e;f&&(r||("auto"===h&&(C.current=!0),O.current=null!=(e=null!=s?s:i)?e:-1,A.current(null)))}),[r,s,i,f,h,A]),f?{reference:{...p&&r&&null!=i&&{"aria-activedescendant":D},onPointerEnter:j,onPointerDown:j,onKeyDown(e){if(M.current=!0,p&&r)return S(e);"auto"===h&&(C.current=!0),I.current=e.key,g?function(e,n,t){return Z(n,t?e===z:e===J,e===Y)}(e.key,w,m)&&(B(e),r?(O.current=ne(c),a(O.current)):o(!0)):($(e.key,w)&&(O.current=null==s?ee(e.key,w,m)?ne(c):te(c):s,B(e),o(!0),a(O.current)),p&&!r&&S(e))}},floating:{"aria-orientation":"both"===w?void 0:w,...p&&null!=i&&{"aria-activedescendant":D},onKeyDown:S,onPointerMove(){M.current=!1}},item:{onClick:e=>{let{currentTarget:n}=e;return n.focus({preventScroll:!0})},...E&&{onPointerMove(e){let{currentTarget:n}=e;const t=n;if(t){const e=c.current.indexOf(t);-1!==e&&a(e)}},onPointerLeave(){var e;M.current||(a(null),p?(O.current=-1,F(c,O)):null==(e=u.floating.current)||e.focus({preventScroll:!0}))}}}}:{}},e.useRole=function(e,n){let{open:t}=e,{enabled:r=!0,role:o="dialog"}=void 0===n?{}:n;const u=g(),c=g(),i={id:u,role:o};return r?"tooltip"===o?{reference:{"aria-describedby":t?u:void 0},floating:i}:{reference:{"aria-expanded":t?"true":"false","aria-haspopup":o,"aria-controls":t?u:void 0,..."listbox"===o&&{role:"combobox"},..."menu"===o&&{id:c}},floating:{...i,..."menu"===o&&{"aria-labelledby":c}}}:{}},e.useTypeahead=function(e,t){var r;let{open:o,dataRef:u}=e,{listRef:c,activeIndex:i,onMatch:a=(()=>{}),enabled:f=!0,findMatch:s=null,resetMs:d=1e3,ignoreKeys:v=[],selectedIndex:g=null}=void 0===t?{listRef:{current:[]},activeIndex:null}:t;const m=n.useRef(),p=n.useRef(""),b=n.useRef(null!=(r=null!=g?g:i)?r:-1),y=n.useRef(null);function h(e){if(!e.currentTarget.contains(k(e.currentTarget).activeElement))return;p.current.length>0&&" "!==p.current[0]&&(u.current.typing=!0," "===e.key&&B(e));const n=c.current;if(null==n||["Home","End","Escape","Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight",...v].includes(e.key))return;n.every((e=>{var n,t;return!e||(null==(n=e[0])?void 0:n.toLocaleLowerCase())!==(null==(t=e[1])?void 0:t.toLocaleLowerCase())}))&&p.current===e.key&&(p.current="",b.current=y.current),p.current+=e.key,clearTimeout(m.current),m.current=setTimeout((()=>{p.current="",b.current=y.current,u.current.typing=!1}),d);const t=b.current,r=[...n.slice((null!=t?t:0)+1),...n.slice(0,(null!=t?t:0)+1)],o=s?s(r,p.current):r.find((e=>0===(null==e?void 0:e.toLocaleLowerCase().indexOf(p.current)))),i=o?n.indexOf(o):-1;-1!==i&&(a(i),y.current=i)}return l((()=>{o&&(clearTimeout(m.current),y.current=null,p.current="")}),[o]),l((()=>{var e;o&&""===p.current&&(b.current=null!=(e=null!=g?g:i)?e:-1)}),[o,g,i]),f?{reference:{onKeyDown:h},floating:{onKeyDown:h}}:{}},Object.keys(t).forEach((function(n){"default"===n||e.hasOwnProperty(n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})})),Object.defineProperty(e,"__esModule",{value:!0})}));
{
"name": "@floating-ui/react-dom-interactions",
"version": "0.2.0",
"version": "0.3.0",
"@rollingversions": {

@@ -59,3 +59,3 @@ "baseVersion": [

"dependencies": {
"@floating-ui/react-dom": "^0.6.2",
"@floating-ui/react-dom": "^0.6.3",
"aria-hidden": "^1.1.3",

@@ -62,0 +62,0 @@ "point-in-polygon": "^1.1.0",

@@ -5,2 +5,3 @@ import type { ElementProps, FloatingContext } from '../types';

pointerDown?: boolean;
toggle?: boolean;
}

@@ -11,2 +12,2 @@ /**

*/
export declare const useClick: <RT extends import("@floating-ui/dom/src/types").ReferenceElement = import("@floating-ui/dom/src/types").ReferenceElement>({ open, onOpenChange, dataRef }: FloatingContext<RT>, { enabled, pointerDown }?: Props) => ElementProps;
export declare const useClick: <RT extends import("@floating-ui/dom/src/types").ReferenceElement = import("@floating-ui/dom/src/types").ReferenceElement>({ open, onOpenChange, dataRef }: FloatingContext<RT>, { enabled, pointerDown, toggle }?: Props) => ElementProps;

@@ -7,5 +7,5 @@ import type { ElementProps, FloatingContext } from '../types';

/**
* Adds hover event listeners that change the open state, like CSS :focus.
* Adds focus event listeners that change the open state, like CSS :focus.
* @see https://floating-ui.com/docs/useFocus
*/
export declare const useFocus: <RT extends import("@floating-ui/dom/src/types").ReferenceElement = import("@floating-ui/dom/src/types").ReferenceElement>({ open, onOpenChange, dataRef, refs, events }: FloatingContext<RT>, { enabled, keyboardOnly }?: Props) => ElementProps;

@@ -12,7 +12,5 @@ import { MutableRefObject } from 'react';

/**
* Traps focus in a loop of focusable elements while the floating element is
* open.
* @see https://floating-ui.com/docs/useFocusTrap
* @deprecated Use `<FloatingFocusManager />` instead.
*/
export declare const useFocusTrap: <RT extends import("@floating-ui/dom/src/types").ReferenceElement = import("@floating-ui/dom/src/types").ReferenceElement>({ open, onOpenChange, refs, nodeId }: FloatingContext<RT>, { enabled, initialContentFocus, order, modal, inert, }?: Props) => ElementProps;
export {};

@@ -11,2 +11,3 @@ import React from 'react';

focusItemOnHover?: boolean;
allowEscape?: boolean;
loop?: boolean;

@@ -23,2 +24,2 @@ nested?: boolean;

*/
export declare const useListNavigation: <RT extends import("@floating-ui/dom/src/types").ReferenceElement = import("@floating-ui/dom/src/types").ReferenceElement>({ open, onOpenChange, refs }: FloatingContext<RT>, { listRef, activeIndex, onNavigate, enabled, selectedIndex, loop, nested, rtl, virtual, focusItemOnOpen, focusItemOnHover, orientation, }?: Props) => ElementProps;
export declare const useListNavigation: <RT extends import("@floating-ui/dom/src/types").ReferenceElement = import("@floating-ui/dom/src/types").ReferenceElement>({ open, onOpenChange, refs }: FloatingContext<RT>, { listRef, activeIndex, onNavigate, enabled, selectedIndex, allowEscape, loop, nested, rtl, virtual, focusItemOnOpen, focusItemOnHover, orientation, }?: Props) => ElementProps;

@@ -34,2 +34,3 @@ import { MutableRefObject } from 'react';

export { FloatingOverlay } from './FloatingOverlay';
export { FloatingFocusManager } from './FloatingFocusManager';
export { FloatingTree, FloatingNode, useFloatingNodeId, useFloatingParentNodeId, useFloatingTree, } from './FloatingTree';

@@ -36,0 +37,0 @@ export { FloatingDelayGroup, useDelayGroup, useDelayGroupContext, } from './FloatingDelayGroup';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc