{"ast":null,"code":"import _objectWithoutProperties from \"@babel/runtime/helpers/objectWithoutProperties\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _slicedToArray from \"@babel/runtime/helpers/slicedToArray\";\nvar _excluded = [\"ref\"],\n    _excluded2 = [\"children\"];\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n\nfunction _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nimport $bmn4K$react, { useRef as $bmn4K$useRef, useContext as $bmn4K$useContext, useEffect as $bmn4K$useEffect, useState as $bmn4K$useState } from \"react\";\nimport { useLayoutEffect as $bmn4K$useLayoutEffect, runAfterTransition as $bmn4K$runAfterTransition, focusWithoutScrolling as $bmn4K$focusWithoutScrolling, mergeProps as $bmn4K$mergeProps, useSyncRef as $bmn4K$useSyncRef } from \"@react-aria/utils\";\nimport { getInteractionModality as $bmn4K$getInteractionModality, isFocusVisible as $bmn4K$isFocusVisible, useFocusVisibleListener as $bmn4K$useFocusVisibleListener, useFocus as $bmn4K$useFocus, useFocusWithin as $bmn4K$useFocusWithin, useKeyboard as $bmn4K$useKeyboard } from \"@react-aria/interactions\";\nimport $bmn4K$clsx from \"clsx\";\n\nfunction $parcel$export(e, n, v, s) {\n  Object.defineProperty(e, n, {\n    get: v,\n    set: s,\n    enumerable: true,\n    configurable: true\n  });\n}\n\nvar $0238e4b796d1715f$exports = {};\n$parcel$export($0238e4b796d1715f$exports, \"FocusScope\", function () {\n  return $0238e4b796d1715f$export$20e40289641fbbb6;\n});\n$parcel$export($0238e4b796d1715f$exports, \"useFocusManager\", function () {\n  return $0238e4b796d1715f$export$10c5169755ce7bd7;\n});\n$parcel$export($0238e4b796d1715f$exports, \"getFocusableTreeWalker\", function () {\n  return $0238e4b796d1715f$export$2d6ec8fc375ceafa;\n});\n$parcel$export($0238e4b796d1715f$exports, \"createFocusManager\", function () {\n  return $0238e4b796d1715f$export$c5251b9e124bf29;\n});\nvar $f2c1256fdcfd2c09$exports = {};\n$parcel$export($f2c1256fdcfd2c09$exports, \"focusSafely\", function () {\n  return $f2c1256fdcfd2c09$export$80f3e147d781571c;\n});\n\nfunction $f2c1256fdcfd2c09$export$80f3e147d781571c(element) {\n  if ($bmn4K$getInteractionModality() === 'virtual') {\n    var lastFocusedElement = document.activeElement;\n    $bmn4K$runAfterTransition(function () {\n      if (document.activeElement === lastFocusedElement && document.contains(element)) $bmn4K$focusWithoutScrolling(element);\n    });\n  } else $bmn4K$focusWithoutScrolling(element);\n}\n\nfunction $c5775c2d6be42e6d$var$isStyleVisible(element) {\n  if (!(element instanceof HTMLElement) && !(element instanceof SVGElement)) return false;\n  var _element$style = element.style,\n      display = _element$style.display,\n      visibility = _element$style.visibility;\n  var isVisible = display !== 'none' && visibility !== 'hidden' && visibility !== 'collapse';\n\n  if (isVisible) {\n    var getComputedStyle = element.ownerDocument.defaultView.getComputedStyle;\n\n    var _getComputedStyle = getComputedStyle(element),\n        computedDisplay = _getComputedStyle.display,\n        computedVisibility = _getComputedStyle.visibility;\n\n    isVisible = computedDisplay !== 'none' && computedVisibility !== 'hidden' && computedVisibility !== 'collapse';\n  }\n\n  return isVisible;\n}\n\nfunction $c5775c2d6be42e6d$var$isAttributeVisible(element, childElement) {\n  return !element.hasAttribute('hidden') && (element.nodeName === 'DETAILS' && childElement && childElement.nodeName !== 'SUMMARY' ? element.hasAttribute('open') : true);\n}\n\nfunction $c5775c2d6be42e6d$export$e989c0fffaa6b27a(element, childElement) {\n  return element.nodeName !== '#comment' && $c5775c2d6be42e6d$var$isStyleVisible(element) && $c5775c2d6be42e6d$var$isAttributeVisible(element, childElement) && (!element.parentElement || $c5775c2d6be42e6d$export$e989c0fffaa6b27a(element.parentElement, element));\n}\n\nvar $0238e4b796d1715f$var$FocusContext = $bmn4K$react.createContext(null);\nvar $0238e4b796d1715f$var$activeScope = null;\nvar $0238e4b796d1715f$var$scopes = new Map();\n\nfunction $0238e4b796d1715f$export$20e40289641fbbb6(props) {\n  var children = props.children,\n      contain = props.contain,\n      restoreFocus = props.restoreFocus,\n      autoFocus = props.autoFocus;\n  var startRef = $bmn4K$useRef();\n  var endRef = $bmn4K$useRef();\n  var scopeRef = $bmn4K$useRef([]);\n  var ctx = $bmn4K$useContext($0238e4b796d1715f$var$FocusContext);\n  var parentScope = ctx == null ? void 0 : ctx.scopeRef;\n  $bmn4K$useLayoutEffect(function () {\n    var node = startRef.current.nextSibling;\n    var nodes = [];\n\n    while (node && node !== endRef.current) {\n      nodes.push(node);\n      node = node.nextSibling;\n    }\n\n    scopeRef.current = nodes;\n  }, [children, parentScope]);\n  $bmn4K$useLayoutEffect(function () {\n    $0238e4b796d1715f$var$scopes.set(scopeRef, parentScope);\n    return function () {\n      if ((scopeRef === $0238e4b796d1715f$var$activeScope || $0238e4b796d1715f$var$isAncestorScope(scopeRef, $0238e4b796d1715f$var$activeScope)) && (!parentScope || $0238e4b796d1715f$var$scopes.has(parentScope))) $0238e4b796d1715f$var$activeScope = parentScope;\n      $0238e4b796d1715f$var$scopes.delete(scopeRef);\n    };\n  }, [scopeRef, parentScope]);\n  $0238e4b796d1715f$var$useFocusContainment(scopeRef, contain);\n  $0238e4b796d1715f$var$useRestoreFocus(scopeRef, restoreFocus, contain);\n  $0238e4b796d1715f$var$useAutoFocus(scopeRef, autoFocus);\n  var focusManager = $0238e4b796d1715f$var$createFocusManagerForScope(scopeRef);\n  return $bmn4K$react.createElement($0238e4b796d1715f$var$FocusContext.Provider, {\n    value: {\n      scopeRef: scopeRef,\n      focusManager: focusManager\n    }\n  }, $bmn4K$react.createElement(\"span\", {\n    \"data-focus-scope-start\": true,\n    hidden: true,\n    ref: startRef\n  }), children, $bmn4K$react.createElement(\"span\", {\n    \"data-focus-scope-end\": true,\n    hidden: true,\n    ref: endRef\n  }));\n}\n\nfunction $0238e4b796d1715f$export$10c5169755ce7bd7() {\n  var _$bmn4K$useContext;\n\n  return (_$bmn4K$useContext = $bmn4K$useContext($0238e4b796d1715f$var$FocusContext)) == null ? void 0 : _$bmn4K$useContext.focusManager;\n}\n\nfunction $0238e4b796d1715f$var$createFocusManagerForScope(scopeRef) {\n  return {\n    focusNext: function focusNext() {\n      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n      var scope = scopeRef.current;\n      var from = opts.from,\n          tabbable = opts.tabbable,\n          wrap = opts.wrap;\n      var node = from || document.activeElement;\n      var sentinel = scope[0].previousElementSibling;\n      var walker = $0238e4b796d1715f$export$2d6ec8fc375ceafa($0238e4b796d1715f$var$getScopeRoot(scope), {\n        tabbable: tabbable\n      }, scope);\n      walker.currentNode = $0238e4b796d1715f$var$isElementInScope(node, scope) ? node : sentinel;\n      var nextNode = walker.nextNode();\n\n      if (!nextNode && wrap) {\n        walker.currentNode = sentinel;\n        nextNode = walker.nextNode();\n      }\n\n      if (nextNode) $0238e4b796d1715f$var$focusElement(nextNode, true);\n      return nextNode;\n    },\n    focusPrevious: function focusPrevious() {\n      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n      var scope = scopeRef.current;\n      var from = opts.from,\n          tabbable = opts.tabbable,\n          wrap = opts.wrap;\n      var node = from || document.activeElement;\n      var sentinel = scope[scope.length - 1].nextElementSibling;\n      var walker = $0238e4b796d1715f$export$2d6ec8fc375ceafa($0238e4b796d1715f$var$getScopeRoot(scope), {\n        tabbable: tabbable\n      }, scope);\n      walker.currentNode = $0238e4b796d1715f$var$isElementInScope(node, scope) ? node : sentinel;\n      var previousNode = walker.previousNode();\n\n      if (!previousNode && wrap) {\n        walker.currentNode = sentinel;\n        previousNode = walker.previousNode();\n      }\n\n      if (previousNode) $0238e4b796d1715f$var$focusElement(previousNode, true);\n      return previousNode;\n    },\n    focusFirst: function focusFirst() {\n      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n      var scope = scopeRef.current;\n      var tabbable = opts.tabbable;\n      var walker = $0238e4b796d1715f$export$2d6ec8fc375ceafa($0238e4b796d1715f$var$getScopeRoot(scope), {\n        tabbable: tabbable\n      }, scope);\n      walker.currentNode = scope[0].previousElementSibling;\n      var nextNode = walker.nextNode();\n      if (nextNode) $0238e4b796d1715f$var$focusElement(nextNode, true);\n      return nextNode;\n    },\n    focusLast: function focusLast() {\n      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n      var scope = scopeRef.current;\n      var tabbable = opts.tabbable;\n      var walker = $0238e4b796d1715f$export$2d6ec8fc375ceafa($0238e4b796d1715f$var$getScopeRoot(scope), {\n        tabbable: tabbable\n      }, scope);\n      walker.currentNode = scope[scope.length - 1].nextElementSibling;\n      var previousNode = walker.previousNode();\n      if (previousNode) $0238e4b796d1715f$var$focusElement(previousNode, true);\n      return previousNode;\n    }\n  };\n}\n\nvar $0238e4b796d1715f$var$focusableElements = ['input:not([disabled]):not([type=hidden])', 'select:not([disabled])', 'textarea:not([disabled])', 'button:not([disabled])', 'a[href]', 'area[href]', 'summary', 'iframe', 'object', 'embed', 'audio[controls]', 'video[controls]', '[contenteditable]'];\nvar $0238e4b796d1715f$var$FOCUSABLE_ELEMENT_SELECTOR = $0238e4b796d1715f$var$focusableElements.join(':not([hidden]),') + ',[tabindex]:not([disabled]):not([hidden])';\n$0238e4b796d1715f$var$focusableElements.push('[tabindex]:not([tabindex=\"-1\"]):not([disabled])');\nvar $0238e4b796d1715f$var$TABBABLE_ELEMENT_SELECTOR = $0238e4b796d1715f$var$focusableElements.join(':not([hidden]):not([tabindex=\"-1\"]),');\n\nfunction $0238e4b796d1715f$var$getScopeRoot(scope) {\n  return scope[0].parentElement;\n}\n\nfunction $0238e4b796d1715f$var$useFocusContainment(scopeRef, contain) {\n  var focusedNode = $bmn4K$useRef();\n  var raf = $bmn4K$useRef(null);\n  $bmn4K$useLayoutEffect(function () {\n    var scope1 = scopeRef.current;\n    if (!contain) return;\n\n    var onKeyDown = function onKeyDown(e) {\n      if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey || scopeRef !== $0238e4b796d1715f$var$activeScope) return;\n      var focusedElement = document.activeElement;\n      var scope = scopeRef.current;\n      if (!$0238e4b796d1715f$var$isElementInScope(focusedElement, scope)) return;\n      var walker = $0238e4b796d1715f$export$2d6ec8fc375ceafa($0238e4b796d1715f$var$getScopeRoot(scope), {\n        tabbable: true\n      }, scope);\n      walker.currentNode = focusedElement;\n      var nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();\n\n      if (!nextElement) {\n        walker.currentNode = e.shiftKey ? scope[scope.length - 1].nextElementSibling : scope[0].previousElementSibling;\n        nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();\n      }\n\n      e.preventDefault();\n      if (nextElement) $0238e4b796d1715f$var$focusElement(nextElement, true);\n    };\n\n    var onFocus = function onFocus(e) {\n      if (!$0238e4b796d1715f$var$activeScope || $0238e4b796d1715f$var$isAncestorScope($0238e4b796d1715f$var$activeScope, scopeRef)) {\n        $0238e4b796d1715f$var$activeScope = scopeRef;\n        focusedNode.current = e.target;\n      } else if (scopeRef === $0238e4b796d1715f$var$activeScope && !$0238e4b796d1715f$var$isElementInChildScope(e.target, scopeRef)) {\n        if (focusedNode.current) focusedNode.current.focus();else if ($0238e4b796d1715f$var$activeScope) $0238e4b796d1715f$var$focusFirstInScope($0238e4b796d1715f$var$activeScope.current);\n      } else if (scopeRef === $0238e4b796d1715f$var$activeScope) focusedNode.current = e.target;\n    };\n\n    var onBlur = function onBlur(e) {\n      raf.current = requestAnimationFrame(function () {\n        if (scopeRef === $0238e4b796d1715f$var$activeScope && !$0238e4b796d1715f$var$isElementInChildScope(document.activeElement, scopeRef)) {\n          $0238e4b796d1715f$var$activeScope = scopeRef;\n          focusedNode.current = e.target;\n          focusedNode.current.focus();\n        }\n      });\n    };\n\n    document.addEventListener('keydown', onKeyDown, false);\n    document.addEventListener('focusin', onFocus, false);\n    scope1.forEach(function (element) {\n      return element.addEventListener('focusin', onFocus, false);\n    });\n    scope1.forEach(function (element) {\n      return element.addEventListener('focusout', onBlur, false);\n    });\n    return function () {\n      document.removeEventListener('keydown', onKeyDown, false);\n      document.removeEventListener('focusin', onFocus, false);\n      scope1.forEach(function (element) {\n        return element.removeEventListener('focusin', onFocus, false);\n      });\n      scope1.forEach(function (element) {\n        return element.removeEventListener('focusout', onBlur, false);\n      });\n    };\n  }, [scopeRef, contain]);\n  $bmn4K$useEffect(function () {\n    return function () {\n      return cancelAnimationFrame(raf.current);\n    };\n  }, [raf]);\n}\n\nfunction $0238e4b796d1715f$var$isElementInAnyScope(element) {\n  for (var _iterator = _createForOfIteratorHelperLoose($0238e4b796d1715f$var$scopes.keys()), _step; !(_step = _iterator()).done;) {\n    var scope = _step.value;\n    if ($0238e4b796d1715f$var$isElementInScope(element, scope.current)) return true;\n  }\n\n  return false;\n}\n\nfunction $0238e4b796d1715f$var$isElementInScope(element, scope) {\n  return scope.some(function (node) {\n    return node.contains(element);\n  });\n}\n\nfunction $0238e4b796d1715f$var$isElementInChildScope(element, scope) {\n  for (var _iterator2 = _createForOfIteratorHelperLoose($0238e4b796d1715f$var$scopes.keys()), _step2; !(_step2 = _iterator2()).done;) {\n    var s = _step2.value;\n    if ((s === scope || $0238e4b796d1715f$var$isAncestorScope(scope, s)) && $0238e4b796d1715f$var$isElementInScope(element, s.current)) return true;\n  }\n\n  return false;\n}\n\nfunction $0238e4b796d1715f$var$isAncestorScope(ancestor, scope) {\n  var parent = $0238e4b796d1715f$var$scopes.get(scope);\n  if (!parent) return false;\n  if (parent === ancestor) return true;\n  return $0238e4b796d1715f$var$isAncestorScope(ancestor, parent);\n}\n\nfunction $0238e4b796d1715f$var$focusElement(element) {\n  var scroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n  if (element != null && !scroll) try {\n    $f2c1256fdcfd2c09$export$80f3e147d781571c(element);\n  } catch (err) {} else if (element != null) try {\n    element.focus();\n  } catch (err1) {}\n}\n\nfunction $0238e4b796d1715f$var$focusFirstInScope(scope) {\n  var sentinel = scope[0].previousElementSibling;\n  var walker = $0238e4b796d1715f$export$2d6ec8fc375ceafa($0238e4b796d1715f$var$getScopeRoot(scope), {\n    tabbable: true\n  }, scope);\n  walker.currentNode = sentinel;\n  $0238e4b796d1715f$var$focusElement(walker.nextNode());\n}\n\nfunction $0238e4b796d1715f$var$useAutoFocus(scopeRef, autoFocus) {\n  var autoFocusRef = $bmn4K$react.useRef(autoFocus);\n  $bmn4K$useEffect(function () {\n    if (autoFocusRef.current) {\n      $0238e4b796d1715f$var$activeScope = scopeRef;\n      if (!$0238e4b796d1715f$var$isElementInScope(document.activeElement, $0238e4b796d1715f$var$activeScope.current)) $0238e4b796d1715f$var$focusFirstInScope(scopeRef.current);\n    }\n\n    autoFocusRef.current = false;\n  }, []);\n}\n\nfunction $0238e4b796d1715f$var$useRestoreFocus(scopeRef, restoreFocus, contain) {\n  var nodeToRestoreRef = $bmn4K$useRef(typeof document !== 'undefined' ? document.activeElement : null);\n  $bmn4K$useLayoutEffect(function () {\n    var nodeToRestore = nodeToRestoreRef.current;\n    if (!restoreFocus) return;\n\n    var onKeyDown = function onKeyDown(e) {\n      if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey) return;\n      var focusedElement = document.activeElement;\n      if (!$0238e4b796d1715f$var$isElementInScope(focusedElement, scopeRef.current)) return;\n      var walker = $0238e4b796d1715f$export$2d6ec8fc375ceafa(document.body, {\n        tabbable: true\n      });\n      walker.currentNode = focusedElement;\n      var nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();\n      if (!document.body.contains(nodeToRestore) || nodeToRestore === document.body) nodeToRestore = null;\n\n      if ((!nextElement || !$0238e4b796d1715f$var$isElementInScope(nextElement, scopeRef.current)) && nodeToRestore) {\n        walker.currentNode = nodeToRestore;\n\n        do {\n          nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();\n        } while ($0238e4b796d1715f$var$isElementInScope(nextElement, scopeRef.current));\n\n        e.preventDefault();\n        e.stopPropagation();\n        if (nextElement) $0238e4b796d1715f$var$focusElement(nextElement, true);else if (!$0238e4b796d1715f$var$isElementInAnyScope(nodeToRestore)) focusedElement.blur();else $0238e4b796d1715f$var$focusElement(nodeToRestore, true);\n      }\n    };\n\n    if (!contain) document.addEventListener('keydown', onKeyDown, true);\n    return function () {\n      if (!contain) document.removeEventListener('keydown', onKeyDown, true);\n      if (restoreFocus && nodeToRestore && $0238e4b796d1715f$var$isElementInScope(document.activeElement, scopeRef.current)) requestAnimationFrame(function () {\n        if (document.body.contains(nodeToRestore)) $0238e4b796d1715f$var$focusElement(nodeToRestore);\n      });\n    };\n  }, [scopeRef, restoreFocus, contain]);\n}\n\nfunction $0238e4b796d1715f$export$2d6ec8fc375ceafa(root, opts, scope) {\n  var selector = opts != null && opts.tabbable ? $0238e4b796d1715f$var$TABBABLE_ELEMENT_SELECTOR : $0238e4b796d1715f$var$FOCUSABLE_ELEMENT_SELECTOR;\n  var walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {\n    acceptNode: function acceptNode(node) {\n      var _opts$from;\n\n      if (opts != null && (_opts$from = opts.from) != null && _opts$from.contains(node)) return NodeFilter.FILTER_REJECT;\n      if (node.matches(selector) && $c5775c2d6be42e6d$export$e989c0fffaa6b27a(node) && (!scope || $0238e4b796d1715f$var$isElementInScope(node, scope))) return NodeFilter.FILTER_ACCEPT;\n      return NodeFilter.FILTER_SKIP;\n    }\n  });\n  if (opts != null && opts.from) walker.currentNode = opts.from;\n  return walker;\n}\n\nfunction $0238e4b796d1715f$export$c5251b9e124bf29(ref) {\n  return {\n    focusNext: function focusNext() {\n      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n      var root = ref.current;\n      var from = opts.from,\n          tabbable = opts.tabbable,\n          wrap = opts.wrap;\n      var node = from || document.activeElement;\n      var walker = $0238e4b796d1715f$export$2d6ec8fc375ceafa(root, {\n        tabbable: tabbable\n      });\n      if (root.contains(node)) walker.currentNode = node;\n      var nextNode = walker.nextNode();\n\n      if (!nextNode && wrap) {\n        walker.currentNode = root;\n        nextNode = walker.nextNode();\n      }\n\n      if (nextNode) $0238e4b796d1715f$var$focusElement(nextNode, true);\n      return nextNode;\n    },\n    focusPrevious: function focusPrevious() {\n      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n      var root = ref.current;\n      var from = opts.from,\n          tabbable = opts.tabbable,\n          wrap = opts.wrap;\n      var node = from || document.activeElement;\n      var walker = $0238e4b796d1715f$export$2d6ec8fc375ceafa(root, {\n        tabbable: tabbable\n      });\n      if (root.contains(node)) walker.currentNode = node;else {\n        var next = $0238e4b796d1715f$var$last(walker);\n        if (next) $0238e4b796d1715f$var$focusElement(next, true);\n        return next;\n      }\n      var previousNode = walker.previousNode();\n\n      if (!previousNode && wrap) {\n        walker.currentNode = root;\n        previousNode = $0238e4b796d1715f$var$last(walker);\n      }\n\n      if (previousNode) $0238e4b796d1715f$var$focusElement(previousNode, true);\n      return previousNode;\n    },\n    focusFirst: function focusFirst() {\n      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n      var root = ref.current;\n      var tabbable = opts.tabbable;\n      var walker = $0238e4b796d1715f$export$2d6ec8fc375ceafa(root, {\n        tabbable: tabbable\n      });\n      var nextNode = walker.nextNode();\n      if (nextNode) $0238e4b796d1715f$var$focusElement(nextNode, true);\n      return nextNode;\n    },\n    focusLast: function focusLast() {\n      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n      var root = ref.current;\n      var tabbable = opts.tabbable;\n      var walker = $0238e4b796d1715f$export$2d6ec8fc375ceafa(root, {\n        tabbable: tabbable\n      });\n      var next = $0238e4b796d1715f$var$last(walker);\n      if (next) $0238e4b796d1715f$var$focusElement(next, true);\n      return next;\n    }\n  };\n}\n\nfunction $0238e4b796d1715f$var$last(walker) {\n  var next;\n  var last;\n\n  do {\n    last = walker.lastChild();\n    if (last) next = last;\n  } while (last);\n\n  return next;\n}\n\nvar $db88f84346fe3322$exports = {};\n$parcel$export($db88f84346fe3322$exports, \"FocusRing\", function () {\n  return $db88f84346fe3322$export$1a38b4ad7f578e1d;\n});\nvar $e974583017b16a4e$exports = {};\n$parcel$export($e974583017b16a4e$exports, \"useFocusRing\", function () {\n  return $e974583017b16a4e$export$4e328f61c538687f;\n});\n\nfunction $e974583017b16a4e$export$4e328f61c538687f() {\n  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n  var _props$autoFocus = props.autoFocus,\n      autoFocus = _props$autoFocus === void 0 ? false : _props$autoFocus,\n      isTextInput = props.isTextInput,\n      within = props.within;\n  var state = $bmn4K$useRef({\n    isFocused: false,\n    isFocusVisible: autoFocus || $bmn4K$isFocusVisible()\n  }).current;\n\n  var _$bmn4K$useState = $bmn4K$useState(false),\n      _$bmn4K$useState2 = _slicedToArray(_$bmn4K$useState, 2),\n      isFocused1 = _$bmn4K$useState2[0],\n      setFocused = _$bmn4K$useState2[1];\n\n  var _$bmn4K$useState3 = $bmn4K$useState(function () {\n    return state.isFocused && state.isFocusVisible;\n  }),\n      _$bmn4K$useState4 = _slicedToArray(_$bmn4K$useState3, 2),\n      isFocusVisibleState = _$bmn4K$useState4[0],\n      setFocusVisible = _$bmn4K$useState4[1];\n\n  var updateState = function updateState() {\n    return setFocusVisible(state.isFocused && state.isFocusVisible);\n  };\n\n  var onFocusChange = function onFocusChange(isFocused) {\n    state.isFocused = isFocused;\n    setFocused(isFocused);\n    updateState();\n  };\n\n  $bmn4K$useFocusVisibleListener(function (isFocusVisible) {\n    state.isFocusVisible = isFocusVisible;\n    updateState();\n  }, [], {\n    isTextInput: isTextInput\n  });\n\n  var _$bmn4K$useFocus = $bmn4K$useFocus({\n    isDisabled: within,\n    onFocusChange: onFocusChange\n  }),\n      focusProps = _$bmn4K$useFocus.focusProps;\n\n  var _$bmn4K$useFocusWithi = $bmn4K$useFocusWithin({\n    isDisabled: !within,\n    onFocusWithinChange: onFocusChange\n  }),\n      focusWithinProps = _$bmn4K$useFocusWithi.focusWithinProps;\n\n  return {\n    isFocused: isFocused1,\n    isFocusVisible: state.isFocused && isFocusVisibleState,\n    focusProps: within ? focusWithinProps : focusProps\n  };\n}\n\nfunction $db88f84346fe3322$export$1a38b4ad7f578e1d(props) {\n  var _$bmn4K$clsx;\n\n  var children = props.children,\n      focusClass = props.focusClass,\n      focusRingClass = props.focusRingClass;\n\n  var _$e974583017b16a4e$ex = $e974583017b16a4e$export$4e328f61c538687f(props),\n      isFocused = _$e974583017b16a4e$ex.isFocused,\n      isFocusVisible = _$e974583017b16a4e$ex.isFocusVisible,\n      focusProps = _$e974583017b16a4e$ex.focusProps;\n\n  var child = $bmn4K$react.Children.only(children);\n  return $bmn4K$react.cloneElement(child, $bmn4K$mergeProps(child.props, _objectSpread(_objectSpread({}, focusProps), {}, {\n    className: $bmn4K$clsx((_$bmn4K$clsx = {}, _defineProperty(_$bmn4K$clsx, focusClass || '', isFocused), _defineProperty(_$bmn4K$clsx, focusRingClass || '', isFocusVisible), _$bmn4K$clsx))\n  })));\n}\n\nvar $e82d8245213b3ebf$exports = {};\n$parcel$export($e82d8245213b3ebf$exports, \"FocusableProvider\", function () {\n  return $e82d8245213b3ebf$export$13f3202a3e5ddd5;\n});\n$parcel$export($e82d8245213b3ebf$exports, \"useFocusable\", function () {\n  return $e82d8245213b3ebf$export$4c014de7c8940b4c;\n});\nvar $e82d8245213b3ebf$var$FocusableContext = $bmn4K$react.createContext(null);\n\nfunction $e82d8245213b3ebf$var$useFocusableContext(ref) {\n  var context = $bmn4K$useContext($e82d8245213b3ebf$var$FocusableContext) || {};\n  $bmn4K$useSyncRef(context, ref);\n\n  var _ = context.ref,\n      otherProps = _objectWithoutProperties(context, _excluded);\n\n  return otherProps;\n}\n\nfunction $e82d8245213b3ebf$var$FocusableProvider(props, ref) {\n  var children = props.children,\n      otherProps = _objectWithoutProperties(props, _excluded2);\n\n  var context = _objectSpread(_objectSpread({}, otherProps), {}, {\n    ref: ref\n  });\n\n  return $bmn4K$react.createElement($e82d8245213b3ebf$var$FocusableContext.Provider, {\n    value: context\n  }, children);\n}\n\nvar $e82d8245213b3ebf$export$13f3202a3e5ddd5 = $bmn4K$react.forwardRef($e82d8245213b3ebf$var$FocusableProvider);\n\nfunction $e82d8245213b3ebf$export$4c014de7c8940b4c(props, domRef) {\n  var _$bmn4K$useFocus2 = $bmn4K$useFocus(props),\n      focusProps = _$bmn4K$useFocus2.focusProps;\n\n  var _$bmn4K$useKeyboard = $bmn4K$useKeyboard(props),\n      keyboardProps = _$bmn4K$useKeyboard.keyboardProps;\n\n  var interactions = $bmn4K$mergeProps(focusProps, keyboardProps);\n  var domProps = $e82d8245213b3ebf$var$useFocusableContext(domRef);\n  var interactionProps = props.isDisabled ? {} : domProps;\n  var autoFocusRef = $bmn4K$useRef(props.autoFocus);\n  $bmn4K$useEffect(function () {\n    if (autoFocusRef.current && domRef.current) domRef.current.focus();\n    autoFocusRef.current = false;\n  }, []);\n  return {\n    focusableProps: $bmn4K$mergeProps(_objectSpread(_objectSpread({}, interactions), {}, {\n      tabIndex: props.excludeFromTabOrder && !props.isDisabled ? -1 : undefined\n    }), interactionProps)\n  };\n}\n\nexport { $0238e4b796d1715f$export$20e40289641fbbb6 as FocusScope, $0238e4b796d1715f$export$10c5169755ce7bd7 as useFocusManager, $0238e4b796d1715f$export$2d6ec8fc375ceafa as getFocusableTreeWalker, $0238e4b796d1715f$export$c5251b9e124bf29 as createFocusManager, $db88f84346fe3322$export$1a38b4ad7f578e1d as FocusRing, $e82d8245213b3ebf$export$13f3202a3e5ddd5 as FocusableProvider, $e82d8245213b3ebf$export$4c014de7c8940b4c as useFocusable, $e974583017b16a4e$export$4e328f61c538687f as useFocusRing, $f2c1256fdcfd2c09$export$80f3e147d781571c as focusSafely };","map":{"version":3,"sources":["packages/@react-aria/focus/src/FocusScope.tsx","packages/@react-aria/focus/src/focusSafely.ts","packages/@react-aria/focus/src/isElementVisible.ts","packages/@react-aria/focus/src/FocusRing.tsx","packages/@react-aria/focus/src/useFocusRing.ts","packages/@react-aria/focus/src/useFocusable.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SCmBgB,yC,CAAY,O,EAAsB;AAMhD,MAAI,6BAAsB,OAAO,SAAjC,EAA4C;AAC1C,QAAI,kBAAkB,GAAG,QAAQ,CAAC,aAAlC;AACA,IAAA,yBAAkB,C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AAjD,GAAsD;AAH1C,QAKxB,gBALwB;AADrB,GAAP;AASD","sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {focusSafely} from './focusSafely';\nimport {isElementVisible} from './isElementVisible';\nimport React, {ReactNode, RefObject, useContext, useEffect, useRef} from 'react';\nimport {useLayoutEffect} from '@react-aria/utils';\n\n// import {FocusScope, useFocusScope} from 'react-events/focus-scope';\n// export {FocusScope};\n\ninterface FocusScopeProps {\n  /** The contents of the focus scope. */\n  children: ReactNode,\n\n  /**\n   * Whether to contain focus inside the scope, so users cannot\n   * move focus outside, for example in a modal dialog.\n   */\n  contain?: boolean,\n\n  /**\n   * Whether to restore focus back to the element that was focused\n   * when the focus scope mounted, after the focus scope unmounts.\n   */\n  restoreFocus?: boolean,\n\n  /** Whether to auto focus the first focusable element in the focus scope on mount. */\n  autoFocus?: boolean\n}\n\ninterface FocusManagerOptions {\n  /** The element to start searching from. The currently focused element by default. */\n  from?: HTMLElement,\n  /** Whether to only include tabbable elements, or all focusable elements. */\n  tabbable?: boolean,\n  /** Whether focus should wrap around when it reaches the end of the scope. */\n  wrap?: boolean\n}\n\ninterface FocusManager {\n  /** Moves focus to the next focusable or tabbable element in the focus scope. */\n  focusNext(opts?: FocusManagerOptions): HTMLElement,\n  /** Moves focus to the previous focusable or tabbable element in the focus scope. */\n  focusPrevious(opts?: FocusManagerOptions): HTMLElement,\n  /** Moves focus to the first focusable or tabbable element in the focus scope. */\n  focusFirst(opts?: FocusManagerOptions): HTMLElement,\n    /** Moves focus to the last focusable or tabbable element in the focus scope. */\n  focusLast(opts?: FocusManagerOptions): HTMLElement\n}\n\ntype ScopeRef = RefObject<HTMLElement[]>;\ninterface IFocusContext {\n  scopeRef: ScopeRef,\n  focusManager: FocusManager\n}\n\nconst FocusContext = React.createContext<IFocusContext>(null);\n\nlet activeScope: ScopeRef = null;\nlet scopes: Map<ScopeRef, ScopeRef | null> = new Map();\n\n// This is a hacky DOM-based implementation of a FocusScope until this RFC lands in React:\n// https://github.com/reactjs/rfcs/pull/109\n// For now, it relies on the DOM tree order rather than the React tree order, and is probably\n// less optimized for performance.\n\n/**\n * A FocusScope manages focus for its descendants. It supports containing focus inside\n * the scope, restoring focus to the previously focused element on unmount, and auto\n * focusing children on mount. It also acts as a container for a programmatic focus\n * management interface that can be used to move focus forward and back in response\n * to user events.\n */\nexport function FocusScope(props: FocusScopeProps) {\n  let {children, contain, restoreFocus, autoFocus} = props;\n  let startRef = useRef<HTMLSpanElement>();\n  let endRef = useRef<HTMLSpanElement>();\n  let scopeRef = useRef<HTMLElement[]>([]);\n  let ctx = useContext(FocusContext);\n  let parentScope = ctx?.scopeRef;\n\n  useLayoutEffect(() => {\n    // Find all rendered nodes between the sentinels and add them to the scope.\n    let node = startRef.current.nextSibling;\n    let nodes = [];\n    while (node && node !== endRef.current) {\n      nodes.push(node);\n      node = node.nextSibling;\n    }\n\n    scopeRef.current = nodes;\n  }, [children, parentScope]);\n\n  useLayoutEffect(() => {\n    scopes.set(scopeRef, parentScope);\n    return () => {\n      // Restore the active scope on unmount if this scope or a descendant scope is active.\n      // Parent effect cleanups run before children, so we need to check if the\n      // parent scope actually still exists before restoring the active scope to it.\n      if (\n        (scopeRef === activeScope || isAncestorScope(scopeRef, activeScope)) &&\n        (!parentScope || scopes.has(parentScope))\n      ) {\n        activeScope = parentScope;\n      }\n      scopes.delete(scopeRef);\n    };\n  }, [scopeRef, parentScope]);\n\n  useFocusContainment(scopeRef, contain);\n  useRestoreFocus(scopeRef, restoreFocus, contain);\n  useAutoFocus(scopeRef, autoFocus);\n\n  let focusManager = createFocusManagerForScope(scopeRef);\n\n  return (\n    <FocusContext.Provider value={{scopeRef, focusManager}}>\n      <span data-focus-scope-start hidden ref={startRef} />\n      {children}\n      <span data-focus-scope-end hidden ref={endRef} />\n    </FocusContext.Provider>\n  );\n}\n\n/**\n * Returns a FocusManager interface for the parent FocusScope.\n * A FocusManager can be used to programmatically move focus within\n * a FocusScope, e.g. in response to user events like keyboard navigation.\n */\nexport function useFocusManager(): FocusManager {\n  return useContext(FocusContext)?.focusManager;\n}\n\nfunction createFocusManagerForScope(scopeRef: React.RefObject<HTMLElement[]>): FocusManager {\n  return {\n    focusNext(opts: FocusManagerOptions = {}) {\n      let scope = scopeRef.current;\n      let {from, tabbable, wrap} = opts;\n      let node = from || document.activeElement;\n      let sentinel = scope[0].previousElementSibling;\n      let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable}, scope);\n      walker.currentNode = isElementInScope(node, scope) ? node : sentinel;\n      let nextNode = walker.nextNode() as HTMLElement;\n      if (!nextNode && wrap) {\n        walker.currentNode = sentinel;\n        nextNode = walker.nextNode() as HTMLElement;\n      }\n      if (nextNode) {\n        focusElement(nextNode, true);\n      }\n      return nextNode;\n    },\n    focusPrevious(opts: FocusManagerOptions = {}) {\n      let scope = scopeRef.current;\n      let {from, tabbable, wrap} = opts;\n      let node = from || document.activeElement;\n      let sentinel = scope[scope.length - 1].nextElementSibling;\n      let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable}, scope);\n      walker.currentNode = isElementInScope(node, scope) ? node : sentinel;\n      let previousNode = walker.previousNode() as HTMLElement;\n      if (!previousNode && wrap) {\n        walker.currentNode = sentinel;\n        previousNode = walker.previousNode() as HTMLElement;\n      }\n      if (previousNode) {\n        focusElement(previousNode, true);\n      }\n      return previousNode;\n    },\n    focusFirst(opts = {}) {\n      let scope = scopeRef.current;\n      let {tabbable} = opts;\n      let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable}, scope);\n      walker.currentNode = scope[0].previousElementSibling;\n      let nextNode = walker.nextNode() as HTMLElement;\n      if (nextNode) {\n        focusElement(nextNode, true);\n      }\n      return nextNode;\n    },\n    focusLast(opts = {}) {\n      let scope = scopeRef.current;\n      let {tabbable} = opts;\n      let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable}, scope);\n      walker.currentNode = scope[scope.length - 1].nextElementSibling;\n      let previousNode = walker.previousNode() as HTMLElement;\n      if (previousNode) {\n        focusElement(previousNode, true);\n      }\n      return previousNode;\n    }\n  };\n}\n\nconst focusableElements = [\n  'input:not([disabled]):not([type=hidden])',\n  'select:not([disabled])',\n  'textarea:not([disabled])',\n  'button:not([disabled])',\n  'a[href]',\n  'area[href]',\n  'summary',\n  'iframe',\n  'object',\n  'embed',\n  'audio[controls]',\n  'video[controls]',\n  '[contenteditable]'\n];\n\nconst FOCUSABLE_ELEMENT_SELECTOR = focusableElements.join(':not([hidden]),') + ',[tabindex]:not([disabled]):not([hidden])';\n\nfocusableElements.push('[tabindex]:not([tabindex=\"-1\"]):not([disabled])');\nconst TABBABLE_ELEMENT_SELECTOR = focusableElements.join(':not([hidden]):not([tabindex=\"-1\"]),');\n\nfunction getScopeRoot(scope: HTMLElement[]) {\n  return scope[0].parentElement;\n}\n\nfunction useFocusContainment(scopeRef: RefObject<HTMLElement[]>, contain: boolean) {\n  let focusedNode = useRef<HTMLElement>();\n\n  let raf = useRef(null);\n  useLayoutEffect(() => {\n    let scope = scopeRef.current;\n    if (!contain) {\n      return;\n    }\n\n    // Handle the Tab key to contain focus within the scope\n    let onKeyDown = (e) => {\n      if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey || scopeRef !== activeScope) {\n        return;\n      }\n\n      let focusedElement = document.activeElement as HTMLElement;\n      let scope = scopeRef.current;\n      if (!isElementInScope(focusedElement, scope)) {\n        return;\n      }\n\n      let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable: true}, scope);\n      walker.currentNode = focusedElement;\n      let nextElement = (e.shiftKey ? walker.previousNode() : walker.nextNode()) as HTMLElement;\n      if (!nextElement) {\n        walker.currentNode = e.shiftKey ? scope[scope.length - 1].nextElementSibling : scope[0].previousElementSibling;\n        nextElement = (e.shiftKey ? walker.previousNode() : walker.nextNode())  as HTMLElement;\n      }\n\n      e.preventDefault();\n      if (nextElement) {\n        focusElement(nextElement, true);\n      }\n    };\n\n    let onFocus = (e) => {\n      // If focusing an element in a child scope of the currently active scope, the child becomes active.\n      // Moving out of the active scope to an ancestor is not allowed.\n      if (!activeScope || isAncestorScope(activeScope, scopeRef)) {\n        activeScope = scopeRef;\n        focusedNode.current = e.target;\n      } else if (scopeRef === activeScope && !isElementInChildScope(e.target, scopeRef)) {\n        // If a focus event occurs outside the active scope (e.g. user tabs from browser location bar),\n        // restore focus to the previously focused node or the first tabbable element in the active scope.\n        if (focusedNode.current) {\n          focusedNode.current.focus();\n        } else if (activeScope) {\n          focusFirstInScope(activeScope.current);\n        }\n      } else if (scopeRef === activeScope) {\n        focusedNode.current = e.target;\n      }\n    };\n\n    let onBlur = (e) => {\n      // Firefox doesn't shift focus back to the Dialog properly without this\n      raf.current = requestAnimationFrame(() => {\n        // Use document.activeElement instead of e.relatedTarget so we can tell if user clicked into iframe\n        if (scopeRef === activeScope && !isElementInChildScope(document.activeElement, scopeRef)) {\n          activeScope = scopeRef;\n          focusedNode.current = e.target;\n          focusedNode.current.focus();\n        }\n      });\n    };\n\n    document.addEventListener('keydown', onKeyDown, false);\n    document.addEventListener('focusin', onFocus, false);\n    scope.forEach(element => element.addEventListener('focusin', onFocus, false));\n    scope.forEach(element => element.addEventListener('focusout', onBlur, false));\n    return () => {\n      document.removeEventListener('keydown', onKeyDown, false);\n      document.removeEventListener('focusin', onFocus, false);\n      scope.forEach(element => element.removeEventListener('focusin', onFocus, false));\n      scope.forEach(element => element.removeEventListener('focusout', onBlur, false));\n    };\n  }, [scopeRef, contain]);\n\n  // eslint-disable-next-line arrow-body-style\n  useEffect(() => {\n    return () => cancelAnimationFrame(raf.current);\n  }, [raf]);\n}\n\nfunction isElementInAnyScope(element: Element) {\n  for (let scope of scopes.keys()) {\n    if (isElementInScope(element, scope.current)) {\n      return true;\n    }\n  }\n  return false;\n}\n\nfunction isElementInScope(element: Element, scope: HTMLElement[]) {\n  return scope.some(node => node.contains(element));\n}\n\nfunction isElementInChildScope(element: Element, scope: ScopeRef) {\n  // node.contains in isElementInScope covers child scopes that are also DOM children,\n  // but does not cover child scopes in portals.\n  for (let s of scopes.keys()) {\n    if ((s === scope || isAncestorScope(scope, s)) && isElementInScope(element, s.current)) {\n      return true;\n    }\n  }\n\n  return false;\n}\n\nfunction isAncestorScope(ancestor: ScopeRef, scope: ScopeRef) {\n  let parent = scopes.get(scope);\n  if (!parent) {\n    return false;\n  }\n\n  if (parent === ancestor) {\n    return true;\n  }\n\n  return isAncestorScope(ancestor, parent);\n}\n\nfunction focusElement(element: HTMLElement | null, scroll = false) {\n  if (element != null && !scroll) {\n    try {\n      focusSafely(element);\n    } catch (err) {\n      // ignore\n    }\n  } else if (element != null) {\n    try {\n      element.focus();\n    } catch (err) {\n      // ignore\n    }\n  }\n}\n\nfunction focusFirstInScope(scope: HTMLElement[]) {\n  let sentinel = scope[0].previousElementSibling;\n  let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable: true}, scope);\n  walker.currentNode = sentinel;\n  focusElement(walker.nextNode() as HTMLElement);\n}\n\nfunction useAutoFocus(scopeRef: RefObject<HTMLElement[]>, autoFocus: boolean) {\n  const autoFocusRef = React.useRef(autoFocus);\n  useEffect(() => {\n    if (autoFocusRef.current) {\n      activeScope = scopeRef;\n      if (!isElementInScope(document.activeElement, activeScope.current)) {\n        focusFirstInScope(scopeRef.current);\n      }\n    }\n    autoFocusRef.current = false;\n  }, []);\n}\n\nfunction useRestoreFocus(scopeRef: RefObject<HTMLElement[]>, restoreFocus: boolean, contain: boolean) {\n  // create a ref during render instead of useLayoutEffect so the active element is saved before a child with autoFocus=true mounts.\n  const nodeToRestoreRef = useRef(typeof document !== 'undefined' ? document.activeElement as HTMLElement : null);\n\n  // useLayoutEffect instead of useEffect so the active element is saved synchronously instead of asynchronously.\n  useLayoutEffect(() => {\n    let nodeToRestore = nodeToRestoreRef.current;\n    if (!restoreFocus) {\n      return;\n    }\n\n    // Handle the Tab key so that tabbing out of the scope goes to the next element\n    // after the node that had focus when the scope mounted. This is important when\n    // using portals for overlays, so that focus goes to the expected element when\n    // tabbing out of the overlay.\n    let onKeyDown = (e: KeyboardEvent) => {\n      if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey) {\n        return;\n      }\n\n      let focusedElement = document.activeElement as HTMLElement;\n      if (!isElementInScope(focusedElement, scopeRef.current)) {\n        return;\n      }\n\n      // Create a DOM tree walker that matches all tabbable elements\n      let walker = getFocusableTreeWalker(document.body, {tabbable: true});\n\n      // Find the next tabbable element after the currently focused element\n      walker.currentNode = focusedElement;\n      let nextElement = (e.shiftKey ? walker.previousNode() : walker.nextNode()) as HTMLElement;\n\n      if (!document.body.contains(nodeToRestore) || nodeToRestore === document.body) {\n        nodeToRestore = null;\n      }\n\n      // If there is no next element, or it is outside the current scope, move focus to the\n      // next element after the node to restore to instead.\n      if ((!nextElement || !isElementInScope(nextElement, scopeRef.current)) && nodeToRestore) {\n        walker.currentNode = nodeToRestore;\n\n        // Skip over elements within the scope, in case the scope immediately follows the node to restore.\n        do {\n          nextElement = (e.shiftKey ? walker.previousNode() : walker.nextNode()) as HTMLElement;\n        } while (isElementInScope(nextElement, scopeRef.current));\n\n        e.preventDefault();\n        e.stopPropagation();\n        if (nextElement) {\n          focusElement(nextElement, true);\n        } else {\n           // If there is no next element and the nodeToRestore isn't within a FocusScope (i.e. we are leaving the top level focus scope)\n           // then move focus to the body.\n           // Otherwise restore focus to the nodeToRestore (e.g menu within a popover -> tabbing to close the menu should move focus to menu trigger)\n          if (!isElementInAnyScope(nodeToRestore)) {\n            focusedElement.blur();\n          } else {\n            focusElement(nodeToRestore, true);\n          }\n        }\n      }\n    };\n\n    if (!contain) {\n      document.addEventListener('keydown', onKeyDown, true);\n    }\n\n    return () => {\n      if (!contain) {\n        document.removeEventListener('keydown', onKeyDown, true);\n      }\n\n      if (restoreFocus && nodeToRestore && isElementInScope(document.activeElement, scopeRef.current)) {\n        requestAnimationFrame(() => {\n          if (document.body.contains(nodeToRestore)) {\n            focusElement(nodeToRestore);\n          }\n        });\n      }\n    };\n  }, [scopeRef, restoreFocus, contain]);\n}\n\n/**\n * Create a [TreeWalker]{@link https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker}\n * that matches all focusable/tabbable elements.\n */\nexport function getFocusableTreeWalker(root: HTMLElement, opts?: FocusManagerOptions, scope?: HTMLElement[]) {\n  let selector = opts?.tabbable ? TABBABLE_ELEMENT_SELECTOR : FOCUSABLE_ELEMENT_SELECTOR;\n  let walker = document.createTreeWalker(\n    root,\n    NodeFilter.SHOW_ELEMENT,\n    {\n      acceptNode(node) {\n        // Skip nodes inside the starting node.\n        if (opts?.from?.contains(node)) {\n          return NodeFilter.FILTER_REJECT;\n        }\n\n        if ((node as HTMLElement).matches(selector)\n          && isElementVisible(node as HTMLElement)\n          && (!scope || isElementInScope(node as HTMLElement, scope))) {\n          return NodeFilter.FILTER_ACCEPT;\n        }\n\n        return NodeFilter.FILTER_SKIP;\n      }\n    }\n  );\n\n  if (opts?.from) {\n    walker.currentNode = opts.from;\n  }\n\n  return walker;\n}\n\n/**\n * Creates a FocusManager object that can be used to move focus within an element.\n */\nexport function createFocusManager(ref: RefObject<HTMLElement>): FocusManager {\n  return {\n    focusNext(opts: FocusManagerOptions = {}) {\n      let root = ref.current;\n      let {from, tabbable, wrap} = opts;\n      let node = from || document.activeElement;\n      let walker = getFocusableTreeWalker(root, {tabbable});\n      if (root.contains(node)) {\n        walker.currentNode = node;\n      }\n      let nextNode = walker.nextNode() as HTMLElement;\n      if (!nextNode && wrap) {\n        walker.currentNode = root;\n        nextNode = walker.nextNode() as HTMLElement;\n      }\n      if (nextNode) {\n        focusElement(nextNode, true);\n      }\n      return nextNode;\n    },\n    focusPrevious(opts: FocusManagerOptions = {}) {\n      let root = ref.current;\n      let {from, tabbable, wrap} = opts;\n      let node = from || document.activeElement;\n      let walker = getFocusableTreeWalker(root, {tabbable});\n      if (root.contains(node)) {\n        walker.currentNode = node;\n      } else {\n        let next = last(walker);\n        if (next) {\n          focusElement(next, true);\n        }\n        return next;\n      }\n      let previousNode = walker.previousNode() as HTMLElement;\n      if (!previousNode && wrap) {\n        walker.currentNode = root;\n        previousNode = last(walker);\n      }\n      if (previousNode) {\n        focusElement(previousNode, true);\n      }\n      return previousNode;\n    },\n    focusFirst(opts = {}) {\n      let root = ref.current;\n      let {tabbable} = opts;\n      let walker = getFocusableTreeWalker(root, {tabbable});\n      let nextNode = walker.nextNode() as HTMLElement;\n      if (nextNode) {\n        focusElement(nextNode, true);\n      }\n      return nextNode;\n    },\n    focusLast(opts = {}) {\n      let root = ref.current;\n      let {tabbable} = opts;\n      let walker = getFocusableTreeWalker(root, {tabbable});\n      let next = last(walker);\n      if (next) {\n        focusElement(next, true);\n      }\n      return next;\n    }\n  };\n}\n\nfunction last(walker: TreeWalker) {\n  let next: HTMLElement;\n  let last: HTMLElement;\n  do {\n    last = walker.lastChild() as HTMLElement;\n    if (last) {\n      next = last;\n    }\n  } while (last);\n  return next;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the 'License');\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {focusWithoutScrolling, runAfterTransition} from '@react-aria/utils';\nimport {getInteractionModality} from '@react-aria/interactions';\n\n/**\n * A utility function that focuses an element while avoiding undesired side effects such\n * as page scrolling and screen reader issues with CSS transitions.\n */\nexport function focusSafely(element: HTMLElement) {\n  // If the user is interacting with a virtual cursor, e.g. screen reader, then\n  // wait until after any animated transitions that are currently occurring on\n  // the page before shifting focus. This avoids issues with VoiceOver on iOS\n  // causing the page to scroll when moving focus if the element is transitioning\n  // from off the screen.\n  if (getInteractionModality() === 'virtual') {\n    let lastFocusedElement = document.activeElement;\n    runAfterTransition(() => {\n      // If focus did not move and the element is still in the document, focus it.\n      if (document.activeElement === lastFocusedElement && document.contains(element)) {\n        focusWithoutScrolling(element);\n      }\n    });\n  } else {\n    focusWithoutScrolling(element);\n  }\n}\n","/*\n * Copyright 2021 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nfunction isStyleVisible(element: Element) {\n  if (!(element instanceof HTMLElement) && !(element instanceof SVGElement)) {\n    return false;\n  }\n\n  let {display, visibility} = element.style;\n\n  let isVisible = (\n    display !== 'none' &&\n    visibility !== 'hidden' &&\n    visibility !== 'collapse'\n  );\n\n  if (isVisible) {\n    const {getComputedStyle} = element.ownerDocument.defaultView;\n    let {display: computedDisplay, visibility: computedVisibility} = getComputedStyle(element);\n\n    isVisible = (\n      computedDisplay !== 'none' &&\n      computedVisibility !== 'hidden' &&\n      computedVisibility !== 'collapse'\n    );\n  }\n\n  return isVisible;\n}\n\nfunction isAttributeVisible(element: Element, childElement?: Element) {\n  return (\n    !element.hasAttribute('hidden') &&\n    (element.nodeName === 'DETAILS' &&\n      childElement &&\n      childElement.nodeName !== 'SUMMARY'\n      ? element.hasAttribute('open')\n      : true)\n  );\n}\n\n/**\n * Adapted from https://github.com/testing-library/jest-dom and \n * https://github.com/vuejs/vue-test-utils-next/.\n * Licensed under the MIT License.\n * @param element - Element to evaluate for display or visibility.\n */  \nexport function isElementVisible(element: Element, childElement?: Element) {\n  return (\n    element.nodeName !== '#comment' &&\n    isStyleVisible(element) &&\n    isAttributeVisible(element, childElement) &&\n    (!element.parentElement || isElementVisible(element.parentElement, element))\n  );\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport clsx from 'clsx';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {ReactElement} from 'react';\nimport {useFocusRing} from './useFocusRing';\n\ninterface FocusRingProps {\n  /** Child element to apply CSS classes to. */\n  children: ReactElement,\n  /** CSS class to apply when the element is focused. */\n  focusClass?: string,\n  /** CSS class to apply when the element has keyboard focus. */\n  focusRingClass?: string,\n  /**\n   * Whether to show the focus ring when something\n   * inside the container element has focus (true), or\n   * only if the container itself has focus (false).\n   * @default false\n   */\n  within?: boolean,\n  /** Whether the element is a text input. */\n  isTextInput?: boolean,\n  /** Whether the element will be auto focused. */\n  autoFocus?: boolean\n}\n\n/**\n * A utility component that applies a CSS class when an element has keyboard focus.\n * Focus rings are visible only when the user is interacting with a keyboard,\n * not with a mouse, touch, or other input methods.\n */\nexport function FocusRing(props: FocusRingProps) {\n  let {children, focusClass, focusRingClass} = props;\n  let {isFocused, isFocusVisible, focusProps} = useFocusRing(props);\n  let child = React.Children.only(children);\n\n  return React.cloneElement(child, mergeProps(child.props, {\n    ...focusProps,\n    className: clsx({\n      [focusClass || '']: isFocused,\n      [focusRingClass || '']: isFocusVisible\n    })\n  }));\n}\n","import {HTMLAttributes, useState} from 'react';\nimport {isFocusVisible, useFocus, useFocusVisibleListener, useFocusWithin} from '@react-aria/interactions';\nimport {useRef} from 'react';\n\ninterface FocusRingProps {\n  /**\n   * Whether to show the focus ring when something\n   * inside the container element has focus (true), or\n   * only if the container itself has focus (false).\n   * @default 'false'\n   */\n  within?: boolean,\n\n  /** Whether the element is a text input. */\n  isTextInput?: boolean,\n\n  /** Whether the element will be auto focused. */\n  autoFocus?: boolean\n}\n\ninterface FocusRingAria {\n  /** Whether the element is currently focused. */\n  isFocused: boolean,\n\n  /** Whether keyboard focus should be visible. */\n  isFocusVisible: boolean,\n\n  /** Props to apply to the container element with the focus ring. */\n  focusProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Determines whether a focus ring should be shown to indicate keyboard focus.\n * Focus rings are visible only when the user is interacting with a keyboard,\n * not with a mouse, touch, or other input methods.\n */\nexport function useFocusRing(props: FocusRingProps = {}): FocusRingAria {\n  let {\n    autoFocus = false,\n    isTextInput,\n    within\n  } = props;\n  let state = useRef({\n    isFocused: false,\n    isFocusVisible: autoFocus || isFocusVisible()\n  }).current;\n  let [isFocused, setFocused] = useState(false);\n  let [isFocusVisibleState, setFocusVisible] = useState(() => state.isFocused && state.isFocusVisible);\n\n  let updateState = () => setFocusVisible(state.isFocused && state.isFocusVisible);\n\n  let onFocusChange = isFocused => {\n    state.isFocused = isFocused;\n    setFocused(isFocused);\n    updateState();\n  };\n\n  useFocusVisibleListener((isFocusVisible) => {\n    state.isFocusVisible = isFocusVisible;\n    updateState();\n  }, [], {isTextInput});\n\n  let {focusProps} = useFocus({\n    isDisabled: within,\n    onFocusChange\n  });\n\n  let {focusWithinProps} = useFocusWithin({\n    isDisabled: !within,\n    onFocusWithinChange: onFocusChange\n  });\n\n  return {\n    isFocused,\n    isFocusVisible: state.isFocused && isFocusVisibleState,\n    focusProps: within ? focusWithinProps : focusProps\n  };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {FocusableDOMProps, FocusableProps} from '@react-types/shared';\nimport {mergeProps, useSyncRef} from '@react-aria/utils';\nimport React, {HTMLAttributes, MutableRefObject, ReactNode, RefObject, useContext, useEffect, useRef} from 'react';\nimport {useFocus, useKeyboard} from '@react-aria/interactions';\n\ninterface FocusableOptions extends FocusableProps, FocusableDOMProps {\n  /** Whether focus should be disabled. */\n  isDisabled?: boolean\n}\n\ninterface FocusableProviderProps extends HTMLAttributes<HTMLElement> {\n  /** The child element to provide DOM props to. */\n  children?: ReactNode\n}\n\ninterface FocusableContextValue extends FocusableProviderProps {\n  ref?: MutableRefObject<HTMLElement>\n}\n\nlet FocusableContext = React.createContext<FocusableContextValue>(null);\n\nfunction useFocusableContext(ref: RefObject<HTMLElement>): FocusableContextValue {\n  let context = useContext(FocusableContext) || {};\n  useSyncRef(context, ref);\n\n  // eslint-disable-next-line\n  let {ref: _, ...otherProps} = context;\n  return otherProps;\n}\n\n/**\n * Provides DOM props to the nearest focusable child.\n */\nfunction FocusableProvider(props: FocusableProviderProps, ref: RefObject<HTMLElement>) {\n  let {children, ...otherProps} = props;\n  let context = {\n    ...otherProps,\n    ref\n  };\n\n  return (\n    <FocusableContext.Provider value={context}>\n      {children}\n    </FocusableContext.Provider>\n  );\n}\n\nlet _FocusableProvider = React.forwardRef(FocusableProvider);\nexport {_FocusableProvider as FocusableProvider};\n\n/**\n * Used to make an element focusable and capable of auto focus.\n */\nexport function useFocusable(props: FocusableOptions, domRef: RefObject<HTMLElement>) {\n  let {focusProps} = useFocus(props);\n  let {keyboardProps} = useKeyboard(props);\n  let interactions = mergeProps(focusProps, keyboardProps);\n  let domProps = useFocusableContext(domRef);\n  let interactionProps = props.isDisabled ? {} : domProps;\n  let autoFocusRef = useRef(props.autoFocus);\n\n  useEffect(() => {\n    if (autoFocusRef.current && domRef.current) {\n      domRef.current.focus();\n    }\n    autoFocusRef.current = false;\n  }, []);\n\n  return {\n    focusableProps: mergeProps(\n      {\n        ...interactions,\n        tabIndex: props.excludeFromTabOrder && !props.isDisabled ? -1 : undefined\n      },\n      interactionProps\n    )\n  };\n}\n"]},"metadata":{},"sourceType":"module"}