{"version":3,"file":"index.cjs","names":["getComputedStyle","index","useLayoutEffect","SafeReact","React","computePosition","arrow","flip","offset","shift","offset","offset$1","shift","shift$1","flip","flip$1","arrow","arrow$1","useLayoutEffect","React","useFloating","React"],"sources":["../src/constants/index.ts","../src/context/TipMagicContext.tsx","../src/utils/parseDataAttributes.ts","../src/components/TipMagicEventHandler.tsx","../node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs","../node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs","../node_modules/@floating-ui/react/dist/floating-ui.react.utils.mjs","../node_modules/@floating-ui/core/dist/floating-ui.core.mjs","../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs","../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs","../node_modules/@floating-ui/react/dist/floating-ui.react.mjs","../src/utils/autoFocusTarget.ts","../src/utils/groupCompatibility.ts","../src/utils/tooltipStyles.ts","../src/components/Tooltip/Tooltip.tsx","../src/components/TipMagicPortal.tsx","../src/components/TipMagicTourHighlight.tsx","../src/components/TipMagicProvider.tsx","../src/components/TipAdvisor/utils/collectItems.ts","../node_modules/fuzzysort/fuzzysort.js","../src/components/TipAdvisor/utils/fuzzySearch.ts","../src/components/TipAdvisor/utils/keyboardNavigation.ts","../src/components/TipAdvisor/utils/tooltipPayload.ts","../src/components/TipAdvisor/useTipAdvisorState.ts","../src/components/TipAdvisor/TipAdvisor.tsx","../src/hooks/useFlowState.ts","../src/hooks/useHelperAPI.ts","../src/hooks/useTooltipAPI.ts","../src/hooks/useTipMagic.ts","../src/hooks/useTour/constants.ts","../src/utils/escapeHtml.ts","../src/hooks/useTour/utils/tourSteps.ts","../src/hooks/useTour/utils/tourNavigation.ts","../src/hooks/useTour/utils/buildTourContent.ts","../src/hooks/useTour/utils/backdropManager.ts","../src/hooks/useTour/utils/highlightManager.ts","../src/hooks/useTour/utils/targetWatcher.ts","../src/hooks/useTour/useTour.ts","../src/hooks/useTipAdvisor.ts","../src/utils/getTipProps.ts"],"sourcesContent":["import type {\n  HelperPosition,\n  Placement,\n  TipMagicOptions,\n  TooltipTransitionBehavior,\n} from '../types';\n\n/**\n * Animation timing\n */\nexport const ANIMATION = {\n  TOOLTIP_SHOW: 150,\n  TOOLTIP_HIDE: 100,\n  POSITION_MOVE: 100,\n  CONTENT_CHANGE: 150,\n  HELPER_STATE: 300,\n} as const;\n\n/**\n * Data attribute selectors, unused currently but kept for future use\n */\nexport const DATA_ATTRIBUTES = {\n  TIP: 'data-tip',\n  TIP_ID: 'data-tip-id',\n  TIP_PLACEMENT: 'data-tip-placement',\n  TIP_DELAY: 'data-tip-delay',\n  TIP_HIDE_DELAY: 'data-tip-hide-delay',\n  TIP_DISABLED: 'data-tip-disabled',\n  TIP_ELLIPSIS: 'data-tip-ellipsis',\n  TIP_MAX_LINES: 'data-tip-max-lines',\n  TIP_WORD_WRAP: 'data-tip-word-wrap',\n  TIP_MAX_WIDTH: 'data-tip-max-width',\n  TIP_HTML: 'data-tip-html',\n  TIP_INTERACTIVE: 'data-tip-interactive',\n  TIP_TEXT_BREAK: 'data-tip-text-break',\n  TIP_MOVE: 'data-tip-move',\n  TIP_JUMP: 'data-tip-jump',\n  TIP_MOVE_DURATION: 'data-tip-move-duration',\n  TIP_GROUP: 'data-tip-group',\n  TIP_NO_ARROW: 'data-tip-no-arrow',\n  /**\n   * Keyboard shortcut to display alongside the tooltip content.\n   * @example <button data-tip=\"Copy\" data-tip-shortcut=\"⌘C\">Copy</button>\n   */\n  TIP_SHORTCUT: 'data-tip-shortcut',\n  TIP_SHOW_ON_FOCUS: 'data-tip-show-on-focus',\n  /**\n   * Elements with this attribute will remain visible (not masked) during tour focus.\n   * Useful for headers, sidebars, and other persistent UI elements.\n   * @example <header data-tip-always-visible>...</header>\n   */\n  TIP_ALWAYS_VISIBLE: 'data-tip-always-visible',\n} as const;\n\n/**\n * CSS class names\n */\nexport const CSS_CLASSES = {\n  TOOLTIP: 'tip-magic-tooltip',\n  TOOLTIP_CONTENT: 'tip-magic-content',\n  TOOLTIP_TEXT: 'tip-magic-text',\n  TOOLTIP_ARROW: 'tip-magic-arrow',\n  TOOLTIP_SHORTCUT: 'tip-magic-shortcut',\n  TOOLTIP_VISIBLE: 'tip-magic-visible',\n  TOOLTIP_HIDDEN: 'tip-magic-hidden',\n  TOOLTIP_TRANSITIONING: 'tip-magic-transitioning',\n  HELPER: 'tip-magic-helper',\n  HIGHLIGHT: 'tip-magic-highlight',\n} as const;\n\n/**\n * Marks the primary action inside a tooltip's content, for `autoFocus: 'primary'`\n */\nexport const PRIMARY_ACTION_ATTRIBUTE = 'data-tip-magic-primary';\n\n/**\n * Default selector for tooltip targets\n */\nexport const DEFAULT_SELECTOR = '[data-tip]';\n\n/**\n * Default configuration values\n */\nexport const DEFAULT_OPTIONS: Required<TipMagicOptions> = {\n  showDelay: 200,\n  hideDelay: 700,\n  animationDuration: ANIMATION.TOOLTIP_SHOW,\n  placement: 'top' as Placement,\n  offset: 8,\n  enableHelper: true,\n  helperPosition: 'bottom-right' as HelperPosition,\n  zIndex: 9999,\n  disabled: false,\n  portalContainer: null as unknown as HTMLElement,\n  enableShortcutStyle: true,\n  respectReducedMotion: true,\n  transitionBehavior: 'jump' as TooltipTransitionBehavior,\n  moveTransitionDuration: ANIMATION.POSITION_MOVE,\n  tourHighlightClass: '',\n  showOnFocus: false,\n};\n","import { createContext, useContext, useReducer, type ReactNode } from 'react';\nimport { DEFAULT_OPTIONS } from '../constants';\nimport type {\n  FlowState,\n  FlowStep,\n  HelperInternalState,\n  HelperState,\n  ParsedTooltipData,\n  Placement,\n  TipMagicOptions,\n  TipMagicState,\n  TooltipState,\n} from '../types';\n\n// Re-export types for backwards compatibility\nexport type {\n  FlowState,\n  HelperInternalState,\n  ParsedTooltipData,\n  TipMagicState,\n  TooltipState,\n} from '../types';\n\n/**\n * Initial tooltip state\n */\nconst initialTooltipState: TooltipState = {\n  visible: false,\n  content: '',\n  target: null,\n  position: { x: 0, y: 0 },\n  placement: 'top',\n  isTransitioning: false,\n  parsedData: null,\n  previousGroup: undefined,\n};\n\n/**\n * Initial helper state\n */\nconst initialHelperState: HelperInternalState = {\n  visible: false,\n  state: 'idle',\n  message: undefined,\n  actions: undefined,\n  targetId: undefined,\n  position: 'bottom-right',\n  autoHide: undefined,\n};\n\n/**\n * Initial flow state\n */\nconst initialFlowState: FlowState = {\n  active: false,\n  steps: [],\n  currentIndex: -1,\n};\n\n/**\n * Create initial state with options\n */\nexport function createInitialState(options: TipMagicOptions = {}): TipMagicState {\n  return {\n    tooltip: initialTooltipState,\n    helper: {\n      ...initialHelperState,\n      position: options.helperPosition ?? DEFAULT_OPTIONS.helperPosition,\n    },\n    flow: initialFlowState,\n    config: {\n      ...DEFAULT_OPTIONS,\n      ...options,\n      portalContainer: options.portalContainer ?? DEFAULT_OPTIONS.portalContainer,\n    },\n  };\n}\n\n/**\n * Action types for the reducer\n */\nexport type TipMagicAction =\n  | {\n      type: 'SHOW_TOOLTIP';\n      payload: {\n        target: Element;\n        content: string;\n        parsedData: ParsedTooltipData;\n      };\n    }\n  | { type: 'HIDE_TOOLTIP' }\n  | {\n      type: 'MOVE_TOOLTIP';\n      payload: {\n        target: Element;\n        content: string;\n        parsedData: ParsedTooltipData;\n        previousGroup?: string;\n      };\n    }\n  | {\n      type: 'UPDATE_TOOLTIP_POSITION';\n      payload: { x: number; y: number; placement: Placement };\n    }\n  | { type: 'UPDATE_TOOLTIP_CONTENT'; payload: string }\n  | { type: 'SET_TOOLTIP_TRANSITIONING'; payload: boolean }\n  | { type: 'SHOW_HELPER'; payload: Partial<HelperInternalState> }\n  | { type: 'HIDE_HELPER' }\n  | { type: 'SET_HELPER_STATE'; payload: HelperState }\n  | { type: 'MOVE_HELPER'; payload: string }\n  | { type: 'START_FLOW'; payload: FlowStep[] }\n  | { type: 'NEXT_FLOW_STEP' }\n  | { type: 'PREV_FLOW_STEP' }\n  | { type: 'SET_FLOW_STEP'; payload: number }\n  | { type: 'END_FLOW' };\n\n/**\n * Reducer for TipMagic state\n */\nexport function tipMagicReducer(state: TipMagicState, action: TipMagicAction): TipMagicState {\n  switch (action.type) {\n    case 'SHOW_TOOLTIP':\n      return {\n        ...state,\n        tooltip: {\n          ...state.tooltip,\n          visible: true,\n          target: action.payload.target,\n          content: action.payload.content,\n          parsedData: action.payload.parsedData,\n          isTransitioning: false,\n        },\n      };\n\n    case 'HIDE_TOOLTIP':\n      return {\n        ...state,\n        tooltip: {\n          ...initialTooltipState,\n        },\n      };\n\n    case 'MOVE_TOOLTIP':\n      return {\n        ...state,\n        tooltip: {\n          ...state.tooltip,\n          visible: true, // Ensure visibility when moving (in case tooltip was hidden)\n          target: action.payload.target,\n          content: action.payload.content,\n          parsedData: action.payload.parsedData,\n          isTransitioning: true,\n          previousGroup: action.payload.previousGroup,\n        },\n      };\n\n    case 'UPDATE_TOOLTIP_POSITION':\n      return {\n        ...state,\n        tooltip: {\n          ...state.tooltip,\n          position: { x: action.payload.x, y: action.payload.y },\n          placement: action.payload.placement,\n        },\n      };\n\n    case 'UPDATE_TOOLTIP_CONTENT':\n      return {\n        ...state,\n        tooltip: {\n          ...state.tooltip,\n          content: action.payload,\n        },\n      };\n\n    case 'SET_TOOLTIP_TRANSITIONING':\n      return {\n        ...state,\n        tooltip: {\n          ...state.tooltip,\n          isTransitioning: action.payload,\n        },\n      };\n\n    case 'SHOW_HELPER':\n      return {\n        ...state,\n        helper: {\n          ...state.helper,\n          ...action.payload,\n          visible: true,\n        },\n      };\n\n    case 'HIDE_HELPER':\n      return {\n        ...state,\n        helper: {\n          ...initialHelperState,\n          position: state.config.helperPosition,\n        },\n      };\n\n    case 'SET_HELPER_STATE':\n      return {\n        ...state,\n        helper: {\n          ...state.helper,\n          state: action.payload,\n        },\n      };\n\n    case 'MOVE_HELPER':\n      return {\n        ...state,\n        helper: {\n          ...state.helper,\n          targetId: action.payload,\n        },\n      };\n\n    case 'START_FLOW':\n      return {\n        ...state,\n        flow: {\n          active: true,\n          steps: action.payload,\n          currentIndex: 0,\n        },\n      };\n\n    case 'NEXT_FLOW_STEP':\n      return {\n        ...state,\n        flow: {\n          ...state.flow,\n          currentIndex: Math.min(state.flow.currentIndex + 1, state.flow.steps.length - 1),\n        },\n      };\n\n    case 'PREV_FLOW_STEP':\n      return {\n        ...state,\n        flow: {\n          ...state.flow,\n          currentIndex: Math.max(state.flow.currentIndex - 1, 0),\n        },\n      };\n\n    case 'SET_FLOW_STEP':\n      return {\n        ...state,\n        flow: {\n          ...state.flow,\n          currentIndex: Math.min(\n            Math.max(action.payload, 0),\n            Math.max(state.flow.steps.length - 1, 0)\n          ),\n        },\n      };\n\n    case 'END_FLOW':\n      return {\n        ...state,\n        flow: initialFlowState,\n      };\n\n    default:\n      return state;\n  }\n}\n\n/**\n * Context value interface\n */\nexport interface TipMagicContextValue {\n  state: TipMagicState;\n  dispatch: React.Dispatch<TipMagicAction>;\n}\n\n/**\n * Create the context\n */\nexport const TipMagicContext = createContext<TipMagicContextValue | null>(null);\n\n/**\n * Hook to access TipMagic context\n */\nexport function useTipMagicContext(): TipMagicContextValue {\n  const context = useContext(TipMagicContext);\n  if (!context) {\n    throw new Error('useTipMagicContext must be used within a TipMagicProvider');\n  }\n  return context;\n}\n\n/**\n * Provider props\n */\nexport interface TipMagicContextProviderProps {\n  children: ReactNode;\n  options?: TipMagicOptions;\n}\n\n/**\n * Context provider component\n */\nexport function TipMagicContextProvider({ children, options }: TipMagicContextProviderProps) {\n  const [state, dispatch] = useReducer(tipMagicReducer, options, createInitialState);\n\n  return (\n    <TipMagicContext.Provider value={{ state, dispatch }}>{children}</TipMagicContext.Provider>\n  );\n}\n","import { DEFAULT_OPTIONS } from '../constants';\nimport type { ParsedTooltipData, Placement, TextBreak } from '../types';\n\n/**\n * Valid placement values\n */\nconst VALID_PLACEMENTS: Placement[] = [\n  'top',\n  'top-start',\n  'top-end',\n  'bottom',\n  'bottom-start',\n  'bottom-end',\n  'left',\n  'left-start',\n  'left-end',\n  'right',\n  'right-start',\n  'right-end',\n];\n\n/**\n * Parse a placement string to a valid Placement type\n */\nfunction parsePlacement(value: string | undefined): Placement {\n  if (value && VALID_PLACEMENTS.includes(value as Placement)) {\n    return value as Placement;\n  }\n  return DEFAULT_OPTIONS.placement;\n}\n\n/**\n * Parse an integer from a string with a default fallback\n */\nfunction parseIntWithDefault(value: string | undefined, defaultValue: number): number {\n  if (value === undefined) return defaultValue;\n  const parsed = parseInt(value, 10);\n  return isNaN(parsed) ? defaultValue : parsed;\n}\n\n/**\n * Check if a boolean data attribute is present\n * Boolean data attributes are considered true if they exist (even if empty)\n */\nfunction parseBooleanAttribute(value: string | undefined): boolean {\n  return value !== undefined;\n}\n\n/**\n * Parse transition behavior from data attributes\n * data-tip-move takes precedence over data-tip-jump\n */\nfunction parseTransitionBehavior(dataset: DOMStringMap): 'move' | 'jump' | undefined {\n  if (dataset.tipMove !== undefined) {\n    return 'move';\n  }\n  if (dataset.tipJump !== undefined) {\n    return 'jump';\n  }\n  return undefined; // Use provider default\n}\n\n/**\n * Parse optional integer (returns undefined if not present)\n */\nfunction parseOptionalInt(value: string | undefined): number | undefined {\n  if (value === undefined) return undefined;\n  const parsed = parseInt(value, 10);\n  return isNaN(parsed) ? undefined : parsed;\n}\n\n/**\n * Valid text break values\n */\nconst VALID_TEXT_BREAKS: TextBreak[] = ['normal', 'break-all', 'keep-all'];\n\n/**\n * Parse text break value\n */\nfunction parseTextBreak(value: string | undefined): TextBreak {\n  if (value && VALID_TEXT_BREAKS.includes(value as TextBreak)) {\n    return value as TextBreak;\n  }\n  return 'normal';\n}\n\n/**\n * Parse all tooltip-related data attributes from an element\n */\nexport function parseDataAttributes(element: Element): ParsedTooltipData {\n  const dataset = (element as HTMLElement).dataset;\n\n  return {\n    content: dataset.tip ?? '',\n    id: dataset.tipId,\n    placement: parsePlacement(dataset.tipPlacement),\n    delay: parseIntWithDefault(dataset.tipDelay, DEFAULT_OPTIONS.showDelay),\n    hideDelay: parseOptionalInt(dataset.tipHideDelay),\n    disabled: parseBooleanAttribute(dataset.tipDisabled),\n    ellipsis: parseBooleanAttribute(dataset.tipEllipsis),\n    maxLines: parseIntWithDefault(dataset.tipMaxLines, 1),\n    wordWrap: parseBooleanAttribute(dataset.tipWordWrap),\n    textBreak: parseTextBreak(dataset.tipTextBreak),\n    maxWidth: parseIntWithDefault(dataset.tipMaxWidth, 300),\n    html: parseBooleanAttribute(dataset.tipHtml),\n    interactive: parseBooleanAttribute(dataset.tipInteractive),\n    transitionBehavior: parseTransitionBehavior(dataset),\n    moveTransitionDuration: parseOptionalInt(dataset.tipMoveDuration),\n    showArrow: !parseBooleanAttribute(dataset.tipNoArrow),\n    shortcut: dataset.tipShortcut,\n    group: dataset.tipGroup,\n    showOnFocus: parseBooleanAttribute(dataset.tipShowOnFocus),\n  };\n}\n\n/**\n * Generate a unique ID for a tooltip target if not provided\n */\nlet tooltipIdCounter = 0;\nexport function generateTooltipId(): string {\n  return `tip-magic-${++tooltipIdCounter}`;\n}\n","import { useCallback, useEffect, useRef } from 'react';\nimport { DEFAULT_SELECTOR } from '../constants';\nimport { useTipMagicContext } from '../context/TipMagicContext';\nimport { parseDataAttributes } from '../utils/parseDataAttributes';\n\n/**\n * Internal component that handles event delegation for tooltips\n *\n * This component sets up document-level event listeners for:\n * - Mouse hover (mouseover/mouseout)\n * - Focus management (focusin/focusout)\n * - Keyboard navigation (Escape to dismiss)\n *\n * It uses refs to avoid stale closure issues in timeouts and\n * properly manages show/hide delays for smooth transitions.\n */\nexport function TipMagicEventHandler() {\n  const { state, dispatch } = useTipMagicContext();\n  const { config, tooltip, flow } = state;\n\n  // Refs for timeout management\n  const showTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n  const hideTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n  const currentTargetRef = useRef<Element | null>(null);\n  // Refs to track current state (avoids stale closure issues in timeouts)\n  const isVisibleRef = useRef(tooltip.visible);\n  isVisibleRef.current = tooltip.visible;\n  // Track parsed data for hide delay (to avoid useEffect re-runs)\n  const parsedDataRef = useRef(tooltip.parsedData);\n  parsedDataRef.current = tooltip.parsedData;\n  // Track flow active state to disable hover tooltips during tours\n  const isFlowActiveRef = useRef(flow.active);\n  isFlowActiveRef.current = flow.active;\n\n  // Clear all timeouts\n  const clearTimeouts = useCallback(() => {\n    if (showTimeoutRef.current) {\n      clearTimeout(showTimeoutRef.current);\n      showTimeoutRef.current = null;\n    }\n    if (hideTimeoutRef.current) {\n      clearTimeout(hideTimeoutRef.current);\n      hideTimeoutRef.current = null;\n    }\n  }, []);\n\n  // Show tooltip for a target element\n  const showTooltip = useCallback(\n    (target: Element) => {\n      const parsedData = parseDataAttributes(target);\n\n      // Don't show if disabled\n      if (parsedData.disabled || config.disabled) {\n        return;\n      }\n\n      const content = parsedData.content;\n      if (!content) {\n        return;\n      }\n\n      // Use ref for current visibility to avoid stale closure issues\n      const isCurrentlyVisible = isVisibleRef.current;\n\n      // If tooltip is already visible, move it instead of show/hide\n      if (isCurrentlyVisible && currentTargetRef.current !== target) {\n        // Get the previous tooltip's group for group-based transition logic\n        const previousParsedData = currentTargetRef.current\n          ? parseDataAttributes(currentTargetRef.current)\n          : null;\n        const previousGroup = previousParsedData?.group;\n\n        dispatch({\n          type: 'MOVE_TOOLTIP',\n          payload: { target, content, parsedData, previousGroup },\n        });\n      } else if (!isCurrentlyVisible) {\n        dispatch({\n          type: 'SHOW_TOOLTIP',\n          payload: { target, content, parsedData },\n        });\n      }\n\n      currentTargetRef.current = target;\n    },\n    [config.disabled, dispatch]\n  );\n\n  // Hide the tooltip\n  const hideTooltip = useCallback(() => {\n    dispatch({ type: 'HIDE_TOOLTIP' });\n    currentTargetRef.current = null;\n  }, [dispatch]);\n\n  // Handle mouseover event\n  const handleMouseOver = useCallback(\n    (event: MouseEvent) => {\n      // Disable hover tooltips when a flow/tour is active\n      if (isFlowActiveRef.current) {\n        return;\n      }\n\n      const target = (event.target as Element).closest(DEFAULT_SELECTOR);\n      const isOverTooltip = (event.target as Element).closest('.tip-magic-tooltip');\n\n      if (target && target !== currentTargetRef.current) {\n        // Clear existing show timeout\n        if (showTimeoutRef.current) {\n          clearTimeout(showTimeoutRef.current);\n        }\n\n        // Get delay from element or use default\n        const parsedData = parseDataAttributes(target);\n        const delay = parsedData.delay ?? config.showDelay;\n\n        // Use ref for current visibility to avoid stale closure issues\n        if (isVisibleRef.current) {\n          // Tooltip is already visible - handle transition to new target\n          if (delay === 0) {\n            // No delay: clear hide timeout and show immediately (smooth transition)\n            if (hideTimeoutRef.current) {\n              clearTimeout(hideTimeoutRef.current);\n              hideTimeoutRef.current = null;\n            }\n            showTooltip(target);\n          } else {\n            // Has delay: keep hide timeout running, schedule show\n            // Whichever fires first wins (hide or show)\n            showTimeoutRef.current = setTimeout(() => {\n              // Clear any pending hide timeout when showing new target\n              if (hideTimeoutRef.current) {\n                clearTimeout(hideTimeoutRef.current);\n                hideTimeoutRef.current = null;\n              }\n              showTooltip(target);\n            }, delay);\n          }\n        } else {\n          // Tooltip not visible - just schedule showing with delay\n          if (delay === 0) {\n            showTooltip(target);\n          } else {\n            showTimeoutRef.current = setTimeout(() => {\n              showTooltip(target);\n            }, delay);\n          }\n        }\n      } else if (isOverTooltip) {\n        // Hovering over the tooltip itself - cancel hide\n        if (hideTimeoutRef.current) {\n          clearTimeout(hideTimeoutRef.current);\n          hideTimeoutRef.current = null;\n        }\n      }\n    },\n    [config.showDelay, showTooltip]\n  );\n\n  // Handle mouseout event\n  const handleMouseOut = useCallback(\n    (event: MouseEvent) => {\n      // Disable hover tooltips when a flow/tour is active\n      if (isFlowActiveRef.current) {\n        return;\n      }\n\n      const target = event.target as Element;\n      const relatedTarget = event.relatedTarget as Element | null;\n      const isLeavingTooltip = target.closest('.tip-magic-tooltip');\n      const isLeavingTarget = target.closest(DEFAULT_SELECTOR);\n\n      // Don't hide if moving to the tooltip itself (for interactive tooltips)\n      if (relatedTarget?.closest('.tip-magic-tooltip')) {\n        return;\n      }\n\n      // Don't hide if moving to the helper\n      if (relatedTarget?.closest('.tip-magic-helper')) {\n        return;\n      }\n\n      // Don't hide if moving to another tooltip target\n      if (relatedTarget?.closest(DEFAULT_SELECTOR)) {\n        return;\n      }\n\n      // Don't hide if moving from tooltip back to the original target\n      if (isLeavingTooltip && relatedTarget === currentTargetRef.current) {\n        return;\n      }\n\n      // Clear show timeout if leaving before it triggers\n      if (showTimeoutRef.current) {\n        clearTimeout(showTimeoutRef.current);\n        showTimeoutRef.current = null;\n      }\n\n      // Schedule hide with delay if leaving a tooltip target or the tooltip itself\n      // Use refs to avoid stale closures and prevent useEffect from re-running\n      if (isVisibleRef.current && (isLeavingTarget || isLeavingTooltip)) {\n        // Use per-element hide delay if set, otherwise use provider config\n        const hideDelay = parsedDataRef.current?.hideDelay ?? config.hideDelay;\n\n        // Clear any existing hide timeout first\n        if (hideTimeoutRef.current) {\n          clearTimeout(hideTimeoutRef.current);\n        }\n        hideTimeoutRef.current = setTimeout(() => {\n          hideTooltip();\n        }, hideDelay);\n      }\n    },\n    [config.hideDelay, hideTooltip]\n  );\n\n  // Handle focus event for accessibility\n  const handleFocusIn = useCallback(\n    (event: FocusEvent) => {\n      // Disable focus tooltips when a flow/tour is active\n      if (isFlowActiveRef.current) {\n        return;\n      }\n\n      const target = (event.target as Element).closest(DEFAULT_SELECTOR);\n      if (target) {\n        // Check if showOnFocus is enabled for this element or globally\n        const parsedData = parseDataAttributes(target);\n        const shouldShowOnFocus = parsedData.showOnFocus || config.showOnFocus;\n\n        if (shouldShowOnFocus) {\n          showTooltip(target);\n        }\n      }\n    },\n    [showTooltip, config.showOnFocus]\n  );\n\n  // Handle blur event\n  const handleFocusOut = useCallback(\n    (event: FocusEvent) => {\n      // Disable focus tooltips when a flow/tour is active\n      if (isFlowActiveRef.current) {\n        return;\n      }\n\n      const target = (event.target as Element).closest(DEFAULT_SELECTOR);\n      const relatedTarget = event.relatedTarget as Element | null;\n\n      // Don't hide if moving focus to another tooltip target that also has showOnFocus\n      if (relatedTarget?.closest(DEFAULT_SELECTOR)) {\n        const relatedParsedData = parseDataAttributes(relatedTarget.closest(DEFAULT_SELECTOR)!);\n        const relatedShowOnFocus = relatedParsedData.showOnFocus || config.showOnFocus;\n        if (relatedShowOnFocus) {\n          return;\n        }\n      }\n\n      if (target) {\n        // Check if showOnFocus is enabled for this element or globally\n        const parsedData = parseDataAttributes(target);\n        const shouldShowOnFocus = parsedData.showOnFocus || config.showOnFocus;\n\n        if (shouldShowOnFocus) {\n          // Use per-element hide delay if set, otherwise use provider config (use ref)\n          const hideDelay = parsedDataRef.current?.hideDelay ?? config.hideDelay;\n          hideTimeoutRef.current = setTimeout(() => {\n            hideTooltip();\n          }, hideDelay);\n        }\n      }\n    },\n    [config.hideDelay, config.showOnFocus, hideTooltip]\n  );\n\n  // Handle escape key to dismiss\n  const handleKeyDown = useCallback(\n    (event: KeyboardEvent) => {\n      if (event.key === 'Escape' && isVisibleRef.current) {\n        clearTimeouts();\n        hideTooltip();\n      }\n    },\n    [clearTimeouts, hideTooltip]\n  );\n\n  // Set up event delegation\n  useEffect(() => {\n    if (config.disabled) {\n      return;\n    }\n\n    document.addEventListener('mouseover', handleMouseOver, { passive: true });\n    document.addEventListener('mouseout', handleMouseOut, { passive: true });\n    document.addEventListener('focusin', handleFocusIn, { passive: true });\n    document.addEventListener('focusout', handleFocusOut, { passive: true });\n    document.addEventListener('keydown', handleKeyDown);\n\n    return () => {\n      document.removeEventListener('mouseover', handleMouseOver);\n      document.removeEventListener('mouseout', handleMouseOut);\n      document.removeEventListener('focusin', handleFocusIn);\n      document.removeEventListener('focusout', handleFocusOut);\n      document.removeEventListener('keydown', handleKeyDown);\n      clearTimeouts();\n    };\n  }, [\n    config.disabled,\n    handleMouseOver,\n    handleMouseOut,\n    handleFocusIn,\n    handleFocusOut,\n    handleKeyDown,\n    clearTimeouts,\n  ]);\n\n  // Clear any pending timeouts when a flow/tour starts\n  // This prevents the regular tooltip hide delay from affecting tour tooltips\n  useEffect(() => {\n    if (flow.active) {\n      clearTimeouts();\n      currentTargetRef.current = null;\n    }\n  }, [flow.active, clearTimeouts]);\n\n  return null;\n}\n","function hasWindow() {\n  return typeof window !== 'undefined';\n}\nfunction getNodeName(node) {\n  if (isNode(node)) {\n    return (node.nodeName || '').toLowerCase();\n  }\n  // Mocked nodes in testing environments may not be instances of Node. By\n  // returning `#document` an infinite loop won't occur.\n  // https://github.com/floating-ui/floating-ui/issues/2317\n  return '#document';\n}\nfunction getWindow(node) {\n  var _node$ownerDocument;\n  return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;\n}\nfunction getDocumentElement(node) {\n  var _ref;\n  return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;\n}\nfunction isNode(value) {\n  if (!hasWindow()) {\n    return false;\n  }\n  return value instanceof Node || value instanceof getWindow(value).Node;\n}\nfunction isElement(value) {\n  if (!hasWindow()) {\n    return false;\n  }\n  return value instanceof Element || value instanceof getWindow(value).Element;\n}\nfunction isHTMLElement(value) {\n  if (!hasWindow()) {\n    return false;\n  }\n  return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;\n}\nfunction isShadowRoot(value) {\n  if (!hasWindow() || typeof ShadowRoot === 'undefined') {\n    return false;\n  }\n  return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;\n}\nconst invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);\nfunction isOverflowElement(element) {\n  const {\n    overflow,\n    overflowX,\n    overflowY,\n    display\n  } = getComputedStyle(element);\n  return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);\n}\nconst tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']);\nfunction isTableElement(element) {\n  return tableElements.has(getNodeName(element));\n}\nconst topLayerSelectors = [':popover-open', ':modal'];\nfunction isTopLayer(element) {\n  return topLayerSelectors.some(selector => {\n    try {\n      return element.matches(selector);\n    } catch (_e) {\n      return false;\n    }\n  });\n}\nconst transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];\nconst willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];\nconst containValues = ['paint', 'layout', 'strict', 'content'];\nfunction isContainingBlock(elementOrCss) {\n  const webkit = isWebKit();\n  const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;\n\n  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n  // https://drafts.csswg.org/css-transforms-2/#individual-transforms\n  return transformProperties.some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || willChangeValues.some(value => (css.willChange || '').includes(value)) || containValues.some(value => (css.contain || '').includes(value));\n}\nfunction getContainingBlock(element) {\n  let currentNode = getParentNode(element);\n  while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {\n    if (isContainingBlock(currentNode)) {\n      return currentNode;\n    } else if (isTopLayer(currentNode)) {\n      return null;\n    }\n    currentNode = getParentNode(currentNode);\n  }\n  return null;\n}\nfunction isWebKit() {\n  if (typeof CSS === 'undefined' || !CSS.supports) return false;\n  return CSS.supports('-webkit-backdrop-filter', 'none');\n}\nconst lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);\nfunction isLastTraversableNode(node) {\n  return lastTraversableNodeNames.has(getNodeName(node));\n}\nfunction getComputedStyle(element) {\n  return getWindow(element).getComputedStyle(element);\n}\nfunction getNodeScroll(element) {\n  if (isElement(element)) {\n    return {\n      scrollLeft: element.scrollLeft,\n      scrollTop: element.scrollTop\n    };\n  }\n  return {\n    scrollLeft: element.scrollX,\n    scrollTop: element.scrollY\n  };\n}\nfunction getParentNode(node) {\n  if (getNodeName(node) === 'html') {\n    return node;\n  }\n  const result =\n  // Step into the shadow DOM of the parent of a slotted node.\n  node.assignedSlot ||\n  // DOM Element detected.\n  node.parentNode ||\n  // ShadowRoot detected.\n  isShadowRoot(node) && node.host ||\n  // Fallback.\n  getDocumentElement(node);\n  return isShadowRoot(result) ? result.host : result;\n}\nfunction getNearestOverflowAncestor(node) {\n  const parentNode = getParentNode(node);\n  if (isLastTraversableNode(parentNode)) {\n    return node.ownerDocument ? node.ownerDocument.body : node.body;\n  }\n  if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {\n    return parentNode;\n  }\n  return getNearestOverflowAncestor(parentNode);\n}\nfunction getOverflowAncestors(node, list, traverseIframes) {\n  var _node$ownerDocument2;\n  if (list === void 0) {\n    list = [];\n  }\n  if (traverseIframes === void 0) {\n    traverseIframes = true;\n  }\n  const scrollableAncestor = getNearestOverflowAncestor(node);\n  const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);\n  const win = getWindow(scrollableAncestor);\n  if (isBody) {\n    const frameElement = getFrameElement(win);\n    return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);\n  }\n  return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));\n}\nfunction getFrameElement(win) {\n  return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;\n}\n\nexport { getComputedStyle, getContainingBlock, getDocumentElement, getFrameElement, getNearestOverflowAncestor, getNodeName, getNodeScroll, getOverflowAncestors, getParentNode, getWindow, isContainingBlock, isElement, isHTMLElement, isLastTraversableNode, isNode, isOverflowElement, isShadowRoot, isTableElement, isTopLayer, isWebKit };\n","/**\n * Custom positioning reference element.\n * @see https://floating-ui.com/docs/virtual-elements\n */\n\nconst sides = ['top', 'right', 'bottom', 'left'];\nconst alignments = ['start', 'end'];\nconst placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + \"-\" + alignments[0], side + \"-\" + alignments[1]), []);\nconst min = Math.min;\nconst max = Math.max;\nconst round = Math.round;\nconst floor = Math.floor;\nconst createCoords = v => ({\n  x: v,\n  y: v\n});\nconst oppositeSideMap = {\n  left: 'right',\n  right: 'left',\n  bottom: 'top',\n  top: 'bottom'\n};\nconst oppositeAlignmentMap = {\n  start: 'end',\n  end: 'start'\n};\nfunction clamp(start, value, end) {\n  return max(start, min(value, end));\n}\nfunction evaluate(value, param) {\n  return typeof value === 'function' ? value(param) : value;\n}\nfunction getSide(placement) {\n  return placement.split('-')[0];\n}\nfunction getAlignment(placement) {\n  return placement.split('-')[1];\n}\nfunction getOppositeAxis(axis) {\n  return axis === 'x' ? 'y' : 'x';\n}\nfunction getAxisLength(axis) {\n  return axis === 'y' ? 'height' : 'width';\n}\nconst yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);\nfunction getSideAxis(placement) {\n  return yAxisSides.has(getSide(placement)) ? 'y' : 'x';\n}\nfunction getAlignmentAxis(placement) {\n  return getOppositeAxis(getSideAxis(placement));\n}\nfunction getAlignmentSides(placement, rects, rtl) {\n  if (rtl === void 0) {\n    rtl = false;\n  }\n  const alignment = getAlignment(placement);\n  const alignmentAxis = getAlignmentAxis(placement);\n  const length = getAxisLength(alignmentAxis);\n  let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';\n  if (rects.reference[length] > rects.floating[length]) {\n    mainAlignmentSide = getOppositePlacement(mainAlignmentSide);\n  }\n  return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];\n}\nfunction getExpandedPlacements(placement) {\n  const oppositePlacement = getOppositePlacement(placement);\n  return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];\n}\nfunction getOppositeAlignmentPlacement(placement) {\n  return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);\n}\nconst lrPlacement = ['left', 'right'];\nconst rlPlacement = ['right', 'left'];\nconst tbPlacement = ['top', 'bottom'];\nconst btPlacement = ['bottom', 'top'];\nfunction getSideList(side, isStart, rtl) {\n  switch (side) {\n    case 'top':\n    case 'bottom':\n      if (rtl) return isStart ? rlPlacement : lrPlacement;\n      return isStart ? lrPlacement : rlPlacement;\n    case 'left':\n    case 'right':\n      return isStart ? tbPlacement : btPlacement;\n    default:\n      return [];\n  }\n}\nfunction getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {\n  const alignment = getAlignment(placement);\n  let list = getSideList(getSide(placement), direction === 'start', rtl);\n  if (alignment) {\n    list = list.map(side => side + \"-\" + alignment);\n    if (flipAlignment) {\n      list = list.concat(list.map(getOppositeAlignmentPlacement));\n    }\n  }\n  return list;\n}\nfunction getOppositePlacement(placement) {\n  return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);\n}\nfunction expandPaddingObject(padding) {\n  return {\n    top: 0,\n    right: 0,\n    bottom: 0,\n    left: 0,\n    ...padding\n  };\n}\nfunction getPaddingObject(padding) {\n  return typeof padding !== 'number' ? expandPaddingObject(padding) : {\n    top: padding,\n    right: padding,\n    bottom: padding,\n    left: padding\n  };\n}\nfunction rectToClientRect(rect) {\n  const {\n    x,\n    y,\n    width,\n    height\n  } = rect;\n  return {\n    width,\n    height,\n    top: y,\n    left: x,\n    right: x + width,\n    bottom: y + height,\n    x,\n    y\n  };\n}\n\nexport { alignments, clamp, createCoords, evaluate, expandPaddingObject, floor, getAlignment, getAlignmentAxis, getAlignmentSides, getAxisLength, getExpandedPlacements, getOppositeAlignmentPlacement, getOppositeAxis, getOppositeAxisPlacements, getOppositePlacement, getPaddingObject, getSide, getSideAxis, max, min, placements, rectToClientRect, round, sides };\n","import { isShadowRoot, isHTMLElement } from '@floating-ui/utils/dom';\nimport * as React from 'react';\nimport { useLayoutEffect } from 'react';\nimport { floor } from '@floating-ui/utils';\nimport { tabbable } from 'tabbable';\n\n// Avoid Chrome DevTools blue warning.\nfunction getPlatform() {\n  const uaData = navigator.userAgentData;\n  if (uaData != null && uaData.platform) {\n    return uaData.platform;\n  }\n  return navigator.platform;\n}\nfunction getUserAgent() {\n  const uaData = navigator.userAgentData;\n  if (uaData && Array.isArray(uaData.brands)) {\n    return uaData.brands.map(_ref => {\n      let {\n        brand,\n        version\n      } = _ref;\n      return brand + \"/\" + version;\n    }).join(' ');\n  }\n  return navigator.userAgent;\n}\nfunction isSafari() {\n  // Chrome DevTools does not complain about navigator.vendor\n  return /apple/i.test(navigator.vendor);\n}\nfunction isAndroid() {\n  const re = /android/i;\n  return re.test(getPlatform()) || re.test(getUserAgent());\n}\nfunction isMac() {\n  return getPlatform().toLowerCase().startsWith('mac') && !navigator.maxTouchPoints;\n}\nfunction isJSDOM() {\n  return getUserAgent().includes('jsdom/');\n}\n\nconst FOCUSABLE_ATTRIBUTE = 'data-floating-ui-focusable';\nconst TYPEABLE_SELECTOR = \"input:not([type='hidden']):not([disabled]),\" + \"[contenteditable]:not([contenteditable='false']),textarea:not([disabled])\";\nconst ARROW_LEFT = 'ArrowLeft';\nconst ARROW_RIGHT = 'ArrowRight';\nconst ARROW_UP = 'ArrowUp';\nconst ARROW_DOWN = 'ArrowDown';\n\nfunction activeElement(doc) {\n  let activeElement = doc.activeElement;\n  while (((_activeElement = activeElement) == null || (_activeElement = _activeElement.shadowRoot) == null ? void 0 : _activeElement.activeElement) != null) {\n    var _activeElement;\n    activeElement = activeElement.shadowRoot.activeElement;\n  }\n  return activeElement;\n}\nfunction contains(parent, child) {\n  if (!parent || !child) {\n    return false;\n  }\n  const rootNode = child.getRootNode == null ? void 0 : child.getRootNode();\n\n  // First, attempt with faster native method\n  if (parent.contains(child)) {\n    return true;\n  }\n\n  // then fallback to custom implementation with Shadow DOM support\n  if (rootNode && isShadowRoot(rootNode)) {\n    let next = child;\n    while (next) {\n      if (parent === next) {\n        return true;\n      }\n      // @ts-ignore\n      next = next.parentNode || next.host;\n    }\n  }\n\n  // Give up, the result is false\n  return false;\n}\nfunction getTarget(event) {\n  if ('composedPath' in event) {\n    return event.composedPath()[0];\n  }\n\n  // TS thinks `event` is of type never as it assumes all browsers support\n  // `composedPath()`, but browsers without shadow DOM don't.\n  return event.target;\n}\nfunction isEventTargetWithin(event, node) {\n  if (node == null) {\n    return false;\n  }\n  if ('composedPath' in event) {\n    return event.composedPath().includes(node);\n  }\n\n  // TS thinks `event` is of type never as it assumes all browsers support composedPath, but browsers without shadow dom don't\n  const e = event;\n  return e.target != null && node.contains(e.target);\n}\nfunction isRootElement(element) {\n  return element.matches('html,body');\n}\nfunction getDocument(node) {\n  return (node == null ? void 0 : node.ownerDocument) || document;\n}\nfunction isTypeableElement(element) {\n  return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);\n}\nfunction isTypeableCombobox(element) {\n  if (!element) return false;\n  return element.getAttribute('role') === 'combobox' && isTypeableElement(element);\n}\nfunction matchesFocusVisible(element) {\n  // We don't want to block focus from working with `visibleOnly`\n  // (JSDOM doesn't match `:focus-visible` when the element has `:focus`)\n  if (!element || isJSDOM()) return true;\n  try {\n    return element.matches(':focus-visible');\n  } catch (_e) {\n    return true;\n  }\n}\nfunction getFloatingFocusElement(floatingElement) {\n  if (!floatingElement) {\n    return null;\n  }\n  // Try to find the element that has `{...getFloatingProps()}` spread on it.\n  // This indicates the floating element is acting as a positioning wrapper, and\n  // so focus should be managed on the child element with the event handlers and\n  // aria props.\n  return floatingElement.hasAttribute(FOCUSABLE_ATTRIBUTE) ? floatingElement : floatingElement.querySelector(\"[\" + FOCUSABLE_ATTRIBUTE + \"]\") || floatingElement;\n}\n\nfunction getNodeChildren(nodes, id, onlyOpenChildren) {\n  if (onlyOpenChildren === void 0) {\n    onlyOpenChildren = true;\n  }\n  const directChildren = nodes.filter(node => {\n    var _node$context;\n    return node.parentId === id && (!onlyOpenChildren || ((_node$context = node.context) == null ? void 0 : _node$context.open));\n  });\n  return directChildren.flatMap(child => [child, ...getNodeChildren(nodes, child.id, onlyOpenChildren)]);\n}\nfunction getDeepestNode(nodes, id) {\n  let deepestNodeId;\n  let maxDepth = -1;\n  function findDeepest(nodeId, depth) {\n    if (depth > maxDepth) {\n      deepestNodeId = nodeId;\n      maxDepth = depth;\n    }\n    const children = getNodeChildren(nodes, nodeId);\n    children.forEach(child => {\n      findDeepest(child.id, depth + 1);\n    });\n  }\n  findDeepest(id, 0);\n  return nodes.find(node => node.id === deepestNodeId);\n}\nfunction getNodeAncestors(nodes, id) {\n  var _nodes$find;\n  let allAncestors = [];\n  let currentParentId = (_nodes$find = nodes.find(node => node.id === id)) == null ? void 0 : _nodes$find.parentId;\n  while (currentParentId) {\n    const currentNode = nodes.find(node => node.id === currentParentId);\n    currentParentId = currentNode == null ? void 0 : currentNode.parentId;\n    if (currentNode) {\n      allAncestors = allAncestors.concat(currentNode);\n    }\n  }\n  return allAncestors;\n}\n\nfunction stopEvent(event) {\n  event.preventDefault();\n  event.stopPropagation();\n}\nfunction isReactEvent(event) {\n  return 'nativeEvent' in event;\n}\n\n// License: https://github.com/adobe/react-spectrum/blob/b35d5c02fe900badccd0cf1a8f23bb593419f238/packages/@react-aria/utils/src/isVirtualEvent.ts\nfunction isVirtualClick(event) {\n  // FIXME: Firefox is now emitting a deprecation warning for `mozInputSource`.\n  // Try to find a workaround for this. `react-aria` source still has the check.\n  if (event.mozInputSource === 0 && event.isTrusted) {\n    return true;\n  }\n  if (isAndroid() && event.pointerType) {\n    return event.type === 'click' && event.buttons === 1;\n  }\n  return event.detail === 0 && !event.pointerType;\n}\nfunction isVirtualPointerEvent(event) {\n  if (isJSDOM()) return false;\n  return !isAndroid() && event.width === 0 && event.height === 0 || isAndroid() && event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === 'mouse' ||\n  // iOS VoiceOver returns 0.333• for width/height.\n  event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === 'touch';\n}\nfunction isMouseLikePointerType(pointerType, strict) {\n  // On some Linux machines with Chromium, mouse inputs return a `pointerType`\n  // of \"pen\": https://github.com/floating-ui/floating-ui/issues/2015\n  const values = ['mouse', 'pen'];\n  if (!strict) {\n    values.push('', undefined);\n  }\n  return values.includes(pointerType);\n}\n\nvar isClient = typeof document !== 'undefined';\n\nvar noop = function noop() {};\nvar index = isClient ? useLayoutEffect : noop;\n\n// https://github.com/mui/material-ui/issues/41190#issuecomment-2040873379\nconst SafeReact = {\n  ...React\n};\n\nfunction useLatestRef(value) {\n  const ref = React.useRef(value);\n  index(() => {\n    ref.current = value;\n  });\n  return ref;\n}\nconst useInsertionEffect = SafeReact.useInsertionEffect;\nconst useSafeInsertionEffect = useInsertionEffect || (fn => fn());\nfunction useEffectEvent(callback) {\n  const ref = React.useRef(() => {\n    if (process.env.NODE_ENV !== \"production\") {\n      throw new Error('Cannot call an event handler while rendering.');\n    }\n  });\n  useSafeInsertionEffect(() => {\n    ref.current = callback;\n  });\n  return React.useCallback(function () {\n    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n      args[_key] = arguments[_key];\n    }\n    return ref.current == null ? void 0 : ref.current(...args);\n  }, []);\n}\n\nfunction isDifferentGridRow(index, cols, prevRow) {\n  return Math.floor(index / cols) !== prevRow;\n}\nfunction isIndexOutOfListBounds(listRef, index) {\n  return index < 0 || index >= listRef.current.length;\n}\nfunction getMinListIndex(listRef, disabledIndices) {\n  return findNonDisabledListIndex(listRef, {\n    disabledIndices\n  });\n}\nfunction getMaxListIndex(listRef, disabledIndices) {\n  return findNonDisabledListIndex(listRef, {\n    decrement: true,\n    startingIndex: listRef.current.length,\n    disabledIndices\n  });\n}\nfunction findNonDisabledListIndex(listRef, _temp) {\n  let {\n    startingIndex = -1,\n    decrement = false,\n    disabledIndices,\n    amount = 1\n  } = _temp === void 0 ? {} : _temp;\n  let index = startingIndex;\n  do {\n    index += decrement ? -amount : amount;\n  } while (index >= 0 && index <= listRef.current.length - 1 && isListIndexDisabled(listRef, index, disabledIndices));\n  return index;\n}\nfunction getGridNavigatedIndex(listRef, _ref) {\n  let {\n    event,\n    orientation,\n    loop,\n    rtl,\n    cols,\n    disabledIndices,\n    minIndex,\n    maxIndex,\n    prevIndex,\n    stopEvent: stop = false\n  } = _ref;\n  let nextIndex = prevIndex;\n  if (event.key === ARROW_UP) {\n    stop && stopEvent(event);\n    if (prevIndex === -1) {\n      nextIndex = maxIndex;\n    } else {\n      nextIndex = findNonDisabledListIndex(listRef, {\n        startingIndex: nextIndex,\n        amount: cols,\n        decrement: true,\n        disabledIndices\n      });\n      if (loop && (prevIndex - cols < minIndex || nextIndex < 0)) {\n        const col = prevIndex % cols;\n        const maxCol = maxIndex % cols;\n        const offset = maxIndex - (maxCol - col);\n        if (maxCol === col) {\n          nextIndex = maxIndex;\n        } else {\n          nextIndex = maxCol > col ? offset : offset - cols;\n        }\n      }\n    }\n    if (isIndexOutOfListBounds(listRef, nextIndex)) {\n      nextIndex = prevIndex;\n    }\n  }\n  if (event.key === ARROW_DOWN) {\n    stop && stopEvent(event);\n    if (prevIndex === -1) {\n      nextIndex = minIndex;\n    } else {\n      nextIndex = findNonDisabledListIndex(listRef, {\n        startingIndex: prevIndex,\n        amount: cols,\n        disabledIndices\n      });\n      if (loop && prevIndex + cols > maxIndex) {\n        nextIndex = findNonDisabledListIndex(listRef, {\n          startingIndex: prevIndex % cols - cols,\n          amount: cols,\n          disabledIndices\n        });\n      }\n    }\n    if (isIndexOutOfListBounds(listRef, nextIndex)) {\n      nextIndex = prevIndex;\n    }\n  }\n\n  // Remains on the same row/column.\n  if (orientation === 'both') {\n    const prevRow = floor(prevIndex / cols);\n    if (event.key === (rtl ? ARROW_LEFT : ARROW_RIGHT)) {\n      stop && stopEvent(event);\n      if (prevIndex % cols !== cols - 1) {\n        nextIndex = findNonDisabledListIndex(listRef, {\n          startingIndex: prevIndex,\n          disabledIndices\n        });\n        if (loop && isDifferentGridRow(nextIndex, cols, prevRow)) {\n          nextIndex = findNonDisabledListIndex(listRef, {\n            startingIndex: prevIndex - prevIndex % cols - 1,\n            disabledIndices\n          });\n        }\n      } else if (loop) {\n        nextIndex = findNonDisabledListIndex(listRef, {\n          startingIndex: prevIndex - prevIndex % cols - 1,\n          disabledIndices\n        });\n      }\n      if (isDifferentGridRow(nextIndex, cols, prevRow)) {\n        nextIndex = prevIndex;\n      }\n    }\n    if (event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT)) {\n      stop && stopEvent(event);\n      if (prevIndex % cols !== 0) {\n        nextIndex = findNonDisabledListIndex(listRef, {\n          startingIndex: prevIndex,\n          decrement: true,\n          disabledIndices\n        });\n        if (loop && isDifferentGridRow(nextIndex, cols, prevRow)) {\n          nextIndex = findNonDisabledListIndex(listRef, {\n            startingIndex: prevIndex + (cols - prevIndex % cols),\n            decrement: true,\n            disabledIndices\n          });\n        }\n      } else if (loop) {\n        nextIndex = findNonDisabledListIndex(listRef, {\n          startingIndex: prevIndex + (cols - prevIndex % cols),\n          decrement: true,\n          disabledIndices\n        });\n      }\n      if (isDifferentGridRow(nextIndex, cols, prevRow)) {\n        nextIndex = prevIndex;\n      }\n    }\n    const lastRow = floor(maxIndex / cols) === prevRow;\n    if (isIndexOutOfListBounds(listRef, nextIndex)) {\n      if (loop && lastRow) {\n        nextIndex = event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT) ? maxIndex : findNonDisabledListIndex(listRef, {\n          startingIndex: prevIndex - prevIndex % cols - 1,\n          disabledIndices\n        });\n      } else {\n        nextIndex = prevIndex;\n      }\n    }\n  }\n  return nextIndex;\n}\n\n/** For each cell index, gets the item index that occupies that cell */\nfunction createGridCellMap(sizes, cols, dense) {\n  const cellMap = [];\n  let startIndex = 0;\n  sizes.forEach((_ref2, index) => {\n    let {\n      width,\n      height\n    } = _ref2;\n    if (width > cols) {\n      if (process.env.NODE_ENV !== \"production\") {\n        throw new Error(\"[Floating UI]: Invalid grid - item width at index \" + index + \" is greater than grid columns\");\n      }\n    }\n    let itemPlaced = false;\n    if (dense) {\n      startIndex = 0;\n    }\n    while (!itemPlaced) {\n      const targetCells = [];\n      for (let i = 0; i < width; i++) {\n        for (let j = 0; j < height; j++) {\n          targetCells.push(startIndex + i + j * cols);\n        }\n      }\n      if (startIndex % cols + width <= cols && targetCells.every(cell => cellMap[cell] == null)) {\n        targetCells.forEach(cell => {\n          cellMap[cell] = index;\n        });\n        itemPlaced = true;\n      } else {\n        startIndex++;\n      }\n    }\n  });\n\n  // convert into a non-sparse array\n  return [...cellMap];\n}\n\n/** Gets cell index of an item's corner or -1 when index is -1. */\nfunction getGridCellIndexOfCorner(index, sizes, cellMap, cols, corner) {\n  if (index === -1) return -1;\n  const firstCellIndex = cellMap.indexOf(index);\n  const sizeItem = sizes[index];\n  switch (corner) {\n    case 'tl':\n      return firstCellIndex;\n    case 'tr':\n      if (!sizeItem) {\n        return firstCellIndex;\n      }\n      return firstCellIndex + sizeItem.width - 1;\n    case 'bl':\n      if (!sizeItem) {\n        return firstCellIndex;\n      }\n      return firstCellIndex + (sizeItem.height - 1) * cols;\n    case 'br':\n      return cellMap.lastIndexOf(index);\n  }\n}\n\n/** Gets all cell indices that correspond to the specified indices */\nfunction getGridCellIndices(indices, cellMap) {\n  return cellMap.flatMap((index, cellIndex) => indices.includes(index) ? [cellIndex] : []);\n}\nfunction isListIndexDisabled(listRef, index, disabledIndices) {\n  if (typeof disabledIndices === 'function') {\n    return disabledIndices(index);\n  } else if (disabledIndices) {\n    return disabledIndices.includes(index);\n  }\n  const element = listRef.current[index];\n  return element == null || element.hasAttribute('disabled') || element.getAttribute('aria-disabled') === 'true';\n}\n\nconst getTabbableOptions = () => ({\n  getShadowRoot: true,\n  displayCheck:\n  // JSDOM does not support the `tabbable` library. To solve this we can\n  // check if `ResizeObserver` is a real function (not polyfilled), which\n  // determines if the current environment is JSDOM-like.\n  typeof ResizeObserver === 'function' && ResizeObserver.toString().includes('[native code]') ? 'full' : 'none'\n});\nfunction getTabbableIn(container, dir) {\n  const list = tabbable(container, getTabbableOptions());\n  const len = list.length;\n  if (len === 0) return;\n  const active = activeElement(getDocument(container));\n  const index = list.indexOf(active);\n  const nextIndex = index === -1 ? dir === 1 ? 0 : len - 1 : index + dir;\n  return list[nextIndex];\n}\nfunction getNextTabbable(referenceElement) {\n  return getTabbableIn(getDocument(referenceElement).body, 1) || referenceElement;\n}\nfunction getPreviousTabbable(referenceElement) {\n  return getTabbableIn(getDocument(referenceElement).body, -1) || referenceElement;\n}\nfunction isOutsideEvent(event, container) {\n  const containerElement = container || event.currentTarget;\n  const relatedTarget = event.relatedTarget;\n  return !relatedTarget || !contains(containerElement, relatedTarget);\n}\nfunction disableFocusInside(container) {\n  const tabbableElements = tabbable(container, getTabbableOptions());\n  tabbableElements.forEach(element => {\n    element.dataset.tabindex = element.getAttribute('tabindex') || '';\n    element.setAttribute('tabindex', '-1');\n  });\n}\nfunction enableFocusInside(container) {\n  const elements = container.querySelectorAll('[data-tabindex]');\n  elements.forEach(element => {\n    const tabindex = element.dataset.tabindex;\n    delete element.dataset.tabindex;\n    if (tabindex) {\n      element.setAttribute('tabindex', tabindex);\n    } else {\n      element.removeAttribute('tabindex');\n    }\n  });\n}\n\nexport { activeElement, contains, createGridCellMap, disableFocusInside, enableFocusInside, findNonDisabledListIndex, getDeepestNode, getDocument, getFloatingFocusElement, getGridCellIndexOfCorner, getGridCellIndices, getGridNavigatedIndex, getMaxListIndex, getMinListIndex, getNextTabbable, getNodeAncestors, getNodeChildren, getPlatform, getPreviousTabbable, getTabbableOptions, getTarget, getUserAgent, isAndroid, isDifferentGridRow, isEventTargetWithin, isIndexOutOfListBounds, isJSDOM, isListIndexDisabled, isMac, isMouseLikePointerType, isOutsideEvent, isReactEvent, isRootElement, isSafari, isTypeableCombobox, isTypeableElement, isVirtualClick, isVirtualPointerEvent, matchesFocusVisible, stopEvent, useEffectEvent, useLatestRef, index as useModernLayoutEffect };\n","import { getSideAxis, getAlignmentAxis, getAxisLength, getSide, getAlignment, evaluate, getPaddingObject, rectToClientRect, min, clamp, placements, getAlignmentSides, getOppositeAlignmentPlacement, getOppositePlacement, getExpandedPlacements, getOppositeAxisPlacements, sides, max, getOppositeAxis } from '@floating-ui/utils';\nexport { rectToClientRect } from '@floating-ui/utils';\n\nfunction computeCoordsFromPlacement(_ref, placement, rtl) {\n  let {\n    reference,\n    floating\n  } = _ref;\n  const sideAxis = getSideAxis(placement);\n  const alignmentAxis = getAlignmentAxis(placement);\n  const alignLength = getAxisLength(alignmentAxis);\n  const side = getSide(placement);\n  const isVertical = sideAxis === 'y';\n  const commonX = reference.x + reference.width / 2 - floating.width / 2;\n  const commonY = reference.y + reference.height / 2 - floating.height / 2;\n  const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;\n  let coords;\n  switch (side) {\n    case 'top':\n      coords = {\n        x: commonX,\n        y: reference.y - floating.height\n      };\n      break;\n    case 'bottom':\n      coords = {\n        x: commonX,\n        y: reference.y + reference.height\n      };\n      break;\n    case 'right':\n      coords = {\n        x: reference.x + reference.width,\n        y: commonY\n      };\n      break;\n    case 'left':\n      coords = {\n        x: reference.x - floating.width,\n        y: commonY\n      };\n      break;\n    default:\n      coords = {\n        x: reference.x,\n        y: reference.y\n      };\n  }\n  switch (getAlignment(placement)) {\n    case 'start':\n      coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);\n      break;\n    case 'end':\n      coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);\n      break;\n  }\n  return coords;\n}\n\n/**\n * Computes the `x` and `y` coordinates that will place the floating element\n * next to a given reference element.\n *\n * This export does not have any `platform` interface logic. You will need to\n * write one for the platform you are using Floating UI with.\n */\nconst computePosition = async (reference, floating, config) => {\n  const {\n    placement = 'bottom',\n    strategy = 'absolute',\n    middleware = [],\n    platform\n  } = config;\n  const validMiddleware = middleware.filter(Boolean);\n  const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));\n  let rects = await platform.getElementRects({\n    reference,\n    floating,\n    strategy\n  });\n  let {\n    x,\n    y\n  } = computeCoordsFromPlacement(rects, placement, rtl);\n  let statefulPlacement = placement;\n  let middlewareData = {};\n  let resetCount = 0;\n  for (let i = 0; i < validMiddleware.length; i++) {\n    const {\n      name,\n      fn\n    } = validMiddleware[i];\n    const {\n      x: nextX,\n      y: nextY,\n      data,\n      reset\n    } = await fn({\n      x,\n      y,\n      initialPlacement: placement,\n      placement: statefulPlacement,\n      strategy,\n      middlewareData,\n      rects,\n      platform,\n      elements: {\n        reference,\n        floating\n      }\n    });\n    x = nextX != null ? nextX : x;\n    y = nextY != null ? nextY : y;\n    middlewareData = {\n      ...middlewareData,\n      [name]: {\n        ...middlewareData[name],\n        ...data\n      }\n    };\n    if (reset && resetCount <= 50) {\n      resetCount++;\n      if (typeof reset === 'object') {\n        if (reset.placement) {\n          statefulPlacement = reset.placement;\n        }\n        if (reset.rects) {\n          rects = reset.rects === true ? await platform.getElementRects({\n            reference,\n            floating,\n            strategy\n          }) : reset.rects;\n        }\n        ({\n          x,\n          y\n        } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));\n      }\n      i = -1;\n    }\n  }\n  return {\n    x,\n    y,\n    placement: statefulPlacement,\n    strategy,\n    middlewareData\n  };\n};\n\n/**\n * Resolves with an object of overflow side offsets that determine how much the\n * element is overflowing a given clipping boundary on each side.\n * - positive = overflowing the boundary by that number of pixels\n * - negative = how many pixels left before it will overflow\n * - 0 = lies flush with the boundary\n * @see https://floating-ui.com/docs/detectOverflow\n */\nasync function detectOverflow(state, options) {\n  var _await$platform$isEle;\n  if (options === void 0) {\n    options = {};\n  }\n  const {\n    x,\n    y,\n    platform,\n    rects,\n    elements,\n    strategy\n  } = state;\n  const {\n    boundary = 'clippingAncestors',\n    rootBoundary = 'viewport',\n    elementContext = 'floating',\n    altBoundary = false,\n    padding = 0\n  } = evaluate(options, state);\n  const paddingObject = getPaddingObject(padding);\n  const altContext = elementContext === 'floating' ? 'reference' : 'floating';\n  const element = elements[altBoundary ? altContext : elementContext];\n  const clippingClientRect = rectToClientRect(await platform.getClippingRect({\n    element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),\n    boundary,\n    rootBoundary,\n    strategy\n  }));\n  const rect = elementContext === 'floating' ? {\n    x,\n    y,\n    width: rects.floating.width,\n    height: rects.floating.height\n  } : rects.reference;\n  const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));\n  const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {\n    x: 1,\n    y: 1\n  } : {\n    x: 1,\n    y: 1\n  };\n  const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({\n    elements,\n    rect,\n    offsetParent,\n    strategy\n  }) : rect);\n  return {\n    top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,\n    bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,\n    left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,\n    right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x\n  };\n}\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = options => ({\n  name: 'arrow',\n  options,\n  async fn(state) {\n    const {\n      x,\n      y,\n      placement,\n      rects,\n      platform,\n      elements,\n      middlewareData\n    } = state;\n    // Since `element` is required, we don't Partial<> the type.\n    const {\n      element,\n      padding = 0\n    } = evaluate(options, state) || {};\n    if (element == null) {\n      return {};\n    }\n    const paddingObject = getPaddingObject(padding);\n    const coords = {\n      x,\n      y\n    };\n    const axis = getAlignmentAxis(placement);\n    const length = getAxisLength(axis);\n    const arrowDimensions = await platform.getDimensions(element);\n    const isYAxis = axis === 'y';\n    const minProp = isYAxis ? 'top' : 'left';\n    const maxProp = isYAxis ? 'bottom' : 'right';\n    const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';\n    const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];\n    const startDiff = coords[axis] - rects.reference[axis];\n    const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));\n    let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;\n\n    // DOM platform can return `window` as the `offsetParent`.\n    if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {\n      clientSize = elements.floating[clientProp] || rects.floating[length];\n    }\n    const centerToReference = endDiff / 2 - startDiff / 2;\n\n    // If the padding is large enough that it causes the arrow to no longer be\n    // centered, modify the padding so that it is centered.\n    const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;\n    const minPadding = min(paddingObject[minProp], largestPossiblePadding);\n    const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);\n\n    // Make sure the arrow doesn't overflow the floating element if the center\n    // point is outside the floating element's bounds.\n    const min$1 = minPadding;\n    const max = clientSize - arrowDimensions[length] - maxPadding;\n    const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;\n    const offset = clamp(min$1, center, max);\n\n    // If the reference is small enough that the arrow's padding causes it to\n    // to point to nothing for an aligned placement, adjust the offset of the\n    // floating element itself. To ensure `shift()` continues to take action,\n    // a single reset is performed when this is true.\n    const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;\n    const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;\n    return {\n      [axis]: coords[axis] + alignmentOffset,\n      data: {\n        [axis]: offset,\n        centerOffset: center - offset - alignmentOffset,\n        ...(shouldAddOffset && {\n          alignmentOffset\n        })\n      },\n      reset: shouldAddOffset\n    };\n  }\n});\n\nfunction getPlacementList(alignment, autoAlignment, allowedPlacements) {\n  const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);\n  return allowedPlacementsSortedByAlignment.filter(placement => {\n    if (alignment) {\n      return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);\n    }\n    return true;\n  });\n}\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = function (options) {\n  if (options === void 0) {\n    options = {};\n  }\n  return {\n    name: 'autoPlacement',\n    options,\n    async fn(state) {\n      var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;\n      const {\n        rects,\n        middlewareData,\n        placement,\n        platform,\n        elements\n      } = state;\n      const {\n        crossAxis = false,\n        alignment,\n        allowedPlacements = placements,\n        autoAlignment = true,\n        ...detectOverflowOptions\n      } = evaluate(options, state);\n      const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;\n      const overflow = await detectOverflow(state, detectOverflowOptions);\n      const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;\n      const currentPlacement = placements$1[currentIndex];\n      if (currentPlacement == null) {\n        return {};\n      }\n      const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));\n\n      // Make `computeCoords` start from the right place.\n      if (placement !== currentPlacement) {\n        return {\n          reset: {\n            placement: placements$1[0]\n          }\n        };\n      }\n      const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];\n      const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {\n        placement: currentPlacement,\n        overflows: currentOverflows\n      }];\n      const nextPlacement = placements$1[currentIndex + 1];\n\n      // There are more placements to check.\n      if (nextPlacement) {\n        return {\n          data: {\n            index: currentIndex + 1,\n            overflows: allOverflows\n          },\n          reset: {\n            placement: nextPlacement\n          }\n        };\n      }\n      const placementsSortedByMostSpace = allOverflows.map(d => {\n        const alignment = getAlignment(d.placement);\n        return [d.placement, alignment && crossAxis ?\n        // Check along the mainAxis and main crossAxis side.\n        d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :\n        // Check only the mainAxis.\n        d.overflows[0], d.overflows];\n      }).sort((a, b) => a[1] - b[1]);\n      const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,\n      // Aligned placements should not check their opposite crossAxis\n      // side.\n      getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));\n      const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];\n      if (resetPlacement !== placement) {\n        return {\n          data: {\n            index: currentIndex + 1,\n            overflows: allOverflows\n          },\n          reset: {\n            placement: resetPlacement\n          }\n        };\n      }\n      return {};\n    }\n  };\n};\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = function (options) {\n  if (options === void 0) {\n    options = {};\n  }\n  return {\n    name: 'flip',\n    options,\n    async fn(state) {\n      var _middlewareData$arrow, _middlewareData$flip;\n      const {\n        placement,\n        middlewareData,\n        rects,\n        initialPlacement,\n        platform,\n        elements\n      } = state;\n      const {\n        mainAxis: checkMainAxis = true,\n        crossAxis: checkCrossAxis = true,\n        fallbackPlacements: specifiedFallbackPlacements,\n        fallbackStrategy = 'bestFit',\n        fallbackAxisSideDirection = 'none',\n        flipAlignment = true,\n        ...detectOverflowOptions\n      } = evaluate(options, state);\n\n      // If a reset by the arrow was caused due to an alignment offset being\n      // added, we should skip any logic now since `flip()` has already done its\n      // work.\n      // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643\n      if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {\n        return {};\n      }\n      const side = getSide(placement);\n      const initialSideAxis = getSideAxis(initialPlacement);\n      const isBasePlacement = getSide(initialPlacement) === initialPlacement;\n      const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));\n      const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));\n      const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';\n      if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {\n        fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));\n      }\n      const placements = [initialPlacement, ...fallbackPlacements];\n      const overflow = await detectOverflow(state, detectOverflowOptions);\n      const overflows = [];\n      let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];\n      if (checkMainAxis) {\n        overflows.push(overflow[side]);\n      }\n      if (checkCrossAxis) {\n        const sides = getAlignmentSides(placement, rects, rtl);\n        overflows.push(overflow[sides[0]], overflow[sides[1]]);\n      }\n      overflowsData = [...overflowsData, {\n        placement,\n        overflows\n      }];\n\n      // One or more sides is overflowing.\n      if (!overflows.every(side => side <= 0)) {\n        var _middlewareData$flip2, _overflowsData$filter;\n        const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;\n        const nextPlacement = placements[nextIndex];\n        if (nextPlacement) {\n          const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;\n          if (!ignoreCrossAxisOverflow ||\n          // We leave the current main axis only if every placement on that axis\n          // overflows the main axis.\n          overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {\n            // Try next placement and re-run the lifecycle.\n            return {\n              data: {\n                index: nextIndex,\n                overflows: overflowsData\n              },\n              reset: {\n                placement: nextPlacement\n              }\n            };\n          }\n        }\n\n        // First, find the candidates that fit on the mainAxis side of overflow,\n        // then find the placement that fits the best on the main crossAxis side.\n        let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;\n\n        // Otherwise fallback.\n        if (!resetPlacement) {\n          switch (fallbackStrategy) {\n            case 'bestFit':\n              {\n                var _overflowsData$filter2;\n                const placement = (_overflowsData$filter2 = overflowsData.filter(d => {\n                  if (hasFallbackAxisSideDirection) {\n                    const currentSideAxis = getSideAxis(d.placement);\n                    return currentSideAxis === initialSideAxis ||\n                    // Create a bias to the `y` side axis due to horizontal\n                    // reading directions favoring greater width.\n                    currentSideAxis === 'y';\n                  }\n                  return true;\n                }).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];\n                if (placement) {\n                  resetPlacement = placement;\n                }\n                break;\n              }\n            case 'initialPlacement':\n              resetPlacement = initialPlacement;\n              break;\n          }\n        }\n        if (placement !== resetPlacement) {\n          return {\n            reset: {\n              placement: resetPlacement\n            }\n          };\n        }\n      }\n      return {};\n    }\n  };\n};\n\nfunction getSideOffsets(overflow, rect) {\n  return {\n    top: overflow.top - rect.height,\n    right: overflow.right - rect.width,\n    bottom: overflow.bottom - rect.height,\n    left: overflow.left - rect.width\n  };\n}\nfunction isAnySideFullyClipped(overflow) {\n  return sides.some(side => overflow[side] >= 0);\n}\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = function (options) {\n  if (options === void 0) {\n    options = {};\n  }\n  return {\n    name: 'hide',\n    options,\n    async fn(state) {\n      const {\n        rects\n      } = state;\n      const {\n        strategy = 'referenceHidden',\n        ...detectOverflowOptions\n      } = evaluate(options, state);\n      switch (strategy) {\n        case 'referenceHidden':\n          {\n            const overflow = await detectOverflow(state, {\n              ...detectOverflowOptions,\n              elementContext: 'reference'\n            });\n            const offsets = getSideOffsets(overflow, rects.reference);\n            return {\n              data: {\n                referenceHiddenOffsets: offsets,\n                referenceHidden: isAnySideFullyClipped(offsets)\n              }\n            };\n          }\n        case 'escaped':\n          {\n            const overflow = await detectOverflow(state, {\n              ...detectOverflowOptions,\n              altBoundary: true\n            });\n            const offsets = getSideOffsets(overflow, rects.floating);\n            return {\n              data: {\n                escapedOffsets: offsets,\n                escaped: isAnySideFullyClipped(offsets)\n              }\n            };\n          }\n        default:\n          {\n            return {};\n          }\n      }\n    }\n  };\n};\n\nfunction getBoundingRect(rects) {\n  const minX = min(...rects.map(rect => rect.left));\n  const minY = min(...rects.map(rect => rect.top));\n  const maxX = max(...rects.map(rect => rect.right));\n  const maxY = max(...rects.map(rect => rect.bottom));\n  return {\n    x: minX,\n    y: minY,\n    width: maxX - minX,\n    height: maxY - minY\n  };\n}\nfunction getRectsByLine(rects) {\n  const sortedRects = rects.slice().sort((a, b) => a.y - b.y);\n  const groups = [];\n  let prevRect = null;\n  for (let i = 0; i < sortedRects.length; i++) {\n    const rect = sortedRects[i];\n    if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {\n      groups.push([rect]);\n    } else {\n      groups[groups.length - 1].push(rect);\n    }\n    prevRect = rect;\n  }\n  return groups.map(rect => rectToClientRect(getBoundingRect(rect)));\n}\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = function (options) {\n  if (options === void 0) {\n    options = {};\n  }\n  return {\n    name: 'inline',\n    options,\n    async fn(state) {\n      const {\n        placement,\n        elements,\n        rects,\n        platform,\n        strategy\n      } = state;\n      // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a\n      // ClientRect's bounds, despite the event listener being triggered. A\n      // padding of 2 seems to handle this issue.\n      const {\n        padding = 2,\n        x,\n        y\n      } = evaluate(options, state);\n      const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);\n      const clientRects = getRectsByLine(nativeClientRects);\n      const fallback = rectToClientRect(getBoundingRect(nativeClientRects));\n      const paddingObject = getPaddingObject(padding);\n      function getBoundingClientRect() {\n        // There are two rects and they are disjoined.\n        if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {\n          // Find the first rect in which the point is fully inside.\n          return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;\n        }\n\n        // There are 2 or more connected rects.\n        if (clientRects.length >= 2) {\n          if (getSideAxis(placement) === 'y') {\n            const firstRect = clientRects[0];\n            const lastRect = clientRects[clientRects.length - 1];\n            const isTop = getSide(placement) === 'top';\n            const top = firstRect.top;\n            const bottom = lastRect.bottom;\n            const left = isTop ? firstRect.left : lastRect.left;\n            const right = isTop ? firstRect.right : lastRect.right;\n            const width = right - left;\n            const height = bottom - top;\n            return {\n              top,\n              bottom,\n              left,\n              right,\n              width,\n              height,\n              x: left,\n              y: top\n            };\n          }\n          const isLeftSide = getSide(placement) === 'left';\n          const maxRight = max(...clientRects.map(rect => rect.right));\n          const minLeft = min(...clientRects.map(rect => rect.left));\n          const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);\n          const top = measureRects[0].top;\n          const bottom = measureRects[measureRects.length - 1].bottom;\n          const left = minLeft;\n          const right = maxRight;\n          const width = right - left;\n          const height = bottom - top;\n          return {\n            top,\n            bottom,\n            left,\n            right,\n            width,\n            height,\n            x: left,\n            y: top\n          };\n        }\n        return fallback;\n      }\n      const resetRects = await platform.getElementRects({\n        reference: {\n          getBoundingClientRect\n        },\n        floating: elements.floating,\n        strategy\n      });\n      if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {\n        return {\n          reset: {\n            rects: resetRects\n          }\n        };\n      }\n      return {};\n    }\n  };\n};\n\nconst originSides = /*#__PURE__*/new Set(['left', 'top']);\n\n// For type backwards-compatibility, the `OffsetOptions` type was also\n// Derivable.\n\nasync function convertValueToCoords(state, options) {\n  const {\n    placement,\n    platform,\n    elements\n  } = state;\n  const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));\n  const side = getSide(placement);\n  const alignment = getAlignment(placement);\n  const isVertical = getSideAxis(placement) === 'y';\n  const mainAxisMulti = originSides.has(side) ? -1 : 1;\n  const crossAxisMulti = rtl && isVertical ? -1 : 1;\n  const rawValue = evaluate(options, state);\n\n  // eslint-disable-next-line prefer-const\n  let {\n    mainAxis,\n    crossAxis,\n    alignmentAxis\n  } = typeof rawValue === 'number' ? {\n    mainAxis: rawValue,\n    crossAxis: 0,\n    alignmentAxis: null\n  } : {\n    mainAxis: rawValue.mainAxis || 0,\n    crossAxis: rawValue.crossAxis || 0,\n    alignmentAxis: rawValue.alignmentAxis\n  };\n  if (alignment && typeof alignmentAxis === 'number') {\n    crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;\n  }\n  return isVertical ? {\n    x: crossAxis * crossAxisMulti,\n    y: mainAxis * mainAxisMulti\n  } : {\n    x: mainAxis * mainAxisMulti,\n    y: crossAxis * crossAxisMulti\n  };\n}\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = function (options) {\n  if (options === void 0) {\n    options = 0;\n  }\n  return {\n    name: 'offset',\n    options,\n    async fn(state) {\n      var _middlewareData$offse, _middlewareData$arrow;\n      const {\n        x,\n        y,\n        placement,\n        middlewareData\n      } = state;\n      const diffCoords = await convertValueToCoords(state, options);\n\n      // If the placement is the same and the arrow caused an alignment offset\n      // then we don't need to change the positioning coordinates.\n      if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {\n        return {};\n      }\n      return {\n        x: x + diffCoords.x,\n        y: y + diffCoords.y,\n        data: {\n          ...diffCoords,\n          placement\n        }\n      };\n    }\n  };\n};\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = function (options) {\n  if (options === void 0) {\n    options = {};\n  }\n  return {\n    name: 'shift',\n    options,\n    async fn(state) {\n      const {\n        x,\n        y,\n        placement\n      } = state;\n      const {\n        mainAxis: checkMainAxis = true,\n        crossAxis: checkCrossAxis = false,\n        limiter = {\n          fn: _ref => {\n            let {\n              x,\n              y\n            } = _ref;\n            return {\n              x,\n              y\n            };\n          }\n        },\n        ...detectOverflowOptions\n      } = evaluate(options, state);\n      const coords = {\n        x,\n        y\n      };\n      const overflow = await detectOverflow(state, detectOverflowOptions);\n      const crossAxis = getSideAxis(getSide(placement));\n      const mainAxis = getOppositeAxis(crossAxis);\n      let mainAxisCoord = coords[mainAxis];\n      let crossAxisCoord = coords[crossAxis];\n      if (checkMainAxis) {\n        const minSide = mainAxis === 'y' ? 'top' : 'left';\n        const maxSide = mainAxis === 'y' ? 'bottom' : 'right';\n        const min = mainAxisCoord + overflow[minSide];\n        const max = mainAxisCoord - overflow[maxSide];\n        mainAxisCoord = clamp(min, mainAxisCoord, max);\n      }\n      if (checkCrossAxis) {\n        const minSide = crossAxis === 'y' ? 'top' : 'left';\n        const maxSide = crossAxis === 'y' ? 'bottom' : 'right';\n        const min = crossAxisCoord + overflow[minSide];\n        const max = crossAxisCoord - overflow[maxSide];\n        crossAxisCoord = clamp(min, crossAxisCoord, max);\n      }\n      const limitedCoords = limiter.fn({\n        ...state,\n        [mainAxis]: mainAxisCoord,\n        [crossAxis]: crossAxisCoord\n      });\n      return {\n        ...limitedCoords,\n        data: {\n          x: limitedCoords.x - x,\n          y: limitedCoords.y - y,\n          enabled: {\n            [mainAxis]: checkMainAxis,\n            [crossAxis]: checkCrossAxis\n          }\n        }\n      };\n    }\n  };\n};\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = function (options) {\n  if (options === void 0) {\n    options = {};\n  }\n  return {\n    options,\n    fn(state) {\n      const {\n        x,\n        y,\n        placement,\n        rects,\n        middlewareData\n      } = state;\n      const {\n        offset = 0,\n        mainAxis: checkMainAxis = true,\n        crossAxis: checkCrossAxis = true\n      } = evaluate(options, state);\n      const coords = {\n        x,\n        y\n      };\n      const crossAxis = getSideAxis(placement);\n      const mainAxis = getOppositeAxis(crossAxis);\n      let mainAxisCoord = coords[mainAxis];\n      let crossAxisCoord = coords[crossAxis];\n      const rawOffset = evaluate(offset, state);\n      const computedOffset = typeof rawOffset === 'number' ? {\n        mainAxis: rawOffset,\n        crossAxis: 0\n      } : {\n        mainAxis: 0,\n        crossAxis: 0,\n        ...rawOffset\n      };\n      if (checkMainAxis) {\n        const len = mainAxis === 'y' ? 'height' : 'width';\n        const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;\n        const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;\n        if (mainAxisCoord < limitMin) {\n          mainAxisCoord = limitMin;\n        } else if (mainAxisCoord > limitMax) {\n          mainAxisCoord = limitMax;\n        }\n      }\n      if (checkCrossAxis) {\n        var _middlewareData$offse, _middlewareData$offse2;\n        const len = mainAxis === 'y' ? 'width' : 'height';\n        const isOriginSide = originSides.has(getSide(placement));\n        const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);\n        const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);\n        if (crossAxisCoord < limitMin) {\n          crossAxisCoord = limitMin;\n        } else if (crossAxisCoord > limitMax) {\n          crossAxisCoord = limitMax;\n        }\n      }\n      return {\n        [mainAxis]: mainAxisCoord,\n        [crossAxis]: crossAxisCoord\n      };\n    }\n  };\n};\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = function (options) {\n  if (options === void 0) {\n    options = {};\n  }\n  return {\n    name: 'size',\n    options,\n    async fn(state) {\n      var _state$middlewareData, _state$middlewareData2;\n      const {\n        placement,\n        rects,\n        platform,\n        elements\n      } = state;\n      const {\n        apply = () => {},\n        ...detectOverflowOptions\n      } = evaluate(options, state);\n      const overflow = await detectOverflow(state, detectOverflowOptions);\n      const side = getSide(placement);\n      const alignment = getAlignment(placement);\n      const isYAxis = getSideAxis(placement) === 'y';\n      const {\n        width,\n        height\n      } = rects.floating;\n      let heightSide;\n      let widthSide;\n      if (side === 'top' || side === 'bottom') {\n        heightSide = side;\n        widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';\n      } else {\n        widthSide = side;\n        heightSide = alignment === 'end' ? 'top' : 'bottom';\n      }\n      const maximumClippingHeight = height - overflow.top - overflow.bottom;\n      const maximumClippingWidth = width - overflow.left - overflow.right;\n      const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);\n      const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);\n      const noShift = !state.middlewareData.shift;\n      let availableHeight = overflowAvailableHeight;\n      let availableWidth = overflowAvailableWidth;\n      if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {\n        availableWidth = maximumClippingWidth;\n      }\n      if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {\n        availableHeight = maximumClippingHeight;\n      }\n      if (noShift && !alignment) {\n        const xMin = max(overflow.left, 0);\n        const xMax = max(overflow.right, 0);\n        const yMin = max(overflow.top, 0);\n        const yMax = max(overflow.bottom, 0);\n        if (isYAxis) {\n          availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));\n        } else {\n          availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));\n        }\n      }\n      await apply({\n        ...state,\n        availableWidth,\n        availableHeight\n      });\n      const nextDimensions = await platform.getDimensions(elements.floating);\n      if (width !== nextDimensions.width || height !== nextDimensions.height) {\n        return {\n          reset: {\n            rects: true\n          }\n        };\n      }\n      return {};\n    }\n  };\n};\n\nexport { arrow, autoPlacement, computePosition, detectOverflow, flip, hide, inline, limitShift, offset, shift, size };\n","import { rectToClientRect, arrow as arrow$1, autoPlacement as autoPlacement$1, detectOverflow as detectOverflow$1, flip as flip$1, hide as hide$1, inline as inline$1, limitShift as limitShift$1, offset as offset$1, shift as shift$1, size as size$1, computePosition as computePosition$1 } from '@floating-ui/core';\nimport { round, createCoords, max, min, floor } from '@floating-ui/utils';\nimport { getComputedStyle as getComputedStyle$1, isHTMLElement, isElement, getWindow, isWebKit, getFrameElement, getNodeScroll, getDocumentElement, isTopLayer, getNodeName, isOverflowElement, getOverflowAncestors, getParentNode, isLastTraversableNode, isContainingBlock, isTableElement, getContainingBlock } from '@floating-ui/utils/dom';\nexport { getOverflowAncestors } from '@floating-ui/utils/dom';\n\nfunction getCssDimensions(element) {\n  const css = getComputedStyle$1(element);\n  // In testing environments, the `width` and `height` properties are empty\n  // strings for SVG elements, returning NaN. Fallback to `0` in this case.\n  let width = parseFloat(css.width) || 0;\n  let height = parseFloat(css.height) || 0;\n  const hasOffset = isHTMLElement(element);\n  const offsetWidth = hasOffset ? element.offsetWidth : width;\n  const offsetHeight = hasOffset ? element.offsetHeight : height;\n  const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;\n  if (shouldFallback) {\n    width = offsetWidth;\n    height = offsetHeight;\n  }\n  return {\n    width,\n    height,\n    $: shouldFallback\n  };\n}\n\nfunction unwrapElement(element) {\n  return !isElement(element) ? element.contextElement : element;\n}\n\nfunction getScale(element) {\n  const domElement = unwrapElement(element);\n  if (!isHTMLElement(domElement)) {\n    return createCoords(1);\n  }\n  const rect = domElement.getBoundingClientRect();\n  const {\n    width,\n    height,\n    $\n  } = getCssDimensions(domElement);\n  let x = ($ ? round(rect.width) : rect.width) / width;\n  let y = ($ ? round(rect.height) : rect.height) / height;\n\n  // 0, NaN, or Infinity should always fallback to 1.\n\n  if (!x || !Number.isFinite(x)) {\n    x = 1;\n  }\n  if (!y || !Number.isFinite(y)) {\n    y = 1;\n  }\n  return {\n    x,\n    y\n  };\n}\n\nconst noOffsets = /*#__PURE__*/createCoords(0);\nfunction getVisualOffsets(element) {\n  const win = getWindow(element);\n  if (!isWebKit() || !win.visualViewport) {\n    return noOffsets;\n  }\n  return {\n    x: win.visualViewport.offsetLeft,\n    y: win.visualViewport.offsetTop\n  };\n}\nfunction shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {\n  if (isFixed === void 0) {\n    isFixed = false;\n  }\n  if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {\n    return false;\n  }\n  return isFixed;\n}\n\nfunction getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {\n  if (includeScale === void 0) {\n    includeScale = false;\n  }\n  if (isFixedStrategy === void 0) {\n    isFixedStrategy = false;\n  }\n  const clientRect = element.getBoundingClientRect();\n  const domElement = unwrapElement(element);\n  let scale = createCoords(1);\n  if (includeScale) {\n    if (offsetParent) {\n      if (isElement(offsetParent)) {\n        scale = getScale(offsetParent);\n      }\n    } else {\n      scale = getScale(element);\n    }\n  }\n  const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);\n  let x = (clientRect.left + visualOffsets.x) / scale.x;\n  let y = (clientRect.top + visualOffsets.y) / scale.y;\n  let width = clientRect.width / scale.x;\n  let height = clientRect.height / scale.y;\n  if (domElement) {\n    const win = getWindow(domElement);\n    const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;\n    let currentWin = win;\n    let currentIFrame = getFrameElement(currentWin);\n    while (currentIFrame && offsetParent && offsetWin !== currentWin) {\n      const iframeScale = getScale(currentIFrame);\n      const iframeRect = currentIFrame.getBoundingClientRect();\n      const css = getComputedStyle$1(currentIFrame);\n      const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;\n      const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;\n      x *= iframeScale.x;\n      y *= iframeScale.y;\n      width *= iframeScale.x;\n      height *= iframeScale.y;\n      x += left;\n      y += top;\n      currentWin = getWindow(currentIFrame);\n      currentIFrame = getFrameElement(currentWin);\n    }\n  }\n  return rectToClientRect({\n    width,\n    height,\n    x,\n    y\n  });\n}\n\n// If <html> has a CSS width greater than the viewport, then this will be\n// incorrect for RTL.\nfunction getWindowScrollBarX(element, rect) {\n  const leftScroll = getNodeScroll(element).scrollLeft;\n  if (!rect) {\n    return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;\n  }\n  return rect.left + leftScroll;\n}\n\nfunction getHTMLOffset(documentElement, scroll) {\n  const htmlRect = documentElement.getBoundingClientRect();\n  const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);\n  const y = htmlRect.top + scroll.scrollTop;\n  return {\n    x,\n    y\n  };\n}\n\nfunction convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {\n  let {\n    elements,\n    rect,\n    offsetParent,\n    strategy\n  } = _ref;\n  const isFixed = strategy === 'fixed';\n  const documentElement = getDocumentElement(offsetParent);\n  const topLayer = elements ? isTopLayer(elements.floating) : false;\n  if (offsetParent === documentElement || topLayer && isFixed) {\n    return rect;\n  }\n  let scroll = {\n    scrollLeft: 0,\n    scrollTop: 0\n  };\n  let scale = createCoords(1);\n  const offsets = createCoords(0);\n  const isOffsetParentAnElement = isHTMLElement(offsetParent);\n  if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {\n    if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {\n      scroll = getNodeScroll(offsetParent);\n    }\n    if (isHTMLElement(offsetParent)) {\n      const offsetRect = getBoundingClientRect(offsetParent);\n      scale = getScale(offsetParent);\n      offsets.x = offsetRect.x + offsetParent.clientLeft;\n      offsets.y = offsetRect.y + offsetParent.clientTop;\n    }\n  }\n  const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);\n  return {\n    width: rect.width * scale.x,\n    height: rect.height * scale.y,\n    x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,\n    y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y\n  };\n}\n\nfunction getClientRects(element) {\n  return Array.from(element.getClientRects());\n}\n\n// Gets the entire size of the scrollable document area, even extending outside\n// of the `<html>` and `<body>` rect bounds if horizontally scrollable.\nfunction getDocumentRect(element) {\n  const html = getDocumentElement(element);\n  const scroll = getNodeScroll(element);\n  const body = element.ownerDocument.body;\n  const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);\n  const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);\n  let x = -scroll.scrollLeft + getWindowScrollBarX(element);\n  const y = -scroll.scrollTop;\n  if (getComputedStyle$1(body).direction === 'rtl') {\n    x += max(html.clientWidth, body.clientWidth) - width;\n  }\n  return {\n    width,\n    height,\n    x,\n    y\n  };\n}\n\n// Safety check: ensure the scrollbar space is reasonable in case this\n// calculation is affected by unusual styles.\n// Most scrollbars leave 15-18px of space.\nconst SCROLLBAR_MAX = 25;\nfunction getViewportRect(element, strategy) {\n  const win = getWindow(element);\n  const html = getDocumentElement(element);\n  const visualViewport = win.visualViewport;\n  let width = html.clientWidth;\n  let height = html.clientHeight;\n  let x = 0;\n  let y = 0;\n  if (visualViewport) {\n    width = visualViewport.width;\n    height = visualViewport.height;\n    const visualViewportBased = isWebKit();\n    if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {\n      x = visualViewport.offsetLeft;\n      y = visualViewport.offsetTop;\n    }\n  }\n  const windowScrollbarX = getWindowScrollBarX(html);\n  // <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the\n  // visual width of the <html> but this is not considered in the size\n  // of `html.clientWidth`.\n  if (windowScrollbarX <= 0) {\n    const doc = html.ownerDocument;\n    const body = doc.body;\n    const bodyStyles = getComputedStyle(body);\n    const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;\n    const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);\n    if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {\n      width -= clippingStableScrollbarWidth;\n    }\n  } else if (windowScrollbarX <= SCROLLBAR_MAX) {\n    // If the <body> scrollbar is on the left, the width needs to be extended\n    // by the scrollbar amount so there isn't extra space on the right.\n    width += windowScrollbarX;\n  }\n  return {\n    width,\n    height,\n    x,\n    y\n  };\n}\n\nconst absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);\n// Returns the inner client rect, subtracting scrollbars if present.\nfunction getInnerBoundingClientRect(element, strategy) {\n  const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');\n  const top = clientRect.top + element.clientTop;\n  const left = clientRect.left + element.clientLeft;\n  const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);\n  const width = element.clientWidth * scale.x;\n  const height = element.clientHeight * scale.y;\n  const x = left * scale.x;\n  const y = top * scale.y;\n  return {\n    width,\n    height,\n    x,\n    y\n  };\n}\nfunction getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {\n  let rect;\n  if (clippingAncestor === 'viewport') {\n    rect = getViewportRect(element, strategy);\n  } else if (clippingAncestor === 'document') {\n    rect = getDocumentRect(getDocumentElement(element));\n  } else if (isElement(clippingAncestor)) {\n    rect = getInnerBoundingClientRect(clippingAncestor, strategy);\n  } else {\n    const visualOffsets = getVisualOffsets(element);\n    rect = {\n      x: clippingAncestor.x - visualOffsets.x,\n      y: clippingAncestor.y - visualOffsets.y,\n      width: clippingAncestor.width,\n      height: clippingAncestor.height\n    };\n  }\n  return rectToClientRect(rect);\n}\nfunction hasFixedPositionAncestor(element, stopNode) {\n  const parentNode = getParentNode(element);\n  if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {\n    return false;\n  }\n  return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);\n}\n\n// A \"clipping ancestor\" is an `overflow` element with the characteristic of\n// clipping (or hiding) child elements. This returns all clipping ancestors\n// of the given element up the tree.\nfunction getClippingElementAncestors(element, cache) {\n  const cachedResult = cache.get(element);\n  if (cachedResult) {\n    return cachedResult;\n  }\n  let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');\n  let currentContainingBlockComputedStyle = null;\n  const elementIsFixed = getComputedStyle$1(element).position === 'fixed';\n  let currentNode = elementIsFixed ? getParentNode(element) : element;\n\n  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n  while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {\n    const computedStyle = getComputedStyle$1(currentNode);\n    const currentNodeIsContaining = isContainingBlock(currentNode);\n    if (!currentNodeIsContaining && computedStyle.position === 'fixed') {\n      currentContainingBlockComputedStyle = null;\n    }\n    const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);\n    if (shouldDropCurrentNode) {\n      // Drop non-containing blocks.\n      result = result.filter(ancestor => ancestor !== currentNode);\n    } else {\n      // Record last containing block for next iteration.\n      currentContainingBlockComputedStyle = computedStyle;\n    }\n    currentNode = getParentNode(currentNode);\n  }\n  cache.set(element, result);\n  return result;\n}\n\n// Gets the maximum area that the element is visible in due to any number of\n// clipping ancestors.\nfunction getClippingRect(_ref) {\n  let {\n    element,\n    boundary,\n    rootBoundary,\n    strategy\n  } = _ref;\n  const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);\n  const clippingAncestors = [...elementClippingAncestors, rootBoundary];\n  const firstClippingAncestor = clippingAncestors[0];\n  const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {\n    const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);\n    accRect.top = max(rect.top, accRect.top);\n    accRect.right = min(rect.right, accRect.right);\n    accRect.bottom = min(rect.bottom, accRect.bottom);\n    accRect.left = max(rect.left, accRect.left);\n    return accRect;\n  }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));\n  return {\n    width: clippingRect.right - clippingRect.left,\n    height: clippingRect.bottom - clippingRect.top,\n    x: clippingRect.left,\n    y: clippingRect.top\n  };\n}\n\nfunction getDimensions(element) {\n  const {\n    width,\n    height\n  } = getCssDimensions(element);\n  return {\n    width,\n    height\n  };\n}\n\nfunction getRectRelativeToOffsetParent(element, offsetParent, strategy) {\n  const isOffsetParentAnElement = isHTMLElement(offsetParent);\n  const documentElement = getDocumentElement(offsetParent);\n  const isFixed = strategy === 'fixed';\n  const rect = getBoundingClientRect(element, true, isFixed, offsetParent);\n  let scroll = {\n    scrollLeft: 0,\n    scrollTop: 0\n  };\n  const offsets = createCoords(0);\n\n  // If the <body> scrollbar appears on the left (e.g. RTL systems). Use\n  // Firefox with layout.scrollbar.side = 3 in about:config to test this.\n  function setLeftRTLScrollbarOffset() {\n    offsets.x = getWindowScrollBarX(documentElement);\n  }\n  if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {\n    if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {\n      scroll = getNodeScroll(offsetParent);\n    }\n    if (isOffsetParentAnElement) {\n      const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);\n      offsets.x = offsetRect.x + offsetParent.clientLeft;\n      offsets.y = offsetRect.y + offsetParent.clientTop;\n    } else if (documentElement) {\n      setLeftRTLScrollbarOffset();\n    }\n  }\n  if (isFixed && !isOffsetParentAnElement && documentElement) {\n    setLeftRTLScrollbarOffset();\n  }\n  const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);\n  const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;\n  const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;\n  return {\n    x,\n    y,\n    width: rect.width,\n    height: rect.height\n  };\n}\n\nfunction isStaticPositioned(element) {\n  return getComputedStyle$1(element).position === 'static';\n}\n\nfunction getTrueOffsetParent(element, polyfill) {\n  if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {\n    return null;\n  }\n  if (polyfill) {\n    return polyfill(element);\n  }\n  let rawOffsetParent = element.offsetParent;\n\n  // Firefox returns the <html> element as the offsetParent if it's non-static,\n  // while Chrome and Safari return the <body> element. The <body> element must\n  // be used to perform the correct calculations even if the <html> element is\n  // non-static.\n  if (getDocumentElement(element) === rawOffsetParent) {\n    rawOffsetParent = rawOffsetParent.ownerDocument.body;\n  }\n  return rawOffsetParent;\n}\n\n// Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\nfunction getOffsetParent(element, polyfill) {\n  const win = getWindow(element);\n  if (isTopLayer(element)) {\n    return win;\n  }\n  if (!isHTMLElement(element)) {\n    let svgOffsetParent = getParentNode(element);\n    while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {\n      if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {\n        return svgOffsetParent;\n      }\n      svgOffsetParent = getParentNode(svgOffsetParent);\n    }\n    return win;\n  }\n  let offsetParent = getTrueOffsetParent(element, polyfill);\n  while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {\n    offsetParent = getTrueOffsetParent(offsetParent, polyfill);\n  }\n  if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {\n    return win;\n  }\n  return offsetParent || getContainingBlock(element) || win;\n}\n\nconst getElementRects = async function (data) {\n  const getOffsetParentFn = this.getOffsetParent || getOffsetParent;\n  const getDimensionsFn = this.getDimensions;\n  const floatingDimensions = await getDimensionsFn(data.floating);\n  return {\n    reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),\n    floating: {\n      x: 0,\n      y: 0,\n      width: floatingDimensions.width,\n      height: floatingDimensions.height\n    }\n  };\n};\n\nfunction isRTL(element) {\n  return getComputedStyle$1(element).direction === 'rtl';\n}\n\nconst platform = {\n  convertOffsetParentRelativeRectToViewportRelativeRect,\n  getDocumentElement,\n  getClippingRect,\n  getOffsetParent,\n  getElementRects,\n  getClientRects,\n  getDimensions,\n  getScale,\n  isElement,\n  isRTL\n};\n\nfunction rectsAreEqual(a, b) {\n  return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;\n}\n\n// https://samthor.au/2021/observing-dom/\nfunction observeMove(element, onMove) {\n  let io = null;\n  let timeoutId;\n  const root = getDocumentElement(element);\n  function cleanup() {\n    var _io;\n    clearTimeout(timeoutId);\n    (_io = io) == null || _io.disconnect();\n    io = null;\n  }\n  function refresh(skip, threshold) {\n    if (skip === void 0) {\n      skip = false;\n    }\n    if (threshold === void 0) {\n      threshold = 1;\n    }\n    cleanup();\n    const elementRectForRootMargin = element.getBoundingClientRect();\n    const {\n      left,\n      top,\n      width,\n      height\n    } = elementRectForRootMargin;\n    if (!skip) {\n      onMove();\n    }\n    if (!width || !height) {\n      return;\n    }\n    const insetTop = floor(top);\n    const insetRight = floor(root.clientWidth - (left + width));\n    const insetBottom = floor(root.clientHeight - (top + height));\n    const insetLeft = floor(left);\n    const rootMargin = -insetTop + \"px \" + -insetRight + \"px \" + -insetBottom + \"px \" + -insetLeft + \"px\";\n    const options = {\n      rootMargin,\n      threshold: max(0, min(1, threshold)) || 1\n    };\n    let isFirstUpdate = true;\n    function handleObserve(entries) {\n      const ratio = entries[0].intersectionRatio;\n      if (ratio !== threshold) {\n        if (!isFirstUpdate) {\n          return refresh();\n        }\n        if (!ratio) {\n          // If the reference is clipped, the ratio is 0. Throttle the refresh\n          // to prevent an infinite loop of updates.\n          timeoutId = setTimeout(() => {\n            refresh(false, 1e-7);\n          }, 1000);\n        } else {\n          refresh(false, ratio);\n        }\n      }\n      if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {\n        // It's possible that even though the ratio is reported as 1, the\n        // element is not actually fully within the IntersectionObserver's root\n        // area anymore. This can happen under performance constraints. This may\n        // be a bug in the browser's IntersectionObserver implementation. To\n        // work around this, we compare the element's bounding rect now with\n        // what it was at the time we created the IntersectionObserver. If they\n        // are not equal then the element moved, so we refresh.\n        refresh();\n      }\n      isFirstUpdate = false;\n    }\n\n    // Older browsers don't support a `document` as the root and will throw an\n    // error.\n    try {\n      io = new IntersectionObserver(handleObserve, {\n        ...options,\n        // Handle <iframe>s\n        root: root.ownerDocument\n      });\n    } catch (_e) {\n      io = new IntersectionObserver(handleObserve, options);\n    }\n    io.observe(element);\n  }\n  refresh(true);\n  return cleanup;\n}\n\n/**\n * Automatically updates the position of the floating element when necessary.\n * Should only be called when the floating element is mounted on the DOM or\n * visible on the screen.\n * @returns cleanup function that should be invoked when the floating element is\n * removed from the DOM or hidden from the screen.\n * @see https://floating-ui.com/docs/autoUpdate\n */\nfunction autoUpdate(reference, floating, update, options) {\n  if (options === void 0) {\n    options = {};\n  }\n  const {\n    ancestorScroll = true,\n    ancestorResize = true,\n    elementResize = typeof ResizeObserver === 'function',\n    layoutShift = typeof IntersectionObserver === 'function',\n    animationFrame = false\n  } = options;\n  const referenceEl = unwrapElement(reference);\n  const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];\n  ancestors.forEach(ancestor => {\n    ancestorScroll && ancestor.addEventListener('scroll', update, {\n      passive: true\n    });\n    ancestorResize && ancestor.addEventListener('resize', update);\n  });\n  const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;\n  let reobserveFrame = -1;\n  let resizeObserver = null;\n  if (elementResize) {\n    resizeObserver = new ResizeObserver(_ref => {\n      let [firstEntry] = _ref;\n      if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {\n        // Prevent update loops when using the `size` middleware.\n        // https://github.com/floating-ui/floating-ui/issues/1740\n        resizeObserver.unobserve(floating);\n        cancelAnimationFrame(reobserveFrame);\n        reobserveFrame = requestAnimationFrame(() => {\n          var _resizeObserver;\n          (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);\n        });\n      }\n      update();\n    });\n    if (referenceEl && !animationFrame) {\n      resizeObserver.observe(referenceEl);\n    }\n    resizeObserver.observe(floating);\n  }\n  let frameId;\n  let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;\n  if (animationFrame) {\n    frameLoop();\n  }\n  function frameLoop() {\n    const nextRefRect = getBoundingClientRect(reference);\n    if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {\n      update();\n    }\n    prevRefRect = nextRefRect;\n    frameId = requestAnimationFrame(frameLoop);\n  }\n  update();\n  return () => {\n    var _resizeObserver2;\n    ancestors.forEach(ancestor => {\n      ancestorScroll && ancestor.removeEventListener('scroll', update);\n      ancestorResize && ancestor.removeEventListener('resize', update);\n    });\n    cleanupIo == null || cleanupIo();\n    (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();\n    resizeObserver = null;\n    if (animationFrame) {\n      cancelAnimationFrame(frameId);\n    }\n  };\n}\n\n/**\n * Resolves with an object of overflow side offsets that determine how much the\n * element is overflowing a given clipping boundary on each side.\n * - positive = overflowing the boundary by that number of pixels\n * - negative = how many pixels left before it will overflow\n * - 0 = lies flush with the boundary\n * @see https://floating-ui.com/docs/detectOverflow\n */\nconst detectOverflow = detectOverflow$1;\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = offset$1;\n\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = autoPlacement$1;\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = shift$1;\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = flip$1;\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = size$1;\n\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = hide$1;\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = arrow$1;\n\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = inline$1;\n\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = limitShift$1;\n\n/**\n * Computes the `x` and `y` coordinates that will place the floating element\n * next to a given reference element.\n */\nconst computePosition = (reference, floating, options) => {\n  // This caches the expensive `getClippingElementAncestors` function so that\n  // multiple lifecycle resets re-use the same result. It only lives for a\n  // single call. If other functions become expensive, we can add them as well.\n  const cache = new Map();\n  const mergedOptions = {\n    platform,\n    ...options\n  };\n  const platformWithCache = {\n    ...mergedOptions.platform,\n    _c: cache\n  };\n  return computePosition$1(reference, floating, {\n    ...mergedOptions,\n    platform: platformWithCache\n  });\n};\n\nexport { arrow, autoPlacement, autoUpdate, computePosition, detectOverflow, flip, hide, inline, limitShift, offset, platform, shift, size };\n","import { computePosition, arrow as arrow$2, autoPlacement as autoPlacement$1, flip as flip$1, hide as hide$1, inline as inline$1, limitShift as limitShift$1, offset as offset$1, shift as shift$1, size as size$1 } from '@floating-ui/dom';\nexport { autoUpdate, computePosition, detectOverflow, getOverflowAncestors, platform } from '@floating-ui/dom';\nimport * as React from 'react';\nimport { useLayoutEffect } from 'react';\nimport * as ReactDOM from 'react-dom';\n\nvar isClient = typeof document !== 'undefined';\n\nvar noop = function noop() {};\nvar index = isClient ? useLayoutEffect : noop;\n\n// Fork of `fast-deep-equal` that only does the comparisons we need and compares\n// functions\nfunction deepEqual(a, b) {\n  if (a === b) {\n    return true;\n  }\n  if (typeof a !== typeof b) {\n    return false;\n  }\n  if (typeof a === 'function' && a.toString() === b.toString()) {\n    return true;\n  }\n  let length;\n  let i;\n  let keys;\n  if (a && b && typeof a === 'object') {\n    if (Array.isArray(a)) {\n      length = a.length;\n      if (length !== b.length) return false;\n      for (i = length; i-- !== 0;) {\n        if (!deepEqual(a[i], b[i])) {\n          return false;\n        }\n      }\n      return true;\n    }\n    keys = Object.keys(a);\n    length = keys.length;\n    if (length !== Object.keys(b).length) {\n      return false;\n    }\n    for (i = length; i-- !== 0;) {\n      if (!{}.hasOwnProperty.call(b, keys[i])) {\n        return false;\n      }\n    }\n    for (i = length; i-- !== 0;) {\n      const key = keys[i];\n      if (key === '_owner' && a.$$typeof) {\n        continue;\n      }\n      if (!deepEqual(a[key], b[key])) {\n        return false;\n      }\n    }\n    return true;\n  }\n  return a !== a && b !== b;\n}\n\nfunction getDPR(element) {\n  if (typeof window === 'undefined') {\n    return 1;\n  }\n  const win = element.ownerDocument.defaultView || window;\n  return win.devicePixelRatio || 1;\n}\n\nfunction roundByDPR(element, value) {\n  const dpr = getDPR(element);\n  return Math.round(value * dpr) / dpr;\n}\n\nfunction useLatestRef(value) {\n  const ref = React.useRef(value);\n  index(() => {\n    ref.current = value;\n  });\n  return ref;\n}\n\n/**\n * Provides data to position a floating element.\n * @see https://floating-ui.com/docs/useFloating\n */\nfunction useFloating(options) {\n  if (options === void 0) {\n    options = {};\n  }\n  const {\n    placement = 'bottom',\n    strategy = 'absolute',\n    middleware = [],\n    platform,\n    elements: {\n      reference: externalReference,\n      floating: externalFloating\n    } = {},\n    transform = true,\n    whileElementsMounted,\n    open\n  } = options;\n  const [data, setData] = React.useState({\n    x: 0,\n    y: 0,\n    strategy,\n    placement,\n    middlewareData: {},\n    isPositioned: false\n  });\n  const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);\n  if (!deepEqual(latestMiddleware, middleware)) {\n    setLatestMiddleware(middleware);\n  }\n  const [_reference, _setReference] = React.useState(null);\n  const [_floating, _setFloating] = React.useState(null);\n  const setReference = React.useCallback(node => {\n    if (node !== referenceRef.current) {\n      referenceRef.current = node;\n      _setReference(node);\n    }\n  }, []);\n  const setFloating = React.useCallback(node => {\n    if (node !== floatingRef.current) {\n      floatingRef.current = node;\n      _setFloating(node);\n    }\n  }, []);\n  const referenceEl = externalReference || _reference;\n  const floatingEl = externalFloating || _floating;\n  const referenceRef = React.useRef(null);\n  const floatingRef = React.useRef(null);\n  const dataRef = React.useRef(data);\n  const hasWhileElementsMounted = whileElementsMounted != null;\n  const whileElementsMountedRef = useLatestRef(whileElementsMounted);\n  const platformRef = useLatestRef(platform);\n  const openRef = useLatestRef(open);\n  const update = React.useCallback(() => {\n    if (!referenceRef.current || !floatingRef.current) {\n      return;\n    }\n    const config = {\n      placement,\n      strategy,\n      middleware: latestMiddleware\n    };\n    if (platformRef.current) {\n      config.platform = platformRef.current;\n    }\n    computePosition(referenceRef.current, floatingRef.current, config).then(data => {\n      const fullData = {\n        ...data,\n        // The floating element's position may be recomputed while it's closed\n        // but still mounted (such as when transitioning out). To ensure\n        // `isPositioned` will be `false` initially on the next open, avoid\n        // setting it to `true` when `open === false` (must be specified).\n        isPositioned: openRef.current !== false\n      };\n      if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {\n        dataRef.current = fullData;\n        ReactDOM.flushSync(() => {\n          setData(fullData);\n        });\n      }\n    });\n  }, [latestMiddleware, placement, strategy, platformRef, openRef]);\n  index(() => {\n    if (open === false && dataRef.current.isPositioned) {\n      dataRef.current.isPositioned = false;\n      setData(data => ({\n        ...data,\n        isPositioned: false\n      }));\n    }\n  }, [open]);\n  const isMountedRef = React.useRef(false);\n  index(() => {\n    isMountedRef.current = true;\n    return () => {\n      isMountedRef.current = false;\n    };\n  }, []);\n  index(() => {\n    if (referenceEl) referenceRef.current = referenceEl;\n    if (floatingEl) floatingRef.current = floatingEl;\n    if (referenceEl && floatingEl) {\n      if (whileElementsMountedRef.current) {\n        return whileElementsMountedRef.current(referenceEl, floatingEl, update);\n      }\n      update();\n    }\n  }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);\n  const refs = React.useMemo(() => ({\n    reference: referenceRef,\n    floating: floatingRef,\n    setReference,\n    setFloating\n  }), [setReference, setFloating]);\n  const elements = React.useMemo(() => ({\n    reference: referenceEl,\n    floating: floatingEl\n  }), [referenceEl, floatingEl]);\n  const floatingStyles = React.useMemo(() => {\n    const initialStyles = {\n      position: strategy,\n      left: 0,\n      top: 0\n    };\n    if (!elements.floating) {\n      return initialStyles;\n    }\n    const x = roundByDPR(elements.floating, data.x);\n    const y = roundByDPR(elements.floating, data.y);\n    if (transform) {\n      return {\n        ...initialStyles,\n        transform: \"translate(\" + x + \"px, \" + y + \"px)\",\n        ...(getDPR(elements.floating) >= 1.5 && {\n          willChange: 'transform'\n        })\n      };\n    }\n    return {\n      position: strategy,\n      left: x,\n      top: y\n    };\n  }, [strategy, transform, elements.floating, data.x, data.y]);\n  return React.useMemo(() => ({\n    ...data,\n    update,\n    refs,\n    elements,\n    floatingStyles\n  }), [data, update, refs, elements, floatingStyles]);\n}\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * This wraps the core `arrow` middleware to allow React refs as the element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow$1 = options => {\n  function isRef(value) {\n    return {}.hasOwnProperty.call(value, 'current');\n  }\n  return {\n    name: 'arrow',\n    options,\n    fn(state) {\n      const {\n        element,\n        padding\n      } = typeof options === 'function' ? options(state) : options;\n      if (element && isRef(element)) {\n        if (element.current != null) {\n          return arrow$2({\n            element: element.current,\n            padding\n          }).fn(state);\n        }\n        return {};\n      }\n      if (element) {\n        return arrow$2({\n          element,\n          padding\n        }).fn(state);\n      }\n      return {};\n    }\n  };\n};\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = (options, deps) => ({\n  ...offset$1(options),\n  options: [options, deps]\n});\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = (options, deps) => ({\n  ...shift$1(options),\n  options: [options, deps]\n});\n\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = (options, deps) => ({\n  ...limitShift$1(options),\n  options: [options, deps]\n});\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = (options, deps) => ({\n  ...flip$1(options),\n  options: [options, deps]\n});\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = (options, deps) => ({\n  ...size$1(options),\n  options: [options, deps]\n});\n\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = (options, deps) => ({\n  ...autoPlacement$1(options),\n  options: [options, deps]\n});\n\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = (options, deps) => ({\n  ...hide$1(options),\n  options: [options, deps]\n});\n\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = (options, deps) => ({\n  ...inline$1(options),\n  options: [options, deps]\n});\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * This wraps the core `arrow` middleware to allow React refs as the element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = (options, deps) => ({\n  ...arrow$1(options),\n  options: [options, deps]\n});\n\nexport { arrow, autoPlacement, flip, hide, inline, limitShift, offset, shift, size, useFloating };\n","import * as React from 'react';\nimport { useModernLayoutEffect, useEffectEvent, getMinListIndex, getMaxListIndex, createGridCellMap, isListIndexDisabled, getGridNavigatedIndex, getGridCellIndexOfCorner, getGridCellIndices, findNonDisabledListIndex, isIndexOutOfListBounds, useLatestRef, getDocument as getDocument$1, isMouseLikePointerType, contains as contains$1, isSafari, enableFocusInside, isOutsideEvent, getPreviousTabbable, getNextTabbable, disableFocusInside, isTypeableCombobox, getFloatingFocusElement, getTabbableOptions, getNodeAncestors, activeElement, getNodeChildren as getNodeChildren$1, stopEvent, getTarget as getTarget$1, isVirtualClick, isVirtualPointerEvent, getPlatform, isTypeableElement, isReactEvent, isRootElement, isEventTargetWithin, matchesFocusVisible, isMac, getDeepestNode, getUserAgent } from '@floating-ui/react/utils';\nimport { jsx, jsxs, Fragment } from 'react/jsx-runtime';\nimport { getComputedStyle, isElement, isShadowRoot, getNodeName, isNode, isHTMLElement, getWindow, isLastTraversableNode, getParentNode, isWebKit } from '@floating-ui/utils/dom';\nimport { tabbable, isTabbable, focusable } from 'tabbable';\nimport * as ReactDOM from 'react-dom';\nimport { getOverflowAncestors, useFloating as useFloating$1, offset, detectOverflow } from '@floating-ui/react-dom';\nexport { arrow, autoPlacement, autoUpdate, computePosition, detectOverflow, flip, getOverflowAncestors, hide, inline, limitShift, offset, platform, shift, size } from '@floating-ui/react-dom';\nimport { evaluate, max, round, min } from '@floating-ui/utils';\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n * @see https://floating-ui.com/docs/react-utils#usemergerefs\n */\nfunction useMergeRefs(refs) {\n  const cleanupRef = React.useRef(undefined);\n  const refEffect = React.useCallback(instance => {\n    const cleanups = refs.map(ref => {\n      if (ref == null) {\n        return;\n      }\n      if (typeof ref === 'function') {\n        const refCallback = ref;\n        const refCleanup = refCallback(instance);\n        return typeof refCleanup === 'function' ? refCleanup : () => {\n          refCallback(null);\n        };\n      }\n      ref.current = instance;\n      return () => {\n        ref.current = null;\n      };\n    });\n    return () => {\n      cleanups.forEach(refCleanup => refCleanup == null ? void 0 : refCleanup());\n    };\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, refs);\n  return React.useMemo(() => {\n    if (refs.every(ref => ref == null)) {\n      return null;\n    }\n    return value => {\n      if (cleanupRef.current) {\n        cleanupRef.current();\n        cleanupRef.current = undefined;\n      }\n      if (value != null) {\n        cleanupRef.current = refEffect(value);\n      }\n    };\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, refs);\n}\n\nfunction sortByDocumentPosition(a, b) {\n  const position = a.compareDocumentPosition(b);\n  if (position & Node.DOCUMENT_POSITION_FOLLOWING || position & Node.DOCUMENT_POSITION_CONTAINED_BY) {\n    return -1;\n  }\n  if (position & Node.DOCUMENT_POSITION_PRECEDING || position & Node.DOCUMENT_POSITION_CONTAINS) {\n    return 1;\n  }\n  return 0;\n}\nconst FloatingListContext = /*#__PURE__*/React.createContext({\n  register: () => {},\n  unregister: () => {},\n  map: /*#__PURE__*/new Map(),\n  elementsRef: {\n    current: []\n  }\n});\n/**\n * Provides context for a list of items within the floating element.\n * @see https://floating-ui.com/docs/FloatingList\n */\nfunction FloatingList(props) {\n  const {\n    children,\n    elementsRef,\n    labelsRef\n  } = props;\n  const [nodes, setNodes] = React.useState(() => new Set());\n  const register = React.useCallback(node => {\n    setNodes(prevSet => new Set(prevSet).add(node));\n  }, []);\n  const unregister = React.useCallback(node => {\n    setNodes(prevSet => {\n      const set = new Set(prevSet);\n      set.delete(node);\n      return set;\n    });\n  }, []);\n  const map = React.useMemo(() => {\n    const newMap = new Map();\n    const sortedNodes = Array.from(nodes.keys()).sort(sortByDocumentPosition);\n    sortedNodes.forEach((node, index) => {\n      newMap.set(node, index);\n    });\n    return newMap;\n  }, [nodes]);\n  return /*#__PURE__*/jsx(FloatingListContext.Provider, {\n    value: React.useMemo(() => ({\n      register,\n      unregister,\n      map,\n      elementsRef,\n      labelsRef\n    }), [register, unregister, map, elementsRef, labelsRef]),\n    children: children\n  });\n}\n/**\n * Used to register a list item and its index (DOM position) in the\n * `FloatingList`.\n * @see https://floating-ui.com/docs/FloatingList#uselistitem\n */\nfunction useListItem(props) {\n  if (props === void 0) {\n    props = {};\n  }\n  const {\n    label\n  } = props;\n  const {\n    register,\n    unregister,\n    map,\n    elementsRef,\n    labelsRef\n  } = React.useContext(FloatingListContext);\n  const [index, setIndex] = React.useState(null);\n  const componentRef = React.useRef(null);\n  const ref = React.useCallback(node => {\n    componentRef.current = node;\n    if (index !== null) {\n      elementsRef.current[index] = node;\n      if (labelsRef) {\n        var _node$textContent;\n        const isLabelDefined = label !== undefined;\n        labelsRef.current[index] = isLabelDefined ? label : (_node$textContent = node == null ? void 0 : node.textContent) != null ? _node$textContent : null;\n      }\n    }\n  }, [index, elementsRef, labelsRef, label]);\n  useModernLayoutEffect(() => {\n    const node = componentRef.current;\n    if (node) {\n      register(node);\n      return () => {\n        unregister(node);\n      };\n    }\n  }, [register, unregister]);\n  useModernLayoutEffect(() => {\n    const index = componentRef.current ? map.get(componentRef.current) : null;\n    if (index != null) {\n      setIndex(index);\n    }\n  }, [map]);\n  return React.useMemo(() => ({\n    ref,\n    index: index == null ? -1 : index\n  }), [index, ref]);\n}\n\nconst FOCUSABLE_ATTRIBUTE = 'data-floating-ui-focusable';\nconst ACTIVE_KEY = 'active';\nconst SELECTED_KEY = 'selected';\nconst ARROW_LEFT = 'ArrowLeft';\nconst ARROW_RIGHT = 'ArrowRight';\nconst ARROW_UP = 'ArrowUp';\nconst ARROW_DOWN = 'ArrowDown';\n\nfunction renderJsx(render, computedProps) {\n  if (typeof render === 'function') {\n    return render(computedProps);\n  }\n  if (render) {\n    return /*#__PURE__*/React.cloneElement(render, computedProps);\n  }\n  return /*#__PURE__*/jsx(\"div\", {\n    ...computedProps\n  });\n}\nconst CompositeContext = /*#__PURE__*/React.createContext({\n  activeIndex: 0,\n  onNavigate: () => {}\n});\nconst horizontalKeys = [ARROW_LEFT, ARROW_RIGHT];\nconst verticalKeys = [ARROW_UP, ARROW_DOWN];\nconst allKeys = [...horizontalKeys, ...verticalKeys];\n\n/**\n * Creates a single tab stop whose items are navigated by arrow keys, which\n * provides list navigation outside of floating element contexts.\n *\n * This is useful to enable navigation of a list of items that aren’t part of a\n * floating element. A menubar is an example of a composite, with each reference\n * element being an item.\n * @see https://floating-ui.com/docs/Composite\n */\nconst Composite = /*#__PURE__*/React.forwardRef(function Composite(props, forwardedRef) {\n  const {\n    render,\n    orientation = 'both',\n    loop = true,\n    rtl = false,\n    cols = 1,\n    disabledIndices,\n    activeIndex: externalActiveIndex,\n    onNavigate: externalSetActiveIndex,\n    itemSizes,\n    dense = false,\n    ...domProps\n  } = props;\n  const [internalActiveIndex, internalSetActiveIndex] = React.useState(0);\n  const activeIndex = externalActiveIndex != null ? externalActiveIndex : internalActiveIndex;\n  const onNavigate = useEffectEvent(externalSetActiveIndex != null ? externalSetActiveIndex : internalSetActiveIndex);\n  const elementsRef = React.useRef([]);\n  const renderElementProps = render && typeof render !== 'function' ? render.props : {};\n  const contextValue = React.useMemo(() => ({\n    activeIndex,\n    onNavigate\n  }), [activeIndex, onNavigate]);\n  const isGrid = cols > 1;\n  function handleKeyDown(event) {\n    if (!allKeys.includes(event.key)) return;\n    let nextIndex = activeIndex;\n    const minIndex = getMinListIndex(elementsRef, disabledIndices);\n    const maxIndex = getMaxListIndex(elementsRef, disabledIndices);\n    const horizontalEndKey = rtl ? ARROW_LEFT : ARROW_RIGHT;\n    const horizontalStartKey = rtl ? ARROW_RIGHT : ARROW_LEFT;\n    if (isGrid) {\n      const sizes = itemSizes || Array.from({\n        length: elementsRef.current.length\n      }, () => ({\n        width: 1,\n        height: 1\n      }));\n      // To calculate movements on the grid, we use hypothetical cell indices\n      // as if every item was 1x1, then convert back to real indices.\n      const cellMap = createGridCellMap(sizes, cols, dense);\n      const minGridIndex = cellMap.findIndex(index => index != null && !isListIndexDisabled(elementsRef, index, disabledIndices));\n      // last enabled index\n      const maxGridIndex = cellMap.reduce((foundIndex, index, cellIndex) => index != null && !isListIndexDisabled(elementsRef, index, disabledIndices) ? cellIndex : foundIndex, -1);\n      const maybeNextIndex = cellMap[getGridNavigatedIndex({\n        current: cellMap.map(itemIndex => itemIndex ? elementsRef.current[itemIndex] : null)\n      }, {\n        event,\n        orientation,\n        loop,\n        rtl,\n        cols,\n        // treat undefined (empty grid spaces) as disabled indices so we\n        // don't end up in them\n        disabledIndices: getGridCellIndices([...((typeof disabledIndices !== 'function' ? disabledIndices : null) || elementsRef.current.map((_, index) => isListIndexDisabled(elementsRef, index, disabledIndices) ? index : undefined)), undefined], cellMap),\n        minIndex: minGridIndex,\n        maxIndex: maxGridIndex,\n        prevIndex: getGridCellIndexOfCorner(activeIndex > maxIndex ? minIndex : activeIndex, sizes, cellMap, cols,\n        // use a corner matching the edge closest to the direction we're\n        // moving in so we don't end up in the same item. Prefer\n        // top/left over bottom/right.\n        event.key === ARROW_DOWN ? 'bl' : event.key === horizontalEndKey ? 'tr' : 'tl')\n      })];\n      if (maybeNextIndex != null) {\n        nextIndex = maybeNextIndex;\n      }\n    }\n    const toEndKeys = {\n      horizontal: [horizontalEndKey],\n      vertical: [ARROW_DOWN],\n      both: [horizontalEndKey, ARROW_DOWN]\n    }[orientation];\n    const toStartKeys = {\n      horizontal: [horizontalStartKey],\n      vertical: [ARROW_UP],\n      both: [horizontalStartKey, ARROW_UP]\n    }[orientation];\n    const preventedKeys = isGrid ? allKeys : {\n      horizontal: horizontalKeys,\n      vertical: verticalKeys,\n      both: allKeys\n    }[orientation];\n    if (nextIndex === activeIndex && [...toEndKeys, ...toStartKeys].includes(event.key)) {\n      if (loop && nextIndex === maxIndex && toEndKeys.includes(event.key)) {\n        nextIndex = minIndex;\n      } else if (loop && nextIndex === minIndex && toStartKeys.includes(event.key)) {\n        nextIndex = maxIndex;\n      } else {\n        nextIndex = findNonDisabledListIndex(elementsRef, {\n          startingIndex: nextIndex,\n          decrement: toStartKeys.includes(event.key),\n          disabledIndices\n        });\n      }\n    }\n    if (nextIndex !== activeIndex && !isIndexOutOfListBounds(elementsRef, nextIndex)) {\n      var _elementsRef$current$;\n      event.stopPropagation();\n      if (preventedKeys.includes(event.key)) {\n        event.preventDefault();\n      }\n      onNavigate(nextIndex);\n      (_elementsRef$current$ = elementsRef.current[nextIndex]) == null || _elementsRef$current$.focus();\n    }\n  }\n  const computedProps = {\n    ...domProps,\n    ...renderElementProps,\n    ref: forwardedRef,\n    'aria-orientation': orientation === 'both' ? undefined : orientation,\n    onKeyDown(e) {\n      domProps.onKeyDown == null || domProps.onKeyDown(e);\n      renderElementProps.onKeyDown == null || renderElementProps.onKeyDown(e);\n      handleKeyDown(e);\n    }\n  };\n  return /*#__PURE__*/jsx(CompositeContext.Provider, {\n    value: contextValue,\n    children: /*#__PURE__*/jsx(FloatingList, {\n      elementsRef: elementsRef,\n      children: renderJsx(render, computedProps)\n    })\n  });\n});\n/**\n * @see https://floating-ui.com/docs/Composite\n */\nconst CompositeItem = /*#__PURE__*/React.forwardRef(function CompositeItem(props, forwardedRef) {\n  const {\n    render,\n    ...domProps\n  } = props;\n  const renderElementProps = render && typeof render !== 'function' ? render.props : {};\n  const {\n    activeIndex,\n    onNavigate\n  } = React.useContext(CompositeContext);\n  const {\n    ref,\n    index\n  } = useListItem();\n  const mergedRef = useMergeRefs([ref, forwardedRef, renderElementProps.ref]);\n  const isActive = activeIndex === index;\n  const computedProps = {\n    ...domProps,\n    ...renderElementProps,\n    ref: mergedRef,\n    tabIndex: isActive ? 0 : -1,\n    'data-active': isActive ? '' : undefined,\n    onFocus(e) {\n      domProps.onFocus == null || domProps.onFocus(e);\n      renderElementProps.onFocus == null || renderElementProps.onFocus(e);\n      onNavigate(index);\n    }\n  };\n  return renderJsx(render, computedProps);\n});\n\n// https://github.com/mui/material-ui/issues/41190#issuecomment-2040873379\nconst SafeReact = {\n  ...React\n};\n\nlet serverHandoffComplete = false;\nlet count = 0;\nconst genId = () => // Ensure the id is unique with multiple independent versions of Floating UI\n// on <React 18\n\"floating-ui-\" + Math.random().toString(36).slice(2, 6) + count++;\nfunction useFloatingId() {\n  const [id, setId] = React.useState(() => serverHandoffComplete ? genId() : undefined);\n  useModernLayoutEffect(() => {\n    if (id == null) {\n      setId(genId());\n    }\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, []);\n  React.useEffect(() => {\n    serverHandoffComplete = true;\n  }, []);\n  return id;\n}\nconst useReactId = SafeReact.useId;\n\n/**\n * Uses React 18's built-in `useId()` when available, or falls back to a\n * slightly less performant (requiring a double render) implementation for\n * earlier React versions.\n * @see https://floating-ui.com/docs/react-utils#useid\n */\nconst useId = useReactId || useFloatingId;\n\nlet devMessageSet;\nif (process.env.NODE_ENV !== \"production\") {\n  devMessageSet = /*#__PURE__*/new Set();\n}\nfunction warn() {\n  var _devMessageSet;\n  for (var _len = arguments.length, messages = new Array(_len), _key = 0; _key < _len; _key++) {\n    messages[_key] = arguments[_key];\n  }\n  const message = \"Floating UI: \" + messages.join(' ');\n  if (!((_devMessageSet = devMessageSet) != null && _devMessageSet.has(message))) {\n    var _devMessageSet2;\n    (_devMessageSet2 = devMessageSet) == null || _devMessageSet2.add(message);\n    console.warn(message);\n  }\n}\nfunction error() {\n  var _devMessageSet3;\n  for (var _len2 = arguments.length, messages = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n    messages[_key2] = arguments[_key2];\n  }\n  const message = \"Floating UI: \" + messages.join(' ');\n  if (!((_devMessageSet3 = devMessageSet) != null && _devMessageSet3.has(message))) {\n    var _devMessageSet4;\n    (_devMessageSet4 = devMessageSet) == null || _devMessageSet4.add(message);\n    console.error(message);\n  }\n}\n\n/**\n * Renders a pointing arrow triangle.\n * @see https://floating-ui.com/docs/FloatingArrow\n */\nconst FloatingArrow = /*#__PURE__*/React.forwardRef(function FloatingArrow(props, ref) {\n  const {\n    context: {\n      placement,\n      elements: {\n        floating\n      },\n      middlewareData: {\n        arrow,\n        shift\n      }\n    },\n    width = 14,\n    height = 7,\n    tipRadius = 0,\n    strokeWidth = 0,\n    staticOffset,\n    stroke,\n    d,\n    style: {\n      transform,\n      ...restStyle\n    } = {},\n    ...rest\n  } = props;\n  if (process.env.NODE_ENV !== \"production\") {\n    if (!ref) {\n      warn('The `ref` prop is required for `FloatingArrow`.');\n    }\n  }\n  const clipPathId = useId();\n  const [isRTL, setIsRTL] = React.useState(false);\n\n  // https://github.com/floating-ui/floating-ui/issues/2932\n  useModernLayoutEffect(() => {\n    if (!floating) return;\n    const isRTL = getComputedStyle(floating).direction === 'rtl';\n    if (isRTL) {\n      setIsRTL(true);\n    }\n  }, [floating]);\n  if (!floating) {\n    return null;\n  }\n  const [side, alignment] = placement.split('-');\n  const isVerticalSide = side === 'top' || side === 'bottom';\n  let computedStaticOffset = staticOffset;\n  if (isVerticalSide && shift != null && shift.x || !isVerticalSide && shift != null && shift.y) {\n    computedStaticOffset = null;\n  }\n\n  // Strokes must be double the border width, this ensures the stroke's width\n  // works as you'd expect.\n  const computedStrokeWidth = strokeWidth * 2;\n  const halfStrokeWidth = computedStrokeWidth / 2;\n  const svgX = width / 2 * (tipRadius / -8 + 1);\n  const svgY = height / 2 * tipRadius / 4;\n  const isCustomShape = !!d;\n  const yOffsetProp = computedStaticOffset && alignment === 'end' ? 'bottom' : 'top';\n  let xOffsetProp = computedStaticOffset && alignment === 'end' ? 'right' : 'left';\n  if (computedStaticOffset && isRTL) {\n    xOffsetProp = alignment === 'end' ? 'left' : 'right';\n  }\n  const arrowX = (arrow == null ? void 0 : arrow.x) != null ? computedStaticOffset || arrow.x : '';\n  const arrowY = (arrow == null ? void 0 : arrow.y) != null ? computedStaticOffset || arrow.y : '';\n  const dValue = d || 'M0,0' + (\" H\" + width) + (\" L\" + (width - svgX) + \",\" + (height - svgY)) + (\" Q\" + width / 2 + \",\" + height + \" \" + svgX + \",\" + (height - svgY)) + ' Z';\n  const rotation = {\n    top: isCustomShape ? 'rotate(180deg)' : '',\n    left: isCustomShape ? 'rotate(90deg)' : 'rotate(-90deg)',\n    bottom: isCustomShape ? '' : 'rotate(180deg)',\n    right: isCustomShape ? 'rotate(-90deg)' : 'rotate(90deg)'\n  }[side];\n  return /*#__PURE__*/jsxs(\"svg\", {\n    ...rest,\n    \"aria-hidden\": true,\n    ref: ref,\n    width: isCustomShape ? width : width + computedStrokeWidth,\n    height: width,\n    viewBox: \"0 0 \" + width + \" \" + (height > width ? height : width),\n    style: {\n      position: 'absolute',\n      pointerEvents: 'none',\n      [xOffsetProp]: arrowX,\n      [yOffsetProp]: arrowY,\n      [side]: isVerticalSide || isCustomShape ? '100%' : \"calc(100% - \" + computedStrokeWidth / 2 + \"px)\",\n      transform: [rotation, transform].filter(t => !!t).join(' '),\n      ...restStyle\n    },\n    children: [computedStrokeWidth > 0 && /*#__PURE__*/jsx(\"path\", {\n      clipPath: \"url(#\" + clipPathId + \")\",\n      fill: \"none\",\n      stroke: stroke\n      // Account for the stroke on the fill path rendered below.\n      ,\n      strokeWidth: computedStrokeWidth + (d ? 0 : 1),\n      d: dValue\n    }), /*#__PURE__*/jsx(\"path\", {\n      stroke: computedStrokeWidth && !d ? rest.fill : 'none',\n      d: dValue\n    }), /*#__PURE__*/jsx(\"clipPath\", {\n      id: clipPathId,\n      children: /*#__PURE__*/jsx(\"rect\", {\n        x: -halfStrokeWidth,\n        y: halfStrokeWidth * (isCustomShape ? -1 : 1),\n        width: width + computedStrokeWidth,\n        height: width\n      })\n    })]\n  });\n});\n\nfunction createEventEmitter() {\n  const map = new Map();\n  return {\n    emit(event, data) {\n      var _map$get;\n      (_map$get = map.get(event)) == null || _map$get.forEach(listener => listener(data));\n    },\n    on(event, listener) {\n      if (!map.has(event)) {\n        map.set(event, new Set());\n      }\n      map.get(event).add(listener);\n    },\n    off(event, listener) {\n      var _map$get2;\n      (_map$get2 = map.get(event)) == null || _map$get2.delete(listener);\n    }\n  };\n}\n\nconst FloatingNodeContext = /*#__PURE__*/React.createContext(null);\nconst FloatingTreeContext = /*#__PURE__*/React.createContext(null);\n\n/**\n * Returns the parent node id for nested floating elements, if available.\n * Returns `null` for top-level floating elements.\n */\nconst useFloatingParentNodeId = () => {\n  var _React$useContext;\n  return ((_React$useContext = React.useContext(FloatingNodeContext)) == null ? void 0 : _React$useContext.id) || null;\n};\n\n/**\n * Returns the nearest floating tree context, if available.\n */\nconst useFloatingTree = () => React.useContext(FloatingTreeContext);\n\n/**\n * Registers a node into the `FloatingTree`, returning its id.\n * @see https://floating-ui.com/docs/FloatingTree\n */\nfunction useFloatingNodeId(customParentId) {\n  const id = useId();\n  const tree = useFloatingTree();\n  const reactParentId = useFloatingParentNodeId();\n  const parentId = customParentId || reactParentId;\n  useModernLayoutEffect(() => {\n    if (!id) return;\n    const node = {\n      id,\n      parentId\n    };\n    tree == null || tree.addNode(node);\n    return () => {\n      tree == null || tree.removeNode(node);\n    };\n  }, [tree, id, parentId]);\n  return id;\n}\n/**\n * Provides parent node context for nested floating elements.\n * @see https://floating-ui.com/docs/FloatingTree\n */\nfunction FloatingNode(props) {\n  const {\n    children,\n    id\n  } = props;\n  const parentId = useFloatingParentNodeId();\n  return /*#__PURE__*/jsx(FloatingNodeContext.Provider, {\n    value: React.useMemo(() => ({\n      id,\n      parentId\n    }), [id, parentId]),\n    children: children\n  });\n}\n/**\n * Provides context for nested floating elements when they are not children of\n * each other on the DOM.\n * This is not necessary in all cases, except when there must be explicit communication between parent and child floating elements. It is necessary for:\n * - The `bubbles` option in the `useDismiss()` Hook\n * - Nested virtual list navigation\n * - Nested floating elements that each open on hover\n * - Custom communication between parent and child floating elements\n * @see https://floating-ui.com/docs/FloatingTree\n */\nfunction FloatingTree(props) {\n  const {\n    children\n  } = props;\n  const nodesRef = React.useRef([]);\n  const addNode = React.useCallback(node => {\n    nodesRef.current = [...nodesRef.current, node];\n  }, []);\n  const removeNode = React.useCallback(node => {\n    nodesRef.current = nodesRef.current.filter(n => n !== node);\n  }, []);\n  const [events] = React.useState(() => createEventEmitter());\n  return /*#__PURE__*/jsx(FloatingTreeContext.Provider, {\n    value: React.useMemo(() => ({\n      nodesRef,\n      addNode,\n      removeNode,\n      events\n    }), [addNode, removeNode, events]),\n    children: children\n  });\n}\n\nfunction createAttribute(name) {\n  return \"data-floating-ui-\" + name;\n}\n\nfunction clearTimeoutIfSet(timeoutRef) {\n  if (timeoutRef.current !== -1) {\n    clearTimeout(timeoutRef.current);\n    timeoutRef.current = -1;\n  }\n}\n\nconst safePolygonIdentifier = /*#__PURE__*/createAttribute('safe-polygon');\nfunction getDelay(value, prop, pointerType) {\n  if (pointerType && !isMouseLikePointerType(pointerType)) {\n    return 0;\n  }\n  if (typeof value === 'number') {\n    return value;\n  }\n  if (typeof value === 'function') {\n    const result = value();\n    if (typeof result === 'number') {\n      return result;\n    }\n    return result == null ? void 0 : result[prop];\n  }\n  return value == null ? void 0 : value[prop];\n}\nfunction getRestMs(value) {\n  if (typeof value === 'function') {\n    return value();\n  }\n  return value;\n}\n/**\n * Opens the floating element while hovering over the reference element, like\n * CSS `:hover`.\n * @see https://floating-ui.com/docs/useHover\n */\nfunction useHover(context, props) {\n  if (props === void 0) {\n    props = {};\n  }\n  const {\n    open,\n    onOpenChange,\n    dataRef,\n    events,\n    elements\n  } = context;\n  const {\n    enabled = true,\n    delay = 0,\n    handleClose = null,\n    mouseOnly = false,\n    restMs = 0,\n    move = true\n  } = props;\n  const tree = useFloatingTree();\n  const parentId = useFloatingParentNodeId();\n  const handleCloseRef = useLatestRef(handleClose);\n  const delayRef = useLatestRef(delay);\n  const openRef = useLatestRef(open);\n  const restMsRef = useLatestRef(restMs);\n  const pointerTypeRef = React.useRef();\n  const timeoutRef = React.useRef(-1);\n  const handlerRef = React.useRef();\n  const restTimeoutRef = React.useRef(-1);\n  const blockMouseMoveRef = React.useRef(true);\n  const performedPointerEventsMutationRef = React.useRef(false);\n  const unbindMouseMoveRef = React.useRef(() => {});\n  const restTimeoutPendingRef = React.useRef(false);\n  const isHoverOpen = useEffectEvent(() => {\n    var _dataRef$current$open;\n    const type = (_dataRef$current$open = dataRef.current.openEvent) == null ? void 0 : _dataRef$current$open.type;\n    return (type == null ? void 0 : type.includes('mouse')) && type !== 'mousedown';\n  });\n\n  // When closing before opening, clear the delay timeouts to cancel it\n  // from showing.\n  React.useEffect(() => {\n    if (!enabled) return;\n    function onOpenChange(_ref) {\n      let {\n        open\n      } = _ref;\n      if (!open) {\n        clearTimeoutIfSet(timeoutRef);\n        clearTimeoutIfSet(restTimeoutRef);\n        blockMouseMoveRef.current = true;\n        restTimeoutPendingRef.current = false;\n      }\n    }\n    events.on('openchange', onOpenChange);\n    return () => {\n      events.off('openchange', onOpenChange);\n    };\n  }, [enabled, events]);\n  React.useEffect(() => {\n    if (!enabled) return;\n    if (!handleCloseRef.current) return;\n    if (!open) return;\n    function onLeave(event) {\n      if (isHoverOpen()) {\n        onOpenChange(false, event, 'hover');\n      }\n    }\n    const html = getDocument$1(elements.floating).documentElement;\n    html.addEventListener('mouseleave', onLeave);\n    return () => {\n      html.removeEventListener('mouseleave', onLeave);\n    };\n  }, [elements.floating, open, onOpenChange, enabled, handleCloseRef, isHoverOpen]);\n  const closeWithDelay = React.useCallback(function (event, runElseBranch, reason) {\n    if (runElseBranch === void 0) {\n      runElseBranch = true;\n    }\n    if (reason === void 0) {\n      reason = 'hover';\n    }\n    const closeDelay = getDelay(delayRef.current, 'close', pointerTypeRef.current);\n    if (closeDelay && !handlerRef.current) {\n      clearTimeoutIfSet(timeoutRef);\n      timeoutRef.current = window.setTimeout(() => onOpenChange(false, event, reason), closeDelay);\n    } else if (runElseBranch) {\n      clearTimeoutIfSet(timeoutRef);\n      onOpenChange(false, event, reason);\n    }\n  }, [delayRef, onOpenChange]);\n  const cleanupMouseMoveHandler = useEffectEvent(() => {\n    unbindMouseMoveRef.current();\n    handlerRef.current = undefined;\n  });\n  const clearPointerEvents = useEffectEvent(() => {\n    if (performedPointerEventsMutationRef.current) {\n      const body = getDocument$1(elements.floating).body;\n      body.style.pointerEvents = '';\n      body.removeAttribute(safePolygonIdentifier);\n      performedPointerEventsMutationRef.current = false;\n    }\n  });\n  const isClickLikeOpenEvent = useEffectEvent(() => {\n    return dataRef.current.openEvent ? ['click', 'mousedown'].includes(dataRef.current.openEvent.type) : false;\n  });\n\n  // Registering the mouse events on the reference directly to bypass React's\n  // delegation system. If the cursor was on a disabled element and then entered\n  // the reference (no gap), `mouseenter` doesn't fire in the delegation system.\n  React.useEffect(() => {\n    if (!enabled) return;\n    function onReferenceMouseEnter(event) {\n      clearTimeoutIfSet(timeoutRef);\n      blockMouseMoveRef.current = false;\n      if (mouseOnly && !isMouseLikePointerType(pointerTypeRef.current) || getRestMs(restMsRef.current) > 0 && !getDelay(delayRef.current, 'open')) {\n        return;\n      }\n      const openDelay = getDelay(delayRef.current, 'open', pointerTypeRef.current);\n      if (openDelay) {\n        timeoutRef.current = window.setTimeout(() => {\n          if (!openRef.current) {\n            onOpenChange(true, event, 'hover');\n          }\n        }, openDelay);\n      } else if (!open) {\n        onOpenChange(true, event, 'hover');\n      }\n    }\n    function onReferenceMouseLeave(event) {\n      if (isClickLikeOpenEvent()) {\n        clearPointerEvents();\n        return;\n      }\n      unbindMouseMoveRef.current();\n      const doc = getDocument$1(elements.floating);\n      clearTimeoutIfSet(restTimeoutRef);\n      restTimeoutPendingRef.current = false;\n      if (handleCloseRef.current && dataRef.current.floatingContext) {\n        // Prevent clearing `onScrollMouseLeave` timeout.\n        if (!open) {\n          clearTimeoutIfSet(timeoutRef);\n        }\n        handlerRef.current = handleCloseRef.current({\n          ...dataRef.current.floatingContext,\n          tree,\n          x: event.clientX,\n          y: event.clientY,\n          onClose() {\n            clearPointerEvents();\n            cleanupMouseMoveHandler();\n            if (!isClickLikeOpenEvent()) {\n              closeWithDelay(event, true, 'safe-polygon');\n            }\n          }\n        });\n        const handler = handlerRef.current;\n        doc.addEventListener('mousemove', handler);\n        unbindMouseMoveRef.current = () => {\n          doc.removeEventListener('mousemove', handler);\n        };\n        return;\n      }\n\n      // Allow interactivity without `safePolygon` on touch devices. With a\n      // pointer, a short close delay is an alternative, so it should work\n      // consistently.\n      const shouldClose = pointerTypeRef.current === 'touch' ? !contains$1(elements.floating, event.relatedTarget) : true;\n      if (shouldClose) {\n        closeWithDelay(event);\n      }\n    }\n\n    // Ensure the floating element closes after scrolling even if the pointer\n    // did not move.\n    // https://github.com/floating-ui/floating-ui/discussions/1692\n    function onScrollMouseLeave(event) {\n      if (isClickLikeOpenEvent()) return;\n      if (!dataRef.current.floatingContext) return;\n      handleCloseRef.current == null || handleCloseRef.current({\n        ...dataRef.current.floatingContext,\n        tree,\n        x: event.clientX,\n        y: event.clientY,\n        onClose() {\n          clearPointerEvents();\n          cleanupMouseMoveHandler();\n          if (!isClickLikeOpenEvent()) {\n            closeWithDelay(event);\n          }\n        }\n      })(event);\n    }\n    function onFloatingMouseEnter() {\n      clearTimeoutIfSet(timeoutRef);\n    }\n    function onFloatingMouseLeave(event) {\n      if (!isClickLikeOpenEvent()) {\n        closeWithDelay(event, false);\n      }\n    }\n    if (isElement(elements.domReference)) {\n      const reference = elements.domReference;\n      const floating = elements.floating;\n      if (open) {\n        reference.addEventListener('mouseleave', onScrollMouseLeave);\n      }\n      if (move) {\n        reference.addEventListener('mousemove', onReferenceMouseEnter, {\n          once: true\n        });\n      }\n      reference.addEventListener('mouseenter', onReferenceMouseEnter);\n      reference.addEventListener('mouseleave', onReferenceMouseLeave);\n      if (floating) {\n        floating.addEventListener('mouseleave', onScrollMouseLeave);\n        floating.addEventListener('mouseenter', onFloatingMouseEnter);\n        floating.addEventListener('mouseleave', onFloatingMouseLeave);\n      }\n      return () => {\n        if (open) {\n          reference.removeEventListener('mouseleave', onScrollMouseLeave);\n        }\n        if (move) {\n          reference.removeEventListener('mousemove', onReferenceMouseEnter);\n        }\n        reference.removeEventListener('mouseenter', onReferenceMouseEnter);\n        reference.removeEventListener('mouseleave', onReferenceMouseLeave);\n        if (floating) {\n          floating.removeEventListener('mouseleave', onScrollMouseLeave);\n          floating.removeEventListener('mouseenter', onFloatingMouseEnter);\n          floating.removeEventListener('mouseleave', onFloatingMouseLeave);\n        }\n      };\n    }\n  }, [elements, enabled, context, mouseOnly, move, closeWithDelay, cleanupMouseMoveHandler, clearPointerEvents, onOpenChange, open, openRef, tree, delayRef, handleCloseRef, dataRef, isClickLikeOpenEvent, restMsRef]);\n\n  // Block pointer-events of every element other than the reference and floating\n  // while the floating element is open and has a `handleClose` handler. Also\n  // handles nested floating elements.\n  // https://github.com/floating-ui/floating-ui/issues/1722\n  useModernLayoutEffect(() => {\n    var _handleCloseRef$curre;\n    if (!enabled) return;\n    if (open && (_handleCloseRef$curre = handleCloseRef.current) != null && (_handleCloseRef$curre = _handleCloseRef$curre.__options) != null && _handleCloseRef$curre.blockPointerEvents && isHoverOpen()) {\n      performedPointerEventsMutationRef.current = true;\n      const floatingEl = elements.floating;\n      if (isElement(elements.domReference) && floatingEl) {\n        var _tree$nodesRef$curren;\n        const body = getDocument$1(elements.floating).body;\n        body.setAttribute(safePolygonIdentifier, '');\n        const ref = elements.domReference;\n        const parentFloating = tree == null || (_tree$nodesRef$curren = tree.nodesRef.current.find(node => node.id === parentId)) == null || (_tree$nodesRef$curren = _tree$nodesRef$curren.context) == null ? void 0 : _tree$nodesRef$curren.elements.floating;\n        if (parentFloating) {\n          parentFloating.style.pointerEvents = '';\n        }\n        body.style.pointerEvents = 'none';\n        ref.style.pointerEvents = 'auto';\n        floatingEl.style.pointerEvents = 'auto';\n        return () => {\n          body.style.pointerEvents = '';\n          ref.style.pointerEvents = '';\n          floatingEl.style.pointerEvents = '';\n        };\n      }\n    }\n  }, [enabled, open, parentId, elements, tree, handleCloseRef, isHoverOpen]);\n  useModernLayoutEffect(() => {\n    if (!open) {\n      pointerTypeRef.current = undefined;\n      restTimeoutPendingRef.current = false;\n      cleanupMouseMoveHandler();\n      clearPointerEvents();\n    }\n  }, [open, cleanupMouseMoveHandler, clearPointerEvents]);\n  React.useEffect(() => {\n    return () => {\n      cleanupMouseMoveHandler();\n      clearTimeoutIfSet(timeoutRef);\n      clearTimeoutIfSet(restTimeoutRef);\n      clearPointerEvents();\n    };\n  }, [enabled, elements.domReference, cleanupMouseMoveHandler, clearPointerEvents]);\n  const reference = React.useMemo(() => {\n    function setPointerRef(event) {\n      pointerTypeRef.current = event.pointerType;\n    }\n    return {\n      onPointerDown: setPointerRef,\n      onPointerEnter: setPointerRef,\n      onMouseMove(event) {\n        const {\n          nativeEvent\n        } = event;\n        function handleMouseMove() {\n          if (!blockMouseMoveRef.current && !openRef.current) {\n            onOpenChange(true, nativeEvent, 'hover');\n          }\n        }\n        if (mouseOnly && !isMouseLikePointerType(pointerTypeRef.current)) {\n          return;\n        }\n        if (open || getRestMs(restMsRef.current) === 0) {\n          return;\n        }\n\n        // Ignore insignificant movements to account for tremors.\n        if (restTimeoutPendingRef.current && event.movementX ** 2 + event.movementY ** 2 < 2) {\n          return;\n        }\n        clearTimeoutIfSet(restTimeoutRef);\n        if (pointerTypeRef.current === 'touch') {\n          handleMouseMove();\n        } else {\n          restTimeoutPendingRef.current = true;\n          restTimeoutRef.current = window.setTimeout(handleMouseMove, getRestMs(restMsRef.current));\n        }\n      }\n    };\n  }, [mouseOnly, onOpenChange, open, openRef, restMsRef]);\n  return React.useMemo(() => enabled ? {\n    reference\n  } : {}, [enabled, reference]);\n}\n\nconst NOOP = () => {};\nconst FloatingDelayGroupContext = /*#__PURE__*/React.createContext({\n  delay: 0,\n  initialDelay: 0,\n  timeoutMs: 0,\n  currentId: null,\n  setCurrentId: NOOP,\n  setState: NOOP,\n  isInstantPhase: false\n});\n\n/**\n * @deprecated\n * Use the return value of `useDelayGroup()` instead.\n */\nconst useDelayGroupContext = () => React.useContext(FloatingDelayGroupContext);\n/**\n * Provides context for a group of floating elements that should share a\n * `delay`.\n * @see https://floating-ui.com/docs/FloatingDelayGroup\n */\nfunction FloatingDelayGroup(props) {\n  const {\n    children,\n    delay,\n    timeoutMs = 0\n  } = props;\n  const [state, setState] = React.useReducer((prev, next) => ({\n    ...prev,\n    ...next\n  }), {\n    delay,\n    timeoutMs,\n    initialDelay: delay,\n    currentId: null,\n    isInstantPhase: false\n  });\n  const initialCurrentIdRef = React.useRef(null);\n  const setCurrentId = React.useCallback(currentId => {\n    setState({\n      currentId\n    });\n  }, []);\n  useModernLayoutEffect(() => {\n    if (state.currentId) {\n      if (initialCurrentIdRef.current === null) {\n        initialCurrentIdRef.current = state.currentId;\n      } else if (!state.isInstantPhase) {\n        setState({\n          isInstantPhase: true\n        });\n      }\n    } else {\n      if (state.isInstantPhase) {\n        setState({\n          isInstantPhase: false\n        });\n      }\n      initialCurrentIdRef.current = null;\n    }\n  }, [state.currentId, state.isInstantPhase]);\n  return /*#__PURE__*/jsx(FloatingDelayGroupContext.Provider, {\n    value: React.useMemo(() => ({\n      ...state,\n      setState,\n      setCurrentId\n    }), [state, setCurrentId]),\n    children: children\n  });\n}\n/**\n * Enables grouping when called inside a component that's a child of a\n * `FloatingDelayGroup`.\n * @see https://floating-ui.com/docs/FloatingDelayGroup\n */\nfunction useDelayGroup(context, options) {\n  if (options === void 0) {\n    options = {};\n  }\n  const {\n    open,\n    onOpenChange,\n    floatingId\n  } = context;\n  const {\n    id: optionId,\n    enabled = true\n  } = options;\n  const id = optionId != null ? optionId : floatingId;\n  const groupContext = useDelayGroupContext();\n  const {\n    currentId,\n    setCurrentId,\n    initialDelay,\n    setState,\n    timeoutMs\n  } = groupContext;\n  useModernLayoutEffect(() => {\n    if (!enabled) return;\n    if (!currentId) return;\n    setState({\n      delay: {\n        open: 1,\n        close: getDelay(initialDelay, 'close')\n      }\n    });\n    if (currentId !== id) {\n      onOpenChange(false);\n    }\n  }, [enabled, id, onOpenChange, setState, currentId, initialDelay]);\n  useModernLayoutEffect(() => {\n    function unset() {\n      onOpenChange(false);\n      setState({\n        delay: initialDelay,\n        currentId: null\n      });\n    }\n    if (!enabled) return;\n    if (!currentId) return;\n    if (!open && currentId === id) {\n      if (timeoutMs) {\n        const timeout = window.setTimeout(unset, timeoutMs);\n        return () => {\n          clearTimeout(timeout);\n        };\n      }\n      unset();\n    }\n  }, [enabled, open, setState, currentId, id, onOpenChange, initialDelay, timeoutMs]);\n  useModernLayoutEffect(() => {\n    if (!enabled) return;\n    if (setCurrentId === NOOP || !open) return;\n    setCurrentId(id);\n  }, [enabled, open, setCurrentId, id]);\n  return groupContext;\n}\n\nconst NextFloatingDelayGroupContext = /*#__PURE__*/React.createContext({\n  hasProvider: false,\n  timeoutMs: 0,\n  delayRef: {\n    current: 0\n  },\n  initialDelayRef: {\n    current: 0\n  },\n  timeoutIdRef: {\n    current: -1\n  },\n  currentIdRef: {\n    current: null\n  },\n  currentContextRef: {\n    current: null\n  }\n});\n/**\n * Experimental next version of `FloatingDelayGroup` to become the default\n * in the future. This component is not yet stable.\n * Provides context for a group of floating elements that should share a\n * `delay`. Unlike `FloatingDelayGroup`, `useNextDelayGroup` with this\n * component does not cause a re-render of unrelated consumers of the\n * context when the delay changes.\n * @see https://floating-ui.com/docs/FloatingDelayGroup\n */\nfunction NextFloatingDelayGroup(props) {\n  const {\n    children,\n    delay,\n    timeoutMs = 0\n  } = props;\n  const delayRef = React.useRef(delay);\n  const initialDelayRef = React.useRef(delay);\n  const currentIdRef = React.useRef(null);\n  const currentContextRef = React.useRef(null);\n  const timeoutIdRef = React.useRef(-1);\n  return /*#__PURE__*/jsx(NextFloatingDelayGroupContext.Provider, {\n    value: React.useMemo(() => ({\n      hasProvider: true,\n      delayRef,\n      initialDelayRef,\n      currentIdRef,\n      timeoutMs,\n      currentContextRef,\n      timeoutIdRef\n    }), [timeoutMs]),\n    children: children\n  });\n}\n/**\n * Enables grouping when called inside a component that's a child of a\n * `NextFloatingDelayGroup`.\n * @see https://floating-ui.com/docs/FloatingDelayGroup\n */\nfunction useNextDelayGroup(context, options) {\n  if (options === void 0) {\n    options = {};\n  }\n  const {\n    open,\n    onOpenChange,\n    floatingId\n  } = context;\n  const {\n    enabled = true\n  } = options;\n  const groupContext = React.useContext(NextFloatingDelayGroupContext);\n  const {\n    currentIdRef,\n    delayRef,\n    timeoutMs,\n    initialDelayRef,\n    currentContextRef,\n    hasProvider,\n    timeoutIdRef\n  } = groupContext;\n  const [isInstantPhase, setIsInstantPhase] = React.useState(false);\n  useModernLayoutEffect(() => {\n    function unset() {\n      var _currentContextRef$cu;\n      setIsInstantPhase(false);\n      (_currentContextRef$cu = currentContextRef.current) == null || _currentContextRef$cu.setIsInstantPhase(false);\n      currentIdRef.current = null;\n      currentContextRef.current = null;\n      delayRef.current = initialDelayRef.current;\n    }\n    if (!enabled) return;\n    if (!currentIdRef.current) return;\n    if (!open && currentIdRef.current === floatingId) {\n      setIsInstantPhase(false);\n      if (timeoutMs) {\n        timeoutIdRef.current = window.setTimeout(unset, timeoutMs);\n        return () => {\n          clearTimeout(timeoutIdRef.current);\n        };\n      }\n      unset();\n    }\n  }, [enabled, open, floatingId, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeoutIdRef]);\n  useModernLayoutEffect(() => {\n    if (!enabled) return;\n    if (!open) return;\n    const prevContext = currentContextRef.current;\n    const prevId = currentIdRef.current;\n    currentContextRef.current = {\n      onOpenChange,\n      setIsInstantPhase\n    };\n    currentIdRef.current = floatingId;\n    delayRef.current = {\n      open: 0,\n      close: getDelay(initialDelayRef.current, 'close')\n    };\n    if (prevId !== null && prevId !== floatingId) {\n      clearTimeoutIfSet(timeoutIdRef);\n      setIsInstantPhase(true);\n      prevContext == null || prevContext.setIsInstantPhase(true);\n      prevContext == null || prevContext.onOpenChange(false);\n    } else {\n      setIsInstantPhase(false);\n      prevContext == null || prevContext.setIsInstantPhase(false);\n    }\n  }, [enabled, open, floatingId, onOpenChange, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeoutIdRef]);\n  useModernLayoutEffect(() => {\n    return () => {\n      currentContextRef.current = null;\n    };\n  }, [currentContextRef]);\n  return React.useMemo(() => ({\n    hasProvider,\n    delayRef,\n    isInstantPhase\n  }), [hasProvider, delayRef, isInstantPhase]);\n}\n\nlet rafId = 0;\nfunction enqueueFocus(el, options) {\n  if (options === void 0) {\n    options = {};\n  }\n  const {\n    preventScroll = false,\n    cancelPrevious = true,\n    sync = false\n  } = options;\n  cancelPrevious && cancelAnimationFrame(rafId);\n  const exec = () => el == null ? void 0 : el.focus({\n    preventScroll\n  });\n  if (sync) {\n    exec();\n  } else {\n    rafId = requestAnimationFrame(exec);\n  }\n}\n\nfunction contains(parent, child) {\n  if (!parent || !child) {\n    return false;\n  }\n  const rootNode = child.getRootNode == null ? void 0 : child.getRootNode();\n\n  // First, attempt with faster native method\n  if (parent.contains(child)) {\n    return true;\n  }\n\n  // then fallback to custom implementation with Shadow DOM support\n  if (rootNode && isShadowRoot(rootNode)) {\n    let next = child;\n    while (next) {\n      if (parent === next) {\n        return true;\n      }\n      // @ts-ignore\n      next = next.parentNode || next.host;\n    }\n  }\n\n  // Give up, the result is false\n  return false;\n}\nfunction getTarget(event) {\n  if ('composedPath' in event) {\n    return event.composedPath()[0];\n  }\n\n  // TS thinks `event` is of type never as it assumes all browsers support\n  // `composedPath()`, but browsers without shadow DOM don't.\n  return event.target;\n}\nfunction getDocument(node) {\n  return (node == null ? void 0 : node.ownerDocument) || document;\n}\n\n// Modified to add conditional `aria-hidden` support:\n// https://github.com/theKashey/aria-hidden/blob/9220c8f4a4fd35f63bee5510a9f41a37264382d4/src/index.ts\nconst counters = {\n  inert: /*#__PURE__*/new WeakMap(),\n  'aria-hidden': /*#__PURE__*/new WeakMap(),\n  none: /*#__PURE__*/new WeakMap()\n};\nfunction getCounterMap(control) {\n  if (control === 'inert') return counters.inert;\n  if (control === 'aria-hidden') return counters['aria-hidden'];\n  return counters.none;\n}\nlet uncontrolledElementsSet = /*#__PURE__*/new WeakSet();\nlet markerMap = {};\nlet lockCount$1 = 0;\nconst supportsInert = () => typeof HTMLElement !== 'undefined' && 'inert' in HTMLElement.prototype;\nconst unwrapHost = node => node && (node.host || unwrapHost(node.parentNode));\nconst correctElements = (parent, targets) => targets.map(target => {\n  if (parent.contains(target)) {\n    return target;\n  }\n  const correctedTarget = unwrapHost(target);\n  if (parent.contains(correctedTarget)) {\n    return correctedTarget;\n  }\n  return null;\n}).filter(x => x != null);\nfunction applyAttributeToOthers(uncorrectedAvoidElements, body, ariaHidden, inert) {\n  const markerName = 'data-floating-ui-inert';\n  const controlAttribute = inert ? 'inert' : ariaHidden ? 'aria-hidden' : null;\n  const avoidElements = correctElements(body, uncorrectedAvoidElements);\n  const elementsToKeep = new Set();\n  const elementsToStop = new Set(avoidElements);\n  const hiddenElements = [];\n  if (!markerMap[markerName]) {\n    markerMap[markerName] = new WeakMap();\n  }\n  const markerCounter = markerMap[markerName];\n  avoidElements.forEach(keep);\n  deep(body);\n  elementsToKeep.clear();\n  function keep(el) {\n    if (!el || elementsToKeep.has(el)) {\n      return;\n    }\n    elementsToKeep.add(el);\n    el.parentNode && keep(el.parentNode);\n  }\n  function deep(parent) {\n    if (!parent || elementsToStop.has(parent)) {\n      return;\n    }\n    [].forEach.call(parent.children, node => {\n      if (getNodeName(node) === 'script') return;\n      if (elementsToKeep.has(node)) {\n        deep(node);\n      } else {\n        const attr = controlAttribute ? node.getAttribute(controlAttribute) : null;\n        const alreadyHidden = attr !== null && attr !== 'false';\n        const counterMap = getCounterMap(controlAttribute);\n        const counterValue = (counterMap.get(node) || 0) + 1;\n        const markerValue = (markerCounter.get(node) || 0) + 1;\n        counterMap.set(node, counterValue);\n        markerCounter.set(node, markerValue);\n        hiddenElements.push(node);\n        if (counterValue === 1 && alreadyHidden) {\n          uncontrolledElementsSet.add(node);\n        }\n        if (markerValue === 1) {\n          node.setAttribute(markerName, '');\n        }\n        if (!alreadyHidden && controlAttribute) {\n          node.setAttribute(controlAttribute, controlAttribute === 'inert' ? '' : 'true');\n        }\n      }\n    });\n  }\n  lockCount$1++;\n  return () => {\n    hiddenElements.forEach(element => {\n      const counterMap = getCounterMap(controlAttribute);\n      const currentCounterValue = counterMap.get(element) || 0;\n      const counterValue = currentCounterValue - 1;\n      const markerValue = (markerCounter.get(element) || 0) - 1;\n      counterMap.set(element, counterValue);\n      markerCounter.set(element, markerValue);\n      if (!counterValue) {\n        if (!uncontrolledElementsSet.has(element) && controlAttribute) {\n          element.removeAttribute(controlAttribute);\n        }\n        uncontrolledElementsSet.delete(element);\n      }\n      if (!markerValue) {\n        element.removeAttribute(markerName);\n      }\n    });\n    lockCount$1--;\n    if (!lockCount$1) {\n      counters.inert = new WeakMap();\n      counters['aria-hidden'] = new WeakMap();\n      counters.none = new WeakMap();\n      uncontrolledElementsSet = new WeakSet();\n      markerMap = {};\n    }\n  };\n}\nfunction markOthers(avoidElements, ariaHidden, inert) {\n  if (ariaHidden === void 0) {\n    ariaHidden = false;\n  }\n  if (inert === void 0) {\n    inert = false;\n  }\n  const body = getDocument(avoidElements[0]).body;\n  return applyAttributeToOthers(avoidElements.concat(Array.from(body.querySelectorAll('[aria-live],[role=\"status\"],output'))), body, ariaHidden, inert);\n}\n\nconst HIDDEN_STYLES = {\n  border: 0,\n  clip: 'rect(0 0 0 0)',\n  height: '1px',\n  margin: '-1px',\n  overflow: 'hidden',\n  padding: 0,\n  position: 'fixed',\n  whiteSpace: 'nowrap',\n  width: '1px',\n  top: 0,\n  left: 0\n};\nconst FocusGuard = /*#__PURE__*/React.forwardRef(function FocusGuard(props, ref) {\n  const [role, setRole] = React.useState();\n  useModernLayoutEffect(() => {\n    if (isSafari()) {\n      // Unlike other screen readers such as NVDA and JAWS, the virtual cursor\n      // on VoiceOver does trigger the onFocus event, so we can use the focus\n      // trap element. On Safari, only buttons trigger the onFocus event.\n      // NB: \"group\" role in the Sandbox no longer appears to work, must be a\n      // button role.\n      setRole('button');\n    }\n  }, []);\n  const restProps = {\n    ref,\n    tabIndex: 0,\n    // Role is only for VoiceOver\n    role,\n    'aria-hidden': role ? undefined : true,\n    [createAttribute('focus-guard')]: '',\n    style: HIDDEN_STYLES\n  };\n  return /*#__PURE__*/jsx(\"span\", {\n    ...props,\n    ...restProps\n  });\n});\n\nconst PortalContext = /*#__PURE__*/React.createContext(null);\nconst attr = /*#__PURE__*/createAttribute('portal');\n/**\n * @see https://floating-ui.com/docs/FloatingPortal#usefloatingportalnode\n */\nfunction useFloatingPortalNode(props) {\n  if (props === void 0) {\n    props = {};\n  }\n  const {\n    id,\n    root\n  } = props;\n  const uniqueId = useId();\n  const portalContext = usePortalContext();\n  const [portalNode, setPortalNode] = React.useState(null);\n  const portalNodeRef = React.useRef(null);\n  useModernLayoutEffect(() => {\n    return () => {\n      portalNode == null || portalNode.remove();\n      // Allow the subsequent layout effects to create a new node on updates.\n      // The portal node will still be cleaned up on unmount.\n      // https://github.com/floating-ui/floating-ui/issues/2454\n      queueMicrotask(() => {\n        portalNodeRef.current = null;\n      });\n    };\n  }, [portalNode]);\n  useModernLayoutEffect(() => {\n    // Wait for the uniqueId to be generated before creating the portal node in\n    // React <18 (using `useFloatingId` instead of the native `useId`).\n    // https://github.com/floating-ui/floating-ui/issues/2778\n    if (!uniqueId) return;\n    if (portalNodeRef.current) return;\n    const existingIdRoot = id ? document.getElementById(id) : null;\n    if (!existingIdRoot) return;\n    const subRoot = document.createElement('div');\n    subRoot.id = uniqueId;\n    subRoot.setAttribute(attr, '');\n    existingIdRoot.appendChild(subRoot);\n    portalNodeRef.current = subRoot;\n    setPortalNode(subRoot);\n  }, [id, uniqueId]);\n  useModernLayoutEffect(() => {\n    // Wait for the root to exist before creating the portal node. The root must\n    // be stored in state, not a ref, for this to work reactively.\n    if (root === null) return;\n    if (!uniqueId) return;\n    if (portalNodeRef.current) return;\n    let container = root || (portalContext == null ? void 0 : portalContext.portalNode);\n    if (container && !isNode(container)) container = container.current;\n    container = container || document.body;\n    let idWrapper = null;\n    if (id) {\n      idWrapper = document.createElement('div');\n      idWrapper.id = id;\n      container.appendChild(idWrapper);\n    }\n    const subRoot = document.createElement('div');\n    subRoot.id = uniqueId;\n    subRoot.setAttribute(attr, '');\n    container = idWrapper || container;\n    container.appendChild(subRoot);\n    portalNodeRef.current = subRoot;\n    setPortalNode(subRoot);\n  }, [id, root, uniqueId, portalContext]);\n  return portalNode;\n}\n/**\n * Portals the floating element into a given container element — by default,\n * outside of the app root and into the body.\n * This is necessary to ensure the floating element can appear outside any\n * potential parent containers that cause clipping (such as `overflow: hidden`),\n * while retaining its location in the React tree.\n * @see https://floating-ui.com/docs/FloatingPortal\n */\nfunction FloatingPortal(props) {\n  const {\n    children,\n    id,\n    root,\n    preserveTabOrder = true\n  } = props;\n  const portalNode = useFloatingPortalNode({\n    id,\n    root\n  });\n  const [focusManagerState, setFocusManagerState] = React.useState(null);\n  const beforeOutsideRef = React.useRef(null);\n  const afterOutsideRef = React.useRef(null);\n  const beforeInsideRef = React.useRef(null);\n  const afterInsideRef = React.useRef(null);\n  const modal = focusManagerState == null ? void 0 : focusManagerState.modal;\n  const open = focusManagerState == null ? void 0 : focusManagerState.open;\n  const shouldRenderGuards =\n  // The FocusManager and therefore floating element are currently open/\n  // rendered.\n  !!focusManagerState &&\n  // Guards are only for non-modal focus management.\n  !focusManagerState.modal &&\n  // Don't render if unmount is transitioning.\n  focusManagerState.open && preserveTabOrder && !!(root || portalNode);\n\n  // https://codesandbox.io/s/tabbable-portal-f4tng?file=/src/TabbablePortal.tsx\n  React.useEffect(() => {\n    if (!portalNode || !preserveTabOrder || modal) {\n      return;\n    }\n\n    // Make sure elements inside the portal element are tabbable only when the\n    // portal has already been focused, either by tabbing into a focus trap\n    // element outside or using the mouse.\n    function onFocus(event) {\n      if (portalNode && isOutsideEvent(event)) {\n        const focusing = event.type === 'focusin';\n        const manageFocus = focusing ? enableFocusInside : disableFocusInside;\n        manageFocus(portalNode);\n      }\n    }\n    // Listen to the event on the capture phase so they run before the focus\n    // trap elements onFocus prop is called.\n    portalNode.addEventListener('focusin', onFocus, true);\n    portalNode.addEventListener('focusout', onFocus, true);\n    return () => {\n      portalNode.removeEventListener('focusin', onFocus, true);\n      portalNode.removeEventListener('focusout', onFocus, true);\n    };\n  }, [portalNode, preserveTabOrder, modal]);\n  React.useEffect(() => {\n    if (!portalNode) return;\n    if (open) return;\n    enableFocusInside(portalNode);\n  }, [open, portalNode]);\n  return /*#__PURE__*/jsxs(PortalContext.Provider, {\n    value: React.useMemo(() => ({\n      preserveTabOrder,\n      beforeOutsideRef,\n      afterOutsideRef,\n      beforeInsideRef,\n      afterInsideRef,\n      portalNode,\n      setFocusManagerState\n    }), [preserveTabOrder, portalNode]),\n    children: [shouldRenderGuards && portalNode && /*#__PURE__*/jsx(FocusGuard, {\n      \"data-type\": \"outside\",\n      ref: beforeOutsideRef,\n      onFocus: event => {\n        if (isOutsideEvent(event, portalNode)) {\n          var _beforeInsideRef$curr;\n          (_beforeInsideRef$curr = beforeInsideRef.current) == null || _beforeInsideRef$curr.focus();\n        } else {\n          const domReference = focusManagerState ? focusManagerState.domReference : null;\n          const prevTabbable = getPreviousTabbable(domReference);\n          prevTabbable == null || prevTabbable.focus();\n        }\n      }\n    }), shouldRenderGuards && portalNode && /*#__PURE__*/jsx(\"span\", {\n      \"aria-owns\": portalNode.id,\n      style: HIDDEN_STYLES\n    }), portalNode && /*#__PURE__*/ReactDOM.createPortal(children, portalNode), shouldRenderGuards && portalNode && /*#__PURE__*/jsx(FocusGuard, {\n      \"data-type\": \"outside\",\n      ref: afterOutsideRef,\n      onFocus: event => {\n        if (isOutsideEvent(event, portalNode)) {\n          var _afterInsideRef$curre;\n          (_afterInsideRef$curre = afterInsideRef.current) == null || _afterInsideRef$curre.focus();\n        } else {\n          const domReference = focusManagerState ? focusManagerState.domReference : null;\n          const nextTabbable = getNextTabbable(domReference);\n          nextTabbable == null || nextTabbable.focus();\n          (focusManagerState == null ? void 0 : focusManagerState.closeOnFocusOut) && (focusManagerState == null ? void 0 : focusManagerState.onOpenChange(false, event.nativeEvent, 'focus-out'));\n        }\n      }\n    })]\n  });\n}\nconst usePortalContext = () => React.useContext(PortalContext);\n\nfunction useLiteMergeRefs(refs) {\n  return React.useMemo(() => {\n    return value => {\n      refs.forEach(ref => {\n        if (ref) {\n          ref.current = value;\n        }\n      });\n    };\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, refs);\n}\n\nconst LIST_LIMIT = 20;\nlet previouslyFocusedElements = [];\nfunction clearDisconnectedPreviouslyFocusedElements() {\n  previouslyFocusedElements = previouslyFocusedElements.filter(el => el.isConnected);\n}\nfunction addPreviouslyFocusedElement(element) {\n  clearDisconnectedPreviouslyFocusedElements();\n  if (element && getNodeName(element) !== 'body') {\n    previouslyFocusedElements.push(element);\n    if (previouslyFocusedElements.length > LIST_LIMIT) {\n      previouslyFocusedElements = previouslyFocusedElements.slice(-20);\n    }\n  }\n}\nfunction getPreviouslyFocusedElement() {\n  clearDisconnectedPreviouslyFocusedElements();\n  return previouslyFocusedElements[previouslyFocusedElements.length - 1];\n}\nfunction getFirstTabbableElement(container) {\n  const tabbableOptions = getTabbableOptions();\n  if (isTabbable(container, tabbableOptions)) {\n    return container;\n  }\n  return tabbable(container, tabbableOptions)[0] || container;\n}\nfunction handleTabIndex(floatingFocusElement, orderRef) {\n  var _floatingFocusElement;\n  if (!orderRef.current.includes('floating') && !((_floatingFocusElement = floatingFocusElement.getAttribute('role')) != null && _floatingFocusElement.includes('dialog'))) {\n    return;\n  }\n  const options = getTabbableOptions();\n  const focusableElements = focusable(floatingFocusElement, options);\n  const tabbableContent = focusableElements.filter(element => {\n    const dataTabIndex = element.getAttribute('data-tabindex') || '';\n    return isTabbable(element, options) || element.hasAttribute('data-tabindex') && !dataTabIndex.startsWith('-');\n  });\n  const tabIndex = floatingFocusElement.getAttribute('tabindex');\n  if (orderRef.current.includes('floating') || tabbableContent.length === 0) {\n    if (tabIndex !== '0') {\n      floatingFocusElement.setAttribute('tabindex', '0');\n    }\n  } else if (tabIndex !== '-1' || floatingFocusElement.hasAttribute('data-tabindex') && floatingFocusElement.getAttribute('data-tabindex') !== '-1') {\n    floatingFocusElement.setAttribute('tabindex', '-1');\n    floatingFocusElement.setAttribute('data-tabindex', '-1');\n  }\n}\nconst VisuallyHiddenDismiss = /*#__PURE__*/React.forwardRef(function VisuallyHiddenDismiss(props, ref) {\n  return /*#__PURE__*/jsx(\"button\", {\n    ...props,\n    type: \"button\",\n    ref: ref,\n    tabIndex: -1,\n    style: HIDDEN_STYLES\n  });\n});\n/**\n * Provides focus management for the floating element.\n * @see https://floating-ui.com/docs/FloatingFocusManager\n */\nfunction FloatingFocusManager(props) {\n  const {\n    context,\n    children,\n    disabled = false,\n    order = ['content'],\n    guards: _guards = true,\n    initialFocus = 0,\n    returnFocus = true,\n    restoreFocus = false,\n    modal = true,\n    visuallyHiddenDismiss = false,\n    closeOnFocusOut = true,\n    outsideElementsInert = false,\n    getInsideElements: _getInsideElements = () => []\n  } = props;\n  const {\n    open,\n    onOpenChange,\n    events,\n    dataRef,\n    elements: {\n      domReference,\n      floating\n    }\n  } = context;\n  const getNodeId = useEffectEvent(() => {\n    var _dataRef$current$floa;\n    return (_dataRef$current$floa = dataRef.current.floatingContext) == null ? void 0 : _dataRef$current$floa.nodeId;\n  });\n  const getInsideElements = useEffectEvent(_getInsideElements);\n  const ignoreInitialFocus = typeof initialFocus === 'number' && initialFocus < 0;\n  // If the reference is a combobox and is typeable (e.g. input/textarea),\n  // there are different focus semantics. The guards should not be rendered, but\n  // aria-hidden should be applied to all nodes still. Further, the visually\n  // hidden dismiss button should only appear at the end of the list, not the\n  // start.\n  const isUntrappedTypeableCombobox = isTypeableCombobox(domReference) && ignoreInitialFocus;\n\n  // Force the guards to be rendered if the `inert` attribute is not supported.\n  const inertSupported = supportsInert();\n  const guards = inertSupported ? _guards : true;\n  const useInert = !guards || inertSupported && outsideElementsInert;\n  const orderRef = useLatestRef(order);\n  const initialFocusRef = useLatestRef(initialFocus);\n  const returnFocusRef = useLatestRef(returnFocus);\n  const tree = useFloatingTree();\n  const portalContext = usePortalContext();\n  const startDismissButtonRef = React.useRef(null);\n  const endDismissButtonRef = React.useRef(null);\n  const preventReturnFocusRef = React.useRef(false);\n  const isPointerDownRef = React.useRef(false);\n  const tabbableIndexRef = React.useRef(-1);\n  const blurTimeoutRef = React.useRef(-1);\n  const isInsidePortal = portalContext != null;\n  const floatingFocusElement = getFloatingFocusElement(floating);\n  const getTabbableContent = useEffectEvent(function (container) {\n    if (container === void 0) {\n      container = floatingFocusElement;\n    }\n    return container ? tabbable(container, getTabbableOptions()) : [];\n  });\n  const getTabbableElements = useEffectEvent(container => {\n    const content = getTabbableContent(container);\n    return orderRef.current.map(type => {\n      if (domReference && type === 'reference') {\n        return domReference;\n      }\n      if (floatingFocusElement && type === 'floating') {\n        return floatingFocusElement;\n      }\n      return content;\n    }).filter(Boolean).flat();\n  });\n  React.useEffect(() => {\n    if (disabled) return;\n    if (!modal) return;\n    function onKeyDown(event) {\n      if (event.key === 'Tab') {\n        // The focus guards have nothing to focus, so we need to stop the event.\n        if (contains$1(floatingFocusElement, activeElement(getDocument$1(floatingFocusElement))) && getTabbableContent().length === 0 && !isUntrappedTypeableCombobox) {\n          stopEvent(event);\n        }\n        const els = getTabbableElements();\n        const target = getTarget$1(event);\n        if (orderRef.current[0] === 'reference' && target === domReference) {\n          stopEvent(event);\n          if (event.shiftKey) {\n            enqueueFocus(els[els.length - 1]);\n          } else {\n            enqueueFocus(els[1]);\n          }\n        }\n        if (orderRef.current[1] === 'floating' && target === floatingFocusElement && event.shiftKey) {\n          stopEvent(event);\n          enqueueFocus(els[0]);\n        }\n      }\n    }\n    const doc = getDocument$1(floatingFocusElement);\n    doc.addEventListener('keydown', onKeyDown);\n    return () => {\n      doc.removeEventListener('keydown', onKeyDown);\n    };\n  }, [disabled, domReference, floatingFocusElement, modal, orderRef, isUntrappedTypeableCombobox, getTabbableContent, getTabbableElements]);\n  React.useEffect(() => {\n    if (disabled) return;\n    if (!floating) return;\n    function handleFocusIn(event) {\n      const target = getTarget$1(event);\n      const tabbableContent = getTabbableContent();\n      const tabbableIndex = tabbableContent.indexOf(target);\n      if (tabbableIndex !== -1) {\n        tabbableIndexRef.current = tabbableIndex;\n      }\n    }\n    floating.addEventListener('focusin', handleFocusIn);\n    return () => {\n      floating.removeEventListener('focusin', handleFocusIn);\n    };\n  }, [disabled, floating, getTabbableContent]);\n  React.useEffect(() => {\n    if (disabled) return;\n    if (!closeOnFocusOut) return;\n\n    // In Safari, buttons lose focus when pressing them.\n    function handlePointerDown() {\n      isPointerDownRef.current = true;\n      setTimeout(() => {\n        isPointerDownRef.current = false;\n      });\n    }\n    function handleFocusOutside(event) {\n      const relatedTarget = event.relatedTarget;\n      const currentTarget = event.currentTarget;\n      const target = getTarget$1(event);\n      queueMicrotask(() => {\n        const nodeId = getNodeId();\n        const movedToUnrelatedNode = !(contains$1(domReference, relatedTarget) || contains$1(floating, relatedTarget) || contains$1(relatedTarget, floating) || contains$1(portalContext == null ? void 0 : portalContext.portalNode, relatedTarget) || relatedTarget != null && relatedTarget.hasAttribute(createAttribute('focus-guard')) || tree && (getNodeChildren$1(tree.nodesRef.current, nodeId).find(node => {\n          var _node$context, _node$context2;\n          return contains$1((_node$context = node.context) == null ? void 0 : _node$context.elements.floating, relatedTarget) || contains$1((_node$context2 = node.context) == null ? void 0 : _node$context2.elements.domReference, relatedTarget);\n        }) || getNodeAncestors(tree.nodesRef.current, nodeId).find(node => {\n          var _node$context3, _node$context4, _node$context5;\n          return [(_node$context3 = node.context) == null ? void 0 : _node$context3.elements.floating, getFloatingFocusElement((_node$context4 = node.context) == null ? void 0 : _node$context4.elements.floating)].includes(relatedTarget) || ((_node$context5 = node.context) == null ? void 0 : _node$context5.elements.domReference) === relatedTarget;\n        })));\n        if (currentTarget === domReference && floatingFocusElement) {\n          handleTabIndex(floatingFocusElement, orderRef);\n        }\n\n        // Restore focus to the previous tabbable element index to prevent\n        // focus from being lost outside the floating tree.\n        if (restoreFocus && currentTarget !== domReference && !(target != null && target.isConnected) && activeElement(getDocument$1(floatingFocusElement)) === getDocument$1(floatingFocusElement).body) {\n          // Let `FloatingPortal` effect knows that focus is still inside the\n          // floating tree.\n          if (isHTMLElement(floatingFocusElement)) {\n            floatingFocusElement.focus();\n          }\n          const prevTabbableIndex = tabbableIndexRef.current;\n          const tabbableContent = getTabbableContent();\n          const nodeToFocus = tabbableContent[prevTabbableIndex] || tabbableContent[tabbableContent.length - 1] || floatingFocusElement;\n          if (isHTMLElement(nodeToFocus)) {\n            nodeToFocus.focus();\n          }\n        }\n\n        // https://github.com/floating-ui/floating-ui/issues/3060\n        if (dataRef.current.insideReactTree) {\n          dataRef.current.insideReactTree = false;\n          return;\n        }\n\n        // Focus did not move inside the floating tree, and there are no tabbable\n        // portal guards to handle closing.\n        if ((isUntrappedTypeableCombobox ? true : !modal) && relatedTarget && movedToUnrelatedNode && !isPointerDownRef.current &&\n        // Fix React 18 Strict Mode returnFocus due to double rendering.\n        relatedTarget !== getPreviouslyFocusedElement()) {\n          preventReturnFocusRef.current = true;\n          onOpenChange(false, event, 'focus-out');\n        }\n      });\n    }\n    const shouldHandleBlurCapture = Boolean(!tree && portalContext);\n    function markInsideReactTree() {\n      clearTimeoutIfSet(blurTimeoutRef);\n      dataRef.current.insideReactTree = true;\n      blurTimeoutRef.current = window.setTimeout(() => {\n        dataRef.current.insideReactTree = false;\n      });\n    }\n    if (floating && isHTMLElement(domReference)) {\n      domReference.addEventListener('focusout', handleFocusOutside);\n      domReference.addEventListener('pointerdown', handlePointerDown);\n      floating.addEventListener('focusout', handleFocusOutside);\n      if (shouldHandleBlurCapture) {\n        floating.addEventListener('focusout', markInsideReactTree, true);\n      }\n      return () => {\n        domReference.removeEventListener('focusout', handleFocusOutside);\n        domReference.removeEventListener('pointerdown', handlePointerDown);\n        floating.removeEventListener('focusout', handleFocusOutside);\n        if (shouldHandleBlurCapture) {\n          floating.removeEventListener('focusout', markInsideReactTree, true);\n        }\n      };\n    }\n  }, [disabled, domReference, floating, floatingFocusElement, modal, tree, portalContext, onOpenChange, closeOnFocusOut, restoreFocus, getTabbableContent, isUntrappedTypeableCombobox, getNodeId, orderRef, dataRef]);\n  const beforeGuardRef = React.useRef(null);\n  const afterGuardRef = React.useRef(null);\n  const mergedBeforeGuardRef = useLiteMergeRefs([beforeGuardRef, portalContext == null ? void 0 : portalContext.beforeInsideRef]);\n  const mergedAfterGuardRef = useLiteMergeRefs([afterGuardRef, portalContext == null ? void 0 : portalContext.afterInsideRef]);\n  React.useEffect(() => {\n    var _portalContext$portal, _ancestors$find;\n    if (disabled) return;\n    if (!floating) return;\n\n    // Don't hide portals nested within the parent portal.\n    const portalNodes = Array.from((portalContext == null || (_portalContext$portal = portalContext.portalNode) == null ? void 0 : _portalContext$portal.querySelectorAll(\"[\" + createAttribute('portal') + \"]\")) || []);\n    const ancestors = tree ? getNodeAncestors(tree.nodesRef.current, getNodeId()) : [];\n    const rootAncestorComboboxDomReference = (_ancestors$find = ancestors.find(node => {\n      var _node$context6;\n      return isTypeableCombobox(((_node$context6 = node.context) == null ? void 0 : _node$context6.elements.domReference) || null);\n    })) == null || (_ancestors$find = _ancestors$find.context) == null ? void 0 : _ancestors$find.elements.domReference;\n    const insideElements = [floating, rootAncestorComboboxDomReference, ...portalNodes, ...getInsideElements(), startDismissButtonRef.current, endDismissButtonRef.current, beforeGuardRef.current, afterGuardRef.current, portalContext == null ? void 0 : portalContext.beforeOutsideRef.current, portalContext == null ? void 0 : portalContext.afterOutsideRef.current, orderRef.current.includes('reference') || isUntrappedTypeableCombobox ? domReference : null].filter(x => x != null);\n    const cleanup = modal || isUntrappedTypeableCombobox ? markOthers(insideElements, !useInert, useInert) : markOthers(insideElements);\n    return () => {\n      cleanup();\n    };\n  }, [disabled, domReference, floating, modal, orderRef, portalContext, isUntrappedTypeableCombobox, guards, useInert, tree, getNodeId, getInsideElements]);\n  useModernLayoutEffect(() => {\n    if (disabled || !isHTMLElement(floatingFocusElement)) return;\n    const doc = getDocument$1(floatingFocusElement);\n    const previouslyFocusedElement = activeElement(doc);\n\n    // Wait for any layout effect state setters to execute to set `tabIndex`.\n    queueMicrotask(() => {\n      const focusableElements = getTabbableElements(floatingFocusElement);\n      const initialFocusValue = initialFocusRef.current;\n      const elToFocus = (typeof initialFocusValue === 'number' ? focusableElements[initialFocusValue] : initialFocusValue.current) || floatingFocusElement;\n      const focusAlreadyInsideFloatingEl = contains$1(floatingFocusElement, previouslyFocusedElement);\n      if (!ignoreInitialFocus && !focusAlreadyInsideFloatingEl && open) {\n        enqueueFocus(elToFocus, {\n          preventScroll: elToFocus === floatingFocusElement\n        });\n      }\n    });\n  }, [disabled, open, floatingFocusElement, ignoreInitialFocus, getTabbableElements, initialFocusRef]);\n  useModernLayoutEffect(() => {\n    if (disabled || !floatingFocusElement) return;\n    const doc = getDocument$1(floatingFocusElement);\n    const previouslyFocusedElement = activeElement(doc);\n    addPreviouslyFocusedElement(previouslyFocusedElement);\n\n    // Dismissing via outside press should always ignore `returnFocus` to\n    // prevent unwanted scrolling.\n    function onOpenChange(_ref) {\n      let {\n        reason,\n        event,\n        nested\n      } = _ref;\n      if (['hover', 'safe-polygon'].includes(reason) && event.type === 'mouseleave') {\n        preventReturnFocusRef.current = true;\n      }\n      if (reason !== 'outside-press') return;\n      if (nested) {\n        preventReturnFocusRef.current = false;\n      } else if (isVirtualClick(event) || isVirtualPointerEvent(event)) {\n        preventReturnFocusRef.current = false;\n      } else {\n        let isPreventScrollSupported = false;\n        document.createElement('div').focus({\n          get preventScroll() {\n            isPreventScrollSupported = true;\n            return false;\n          }\n        });\n        if (isPreventScrollSupported) {\n          preventReturnFocusRef.current = false;\n        } else {\n          preventReturnFocusRef.current = true;\n        }\n      }\n    }\n    events.on('openchange', onOpenChange);\n    const fallbackEl = doc.createElement('span');\n    fallbackEl.setAttribute('tabindex', '-1');\n    fallbackEl.setAttribute('aria-hidden', 'true');\n    Object.assign(fallbackEl.style, HIDDEN_STYLES);\n    if (isInsidePortal && domReference) {\n      domReference.insertAdjacentElement('afterend', fallbackEl);\n    }\n    function getReturnElement() {\n      if (typeof returnFocusRef.current === 'boolean') {\n        const el = domReference || getPreviouslyFocusedElement();\n        return el && el.isConnected ? el : fallbackEl;\n      }\n      return returnFocusRef.current.current || fallbackEl;\n    }\n    return () => {\n      events.off('openchange', onOpenChange);\n      const activeEl = activeElement(doc);\n      const isFocusInsideFloatingTree = contains$1(floating, activeEl) || tree && getNodeChildren$1(tree.nodesRef.current, getNodeId(), false).some(node => {\n        var _node$context7;\n        return contains$1((_node$context7 = node.context) == null ? void 0 : _node$context7.elements.floating, activeEl);\n      });\n      const returnElement = getReturnElement();\n      queueMicrotask(() => {\n        // This is `returnElement`, if it's tabbable, or its first tabbable child.\n        const tabbableReturnElement = getFirstTabbableElement(returnElement);\n        if (\n        // eslint-disable-next-line react-hooks/exhaustive-deps\n        returnFocusRef.current && !preventReturnFocusRef.current && isHTMLElement(tabbableReturnElement) && (\n        // If the focus moved somewhere else after mount, avoid returning focus\n        // since it likely entered a different element which should be\n        // respected: https://github.com/floating-ui/floating-ui/issues/2607\n        tabbableReturnElement !== activeEl && activeEl !== doc.body ? isFocusInsideFloatingTree : true)) {\n          tabbableReturnElement.focus({\n            preventScroll: true\n          });\n        }\n        fallbackEl.remove();\n      });\n    };\n  }, [disabled, floating, floatingFocusElement, returnFocusRef, dataRef, events, tree, isInsidePortal, domReference, getNodeId]);\n  React.useEffect(() => {\n    // The `returnFocus` cleanup behavior is inside a microtask; ensure we\n    // wait for it to complete before resetting the flag.\n    queueMicrotask(() => {\n      preventReturnFocusRef.current = false;\n    });\n    return () => {\n      queueMicrotask(clearDisconnectedPreviouslyFocusedElements);\n    };\n  }, [disabled]);\n\n  // Synchronize the `context` & `modal` value to the FloatingPortal context.\n  // It will decide whether or not it needs to render its own guards.\n  useModernLayoutEffect(() => {\n    if (disabled) return;\n    if (!portalContext) return;\n    portalContext.setFocusManagerState({\n      modal,\n      closeOnFocusOut,\n      open,\n      onOpenChange,\n      domReference\n    });\n    return () => {\n      portalContext.setFocusManagerState(null);\n    };\n  }, [disabled, portalContext, modal, open, onOpenChange, closeOnFocusOut, domReference]);\n  useModernLayoutEffect(() => {\n    if (disabled) return;\n    if (!floatingFocusElement) return;\n    handleTabIndex(floatingFocusElement, orderRef);\n  }, [disabled, floatingFocusElement, orderRef]);\n  function renderDismissButton(location) {\n    if (disabled || !visuallyHiddenDismiss || !modal) {\n      return null;\n    }\n    return /*#__PURE__*/jsx(VisuallyHiddenDismiss, {\n      ref: location === 'start' ? startDismissButtonRef : endDismissButtonRef,\n      onClick: event => onOpenChange(false, event.nativeEvent),\n      children: typeof visuallyHiddenDismiss === 'string' ? visuallyHiddenDismiss : 'Dismiss'\n    });\n  }\n  const shouldRenderGuards = !disabled && guards && (modal ? !isUntrappedTypeableCombobox : true) && (isInsidePortal || modal);\n  return /*#__PURE__*/jsxs(Fragment, {\n    children: [shouldRenderGuards && /*#__PURE__*/jsx(FocusGuard, {\n      \"data-type\": \"inside\",\n      ref: mergedBeforeGuardRef,\n      onFocus: event => {\n        if (modal) {\n          const els = getTabbableElements();\n          enqueueFocus(order[0] === 'reference' ? els[0] : els[els.length - 1]);\n        } else if (portalContext != null && portalContext.preserveTabOrder && portalContext.portalNode) {\n          preventReturnFocusRef.current = false;\n          if (isOutsideEvent(event, portalContext.portalNode)) {\n            const nextTabbable = getNextTabbable(domReference);\n            nextTabbable == null || nextTabbable.focus();\n          } else {\n            var _portalContext$before;\n            (_portalContext$before = portalContext.beforeOutsideRef.current) == null || _portalContext$before.focus();\n          }\n        }\n      }\n    }), !isUntrappedTypeableCombobox && renderDismissButton('start'), children, renderDismissButton('end'), shouldRenderGuards && /*#__PURE__*/jsx(FocusGuard, {\n      \"data-type\": \"inside\",\n      ref: mergedAfterGuardRef,\n      onFocus: event => {\n        if (modal) {\n          enqueueFocus(getTabbableElements()[0]);\n        } else if (portalContext != null && portalContext.preserveTabOrder && portalContext.portalNode) {\n          if (closeOnFocusOut) {\n            preventReturnFocusRef.current = true;\n          }\n          if (isOutsideEvent(event, portalContext.portalNode)) {\n            const prevTabbable = getPreviousTabbable(domReference);\n            prevTabbable == null || prevTabbable.focus();\n          } else {\n            var _portalContext$afterO;\n            (_portalContext$afterO = portalContext.afterOutsideRef.current) == null || _portalContext$afterO.focus();\n          }\n        }\n      }\n    })]\n  });\n}\n\nlet lockCount = 0;\nconst scrollbarProperty = '--floating-ui-scrollbar-width';\nfunction enableScrollLock() {\n  const platform = getPlatform();\n  const isIOS = /iP(hone|ad|od)|iOS/.test(platform) ||\n  // iPads can claim to be MacIntel\n  platform === 'MacIntel' && navigator.maxTouchPoints > 1;\n  const bodyStyle = document.body.style;\n  // RTL <body> scrollbar\n  const scrollbarX = Math.round(document.documentElement.getBoundingClientRect().left) + document.documentElement.scrollLeft;\n  const paddingProp = scrollbarX ? 'paddingLeft' : 'paddingRight';\n  const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;\n  const scrollX = bodyStyle.left ? parseFloat(bodyStyle.left) : window.scrollX;\n  const scrollY = bodyStyle.top ? parseFloat(bodyStyle.top) : window.scrollY;\n  bodyStyle.overflow = 'hidden';\n  bodyStyle.setProperty(scrollbarProperty, scrollbarWidth + \"px\");\n  if (scrollbarWidth) {\n    bodyStyle[paddingProp] = scrollbarWidth + \"px\";\n  }\n\n  // Only iOS doesn't respect `overflow: hidden` on document.body, and this\n  // technique has fewer side effects.\n  if (isIOS) {\n    var _window$visualViewpor, _window$visualViewpor2;\n    // iOS 12 does not support `visualViewport`.\n    const offsetLeft = ((_window$visualViewpor = window.visualViewport) == null ? void 0 : _window$visualViewpor.offsetLeft) || 0;\n    const offsetTop = ((_window$visualViewpor2 = window.visualViewport) == null ? void 0 : _window$visualViewpor2.offsetTop) || 0;\n    Object.assign(bodyStyle, {\n      position: 'fixed',\n      top: -(scrollY - Math.floor(offsetTop)) + \"px\",\n      left: -(scrollX - Math.floor(offsetLeft)) + \"px\",\n      right: '0'\n    });\n  }\n  return () => {\n    Object.assign(bodyStyle, {\n      overflow: '',\n      [paddingProp]: ''\n    });\n    bodyStyle.removeProperty(scrollbarProperty);\n    if (isIOS) {\n      Object.assign(bodyStyle, {\n        position: '',\n        top: '',\n        left: '',\n        right: ''\n      });\n      window.scrollTo(scrollX, scrollY);\n    }\n  };\n}\nlet cleanup = () => {};\n\n/**\n * Provides base styling for a fixed overlay element to dim content or block\n * pointer events behind a floating element.\n * It's a regular `<div>`, so it can be styled via any CSS solution you prefer.\n * @see https://floating-ui.com/docs/FloatingOverlay\n */\nconst FloatingOverlay = /*#__PURE__*/React.forwardRef(function FloatingOverlay(props, ref) {\n  const {\n    lockScroll = false,\n    ...rest\n  } = props;\n  useModernLayoutEffect(() => {\n    if (!lockScroll) return;\n    lockCount++;\n    if (lockCount === 1) {\n      cleanup = enableScrollLock();\n    }\n    return () => {\n      lockCount--;\n      if (lockCount === 0) {\n        cleanup();\n      }\n    };\n  }, [lockScroll]);\n  return /*#__PURE__*/jsx(\"div\", {\n    ref: ref,\n    ...rest,\n    style: {\n      position: 'fixed',\n      overflow: 'auto',\n      top: 0,\n      right: 0,\n      bottom: 0,\n      left: 0,\n      ...rest.style\n    }\n  });\n});\n\nfunction isButtonTarget(event) {\n  return isHTMLElement(event.target) && event.target.tagName === 'BUTTON';\n}\nfunction isAnchorTarget(event) {\n  return isHTMLElement(event.target) && event.target.tagName === 'A';\n}\nfunction isSpaceIgnored(element) {\n  return isTypeableElement(element);\n}\n/**\n * Opens or closes the floating element when clicking the reference element.\n * @see https://floating-ui.com/docs/useClick\n */\nfunction useClick(context, props) {\n  if (props === void 0) {\n    props = {};\n  }\n  const {\n    open,\n    onOpenChange,\n    dataRef,\n    elements: {\n      domReference\n    }\n  } = context;\n  const {\n    enabled = true,\n    event: eventOption = 'click',\n    toggle = true,\n    ignoreMouse = false,\n    keyboardHandlers = true,\n    stickIfOpen = true\n  } = props;\n  const pointerTypeRef = React.useRef();\n  const didKeyDownRef = React.useRef(false);\n  const reference = React.useMemo(() => ({\n    onPointerDown(event) {\n      pointerTypeRef.current = event.pointerType;\n    },\n    onMouseDown(event) {\n      const pointerType = pointerTypeRef.current;\n\n      // Ignore all buttons except for the \"main\" button.\n      // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button\n      if (event.button !== 0) return;\n      if (eventOption === 'click') return;\n      if (isMouseLikePointerType(pointerType, true) && ignoreMouse) return;\n      if (open && toggle && (dataRef.current.openEvent && stickIfOpen ? dataRef.current.openEvent.type === 'mousedown' : true)) {\n        onOpenChange(false, event.nativeEvent, 'click');\n      } else {\n        // Prevent stealing focus from the floating element\n        event.preventDefault();\n        onOpenChange(true, event.nativeEvent, 'click');\n      }\n    },\n    onClick(event) {\n      const pointerType = pointerTypeRef.current;\n      if (eventOption === 'mousedown' && pointerTypeRef.current) {\n        pointerTypeRef.current = undefined;\n        return;\n      }\n      if (isMouseLikePointerType(pointerType, true) && ignoreMouse) return;\n      if (open && toggle && (dataRef.current.openEvent && stickIfOpen ? dataRef.current.openEvent.type === 'click' : true)) {\n        onOpenChange(false, event.nativeEvent, 'click');\n      } else {\n        onOpenChange(true, event.nativeEvent, 'click');\n      }\n    },\n    onKeyDown(event) {\n      pointerTypeRef.current = undefined;\n      if (event.defaultPrevented || !keyboardHandlers || isButtonTarget(event)) {\n        return;\n      }\n      if (event.key === ' ' && !isSpaceIgnored(domReference)) {\n        // Prevent scrolling\n        event.preventDefault();\n        didKeyDownRef.current = true;\n      }\n      if (isAnchorTarget(event)) {\n        return;\n      }\n      if (event.key === 'Enter') {\n        if (open && toggle) {\n          onOpenChange(false, event.nativeEvent, 'click');\n        } else {\n          onOpenChange(true, event.nativeEvent, 'click');\n        }\n      }\n    },\n    onKeyUp(event) {\n      if (event.defaultPrevented || !keyboardHandlers || isButtonTarget(event) || isSpaceIgnored(domReference)) {\n        return;\n      }\n      if (event.key === ' ' && didKeyDownRef.current) {\n        didKeyDownRef.current = false;\n        if (open && toggle) {\n          onOpenChange(false, event.nativeEvent, 'click');\n        } else {\n          onOpenChange(true, event.nativeEvent, 'click');\n        }\n      }\n    }\n  }), [dataRef, domReference, eventOption, ignoreMouse, keyboardHandlers, onOpenChange, open, stickIfOpen, toggle]);\n  return React.useMemo(() => enabled ? {\n    reference\n  } : {}, [enabled, reference]);\n}\n\nfunction createVirtualElement(domElement, data) {\n  let offsetX = null;\n  let offsetY = null;\n  let isAutoUpdateEvent = false;\n  return {\n    contextElement: domElement || undefined,\n    getBoundingClientRect() {\n      var _data$dataRef$current;\n      const domRect = (domElement == null ? void 0 : domElement.getBoundingClientRect()) || {\n        width: 0,\n        height: 0,\n        x: 0,\n        y: 0\n      };\n      const isXAxis = data.axis === 'x' || data.axis === 'both';\n      const isYAxis = data.axis === 'y' || data.axis === 'both';\n      const canTrackCursorOnAutoUpdate = ['mouseenter', 'mousemove'].includes(((_data$dataRef$current = data.dataRef.current.openEvent) == null ? void 0 : _data$dataRef$current.type) || '') && data.pointerType !== 'touch';\n      let width = domRect.width;\n      let height = domRect.height;\n      let x = domRect.x;\n      let y = domRect.y;\n      if (offsetX == null && data.x && isXAxis) {\n        offsetX = domRect.x - data.x;\n      }\n      if (offsetY == null && data.y && isYAxis) {\n        offsetY = domRect.y - data.y;\n      }\n      x -= offsetX || 0;\n      y -= offsetY || 0;\n      width = 0;\n      height = 0;\n      if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) {\n        width = data.axis === 'y' ? domRect.width : 0;\n        height = data.axis === 'x' ? domRect.height : 0;\n        x = isXAxis && data.x != null ? data.x : x;\n        y = isYAxis && data.y != null ? data.y : y;\n      } else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) {\n        height = data.axis === 'x' ? domRect.height : height;\n        width = data.axis === 'y' ? domRect.width : width;\n      }\n      isAutoUpdateEvent = true;\n      return {\n        width,\n        height,\n        x,\n        y,\n        top: y,\n        right: x + width,\n        bottom: y + height,\n        left: x\n      };\n    }\n  };\n}\nfunction isMouseBasedEvent(event) {\n  return event != null && event.clientX != null;\n}\n/**\n * Positions the floating element relative to a client point (in the viewport),\n * such as the mouse position. By default, it follows the mouse cursor.\n * @see https://floating-ui.com/docs/useClientPoint\n */\nfunction useClientPoint(context, props) {\n  if (props === void 0) {\n    props = {};\n  }\n  const {\n    open,\n    dataRef,\n    elements: {\n      floating,\n      domReference\n    },\n    refs\n  } = context;\n  const {\n    enabled = true,\n    axis = 'both',\n    x = null,\n    y = null\n  } = props;\n  const initialRef = React.useRef(false);\n  const cleanupListenerRef = React.useRef(null);\n  const [pointerType, setPointerType] = React.useState();\n  const [reactive, setReactive] = React.useState([]);\n  const setReference = useEffectEvent((x, y) => {\n    if (initialRef.current) return;\n\n    // Prevent setting if the open event was not a mouse-like one\n    // (e.g. focus to open, then hover over the reference element).\n    // Only apply if the event exists.\n    if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) {\n      return;\n    }\n    refs.setPositionReference(createVirtualElement(domReference, {\n      x,\n      y,\n      axis,\n      dataRef,\n      pointerType\n    }));\n  });\n  const handleReferenceEnterOrMove = useEffectEvent(event => {\n    if (x != null || y != null) return;\n    if (!open) {\n      setReference(event.clientX, event.clientY);\n    } else if (!cleanupListenerRef.current) {\n      // If there's no cleanup, there's no listener, but we want to ensure\n      // we add the listener if the cursor landed on the floating element and\n      // then back on the reference (i.e. it's interactive).\n      setReactive([]);\n    }\n  });\n\n  // If the pointer is a mouse-like pointer, we want to continue following the\n  // mouse even if the floating element is transitioning out. On touch\n  // devices, this is undesirable because the floating element will move to\n  // the dismissal touch point.\n  const openCheck = isMouseLikePointerType(pointerType) ? floating : open;\n  const addListener = React.useCallback(() => {\n    // Explicitly specified `x`/`y` coordinates shouldn't add a listener.\n    if (!openCheck || !enabled || x != null || y != null) return;\n    const win = getWindow(floating);\n    function handleMouseMove(event) {\n      const target = getTarget$1(event);\n      if (!contains$1(floating, target)) {\n        setReference(event.clientX, event.clientY);\n      } else {\n        win.removeEventListener('mousemove', handleMouseMove);\n        cleanupListenerRef.current = null;\n      }\n    }\n    if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) {\n      win.addEventListener('mousemove', handleMouseMove);\n      const cleanup = () => {\n        win.removeEventListener('mousemove', handleMouseMove);\n        cleanupListenerRef.current = null;\n      };\n      cleanupListenerRef.current = cleanup;\n      return cleanup;\n    }\n    refs.setPositionReference(domReference);\n  }, [openCheck, enabled, x, y, floating, dataRef, refs, domReference, setReference]);\n  React.useEffect(() => {\n    return addListener();\n  }, [addListener, reactive]);\n  React.useEffect(() => {\n    if (enabled && !floating) {\n      initialRef.current = false;\n    }\n  }, [enabled, floating]);\n  React.useEffect(() => {\n    if (!enabled && open) {\n      initialRef.current = true;\n    }\n  }, [enabled, open]);\n  useModernLayoutEffect(() => {\n    if (enabled && (x != null || y != null)) {\n      initialRef.current = false;\n      setReference(x, y);\n    }\n  }, [enabled, x, y, setReference]);\n  const reference = React.useMemo(() => {\n    function setPointerTypeRef(_ref) {\n      let {\n        pointerType\n      } = _ref;\n      setPointerType(pointerType);\n    }\n    return {\n      onPointerDown: setPointerTypeRef,\n      onPointerEnter: setPointerTypeRef,\n      onMouseMove: handleReferenceEnterOrMove,\n      onMouseEnter: handleReferenceEnterOrMove\n    };\n  }, [handleReferenceEnterOrMove]);\n  return React.useMemo(() => enabled ? {\n    reference\n  } : {}, [enabled, reference]);\n}\n\nconst bubbleHandlerKeys = {\n  pointerdown: 'onPointerDown',\n  mousedown: 'onMouseDown',\n  click: 'onClick'\n};\nconst captureHandlerKeys = {\n  pointerdown: 'onPointerDownCapture',\n  mousedown: 'onMouseDownCapture',\n  click: 'onClickCapture'\n};\nconst normalizeProp = normalizable => {\n  var _normalizable$escapeK, _normalizable$outside;\n  return {\n    escapeKey: typeof normalizable === 'boolean' ? normalizable : (_normalizable$escapeK = normalizable == null ? void 0 : normalizable.escapeKey) != null ? _normalizable$escapeK : false,\n    outsidePress: typeof normalizable === 'boolean' ? normalizable : (_normalizable$outside = normalizable == null ? void 0 : normalizable.outsidePress) != null ? _normalizable$outside : true\n  };\n};\n/**\n * Closes the floating element when a dismissal is requested — by default, when\n * the user presses the `escape` key or outside of the floating element.\n * @see https://floating-ui.com/docs/useDismiss\n */\nfunction useDismiss(context, props) {\n  if (props === void 0) {\n    props = {};\n  }\n  const {\n    open,\n    onOpenChange,\n    elements,\n    dataRef\n  } = context;\n  const {\n    enabled = true,\n    escapeKey = true,\n    outsidePress: unstable_outsidePress = true,\n    outsidePressEvent = 'pointerdown',\n    referencePress = false,\n    referencePressEvent = 'pointerdown',\n    ancestorScroll = false,\n    bubbles,\n    capture\n  } = props;\n  const tree = useFloatingTree();\n  const outsidePressFn = useEffectEvent(typeof unstable_outsidePress === 'function' ? unstable_outsidePress : () => false);\n  const outsidePress = typeof unstable_outsidePress === 'function' ? outsidePressFn : unstable_outsidePress;\n  const endedOrStartedInsideRef = React.useRef(false);\n  const {\n    escapeKey: escapeKeyBubbles,\n    outsidePress: outsidePressBubbles\n  } = normalizeProp(bubbles);\n  const {\n    escapeKey: escapeKeyCapture,\n    outsidePress: outsidePressCapture\n  } = normalizeProp(capture);\n  const isComposingRef = React.useRef(false);\n  const closeOnEscapeKeyDown = useEffectEvent(event => {\n    var _dataRef$current$floa;\n    if (!open || !enabled || !escapeKey || event.key !== 'Escape') {\n      return;\n    }\n\n    // Wait until IME is settled. Pressing `Escape` while composing should\n    // close the compose menu, but not the floating element.\n    if (isComposingRef.current) {\n      return;\n    }\n    const nodeId = (_dataRef$current$floa = dataRef.current.floatingContext) == null ? void 0 : _dataRef$current$floa.nodeId;\n    const children = tree ? getNodeChildren$1(tree.nodesRef.current, nodeId) : [];\n    if (!escapeKeyBubbles) {\n      event.stopPropagation();\n      if (children.length > 0) {\n        let shouldDismiss = true;\n        children.forEach(child => {\n          var _child$context;\n          if ((_child$context = child.context) != null && _child$context.open && !child.context.dataRef.current.__escapeKeyBubbles) {\n            shouldDismiss = false;\n            return;\n          }\n        });\n        if (!shouldDismiss) {\n          return;\n        }\n      }\n    }\n    onOpenChange(false, isReactEvent(event) ? event.nativeEvent : event, 'escape-key');\n  });\n  const closeOnEscapeKeyDownCapture = useEffectEvent(event => {\n    var _getTarget2;\n    const callback = () => {\n      var _getTarget;\n      closeOnEscapeKeyDown(event);\n      (_getTarget = getTarget$1(event)) == null || _getTarget.removeEventListener('keydown', callback);\n    };\n    (_getTarget2 = getTarget$1(event)) == null || _getTarget2.addEventListener('keydown', callback);\n  });\n  const closeOnPressOutside = useEffectEvent(event => {\n    var _dataRef$current$floa2;\n    // Given developers can stop the propagation of the synthetic event,\n    // we can only be confident with a positive value.\n    const insideReactTree = dataRef.current.insideReactTree;\n    dataRef.current.insideReactTree = false;\n\n    // When click outside is lazy (`click` event), handle dragging.\n    // Don't close if:\n    // - The click started inside the floating element.\n    // - The click ended inside the floating element.\n    const endedOrStartedInside = endedOrStartedInsideRef.current;\n    endedOrStartedInsideRef.current = false;\n    if (outsidePressEvent === 'click' && endedOrStartedInside) {\n      return;\n    }\n    if (insideReactTree) {\n      return;\n    }\n    if (typeof outsidePress === 'function' && !outsidePress(event)) {\n      return;\n    }\n    const target = getTarget$1(event);\n    const inertSelector = \"[\" + createAttribute('inert') + \"]\";\n    const markers = getDocument$1(elements.floating).querySelectorAll(inertSelector);\n    let targetRootAncestor = isElement(target) ? target : null;\n    while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) {\n      const nextParent = getParentNode(targetRootAncestor);\n      if (isLastTraversableNode(nextParent) || !isElement(nextParent)) {\n        break;\n      }\n      targetRootAncestor = nextParent;\n    }\n\n    // Check if the click occurred on a third-party element injected after the\n    // floating element rendered.\n    if (markers.length && isElement(target) && !isRootElement(target) &&\n    // Clicked on a direct ancestor (e.g. FloatingOverlay).\n    !contains$1(target, elements.floating) &&\n    // If the target root element contains none of the markers, then the\n    // element was injected after the floating element rendered.\n    Array.from(markers).every(marker => !contains$1(targetRootAncestor, marker))) {\n      return;\n    }\n\n    // Check if the click occurred on the scrollbar\n    if (isHTMLElement(target) && floating) {\n      const lastTraversableNode = isLastTraversableNode(target);\n      const style = getComputedStyle(target);\n      const scrollRe = /auto|scroll/;\n      const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX);\n      const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY);\n      const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth;\n      const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight;\n      const isRTL = style.direction === 'rtl';\n\n      // Check click position relative to scrollbar.\n      // In some browsers it is possible to change the <body> (or window)\n      // scrollbar to the left side, but is very rare and is difficult to\n      // check for. Plus, for modal dialogs with backdrops, it is more\n      // important that the backdrop is checked but not so much the window.\n      const pressedVerticalScrollbar = canScrollY && (isRTL ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth);\n      const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight;\n      if (pressedVerticalScrollbar || pressedHorizontalScrollbar) {\n        return;\n      }\n    }\n    const nodeId = (_dataRef$current$floa2 = dataRef.current.floatingContext) == null ? void 0 : _dataRef$current$floa2.nodeId;\n    const targetIsInsideChildren = tree && getNodeChildren$1(tree.nodesRef.current, nodeId).some(node => {\n      var _node$context;\n      return isEventTargetWithin(event, (_node$context = node.context) == null ? void 0 : _node$context.elements.floating);\n    });\n    if (isEventTargetWithin(event, elements.floating) || isEventTargetWithin(event, elements.domReference) || targetIsInsideChildren) {\n      return;\n    }\n    const children = tree ? getNodeChildren$1(tree.nodesRef.current, nodeId) : [];\n    if (children.length > 0) {\n      let shouldDismiss = true;\n      children.forEach(child => {\n        var _child$context2;\n        if ((_child$context2 = child.context) != null && _child$context2.open && !child.context.dataRef.current.__outsidePressBubbles) {\n          shouldDismiss = false;\n          return;\n        }\n      });\n      if (!shouldDismiss) {\n        return;\n      }\n    }\n    onOpenChange(false, event, 'outside-press');\n  });\n  const closeOnPressOutsideCapture = useEffectEvent(event => {\n    var _getTarget4;\n    const callback = () => {\n      var _getTarget3;\n      closeOnPressOutside(event);\n      (_getTarget3 = getTarget$1(event)) == null || _getTarget3.removeEventListener(outsidePressEvent, callback);\n    };\n    (_getTarget4 = getTarget$1(event)) == null || _getTarget4.addEventListener(outsidePressEvent, callback);\n  });\n  React.useEffect(() => {\n    if (!open || !enabled) {\n      return;\n    }\n    dataRef.current.__escapeKeyBubbles = escapeKeyBubbles;\n    dataRef.current.__outsidePressBubbles = outsidePressBubbles;\n    let compositionTimeout = -1;\n    function onScroll(event) {\n      onOpenChange(false, event, 'ancestor-scroll');\n    }\n    function handleCompositionStart() {\n      window.clearTimeout(compositionTimeout);\n      isComposingRef.current = true;\n    }\n    function handleCompositionEnd() {\n      // Safari fires `compositionend` before `keydown`, so we need to wait\n      // until the next tick to set `isComposing` to `false`.\n      // https://bugs.webkit.org/show_bug.cgi?id=165004\n      compositionTimeout = window.setTimeout(() => {\n        isComposingRef.current = false;\n      },\n      // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.\n      // Only apply to WebKit for the test to remain 0ms.\n      isWebKit() ? 5 : 0);\n    }\n    const doc = getDocument$1(elements.floating);\n    if (escapeKey) {\n      doc.addEventListener('keydown', escapeKeyCapture ? closeOnEscapeKeyDownCapture : closeOnEscapeKeyDown, escapeKeyCapture);\n      doc.addEventListener('compositionstart', handleCompositionStart);\n      doc.addEventListener('compositionend', handleCompositionEnd);\n    }\n    outsidePress && doc.addEventListener(outsidePressEvent, outsidePressCapture ? closeOnPressOutsideCapture : closeOnPressOutside, outsidePressCapture);\n    let ancestors = [];\n    if (ancestorScroll) {\n      if (isElement(elements.domReference)) {\n        ancestors = getOverflowAncestors(elements.domReference);\n      }\n      if (isElement(elements.floating)) {\n        ancestors = ancestors.concat(getOverflowAncestors(elements.floating));\n      }\n      if (!isElement(elements.reference) && elements.reference && elements.reference.contextElement) {\n        ancestors = ancestors.concat(getOverflowAncestors(elements.reference.contextElement));\n      }\n    }\n\n    // Ignore the visual viewport for scrolling dismissal (allow pinch-zoom)\n    ancestors = ancestors.filter(ancestor => {\n      var _doc$defaultView;\n      return ancestor !== ((_doc$defaultView = doc.defaultView) == null ? void 0 : _doc$defaultView.visualViewport);\n    });\n    ancestors.forEach(ancestor => {\n      ancestor.addEventListener('scroll', onScroll, {\n        passive: true\n      });\n    });\n    return () => {\n      if (escapeKey) {\n        doc.removeEventListener('keydown', escapeKeyCapture ? closeOnEscapeKeyDownCapture : closeOnEscapeKeyDown, escapeKeyCapture);\n        doc.removeEventListener('compositionstart', handleCompositionStart);\n        doc.removeEventListener('compositionend', handleCompositionEnd);\n      }\n      outsidePress && doc.removeEventListener(outsidePressEvent, outsidePressCapture ? closeOnPressOutsideCapture : closeOnPressOutside, outsidePressCapture);\n      ancestors.forEach(ancestor => {\n        ancestor.removeEventListener('scroll', onScroll);\n      });\n      window.clearTimeout(compositionTimeout);\n    };\n  }, [dataRef, elements, escapeKey, outsidePress, outsidePressEvent, open, onOpenChange, ancestorScroll, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, escapeKeyCapture, closeOnEscapeKeyDownCapture, closeOnPressOutside, outsidePressCapture, closeOnPressOutsideCapture]);\n  React.useEffect(() => {\n    dataRef.current.insideReactTree = false;\n  }, [dataRef, outsidePress, outsidePressEvent]);\n  const reference = React.useMemo(() => ({\n    onKeyDown: closeOnEscapeKeyDown,\n    ...(referencePress && {\n      [bubbleHandlerKeys[referencePressEvent]]: event => {\n        onOpenChange(false, event.nativeEvent, 'reference-press');\n      },\n      ...(referencePressEvent !== 'click' && {\n        onClick(event) {\n          onOpenChange(false, event.nativeEvent, 'reference-press');\n        }\n      })\n    })\n  }), [closeOnEscapeKeyDown, onOpenChange, referencePress, referencePressEvent]);\n  const floating = React.useMemo(() => ({\n    onKeyDown: closeOnEscapeKeyDown,\n    onMouseDown() {\n      endedOrStartedInsideRef.current = true;\n    },\n    onMouseUp() {\n      endedOrStartedInsideRef.current = true;\n    },\n    [captureHandlerKeys[outsidePressEvent]]: () => {\n      dataRef.current.insideReactTree = true;\n    }\n  }), [closeOnEscapeKeyDown, outsidePressEvent, dataRef]);\n  return React.useMemo(() => enabled ? {\n    reference,\n    floating\n  } : {}, [enabled, reference, floating]);\n}\n\nfunction useFloatingRootContext(options) {\n  const {\n    open = false,\n    onOpenChange: onOpenChangeProp,\n    elements: elementsProp\n  } = options;\n  const floatingId = useId();\n  const dataRef = React.useRef({});\n  const [events] = React.useState(() => createEventEmitter());\n  const nested = useFloatingParentNodeId() != null;\n  if (process.env.NODE_ENV !== \"production\") {\n    const optionDomReference = elementsProp.reference;\n    if (optionDomReference && !isElement(optionDomReference)) {\n      error('Cannot pass a virtual element to the `elements.reference` option,', 'as it must be a real DOM element. Use `refs.setPositionReference()`', 'instead.');\n    }\n  }\n  const [positionReference, setPositionReference] = React.useState(elementsProp.reference);\n  const onOpenChange = useEffectEvent((open, event, reason) => {\n    dataRef.current.openEvent = open ? event : undefined;\n    events.emit('openchange', {\n      open,\n      event,\n      reason,\n      nested\n    });\n    onOpenChangeProp == null || onOpenChangeProp(open, event, reason);\n  });\n  const refs = React.useMemo(() => ({\n    setPositionReference\n  }), []);\n  const elements = React.useMemo(() => ({\n    reference: positionReference || elementsProp.reference || null,\n    floating: elementsProp.floating || null,\n    domReference: elementsProp.reference\n  }), [positionReference, elementsProp.reference, elementsProp.floating]);\n  return React.useMemo(() => ({\n    dataRef,\n    open,\n    onOpenChange,\n    elements,\n    events,\n    floatingId,\n    refs\n  }), [open, onOpenChange, elements, events, floatingId, refs]);\n}\n\n/**\n * Provides data to position a floating element and context to add interactions.\n * @see https://floating-ui.com/docs/useFloating\n */\nfunction useFloating(options) {\n  if (options === void 0) {\n    options = {};\n  }\n  const {\n    nodeId\n  } = options;\n  const internalRootContext = useFloatingRootContext({\n    ...options,\n    elements: {\n      reference: null,\n      floating: null,\n      ...options.elements\n    }\n  });\n  const rootContext = options.rootContext || internalRootContext;\n  const computedElements = rootContext.elements;\n  const [_domReference, setDomReference] = React.useState(null);\n  const [positionReference, _setPositionReference] = React.useState(null);\n  const optionDomReference = computedElements == null ? void 0 : computedElements.domReference;\n  const domReference = optionDomReference || _domReference;\n  const domReferenceRef = React.useRef(null);\n  const tree = useFloatingTree();\n  useModernLayoutEffect(() => {\n    if (domReference) {\n      domReferenceRef.current = domReference;\n    }\n  }, [domReference]);\n  const position = useFloating$1({\n    ...options,\n    elements: {\n      ...computedElements,\n      ...(positionReference && {\n        reference: positionReference\n      })\n    }\n  });\n  const setPositionReference = React.useCallback(node => {\n    const computedPositionReference = isElement(node) ? {\n      getBoundingClientRect: () => node.getBoundingClientRect(),\n      getClientRects: () => node.getClientRects(),\n      contextElement: node\n    } : node;\n    // Store the positionReference in state if the DOM reference is specified externally via the\n    // `elements.reference` option. This ensures that it won't be overridden on future renders.\n    _setPositionReference(computedPositionReference);\n    position.refs.setReference(computedPositionReference);\n  }, [position.refs]);\n  const setReference = React.useCallback(node => {\n    if (isElement(node) || node === null) {\n      domReferenceRef.current = node;\n      setDomReference(node);\n    }\n\n    // Backwards-compatibility for passing a virtual element to `reference`\n    // after it has set the DOM reference.\n    if (isElement(position.refs.reference.current) || position.refs.reference.current === null ||\n    // Don't allow setting virtual elements using the old technique back to\n    // `null` to support `positionReference` + an unstable `reference`\n    // callback ref.\n    node !== null && !isElement(node)) {\n      position.refs.setReference(node);\n    }\n  }, [position.refs]);\n  const refs = React.useMemo(() => ({\n    ...position.refs,\n    setReference,\n    setPositionReference,\n    domReference: domReferenceRef\n  }), [position.refs, setReference, setPositionReference]);\n  const elements = React.useMemo(() => ({\n    ...position.elements,\n    domReference: domReference\n  }), [position.elements, domReference]);\n  const context = React.useMemo(() => ({\n    ...position,\n    ...rootContext,\n    refs,\n    elements,\n    nodeId\n  }), [position, refs, elements, nodeId, rootContext]);\n  useModernLayoutEffect(() => {\n    rootContext.dataRef.current.floatingContext = context;\n    const node = tree == null ? void 0 : tree.nodesRef.current.find(node => node.id === nodeId);\n    if (node) {\n      node.context = context;\n    }\n  });\n  return React.useMemo(() => ({\n    ...position,\n    context,\n    refs,\n    elements\n  }), [position, refs, elements, context]);\n}\n\nfunction isMacSafari() {\n  return isMac() && isSafari();\n}\n/**\n * Opens the floating element while the reference element has focus, like CSS\n * `:focus`.\n * @see https://floating-ui.com/docs/useFocus\n */\nfunction useFocus(context, props) {\n  if (props === void 0) {\n    props = {};\n  }\n  const {\n    open,\n    onOpenChange,\n    events,\n    dataRef,\n    elements\n  } = context;\n  const {\n    enabled = true,\n    visibleOnly = true\n  } = props;\n  const blockFocusRef = React.useRef(false);\n  const timeoutRef = React.useRef(-1);\n  const keyboardModalityRef = React.useRef(true);\n  React.useEffect(() => {\n    if (!enabled) return;\n    const win = getWindow(elements.domReference);\n\n    // If the reference was focused and the user left the tab/window, and the\n    // floating element was not open, the focus should be blocked when they\n    // return to the tab/window.\n    function onBlur() {\n      if (!open && isHTMLElement(elements.domReference) && elements.domReference === activeElement(getDocument$1(elements.domReference))) {\n        blockFocusRef.current = true;\n      }\n    }\n    function onKeyDown() {\n      keyboardModalityRef.current = true;\n    }\n    function onPointerDown() {\n      keyboardModalityRef.current = false;\n    }\n    win.addEventListener('blur', onBlur);\n    if (isMacSafari()) {\n      win.addEventListener('keydown', onKeyDown, true);\n      win.addEventListener('pointerdown', onPointerDown, true);\n    }\n    return () => {\n      win.removeEventListener('blur', onBlur);\n      if (isMacSafari()) {\n        win.removeEventListener('keydown', onKeyDown, true);\n        win.removeEventListener('pointerdown', onPointerDown, true);\n      }\n    };\n  }, [elements.domReference, open, enabled]);\n  React.useEffect(() => {\n    if (!enabled) return;\n    function onOpenChange(_ref) {\n      let {\n        reason\n      } = _ref;\n      if (reason === 'reference-press' || reason === 'escape-key') {\n        blockFocusRef.current = true;\n      }\n    }\n    events.on('openchange', onOpenChange);\n    return () => {\n      events.off('openchange', onOpenChange);\n    };\n  }, [events, enabled]);\n  React.useEffect(() => {\n    return () => {\n      clearTimeoutIfSet(timeoutRef);\n    };\n  }, []);\n  const reference = React.useMemo(() => ({\n    onMouseLeave() {\n      blockFocusRef.current = false;\n    },\n    onFocus(event) {\n      if (blockFocusRef.current) return;\n      const target = getTarget$1(event.nativeEvent);\n      if (visibleOnly && isElement(target)) {\n        // Safari fails to match `:focus-visible` if focus was initially\n        // outside the document.\n        if (isMacSafari() && !event.relatedTarget) {\n          if (!keyboardModalityRef.current && !isTypeableElement(target)) {\n            return;\n          }\n        } else if (!matchesFocusVisible(target)) {\n          return;\n        }\n      }\n      onOpenChange(true, event.nativeEvent, 'focus');\n    },\n    onBlur(event) {\n      blockFocusRef.current = false;\n      const relatedTarget = event.relatedTarget;\n      const nativeEvent = event.nativeEvent;\n\n      // Hit the non-modal focus management portal guard. Focus will be\n      // moved into the floating element immediately after.\n      const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute('focus-guard')) && relatedTarget.getAttribute('data-type') === 'outside';\n\n      // Wait for the window blur listener to fire.\n      timeoutRef.current = window.setTimeout(() => {\n        var _dataRef$current$floa;\n        const activeEl = activeElement(elements.domReference ? elements.domReference.ownerDocument : document);\n\n        // Focus left the page, keep it open.\n        if (!relatedTarget && activeEl === elements.domReference) return;\n\n        // When focusing the reference element (e.g. regular click), then\n        // clicking into the floating element, prevent it from hiding.\n        // Note: it must be focusable, e.g. `tabindex=\"-1\"`.\n        // We can not rely on relatedTarget to point to the correct element\n        // as it will only point to the shadow host of the newly focused element\n        // and not the element that actually has received focus if it is located\n        // inside a shadow root.\n        if (contains$1((_dataRef$current$floa = dataRef.current.floatingContext) == null ? void 0 : _dataRef$current$floa.refs.floating.current, activeEl) || contains$1(elements.domReference, activeEl) || movedToFocusGuard) {\n          return;\n        }\n        onOpenChange(false, nativeEvent, 'focus');\n      });\n    }\n  }), [dataRef, elements.domReference, onOpenChange, visibleOnly]);\n  return React.useMemo(() => enabled ? {\n    reference\n  } : {}, [enabled, reference]);\n}\n\nfunction mergeProps(userProps, propsList, elementKey) {\n  const map = new Map();\n  const isItem = elementKey === 'item';\n  let domUserProps = userProps;\n  if (isItem && userProps) {\n    const {\n      [ACTIVE_KEY]: _,\n      [SELECTED_KEY]: __,\n      ...validProps\n    } = userProps;\n    domUserProps = validProps;\n  }\n  return {\n    ...(elementKey === 'floating' && {\n      tabIndex: -1,\n      [FOCUSABLE_ATTRIBUTE]: ''\n    }),\n    ...domUserProps,\n    ...propsList.map(value => {\n      const propsOrGetProps = value ? value[elementKey] : null;\n      if (typeof propsOrGetProps === 'function') {\n        return userProps ? propsOrGetProps(userProps) : null;\n      }\n      return propsOrGetProps;\n    }).concat(userProps).reduce((acc, props) => {\n      if (!props) {\n        return acc;\n      }\n      Object.entries(props).forEach(_ref => {\n        let [key, value] = _ref;\n        if (isItem && [ACTIVE_KEY, SELECTED_KEY].includes(key)) {\n          return;\n        }\n        if (key.indexOf('on') === 0) {\n          if (!map.has(key)) {\n            map.set(key, []);\n          }\n          if (typeof value === 'function') {\n            var _map$get;\n            (_map$get = map.get(key)) == null || _map$get.push(value);\n            acc[key] = function () {\n              var _map$get2;\n              for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n                args[_key] = arguments[_key];\n              }\n              return (_map$get2 = map.get(key)) == null ? void 0 : _map$get2.map(fn => fn(...args)).find(val => val !== undefined);\n            };\n          }\n        } else {\n          acc[key] = value;\n        }\n      });\n      return acc;\n    }, {})\n  };\n}\n/**\n * Merges an array of interaction hooks' props into prop getters, allowing\n * event handler functions to be composed together without overwriting one\n * another.\n * @see https://floating-ui.com/docs/useInteractions\n */\nfunction useInteractions(propsList) {\n  if (propsList === void 0) {\n    propsList = [];\n  }\n  const referenceDeps = propsList.map(key => key == null ? void 0 : key.reference);\n  const floatingDeps = propsList.map(key => key == null ? void 0 : key.floating);\n  const itemDeps = propsList.map(key => key == null ? void 0 : key.item);\n  const getReferenceProps = React.useCallback(userProps => mergeProps(userProps, propsList, 'reference'),\n  // eslint-disable-next-line react-hooks/exhaustive-deps\n  referenceDeps);\n  const getFloatingProps = React.useCallback(userProps => mergeProps(userProps, propsList, 'floating'),\n  // eslint-disable-next-line react-hooks/exhaustive-deps\n  floatingDeps);\n  const getItemProps = React.useCallback(userProps => mergeProps(userProps, propsList, 'item'),\n  // eslint-disable-next-line react-hooks/exhaustive-deps\n  itemDeps);\n  return React.useMemo(() => ({\n    getReferenceProps,\n    getFloatingProps,\n    getItemProps\n  }), [getReferenceProps, getFloatingProps, getItemProps]);\n}\n\nconst ESCAPE = 'Escape';\nfunction doSwitch(orientation, vertical, horizontal) {\n  switch (orientation) {\n    case 'vertical':\n      return vertical;\n    case 'horizontal':\n      return horizontal;\n    default:\n      return vertical || horizontal;\n  }\n}\nfunction isMainOrientationKey(key, orientation) {\n  const vertical = key === ARROW_UP || key === ARROW_DOWN;\n  const horizontal = key === ARROW_LEFT || key === ARROW_RIGHT;\n  return doSwitch(orientation, vertical, horizontal);\n}\nfunction isMainOrientationToEndKey(key, orientation, rtl) {\n  const vertical = key === ARROW_DOWN;\n  const horizontal = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT;\n  return doSwitch(orientation, vertical, horizontal) || key === 'Enter' || key === ' ' || key === '';\n}\nfunction isCrossOrientationOpenKey(key, orientation, rtl) {\n  const vertical = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT;\n  const horizontal = key === ARROW_DOWN;\n  return doSwitch(orientation, vertical, horizontal);\n}\nfunction isCrossOrientationCloseKey(key, orientation, rtl, cols) {\n  const vertical = rtl ? key === ARROW_RIGHT : key === ARROW_LEFT;\n  const horizontal = key === ARROW_UP;\n  if (orientation === 'both' || orientation === 'horizontal' && cols && cols > 1) {\n    return key === ESCAPE;\n  }\n  return doSwitch(orientation, vertical, horizontal);\n}\n/**\n * Adds arrow key-based navigation of a list of items, either using real DOM\n * focus or virtual focus.\n * @see https://floating-ui.com/docs/useListNavigation\n */\nfunction useListNavigation(context, props) {\n  const {\n    open,\n    onOpenChange,\n    elements,\n    floatingId\n  } = context;\n  const {\n    listRef,\n    activeIndex,\n    onNavigate: unstable_onNavigate = () => {},\n    enabled = true,\n    selectedIndex = null,\n    allowEscape = false,\n    loop = false,\n    nested = false,\n    rtl = false,\n    virtual = false,\n    focusItemOnOpen = 'auto',\n    focusItemOnHover = true,\n    openOnArrowKeyDown = true,\n    disabledIndices = undefined,\n    orientation = 'vertical',\n    parentOrientation,\n    cols = 1,\n    scrollItemIntoView = true,\n    virtualItemRef,\n    itemSizes,\n    dense = false\n  } = props;\n  if (process.env.NODE_ENV !== \"production\") {\n    if (allowEscape) {\n      if (!loop) {\n        warn('`useListNavigation` looping must be enabled to allow escaping.');\n      }\n      if (!virtual) {\n        warn('`useListNavigation` must be virtual to allow escaping.');\n      }\n    }\n    if (orientation === 'vertical' && cols > 1) {\n      warn('In grid list navigation mode (`cols` > 1), the `orientation` should', 'be either \"horizontal\" or \"both\".');\n    }\n  }\n  const floatingFocusElement = getFloatingFocusElement(elements.floating);\n  const floatingFocusElementRef = useLatestRef(floatingFocusElement);\n  const parentId = useFloatingParentNodeId();\n  const tree = useFloatingTree();\n  useModernLayoutEffect(() => {\n    context.dataRef.current.orientation = orientation;\n  }, [context, orientation]);\n  const onNavigate = useEffectEvent(() => {\n    unstable_onNavigate(indexRef.current === -1 ? null : indexRef.current);\n  });\n  const typeableComboboxReference = isTypeableCombobox(elements.domReference);\n  const focusItemOnOpenRef = React.useRef(focusItemOnOpen);\n  const indexRef = React.useRef(selectedIndex != null ? selectedIndex : -1);\n  const keyRef = React.useRef(null);\n  const isPointerModalityRef = React.useRef(true);\n  const previousOnNavigateRef = React.useRef(onNavigate);\n  const previousMountedRef = React.useRef(!!elements.floating);\n  const previousOpenRef = React.useRef(open);\n  const forceSyncFocusRef = React.useRef(false);\n  const forceScrollIntoViewRef = React.useRef(false);\n  const disabledIndicesRef = useLatestRef(disabledIndices);\n  const latestOpenRef = useLatestRef(open);\n  const scrollItemIntoViewRef = useLatestRef(scrollItemIntoView);\n  const selectedIndexRef = useLatestRef(selectedIndex);\n  const [activeId, setActiveId] = React.useState();\n  const [virtualId, setVirtualId] = React.useState();\n  const focusItem = useEffectEvent(() => {\n    function runFocus(item) {\n      if (virtual) {\n        var _item$id;\n        if ((_item$id = item.id) != null && _item$id.endsWith('-fui-option')) {\n          item.id = floatingId + \"-\" + Math.random().toString(16).slice(2, 10);\n        }\n        setActiveId(item.id);\n        tree == null || tree.events.emit('virtualfocus', item);\n        if (virtualItemRef) {\n          virtualItemRef.current = item;\n        }\n      } else {\n        enqueueFocus(item, {\n          sync: forceSyncFocusRef.current,\n          preventScroll: true\n        });\n      }\n    }\n    const initialItem = listRef.current[indexRef.current];\n    const forceScrollIntoView = forceScrollIntoViewRef.current;\n    if (initialItem) {\n      runFocus(initialItem);\n    }\n    const scheduler = forceSyncFocusRef.current ? v => v() : requestAnimationFrame;\n    scheduler(() => {\n      const waitedItem = listRef.current[indexRef.current] || initialItem;\n      if (!waitedItem) return;\n      if (!initialItem) {\n        runFocus(waitedItem);\n      }\n      const scrollIntoViewOptions = scrollItemIntoViewRef.current;\n      const shouldScrollIntoView = scrollIntoViewOptions && item && (forceScrollIntoView || !isPointerModalityRef.current);\n      if (shouldScrollIntoView) {\n        // JSDOM doesn't support `.scrollIntoView()` but it's widely supported\n        // by all browsers.\n        waitedItem.scrollIntoView == null || waitedItem.scrollIntoView(typeof scrollIntoViewOptions === 'boolean' ? {\n          block: 'nearest',\n          inline: 'nearest'\n        } : scrollIntoViewOptions);\n      }\n    });\n  });\n\n  // Sync `selectedIndex` to be the `activeIndex` upon opening the floating\n  // element. Also, reset `activeIndex` upon closing the floating element.\n  useModernLayoutEffect(() => {\n    if (!enabled) return;\n    if (open && elements.floating) {\n      if (focusItemOnOpenRef.current && selectedIndex != null) {\n        // Regardless of the pointer modality, we want to ensure the selected\n        // item comes into view when the floating element is opened.\n        forceScrollIntoViewRef.current = true;\n        indexRef.current = selectedIndex;\n        onNavigate();\n      }\n    } else if (previousMountedRef.current) {\n      // Since the user can specify `onNavigate` conditionally\n      // (onNavigate: open ? setActiveIndex : setSelectedIndex),\n      // we store and call the previous function.\n      indexRef.current = -1;\n      previousOnNavigateRef.current();\n    }\n  }, [enabled, open, elements.floating, selectedIndex, onNavigate]);\n\n  // Sync `activeIndex` to be the focused item while the floating element is\n  // open.\n  useModernLayoutEffect(() => {\n    if (!enabled) return;\n    if (!open) return;\n    if (!elements.floating) return;\n    if (activeIndex == null) {\n      forceSyncFocusRef.current = false;\n      if (selectedIndexRef.current != null) {\n        return;\n      }\n\n      // Reset while the floating element was open (e.g. the list changed).\n      if (previousMountedRef.current) {\n        indexRef.current = -1;\n        focusItem();\n      }\n\n      // Initial sync.\n      if ((!previousOpenRef.current || !previousMountedRef.current) && focusItemOnOpenRef.current && (keyRef.current != null || focusItemOnOpenRef.current === true && keyRef.current == null)) {\n        let runs = 0;\n        const waitForListPopulated = () => {\n          if (listRef.current[0] == null) {\n            // Avoid letting the browser paint if possible on the first try,\n            // otherwise use rAF. Don't try more than twice, since something\n            // is wrong otherwise.\n            if (runs < 2) {\n              const scheduler = runs ? requestAnimationFrame : queueMicrotask;\n              scheduler(waitForListPopulated);\n            }\n            runs++;\n          } else {\n            indexRef.current = keyRef.current == null || isMainOrientationToEndKey(keyRef.current, orientation, rtl) || nested ? getMinListIndex(listRef, disabledIndicesRef.current) : getMaxListIndex(listRef, disabledIndicesRef.current);\n            keyRef.current = null;\n            onNavigate();\n          }\n        };\n        waitForListPopulated();\n      }\n    } else if (!isIndexOutOfListBounds(listRef, activeIndex)) {\n      indexRef.current = activeIndex;\n      focusItem();\n      forceScrollIntoViewRef.current = false;\n    }\n  }, [enabled, open, elements.floating, activeIndex, selectedIndexRef, nested, listRef, orientation, rtl, onNavigate, focusItem, disabledIndicesRef]);\n\n  // Ensure the parent floating element has focus when a nested child closes\n  // to allow arrow key navigation to work after the pointer leaves the child.\n  useModernLayoutEffect(() => {\n    var _nodes$find;\n    if (!enabled || elements.floating || !tree || virtual || !previousMountedRef.current) {\n      return;\n    }\n    const nodes = tree.nodesRef.current;\n    const parent = (_nodes$find = nodes.find(node => node.id === parentId)) == null || (_nodes$find = _nodes$find.context) == null ? void 0 : _nodes$find.elements.floating;\n    const activeEl = activeElement(getDocument$1(elements.floating));\n    const treeContainsActiveEl = nodes.some(node => node.context && contains$1(node.context.elements.floating, activeEl));\n    if (parent && !treeContainsActiveEl && isPointerModalityRef.current) {\n      parent.focus({\n        preventScroll: true\n      });\n    }\n  }, [enabled, elements.floating, tree, parentId, virtual]);\n  useModernLayoutEffect(() => {\n    if (!enabled) return;\n    if (!tree) return;\n    if (!virtual) return;\n    if (parentId) return;\n    function handleVirtualFocus(item) {\n      setVirtualId(item.id);\n      if (virtualItemRef) {\n        virtualItemRef.current = item;\n      }\n    }\n    tree.events.on('virtualfocus', handleVirtualFocus);\n    return () => {\n      tree.events.off('virtualfocus', handleVirtualFocus);\n    };\n  }, [enabled, tree, virtual, parentId, virtualItemRef]);\n  useModernLayoutEffect(() => {\n    previousOnNavigateRef.current = onNavigate;\n    previousOpenRef.current = open;\n    previousMountedRef.current = !!elements.floating;\n  });\n  useModernLayoutEffect(() => {\n    if (!open) {\n      keyRef.current = null;\n      focusItemOnOpenRef.current = focusItemOnOpen;\n    }\n  }, [open, focusItemOnOpen]);\n  const hasActiveIndex = activeIndex != null;\n  const item = React.useMemo(() => {\n    function syncCurrentTarget(currentTarget) {\n      if (!latestOpenRef.current) return;\n      const index = listRef.current.indexOf(currentTarget);\n      if (index !== -1 && indexRef.current !== index) {\n        indexRef.current = index;\n        onNavigate();\n      }\n    }\n    const props = {\n      onFocus(_ref) {\n        let {\n          currentTarget\n        } = _ref;\n        forceSyncFocusRef.current = true;\n        syncCurrentTarget(currentTarget);\n      },\n      onClick: _ref2 => {\n        let {\n          currentTarget\n        } = _ref2;\n        return currentTarget.focus({\n          preventScroll: true\n        });\n      },\n      // Safari\n      onMouseMove(_ref3) {\n        let {\n          currentTarget\n        } = _ref3;\n        forceSyncFocusRef.current = true;\n        forceScrollIntoViewRef.current = false;\n        if (focusItemOnHover) {\n          syncCurrentTarget(currentTarget);\n        }\n      },\n      onPointerLeave(_ref4) {\n        let {\n          pointerType\n        } = _ref4;\n        if (!isPointerModalityRef.current || pointerType === 'touch') {\n          return;\n        }\n        forceSyncFocusRef.current = true;\n        if (!focusItemOnHover) {\n          return;\n        }\n        indexRef.current = -1;\n        onNavigate();\n        if (!virtual) {\n          var _floatingFocusElement;\n          (_floatingFocusElement = floatingFocusElementRef.current) == null || _floatingFocusElement.focus({\n            preventScroll: true\n          });\n        }\n      }\n    };\n    return props;\n  }, [latestOpenRef, floatingFocusElementRef, focusItemOnHover, listRef, onNavigate, virtual]);\n  const getParentOrientation = React.useCallback(() => {\n    var _tree$nodesRef$curren;\n    return parentOrientation != null ? parentOrientation : tree == null || (_tree$nodesRef$curren = tree.nodesRef.current.find(node => node.id === parentId)) == null || (_tree$nodesRef$curren = _tree$nodesRef$curren.context) == null || (_tree$nodesRef$curren = _tree$nodesRef$curren.dataRef) == null ? void 0 : _tree$nodesRef$curren.current.orientation;\n  }, [parentId, tree, parentOrientation]);\n  const commonOnKeyDown = useEffectEvent(event => {\n    isPointerModalityRef.current = false;\n    forceSyncFocusRef.current = true;\n\n    // When composing a character, Chrome fires ArrowDown twice. Firefox/Safari\n    // don't appear to suffer from this. `event.isComposing` is avoided due to\n    // Safari not supporting it properly (although it's not needed in the first\n    // place for Safari, just avoiding any possible issues).\n    if (event.which === 229) {\n      return;\n    }\n\n    // If the floating element is animating out, ignore navigation. Otherwise,\n    // the `activeIndex` gets set to 0 despite not being open so the next time\n    // the user ArrowDowns, the first item won't be focused.\n    if (!latestOpenRef.current && event.currentTarget === floatingFocusElementRef.current) {\n      return;\n    }\n    if (nested && isCrossOrientationCloseKey(event.key, orientation, rtl, cols)) {\n      // If the nested list's close key is also the parent navigation key,\n      // let the parent navigate. Otherwise, stop propagating the event.\n      if (!isMainOrientationKey(event.key, getParentOrientation())) {\n        stopEvent(event);\n      }\n      onOpenChange(false, event.nativeEvent, 'list-navigation');\n      if (isHTMLElement(elements.domReference)) {\n        if (virtual) {\n          tree == null || tree.events.emit('virtualfocus', elements.domReference);\n        } else {\n          elements.domReference.focus();\n        }\n      }\n      return;\n    }\n    const currentIndex = indexRef.current;\n    const minIndex = getMinListIndex(listRef, disabledIndices);\n    const maxIndex = getMaxListIndex(listRef, disabledIndices);\n    if (!typeableComboboxReference) {\n      if (event.key === 'Home') {\n        stopEvent(event);\n        indexRef.current = minIndex;\n        onNavigate();\n      }\n      if (event.key === 'End') {\n        stopEvent(event);\n        indexRef.current = maxIndex;\n        onNavigate();\n      }\n    }\n\n    // Grid navigation.\n    if (cols > 1) {\n      const sizes = itemSizes || Array.from({\n        length: listRef.current.length\n      }, () => ({\n        width: 1,\n        height: 1\n      }));\n      // To calculate movements on the grid, we use hypothetical cell indices\n      // as if every item was 1x1, then convert back to real indices.\n      const cellMap = createGridCellMap(sizes, cols, dense);\n      const minGridIndex = cellMap.findIndex(index => index != null && !isListIndexDisabled(listRef, index, disabledIndices));\n      // last enabled index\n      const maxGridIndex = cellMap.reduce((foundIndex, index, cellIndex) => index != null && !isListIndexDisabled(listRef, index, disabledIndices) ? cellIndex : foundIndex, -1);\n      const index = cellMap[getGridNavigatedIndex({\n        current: cellMap.map(itemIndex => itemIndex != null ? listRef.current[itemIndex] : null)\n      }, {\n        event,\n        orientation,\n        loop,\n        rtl,\n        cols,\n        // treat undefined (empty grid spaces) as disabled indices so we\n        // don't end up in them\n        disabledIndices: getGridCellIndices([...((typeof disabledIndices !== 'function' ? disabledIndices : null) || listRef.current.map((_, index) => isListIndexDisabled(listRef, index, disabledIndices) ? index : undefined)), undefined], cellMap),\n        minIndex: minGridIndex,\n        maxIndex: maxGridIndex,\n        prevIndex: getGridCellIndexOfCorner(indexRef.current > maxIndex ? minIndex : indexRef.current, sizes, cellMap, cols,\n        // use a corner matching the edge closest to the direction\n        // we're moving in so we don't end up in the same item. Prefer\n        // top/left over bottom/right.\n        event.key === ARROW_DOWN ? 'bl' : event.key === (rtl ? ARROW_LEFT : ARROW_RIGHT) ? 'tr' : 'tl'),\n        stopEvent: true\n      })];\n      if (index != null) {\n        indexRef.current = index;\n        onNavigate();\n      }\n      if (orientation === 'both') {\n        return;\n      }\n    }\n    if (isMainOrientationKey(event.key, orientation)) {\n      stopEvent(event);\n\n      // Reset the index if no item is focused.\n      if (open && !virtual && activeElement(event.currentTarget.ownerDocument) === event.currentTarget) {\n        indexRef.current = isMainOrientationToEndKey(event.key, orientation, rtl) ? minIndex : maxIndex;\n        onNavigate();\n        return;\n      }\n      if (isMainOrientationToEndKey(event.key, orientation, rtl)) {\n        if (loop) {\n          indexRef.current = currentIndex >= maxIndex ? allowEscape && currentIndex !== listRef.current.length ? -1 : minIndex : findNonDisabledListIndex(listRef, {\n            startingIndex: currentIndex,\n            disabledIndices\n          });\n        } else {\n          indexRef.current = Math.min(maxIndex, findNonDisabledListIndex(listRef, {\n            startingIndex: currentIndex,\n            disabledIndices\n          }));\n        }\n      } else {\n        if (loop) {\n          indexRef.current = currentIndex <= minIndex ? allowEscape && currentIndex !== -1 ? listRef.current.length : maxIndex : findNonDisabledListIndex(listRef, {\n            startingIndex: currentIndex,\n            decrement: true,\n            disabledIndices\n          });\n        } else {\n          indexRef.current = Math.max(minIndex, findNonDisabledListIndex(listRef, {\n            startingIndex: currentIndex,\n            decrement: true,\n            disabledIndices\n          }));\n        }\n      }\n      if (isIndexOutOfListBounds(listRef, indexRef.current)) {\n        indexRef.current = -1;\n      }\n      onNavigate();\n    }\n  });\n  const ariaActiveDescendantProp = React.useMemo(() => {\n    return virtual && open && hasActiveIndex && {\n      'aria-activedescendant': virtualId || activeId\n    };\n  }, [virtual, open, hasActiveIndex, virtualId, activeId]);\n  const floating = React.useMemo(() => {\n    return {\n      'aria-orientation': orientation === 'both' ? undefined : orientation,\n      ...(!typeableComboboxReference ? ariaActiveDescendantProp : {}),\n      onKeyDown: commonOnKeyDown,\n      onPointerMove() {\n        isPointerModalityRef.current = true;\n      }\n    };\n  }, [ariaActiveDescendantProp, commonOnKeyDown, orientation, typeableComboboxReference]);\n  const reference = React.useMemo(() => {\n    function checkVirtualMouse(event) {\n      if (focusItemOnOpen === 'auto' && isVirtualClick(event.nativeEvent)) {\n        focusItemOnOpenRef.current = true;\n      }\n    }\n    function checkVirtualPointer(event) {\n      // `pointerdown` fires first, reset the state then perform the checks.\n      focusItemOnOpenRef.current = focusItemOnOpen;\n      if (focusItemOnOpen === 'auto' && isVirtualPointerEvent(event.nativeEvent)) {\n        focusItemOnOpenRef.current = true;\n      }\n    }\n    return {\n      ...ariaActiveDescendantProp,\n      onKeyDown(event) {\n        isPointerModalityRef.current = false;\n        const isArrowKey = event.key.startsWith('Arrow');\n        const isHomeOrEndKey = ['Home', 'End'].includes(event.key);\n        const isMoveKey = isArrowKey || isHomeOrEndKey;\n        const isCrossOpenKey = isCrossOrientationOpenKey(event.key, orientation, rtl);\n        const isCrossCloseKey = isCrossOrientationCloseKey(event.key, orientation, rtl, cols);\n        const isParentCrossOpenKey = isCrossOrientationOpenKey(event.key, getParentOrientation(), rtl);\n        const isMainKey = isMainOrientationKey(event.key, orientation);\n        const isNavigationKey = (nested ? isParentCrossOpenKey : isMainKey) || event.key === 'Enter' || event.key.trim() === '';\n        if (virtual && open) {\n          const rootNode = tree == null ? void 0 : tree.nodesRef.current.find(node => node.parentId == null);\n          const deepestNode = tree && rootNode ? getDeepestNode(tree.nodesRef.current, rootNode.id) : null;\n          if (isMoveKey && deepestNode && virtualItemRef) {\n            const eventObject = new KeyboardEvent('keydown', {\n              key: event.key,\n              bubbles: true\n            });\n            if (isCrossOpenKey || isCrossCloseKey) {\n              var _deepestNode$context, _deepestNode$context2;\n              const isCurrentTarget = ((_deepestNode$context = deepestNode.context) == null ? void 0 : _deepestNode$context.elements.domReference) === event.currentTarget;\n              const dispatchItem = isCrossCloseKey && !isCurrentTarget ? (_deepestNode$context2 = deepestNode.context) == null ? void 0 : _deepestNode$context2.elements.domReference : isCrossOpenKey ? listRef.current.find(item => (item == null ? void 0 : item.id) === activeId) : null;\n              if (dispatchItem) {\n                stopEvent(event);\n                dispatchItem.dispatchEvent(eventObject);\n                setVirtualId(undefined);\n              }\n            }\n            if ((isMainKey || isHomeOrEndKey) && deepestNode.context) {\n              if (deepestNode.context.open && deepestNode.parentId && event.currentTarget !== deepestNode.context.elements.domReference) {\n                var _deepestNode$context$;\n                stopEvent(event);\n                (_deepestNode$context$ = deepestNode.context.elements.domReference) == null || _deepestNode$context$.dispatchEvent(eventObject);\n                return;\n              }\n            }\n          }\n          return commonOnKeyDown(event);\n        }\n        // If a floating element should not open on arrow key down, avoid\n        // setting `activeIndex` while it's closed.\n        if (!open && !openOnArrowKeyDown && isArrowKey) {\n          return;\n        }\n        if (isNavigationKey) {\n          const isParentMainKey = isMainOrientationKey(event.key, getParentOrientation());\n          keyRef.current = nested && isParentMainKey ? null : event.key;\n        }\n        if (nested) {\n          if (isParentCrossOpenKey) {\n            stopEvent(event);\n            if (open) {\n              indexRef.current = getMinListIndex(listRef, disabledIndicesRef.current);\n              onNavigate();\n            } else {\n              onOpenChange(true, event.nativeEvent, 'list-navigation');\n            }\n          }\n          return;\n        }\n        if (isMainKey) {\n          if (selectedIndex != null) {\n            indexRef.current = selectedIndex;\n          }\n          stopEvent(event);\n          if (!open && openOnArrowKeyDown) {\n            onOpenChange(true, event.nativeEvent, 'list-navigation');\n          } else {\n            commonOnKeyDown(event);\n          }\n          if (open) {\n            onNavigate();\n          }\n        }\n      },\n      onFocus() {\n        if (open && !virtual) {\n          indexRef.current = -1;\n          onNavigate();\n        }\n      },\n      onPointerDown: checkVirtualPointer,\n      onPointerEnter: checkVirtualPointer,\n      onMouseDown: checkVirtualMouse,\n      onClick: checkVirtualMouse\n    };\n  }, [activeId, ariaActiveDescendantProp, cols, commonOnKeyDown, disabledIndicesRef, focusItemOnOpen, listRef, nested, onNavigate, onOpenChange, open, openOnArrowKeyDown, orientation, getParentOrientation, rtl, selectedIndex, tree, virtual, virtualItemRef]);\n  return React.useMemo(() => enabled ? {\n    reference,\n    floating,\n    item\n  } : {}, [enabled, reference, floating, item]);\n}\n\nconst componentRoleToAriaRoleMap = /*#__PURE__*/new Map([['select', 'listbox'], ['combobox', 'listbox'], ['label', false]]);\n\n/**\n * Adds base screen reader props to the reference and floating elements for a\n * given floating element `role`.\n * @see https://floating-ui.com/docs/useRole\n */\nfunction useRole(context, props) {\n  var _elements$domReferenc, _componentRoleToAriaR;\n  if (props === void 0) {\n    props = {};\n  }\n  const {\n    open,\n    elements,\n    floatingId: defaultFloatingId\n  } = context;\n  const {\n    enabled = true,\n    role = 'dialog'\n  } = props;\n  const defaultReferenceId = useId();\n  const referenceId = ((_elements$domReferenc = elements.domReference) == null ? void 0 : _elements$domReferenc.id) || defaultReferenceId;\n  const floatingId = React.useMemo(() => {\n    var _getFloatingFocusElem;\n    return ((_getFloatingFocusElem = getFloatingFocusElement(elements.floating)) == null ? void 0 : _getFloatingFocusElem.id) || defaultFloatingId;\n  }, [elements.floating, defaultFloatingId]);\n  const ariaRole = (_componentRoleToAriaR = componentRoleToAriaRoleMap.get(role)) != null ? _componentRoleToAriaR : role;\n  const parentId = useFloatingParentNodeId();\n  const isNested = parentId != null;\n  const reference = React.useMemo(() => {\n    if (ariaRole === 'tooltip' || role === 'label') {\n      return {\n        [\"aria-\" + (role === 'label' ? 'labelledby' : 'describedby')]: open ? floatingId : undefined\n      };\n    }\n    return {\n      'aria-expanded': open ? 'true' : 'false',\n      'aria-haspopup': ariaRole === 'alertdialog' ? 'dialog' : ariaRole,\n      'aria-controls': open ? floatingId : undefined,\n      ...(ariaRole === 'listbox' && {\n        role: 'combobox'\n      }),\n      ...(ariaRole === 'menu' && {\n        id: referenceId\n      }),\n      ...(ariaRole === 'menu' && isNested && {\n        role: 'menuitem'\n      }),\n      ...(role === 'select' && {\n        'aria-autocomplete': 'none'\n      }),\n      ...(role === 'combobox' && {\n        'aria-autocomplete': 'list'\n      })\n    };\n  }, [ariaRole, floatingId, isNested, open, referenceId, role]);\n  const floating = React.useMemo(() => {\n    const floatingProps = {\n      id: floatingId,\n      ...(ariaRole && {\n        role: ariaRole\n      })\n    };\n    if (ariaRole === 'tooltip' || role === 'label') {\n      return floatingProps;\n    }\n    return {\n      ...floatingProps,\n      ...(ariaRole === 'menu' && {\n        'aria-labelledby': referenceId\n      })\n    };\n  }, [ariaRole, floatingId, referenceId, role]);\n  const item = React.useCallback(_ref => {\n    let {\n      active,\n      selected\n    } = _ref;\n    const commonProps = {\n      role: 'option',\n      ...(active && {\n        id: floatingId + \"-fui-option\"\n      })\n    };\n\n    // For `menu`, we are unable to tell if the item is a `menuitemradio`\n    // or `menuitemcheckbox`. For backwards-compatibility reasons, also\n    // avoid defaulting to `menuitem` as it may overwrite custom role props.\n    switch (role) {\n      case 'select':\n      case 'combobox':\n        return {\n          ...commonProps,\n          'aria-selected': selected\n        };\n    }\n    return {};\n  }, [floatingId, role]);\n  return React.useMemo(() => enabled ? {\n    reference,\n    floating,\n    item\n  } : {}, [enabled, reference, floating, item]);\n}\n\n// Converts a JS style key like `backgroundColor` to a CSS transition-property\n// like `background-color`.\nconst camelCaseToKebabCase = str => str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs) => (ofs ? '-' : '') + $.toLowerCase());\nfunction execWithArgsOrReturn(valueOrFn, args) {\n  return typeof valueOrFn === 'function' ? valueOrFn(args) : valueOrFn;\n}\nfunction useDelayUnmount(open, durationMs) {\n  const [isMounted, setIsMounted] = React.useState(open);\n  if (open && !isMounted) {\n    setIsMounted(true);\n  }\n  React.useEffect(() => {\n    if (!open && isMounted) {\n      const timeout = setTimeout(() => setIsMounted(false), durationMs);\n      return () => clearTimeout(timeout);\n    }\n  }, [open, isMounted, durationMs]);\n  return isMounted;\n}\n/**\n * Provides a status string to apply CSS transitions to a floating element,\n * correctly handling placement-aware transitions.\n * @see https://floating-ui.com/docs/useTransition#usetransitionstatus\n */\nfunction useTransitionStatus(context, props) {\n  if (props === void 0) {\n    props = {};\n  }\n  const {\n    open,\n    elements: {\n      floating\n    }\n  } = context;\n  const {\n    duration = 250\n  } = props;\n  const isNumberDuration = typeof duration === 'number';\n  const closeDuration = (isNumberDuration ? duration : duration.close) || 0;\n  const [status, setStatus] = React.useState('unmounted');\n  const isMounted = useDelayUnmount(open, closeDuration);\n  if (!isMounted && status === 'close') {\n    setStatus('unmounted');\n  }\n  useModernLayoutEffect(() => {\n    if (!floating) return;\n    if (open) {\n      setStatus('initial');\n      const frame = requestAnimationFrame(() => {\n        // Ensure it opens before paint. With `FloatingDelayGroup`,\n        // this avoids a flicker when moving between floating elements\n        // to ensure one is always open with no missing frames.\n        ReactDOM.flushSync(() => {\n          setStatus('open');\n        });\n      });\n      return () => {\n        cancelAnimationFrame(frame);\n      };\n    }\n    setStatus('close');\n  }, [open, floating]);\n  return {\n    isMounted,\n    status\n  };\n}\n/**\n * Provides styles to apply CSS transitions to a floating element, correctly\n * handling placement-aware transitions. Wrapper around `useTransitionStatus`.\n * @see https://floating-ui.com/docs/useTransition#usetransitionstyles\n */\nfunction useTransitionStyles(context, props) {\n  if (props === void 0) {\n    props = {};\n  }\n  const {\n    initial: unstable_initial = {\n      opacity: 0\n    },\n    open: unstable_open,\n    close: unstable_close,\n    common: unstable_common,\n    duration = 250\n  } = props;\n  const placement = context.placement;\n  const side = placement.split('-')[0];\n  const fnArgs = React.useMemo(() => ({\n    side,\n    placement\n  }), [side, placement]);\n  const isNumberDuration = typeof duration === 'number';\n  const openDuration = (isNumberDuration ? duration : duration.open) || 0;\n  const closeDuration = (isNumberDuration ? duration : duration.close) || 0;\n  const [styles, setStyles] = React.useState(() => ({\n    ...execWithArgsOrReturn(unstable_common, fnArgs),\n    ...execWithArgsOrReturn(unstable_initial, fnArgs)\n  }));\n  const {\n    isMounted,\n    status\n  } = useTransitionStatus(context, {\n    duration\n  });\n  const initialRef = useLatestRef(unstable_initial);\n  const openRef = useLatestRef(unstable_open);\n  const closeRef = useLatestRef(unstable_close);\n  const commonRef = useLatestRef(unstable_common);\n  useModernLayoutEffect(() => {\n    const initialStyles = execWithArgsOrReturn(initialRef.current, fnArgs);\n    const closeStyles = execWithArgsOrReturn(closeRef.current, fnArgs);\n    const commonStyles = execWithArgsOrReturn(commonRef.current, fnArgs);\n    const openStyles = execWithArgsOrReturn(openRef.current, fnArgs) || Object.keys(initialStyles).reduce((acc, key) => {\n      acc[key] = '';\n      return acc;\n    }, {});\n    if (status === 'initial') {\n      setStyles(styles => ({\n        transitionProperty: styles.transitionProperty,\n        ...commonStyles,\n        ...initialStyles\n      }));\n    }\n    if (status === 'open') {\n      setStyles({\n        transitionProperty: Object.keys(openStyles).map(camelCaseToKebabCase).join(','),\n        transitionDuration: openDuration + \"ms\",\n        ...commonStyles,\n        ...openStyles\n      });\n    }\n    if (status === 'close') {\n      const styles = closeStyles || initialStyles;\n      setStyles({\n        transitionProperty: Object.keys(styles).map(camelCaseToKebabCase).join(','),\n        transitionDuration: closeDuration + \"ms\",\n        ...commonStyles,\n        ...styles\n      });\n    }\n  }, [closeDuration, closeRef, initialRef, openRef, commonRef, openDuration, status, fnArgs]);\n  return {\n    isMounted,\n    styles\n  };\n}\n\n/**\n * Provides a matching callback that can be used to focus an item as the user\n * types, often used in tandem with `useListNavigation()`.\n * @see https://floating-ui.com/docs/useTypeahead\n */\nfunction useTypeahead(context, props) {\n  var _ref;\n  const {\n    open,\n    dataRef\n  } = context;\n  const {\n    listRef,\n    activeIndex,\n    onMatch: unstable_onMatch,\n    onTypingChange: unstable_onTypingChange,\n    enabled = true,\n    findMatch = null,\n    resetMs = 750,\n    ignoreKeys = [],\n    selectedIndex = null\n  } = props;\n  const timeoutIdRef = React.useRef(-1);\n  const stringRef = React.useRef('');\n  const prevIndexRef = React.useRef((_ref = selectedIndex != null ? selectedIndex : activeIndex) != null ? _ref : -1);\n  const matchIndexRef = React.useRef(null);\n  const onMatch = useEffectEvent(unstable_onMatch);\n  const onTypingChange = useEffectEvent(unstable_onTypingChange);\n  const findMatchRef = useLatestRef(findMatch);\n  const ignoreKeysRef = useLatestRef(ignoreKeys);\n  useModernLayoutEffect(() => {\n    if (open) {\n      clearTimeoutIfSet(timeoutIdRef);\n      matchIndexRef.current = null;\n      stringRef.current = '';\n    }\n  }, [open]);\n  useModernLayoutEffect(() => {\n    // Sync arrow key navigation but not typeahead navigation.\n    if (open && stringRef.current === '') {\n      var _ref2;\n      prevIndexRef.current = (_ref2 = selectedIndex != null ? selectedIndex : activeIndex) != null ? _ref2 : -1;\n    }\n  }, [open, selectedIndex, activeIndex]);\n  const setTypingChange = useEffectEvent(value => {\n    if (value) {\n      if (!dataRef.current.typing) {\n        dataRef.current.typing = value;\n        onTypingChange(value);\n      }\n    } else {\n      if (dataRef.current.typing) {\n        dataRef.current.typing = value;\n        onTypingChange(value);\n      }\n    }\n  });\n  const onKeyDown = useEffectEvent(event => {\n    function getMatchingIndex(list, orderedList, string) {\n      const str = findMatchRef.current ? findMatchRef.current(orderedList, string) : orderedList.find(text => (text == null ? void 0 : text.toLocaleLowerCase().indexOf(string.toLocaleLowerCase())) === 0);\n      return str ? list.indexOf(str) : -1;\n    }\n    const listContent = listRef.current;\n    if (stringRef.current.length > 0 && stringRef.current[0] !== ' ') {\n      if (getMatchingIndex(listContent, listContent, stringRef.current) === -1) {\n        setTypingChange(false);\n      } else if (event.key === ' ') {\n        stopEvent(event);\n      }\n    }\n    if (listContent == null || ignoreKeysRef.current.includes(event.key) ||\n    // Character key.\n    event.key.length !== 1 ||\n    // Modifier key.\n    event.ctrlKey || event.metaKey || event.altKey) {\n      return;\n    }\n    if (open && event.key !== ' ') {\n      stopEvent(event);\n      setTypingChange(true);\n    }\n\n    // Bail out if the list contains a word like \"llama\" or \"aaron\". TODO:\n    // allow it in this case, too.\n    const allowRapidSuccessionOfFirstLetter = listContent.every(text => {\n      var _text$, _text$2;\n      return text ? ((_text$ = text[0]) == null ? void 0 : _text$.toLocaleLowerCase()) !== ((_text$2 = text[1]) == null ? void 0 : _text$2.toLocaleLowerCase()) : true;\n    });\n\n    // Allows the user to cycle through items that start with the same letter\n    // in rapid succession.\n    if (allowRapidSuccessionOfFirstLetter && stringRef.current === event.key) {\n      stringRef.current = '';\n      prevIndexRef.current = matchIndexRef.current;\n    }\n    stringRef.current += event.key;\n    clearTimeoutIfSet(timeoutIdRef);\n    timeoutIdRef.current = window.setTimeout(() => {\n      stringRef.current = '';\n      prevIndexRef.current = matchIndexRef.current;\n      setTypingChange(false);\n    }, resetMs);\n    const prevIndex = prevIndexRef.current;\n    const index = getMatchingIndex(listContent, [...listContent.slice((prevIndex || 0) + 1), ...listContent.slice(0, (prevIndex || 0) + 1)], stringRef.current);\n    if (index !== -1) {\n      onMatch(index);\n      matchIndexRef.current = index;\n    } else if (event.key !== ' ') {\n      stringRef.current = '';\n      setTypingChange(false);\n    }\n  });\n  const reference = React.useMemo(() => ({\n    onKeyDown\n  }), [onKeyDown]);\n  const floating = React.useMemo(() => {\n    return {\n      onKeyDown,\n      onKeyUp(event) {\n        if (event.key === ' ') {\n          setTypingChange(false);\n        }\n      }\n    };\n  }, [onKeyDown, setTypingChange]);\n  return React.useMemo(() => enabled ? {\n    reference,\n    floating\n  } : {}, [enabled, reference, floating]);\n}\n\nfunction getArgsWithCustomFloatingHeight(state, height) {\n  return {\n    ...state,\n    rects: {\n      ...state.rects,\n      floating: {\n        ...state.rects.floating,\n        height\n      }\n    }\n  };\n}\n/**\n * Positions the floating element such that an inner element inside of it is\n * anchored to the reference element.\n * @see https://floating-ui.com/docs/inner\n * @deprecated\n */\nconst inner = props => ({\n  name: 'inner',\n  options: props,\n  async fn(state) {\n    const {\n      listRef,\n      overflowRef,\n      onFallbackChange,\n      offset: innerOffset = 0,\n      index = 0,\n      minItemsVisible = 4,\n      referenceOverflowThreshold = 0,\n      scrollRef,\n      ...detectOverflowOptions\n    } = evaluate(props, state);\n    const {\n      rects,\n      elements: {\n        floating\n      }\n    } = state;\n    const item = listRef.current[index];\n    const scrollEl = (scrollRef == null ? void 0 : scrollRef.current) || floating;\n\n    // Valid combinations:\n    // 1. Floating element is the scrollRef and has a border (default)\n    // 2. Floating element is not the scrollRef, floating element has a border\n    // 3. Floating element is not the scrollRef, scrollRef has a border\n    // Floating > {...getFloatingProps()} wrapper > scrollRef > items is not\n    // allowed as VoiceOver doesn't work.\n    const clientTop = floating.clientTop || scrollEl.clientTop;\n    const floatingIsBordered = floating.clientTop !== 0;\n    const scrollElIsBordered = scrollEl.clientTop !== 0;\n    const floatingIsScrollEl = floating === scrollEl;\n    if (process.env.NODE_ENV !== \"production\") {\n      if (!state.placement.startsWith('bottom')) {\n        warn('`placement` side must be \"bottom\" when using the `inner`', 'middleware.');\n      }\n    }\n    if (!item) {\n      return {};\n    }\n    const nextArgs = {\n      ...state,\n      ...(await offset(-item.offsetTop - floating.clientTop - rects.reference.height / 2 - item.offsetHeight / 2 - innerOffset).fn(state))\n    };\n    const overflow = await detectOverflow(getArgsWithCustomFloatingHeight(nextArgs, scrollEl.scrollHeight + clientTop + floating.clientTop), detectOverflowOptions);\n    const refOverflow = await detectOverflow(nextArgs, {\n      ...detectOverflowOptions,\n      elementContext: 'reference'\n    });\n    const diffY = max(0, overflow.top);\n    const nextY = nextArgs.y + diffY;\n    const isScrollable = scrollEl.scrollHeight > scrollEl.clientHeight;\n    const rounder = isScrollable ? v => v : round;\n    const maxHeight = rounder(max(0, scrollEl.scrollHeight + (floatingIsBordered && floatingIsScrollEl || scrollElIsBordered ? clientTop * 2 : 0) - diffY - max(0, overflow.bottom)));\n    scrollEl.style.maxHeight = maxHeight + \"px\";\n    scrollEl.scrollTop = diffY;\n\n    // There is not enough space, fallback to standard anchored positioning\n    if (onFallbackChange) {\n      const shouldFallback = scrollEl.offsetHeight < item.offsetHeight * min(minItemsVisible, listRef.current.length) - 1 || refOverflow.top >= -referenceOverflowThreshold || refOverflow.bottom >= -referenceOverflowThreshold;\n      ReactDOM.flushSync(() => onFallbackChange(shouldFallback));\n    }\n    if (overflowRef) {\n      overflowRef.current = await detectOverflow(getArgsWithCustomFloatingHeight({\n        ...nextArgs,\n        y: nextY\n      }, scrollEl.offsetHeight + clientTop + floating.clientTop), detectOverflowOptions);\n    }\n    return {\n      y: nextY\n    };\n  }\n});\n/**\n * Changes the `inner` middleware's `offset` upon a `wheel` event to\n * expand the floating element's height, revealing more list items.\n * @see https://floating-ui.com/docs/inner\n * @deprecated\n */\nfunction useInnerOffset(context, props) {\n  const {\n    open,\n    elements\n  } = context;\n  const {\n    enabled = true,\n    overflowRef,\n    scrollRef,\n    onChange: unstable_onChange\n  } = props;\n  const onChange = useEffectEvent(unstable_onChange);\n  const controlledScrollingRef = React.useRef(false);\n  const prevScrollTopRef = React.useRef(null);\n  const initialOverflowRef = React.useRef(null);\n  React.useEffect(() => {\n    if (!enabled) return;\n    function onWheel(e) {\n      if (e.ctrlKey || !el || overflowRef.current == null) {\n        return;\n      }\n      const dY = e.deltaY;\n      const isAtTop = overflowRef.current.top >= -0.5;\n      const isAtBottom = overflowRef.current.bottom >= -0.5;\n      const remainingScroll = el.scrollHeight - el.clientHeight;\n      const sign = dY < 0 ? -1 : 1;\n      const method = dY < 0 ? 'max' : 'min';\n      if (el.scrollHeight <= el.clientHeight) {\n        return;\n      }\n      if (!isAtTop && dY > 0 || !isAtBottom && dY < 0) {\n        e.preventDefault();\n        ReactDOM.flushSync(() => {\n          onChange(d => d + Math[method](dY, remainingScroll * sign));\n        });\n      } else if (/firefox/i.test(getUserAgent())) {\n        // Needed to propagate scrolling during momentum scrolling phase once\n        // it gets limited by the boundary. UX improvement, not critical.\n        el.scrollTop += dY;\n      }\n    }\n    const el = (scrollRef == null ? void 0 : scrollRef.current) || elements.floating;\n    if (open && el) {\n      el.addEventListener('wheel', onWheel);\n\n      // Wait for the position to be ready.\n      requestAnimationFrame(() => {\n        prevScrollTopRef.current = el.scrollTop;\n        if (overflowRef.current != null) {\n          initialOverflowRef.current = {\n            ...overflowRef.current\n          };\n        }\n      });\n      return () => {\n        prevScrollTopRef.current = null;\n        initialOverflowRef.current = null;\n        el.removeEventListener('wheel', onWheel);\n      };\n    }\n  }, [enabled, open, elements.floating, overflowRef, scrollRef, onChange]);\n  const floating = React.useMemo(() => ({\n    onKeyDown() {\n      controlledScrollingRef.current = true;\n    },\n    onWheel() {\n      controlledScrollingRef.current = false;\n    },\n    onPointerMove() {\n      controlledScrollingRef.current = false;\n    },\n    onScroll() {\n      const el = (scrollRef == null ? void 0 : scrollRef.current) || elements.floating;\n      if (!overflowRef.current || !el || !controlledScrollingRef.current) {\n        return;\n      }\n      if (prevScrollTopRef.current !== null) {\n        const scrollDiff = el.scrollTop - prevScrollTopRef.current;\n        if (overflowRef.current.bottom < -0.5 && scrollDiff < -1 || overflowRef.current.top < -0.5 && scrollDiff > 1) {\n          ReactDOM.flushSync(() => onChange(d => d + scrollDiff));\n        }\n      }\n\n      // [Firefox] Wait for the height change to have been applied.\n      requestAnimationFrame(() => {\n        prevScrollTopRef.current = el.scrollTop;\n      });\n    }\n  }), [elements.floating, onChange, overflowRef, scrollRef]);\n  return React.useMemo(() => enabled ? {\n    floating\n  } : {}, [enabled, floating]);\n}\n\nfunction getNodeChildren(nodes, id, onlyOpenChildren) {\n  if (onlyOpenChildren === void 0) {\n    onlyOpenChildren = true;\n  }\n  const directChildren = nodes.filter(node => {\n    var _node$context;\n    return node.parentId === id && (!onlyOpenChildren || ((_node$context = node.context) == null ? void 0 : _node$context.open));\n  });\n  return directChildren.flatMap(child => [child, ...getNodeChildren(nodes, child.id, onlyOpenChildren)]);\n}\n\nfunction isPointInPolygon(point, polygon) {\n  const [x, y] = point;\n  let isInside = false;\n  const length = polygon.length;\n  for (let i = 0, j = length - 1; i < length; j = i++) {\n    const [xi, yi] = polygon[i] || [0, 0];\n    const [xj, yj] = polygon[j] || [0, 0];\n    const intersect = yi >= y !== yj >= y && x <= (xj - xi) * (y - yi) / (yj - yi) + xi;\n    if (intersect) {\n      isInside = !isInside;\n    }\n  }\n  return isInside;\n}\nfunction isInside(point, rect) {\n  return point[0] >= rect.x && point[0] <= rect.x + rect.width && point[1] >= rect.y && point[1] <= rect.y + rect.height;\n}\n/**\n * Generates a safe polygon area that the user can traverse without closing the\n * floating element once leaving the reference element.\n * @see https://floating-ui.com/docs/useHover#safepolygon\n */\nfunction safePolygon(options) {\n  if (options === void 0) {\n    options = {};\n  }\n  const {\n    buffer = 0.5,\n    blockPointerEvents = false,\n    requireIntent = true\n  } = options;\n  const timeoutRef = {\n    current: -1\n  };\n  let hasLanded = false;\n  let lastX = null;\n  let lastY = null;\n  let lastCursorTime = typeof performance !== 'undefined' ? performance.now() : 0;\n  function getCursorSpeed(x, y) {\n    const currentTime = performance.now();\n    const elapsedTime = currentTime - lastCursorTime;\n    if (lastX === null || lastY === null || elapsedTime === 0) {\n      lastX = x;\n      lastY = y;\n      lastCursorTime = currentTime;\n      return null;\n    }\n    const deltaX = x - lastX;\n    const deltaY = y - lastY;\n    const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);\n    const speed = distance / elapsedTime; // px / ms\n\n    lastX = x;\n    lastY = y;\n    lastCursorTime = currentTime;\n    return speed;\n  }\n  const fn = _ref => {\n    let {\n      x,\n      y,\n      placement,\n      elements,\n      onClose,\n      nodeId,\n      tree\n    } = _ref;\n    return function onMouseMove(event) {\n      function close() {\n        clearTimeoutIfSet(timeoutRef);\n        onClose();\n      }\n      clearTimeoutIfSet(timeoutRef);\n      if (!elements.domReference || !elements.floating || placement == null || x == null || y == null) {\n        return;\n      }\n      const {\n        clientX,\n        clientY\n      } = event;\n      const clientPoint = [clientX, clientY];\n      const target = getTarget(event);\n      const isLeave = event.type === 'mouseleave';\n      const isOverFloatingEl = contains(elements.floating, target);\n      const isOverReferenceEl = contains(elements.domReference, target);\n      const refRect = elements.domReference.getBoundingClientRect();\n      const rect = elements.floating.getBoundingClientRect();\n      const side = placement.split('-')[0];\n      const cursorLeaveFromRight = x > rect.right - rect.width / 2;\n      const cursorLeaveFromBottom = y > rect.bottom - rect.height / 2;\n      const isOverReferenceRect = isInside(clientPoint, refRect);\n      const isFloatingWider = rect.width > refRect.width;\n      const isFloatingTaller = rect.height > refRect.height;\n      const left = (isFloatingWider ? refRect : rect).left;\n      const right = (isFloatingWider ? refRect : rect).right;\n      const top = (isFloatingTaller ? refRect : rect).top;\n      const bottom = (isFloatingTaller ? refRect : rect).bottom;\n      if (isOverFloatingEl) {\n        hasLanded = true;\n        if (!isLeave) {\n          return;\n        }\n      }\n      if (isOverReferenceEl) {\n        hasLanded = false;\n      }\n      if (isOverReferenceEl && !isLeave) {\n        hasLanded = true;\n        return;\n      }\n\n      // Prevent overlapping floating element from being stuck in an open-close\n      // loop: https://github.com/floating-ui/floating-ui/issues/1910\n      if (isLeave && isElement(event.relatedTarget) && contains(elements.floating, event.relatedTarget)) {\n        return;\n      }\n\n      // If any nested child is open, abort.\n      if (tree && getNodeChildren(tree.nodesRef.current, nodeId).length) {\n        return;\n      }\n\n      // If the pointer is leaving from the opposite side, the \"buffer\" logic\n      // creates a point where the floating element remains open, but should be\n      // ignored.\n      // A constant of 1 handles floating point rounding errors.\n      if (side === 'top' && y >= refRect.bottom - 1 || side === 'bottom' && y <= refRect.top + 1 || side === 'left' && x >= refRect.right - 1 || side === 'right' && x <= refRect.left + 1) {\n        return close();\n      }\n\n      // Ignore when the cursor is within the rectangular trough between the\n      // two elements. Since the triangle is created from the cursor point,\n      // which can start beyond the ref element's edge, traversing back and\n      // forth from the ref to the floating element can cause it to close. This\n      // ensures it always remains open in that case.\n      let rectPoly = [];\n      switch (side) {\n        case 'top':\n          rectPoly = [[left, refRect.top + 1], [left, rect.bottom - 1], [right, rect.bottom - 1], [right, refRect.top + 1]];\n          break;\n        case 'bottom':\n          rectPoly = [[left, rect.top + 1], [left, refRect.bottom - 1], [right, refRect.bottom - 1], [right, rect.top + 1]];\n          break;\n        case 'left':\n          rectPoly = [[rect.right - 1, bottom], [rect.right - 1, top], [refRect.left + 1, top], [refRect.left + 1, bottom]];\n          break;\n        case 'right':\n          rectPoly = [[refRect.right - 1, bottom], [refRect.right - 1, top], [rect.left + 1, top], [rect.left + 1, bottom]];\n          break;\n      }\n      function getPolygon(_ref2) {\n        let [x, y] = _ref2;\n        switch (side) {\n          case 'top':\n            {\n              const cursorPointOne = [isFloatingWider ? x + buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, y + buffer + 1];\n              const cursorPointTwo = [isFloatingWider ? x - buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, y + buffer + 1];\n              const commonPoints = [[rect.left, cursorLeaveFromRight ? rect.bottom - buffer : isFloatingWider ? rect.bottom - buffer : rect.top], [rect.right, cursorLeaveFromRight ? isFloatingWider ? rect.bottom - buffer : rect.top : rect.bottom - buffer]];\n              return [cursorPointOne, cursorPointTwo, ...commonPoints];\n            }\n          case 'bottom':\n            {\n              const cursorPointOne = [isFloatingWider ? x + buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, y - buffer];\n              const cursorPointTwo = [isFloatingWider ? x - buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, y - buffer];\n              const commonPoints = [[rect.left, cursorLeaveFromRight ? rect.top + buffer : isFloatingWider ? rect.top + buffer : rect.bottom], [rect.right, cursorLeaveFromRight ? isFloatingWider ? rect.top + buffer : rect.bottom : rect.top + buffer]];\n              return [cursorPointOne, cursorPointTwo, ...commonPoints];\n            }\n          case 'left':\n            {\n              const cursorPointOne = [x + buffer + 1, isFloatingTaller ? y + buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4];\n              const cursorPointTwo = [x + buffer + 1, isFloatingTaller ? y - buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4];\n              const commonPoints = [[cursorLeaveFromBottom ? rect.right - buffer : isFloatingTaller ? rect.right - buffer : rect.left, rect.top], [cursorLeaveFromBottom ? isFloatingTaller ? rect.right - buffer : rect.left : rect.right - buffer, rect.bottom]];\n              return [...commonPoints, cursorPointOne, cursorPointTwo];\n            }\n          case 'right':\n            {\n              const cursorPointOne = [x - buffer, isFloatingTaller ? y + buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4];\n              const cursorPointTwo = [x - buffer, isFloatingTaller ? y - buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4];\n              const commonPoints = [[cursorLeaveFromBottom ? rect.left + buffer : isFloatingTaller ? rect.left + buffer : rect.right, rect.top], [cursorLeaveFromBottom ? isFloatingTaller ? rect.left + buffer : rect.right : rect.left + buffer, rect.bottom]];\n              return [cursorPointOne, cursorPointTwo, ...commonPoints];\n            }\n        }\n      }\n      if (isPointInPolygon([clientX, clientY], rectPoly)) {\n        return;\n      }\n      if (hasLanded && !isOverReferenceRect) {\n        return close();\n      }\n      if (!isLeave && requireIntent) {\n        const cursorSpeed = getCursorSpeed(event.clientX, event.clientY);\n        const cursorSpeedThreshold = 0.1;\n        if (cursorSpeed !== null && cursorSpeed < cursorSpeedThreshold) {\n          return close();\n        }\n      }\n      if (!isPointInPolygon([clientX, clientY], getPolygon([x, y]))) {\n        close();\n      } else if (!hasLanded && requireIntent) {\n        timeoutRef.current = window.setTimeout(close, 40);\n      }\n    };\n  };\n  fn.__options = {\n    blockPointerEvents\n  };\n  return fn;\n}\n\nexport { Composite, CompositeItem, FloatingArrow, FloatingDelayGroup, FloatingFocusManager, FloatingList, FloatingNode, FloatingOverlay, FloatingPortal, FloatingTree, NextFloatingDelayGroup, inner, safePolygon, useClick, useClientPoint, useDelayGroup, useDelayGroupContext, useDismiss, useFloating, useFloatingNodeId, useFloatingParentNodeId, useFloatingPortalNode, useFloatingRootContext, useFloatingTree, useFocus, useHover, useId, useInnerOffset, useInteractions, useListItem, useListNavigation, useMergeRefs, useNextDelayGroup, useRole, useTransitionStatus, useTransitionStyles, useTypeahead };\n","import { PRIMARY_ACTION_ATTRIBUTE } from '../constants';\nimport type { TooltipAutoFocus } from '../types';\n\n/**\n * Focus target resolution for dialog tooltips\n */\n\n/**\n * Determines which element a dialog tooltip should focus.\n *\n * Resolution rules:\n * - `false` → never focus anything\n * - `'primary'` → the first element marked `data-tip-magic-primary`, unless it already\n *   has focus. Content that marks nothing falls through to the `'panel'` rules.\n * - `'panel'` → the tooltip element, unless focus is already somewhere inside it, so a\n *   control the user tabbed to is not stolen back.\n *\n * @param panel - The tooltip element\n * @param mode - The resolved `autoFocus` setting\n * @param activeElement - What currently holds focus\n * @returns The element to focus, or null to leave focus where it is\n *\n * @example\n * ```ts\n * resolveAutoFocusTarget(panel, 'primary', panel); // the Next button\n * resolveAutoFocusTarget(panel, 'panel', backButton); // null - already inside\n * ```\n */\nexport function resolveAutoFocusTarget(\n  panel: HTMLElement,\n  mode: TooltipAutoFocus,\n  activeElement: Element | null\n): HTMLElement | null {\n  if (mode === false) {\n    return null;\n  }\n\n  if (mode === 'primary') {\n    const primary = panel.querySelector<HTMLElement>(`[${PRIMARY_ACTION_ATTRIBUTE}]`);\n    if (primary) {\n      return primary === activeElement ? null : primary;\n    }\n  }\n\n  return panel.contains(activeElement) ? null : panel;\n}\n","/**\n * Group compatibility utilities for tooltip transitions\n *\n * These functions determine how tooltips transition between elements\n * based on their group assignments.\n */\n\n/**\n * Determines if two tooltip groups are compatible for move transitions.\n *\n * Group compatibility rules:\n * - Same group → allow smooth move transition\n * - Different groups (both have groups but different) → force jump transition\n * - One has group, one doesn't → allow smooth move transition\n * - Both have no group → allow smooth move transition\n *\n * @param currentGroup - The group of the current tooltip target\n * @param previousGroup - The group of the previous tooltip target\n * @returns true if groups are compatible for move transitions\n *\n * @example\n * ```ts\n * areGroupsCompatible('nav', 'nav'); // true - same group\n * areGroupsCompatible('nav', 'sidebar'); // false - different groups\n * areGroupsCompatible('nav', undefined); // true - one has group\n * areGroupsCompatible(undefined, undefined); // true - both no group\n * ```\n */\nexport function areGroupsCompatible(\n  currentGroup: string | undefined,\n  previousGroup: string | undefined\n): boolean {\n  // Both have no group\n  if (currentGroup === undefined && previousGroup === undefined) {\n    return true;\n  }\n\n  // Same group\n  if (currentGroup === previousGroup) {\n    return true;\n  }\n\n  // One has group, one doesn't (treat as compatible)\n  if (\n    (currentGroup === undefined && previousGroup !== undefined) ||\n    (currentGroup !== undefined && previousGroup === undefined)\n  ) {\n    return true;\n  }\n\n  // Different groups - not compatible\n  return false;\n}\n\n/**\n * Determines if a tooltip should animate its position during a transition.\n *\n * @param hasBeenPositioned - Whether the tooltip has been positioned at least once\n * @param isTransitioning - Whether the tooltip is currently transitioning between targets\n * @param transitionBehavior - The configured transition behavior ('move' or 'jump')\n * @param areGroupsCompatible - Whether the current and previous groups are compatible\n * @returns true if the tooltip should animate its position\n */\nexport function shouldAnimatePosition(\n  hasBeenPositioned: boolean,\n  isTransitioning: boolean,\n  transitionBehavior: 'move' | 'jump',\n  groupsCompatible: boolean\n): boolean {\n  return hasBeenPositioned && isTransitioning && transitionBehavior === 'move' && groupsCompatible;\n}\n","import { CSS_CLASSES } from '../constants';\nimport type { TextBreak } from '../types';\n\n/**\n * Tooltip styling utilities\n *\n * Pure functions for computing tooltip styles and class names.\n */\n\n/**\n * Options for building tooltip class names\n */\nexport interface TooltipClassNameOptions {\n  /** Whether the tooltip should be visible */\n  shouldShow: boolean;\n  /** Whether the tooltip is transitioning between targets */\n  isTransitioning: boolean;\n  /** Whether the tooltip should animate its position */\n  shouldAnimatePosition: boolean;\n  /** Whether the tooltip is interactive (hoverable) */\n  isInteractive: boolean;\n  /** Whether word wrapping is enabled */\n  wordWrap: boolean;\n  /** Whether ellipsis truncation is enabled */\n  ellipsis: boolean;\n  /** Text break behavior */\n  textBreak: TextBreak;\n}\n\n/**\n * Builds the CSS class name string for a tooltip.\n *\n * @param options - The options for building class names\n * @returns The combined class name string\n *\n * @example\n * ```ts\n * buildTooltipClassNames({\n *   shouldShow: true,\n *   isTransitioning: false,\n *   shouldAnimatePosition: false,\n *   isInteractive: true,\n *   wordWrap: true,\n *   ellipsis: false,\n *   textBreak: 'normal',\n * });\n * // Returns: \"tip-magic-tooltip tip-magic-visible tip-magic-interactive tip-magic-word-wrap\"\n * ```\n */\nexport function buildTooltipClassNames(options: TooltipClassNameOptions): string {\n  const {\n    shouldShow,\n    isTransitioning,\n    shouldAnimatePosition,\n    isInteractive,\n    wordWrap,\n    ellipsis,\n    textBreak,\n  } = options;\n\n  const classes = [\n    CSS_CLASSES.TOOLTIP,\n    shouldShow ? CSS_CLASSES.TOOLTIP_VISIBLE : CSS_CLASSES.TOOLTIP_HIDDEN,\n    isTransitioning ? CSS_CLASSES.TOOLTIP_TRANSITIONING : '',\n    shouldAnimatePosition ? 'tip-magic-moving' : '',\n    isInteractive ? 'tip-magic-interactive' : '',\n    wordWrap ? 'tip-magic-word-wrap' : '',\n    ellipsis ? 'tip-magic-ellipsis' : '',\n    textBreak !== 'normal' ? `tip-magic-text-break-${textBreak}` : '',\n  ];\n\n  return classes.filter(Boolean).join(' ');\n}\n\n/**\n * Arrow position sides mapped to their opposite static side.\n * Used for positioning the arrow on the correct edge of the tooltip.\n */\nconst STATIC_SIDE_MAP: Record<string, string> = {\n  top: 'bottom',\n  right: 'left',\n  bottom: 'top',\n  left: 'right',\n};\n\n/**\n * Gets the static side for arrow positioning based on tooltip placement.\n *\n * @param placement - The current tooltip placement (e.g., 'top', 'bottom-start')\n * @returns The static side for CSS positioning ('top', 'right', 'bottom', or 'left')\n *\n * @example\n * ```ts\n * getArrowStaticSide('top'); // Returns: 'bottom'\n * getArrowStaticSide('bottom-start'); // Returns: 'top'\n * getArrowStaticSide('left-end'); // Returns: 'right'\n * ```\n */\nexport function getArrowStaticSide(placement: string): string {\n  const basePlacement = placement.split('-')[0];\n  return STATIC_SIDE_MAP[basePlacement] ?? 'bottom';\n}\n\n/**\n * Computes the arrow style object for positioning.\n *\n * @param arrowX - The X coordinate from floating-ui middleware\n * @param arrowY - The Y coordinate from floating-ui middleware\n * @param staticSide - The static side for positioning\n * @returns A CSS style object for the arrow element\n */\nexport function getArrowStyles(\n  arrowX: number | undefined,\n  arrowY: number | undefined,\n  staticSide: string\n): React.CSSProperties {\n  return {\n    left: arrowX != null ? `${arrowX}px` : '',\n    top: arrowY != null ? `${arrowY}px` : '',\n    [staticSide]: '-4px',\n  };\n}\n","import {\n  arrow,\n  autoUpdate,\n  flip,\n  offset,\n  shift,\n  useFloating,\n  type Placement,\n} from '@floating-ui/react';\nimport { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { ANIMATION, CSS_CLASSES } from '../../constants';\nimport { useTipMagicContext } from '../../context/TipMagicContext';\nimport type { TooltipTransitionBehavior } from '../../types';\nimport { resolveAutoFocusTarget } from '../../utils/autoFocusTarget';\nimport { areGroupsCompatible, shouldAnimatePosition } from '../../utils/groupCompatibility';\nimport {\n  buildTooltipClassNames,\n  getArrowStaticSide,\n  getArrowStyles,\n} from '../../utils/tooltipStyles';\n\n/**\n * Content rendered from an HTML string.\n *\n * Memoised on `html` so the subtree survives re-renders - see CLAUDE.md,\n * \"dangerouslySetInnerHTML is re-applied on every render\".\n */\nconst HtmlContent = memo(function HtmlContent({ html }: { html: string }) {\n  return <span className={CSS_CLASSES.TOOLTIP_TEXT} dangerouslySetInnerHTML={{ __html: html }} />;\n});\n\n/**\n * Main Tooltip component - renders a single tooltip instance\n * that moves between targets for smooth transitions\n */\nexport function Tooltip() {\n  const { state, dispatch } = useTipMagicContext();\n  const { tooltip, config } = state;\n  const arrowRef = useRef<HTMLDivElement>(null);\n  const previouslyFocusedRef = useRef<HTMLElement | null>(null);\n  const [shouldShow, setShouldShow] = useState(false);\n  const [hasBeenPositioned, setHasBeenPositioned] = useState(false);\n\n  // Get the placement from parsed data or default\n  const placement: Placement = tooltip.parsedData?.placement ?? config.placement;\n\n  // Determine transition behavior: per-tooltip override or provider default\n  const transitionBehavior: TooltipTransitionBehavior =\n    tooltip.parsedData?.transitionBehavior ?? config.transitionBehavior;\n\n  // Memoize middleware array to prevent unnecessary recalculations\n  const middleware = useMemo(\n    () => [\n      offset(config.offset),\n      flip({\n        fallbackAxisSideDirection: 'start',\n        padding: 8,\n      }),\n      shift({ padding: 8 }),\n      arrow({ element: arrowRef }),\n    ],\n    [config.offset]\n  );\n\n  // Floating UI setup\n  const { refs, floatingStyles, context, middlewareData, isPositioned } = useFloating({\n    placement,\n    open: tooltip.visible,\n    middleware,\n    whileElementsMounted: autoUpdate,\n  });\n\n  // Update reference element when target changes\n  useEffect(() => {\n    if (tooltip.target) {\n      refs.setReference(tooltip.target);\n    }\n  }, [tooltip.target, refs]);\n\n  // Track if we've been positioned at least once (for move transitions)\n  useEffect(() => {\n    if (isPositioned && tooltip.visible) {\n      setHasBeenPositioned(true);\n    } else if (!tooltip.visible) {\n      setHasBeenPositioned(false);\n    }\n  }, [isPositioned, tooltip.visible]);\n\n  // Check group compatibility for move transitions\n  const groupsCompatible = areGroupsCompatible(tooltip.parsedData?.group, tooltip.previousGroup);\n\n  // Determine if we should animate position (move behavior)\n  const animatePosition = shouldAnimatePosition(\n    hasBeenPositioned,\n    tooltip.isTransitioning,\n    transitionBehavior,\n    groupsCompatible\n  );\n\n  // Control visibility: show only after positioned, hide immediately when not visible\n  useEffect(() => {\n    if (tooltip.visible && isPositioned) {\n      // Small delay to ensure position is applied before fading in\n      const timer = setTimeout(() => setShouldShow(true), 16);\n      return () => clearTimeout(timer);\n    } else {\n      // Hide immediately\n      setShouldShow(false);\n    }\n  }, [tooltip.visible, isPositioned]);\n\n  // A tooltip presented as a dialog holds interactive controls, so it needs the focus\n  // management a description-only tooltip does not\n  const isDialog = tooltip.parsedData?.role === 'dialog';\n  const isDialogOpen = isDialog && tooltip.visible;\n\n  // Remember what had focus before the dialog opened, and hand it back on close\n  useEffect(() => {\n    if (!isDialogOpen) return;\n\n    previouslyFocusedRef.current = document.activeElement as HTMLElement | null;\n\n    return () => {\n      const previous = previouslyFocusedRef.current;\n      previouslyFocusedRef.current = null;\n      if (previous?.isConnected) {\n        previous.focus({ preventScroll: true });\n      }\n    };\n  }, [isDialogOpen]);\n\n  const autoFocus = tooltip.parsedData?.autoFocus ?? 'panel';\n  useEffect(() => {\n    if (!isDialogOpen || !isPositioned) return;\n\n    const panel = refs.floating.current;\n    if (!panel) return;\n\n    const target = resolveAutoFocusTarget(panel, autoFocus, document.activeElement);\n    if (!target) return;\n\n    target.focus({ preventScroll: true });\n\n    const focusLanded = panel.contains(document.activeElement);\n    if (!focusLanded) {\n      panel.focus({ preventScroll: true });\n    }\n  }, [isDialogOpen, isPositioned, tooltip.content, refs, autoFocus]);\n\n  // Handle transition end - only clear transitioning state when transform finishes\n  // (or opacity if not animating position)\n  const handleTransitionEnd = useCallback(\n    (e: React.TransitionEvent) => {\n      if (!tooltip.isTransitioning) return;\n\n      // When animating position, wait for transform to finish (it's usually longer)\n      // When not animating position, opacity ending is sufficient\n      const shouldClear =\n        e.propertyName === 'transform' || (e.propertyName === 'opacity' && !animatePosition);\n\n      if (shouldClear) {\n        dispatch({ type: 'SET_TOOLTIP_TRANSITIONING', payload: false });\n      }\n    },\n    [tooltip.isTransitioning, dispatch, animatePosition]\n  );\n\n  // Don't render if not visible or no content\n  if (!tooltip.visible || !tooltip.content) {\n    return null;\n  }\n\n  // Get content and shortcut from parsed data\n  const isHtmlContent = tooltip.parsedData?.html ?? false;\n  const mainContent = tooltip.content;\n  const shortcut = tooltip.parsedData?.shortcut;\n\n  // Extract text display options\n  const isInteractive = tooltip.parsedData?.interactive ?? false;\n  const wordWrap = tooltip.parsedData?.wordWrap ?? false;\n  const ellipsis = tooltip.parsedData?.ellipsis ?? false;\n  const maxLines = tooltip.parsedData?.maxLines ?? 1;\n  const textBreak = tooltip.parsedData?.textBreak ?? 'normal';\n  const showArrow = tooltip.parsedData?.showArrow ?? true;\n\n  // Build class names using utility\n  const classNames = buildTooltipClassNames({\n    shouldShow,\n    isTransitioning: tooltip.isTransitioning,\n    shouldAnimatePosition: animatePosition,\n    isInteractive,\n    wordWrap,\n    ellipsis,\n    textBreak,\n  });\n\n  // Calculate arrow position\n  const staticSide = getArrowStaticSide(context.placement);\n  const arrowStyles = getArrowStyles(middlewareData.arrow?.x, middlewareData.arrow?.y, staticSide);\n\n  return (\n    <div\n      ref={refs.setFloating}\n      role={tooltip.parsedData?.role ?? 'tooltip'}\n      aria-labelledby={tooltip.parsedData?.ariaLabelledBy}\n      // Focusable only as a programmatic focus destination, never in the tab order\n      tabIndex={isDialog ? -1 : undefined}\n      className={classNames}\n      style={\n        {\n          ...floatingStyles,\n          zIndex: config.zIndex,\n          maxWidth: tooltip.parsedData?.maxWidth ?? 300,\n          // Hide until positioned to prevent flash at wrong position\n          visibility: isPositioned ? 'visible' : 'hidden',\n          '--animation-duration': `${ANIMATION.TOOLTIP_SHOW}ms`,\n          '--move-duration': `${tooltip.parsedData?.moveTransitionDuration ?? config.moveTransitionDuration}ms`,\n          '--max-lines': maxLines,\n        } as React.CSSProperties\n      }\n      onTransitionEnd={handleTransitionEnd}\n      data-placement={context.placement}\n      data-transition-behavior={transitionBehavior}\n      data-interactive={isInteractive ? '' : undefined}\n      // Opts the stylesheet's prefers-reduced-motion guards back out\n      data-tip-magic-motion={config.respectReducedMotion ? undefined : 'always'}\n    >\n      <div className={CSS_CLASSES.TOOLTIP_CONTENT}>\n        {isHtmlContent ? (\n          <HtmlContent html={mainContent} />\n        ) : (\n          <span className={CSS_CLASSES.TOOLTIP_TEXT}>{mainContent}</span>\n        )}\n        {shortcut && config.enableShortcutStyle && (\n          <kbd className={CSS_CLASSES.TOOLTIP_SHORTCUT}>{shortcut}</kbd>\n        )}\n      </div>\n      {showArrow && (\n        <div ref={arrowRef} className={CSS_CLASSES.TOOLTIP_ARROW} style={arrowStyles} />\n      )}\n    </div>\n  );\n}\n","import { createPortal } from 'react-dom';\nimport { useTipMagicContext } from '../context/TipMagicContext';\nimport { Tooltip } from './Tooltip';\n\n/**\n * Internal component that renders the tooltip via a portal\n *\n * This ensures the tooltip is rendered at the top level of the DOM\n * (by default in document.body) to avoid z-index and overflow issues.\n *\n * The portal container can be customized via the provider's\n * `portalContainer` option.\n */\nexport function TipMagicPortal() {\n  const { state } = useTipMagicContext();\n  const portalContainer = state.config.portalContainer ?? document.body;\n\n  return createPortal(<Tooltip />, portalContainer);\n}\n","import { useEffect, useRef } from 'react';\nimport { useTipMagicContext } from '../context/TipMagicContext';\n\n/**\n * Internal component that handles automatic tour highlighting\n *\n * When a flow/tour is active and `tourHighlightClass` is configured,\n * this component automatically adds/removes the highlight class\n * to/from target elements as the tour progresses.\n *\n * This enables visual highlighting of the current step's target\n * without requiring manual class management.\n */\nexport function TipMagicTourHighlight() {\n  const { state } = useTipMagicContext();\n  const { flow, tooltip, config } = state;\n  const previousTargetRef = useRef<Element | null>(null);\n\n  useEffect(() => {\n    const highlightClass = config.tourHighlightClass;\n\n    // Only apply highlighting if class is configured and flow is active\n    if (!highlightClass) {\n      return;\n    }\n\n    // Remove highlight from previous target\n    if (previousTargetRef.current && previousTargetRef.current !== tooltip.target) {\n      previousTargetRef.current.classList.remove(highlightClass);\n    }\n\n    // Add highlight to current target if flow is active\n    if (flow.active && tooltip.target) {\n      tooltip.target.classList.add(highlightClass);\n      previousTargetRef.current = tooltip.target;\n    }\n\n    // Cleanup function - remove highlight when flow ends or component unmounts\n    return () => {\n      if (!flow.active && previousTargetRef.current && highlightClass) {\n        previousTargetRef.current.classList.remove(highlightClass);\n        previousTargetRef.current = null;\n      }\n    };\n  }, [flow.active, tooltip.target, config.tourHighlightClass]);\n\n  // Also clean up when flow becomes inactive\n  useEffect(() => {\n    if (!flow.active && previousTargetRef.current && config.tourHighlightClass) {\n      previousTargetRef.current.classList.remove(config.tourHighlightClass);\n      previousTargetRef.current = null;\n    }\n  }, [flow.active, config.tourHighlightClass]);\n\n  return null;\n}\n","import type { ReactNode } from 'react';\nimport { TipMagicContextProvider } from '../context/TipMagicContext';\nimport type { TipMagicOptions } from '../types';\nimport { TipMagicEventHandler } from './TipMagicEventHandler';\nimport { TipMagicPortal } from './TipMagicPortal';\nimport { TipMagicTourHighlight } from './TipMagicTourHighlight';\n\n/**\n * Props for TipMagicProvider\n */\nexport interface TipMagicProviderProps {\n  children: ReactNode;\n  options?: TipMagicOptions;\n}\n\n/**\n * TipMagicProvider - Main provider component\n *\n * Wrap your application with this provider to enable tooltips.\n * Elements with `data-tip` attribute will automatically show tooltips.\n *\n * @example\n * ```tsx\n * <TipMagicProvider>\n *   <button data-tip=\"Save changes\">Save</button>\n * </TipMagicProvider>\n * ```\n */\nexport function TipMagicProvider({ children, options }: TipMagicProviderProps) {\n  return (\n    <TipMagicContextProvider options={options}>\n      <TipMagicEventHandler />\n      <TipMagicTourHighlight />\n      {children}\n      <TipMagicPortal />\n    </TipMagicContextProvider>\n  );\n}\n","import type { TipAdvisorItem, TipAdvisorPresetItem } from '../../../types/tipAdvisor';\nimport { parseDataAttributes } from '../../../utils/parseDataAttributes';\n\n/**\n * Collects all elements matching the selector that have both tooltip content and a shortcut.\n *\n * @param selector - CSS selector to find elements, or null/empty to skip DOM scanning\n * @returns Array of TipAdvisorItem objects from DOM\n */\nexport function collectElementItems(selector: string | null | undefined): TipAdvisorItem[] {\n  if (!selector) {\n    return [];\n  }\n\n  const elements = document.querySelectorAll(selector);\n  const items: TipAdvisorItem[] = [];\n\n  elements.forEach((element, index) => {\n    const parsedData = parseDataAttributes(element);\n\n    if (parsedData.content && parsedData.shortcut) {\n      items.push({\n        id: parsedData.id || `tip-advisor-element-${index}`,\n        element,\n        content: parsedData.content,\n        shortcut: parsedData.shortcut,\n      });\n    }\n  });\n\n  return items;\n}\n\n/**\n * Converts preset items to TipAdvisorItem format.\n *\n * @param presetItems - Array of preset items from props\n * @returns Array of TipAdvisorItem objects\n */\nexport function convertPresetItems(\n  presetItems: TipAdvisorPresetItem[] | undefined\n): TipAdvisorItem[] {\n  if (!presetItems || presetItems.length === 0) {\n    return [];\n  }\n\n  return presetItems.map((preset) => ({\n    id: preset.id,\n    content: preset.label,\n    shortcut: preset.shortcut,\n    onSelect: preset.onSelect,\n  }));\n}\n\n/**\n * Collects all TipAdvisor items from both DOM elements and preset items.\n *\n * @param selector - CSS selector to find elements, or null/empty to skip DOM scanning\n * @param presetItems - Optional preset items to include\n * @returns Combined array of TipAdvisorItem objects\n */\nexport function collectTipAdvisorItems(\n  selector: string | null | undefined,\n  presetItems?: TipAdvisorPresetItem[]\n): TipAdvisorItem[] {\n  const elementItems = collectElementItems(selector);\n  const convertedPresets = convertPresetItems(presetItems);\n\n  return [...elementItems, ...convertedPresets];\n}\n","// https://github.com/farzher/fuzzysort v3.0.2\r\n\r\n// UMD (Universal Module Definition) for fuzzysort\r\n;((root, UMD) => {\r\n  if(typeof define === 'function' && define.amd) define([], UMD)\r\n  else if(typeof module === 'object' && module.exports) module.exports = UMD()\r\n  else root['fuzzysort'] = UMD()\r\n})(this, _ => {\r\n  'use strict'\r\n\r\n  var single = (search, target) => {\r\n    if(!search || !target) return NULL\r\n\r\n    var preparedSearch = getPreparedSearch(search)\r\n    if(!isPrepared(target)) target = getPrepared(target)\r\n\r\n    var searchBitflags = preparedSearch.bitflags\r\n    if((searchBitflags & target._bitflags) !== searchBitflags) return NULL\r\n\r\n    return algorithm(preparedSearch, target)\r\n  }\r\n\r\n  var go = (search, targets, options) => {\r\n    if(!search) return options?.all ? all(targets, options) : noResults\r\n\r\n    var preparedSearch = getPreparedSearch(search)\r\n    var searchBitflags = preparedSearch.bitflags\r\n    var containsSpace  = preparedSearch.containsSpace\r\n\r\n    var threshold = denormalizeScore( options?.threshold || 0 )\r\n    var limit     = options?.limit || INFINITY\r\n\r\n    var resultsLen = 0; var limitedCount = 0\r\n    var targetsLen = targets.length\r\n\r\n    function push_result(result) {\r\n      if(resultsLen < limit) { q.add(result); ++resultsLen }\r\n      else {\r\n        ++limitedCount\r\n        if(result._score > q.peek()._score) q.replaceTop(result)\r\n      }\r\n    }\r\n\r\n    // This code is copy/pasted 3 times for performance reasons [options.key, options.keys, no keys]\r\n\r\n    // options.key\r\n    if(options?.key) {\r\n      var key = options.key\r\n      for(var i = 0; i < targetsLen; ++i) { var obj = targets[i]\r\n        var target = getValue(obj, key)\r\n        if(!target) continue\r\n        if(!isPrepared(target)) target = getPrepared(target)\r\n\r\n        if((searchBitflags & target._bitflags) !== searchBitflags) continue\r\n        var result = algorithm(preparedSearch, target)\r\n        if(result === NULL) continue\r\n        if(result._score < threshold) continue\r\n\r\n        result.obj = obj\r\n        push_result(result)\r\n      }\r\n\r\n    // options.keys\r\n    } else if(options?.keys) {\r\n      var keys = options.keys\r\n      var keysLen = keys.length\r\n\r\n      outer: for(var i = 0; i < targetsLen; ++i) { var obj = targets[i]\r\n\r\n        { // early out based on bitflags\r\n          var keysBitflags = 0\r\n          for (var keyI = 0; keyI < keysLen; ++keyI) {\r\n            var key = keys[keyI]\r\n            var target = getValue(obj, key)\r\n            if(!target) { tmpTargets[keyI] = noTarget; continue }\r\n            if(!isPrepared(target)) target = getPrepared(target)\r\n            tmpTargets[keyI] = target\r\n\r\n            keysBitflags |= target._bitflags\r\n          }\r\n\r\n          if((searchBitflags & keysBitflags) !== searchBitflags) continue\r\n        }\r\n\r\n        if(containsSpace) for(let i=0; i<preparedSearch.spaceSearches.length; i++) keysSpacesBestScores[i] = NEGATIVE_INFINITY\r\n\r\n        for (var keyI = 0; keyI < keysLen; ++keyI) {\r\n          target = tmpTargets[keyI]\r\n          if(target === noTarget) { tmpResults[keyI] = noTarget; continue }\r\n\r\n          tmpResults[keyI] = algorithm(preparedSearch, target, /*allowSpaces=*/false, /*allowPartialMatch=*/containsSpace)\r\n          if(tmpResults[keyI] === NULL) { tmpResults[keyI] = noTarget; continue }\r\n\r\n          // todo: this seems weird and wrong. like what if our first match wasn't good. this should just replace it instead of averaging with it\r\n          // if our second match isn't good we ignore it instead of averaging with it\r\n          if(containsSpace) for(let i=0; i<preparedSearch.spaceSearches.length; i++) {\r\n            if(allowPartialMatchScores[i] > -1000) {\r\n              if(keysSpacesBestScores[i] > NEGATIVE_INFINITY) {\r\n                var tmp = (keysSpacesBestScores[i] + allowPartialMatchScores[i]) / 4/*bonus score for having multiple matches*/\r\n                if(tmp > keysSpacesBestScores[i]) keysSpacesBestScores[i] = tmp\r\n              }\r\n            }\r\n            if(allowPartialMatchScores[i] > keysSpacesBestScores[i]) keysSpacesBestScores[i] = allowPartialMatchScores[i]\r\n          }\r\n        }\r\n\r\n        if(containsSpace) {\r\n          for(let i=0; i<preparedSearch.spaceSearches.length; i++) { if(keysSpacesBestScores[i] === NEGATIVE_INFINITY) continue outer }\r\n        } else {\r\n          var hasAtLeast1Match = false\r\n          for(let i=0; i < keysLen; i++) { if(tmpResults[i]._score !== NEGATIVE_INFINITY) { hasAtLeast1Match = true; break } }\r\n          if(!hasAtLeast1Match) continue\r\n        }\r\n\r\n        var objResults = new KeysResult(keysLen)\r\n        for(let i=0; i < keysLen; i++) { objResults[i] = tmpResults[i] }\r\n\r\n        if(containsSpace) {\r\n          var score = 0\r\n          for(let i=0; i<preparedSearch.spaceSearches.length; i++) score += keysSpacesBestScores[i]\r\n        } else {\r\n          // todo could rewrite this scoring to be more similar to when there's spaces\r\n          // if we match multiple keys give us bonus points\r\n          var score = NEGATIVE_INFINITY\r\n          for(let i=0; i<keysLen; i++) {\r\n            var result = objResults[i]\r\n            if(result._score > -1000) {\r\n              if(score > NEGATIVE_INFINITY) {\r\n                var tmp = (score + result._score) / 4/*bonus score for having multiple matches*/\r\n                if(tmp > score) score = tmp\r\n              }\r\n            }\r\n            if(result._score > score) score = result._score\r\n          }\r\n        }\r\n\r\n        objResults.obj = obj\r\n        objResults._score = score\r\n        if(options?.scoreFn) {\r\n          score = options.scoreFn(objResults)\r\n          if(!score) continue\r\n          score = denormalizeScore(score)\r\n          objResults._score = score\r\n        }\r\n\r\n        if(score < threshold) continue\r\n        push_result(objResults)\r\n      }\r\n\r\n    // no keys\r\n    } else {\r\n      for(var i = 0; i < targetsLen; ++i) { var target = targets[i]\r\n        if(!target) continue\r\n        if(!isPrepared(target)) target = getPrepared(target)\r\n\r\n        if((searchBitflags & target._bitflags) !== searchBitflags) continue\r\n        var result = algorithm(preparedSearch, target)\r\n        if(result === NULL) continue\r\n        if(result._score < threshold) continue\r\n\r\n        push_result(result)\r\n      }\r\n    }\r\n\r\n    if(resultsLen === 0) return noResults\r\n    var results = new Array(resultsLen)\r\n    for(var i = resultsLen - 1; i >= 0; --i) results[i] = q.poll()\r\n    results.total = resultsLen + limitedCount\r\n    return results\r\n  }\r\n\r\n\r\n  // this is written as 1 function instead of 2 for minification. perf seems fine ...\r\n  // except when minified. the perf is very slow\r\n  var highlight = (result, open='<b>', close='</b>') => {\r\n    var callback = typeof open === 'function' ? open : undefined\r\n\r\n    var target      = result.target\r\n    var targetLen   = target.length\r\n    var indexes     = result.indexes\r\n    var highlighted = ''\r\n    var matchI      = 0\r\n    var indexesI    = 0\r\n    var opened      = false\r\n    var parts       = []\r\n\r\n    for(var i = 0; i < targetLen; ++i) { var char = target[i]\r\n      if(indexes[indexesI] === i) {\r\n        ++indexesI\r\n        if(!opened) { opened = true\r\n          if(callback) {\r\n            parts.push(highlighted); highlighted = ''\r\n          } else {\r\n            highlighted += open\r\n          }\r\n        }\r\n\r\n        if(indexesI === indexes.length) {\r\n          if(callback) {\r\n            highlighted += char\r\n            parts.push(callback(highlighted, matchI++)); highlighted = ''\r\n            parts.push(target.substr(i+1))\r\n          } else {\r\n            highlighted += char + close + target.substr(i+1)\r\n          }\r\n          break\r\n        }\r\n      } else {\r\n        if(opened) { opened = false\r\n          if(callback) {\r\n            parts.push(callback(highlighted, matchI++)); highlighted = ''\r\n          } else {\r\n            highlighted += close\r\n          }\r\n        }\r\n      }\r\n      highlighted += char\r\n    }\r\n\r\n    return callback ? parts : highlighted\r\n  }\r\n\r\n\r\n  var prepare = (target) => {\r\n    if(typeof target === 'number') target = ''+target\r\n    else if(typeof target !== 'string') target = ''\r\n    var info = prepareLowerInfo(target)\r\n    return new_result(target, {_targetLower:info._lower, _targetLowerCodes:info.lowerCodes, _bitflags:info.bitflags})\r\n  }\r\n\r\n  var cleanup = () => { preparedCache.clear(); preparedSearchCache.clear() }\r\n\r\n\r\n  // Below this point is only internal code\r\n  // Below this point is only internal code\r\n  // Below this point is only internal code\r\n  // Below this point is only internal code\r\n\r\n\r\n  class Result {\r\n    get ['indexes']() { return this._indexes.slice(0, this._indexes.len).sort((a,b)=>a-b) }\r\n    set ['indexes'](indexes) { return this._indexes = indexes }\r\n    ['highlight'](open, close) { return highlight(this, open, close) }\r\n    get ['score']() { return normalizeScore(this._score) }\r\n    set ['score'](score) { this._score = denormalizeScore(score) }\r\n  }\r\n\r\n  class KeysResult extends Array {\r\n    get ['score']() { return normalizeScore(this._score) }\r\n    set ['score'](score) { this._score = denormalizeScore(score) }\r\n  }\r\n\r\n  var new_result = (target, options) => {\r\n    const result = new Result()\r\n    result['target']             = target\r\n    result['obj']                = options.obj                   ?? NULL\r\n    result._score                = options._score                ?? NEGATIVE_INFINITY\r\n    result._indexes              = options._indexes              ?? []\r\n    result._targetLower          = options._targetLower          ?? ''\r\n    result._targetLowerCodes     = options._targetLowerCodes     ?? NULL\r\n    result._nextBeginningIndexes = options._nextBeginningIndexes ?? NULL\r\n    result._bitflags             = options._bitflags             ?? 0\r\n    return result\r\n  }\r\n\r\n\r\n  var normalizeScore = score => {\r\n    if(score === NEGATIVE_INFINITY) return 0\r\n    if(score > 1) return score\r\n    return Math.E ** ( ((-score + 1)**.04307 - 1) * -2)\r\n  }\r\n  var denormalizeScore = normalizedScore => {\r\n    if(normalizedScore === 0) return NEGATIVE_INFINITY\r\n    if(normalizedScore > 1) return normalizedScore\r\n    return 1 - Math.pow((Math.log(normalizedScore) / -2 + 1), 1 / 0.04307)\r\n  }\r\n\r\n\r\n  var prepareSearch = (search) => {\r\n    if(typeof search === 'number') search = ''+search\r\n    else if(typeof search !== 'string') search = ''\r\n    search = search.trim()\r\n    var info = prepareLowerInfo(search)\r\n\r\n    var spaceSearches = []\r\n    if(info.containsSpace) {\r\n      var searches = search.split(/\\s+/)\r\n      searches = [...new Set(searches)] // distinct\r\n      for(var i=0; i<searches.length; i++) {\r\n        if(searches[i] === '') continue\r\n        var _info = prepareLowerInfo(searches[i])\r\n        spaceSearches.push({lowerCodes:_info.lowerCodes, _lower:searches[i].toLowerCase(), containsSpace:false})\r\n      }\r\n    }\r\n\r\n    return {lowerCodes: info.lowerCodes, _lower: info._lower, containsSpace: info.containsSpace, bitflags: info.bitflags, spaceSearches: spaceSearches}\r\n  }\r\n\r\n\r\n\r\n  var getPrepared = (target) => {\r\n    if(target.length > 999) return prepare(target) // don't cache huge targets\r\n    var targetPrepared = preparedCache.get(target)\r\n    if(targetPrepared !== undefined) return targetPrepared\r\n    targetPrepared = prepare(target)\r\n    preparedCache.set(target, targetPrepared)\r\n    return targetPrepared\r\n  }\r\n  var getPreparedSearch = (search) => {\r\n    if(search.length > 999) return prepareSearch(search) // don't cache huge searches\r\n    var searchPrepared = preparedSearchCache.get(search)\r\n    if(searchPrepared !== undefined) return searchPrepared\r\n    searchPrepared = prepareSearch(search)\r\n    preparedSearchCache.set(search, searchPrepared)\r\n    return searchPrepared\r\n  }\r\n\r\n\r\n  var all = (targets, options) => {\r\n    var results = []; results.total = targets.length // this total can be wrong if some targets are skipped\r\n\r\n    var limit = options?.limit || INFINITY\r\n\r\n    if(options?.key) {\r\n      for(var i=0;i<targets.length;i++) { var obj = targets[i]\r\n        var target = getValue(obj, options.key)\r\n        if(target == NULL) continue\r\n        if(!isPrepared(target)) target = getPrepared(target)\r\n        var result = new_result(target.target, {_score: target._score, obj: obj})\r\n        results.push(result); if(results.length >= limit) return results\r\n      }\r\n    } else if(options?.keys) {\r\n      for(var i=0;i<targets.length;i++) { var obj = targets[i]\r\n        var objResults = new KeysResult(options.keys.length)\r\n        for (var keyI = options.keys.length - 1; keyI >= 0; --keyI) {\r\n          var target = getValue(obj, options.keys[keyI])\r\n          if(!target) { objResults[keyI] = noTarget; continue }\r\n          if(!isPrepared(target)) target = getPrepared(target)\r\n          target._score = NEGATIVE_INFINITY\r\n          target._indexes.len = 0\r\n          objResults[keyI] = target\r\n        }\r\n        objResults.obj = obj\r\n        objResults._score = NEGATIVE_INFINITY\r\n        results.push(objResults); if(results.length >= limit) return results\r\n      }\r\n    } else {\r\n      for(var i=0;i<targets.length;i++) { var target = targets[i]\r\n        if(target == NULL) continue\r\n        if(!isPrepared(target)) target = getPrepared(target)\r\n        target._score = NEGATIVE_INFINITY\r\n        target._indexes.len = 0\r\n        results.push(target); if(results.length >= limit) return results\r\n      }\r\n    }\r\n\r\n    return results\r\n  }\r\n\r\n\r\n  var algorithm = (preparedSearch, prepared, allowSpaces=false, allowPartialMatch=false) => {\r\n    if(allowSpaces===false && preparedSearch.containsSpace) return algorithmSpaces(preparedSearch, prepared, allowPartialMatch)\r\n\r\n    var searchLower      = preparedSearch._lower\r\n    var searchLowerCodes = preparedSearch.lowerCodes\r\n    var searchLowerCode  = searchLowerCodes[0]\r\n    var targetLowerCodes = prepared._targetLowerCodes\r\n    var searchLen        = searchLowerCodes.length\r\n    var targetLen        = targetLowerCodes.length\r\n    var searchI          = 0 // where we at\r\n    var targetI          = 0 // where you at\r\n    var matchesSimpleLen = 0\r\n\r\n    // very basic fuzzy match; to remove non-matching targets ASAP!\r\n    // walk through target. find sequential matches.\r\n    // if all chars aren't found then exit\r\n    for(;;) {\r\n      var isMatch = searchLowerCode === targetLowerCodes[targetI]\r\n      if(isMatch) {\r\n        matchesSimple[matchesSimpleLen++] = targetI\r\n        ++searchI; if(searchI === searchLen) break\r\n        searchLowerCode = searchLowerCodes[searchI]\r\n      }\r\n      ++targetI; if(targetI >= targetLen) return NULL // Failed to find searchI\r\n    }\r\n\r\n    var searchI = 0\r\n    var successStrict = false\r\n    var matchesStrictLen = 0\r\n\r\n    var nextBeginningIndexes = prepared._nextBeginningIndexes\r\n    if(nextBeginningIndexes === NULL) nextBeginningIndexes = prepared._nextBeginningIndexes = prepareNextBeginningIndexes(prepared.target)\r\n    targetI = matchesSimple[0]===0 ? 0 : nextBeginningIndexes[matchesSimple[0]-1]\r\n\r\n    // Our target string successfully matched all characters in sequence!\r\n    // Let's try a more advanced and strict test to improve the score\r\n    // only count it as a match if it's consecutive or a beginning character!\r\n    var backtrackCount = 0\r\n    if(targetI !== targetLen) for(;;) {\r\n      if(targetI >= targetLen) {\r\n        // We failed to find a good spot for this search char, go back to the previous search char and force it forward\r\n        if(searchI <= 0) break // We failed to push chars forward for a better match\r\n\r\n        ++backtrackCount; if(backtrackCount > 200) break // exponential backtracking is taking too long, just give up and return a bad match\r\n\r\n        --searchI\r\n        var lastMatch = matchesStrict[--matchesStrictLen]\r\n        targetI = nextBeginningIndexes[lastMatch]\r\n\r\n      } else {\r\n        var isMatch = searchLowerCodes[searchI] === targetLowerCodes[targetI]\r\n        if(isMatch) {\r\n          matchesStrict[matchesStrictLen++] = targetI\r\n          ++searchI; if(searchI === searchLen) { successStrict = true; break }\r\n          ++targetI\r\n        } else {\r\n          targetI = nextBeginningIndexes[targetI]\r\n        }\r\n      }\r\n    }\r\n\r\n    // check if it's a substring match\r\n    var substringIndex = searchLen <= 1 ? -1 : prepared._targetLower.indexOf(searchLower, matchesSimple[0]) // perf: this is slow\r\n    var isSubstring = !!~substringIndex\r\n    var isSubstringBeginning = !isSubstring ? false : substringIndex===0 || prepared._nextBeginningIndexes[substringIndex-1] === substringIndex\r\n\r\n    // if it's a substring match but not at a beginning index, let's try to find a substring starting at a beginning index for a better score\r\n    if(isSubstring && !isSubstringBeginning) {\r\n      for(var i=0; i<nextBeginningIndexes.length; i=nextBeginningIndexes[i]) {\r\n        if(i <= substringIndex) continue\r\n\r\n        for(var s=0; s<searchLen; s++) if(searchLowerCodes[s] !== prepared._targetLowerCodes[i+s]) break\r\n        if(s === searchLen) { substringIndex = i; isSubstringBeginning = true; break }\r\n      }\r\n    }\r\n\r\n    // tally up the score & keep track of matches for highlighting later\r\n    // if it's a simple match, we'll switch to a substring match if a substring exists\r\n    // if it's a strict match, we'll switch to a substring match only if that's a better score\r\n\r\n    var calculateScore = matches => {\r\n      var score = 0\r\n\r\n      var extraMatchGroupCount = 0\r\n      for(var i = 1; i < searchLen; ++i) {\r\n        if(matches[i] - matches[i-1] !== 1) {score -= matches[i]; ++extraMatchGroupCount}\r\n      }\r\n      var unmatchedDistance = matches[searchLen-1] - matches[0] - (searchLen-1)\r\n\r\n      score -= (12+unmatchedDistance) * extraMatchGroupCount // penality for more groups\r\n\r\n      if(matches[0] !== 0) score -= matches[0]*matches[0]*.2 // penality for not starting near the beginning\r\n\r\n      if(!successStrict) {\r\n        score *= 1000\r\n      } else {\r\n        // successStrict on a target with too many beginning indexes loses points for being a bad target\r\n        var uniqueBeginningIndexes = 1\r\n        for(var i = nextBeginningIndexes[0]; i < targetLen; i=nextBeginningIndexes[i]) ++uniqueBeginningIndexes\r\n\r\n        if(uniqueBeginningIndexes > 24) score *= (uniqueBeginningIndexes-24)*10 // quite arbitrary numbers here ...\r\n      }\r\n\r\n      score -= (targetLen - searchLen)/2 // penality for longer targets\r\n\r\n      if(isSubstring)          score /= 1+searchLen*searchLen*1 // bonus for being a full substring\r\n      if(isSubstringBeginning) score /= 1+searchLen*searchLen*1 // bonus for substring starting on a beginningIndex\r\n\r\n      score -= (targetLen - searchLen)/2 // penality for longer targets\r\n\r\n      return score\r\n    }\r\n\r\n    if(!successStrict) {\r\n      if(isSubstring) for(var i=0; i<searchLen; ++i) matchesSimple[i] = substringIndex+i // at this point it's safe to overwrite matchehsSimple with substr matches\r\n      var matchesBest = matchesSimple\r\n      var score = calculateScore(matchesBest)\r\n    } else {\r\n      if(isSubstringBeginning) {\r\n        for(var i=0; i<searchLen; ++i) matchesSimple[i] = substringIndex+i // at this point it's safe to overwrite matchehsSimple with substr matches\r\n        var matchesBest = matchesSimple\r\n        var score = calculateScore(matchesSimple)\r\n      } else {\r\n        var matchesBest = matchesStrict\r\n        var score = calculateScore(matchesStrict)\r\n      }\r\n    }\r\n\r\n    prepared._score = score\r\n\r\n    for(var i = 0; i < searchLen; ++i) prepared._indexes[i] = matchesBest[i]\r\n    prepared._indexes.len = searchLen\r\n\r\n    const result    = new Result()\r\n    result.target   = prepared.target\r\n    result._score   = prepared._score\r\n    result._indexes = prepared._indexes\r\n    return result\r\n  }\r\n  var algorithmSpaces = (preparedSearch, target, allowPartialMatch) => {\r\n    var seen_indexes = new Set()\r\n    var score = 0\r\n    var result = NULL\r\n\r\n    var first_seen_index_last_search = 0\r\n    var searches = preparedSearch.spaceSearches\r\n    var searchesLen = searches.length\r\n    var changeslen = 0\r\n\r\n    // Return _nextBeginningIndexes back to its normal state\r\n    var resetNextBeginningIndexes = () => {\r\n      for(let i=changeslen-1; i>=0; i--) target._nextBeginningIndexes[nextBeginningIndexesChanges[i*2 + 0]] = nextBeginningIndexesChanges[i*2 + 1]\r\n    }\r\n\r\n    var hasAtLeast1Match = false\r\n    for(var i=0; i<searchesLen; ++i) {\r\n      allowPartialMatchScores[i] = NEGATIVE_INFINITY\r\n      var search = searches[i]\r\n\r\n      result = algorithm(search, target)\r\n      if(allowPartialMatch) {\r\n        if(result === NULL) continue\r\n        hasAtLeast1Match = true\r\n      } else {\r\n        if(result === NULL) {resetNextBeginningIndexes(); return NULL}\r\n      }\r\n\r\n      // if not the last search, we need to mutate _nextBeginningIndexes for the next search\r\n      var isTheLastSearch = i === searchesLen - 1\r\n      if(!isTheLastSearch) {\r\n        var indexes = result._indexes\r\n\r\n        var indexesIsConsecutiveSubstring = true\r\n        for(let i=0; i<indexes.len-1; i++) {\r\n          if(indexes[i+1] - indexes[i] !== 1) {\r\n            indexesIsConsecutiveSubstring = false; break;\r\n          }\r\n        }\r\n\r\n        if(indexesIsConsecutiveSubstring) {\r\n          var newBeginningIndex = indexes[indexes.len-1] + 1\r\n          var toReplace = target._nextBeginningIndexes[newBeginningIndex-1]\r\n          for(let i=newBeginningIndex-1; i>=0; i--) {\r\n            if(toReplace !== target._nextBeginningIndexes[i]) break\r\n            target._nextBeginningIndexes[i] = newBeginningIndex\r\n            nextBeginningIndexesChanges[changeslen*2 + 0] = i\r\n            nextBeginningIndexesChanges[changeslen*2 + 1] = toReplace\r\n            changeslen++\r\n          }\r\n        }\r\n      }\r\n\r\n      score += result._score / searchesLen\r\n      allowPartialMatchScores[i] = result._score / searchesLen\r\n\r\n      // dock points based on order otherwise \"c man\" returns Manifest.cpp instead of CheatManager.h\r\n      if(result._indexes[0] < first_seen_index_last_search) {\r\n        score -= (first_seen_index_last_search - result._indexes[0]) * 2\r\n      }\r\n      first_seen_index_last_search = result._indexes[0]\r\n\r\n      for(var j=0; j<result._indexes.len; ++j) seen_indexes.add(result._indexes[j])\r\n    }\r\n\r\n    if(allowPartialMatch && !hasAtLeast1Match) return NULL\r\n\r\n    resetNextBeginningIndexes()\r\n\r\n    // allows a search with spaces that's an exact substring to score well\r\n    var allowSpacesResult = algorithm(preparedSearch, target, /*allowSpaces=*/true)\r\n    if(allowSpacesResult !== NULL && allowSpacesResult._score > score) {\r\n      if(allowPartialMatch) {\r\n        for(var i=0; i<searchesLen; ++i) {\r\n          allowPartialMatchScores[i] = allowSpacesResult._score / searchesLen\r\n        }\r\n      }\r\n      return allowSpacesResult\r\n    }\r\n\r\n    if(allowPartialMatch) result = target\r\n    result._score = score\r\n\r\n    var i = 0\r\n    for (let index of seen_indexes) result._indexes[i++] = index\r\n    result._indexes.len = i\r\n\r\n    return result\r\n  }\r\n\r\n  // we use this instead of just .normalize('NFD').replace(/[\\u0300-\\u036f]/g, '') because that screws with japanese characters\r\n  var remove_accents = (str) => str.replace(/\\p{Script=Latin}+/gu, match => match.normalize('NFD')).replace(/[\\u0300-\\u036f]/g, '')\r\n\r\n  var prepareLowerInfo = (str) => {\r\n    str = remove_accents(str)\r\n    var strLen = str.length\r\n    var lower = str.toLowerCase()\r\n    var lowerCodes = [] // new Array(strLen)    sparse array is too slow\r\n    var bitflags = 0\r\n    var containsSpace = false // space isn't stored in bitflags because of how searching with a space works\r\n\r\n    for(var i = 0; i < strLen; ++i) {\r\n      var lowerCode = lowerCodes[i] = lower.charCodeAt(i)\r\n\r\n      if(lowerCode === 32) {\r\n        containsSpace = true\r\n        continue // it's important that we don't set any bitflags for space\r\n      }\r\n\r\n      var bit = lowerCode>=97&&lowerCode<=122 ? lowerCode-97 // alphabet\r\n              : lowerCode>=48&&lowerCode<=57  ? 26           // numbers\r\n                                                             // 3 bits available\r\n              : lowerCode<=127                ? 30           // other ascii\r\n              :                                 31           // other utf8\r\n      bitflags |= 1<<bit\r\n    }\r\n\r\n    return {lowerCodes:lowerCodes, bitflags:bitflags, containsSpace:containsSpace, _lower:lower}\r\n  }\r\n  var prepareBeginningIndexes = (target) => {\r\n    var targetLen = target.length\r\n    var beginningIndexes = []; var beginningIndexesLen = 0\r\n    var wasUpper = false\r\n    var wasAlphanum = false\r\n    for(var i = 0; i < targetLen; ++i) {\r\n      var targetCode = target.charCodeAt(i)\r\n      var isUpper = targetCode>=65&&targetCode<=90\r\n      var isAlphanum = isUpper || targetCode>=97&&targetCode<=122 || targetCode>=48&&targetCode<=57\r\n      var isBeginning = isUpper && !wasUpper || !wasAlphanum || !isAlphanum\r\n      wasUpper = isUpper\r\n      wasAlphanum = isAlphanum\r\n      if(isBeginning) beginningIndexes[beginningIndexesLen++] = i\r\n    }\r\n    return beginningIndexes\r\n  }\r\n  var prepareNextBeginningIndexes = (target) => {\r\n    target = remove_accents(target)\r\n    var targetLen = target.length\r\n    var beginningIndexes = prepareBeginningIndexes(target)\r\n    var nextBeginningIndexes = [] // new Array(targetLen)     sparse array is too slow\r\n    var lastIsBeginning = beginningIndexes[0]\r\n    var lastIsBeginningI = 0\r\n    for(var i = 0; i < targetLen; ++i) {\r\n      if(lastIsBeginning > i) {\r\n        nextBeginningIndexes[i] = lastIsBeginning\r\n      } else {\r\n        lastIsBeginning = beginningIndexes[++lastIsBeginningI]\r\n        nextBeginningIndexes[i] = lastIsBeginning===undefined ? targetLen : lastIsBeginning\r\n      }\r\n    }\r\n    return nextBeginningIndexes\r\n  }\r\n\r\n  var preparedCache       = new Map()\r\n  var preparedSearchCache = new Map()\r\n\r\n  // the theory behind these being globals is to reduce garbage collection by not making new arrays\r\n  var matchesSimple = []; var matchesStrict = []\r\n  var nextBeginningIndexesChanges = [] // allows straw berry to match strawberry well, by modifying the end of a substring to be considered a beginning index for the rest of the search\r\n  var keysSpacesBestScores = []; var allowPartialMatchScores = []\r\n  var tmpTargets = []; var tmpResults = []\r\n\r\n  // prop = 'key'                  2.5ms optimized for this case, seems to be about as fast as direct obj[prop]\r\n  // prop = 'key1.key2'            10ms\r\n  // prop = ['key1', 'key2']       27ms\r\n  // prop = obj => obj.tags.join() ??ms\r\n  var getValue = (obj, prop) => {\r\n    var tmp = obj[prop]; if(tmp !== undefined) return tmp\r\n    if(typeof prop === 'function') return prop(obj) // this should run first. but that makes string props slower\r\n    var segs = prop\r\n    if(!Array.isArray(prop)) segs = prop.split('.')\r\n    var len = segs.length\r\n    var i = -1\r\n    while (obj && (++i < len)) obj = obj[segs[i]]\r\n    return obj\r\n  }\r\n\r\n  var isPrepared = (x) => { return typeof x === 'object' && typeof x._bitflags === 'number' }\r\n  var INFINITY = Infinity; var NEGATIVE_INFINITY = -INFINITY\r\n  var noResults = []; noResults.total = 0\r\n  var NULL = null\r\n\r\n  var noTarget = prepare('')\r\n\r\n  // Hacked version of https://github.com/lemire/FastPriorityQueue.js\r\n  var fastpriorityqueue=r=>{var e=[],o=0,a={},v=r=>{for(var a=0,v=e[a],c=1;c<o;){var s=c+1;a=c,s<o&&e[s]._score<e[c]._score&&(a=s),e[a-1>>1]=e[a],c=1+(a<<1)}for(var f=a-1>>1;a>0&&v._score<e[f]._score;f=(a=f)-1>>1)e[a]=e[f];e[a]=v};return a.add=(r=>{var a=o;e[o++]=r;for(var v=a-1>>1;a>0&&r._score<e[v]._score;v=(a=v)-1>>1)e[a]=e[v];e[a]=r}),a.poll=(r=>{if(0!==o){var a=e[0];return e[0]=e[--o],v(),a}}),a.peek=(r=>{if(0!==o)return e[0]}),a.replaceTop=(r=>{e[0]=r,v()}),a}\r\n  var q = fastpriorityqueue() // reuse this\r\n\r\n  // fuzzysort is written this way for minification. all names are mangeled unless quoted\r\n  return {'single':single, 'go':go, 'prepare':prepare, 'cleanup':cleanup}\r\n}) // UMD\r\n","import fuzzysort from 'fuzzysort';\nimport type { TipAdvisorItem } from '../../../types/tipAdvisor';\n\n/**\n * Result of a fuzzy search on TipAdvisor items\n */\nexport interface FuzzySearchResult {\n  item: TipAdvisorItem;\n  contentResult: Fuzzysort.Result | null;\n  shortcutResult: Fuzzysort.Result | null;\n}\n\n/**\n * Filters TipAdvisor items using fuzzy search.\n *\n * When query is empty, returns all items with null results (no highlighting).\n * When query is provided, searches in both 'content' and 'shortcut' fields.\n *\n * @param items - Array of TipAdvisorItem to search\n * @param query - Search query string\n * @returns Array of FuzzySearchResult with matched items and highlight data\n */\nexport function filterItemsWithFuzzy(items: TipAdvisorItem[], query: string): FuzzySearchResult[] {\n  const trimmedQuery = query.trim();\n\n  if (!trimmedQuery) {\n    // Return all items with null results (no highlighting needed)\n    return items.map((item) => ({\n      item,\n      contentResult: null,\n      shortcutResult: null,\n    }));\n  }\n\n  // Search in both content and shortcut\n  const results = fuzzysort.go(trimmedQuery, items, {\n    keys: ['content', 'shortcut'],\n    threshold: -10000, // Include more results\n  });\n\n  return results.map((result) => ({\n    item: result.obj,\n    contentResult: result[0],\n    shortcutResult: result[1],\n  }));\n}\n\n/**\n * Highlights matching parts of text using fuzzysort result.\n *\n * @param text - Original text to display\n * @param result - Fuzzysort result containing match information\n * @returns HTML string with <mark> tags around matched characters, or original text if no result\n */\nexport function highlightFuzzyMatch(text: string, result: Fuzzysort.Result | null): string {\n  if (!result) {\n    return text;\n  }\n\n  const highlighted = result.highlight('<mark>', '</mark>');\n  return highlighted || text;\n}\n","/**\n * Navigation direction for keyboard control\n */\nexport type NavigationDirection = 'up' | 'down';\n\n/**\n * Calculates the next focused index for circular navigation.\n *\n * @param currentIndex - Current focused index\n * @param itemCount - Total number of items\n * @param direction - Navigation direction ('up' or 'down')\n * @returns The new focused index with circular wrapping\n */\nexport function getNextFocusedIndex(\n  currentIndex: number,\n  itemCount: number,\n  direction: NavigationDirection\n): number {\n  if (itemCount === 0) {\n    return 0;\n  }\n\n  if (direction === 'down') {\n    return currentIndex < itemCount - 1 ? currentIndex + 1 : 0;\n  }\n\n  // direction === 'up'\n  return currentIndex > 0 ? currentIndex - 1 : itemCount - 1;\n}\n\n/**\n * Determines if a key is a navigation key that should be handled.\n *\n * @param key - The keyboard event key\n * @returns True if the key is a navigation key\n */\nexport function isNavigationKey(key: string): key is 'Escape' | 'ArrowDown' | 'ArrowUp' | 'Enter' {\n  return key === 'Escape' || key === 'ArrowDown' || key === 'ArrowUp' || key === 'Enter';\n}\n","import type { ParsedTooltipData } from '../../../types';\nimport type { TipAdvisorItem } from '../../../types/tipAdvisor';\nimport { parseDataAttributes } from '../../../utils/parseDataAttributes';\n\n/**\n * Payload structure for showing a tooltip\n */\nexport interface TooltipPayload {\n  target: Element;\n  content: string;\n  parsedData: ParsedTooltipData;\n}\n\n/**\n * Builds the tooltip payload for a TipAdvisor item.\n *\n * When previewing an item in the advisor, we show the shortcut as the tooltip\n * content (since the main content is already visible in the menu).\n *\n * @param item - The TipAdvisor item to build a payload for (must have an element)\n * @returns The tooltip payload ready for dispatch, or null if item has no element\n */\nexport function buildTooltipPayload(item: TipAdvisorItem): TooltipPayload | null {\n  if (!item.element) {\n    return null;\n  }\n\n  const parsedData = parseDataAttributes(item.element);\n\n  return {\n    target: item.element,\n    content: item.shortcut || '',\n    parsedData: {\n      ...parsedData,\n      content: item.shortcut || '',\n      shortcut: undefined,\n    },\n  };\n}\n","import { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport type { TipMagicAction } from '../../context/TipMagicContext';\nimport type { TipAdvisorItem, TipAdvisorPresetItem } from '../../types/tipAdvisor';\nimport {\n  buildTooltipPayload,\n  collectTipAdvisorItems,\n  filterItemsWithFuzzy,\n  getNextFocusedIndex,\n  type FuzzySearchResult,\n} from './utils';\n\nexport interface UseTipAdvisorStateOptions {\n  /** CSS selector for finding tip elements, or null to skip DOM scanning */\n  selector: string | null | undefined;\n  /** Key to toggle the advisor */\n  triggerKey: string;\n  /** Preset items to include (not tied to DOM elements) */\n  presetItems?: TipAdvisorPresetItem[];\n  /** Callback when advisor opens */\n  onOpen?: () => void;\n  /** Callback when advisor closes */\n  onClose?: () => void;\n  /** Context dispatch function */\n  dispatch: React.Dispatch<TipMagicAction>;\n}\n\nexport interface UseTipAdvisorStateReturn {\n  // State\n  isOpen: boolean;\n  items: TipAdvisorItem[];\n  searchQuery: string;\n  focusedIndex: number;\n  filteredResults: FuzzySearchResult[];\n\n  // Refs\n  searchInputRef: React.RefObject<HTMLInputElement | null>;\n  itemRefs: React.MutableRefObject<Map<number, HTMLDivElement>>;\n\n  // Actions\n  open: () => void;\n  close: () => void;\n  toggle: () => void;\n  setSearchQuery: (query: string) => void;\n  setFocusedIndex: (index: number) => void;\n\n  // Handlers\n  handleItemClick: (item: TipAdvisorItem) => void;\n  handleItemHover: (item: TipAdvisorItem, index: number) => void;\n  handleItemLeave: () => void;\n  handleKeyDown: (event: React.KeyboardEvent) => void;\n}\n\n/**\n * Hook that manages TipAdvisor state, keyboard navigation, and tooltip display.\n */\nexport function useTipAdvisorState(options: UseTipAdvisorStateOptions): UseTipAdvisorStateReturn {\n  const { selector, triggerKey, presetItems, onOpen, onClose, dispatch } = options;\n\n  // Core state\n  const [isOpen, setIsOpen] = useState(false);\n  const [items, setItems] = useState<TipAdvisorItem[]>([]);\n  const [searchQuery, setSearchQuery] = useState('');\n  const [focusedIndex, setFocusedIndex] = useState(0);\n\n  // Refs\n  const searchInputRef = useRef<HTMLInputElement>(null);\n  const itemRefs = useRef<Map<number, HTMLDivElement>>(new Map());\n\n  // Filter items using fuzzy search\n  const filteredResults = useMemo(\n    () => filterItemsWithFuzzy(items, searchQuery),\n    [items, searchQuery]\n  );\n\n  // Show tooltip for an item (only for element-based items)\n  const showTooltipForItem = useCallback(\n    (item: TipAdvisorItem) => {\n      // Build payload - returns null for preset items (no element)\n      const payload = buildTooltipPayload(item);\n\n      if (!payload) {\n        dispatch({ type: 'HIDE_TOOLTIP' });\n        return;\n      }\n\n      // Scroll element into view if needed\n      item.element?.scrollIntoView({ behavior: 'smooth', block: 'nearest' });\n\n      // Show tooltip on the target element\n      dispatch({ type: 'SHOW_TOOLTIP', payload });\n    },\n    [dispatch]\n  );\n\n  // Open the advisor\n  const open = useCallback(() => {\n    const collectedItems = collectTipAdvisorItems(selector, presetItems);\n    setItems(collectedItems);\n    setSearchQuery('');\n    setIsOpen(true);\n    setFocusedIndex(0);\n    onOpen?.();\n\n    // Focus search input after render\n    setTimeout(() => {\n      searchInputRef.current?.focus();\n    }, 0);\n  }, [selector, presetItems, onOpen]);\n\n  // Close the advisor\n  const close = useCallback(() => {\n    setIsOpen(false);\n    setFocusedIndex(0);\n    setSearchQuery('');\n    dispatch({ type: 'HIDE_TOOLTIP' });\n    onClose?.();\n  }, [dispatch, onClose]);\n\n  // Toggle the advisor\n  const toggle = useCallback(() => {\n    if (isOpen) {\n      close();\n    } else {\n      open();\n    }\n  }, [isOpen, open, close]);\n\n  // Handle item click\n  const handleItemClick = useCallback(\n    (item: TipAdvisorItem) => {\n      close();\n\n      // For preset items, call the onSelect callback\n      if (item.onSelect) {\n        item.onSelect();\n        return;\n      }\n\n      // For element-based items, trigger click on the element\n      if (item.element instanceof HTMLElement) {\n        item.element.click();\n      }\n    },\n    [close]\n  );\n\n  // Handle item hover\n  const handleItemHover = useCallback(\n    (item: TipAdvisorItem, index: number) => {\n      setFocusedIndex(index);\n      showTooltipForItem(item);\n    },\n    [showTooltipForItem]\n  );\n\n  // Handle item leave\n  const handleItemLeave = useCallback(() => {\n    dispatch({ type: 'HIDE_TOOLTIP' });\n  }, [dispatch]);\n\n  // Handle keyboard navigation\n  const handleKeyDown = useCallback(\n    (event: React.KeyboardEvent) => {\n      const itemCount = filteredResults.length;\n\n      switch (event.key) {\n        case 'Escape':\n          event.preventDefault();\n          close();\n          break;\n\n        case 'ArrowDown':\n          event.preventDefault();\n          setFocusedIndex((prev) => getNextFocusedIndex(prev, itemCount, 'down'));\n          break;\n\n        case 'ArrowUp':\n          event.preventDefault();\n          setFocusedIndex((prev) => getNextFocusedIndex(prev, itemCount, 'up'));\n          break;\n\n        case 'Enter':\n          event.preventDefault();\n          if (focusedIndex >= 0 && focusedIndex < itemCount) {\n            handleItemClick(filteredResults[focusedIndex].item);\n          }\n          break;\n      }\n    },\n    [close, filteredResults, focusedIndex, handleItemClick]\n  );\n\n  // Global trigger key listener\n  useEffect(() => {\n    const handleGlobalKeyDown = (event: KeyboardEvent) => {\n      if (event.key === triggerKey) {\n        event.preventDefault();\n        toggle();\n      }\n    };\n\n    document.addEventListener('keydown', handleGlobalKeyDown);\n    return () => document.removeEventListener('keydown', handleGlobalKeyDown);\n  }, [triggerKey, toggle]);\n\n  // Reset focused index when search changes\n  useEffect(() => {\n    setFocusedIndex(0);\n  }, [searchQuery]);\n\n  // Update tooltip and scroll menu item when focused index changes\n  useEffect(() => {\n    if (focusedIndex >= 0 && focusedIndex < filteredResults.length) {\n      showTooltipForItem(filteredResults[focusedIndex].item);\n\n      // Scroll the focused menu item into view within the list\n      const itemElement = itemRefs.current.get(focusedIndex);\n      if (itemElement) {\n        itemElement.scrollIntoView({ behavior: 'smooth', block: 'nearest' });\n      }\n    } else {\n      dispatch({ type: 'HIDE_TOOLTIP' });\n    }\n  }, [focusedIndex, filteredResults, showTooltipForItem, dispatch]);\n\n  return {\n    // State\n    isOpen,\n    items,\n    searchQuery,\n    focusedIndex,\n    filteredResults,\n\n    // Refs\n    searchInputRef,\n    itemRefs,\n\n    // Actions\n    open,\n    close,\n    toggle,\n    setSearchQuery,\n    setFocusedIndex,\n\n    // Handlers\n    handleItemClick,\n    handleItemHover,\n    handleItemLeave,\n    handleKeyDown,\n  };\n}\n","import { forwardRef, useCallback, useImperativeHandle, useRef } from 'react';\nimport { createPortal } from 'react-dom';\nimport { useTipMagicContext } from '../../context/TipMagicContext';\nimport type { TipAdvisorAPI, TipAdvisorProps } from '../../types/tipAdvisor';\nimport { useTipAdvisorState } from './useTipAdvisorState';\nimport { highlightFuzzyMatch } from './utils';\n\nconst DEFAULT_TRIGGER_KEY = 'F1';\nconst DEFAULT_SELECTOR = '[data-tip][data-tip-shortcut]';\nconst DEFAULT_POSITION = 'center';\nconst DEFAULT_SEARCH_PLACEHOLDER = 'Search shortcuts...';\n\n/**\n * TipAdvisor - An optional menu component that displays all tooltips with shortcuts.\n *\n * Features:\n * - Fuzzy search with highlighting\n * - Keyboard navigation (arrow keys, enter)\n * - Hover preview of tooltips\n * - Click to trigger target element\n *\n * @example\n * ```tsx\n * <TipMagicProvider>\n *   <App />\n *   <TipAdvisor position=\"center\" triggerKey=\"F1\" />\n * </TipMagicProvider>\n * ```\n */\nexport const TipAdvisor = forwardRef<TipAdvisorAPI, TipAdvisorProps>(function TipAdvisor(\n  {\n    triggerKey = DEFAULT_TRIGGER_KEY,\n    position = DEFAULT_POSITION,\n    showCloseButton = true,\n    showBackdrop = true,\n    closeOnBackdropClick = true,\n    className,\n    itemClassName,\n    selector = DEFAULT_SELECTOR,\n    onOpen,\n    onClose,\n    searchPlaceholder = DEFAULT_SEARCH_PLACEHOLDER,\n    items: presetItems,\n  },\n  ref\n) {\n  const { state, dispatch } = useTipMagicContext();\n  const menuRef = useRef<HTMLDivElement>(null);\n  const backdropRef = useRef<HTMLDivElement>(null);\n\n  const {\n    isOpen,\n    items,\n    searchQuery,\n    focusedIndex,\n    filteredResults,\n    searchInputRef,\n    itemRefs,\n    open,\n    close,\n    toggle,\n    setSearchQuery,\n    handleItemClick,\n    handleItemHover,\n    handleItemLeave,\n    handleKeyDown,\n  } = useTipAdvisorState({\n    selector,\n    triggerKey,\n    presetItems,\n    onOpen,\n    onClose,\n    dispatch,\n  });\n\n  // Expose API via ref\n  useImperativeHandle(\n    ref,\n    () => ({\n      open,\n      close,\n      toggle,\n      isOpen,\n      items,\n    }),\n    [open, close, toggle, isOpen, items]\n  );\n\n  // Handle backdrop click\n  const handleBackdropClick = useCallback(\n    (event: React.MouseEvent) => {\n      if (!closeOnBackdropClick) return;\n\n      // Close if clicking directly on the container or the backdrop element\n      const target = event.target;\n      if (target === event.currentTarget || target === backdropRef.current) {\n        close();\n      }\n    },\n    [closeOnBackdropClick, close]\n  );\n\n  // Render highlighted text\n  const renderHighlightedText = (\n    text: string,\n    result: Fuzzysort.Result | null\n  ): React.ReactNode => {\n    const highlighted = highlightFuzzyMatch(text, result);\n\n    if (highlighted === text) {\n      return text;\n    }\n\n    return <span dangerouslySetInnerHTML={{ __html: highlighted }} />;\n  };\n\n  // Don't render if not open\n  if (!isOpen) {\n    return null;\n  }\n\n  const positionClass = `tip-advisor-menu--${position}`;\n\n  return createPortal(\n    <div\n      className={`tip-advisor ${showBackdrop ? '' : 'tip-advisor--no-backdrop'} ${className || ''}`}\n      onClick={handleBackdropClick}\n      role=\"dialog\"\n      aria-modal=\"true\"\n      aria-label=\"Keyboard Shortcuts\"\n    >\n      {showBackdrop && <div ref={backdropRef} className=\"tip-advisor-backdrop\" />}\n      <div\n        ref={menuRef}\n        className={`tip-advisor-menu ${positionClass}`}\n        role=\"menu\"\n        style={{ zIndex: state.config.zIndex + 1 }}\n        onKeyDown={handleKeyDown}\n      >\n        <div className=\"tip-advisor-header\">\n          <input\n            ref={searchInputRef}\n            type=\"text\"\n            className=\"tip-advisor-search\"\n            placeholder={searchPlaceholder}\n            value={searchQuery}\n            onChange={(e) => setSearchQuery(e.target.value)}\n            aria-label=\"Search shortcuts\"\n          />\n          {showCloseButton && (\n            <button className=\"tip-advisor-close\" onClick={close} aria-label=\"Close\" type=\"button\">\n              ×\n            </button>\n          )}\n        </div>\n        <div className=\"tip-advisor-list\">\n          {filteredResults.length === 0 ? (\n            <div className=\"tip-advisor-empty\">\n              {searchQuery ? 'No matching shortcuts' : 'No shortcuts available'}\n            </div>\n          ) : (\n            filteredResults.map(({ item, contentResult, shortcutResult }, index) => (\n              <div\n                key={item.id}\n                ref={(el) => {\n                  if (el) {\n                    itemRefs.current.set(index, el);\n                  } else {\n                    itemRefs.current.delete(index);\n                  }\n                }}\n                className={`tip-advisor-item ${itemClassName || ''} ${\n                  focusedIndex === index ? 'tip-advisor-item--focus' : ''\n                }`}\n                role=\"menuitem\"\n                tabIndex={-1}\n                onMouseEnter={() => handleItemHover(item, index)}\n                onMouseLeave={handleItemLeave}\n                onClick={() => handleItemClick(item)}\n              >\n                <span className=\"tip-advisor-item-content\">\n                  {renderHighlightedText(item.content, contentResult)}\n                </span>\n                {item.shortcut && (\n                  <kbd className=\"tip-advisor-item-shortcut\">\n                    {renderHighlightedText(item.shortcut, shortcutResult)}\n                  </kbd>\n                )}\n              </div>\n            ))\n          )}\n        </div>\n      </div>\n    </div>,\n    document.body\n  );\n});\n","import { useMemo } from 'react';\nimport type { CurrentStepData, TipMagicState } from '../types';\n\n/**\n * Hook that computes the current flow step data\n *\n * This hook derives the current step information including:\n * - The step itself (id, targetId, message, etc.)\n * - Navigation metadata (index, total, isFirst, isLast)\n *\n * @internal This hook is used internally by useHelperAPI\n */\nexport function useFlowState(state: TipMagicState): CurrentStepData | null {\n  return useMemo(() => {\n    if (!state.flow.active || state.flow.currentIndex < 0) {\n      return null;\n    }\n\n    const step = state.flow.steps[state.flow.currentIndex];\n    if (!step) {\n      return null;\n    }\n\n    return {\n      ...step,\n      index: state.flow.currentIndex,\n      total: state.flow.steps.length,\n      isFirst: state.flow.currentIndex === 0,\n      isLast: state.flow.currentIndex === state.flow.steps.length - 1,\n    };\n  }, [state.flow.active, state.flow.currentIndex, state.flow.steps]);\n}\n","import { useCallback, useMemo } from 'react';\nimport type { TipMagicAction } from '../context/TipMagicContext';\nimport type {\n  CurrentStepData,\n  FlowStep,\n  HelperAPI,\n  HelperShowOptions,\n  HelperState,\n  TipMagicState,\n} from '../types';\nimport { useFlowState } from './useFlowState';\n\n/**\n * Hook that provides the Helper API for programmatic helper/flow control\n *\n * @internal This hook is used internally by useTipMagic\n */\nexport function useHelperAPI(\n  state: TipMagicState,\n  dispatch: React.Dispatch<TipMagicAction>\n): HelperAPI {\n  // Show the helper with options\n  const helperShow = useCallback(\n    (options: HelperShowOptions) => {\n      dispatch({\n        type: 'SHOW_HELPER',\n        payload: {\n          state: options.state ?? 'informative',\n          message: options.message,\n          actions: options.actions,\n          targetId: options.targetId,\n          position: options.position ?? state.config.helperPosition,\n          autoHide: options.autoHide,\n        },\n      });\n    },\n    [dispatch, state.config.helperPosition]\n  );\n\n  // Hide the helper\n  const helperHide = useCallback(() => {\n    dispatch({ type: 'HIDE_HELPER' });\n  }, [dispatch]);\n\n  // Set helper state\n  const helperSetState = useCallback(\n    (helperState: HelperState) => {\n      dispatch({ type: 'SET_HELPER_STATE', payload: helperState });\n    },\n    [dispatch]\n  );\n\n  // Move helper to a target\n  const helperMoveTo = useCallback(\n    (targetId: string) => {\n      dispatch({ type: 'MOVE_HELPER', payload: targetId });\n    },\n    [dispatch]\n  );\n\n  // Start an automated flow\n  const helperStartFlow = useCallback(\n    (steps: FlowStep[]) => {\n      dispatch({ type: 'START_FLOW', payload: steps });\n    },\n    [dispatch]\n  );\n\n  // Move to next flow step\n  const helperNextStep = useCallback(() => {\n    dispatch({ type: 'NEXT_FLOW_STEP' });\n  }, [dispatch]);\n\n  // Move to a specific flow step\n  const helperGoToStep = useCallback(\n    (index: number) => {\n      dispatch({ type: 'SET_FLOW_STEP', payload: index });\n    },\n    [dispatch]\n  );\n\n  // End current flow\n  const helperEndFlow = useCallback(() => {\n    dispatch({ type: 'END_FLOW' });\n  }, [dispatch]);\n\n  // Get computed flow state\n  const currentStepData: CurrentStepData | null = useFlowState(state);\n\n  // Memoize the API object\n  return useMemo(\n    () => ({\n      show: helperShow,\n      hide: helperHide,\n      setState: helperSetState,\n      moveTo: helperMoveTo,\n      startFlow: helperStartFlow,\n      nextStep: helperNextStep,\n      goToStep: helperGoToStep,\n      endFlow: helperEndFlow,\n      currentStep: currentStepData,\n      currentStepIndex: state.flow.currentIndex,\n      steps: state.flow.steps,\n      isFlowActive: state.flow.active,\n      isVisible: state.helper.visible,\n      state: state.helper.state,\n    }),\n    [\n      helperShow,\n      helperHide,\n      helperSetState,\n      helperMoveTo,\n      helperStartFlow,\n      helperNextStep,\n      helperGoToStep,\n      helperEndFlow,\n      currentStepData,\n      state.flow.currentIndex,\n      state.flow.steps,\n      state.flow.active,\n      state.helper.visible,\n      state.helper.state,\n    ]\n  );\n}\n","import { useCallback, useMemo } from 'react';\nimport type { TipMagicAction } from '../context/TipMagicContext';\nimport type { ParsedTooltipData, TipMagicState, TooltipAPI, TooltipShowOptions } from '../types';\nimport { parseDataAttributes } from '../utils/parseDataAttributes';\n\n/**\n * Hook that provides the Tooltip API for programmatic tooltip control\n *\n * @internal This hook is used internally by useTipMagic\n */\nexport function useTooltipAPI(\n  state: TipMagicState,\n  dispatch: React.Dispatch<TipMagicAction>\n): TooltipAPI {\n  // Show tooltip for a target element\n  const tooltipShow = useCallback(\n    (target: Element | string, contentOrOptions?: string | TooltipShowOptions) => {\n      // Resolve target element\n      let element: Element | null = null;\n\n      if (typeof target === 'string') {\n        element = document.querySelector(target);\n      } else {\n        element = target;\n      }\n\n      if (!element) {\n        console.warn(`TipMagic: Could not find target element: ${target}`);\n        return;\n      }\n\n      const parsedData = parseDataAttributes(element);\n\n      // Handle string content or options object\n      let tooltipContent: string;\n      let options: TooltipShowOptions = {};\n\n      if (typeof contentOrOptions === 'string') {\n        tooltipContent = contentOrOptions;\n      } else if (contentOrOptions && typeof contentOrOptions === 'object') {\n        options = contentOrOptions;\n        tooltipContent = options.content ?? parsedData.content;\n      } else {\n        tooltipContent = parsedData.content;\n      }\n\n      if (!tooltipContent) {\n        console.warn('TipMagic: No content provided for tooltip');\n        return;\n      }\n\n      // Merge parsed data with options (options take precedence)\n      const mergedData: ParsedTooltipData = {\n        ...parsedData,\n        content: tooltipContent,\n        ...(options.placement !== undefined && { placement: options.placement }),\n        ...(options.showDelay !== undefined && { delay: options.showDelay }),\n        ...(options.hideDelay !== undefined && { hideDelay: options.hideDelay }),\n        ...(options.ellipsis !== undefined && { ellipsis: options.ellipsis }),\n        ...(options.maxLines !== undefined && { maxLines: options.maxLines }),\n        ...(options.wordWrap !== undefined && { wordWrap: options.wordWrap }),\n        ...(options.textBreak !== undefined && { textBreak: options.textBreak }),\n        ...(options.maxWidth !== undefined && { maxWidth: options.maxWidth }),\n        ...(options.html !== undefined && { html: options.html }),\n        ...(options.interactive !== undefined && { interactive: options.interactive }),\n        ...(options.transitionBehavior !== undefined && {\n          transitionBehavior: options.transitionBehavior,\n        }),\n        ...(options.moveTransitionDuration !== undefined && {\n          moveTransitionDuration: options.moveTransitionDuration,\n        }),\n        ...(options.showArrow !== undefined && { showArrow: options.showArrow }),\n        ...(options.shortcut !== undefined && { shortcut: options.shortcut }),\n        ...(options.role !== undefined && { role: options.role }),\n        ...(options.ariaLabelledBy !== undefined && { ariaLabelledBy: options.ariaLabelledBy }),\n        ...(options.autoFocus !== undefined && { autoFocus: options.autoFocus }),\n      };\n\n      if (state.tooltip.visible) {\n        // Check if we're updating the same target (content change, not position change)\n        const isSameTarget = state.tooltip.target === element;\n\n        if (isSameTarget) {\n          // Same target - just update content without move transition\n          dispatch({\n            type: 'SHOW_TOOLTIP',\n            payload: {\n              target: element,\n              content: tooltipContent,\n              parsedData: mergedData,\n            },\n          });\n        } else {\n          // Different target - use move transition\n          dispatch({\n            type: 'MOVE_TOOLTIP',\n            payload: {\n              target: element,\n              content: tooltipContent,\n              parsedData: mergedData,\n            },\n          });\n        }\n      } else {\n        dispatch({\n          type: 'SHOW_TOOLTIP',\n          payload: {\n            target: element,\n            content: tooltipContent,\n            parsedData: mergedData,\n          },\n        });\n      }\n    },\n    [state.tooltip.visible, state.tooltip.target, dispatch]\n  );\n\n  // Hide the tooltip\n  const tooltipHide = useCallback(() => {\n    dispatch({ type: 'HIDE_TOOLTIP' });\n  }, [dispatch]);\n\n  // Update tooltip content dynamically\n  const tooltipUpdateContent = useCallback(\n    (content: string) => {\n      dispatch({ type: 'UPDATE_TOOLTIP_CONTENT', payload: content });\n    },\n    [dispatch]\n  );\n\n  // Memoize the API object\n  return useMemo(\n    () => ({\n      show: tooltipShow,\n      hide: tooltipHide,\n      isVisible: state.tooltip.visible,\n      content: state.tooltip.content || null,\n      target: state.tooltip.target,\n      updateContent: tooltipUpdateContent,\n    }),\n    [\n      tooltipShow,\n      tooltipHide,\n      tooltipUpdateContent,\n      state.tooltip.visible,\n      state.tooltip.content,\n      state.tooltip.target,\n    ]\n  );\n}\n","import { useTipMagicContext } from '../context/TipMagicContext';\nimport type { UseTipMagicReturn } from '../types';\nimport { useHelperAPI } from './useHelperAPI';\nimport { useTooltipAPI } from './useTooltipAPI';\n\n/**\n * Main hook to interact with TipMagic programmatically\n *\n * Provides access to both the Tooltip and Helper APIs for controlling\n * tooltips and guided tours/flows.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n *   const { tooltip, helper } = useTipMagic();\n *\n *   const handleClick = () => {\n *     tooltip.show('#my-element', 'Custom tooltip content');\n *   };\n *\n *   return <button onClick={handleClick}>Show Tooltip</button>;\n * }\n * ```\n *\n * @example\n * ```tsx\n * // With options\n * tooltip.show('#my-element', {\n *   content: 'Tooltip with options',\n *   maxLines: 2,\n *   ellipsis: true,\n *   wordWrap: true,\n * });\n * ```\n *\n * @example\n * ```tsx\n * // Start a guided tour\n * helper.startFlow([\n *   { id: 'step-1', targetId: 'nav', message: 'Navigate here' },\n *   { id: 'step-2', targetId: 'search', message: 'Search for items' },\n * ]);\n * ```\n */\nexport function useTipMagic(): UseTipMagicReturn {\n  const { state, dispatch } = useTipMagicContext();\n\n  // Use composed hooks for tooltip and helper APIs\n  const tooltip = useTooltipAPI(state, dispatch);\n  const helper = useHelperAPI(state, dispatch);\n\n  return {\n    tooltip,\n    helper,\n    config: state.config,\n  };\n}\n","import type { TourNavigation } from '../../types/tour';\n\n/**\n * Default navigation configuration for tours\n */\nexport const DEFAULT_NAVIGATION: Required<TourNavigation> = {\n  showControls: false,\n  nextLabel: 'Next',\n  backLabel: 'Back',\n  finishLabel: 'Finish',\n  showClose: true,\n  autoFocus: 'panel',\n};\n\n/**\n * CSS class names used by the tour\n */\nexport const TOUR_CSS_CLASSES = {\n  BACKDROP: 'tip-magic-tour-backdrop',\n  FOCUS_TARGET: 'tip-magic-tour-focus-target',\n  ALWAYS_VISIBLE: 'tip-magic-tour-always-visible',\n  CONTENT: 'tip-magic-tour-content',\n  HEADER: 'tip-magic-tour-header',\n  TITLE: 'tip-magic-tour-title',\n  CLOSE: 'tip-magic-tour-close',\n  IMAGE: 'tip-magic-tour-image',\n  VIDEO: 'tip-magic-tour-video',\n  VIDEO_EMBED: 'tip-magic-tour-video-embed',\n  BODY: 'tip-magic-tour-body',\n  MESSAGE: 'tip-magic-tour-message',\n  FOOTER: 'tip-magic-tour-footer',\n  PROGRESS: 'tip-magic-tour-progress',\n  PROGRESS_RING: 'tip-magic-tour-progress-ring',\n  PROGRESS_RING_BG: 'tip-magic-tour-progress-ring-bg',\n  PROGRESS_RING_FILL: 'tip-magic-tour-progress-ring-fill',\n  PROGRESS_RING_TEXT: 'tip-magic-tour-progress-ring-text',\n  NAV: 'tip-magic-tour-nav',\n  BTN: 'tip-magic-tour-btn',\n  BTN_BACK: 'tip-magic-tour-btn-back',\n  BTN_NEXT: 'tip-magic-tour-btn-next',\n} as const;\n\n/**\n * Data attributes used for tour actions\n */\nexport const TOUR_DATA_ATTRIBUTES = {\n  ACTION: 'data-tour-action',\n  TIP_ID: 'data-tip-id',\n  /**\n   * Elements with this attribute will remain visible (not masked) during tour focus.\n   * Useful for headers, sidebars, and other persistent UI elements.\n   * @example <header data-tip-always-visible>...</header>\n   */\n  ALWAYS_VISIBLE: 'data-tip-always-visible',\n  /**\n   * Applied by the library to elevate the current step's target above the backdrop.\n   * An attribute rather than a class because React rewrites `class` wholesale on\n   * re-render and would drop it.\n   */\n  FOCUS: 'data-tip-magic-focus',\n  /** Applied by the library to elevate `data-tip-always-visible` elements */\n  ELEVATED: 'data-tip-magic-elevated',\n  /** Applied to the backdrop when it should capture pointer events */\n  BACKDROP_INTERACTIVE: 'data-tip-magic-backdrop-interactive',\n} as const;\n\n/**\n * Tour action values\n */\nexport const TOUR_ACTIONS = {\n  NEXT: 'next',\n  PREV: 'prev',\n  FINISH: 'finish',\n  CLOSE: 'close',\n} as const;\n","/**\n * Characters that have to be encoded to be safe in both element text and\n * double-quoted attribute values.\n */\nconst HTML_ESCAPES: Record<string, string> = {\n  '&': '&amp;',\n  '<': '&lt;',\n  '>': '&gt;',\n  '\"': '&quot;',\n  \"'\": '&#39;',\n};\n\n/**\n * Escape a value for interpolation into an HTML string\n *\n * Tour content is assembled as HTML and injected with `dangerouslySetInnerHTML`, so\n * anything the library interpolates on the consumer's behalf - titles, media URLs -\n * has to be encoded first.\n *\n * @param value - The raw value to escape\n * @returns The value with HTML-significant characters encoded\n *\n * @example\n * ```ts\n * escapeHtml('Tom & \"Jerry\"'); // 'Tom &amp; &quot;Jerry&quot;'\n * ```\n */\nexport function escapeHtml(value: string): string {\n  return value.replace(/[&<>\"']/g, (char) => HTML_ESCAPES[char]);\n}\n","import type { CurrentTourStep, TourStep } from '../../../types/tour';\nimport { escapeHtml } from '../../../utils/escapeHtml';\nimport { TOUR_DATA_ATTRIBUTES } from '../constants';\n\n/**\n * Filter steps based on their condition functions\n * Returns only steps where condition() returns true (or condition is undefined)\n *\n * @param steps - Array of tour steps\n * @returns Filtered array of visible steps\n */\nexport function filterVisibleSteps(steps: TourStep[]): TourStep[] {\n  return steps.filter((step) => !step.condition || step.condition());\n}\n\n/**\n * Find a step's target element in the document\n *\n * @param target - The target's data-tip-id value\n * @returns The element, or null if it is not in the DOM\n */\nexport function resolveTargetElement(target: string): HTMLElement | null {\n  // Quote and backslash would otherwise break out of the attribute selector\n  const escaped = target.replace(/[\"\\\\]/g, '\\\\$&');\n  return document.querySelector(`[${TOUR_DATA_ATTRIBUTES.TIP_ID}=\"${escaped}\"]`);\n}\n\n/**\n * Resolve step content - handles `text`, string content and function content\n *\n * `text` takes precedence and is HTML-escaped; `content` is passed through as the raw\n * HTML it is documented to be.\n *\n * @param step - The tour step\n * @param stepInfo - Current step metadata (without content)\n * @returns Resolved content string\n */\nexport function resolveStepContent(\n  step: TourStep,\n  stepInfo: Omit<CurrentTourStep, 'content'>\n): string {\n  if (step.text !== undefined) {\n    return escapeHtml(step.text);\n  }\n\n  if (step.content === undefined) {\n    return '';\n  }\n\n  return typeof step.content === 'function'\n    ? step.content(stepInfo as CurrentTourStep)\n    : step.content;\n}\n\n/**\n * Build CurrentTourStep data for a given index\n *\n * @param visibleSteps - Array of visible (filtered) steps\n * @param index - Index of the step to build\n * @returns CurrentTourStep data or null if index is invalid\n */\nexport function buildCurrentStep(visibleSteps: TourStep[], index: number): CurrentTourStep | null {\n  if (index < 0 || index >= visibleSteps.length) {\n    return null;\n  }\n\n  const step = visibleSteps[index];\n  const stepInfo: Omit<CurrentTourStep, 'content'> = {\n    index,\n    target: step.target,\n    title: step.title,\n    isFirst: index === 0,\n    isLast: index === visibleSteps.length - 1,\n    total: visibleSteps.length,\n  };\n\n  return {\n    ...stepInfo,\n    content: resolveStepContent(step, stepInfo),\n  };\n}\n\n/**\n * Calculate progress info for the tour\n *\n * @param isActive - Whether the tour is active\n * @param currentIndex - Current step index (0-based)\n * @param totalSteps - Total number of visible steps\n * @returns Progress object with current (1-based) and total\n */\nexport function calculateProgress(\n  isActive: boolean,\n  currentIndex: number,\n  totalSteps: number\n): { current: number; total: number } {\n  return {\n    current: isActive ? currentIndex + 1 : 0,\n    total: totalSteps,\n  };\n}\n","import type {\n  ProgressOptions,\n  ProgressType,\n  TourFocus,\n  TourNavigation,\n  TourStep,\n} from '../../../types/tour';\nimport { DEFAULT_NAVIGATION } from '../constants';\n\n/**\n * Default progress options\n */\nexport const DEFAULT_PROGRESS: Required<Omit<ProgressOptions, 'render'>> = {\n  show: false,\n  type: 'steps',\n};\n\n/**\n * Merge navigation config: defaults < tour-level < step-level\n *\n * @param tourNavigation - Tour-level navigation config\n * @param step - Current step (may have step-level overrides)\n * @returns Fully resolved navigation config\n */\nexport function getMergedNavigation(\n  tourNavigation: TourNavigation | undefined,\n  step: TourStep\n): Required<TourNavigation> {\n  return {\n    ...DEFAULT_NAVIGATION,\n    ...tourNavigation,\n    ...step.navigation,\n  };\n}\n\n/**\n * Fully resolved focus/backdrop configuration for a step\n */\nexport interface ResolvedTourFocus {\n  /** Whether the backdrop should be shown at all */\n  enabled: boolean;\n  /** Whether the backdrop should swallow clicks aimed at the app behind it */\n  block: boolean;\n  /** Whether clicking the backdrop ends the tour */\n  dismissOnClick: boolean;\n}\n\n/**\n * Resolve focus/backdrop options for a step: tour-level < step-level\n *\n * @param tourFocus - Tour-level focus setting\n * @param step - Current step (may have step-level override)\n * @returns Resolved focus configuration\n */\nexport function resolveFocus(tourFocus: TourFocus, step: TourStep): ResolvedTourFocus {\n  const value = step.focus !== undefined ? step.focus : tourFocus;\n\n  if (typeof value === 'boolean') {\n    return { enabled: value, block: false, dismissOnClick: false };\n  }\n\n  return {\n    enabled: true,\n    block: value.block ?? false,\n    dismissOnClick: value.dismissOnClick ?? false,\n  };\n}\n\n/**\n * Resolved progress options for a step\n */\nexport interface ResolvedProgressOptions {\n  show: boolean;\n  type: ProgressType;\n  render?: (props: { currentStep: number; totalSteps: number }) => string;\n}\n\n/**\n * Get merged progress options for a step\n *\n * @param tourProgress - Tour-level progress options\n * @param step - Current step (may have step-level overrides)\n * @returns Resolved progress options\n */\nexport function getMergedProgress(\n  tourProgress: ProgressOptions | undefined,\n  step: TourStep\n): ResolvedProgressOptions {\n  const base: ResolvedProgressOptions = {\n    ...DEFAULT_PROGRESS,\n    ...tourProgress,\n  };\n\n  // Step-level overrides\n  if (step.progress) {\n    if (step.progress.show !== undefined) {\n      base.show = step.progress.show;\n    }\n    if (step.progress.type !== undefined) {\n      base.type = step.progress.type;\n    }\n    if (step.progress.render !== undefined) {\n      base.render = step.progress.render;\n    }\n  }\n\n  return base;\n}\n\n/**\n * Check if a step has any navigation-related features enabled\n * (navigation controls, close button, media, or progress)\n *\n * @param nav - Merged navigation config\n * @param step - Current step\n * @param showProgress - Whether progress is enabled for this step\n * @returns Whether any navigation features are enabled\n */\nexport function hasNavigationFeatures(\n  nav: Required<TourNavigation>,\n  step: TourStep,\n  showProgress: boolean = false\n): boolean {\n  return nav.showControls || nav.showClose || !!step.image || !!step.video || showProgress;\n}\n","import type { CurrentTourStep, TourNavigation, TourStep } from '../../../types/tour';\nimport { PRIMARY_ACTION_ATTRIBUTE } from '../../../constants';\nimport { escapeHtml } from '../../../utils/escapeHtml';\nimport { TOUR_ACTIONS, TOUR_CSS_CLASSES } from '../constants';\nimport type { ResolvedProgressOptions } from './tourNavigation';\n\n/**\n * Build media HTML for a tour step (image or video)\n *\n * @param step - The tour step with optional image/video\n * @returns HTML string for the media element\n */\nexport function buildMediaHtml(step: TourStep): string {\n  if (step.video) {\n    const { src, type = 'native', autoplay = true, loop = true, muted = true } = step.video;\n\n    if (type === 'embed') {\n      // Embed video (YouTube, Vimeo, etc.)\n      return `<div class=\"${TOUR_CSS_CLASSES.VIDEO} ${TOUR_CSS_CLASSES.VIDEO_EMBED}\">\n        <iframe src=\"${escapeHtml(src)}\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n      </div>`;\n    } else {\n      // Native video (mp4, webm)\n      return `<div class=\"${TOUR_CSS_CLASSES.VIDEO}\">\n        <video ${autoplay ? 'autoplay' : ''} ${loop ? 'loop' : ''} ${muted ? 'muted' : ''} playsinline>\n          <source src=\"${escapeHtml(src)}\" type=\"video/mp4\">\n        </video>\n      </div>`;\n    }\n  }\n\n  if (step.image) {\n    return `<div class=\"${TOUR_CSS_CLASSES.IMAGE}\"><img src=\"${escapeHtml(step.image)}\" alt=\"\" /></div>`;\n  }\n\n  return '';\n}\n\n/**\n * Build header HTML for a tour step (title and close button)\n *\n * @param step - The tour step\n * @param nav - Navigation configuration\n * @param titleId - id to put on the title, for the panel's `aria-labelledby`. Must be\n *   unique on the page, so it is generated per tour rather than hardcoded.\n * @returns HTML string for the header\n */\nexport function buildHeaderHtml(\n  step: TourStep,\n  nav: Required<TourNavigation>,\n  titleId?: string\n): string {\n  const hasHeader = step.title || nav.showClose;\n\n  if (!hasHeader) {\n    return '';\n  }\n\n  const titleIdAttr = titleId ? ` id=\"${escapeHtml(titleId)}\"` : '';\n  const titleHtml = step.title\n    ? `<div class=\"${TOUR_CSS_CLASSES.TITLE}\"${titleIdAttr}>${escapeHtml(step.title)}</div>`\n    : '<div></div>';\n\n  return `<div class=\"${TOUR_CSS_CLASSES.HEADER}\">\n    ${titleHtml}\n    ${nav.showClose ? `<button type=\"button\" class=\"${TOUR_CSS_CLASSES.CLOSE}\" data-tour-action=\"${TOUR_ACTIONS.CLOSE}\" aria-label=\"Close\">×</button>` : ''}\n  </div>`;\n}\n\n/**\n * Build navigation HTML for a tour step (back/next buttons)\n *\n * @param stepInfo - Current step info with navigation metadata\n * @param nav - Navigation configuration\n * @returns HTML string for the navigation buttons\n */\nexport function buildNavHtml(stepInfo: CurrentTourStep, nav: Required<TourNavigation>): string {\n  if (!nav.showControls) {\n    return '';\n  }\n\n  const backButton = !stepInfo.isFirst\n    ? `<button type=\"button\" class=\"${TOUR_CSS_CLASSES.BTN} ${TOUR_CSS_CLASSES.BTN_BACK}\" data-tour-action=\"${TOUR_ACTIONS.PREV}\">${nav.backLabel}</button>`\n    : '';\n\n  const nextAction = stepInfo.isLast ? TOUR_ACTIONS.FINISH : TOUR_ACTIONS.NEXT;\n  const nextLabel = stepInfo.isLast ? nav.finishLabel : nav.nextLabel;\n  const nextButton = `<button type=\"button\" class=\"${TOUR_CSS_CLASSES.BTN} ${TOUR_CSS_CLASSES.BTN_NEXT}\" data-tour-action=\"${nextAction}\" ${PRIMARY_ACTION_ATTRIBUTE}>${nextLabel}</button>`;\n\n  return `<div class=\"${TOUR_CSS_CLASSES.NAV}\">\n    ${backButton}\n    ${nextButton}\n  </div>`;\n}\n\n/**\n * Build text-based progress indicator HTML (e.g., \"Step 1 of 5\")\n *\n * @param currentStep - Current step number (1-based)\n * @param totalSteps - Total number of steps\n * @returns HTML string for the text progress indicator\n */\nexport function buildStepsProgressHtml(currentStep: number, totalSteps: number): string {\n  return `<div class=\"${TOUR_CSS_CLASSES.PROGRESS}\">Step ${currentStep} of ${totalSteps}</div>`;\n}\n\n/**\n * Build ring/circular progress indicator HTML\n *\n * @param currentStep - Current step number (1-based)\n * @param totalSteps - Total number of steps\n * @returns HTML string for the ring progress indicator\n */\nexport function buildRingProgressHtml(currentStep: number, totalSteps: number): string {\n  // SVG ring calculations\n  const size = 32; // Matches CSS variable default\n  const strokeWidth = 3;\n  const radius = (size - strokeWidth) / 2;\n  const circumference = 2 * Math.PI * radius;\n  const progress = currentStep / totalSteps;\n  const dashOffset = circumference * (1 - progress);\n\n  return `<div class=\"${TOUR_CSS_CLASSES.PROGRESS_RING}\">\n    <svg viewBox=\"0 0 ${size} ${size}\">\n      <circle \n        class=\"${TOUR_CSS_CLASSES.PROGRESS_RING_BG}\"\n        cx=\"${size / 2}\" \n        cy=\"${size / 2}\" \n        r=\"${radius}\"\n      />\n      <circle \n        class=\"${TOUR_CSS_CLASSES.PROGRESS_RING_FILL}\"\n        cx=\"${size / 2}\" \n        cy=\"${size / 2}\" \n        r=\"${radius}\"\n        stroke-dasharray=\"${circumference}\"\n        stroke-dashoffset=\"${dashOffset}\"\n      />\n    </svg>\n    <span class=\"${TOUR_CSS_CLASSES.PROGRESS_RING_TEXT}\">${currentStep}/${totalSteps}</span>\n  </div>`;\n}\n\n/**\n * Build progress indicator HTML based on options\n *\n * @param stepInfo - Current step info with progress metadata\n * @param progressOptions - Progress configuration\n * @returns HTML string for the progress indicator\n */\nexport function buildProgressHtml(\n  stepInfo: CurrentTourStep,\n  progressOptions: ResolvedProgressOptions\n): string {\n  const currentStep = stepInfo.index + 1;\n  const totalSteps = stepInfo.total;\n\n  // Custom render function takes priority\n  if (progressOptions.render) {\n    return progressOptions.render({ currentStep, totalSteps });\n  }\n\n  // Built-in types\n  switch (progressOptions.type) {\n    case 'ring':\n      return buildRingProgressHtml(currentStep, totalSteps);\n    case 'steps':\n    default:\n      return buildStepsProgressHtml(currentStep, totalSteps);\n  }\n}\n\n/**\n * Build footer HTML containing progress and/or navigation\n *\n * @param stepInfo - Current step info\n * @param nav - Navigation configuration\n * @param progressOptions - Progress configuration (null if not shown)\n * @returns HTML string for the footer\n */\nexport function buildFooterHtml(\n  stepInfo: CurrentTourStep,\n  nav: Required<TourNavigation>,\n  progressOptions: ResolvedProgressOptions | null\n): string {\n  const hasNavigation = nav.showControls;\n  const showProgress = progressOptions?.show ?? false;\n\n  // No footer needed if neither progress nor navigation\n  if (!showProgress && !hasNavigation) {\n    return '';\n  }\n\n  // Only navigation, no progress - return just nav\n  if (!showProgress && hasNavigation) {\n    return buildNavHtml(stepInfo, nav);\n  }\n\n  // Only progress, no navigation\n  if (showProgress && progressOptions && !hasNavigation) {\n    return `<div class=\"${TOUR_CSS_CLASSES.FOOTER}\">\n      ${buildProgressHtml(stepInfo, progressOptions)}\n    </div>`;\n  }\n\n  // Both progress and navigation - use footer layout\n  if (showProgress && progressOptions) {\n    return `<div class=\"${TOUR_CSS_CLASSES.FOOTER}\">\n      ${buildProgressHtml(stepInfo, progressOptions)}\n      ${buildNavHtml(stepInfo, nav)}\n    </div>`;\n  }\n\n  return '';\n}\n\n/**\n * Build the complete HTML content for a tour step with navigation controls\n *\n * @param step - The tour step\n * @param stepInfo - Current step info with navigation metadata\n * @param nav - Navigation configuration\n * @param resolvedContent - The resolved content string\n * @param progressOptions - Progress configuration (null if not shown)\n * @param titleId - id for the title element, for the panel's `aria-labelledby`\n * @returns Complete HTML string for the tooltip content\n */\nexport function buildTourContent(\n  step: TourStep,\n  stepInfo: CurrentTourStep,\n  nav: Required<TourNavigation>,\n  resolvedContent: string,\n  progressOptions: ResolvedProgressOptions | null = null,\n  titleId?: string\n): string {\n  const hasHeader = step.title || nav.showClose;\n  const hasNavigation = nav.showControls;\n  const hasMedia = step.image || step.video;\n  const showProgress = progressOptions?.show ?? false;\n  const hasFooter = hasNavigation || showProgress;\n\n  // If no navigation features are used, return simple content\n  if (!hasHeader && !hasMedia && !hasFooter) {\n    return resolvedContent;\n  }\n\n  const headerHtml = buildHeaderHtml(step, nav, titleId);\n  const mediaHtml = buildMediaHtml(step);\n  const footerHtml = buildFooterHtml(stepInfo, nav, progressOptions);\n\n  return `<div class=\"${TOUR_CSS_CLASSES.CONTENT}\">\n    ${headerHtml}\n    ${mediaHtml}\n    <div class=\"${TOUR_CSS_CLASSES.BODY}\">\n      <div class=\"${TOUR_CSS_CLASSES.MESSAGE}\">${resolvedContent}</div>\n    </div>\n    ${footerHtml}\n  </div>`;\n}\n","import { TOUR_CSS_CLASSES, TOUR_DATA_ATTRIBUTES } from '../constants';\n\n/**\n * Options for showing the backdrop\n */\nexport interface BackdropShowOptions {\n  /** Whether the backdrop should capture pointer events instead of letting them through */\n  blockInteraction?: boolean;\n  /** Called when the backdrop itself is clicked (only reachable when blockInteraction is set) */\n  onClick?: () => void;\n}\n\n/**\n * BackdropManager handles the creation and cleanup of the tour backdrop\n * and focus target elements. It's designed as a class to encapsulate\n * the mutable DOM references.\n *\n * Elevation is applied as both a class and a data attribute. The stylesheet keys off\n * the attribute: React rewrites the whole `class` attribute when a component\n * re-renders, which would otherwise drop the elevation and leave the target masked by\n * the backdrop while the tour keeps running.\n */\nexport class BackdropManager {\n  private backdropElement: HTMLDivElement | null = null;\n  private focusTargetElement: HTMLElement | null = null;\n  private alwaysVisibleElements: Element[] = [];\n  private clickHandler: (() => void) | null = null;\n\n  /**\n   * Check if backdrop is currently visible\n   */\n  get isVisible(): boolean {\n    return this.backdropElement !== null;\n  }\n\n  /**\n   * Get the current focus target element\n   */\n  get currentFocusTarget(): HTMLElement | null {\n    return this.focusTargetElement;\n  }\n\n  /**\n   * Show the backdrop overlay and elevate the target element\n   *\n   * @param targetElement - The element to elevate above the backdrop\n   * @param options - Pointer interaction options\n   */\n  show(targetElement: HTMLElement, options: BackdropShowOptions = {}): void {\n    // Clean up previous focus target first\n    this.cleanupFocusTarget();\n\n    // Create backdrop if it doesn't exist\n    if (!this.backdropElement) {\n      const backdrop = document.createElement('div');\n      backdrop.className = TOUR_CSS_CLASSES.BACKDROP;\n      backdrop.addEventListener('click', this.handleBackdropClick);\n      document.body.appendChild(backdrop);\n      this.backdropElement = backdrop;\n    }\n\n    // A dismissible backdrop has to receive the click in order to act on it\n    const shouldBlock = Boolean(options.blockInteraction || options.onClick);\n    if (shouldBlock) {\n      this.backdropElement.setAttribute(TOUR_DATA_ATTRIBUTES.BACKDROP_INTERACTIVE, '');\n    } else {\n      this.backdropElement.removeAttribute(TOUR_DATA_ATTRIBUTES.BACKDROP_INTERACTIVE);\n    }\n    this.clickHandler = options.onClick ?? null;\n\n    // Elevate target above backdrop\n    elevate(targetElement, TOUR_CSS_CLASSES.FOCUS_TARGET, TOUR_DATA_ATTRIBUTES.FOCUS);\n    this.focusTargetElement = targetElement;\n\n    // Find and elevate all elements with data-tip-always-visible\n    this.elevateAlwaysVisibleElements();\n  }\n\n  /**\n   * Hide the backdrop overlay and clean up focus target\n   */\n  hide(): void {\n    // Remove backdrop element\n    if (this.backdropElement) {\n      this.backdropElement.removeEventListener('click', this.handleBackdropClick);\n      this.backdropElement.remove();\n      this.backdropElement = null;\n    }\n    this.clickHandler = null;\n\n    // Clean up focus target\n    this.cleanupFocusTarget();\n\n    // Clean up always-visible elements\n    this.cleanupAlwaysVisibleElements();\n  }\n\n  /**\n   * Clean up only the focus target (remove class and attribute)\n   */\n  cleanupFocusTarget(): void {\n    if (this.focusTargetElement) {\n      unelevate(this.focusTargetElement, TOUR_CSS_CLASSES.FOCUS_TARGET, TOUR_DATA_ATTRIBUTES.FOCUS);\n      this.focusTargetElement = null;\n    }\n  }\n\n  /**\n   * Re-apply elevation to the focus target\n   *\n   * Called when the host app rewrites the target's `class` attribute, which drops the\n   * library's class alongside its own. Deliberately does not touch the always-visible\n   * set: those elements are unrelated to the target's class changes, whose frequency the\n   * host app controls.\n   */\n  reapplyFocusTarget(): void {\n    if (this.focusTargetElement) {\n      elevate(this.focusTargetElement, TOUR_CSS_CLASSES.FOCUS_TARGET, TOUR_DATA_ATTRIBUTES.FOCUS);\n    }\n  }\n\n  /**\n   * Re-apply elevation to every tracked always-visible element\n   */\n  reapplyAlwaysVisible(): void {\n    this.alwaysVisibleElements.forEach((element) => {\n      elevate(element, TOUR_CSS_CLASSES.ALWAYS_VISIBLE, TOUR_DATA_ATTRIBUTES.ELEVATED);\n    });\n  }\n\n  /**\n   * Handle a click on the backdrop itself\n   */\n  private handleBackdropClick = (): void => {\n    this.clickHandler?.();\n  };\n\n  /**\n   * Find and elevate all elements with data-tip-always-visible attribute\n   */\n  private elevateAlwaysVisibleElements(): void {\n    // Clean up any previously elevated elements first\n    this.cleanupAlwaysVisibleElements();\n\n    // Find all elements with the always-visible attribute\n    const elements = document.querySelectorAll(`[${TOUR_DATA_ATTRIBUTES.ALWAYS_VISIBLE}]`);\n\n    elements.forEach((element) => {\n      elevate(element, TOUR_CSS_CLASSES.ALWAYS_VISIBLE, TOUR_DATA_ATTRIBUTES.ELEVATED);\n      this.alwaysVisibleElements.push(element);\n    });\n  }\n\n  /**\n   * Remove the always-visible class and attribute from all tracked elements\n   */\n  private cleanupAlwaysVisibleElements(): void {\n    this.alwaysVisibleElements.forEach((element) => {\n      unelevate(element, TOUR_CSS_CLASSES.ALWAYS_VISIBLE, TOUR_DATA_ATTRIBUTES.ELEVATED);\n    });\n    this.alwaysVisibleElements = [];\n  }\n\n  /**\n   * Full cleanup - call on unmount\n   */\n  destroy(): void {\n    this.hide();\n  }\n}\n\n/**\n * Mark an element as elevated above the backdrop\n *\n * Writes only when something is actually missing. `DOMTokenList.add` re-sets the\n * `class` attribute even when the token is already present, which would notify the\n * tour's target watcher, which would call back into here - an unbroken loop of\n * mutation records.\n */\nfunction elevate(element: Element, className: string, attribute: string): void {\n  if (!element.classList.contains(className)) {\n    element.classList.add(className);\n  }\n  if (!element.hasAttribute(attribute)) {\n    element.setAttribute(attribute, '');\n  }\n}\n\n/**\n * Remove the elevation markers from an element\n */\nfunction unelevate(element: Element, className: string, attribute: string): void {\n  element.classList.remove(className);\n  element.removeAttribute(attribute);\n}\n\n/**\n * Create a new BackdropManager instance\n */\nexport function createBackdropManager(): BackdropManager {\n  return new BackdropManager();\n}\n","/**\n * HighlightManager handles adding/removing highlight classes from tour targets\n */\nexport class HighlightManager {\n  private currentElement: Element | null = null;\n  private highlightClass: string | undefined;\n\n  constructor(highlightClass?: string) {\n    this.highlightClass = highlightClass;\n  }\n\n  /**\n   * Update the highlight class (e.g., if config changes)\n   */\n  setHighlightClass(highlightClass: string | undefined): void {\n    // If class changed and we have a highlighted element, update it\n    if (this.currentElement && this.highlightClass !== highlightClass) {\n      if (this.highlightClass) {\n        this.currentElement.classList.remove(this.highlightClass);\n      }\n      if (highlightClass) {\n        this.currentElement.classList.add(highlightClass);\n      }\n    }\n    this.highlightClass = highlightClass;\n  }\n\n  /**\n   * Get the current highlight class\n   */\n  getHighlightClass(): string | undefined {\n    return this.highlightClass;\n  }\n\n  /**\n   * Highlight a new element (removes highlight from previous element)\n   *\n   * @param element - The element to highlight\n   */\n  highlight(element: Element): void {\n    if (!this.highlightClass) return;\n\n    // Remove from previous\n    if (this.currentElement) {\n      this.currentElement.classList.remove(this.highlightClass);\n    }\n\n    // Add to new\n    element.classList.add(this.highlightClass);\n    this.currentElement = element;\n  }\n\n  /**\n   * Re-apply the highlight class to the current element\n   *\n   * The class is the consumer's own styling hook, so it has to stay a class rather\n   * than move to a data attribute. That leaves it exposed to React rewriting the\n   * target's `class` attribute, which the tour's target watcher recovers from by\n   * calling this.\n   */\n  reapply(): void {\n    if (!this.currentElement || !this.highlightClass) {\n      return;\n    }\n\n    // Only write when the class is actually missing. `DOMTokenList.add` re-sets the\n    // `class` attribute even for a token that is already there, which would notify the\n    // watcher that called this and loop.\n    if (!this.currentElement.classList.contains(this.highlightClass)) {\n      this.currentElement.classList.add(this.highlightClass);\n    }\n  }\n\n  /**\n   * Clear any current highlight\n   */\n  clear(): void {\n    if (this.currentElement && this.highlightClass) {\n      this.currentElement.classList.remove(this.highlightClass);\n      this.currentElement = null;\n    }\n  }\n\n  /**\n   * Full cleanup - call on unmount\n   */\n  destroy(): void {\n    this.clear();\n  }\n}\n\n/**\n * Create a new HighlightManager instance\n */\nexport function createHighlightManager(highlightClass?: string): HighlightManager {\n  return new HighlightManager(highlightClass);\n}\n","/**\n * Callbacks invoked by a {@link TargetWatcher}\n */\nexport interface TargetWatcherCallbacks {\n  /**\n   * The watched element's class attribute was rewritten by the host app.\n   *\n   * Optional: leave it out and no attribute observer is registered at all. Only supply\n   * it when there is a class whose loss has a visible effect - a consumer's\n   * `highlightClass`. The library's own elevation rides on a data attribute, which\n   * React cannot clobber, so it needs no repair.\n   */\n  onClassRewritten?: () => void;\n  /** The watched element left the document */\n  onDetached: () => void;\n}\n\n/**\n * TargetWatcher observes the current tour target for the ways a running tour loses it.\n *\n * **Detachment.** Without this, the backdrop stays up over an app with nothing\n * highlighted and the panel collapses into the viewport corner. Watching the target's\n * parent is not enough: removing an ancestor several levels up never mutates the\n * target's own parent. But it does mutate *that ancestor's* parent, so observing the\n * whole ancestor chain with `childList` catches every removal that can detach the\n * target - and, because no `subtree` is used, nothing else.\n *\n * That distinction is the reason for the chain walk rather than a single\n * `observe(document.body, { subtree: true })`. A document-wide subtree observer makes\n * the browser allocate and queue a MutationRecord for every DOM change anywhere in the\n * host app for the life of the tour; in a data-heavy app that is continuous garbage for\n * records that are read once and discarded. The chain costs one observer registration\n * per ancestor - depth, not app size - and zero records for mutations that cannot\n * possibly affect the target.\n *\n * The chain stops at the light-DOM boundary, which is not a limitation in practice:\n * `document.querySelector` cannot resolve a target inside a shadow root either, so a\n * tour target is always in the light DOM.\n */\nexport class TargetWatcher {\n  private classObserver: MutationObserver | null = null;\n  private chainObserver: MutationObserver | null = null;\n  private element: Element | null = null;\n\n  /**\n   * Start watching an element, replacing any previous subject\n   *\n   * @param element - The element to watch\n   * @param callbacks - Handlers for the loss modes\n   */\n  watch(element: Element, callbacks: TargetWatcherCallbacks): void {\n    this.unwatch();\n\n    // Not available in every non-browser environment the library may be rendered in\n    if (typeof MutationObserver === 'undefined') {\n      return;\n    }\n\n    this.element = element;\n\n    const { onClassRewritten } = callbacks;\n    if (onClassRewritten) {\n      this.classObserver = new MutationObserver(() => onClassRewritten());\n      this.classObserver.observe(element, {\n        attributes: true,\n        attributeFilter: ['class'],\n      });\n    }\n\n    this.chainObserver = new MutationObserver(() => {\n      if (!element.isConnected) {\n        // Stop before notifying - the handler ends or advances the tour\n        this.unwatch();\n        callbacks.onDetached();\n        return;\n      }\n      // Still attached, so the element was moved rather than removed: follow it\n      this.observeChain();\n    });\n    this.observeChain();\n  }\n\n  /**\n   * Stop watching the current element\n   */\n  unwatch(): void {\n    this.classObserver?.disconnect();\n    this.classObserver = null;\n    this.chainObserver?.disconnect();\n    this.chainObserver = null;\n    this.element = null;\n  }\n\n  /**\n   * Full cleanup - call on unmount\n   */\n  destroy(): void {\n    this.unwatch();\n  }\n\n  /**\n   * (Re)register the chain observer against every ancestor of the target\n   */\n  private observeChain(): void {\n    const observer = this.chainObserver;\n    const element = this.element;\n    if (!observer || !element) {\n      return;\n    }\n\n    observer.disconnect();\n    for (let node = element.parentElement; node; node = node.parentElement) {\n      observer.observe(node, { childList: true });\n    }\n  }\n}\n\n/**\n * Create a new TargetWatcher instance\n */\nexport function createTargetWatcher(): TargetWatcher {\n  return new TargetWatcher();\n}\n","import { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport type { TooltipShowOptions } from '../../types';\nimport type {\n  CurrentTourStep,\n  TourDirection,\n  TourOptions,\n  TourProgress,\n  TourTargetMissingAction,\n  UseTourReturn,\n} from '../../types/tour';\nimport { generateTooltipId } from '../../utils/parseDataAttributes';\nimport { useTipMagic } from '../useTipMagic';\nimport { TOUR_ACTIONS, TOUR_DATA_ATTRIBUTES } from './constants';\nimport {\n  buildCurrentStep,\n  buildTourContent,\n  calculateProgress,\n  createBackdropManager,\n  createHighlightManager,\n  createTargetWatcher,\n  filterVisibleSteps,\n  getMergedNavigation,\n  getMergedProgress,\n  hasNavigationFeatures,\n  resolveFocus,\n  resolveStepContent,\n  resolveTargetElement,\n} from './utils';\n\n/**\n * A step that can render, and the element it renders against\n */\ninterface ResolvedStep {\n  index: number;\n  element: HTMLElement;\n}\n\n/**\n * How each entry point recovers when a step's target is not in the DOM.\n *\n * The distinction matters: forward motion has nowhere to fall back to, so an\n * unresolvable run ends the tour, but going back or jumping happens while the current\n * step is still rendering fine, so failing there should leave it untouched. An explicit\n * jump additionally never skips - landing on a step the caller did not ask for is worse\n * than not moving.\n */\nconst TOUR_RECOVERY: Record<\n  TourDirection,\n  { delta: 1 | -1; allowSkip: boolean; onExhausted: 'end' | 'stay' }\n> = {\n  next: { delta: 1, allowSkip: true, onExhausted: 'end' },\n  prev: { delta: -1, allowSkip: true, onExhausted: 'stay' },\n  jump: { delta: 1, allowSkip: false, onExhausted: 'stay' },\n};\n\n/**\n * Simplified hook for creating guided tours\n *\n * Combines step management, tooltip integration, and navigation into a single,\n * headless API. Users define steps and get back ready-to-use state and controls.\n *\n * @example\n * ```tsx\n * // Simple usage\n * const tour = useTour({\n *   steps: [\n *     { target: 'sidebar', content: 'Navigate from here' },\n *     { target: 'search', content: 'Search for items' },\n *     { target: 'profile', content: 'Your account settings' },\n *   ],\n * });\n *\n * return (\n *   <>\n *     <button onClick={tour.start}>Start Tour</button>\n *\n *     {tour.isActive && (\n *       <div className=\"tour-controls\">\n *         <span>{tour.progress.current} of {tour.progress.total}</span>\n *         <button onClick={tour.prev} disabled={tour.currentStep?.isFirst}>Back</button>\n *         <button onClick={tour.next}>\n *           {tour.currentStep?.isLast ? 'Finish' : 'Next'}\n *         </button>\n *         <button onClick={tour.end}>Exit</button>\n *       </div>\n *     )}\n *\n *     <Dashboard />\n *   </>\n * );\n * ```\n *\n * @example\n * ```tsx\n * // Built-in controls instead of your own\n * const tour = useTour({\n *   steps: [\n *     { target: 'sidebar', content: 'Navigate from here' },\n *     { target: 'search', content: 'Search for items' },\n *   ],\n *   navigation: { showControls: true },\n *   progress: { show: true },\n * });\n * ```\n *\n * @example\n * ```tsx\n * // Advanced usage with callbacks\n * const tour = useTour({\n *   steps: [\n *     {\n *       target: 'sidebar',\n *       title: 'Navigation',\n *       content: 'Access all sections here',\n *       placement: 'right',\n *       onEnter: () => analytics.track('tour_step_1'),\n *     },\n *     {\n *       target: 'search',\n *       content: (step) => `Step ${step.index + 1}: Search here`,\n *       condition: () => hasSearchFeature,\n *     },\n *   ],\n *   onStart: () => console.log('Tour started'),\n *   onEnd: (completed) => console.log(completed ? 'Completed!' : 'Skipped'),\n *   onStepChange: (step, direction) => trackStep(step),\n *   onTargetMissing: (step) => logger.warn('missing target', step.target),\n *   tooltipOptions: { placement: 'bottom', interactive: true },\n *   autoScroll: true,\n * });\n *\n * // start() reports whether the tour actually opened\n * if (tour.start()) {\n *   markTourAsSeen();\n * }\n * ```\n */\nexport function useTour(options: TourOptions): UseTourReturn {\n  const {\n    steps,\n    onStart,\n    onEnd,\n    onStepChange,\n    onTargetMissing,\n    tooltipOptions,\n    autoScroll = true,\n    highlightClass,\n    navigation,\n    focus: tourFocus = false,\n    progress: tourProgress,\n  } = options;\n\n  const { tooltip, helper, config } = useTipMagic();\n\n  // Internal state\n  const [isActive, setIsActive] = useState(false);\n  const [currentIndex, setCurrentIndex] = useState(-1);\n\n  // Keep refs of the state that's read from callbacks and observers, always up to date\n  const currentIndexRef = useRef(currentIndex);\n  currentIndexRef.current = currentIndex;\n  const isActiveRef = useRef(isActive);\n  isActiveRef.current = isActive;\n\n  // DOM managers (created once and reused)\n  const backdropManagerRef = useRef(createBackdropManager());\n  const highlightManagerRef = useRef(\n    createHighlightManager(highlightClass ?? config.tourHighlightClass)\n  );\n  const targetWatcherRef = useRef(createTargetWatcher());\n\n  // One id per tour instance for the panel's aria-labelledby. Generated rather than\n  // hardcoded so it cannot collide with an id the host page already owns, and held for\n  // the instance rather than per step so the label does not churn between steps.\n  const titleIdRef = useRef('');\n  if (!titleIdRef.current) {\n    titleIdRef.current = `${generateTooltipId()}-title`;\n  }\n\n  // Refs for navigation handlers to avoid stale closures\n  const nextRef = useRef<() => void>(() => {});\n  const prevRef = useRef<() => void>(() => {});\n  const endRef = useRef<() => void>(() => {});\n  const targetLostRef = useRef<() => void>(() => {});\n\n  // Compute visible steps (filter out steps with condition returning false)\n  const visibleSteps = useMemo(() => filterVisibleSteps(steps), [steps]);\n\n  // Get the effective highlight class (from options or provider config)\n  const effectiveHighlightClass = highlightClass ?? config.tourHighlightClass;\n\n  // Update highlight manager when class changes\n  useEffect(() => {\n    highlightManagerRef.current.setHighlightClass(effectiveHighlightClass);\n  }, [effectiveHighlightClass]);\n\n  /**\n   * Report a target that could not be resolved, and ask how to recover\n   *\n   * The console warning is the fallback for consumers who have not supplied a handler;\n   * hosts that ban `console.*` provide `onTargetMissing` and route it themselves.\n   */\n  const notifyTargetMissing = useCallback(\n    (step: CurrentTourStep): TourTargetMissingAction | void => {\n      if (onTargetMissing) {\n        return onTargetMissing(step);\n      }\n      console.warn(`useTour: Could not find target element with data-tip-id=\"${step.target}\"`);\n    },\n    [onTargetMissing]\n  );\n\n  /**\n   * Find a step that can actually render, starting at an index\n   *\n   * Returns the element alongside the index so callers do not have to query the document\n   * a second time for the target this just proved exists.\n   *\n   * @param fromIndex - Where to start looking\n   * @param delta - Direction to walk (1 forward, -1 backward)\n   * @param allowSkip - Whether `onTargetMissing` may move past an unresolvable step.\n   *   False for an explicit jump, which should land where it was asked to or nowhere.\n   * @returns The step and its element, or null if there is none to continue with\n   */\n  const findResolvableStep = useCallback(\n    (fromIndex: number, delta: 1 | -1, allowSkip: boolean): ResolvedStep | null => {\n      for (let index = fromIndex; index >= 0 && index < visibleSteps.length; index += delta) {\n        const element = resolveTargetElement(visibleSteps[index].target);\n        if (element) {\n          return { index, element };\n        }\n\n        const stepData = buildCurrentStep(visibleSteps, index);\n        if (!stepData) {\n          return null;\n        }\n\n        const action = notifyTargetMissing(stepData);\n        if (!allowSkip || action !== 'skip') {\n          return null;\n        }\n      }\n\n      return null;\n    },\n    [visibleSteps, notifyTargetMissing]\n  );\n\n  /**\n   * Show tooltip for a step\n   *\n   * The target element is resolved by the caller, so this is only ever reached for a\n   * step that can actually render.\n   */\n  const showStepTooltip = useCallback(\n    (stepIndex: number, targetElement: HTMLElement) => {\n      const step = visibleSteps[stepIndex];\n      const currentStepData = buildCurrentStep(visibleSteps, stepIndex);\n      if (!step || !currentStepData) return;\n\n      // Highlight element\n      highlightManagerRef.current.highlight(targetElement);\n\n      // Handle focus/backdrop\n      const focusOptions = resolveFocus(tourFocus, step);\n      if (focusOptions.enabled) {\n        backdropManagerRef.current.show(targetElement, {\n          blockInteraction: focusOptions.block,\n          onClick: focusOptions.dismissOnClick ? () => endRef.current() : undefined,\n        });\n      } else {\n        backdropManagerRef.current.hide();\n      }\n\n      // Notice when the target is unmounted, and - only when there is a consumer class\n      // that would be lost - when the host app rewrites its className\n      targetWatcherRef.current.watch(targetElement, {\n        onDetached: () => targetLostRef.current(),\n        ...(effectiveHighlightClass && {\n          onClassRewritten: () => {\n            highlightManagerRef.current.reapply();\n            backdropManagerRef.current.reapplyFocusTarget();\n          },\n        }),\n      });\n\n      // Scroll into view if enabled\n      if (autoScroll) {\n        targetElement.scrollIntoView({\n          behavior: 'smooth',\n          block: 'center',\n        });\n      }\n\n      // Get merged navigation config\n      const mergedNav = getMergedNavigation(navigation, step);\n\n      // Get merged progress options for this step\n      const progressOptions = getMergedProgress(tourProgress, step);\n      const showProgress = progressOptions.show;\n\n      // Resolve content\n      const resolvedContent = resolveStepContent(step, currentStepData);\n\n      // Build tour content with navigation if needed\n      const hasNavFeatures = hasNavigationFeatures(mergedNav, step, showProgress);\n      const finalContent = hasNavFeatures\n        ? buildTourContent(\n            step,\n            currentStepData,\n            mergedNav,\n            resolvedContent,\n            showProgress ? progressOptions : null,\n            titleIdRef.current\n          )\n        : resolvedContent;\n\n      // Merge tooltip options: tour panel defaults < tour options < step overrides <\n      // the values the tour panel cannot function without\n      const mergedOptions: TooltipShowOptions = {\n        // The panel holds prose, a header row and a nav row - it has to be able to wrap.\n        // Overridable, unlike the forced values below.\n        ...(hasNavFeatures && { wordWrap: true }),\n        ...tooltipOptions,\n        ...step.tooltipOptions,\n        content: finalContent,\n        placement: step.placement ?? tooltipOptions?.placement,\n        // Enable html and interactive when using navigation features, and present the\n        // panel as a dialog - role=\"tooltip\" is a description, so screen readers would\n        // not expose the buttons inside it\n        ...(hasNavFeatures && {\n          html: true,\n          interactive: true,\n          role: 'dialog' as const,\n          ariaLabelledBy: step.title ? titleIdRef.current : undefined,\n          autoFocus: mergedNav.autoFocus,\n        }),\n      };\n\n      // Show the tooltip\n      tooltip.show(targetElement, mergedOptions);\n    },\n    [\n      visibleSteps,\n      tooltip,\n      tooltipOptions,\n      autoScroll,\n      tourFocus,\n      tourProgress,\n      navigation,\n      effectiveHighlightClass,\n    ]\n  );\n\n  /**\n   * Clean up highlight, backdrop, watcher, and hide tooltip\n   */\n  const cleanup = useCallback(() => {\n    tooltip.hide();\n    targetWatcherRef.current.unwatch();\n    backdropManagerRef.current.hide();\n    highlightManagerRef.current.clear();\n  }, [tooltip]);\n\n  /**\n   * Tear the tour down and report the outcome\n   */\n  const finishTour = useCallback(\n    (completed: boolean) => {\n      // Use ref for current index to always get latest value\n      const idx = currentIndexRef.current;\n\n      // Call onExit for current step\n      const currentStep = visibleSteps[idx];\n      if (currentStep?.onExit) {\n        currentStep.onExit();\n      }\n\n      cleanup();\n      helper.endFlow();\n      setIsActive(false);\n      isActiveRef.current = false;\n      setCurrentIndex(-1);\n      currentIndexRef.current = -1;\n\n      if (onEnd) {\n        onEnd(completed);\n      }\n    },\n    [visibleSteps, cleanup, helper, onEnd]\n  );\n\n  /**\n   * Navigate to a specific step\n   *\n   * @returns Whether the tour moved\n   */\n  const navigateToStep = useCallback(\n    (newIndex: number, direction: TourDirection): boolean => {\n      if (newIndex < 0 || newIndex >= visibleSteps.length) {\n        return false;\n      }\n\n      // A step whose target has gone missing must not leave the previous step's\n      // highlight, backdrop and content on screen while the index moves on\n      const recovery = TOUR_RECOVERY[direction];\n      const resolved = findResolvableStep(newIndex, recovery.delta, recovery.allowSkip);\n\n      if (!resolved) {\n        // Only forward motion ends the tour. Going back or jumping while the current\n        // step is still rendering fine should leave it alone.\n        if (recovery.onExhausted === 'end') {\n          finishTour(false);\n        }\n        return false;\n      }\n\n      const { index: targetIndex, element: targetElement } = resolved;\n\n      // Use ref for current index to get the previous step\n      const prevIdx = currentIndexRef.current;\n      const previousStep = visibleSteps[prevIdx];\n      const nextStep = visibleSteps[targetIndex];\n\n      // Call onExit for previous step\n      if (previousStep?.onExit) {\n        previousStep.onExit();\n      }\n\n      // Update state\n      setCurrentIndex(targetIndex);\n      currentIndexRef.current = targetIndex;\n\n      // Keep the helper flow on the same step, even when steps were skipped\n      helper.goToStep(targetIndex);\n\n      // Show tooltip for new step\n      showStepTooltip(targetIndex, targetElement);\n\n      // Call onEnter for new step\n      if (nextStep?.onEnter) {\n        nextStep.onEnter();\n      }\n\n      // Call onStepChange callback\n      const currentStepData = buildCurrentStep(visibleSteps, targetIndex);\n      if (currentStepData && onStepChange) {\n        onStepChange(currentStepData, direction);\n      }\n\n      return true;\n    },\n    [visibleSteps, showStepTooltip, onStepChange, findResolvableStep, finishTour, helper]\n  );\n\n  /**\n   * Start the tour\n   */\n  const start = useCallback((): boolean => {\n    if (visibleSteps.length === 0) {\n      console.warn('useTour: No steps available to start the tour');\n      return false;\n    }\n\n    // Resolve before mutating anything: a tour that cannot render must not report\n    // itself as started, or consumers using onStart to mark it seen retire a tour the\n    // user never saw\n    const resolved = findResolvableStep(0, 1, true);\n    if (!resolved) {\n      return false;\n    }\n\n    const { index: startIndex, element: targetElement } = resolved;\n\n    setIsActive(true);\n    isActiveRef.current = true;\n    setCurrentIndex(startIndex);\n    currentIndexRef.current = startIndex;\n\n    // Sync with helper flow state\n    const flowSteps = visibleSteps.map((step, index) => ({\n      id: `tour-step-${index}`,\n      targetId: step.target,\n      message: step.text ?? (typeof step.content === 'string' ? step.content : ''),\n    }));\n    helper.startFlow(flowSteps);\n    // startFlow always opens at 0; a skipped first step means we are elsewhere\n    if (startIndex !== 0) {\n      helper.goToStep(startIndex);\n    }\n\n    // Show first step tooltip\n    showStepTooltip(startIndex, targetElement);\n\n    // Call onEnter for first step\n    const firstStep = visibleSteps[startIndex];\n    if (firstStep?.onEnter) {\n      firstStep.onEnter();\n    }\n\n    // Call onStart callback\n    if (onStart) {\n      onStart();\n    }\n\n    // Call onStepChange for initial step\n    const currentStepData = buildCurrentStep(visibleSteps, startIndex);\n    if (currentStepData && onStepChange) {\n      onStepChange(currentStepData, 'next');\n    }\n\n    return true;\n  }, [visibleSteps, helper, showStepTooltip, onStart, onStepChange, findResolvableStep]);\n\n  /**\n   * End the tour (incomplete)\n   */\n  const end = useCallback(() => {\n    if (!isActiveRef.current) return;\n\n    finishTour(false);\n  }, [finishTour]);\n\n  /**\n   * Go to next step\n   */\n  const next = useCallback(() => {\n    if (!isActiveRef.current) return;\n\n    // Use ref for current index to always get latest value\n    const idx = currentIndexRef.current;\n    const isLastStep = idx === visibleSteps.length - 1;\n\n    if (isLastStep) {\n      // End tour as complete\n      finishTour(true);\n    } else {\n      navigateToStep(idx + 1, 'next');\n    }\n  }, [visibleSteps.length, navigateToStep, finishTour]);\n\n  /**\n   * Go to previous step\n   *\n   * A no-op if the previous step cannot render - the tour stays where it is rather than\n   * ending, since the current step is still fine.\n   */\n  const prev = useCallback(() => {\n    // Use ref for current index to always get latest value\n    const idx = currentIndexRef.current;\n    if (!isActiveRef.current || idx === 0) return;\n\n    navigateToStep(idx - 1, 'prev');\n  }, [navigateToStep]);\n\n  /**\n   * Recover from the current step's target leaving the DOM\n   */\n  const handleTargetLost = useCallback(() => {\n    if (!isActiveRef.current) return;\n\n    const idx = currentIndexRef.current;\n    const stepData = buildCurrentStep(visibleSteps, idx);\n    const action = stepData ? notifyTargetMissing(stepData) : undefined;\n\n    if (action === 'skip' && idx + 1 < visibleSteps.length) {\n      navigateToStep(idx + 1, 'next');\n      return;\n    }\n\n    finishTour(false);\n  }, [visibleSteps, notifyTargetMissing, navigateToStep, finishTour]);\n\n  // Update refs synchronously during render (before any effects run)\n  nextRef.current = next;\n  prevRef.current = prev;\n  endRef.current = end;\n  targetLostRef.current = handleTargetLost;\n\n  /**\n   * Jump to a specific step\n   *\n   * Never lands anywhere other than the requested index: an explicit jump that quietly\n   * arrives somewhere else is worse than one that does nothing and reports it.\n   *\n   * @returns Whether the tour moved to the requested step\n   */\n  const goTo = useCallback(\n    (index: number): boolean => {\n      if (!isActiveRef.current) return false;\n\n      if (index < 0 || index >= visibleSteps.length) {\n        console.warn(\n          `useTour: Invalid step index ${index}. Valid range: 0-${visibleSteps.length - 1}`\n        );\n        return false;\n      }\n\n      // Use ref for current index to always get latest value\n      if (index === currentIndexRef.current) return true;\n\n      return navigateToStep(index, 'jump');\n    },\n    [visibleSteps.length, navigateToStep]\n  );\n\n  // Build current step data\n  const currentStep = useMemo((): CurrentTourStep | null => {\n    if (!isActive || currentIndex < 0) {\n      return null;\n    }\n    return buildCurrentStep(visibleSteps, currentIndex);\n  }, [isActive, currentIndex, visibleSteps]);\n\n  // Progress info\n  const progress = useMemo(\n    (): TourProgress => calculateProgress(isActive, currentIndex, visibleSteps.length),\n    [isActive, currentIndex, visibleSteps.length]\n  );\n\n  // Handle navigation button activation via data-tour-action attributes\n  useEffect(() => {\n    if (!isActive) return;\n\n    /**\n     * Run the data-tour-action carried by the event's target, if any\n     */\n    const runAction = (e: MouseEvent) => {\n      const target = e.target as HTMLElement | null;\n\n      // Find the closest element with data-tour-action (handles clicks on child elements)\n      const actionElement = target?.closest(`[${TOUR_DATA_ATTRIBUTES.ACTION}]`);\n      const action = actionElement?.getAttribute(TOUR_DATA_ATTRIBUTES.ACTION);\n      if (!action) return;\n\n      // Prevent default and stop propagation\n      e.preventDefault();\n      e.stopPropagation();\n\n      // Call the action handler directly (refs are updated during render)\n      switch (action) {\n        case TOUR_ACTIONS.NEXT:\n        case TOUR_ACTIONS.FINISH:\n          nextRef.current();\n          break;\n        case TOUR_ACTIONS.PREV:\n          prevRef.current();\n          break;\n        case TOUR_ACTIONS.CLOSE:\n          endRef.current();\n          break;\n      }\n    };\n\n    /**\n     * Keyboard activation.\n     *\n     * Enter or Space on a focused button fires `click` and never `mousedown`, so the\n     * pointer listener alone leaves the panel's controls announced but inert. A click\n     * produced by keyboard activation reports `detail === 0`; a pointer click reports\n     * `>= 1` and has already been handled on mousedown, so this cannot double-fire.\n     */\n    const handleClick = (e: MouseEvent) => {\n      if (e.detail !== 0) return;\n      runAction(e);\n    };\n\n    // Pointer activation stays on mousedown, which reacts before the press can move focus\n    document.addEventListener('mousedown', runAction);\n    document.addEventListener('click', handleClick);\n    return () => {\n      document.removeEventListener('mousedown', runAction);\n      document.removeEventListener('click', handleClick);\n    };\n  }, [isActive]);\n\n  // Handle ESC key to end the tour\n  useEffect(() => {\n    if (!isActive) return;\n\n    const handleKeyDown = (e: KeyboardEvent) => {\n      if (e.key === 'Escape') {\n        e.preventDefault();\n        endRef.current();\n      }\n    };\n\n    document.addEventListener('keydown', handleKeyDown);\n    return () => document.removeEventListener('keydown', handleKeyDown);\n  }, [isActive]);\n\n  // Cleanup on unmount\n  useEffect(() => {\n    const backdropManager = backdropManagerRef.current;\n    const highlightManager = highlightManagerRef.current;\n    const targetWatcher = targetWatcherRef.current;\n    return () => {\n      targetWatcher.destroy();\n      backdropManager.destroy();\n      highlightManager.destroy();\n    };\n  }, []);\n\n  return useMemo(\n    () => ({\n      start,\n      end,\n      next,\n      prev,\n      goTo,\n      isActive,\n      currentStep,\n      totalSteps: visibleSteps.length,\n      progress,\n    }),\n    [start, end, next, prev, goTo, isActive, currentStep, visibleSteps.length, progress]\n  );\n}\n","import { useCallback, useRef } from 'react';\nimport type { TipAdvisorAPI } from '../types/tipAdvisor';\n\n/**\n * Hook for programmatic control of the TipAdvisor component.\n *\n * This hook provides a ref that can be passed to a TipAdvisor component\n * to control it from a parent component.\n *\n * @example\n * ```tsx\n * function App() {\n *   const advisor = useTipAdvisor();\n *\n *   return (\n *     <TipMagicProvider>\n *       <button onClick={advisor.toggle}>\n *         Show Shortcuts (F1)\n *       </button>\n *       <Toolbar />\n *       <TipAdvisor ref={advisor.ref} position=\"bottom-right\" />\n *     </TipMagicProvider>\n *   );\n * }\n * ```\n */\nexport function useTipAdvisor() {\n  const ref = useRef<TipAdvisorAPI>(null);\n\n  const open = useCallback(() => {\n    ref.current?.open();\n  }, []);\n\n  const close = useCallback(() => {\n    ref.current?.close();\n  }, []);\n\n  const toggle = useCallback(() => {\n    ref.current?.toggle();\n  }, []);\n\n  return {\n    /** Ref to pass to TipAdvisor component */\n    ref,\n    /** Open the TipAdvisor */\n    open,\n    /** Close the TipAdvisor */\n    close,\n    /** Toggle the TipAdvisor */\n    toggle,\n  };\n}\n","import type { Placement, TextBreak, TooltipTransitionBehavior } from '../types';\n\n/**\n * Options for configuring a tooltip via data attributes\n */\nexport interface TipPropsOptions {\n  /** Tooltip content (required) */\n  tip: string;\n  /** Unique identifier for the tooltip target */\n  id?: string;\n  /** Tooltip placement relative to target */\n  placement?: Placement;\n  /** Delay before showing tooltip (ms) */\n  showDelay?: number;\n  /** Delay before hiding tooltip (ms) */\n  hideDelay?: number;\n  /** Disable the tooltip */\n  disabled?: boolean;\n  /** Enable text truncation with ellipsis */\n  ellipsis?: boolean;\n  /** Maximum lines before truncation */\n  maxLines?: number;\n  /** Enable word wrapping */\n  wordWrap?: boolean;\n  /**\n   * Text break behavior - controls where words can break\n   * - 'normal': Break at word boundaries (default)\n   * - 'break-all': Can break in middle of words (for long URLs, codes)\n   * - 'keep-all': Don't break CJK characters (for Asian languages)\n   */\n  textBreak?: TextBreak;\n  /** Maximum width in pixels */\n  maxWidth?: number;\n  /** Parse content as HTML */\n  html?: boolean;\n  /** Keep tooltip visible when hovering over it */\n  interactive?: boolean;\n  /** Transition behavior when moving between targets */\n  transitionBehavior?: TooltipTransitionBehavior;\n  /** Duration of move transition animation (ms) */\n  moveTransitionDuration?: number;\n  /** Show or hide the arrow (default: true) */\n  showArrow?: boolean;\n  /** Keyboard shortcut to display alongside the tooltip content */\n  shortcut?: string;\n  /** Show tooltip when element receives keyboard focus */\n  showOnFocus?: boolean;\n}\n\n/**\n * Return type of getTipProps - data attributes for tooltip\n */\nexport interface TipPropsResult {\n  'data-tip': string;\n  'data-tip-id'?: string;\n  'data-tip-placement'?: Placement;\n  'data-tip-delay'?: string;\n  'data-tip-hide-delay'?: string;\n  'data-tip-disabled'?: '';\n  'data-tip-ellipsis'?: '';\n  'data-tip-max-lines'?: string;\n  'data-tip-word-wrap'?: '';\n  'data-tip-text-break'?: TextBreak;\n  'data-tip-max-width'?: string;\n  'data-tip-html'?: '';\n  'data-tip-interactive'?: '';\n  'data-tip-move'?: '';\n  'data-tip-jump'?: '';\n  'data-tip-move-duration'?: string;\n  'data-tip-no-arrow'?: '';\n  'data-tip-shortcut'?: string;\n  'data-tip-show-on-focus'?: '';\n}\n\n/**\n * Creates data attribute props for a tooltip.\n * Use this to configure tooltips with TypeScript support and spread onto elements.\n *\n * @example\n * ```tsx\n * const tipProps = getTipProps({\n *   tip: 'Save changes',\n *   placement: 'bottom',\n *   showDelay: 100,\n * });\n *\n * <button {...tipProps}>Save</button>\n * ```\n *\n * @example\n * ```tsx\n * // With keyboard shortcut\n * const tipProps = getTipProps({\n *   tip: 'Copy',\n *   shortcut: '⌘C',\n *   hideDelay: 500,\n * });\n *\n * <button {...tipProps}>Copy</button>\n * ```\n */\nexport function getTipProps(options: TipPropsOptions): TipPropsResult {\n  const result: TipPropsResult = {\n    'data-tip': options.tip,\n  };\n\n  if (options.id !== undefined) {\n    result['data-tip-id'] = options.id;\n  }\n\n  if (options.placement !== undefined) {\n    result['data-tip-placement'] = options.placement;\n  }\n\n  if (options.showDelay !== undefined) {\n    result['data-tip-delay'] = String(options.showDelay);\n  }\n\n  if (options.hideDelay !== undefined) {\n    result['data-tip-hide-delay'] = String(options.hideDelay);\n  }\n\n  if (options.disabled) {\n    result['data-tip-disabled'] = '';\n  }\n\n  if (options.ellipsis) {\n    result['data-tip-ellipsis'] = '';\n  }\n\n  if (options.maxLines !== undefined) {\n    result['data-tip-max-lines'] = String(options.maxLines);\n  }\n\n  if (options.wordWrap) {\n    result['data-tip-word-wrap'] = '';\n  }\n\n  if (options.textBreak !== undefined && options.textBreak !== 'normal') {\n    result['data-tip-text-break'] = options.textBreak;\n  }\n\n  if (options.maxWidth !== undefined) {\n    result['data-tip-max-width'] = String(options.maxWidth);\n  }\n\n  if (options.html) {\n    result['data-tip-html'] = '';\n  }\n\n  if (options.interactive) {\n    result['data-tip-interactive'] = '';\n  }\n\n  if (options.transitionBehavior === 'move') {\n    result['data-tip-move'] = '';\n  } else if (options.transitionBehavior === 'jump') {\n    result['data-tip-jump'] = '';\n  }\n\n  if (options.moveTransitionDuration !== undefined) {\n    result['data-tip-move-duration'] = String(options.moveTransitionDuration);\n  }\n\n  if (options.showArrow === false) {\n    result['data-tip-no-arrow'] = '';\n  }\n\n  if (options.shortcut !== undefined && options.shortcut !== '') {\n    result['data-tip-shortcut'] = options.shortcut;\n  }\n\n  if (options.showOnFocus) {\n    result['data-tip-show-on-focus'] = '';\n  }\n\n  return result;\n}\n"],"x_google_ignoreList":[4,5,6,7,8,9,10,19],"mappings":"qvBAUA,IAAa,GAAY,CACvB,aAAc,IACd,aAAc,IACd,cAAe,IACf,eAAgB,IAChB,aAAc,GAChB,EAyCa,GAAc,CACzB,QAAS,oBACT,gBAAiB,oBACjB,aAAc,iBACd,cAAe,kBACf,iBAAkB,qBAClB,gBAAiB,oBACjB,eAAgB,mBAChB,sBAAuB,0BACvB,OAAQ,mBACR,UAAW,qBACb,EAKa,GAA2B,yBAK3B,GAAmB,aAKnB,GAA6C,CACxD,UAAW,IACX,UAAW,IACX,kBAAmB,GAAU,aAC7B,UAAW,MACX,OAAQ,EACR,aAAc,GACd,eAAgB,eAChB,OAAQ,KACR,SAAU,GACV,gBAAiB,KACjB,oBAAqB,GACrB,qBAAsB,GACtB,mBAAoB,OACpB,uBAAwB,GAAU,cAClC,mBAAoB,GACpB,YAAa,EACf,EC1EM,GAAoC,CACxC,QAAS,GACT,QAAS,GACT,OAAQ,KACR,SAAU,CAAE,EAAG,EAAG,EAAG,CAAE,EACvB,UAAW,MACX,gBAAiB,GACjB,WAAY,KACZ,cAAe,MACjB,EAKM,GAA0C,CAC9C,QAAS,GACT,MAAO,OACP,QAAS,OACT,QAAS,OACT,SA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