{"ast":null,"code":"import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _slicedToArray from \"@babel/runtime/helpers/slicedToArray\";\nimport _toConsumableArray from \"@babel/runtime/helpers/toConsumableArray\";\n\nfunction _createForOfIteratorHelperLoose(o, allowArrayLike) { var it; if (typeof Symbol === \"undefined\" || o[Symbol.iterator] == null) { 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.\"); } it = o[Symbol.iterator](); return it.next.bind(it); }\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 _babelRuntimeHelpersEsmObjectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport _clsx from \"clsx\";\nimport _babelRuntimeHelpersEsmExtends from \"@babel/runtime/helpers/esm/extends\";\nimport _react, { useContext, useEffect, useRef, useState } from \"react\";\nimport { getInteractionModality, useFocus, useFocusVisible, useFocusWithin, useKeyboard } from \"@react-aria/interactions\";\nimport { focusWithoutScrolling, runAfterTransition, useLayoutEffect, mergeProps } from \"@react-aria/utils\";\nexport function focusSafely(element) {\n  if (getInteractionModality() === 'virtual') {\n    var lastFocusedElement = document.activeElement;\n    runAfterTransition(function () {\n      if (document.activeElement === lastFocusedElement && document.contains(element)) {\n        focusWithoutScrolling(element);\n      }\n    });\n  } else {\n    focusWithoutScrolling(element);\n  }\n}\n\nvar $c9e8f80f5bb1841844f54e4ad30b$var$FocusContext = _react.createContext(null);\n\nvar $c9e8f80f5bb1841844f54e4ad30b$var$activeScope = null;\nvar $c9e8f80f5bb1841844f54e4ad30b$var$scopes = new Set();\nexport function FocusScope(props) {\n  var children = props.children,\n      contain = props.contain,\n      restoreFocus = props.restoreFocus,\n      autoFocus = props.autoFocus;\n  var startRef = useRef();\n  var endRef = useRef();\n  var scopeRef = useRef([]);\n  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    $c9e8f80f5bb1841844f54e4ad30b$var$scopes.add(scopeRef);\n    return function () {\n      $c9e8f80f5bb1841844f54e4ad30b$var$scopes.delete(scopeRef);\n    };\n  }, [children]);\n  $c9e8f80f5bb1841844f54e4ad30b$var$useFocusContainment(scopeRef, contain);\n  $c9e8f80f5bb1841844f54e4ad30b$var$useRestoreFocus(scopeRef, restoreFocus, contain);\n  $c9e8f80f5bb1841844f54e4ad30b$var$useAutoFocus(scopeRef, autoFocus);\n  var focusManager = $c9e8f80f5bb1841844f54e4ad30b$var$createFocusManager(scopeRef);\n  return _react.createElement($c9e8f80f5bb1841844f54e4ad30b$var$FocusContext.Provider, {\n    value: focusManager\n  }, _react.createElement(\"span\", {\n    hidden: true,\n    ref: startRef\n  }), children, _react.createElement(\"span\", {\n    hidden: true,\n    ref: endRef\n  }));\n}\nexport function useFocusManager() {\n  return useContext($c9e8f80f5bb1841844f54e4ad30b$var$FocusContext);\n}\n\nfunction $c9e8f80f5bb1841844f54e4ad30b$var$createFocusManager(scopeRef) {\n  return {\n    focusNext: function focusNext(opts) {\n      if (opts === void 0) {\n        opts = {};\n      }\n\n      var node = opts.from || document.activeElement;\n      var focusable = $c9e8f80f5bb1841844f54e4ad30b$var$getFocusableElementsInScope(scopeRef.current, opts);\n      var nextNode = focusable.find(function (n) {\n        return !!(node.compareDocumentPosition(n) & (Node.DOCUMENT_POSITION_FOLLOWING | Node.DOCUMENT_POSITION_CONTAINED_BY));\n      });\n\n      if (!nextNode && opts.wrap) {\n        nextNode = focusable[0];\n      }\n\n      if (nextNode) {\n        nextNode.focus();\n      }\n\n      return nextNode;\n    },\n    focusPrevious: function focusPrevious(opts) {\n      if (opts === void 0) {\n        opts = {};\n      }\n\n      var node = opts.from || document.activeElement;\n      var focusable = $c9e8f80f5bb1841844f54e4ad30b$var$getFocusableElementsInScope(scopeRef.current, opts).reverse();\n      var previousNode = focusable.find(function (n) {\n        return !!(node.compareDocumentPosition(n) & (Node.DOCUMENT_POSITION_PRECEDING | Node.DOCUMENT_POSITION_CONTAINED_BY));\n      });\n\n      if (!previousNode && opts.wrap) {\n        previousNode = focusable[0];\n      }\n\n      if (previousNode) {\n        previousNode.focus();\n      }\n\n      return previousNode;\n    }\n  };\n}\n\nvar $c9e8f80f5bb1841844f54e4ad30b$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 $c9e8f80f5bb1841844f54e4ad30b$var$FOCUSABLE_ELEMENT_SELECTOR = $c9e8f80f5bb1841844f54e4ad30b$var$focusableElements.join(',') + ',[tabindex]';\n$c9e8f80f5bb1841844f54e4ad30b$var$focusableElements.push('[tabindex]:not([tabindex=\"-1\"])');\nvar $c9e8f80f5bb1841844f54e4ad30b$var$TABBABLE_ELEMENT_SELECTOR = $c9e8f80f5bb1841844f54e4ad30b$var$focusableElements.join(':not([tabindex=\"-1\"]),');\n\nfunction $c9e8f80f5bb1841844f54e4ad30b$var$getFocusableElementsInScope(scope, opts) {\n  var res = [];\n  var selector = opts.tabbable ? $c9e8f80f5bb1841844f54e4ad30b$var$TABBABLE_ELEMENT_SELECTOR : $c9e8f80f5bb1841844f54e4ad30b$var$FOCUSABLE_ELEMENT_SELECTOR;\n\n  for (var _iterator = _createForOfIteratorHelperLoose(scope), _step; !(_step = _iterator()).done;) {\n    var node = _step.value;\n\n    if (node.matches(selector)) {\n      res.push(node);\n    }\n\n    res.push.apply(res, _toConsumableArray(Array.from(node.querySelectorAll(selector))));\n  }\n\n  return res;\n}\n\nfunction $c9e8f80f5bb1841844f54e4ad30b$var$useFocusContainment(scopeRef, contain) {\n  var focusedNode = useRef();\n  var raf = useRef(null);\n  useEffect(function () {\n    var scope = scopeRef.current;\n\n    if (!contain) {\n      return;\n    }\n\n    var onKeyDown = function onKeyDown(e) {\n      if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey) {\n        return;\n      }\n\n      var focusedElement = document.activeElement;\n\n      if (!$c9e8f80f5bb1841844f54e4ad30b$var$isElementInScope(focusedElement, scope)) {\n        return;\n      }\n\n      var elements = $c9e8f80f5bb1841844f54e4ad30b$var$getFocusableElementsInScope(scope, {\n        tabbable: true\n      });\n      var position = elements.indexOf(focusedElement);\n      var lastPosition = elements.length - 1;\n      var nextElement = null;\n\n      if (e.shiftKey) {\n        if (position <= 0) {\n          nextElement = elements[lastPosition];\n        } else {\n          nextElement = elements[position - 1];\n        }\n      } else {\n        if (position === lastPosition) {\n          nextElement = elements[0];\n        } else {\n          nextElement = elements[position + 1];\n        }\n      }\n\n      e.preventDefault();\n\n      if (nextElement) {\n        $c9e8f80f5bb1841844f54e4ad30b$var$focusElement(nextElement, true);\n      }\n    };\n\n    var onFocus = function onFocus(e) {\n      var isInAnyScope = $c9e8f80f5bb1841844f54e4ad30b$var$isElementInAnyScope(e.target, $c9e8f80f5bb1841844f54e4ad30b$var$scopes);\n\n      if (!isInAnyScope) {\n        if (focusedNode.current) {\n          focusedNode.current.focus();\n        } else if ($c9e8f80f5bb1841844f54e4ad30b$var$activeScope) {\n          $c9e8f80f5bb1841844f54e4ad30b$var$focusFirstInScope($c9e8f80f5bb1841844f54e4ad30b$var$activeScope.current);\n        }\n      } else {\n        $c9e8f80f5bb1841844f54e4ad30b$var$activeScope = scopeRef;\n        focusedNode.current = e.target;\n      }\n    };\n\n    var onBlur = function onBlur(e) {\n      raf.current = requestAnimationFrame(function () {\n        var isInAnyScope = $c9e8f80f5bb1841844f54e4ad30b$var$isElementInAnyScope(document.activeElement, $c9e8f80f5bb1841844f54e4ad30b$var$scopes);\n\n        if (!isInAnyScope) {\n          $c9e8f80f5bb1841844f54e4ad30b$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    scope.forEach(function (element) {\n      return element.addEventListener('focusin', onFocus, false);\n    });\n    scope.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      scope.forEach(function (element) {\n        return element.removeEventListener('focusin', onFocus, false);\n      });\n      scope.forEach(function (element) {\n        return element.removeEventListener('focusout', onBlur, false);\n      });\n    };\n  }, [scopeRef, contain]);\n  useEffect(function () {\n    return function () {\n      return cancelAnimationFrame(raf.current);\n    };\n  }, [raf]);\n}\n\nfunction $c9e8f80f5bb1841844f54e4ad30b$var$isElementInAnyScope(element, scopes) {\n  for (var _iterator2 = _createForOfIteratorHelperLoose(scopes.values()), _step2; !(_step2 = _iterator2()).done;) {\n    var scope = _step2.value;\n\n    if ($c9e8f80f5bb1841844f54e4ad30b$var$isElementInScope(element, scope.current)) {\n      return true;\n    }\n  }\n\n  return false;\n}\n\nfunction $c9e8f80f5bb1841844f54e4ad30b$var$isElementInScope(element, scope) {\n  return scope.some(function (node) {\n    return node.contains(element);\n  });\n}\n\nfunction $c9e8f80f5bb1841844f54e4ad30b$var$focusElement(element, scroll) {\n  if (scroll === void 0) {\n    scroll = false;\n  }\n\n  if (element != null && !scroll) {\n    try {\n      focusSafely(element);\n    } catch (err) {}\n  } else if (element != null) {\n    try {\n      element.focus();\n    } catch (err) {}\n  }\n}\n\nfunction $c9e8f80f5bb1841844f54e4ad30b$var$focusFirstInScope(scope) {\n  var elements = $c9e8f80f5bb1841844f54e4ad30b$var$getFocusableElementsInScope(scope, {\n    tabbable: true\n  });\n  $c9e8f80f5bb1841844f54e4ad30b$var$focusElement(elements[0]);\n}\n\nfunction $c9e8f80f5bb1841844f54e4ad30b$var$useAutoFocus(scopeRef, autoFocus) {\n  useEffect(function () {\n    if (autoFocus) {\n      $c9e8f80f5bb1841844f54e4ad30b$var$activeScope = scopeRef;\n\n      if (!$c9e8f80f5bb1841844f54e4ad30b$var$isElementInScope(document.activeElement, $c9e8f80f5bb1841844f54e4ad30b$var$activeScope.current)) {\n        $c9e8f80f5bb1841844f54e4ad30b$var$focusFirstInScope(scopeRef.current);\n      }\n    }\n  }, [scopeRef, autoFocus]);\n}\n\nfunction $c9e8f80f5bb1841844f54e4ad30b$var$useRestoreFocus(scopeRef, restoreFocus, contain) {\n  useLayoutEffect(function () {\n    var scope = scopeRef.current;\n    var nodeToRestore = document.activeElement;\n\n    var onKeyDown = function onKeyDown(e) {\n      if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey) {\n        return;\n      }\n\n      var focusedElement = document.activeElement;\n\n      if (!$c9e8f80f5bb1841844f54e4ad30b$var$isElementInScope(focusedElement, scope)) {\n        return;\n      }\n\n      var walker = getFocusableTreeWalker(document.body, {\n        tabbable: true\n      });\n      walker.currentNode = focusedElement;\n      var nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();\n\n      if ((!nextElement || !$c9e8f80f5bb1841844f54e4ad30b$var$isElementInScope(nextElement, scope)) && nodeToRestore) {\n        walker.currentNode = nodeToRestore;\n\n        do {\n          nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();\n        } while ($c9e8f80f5bb1841844f54e4ad30b$var$isElementInScope(nextElement, scope));\n\n        e.preventDefault();\n        e.stopPropagation();\n\n        if (nextElement) {\n          nextElement.focus();\n        } else {\n          focusedElement.blur();\n        }\n      }\n    };\n\n    if (!contain) {\n      document.addEventListener('keydown', onKeyDown, true);\n    }\n\n    return function () {\n      if (!contain) {\n        document.removeEventListener('keydown', onKeyDown, true);\n      }\n\n      if (restoreFocus && nodeToRestore && $c9e8f80f5bb1841844f54e4ad30b$var$isElementInScope(document.activeElement, scope)) {\n        requestAnimationFrame(function () {\n          if (document.body.contains(nodeToRestore)) {\n            $c9e8f80f5bb1841844f54e4ad30b$var$focusElement(nodeToRestore);\n          }\n        });\n      }\n    };\n  }, [scopeRef, restoreFocus, contain]);\n}\n\nexport function getFocusableTreeWalker(root, opts) {\n  var selector = (opts == null ? void 0 : opts.tabbable) ? $c9e8f80f5bb1841844f54e4ad30b$var$TABBABLE_ELEMENT_SELECTOR : $c9e8f80f5bb1841844f54e4ad30b$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 ? void 0 : (_opts$from = opts.from) == null ? void 0 : _opts$from.contains(node)) {\n        return NodeFilter.FILTER_REJECT;\n      }\n\n      if (node.matches(selector)) {\n        return NodeFilter.FILTER_ACCEPT;\n      }\n\n      return NodeFilter.FILTER_SKIP;\n    }\n  }, false);\n\n  if (opts == null ? void 0 : opts.from) {\n    walker.currentNode = opts.from;\n  }\n\n  return walker;\n}\nexport function useFocusRing(props) {\n  if (props === void 0) {\n    props = {};\n  }\n\n  var _props = props,\n      within = _props.within;\n\n  var _useState = useState(false),\n      _useState2 = _slicedToArray(_useState, 2),\n      isFocused = _useState2[0],\n      setFocused = _useState2[1];\n\n  var _useState3 = useState(false),\n      _useState4 = _slicedToArray(_useState3, 2),\n      isFocusWithin = _useState4[0],\n      setFocusWithin = _useState4[1];\n\n  var _useFocusVisible = useFocusVisible(props),\n      isFocusVisible = _useFocusVisible.isFocusVisible;\n\n  var _useFocus = useFocus({\n    isDisabled: within,\n    onFocusChange: setFocused\n  }),\n      focusProps = _useFocus.focusProps;\n\n  var _useFocusWithin = useFocusWithin({\n    isDisabled: !within,\n    onFocusWithinChange: setFocusWithin\n  }),\n      focusWithinProps = _useFocusWithin.focusWithinProps;\n\n  return {\n    isFocused: within ? isFocusWithin : isFocused,\n    isFocusVisible: (within ? isFocusWithin : isFocused) && isFocusVisible,\n    focusProps: within ? focusWithinProps : focusProps\n  };\n}\nexport function FocusRing(props) {\n  var _clsx2;\n\n  var children = props.children,\n      focusClass = props.focusClass,\n      focusRingClass = props.focusRingClass;\n\n  var _useFocusRing = useFocusRing(props),\n      isFocused = _useFocusRing.isFocused,\n      isFocusVisible = _useFocusRing.isFocusVisible,\n      focusProps = _useFocusRing.focusProps;\n\n  var child = _react.Children.only(children);\n\n  return _react.cloneElement(child, mergeProps(child.props, _babelRuntimeHelpersEsmExtends({}, focusProps, {\n    className: _clsx((_clsx2 = {}, _defineProperty(_clsx2, focusClass || '', isFocused), _defineProperty(_clsx2, focusRingClass || '', isFocusVisible), _clsx2))\n  })));\n}\n\nvar $e11539c8317b2d21639df611cb5658f$var$FocusableContext = _react.createContext(null);\n\nfunction $e11539c8317b2d21639df611cb5658f$var$useFocusableContext(ref) {\n  var context = useContext($e11539c8317b2d21639df611cb5658f$var$FocusableContext) || {};\n  useEffect(function () {\n    if (context && context.ref) {\n      context.ref.current = ref.current;\n      return function () {\n        context.ref.current = null;\n      };\n    }\n  }, [context, ref]);\n  return context;\n}\n\nfunction $e11539c8317b2d21639df611cb5658f$var$FocusableProvider(props, ref) {\n  var children = props.children,\n      otherProps = _babelRuntimeHelpersEsmObjectWithoutPropertiesLoose(props, [\"children\"]);\n\n  var context = _babelRuntimeHelpersEsmExtends({}, otherProps, {\n    ref: ref\n  });\n\n  return _react.createElement($e11539c8317b2d21639df611cb5658f$var$FocusableContext.Provider, {\n    value: context\n  }, children);\n}\n\nexport var FocusableProvider = _react.forwardRef($e11539c8317b2d21639df611cb5658f$var$FocusableProvider);\nexport function useFocusable(props, domRef) {\n  var _useFocus2 = useFocus(props),\n      focusProps = _useFocus2.focusProps;\n\n  var _useKeyboard = useKeyboard(props),\n      keyboardProps = _useKeyboard.keyboardProps;\n\n  var interactions = mergeProps(focusProps, keyboardProps);\n  var domProps = $e11539c8317b2d21639df611cb5658f$var$useFocusableContext(domRef);\n  var interactionProps = props.isDisabled ? {} : domProps;\n  useEffect(function () {\n    if (props.autoFocus && domRef.current) {\n      domRef.current.focus();\n    }\n  }, [props.autoFocus, domRef]);\n  return {\n    focusableProps: mergeProps(_babelRuntimeHelpersEsmExtends({}, interactions, {\n      tabIndex: props.excludeFromTabOrder && !props.isDisabled ? -1 : undefined\n    }), interactionProps)\n  };\n}","map":{"version":3,"sources":["packages/@react-aria/focus/src/focusSafely.ts","packages/@react-aria/focus/src/FocusScope.tsx","packages/@react-aria/focus/src/useFocusRing.ts","packages/@react-aria/focus/src/FocusRing.tsx","packages/@react-aria/focus/src/useFocusable.tsx"],"names":["getInteractionModality","lastFocusedElement","document","runAfterTransition","focusWithoutScrolling","FocusContext","React","activeScope","scopes","autoFocus","startRef","useRef","endRef","scopeRef","useLayoutEffect","node","nodes","useFocusContainment","useRestoreFocus","useAutoFocus","focusManager","createFocusManager","useContext","focusNext","opts","focusable","getFocusableElementsInScope","nextNode","n","Node","focusPrevious","previousNode","focusableElements","FOCUSABLE_ELEMENT_SELECTOR","TABBABLE_ELEMENT_SELECTOR","res","selector","Array","focusedNode","raf","useEffect","scope","onKeyDown","e","focusedElement","isElementInScope","elements","tabbable","position","lastPosition","nextElement","focusElement","onFocus","isInAnyScope","isElementInAnyScope","focusFirstInScope","onBlur","requestAnimationFrame","element","cancelAnimationFrame","scroll","nodeToRestore","walker","getFocusableTreeWalker","restoreFocus","NodeFilter","acceptNode","props","within","useState","isFocusVisible","useFocusVisible","focusProps","useFocus","isDisabled","onFocusChange","setFocused","focusWithinProps","useFocusWithin","onFocusWithinChange","setFocusWithin","isFocused","focusRingClass","child","mergeProps","className","clsx","focusClass","FocusableContext","context","ref","children","_FocusableProvider","keyboardProps","useKeyboard","interactions","domProps","useFocusableContext","interactionProps","domRef","focusableProps","tabIndex","undefined"],"mappings":";;;;;;;;;;;;;;;;OAmBO,SAAA,WAAA,CAAA,OAAA,EAA2C;AAMhD,MAAIA,sBAAsB,OAA1B,SAAA,EAA4C;AAC1C,QAAIC,kBAAkB,GAAGC,QAAQ,CAAjC,aAAA;AACAC,IAAAA,kBAAkB,CAAC,YAAM;AAEvB,UAAID,QAAQ,CAARA,aAAAA,KAAAA,kBAAAA,IAAiDA,QAAQ,CAARA,QAAAA,CAArD,OAAqDA,CAArD,EAAiF;AAC/EE,QAAAA,qBAAqB,CAArBA,OAAqB,CAArBA;AACD;AAJHD,KAAkB,CAAlBA;AAFF,GAAA,MAQO;AACLC,IAAAA,qBAAqB,CAArBA,OAAqB,CAArBA;AACD;AACF;;ACmBD,IAAMC,8CAAY,GAAGC,MAAK,CAALA,aAAAA,CAArB,IAAqBA,CAArB;;AAEA,IAAIC,6CAAqC,GAAzC,IAAA;AACA,IAAIC,wCAAqC,GAAG,IAA5C,GAA4C,EAA5C;OAcO,SAAA,UAAA,CAAA,KAAA,EAA4C;AAAA,MAC7C,QAD6C,GACjD,KADiD,CAC7C,QAD6C;AAAA,MAC7C,OAD6C,GACjD,KADiD,CAC7C,OAD6C;AAAA,MAC7C,YAD6C,GACjD,KADiD,CAC7C,YAD6C;AAAA,MACXC,SADW,GACjD,KADiD,CACXA,SADW;AAEjD,MAAIC,QAAQ,GAAGC,MAAf,EAAA;AACA,MAAIC,MAAM,GAAGD,MAAb,EAAA;AACA,MAAIE,QAAQ,GAAGF,MAAM,CAArB,EAAqB,CAArB;AAEAG,EAAAA,eAAe,CAAC,YAAM;AAEpB,QAAIC,IAAI,GAAGL,QAAQ,CAARA,OAAAA,CAAX,WAAA;AAC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SAAA,EAJH3B,MAIG,CAJM,CAATA;AAMA,SAAO;AACL4D,IAAAA,cAAc,EAAEhB,UAAU,CAAA,8BAAA,CAAA,EAAA,EAAA,YAAA,EAAA;AAGtBiB,MAAAA,QAAQ,EAAElC,KAAK,CAALA,mBAAAA,IAA6B,CAACA,KAAK,CAAnCA,UAAAA,GAAiD,CAAjDA,CAAAA,GAAsDmC;AAH1C,KAAA,CAAA,EAAA,gBAAA;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 {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 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 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}\n\nconst FocusContext = React.createContext<FocusManager>(null);\n\nlet activeScope: RefObject<HTMLElement[]> = null;\nlet scopes: Set<RefObject<HTMLElement[]>> = new Set();\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\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    scopes.add(scopeRef);\n    return () => {\n      scopes.delete(scopeRef);\n    };\n  }, [children]);\n\n  useFocusContainment(scopeRef, contain);\n  useRestoreFocus(scopeRef, restoreFocus, contain);\n  useAutoFocus(scopeRef, autoFocus);\n\n  let focusManager = createFocusManager(scopeRef);\n\n  return (\n    <FocusContext.Provider value={focusManager}>\n      <span hidden ref={startRef} />\n      {children}\n      <span 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);\n}\n\nfunction createFocusManager(scopeRef: React.RefObject<HTMLElement[]>): FocusManager {\n  return {\n    focusNext(opts: FocusManagerOptions = {}) {\n      let node = opts.from || document.activeElement;\n      let focusable = getFocusableElementsInScope(scopeRef.current, opts);\n      let nextNode = focusable.find(n =>\n        !!(node.compareDocumentPosition(n) & (Node.DOCUMENT_POSITION_FOLLOWING | Node.DOCUMENT_POSITION_CONTAINED_BY))\n      );\n      if (!nextNode && opts.wrap) {\n        nextNode = focusable[0];\n      }\n      if (nextNode) {\n        nextNode.focus();\n      }\n      return nextNode;\n    },\n    focusPrevious(opts: FocusManagerOptions = {}) {\n      let node = opts.from || document.activeElement;\n      let focusable = getFocusableElementsInScope(scopeRef.current, opts).reverse();\n      let previousNode = focusable.find(n =>\n        !!(node.compareDocumentPosition(n) & (Node.DOCUMENT_POSITION_PRECEDING | Node.DOCUMENT_POSITION_CONTAINED_BY))\n      );\n      if (!previousNode && opts.wrap) {\n        previousNode = focusable[0];\n      }\n      if (previousNode) {\n        previousNode.focus();\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(',') + ',[tabindex]';\n\nfocusableElements.push('[tabindex]:not([tabindex=\"-1\"])');\nconst TABBABLE_ELEMENT_SELECTOR = focusableElements.join(':not([tabindex=\"-1\"]),');\n\nfunction getFocusableElementsInScope(scope: HTMLElement[], opts: FocusManagerOptions): HTMLElement[] {\n  let res = [];\n  let selector = opts.tabbable ? TABBABLE_ELEMENT_SELECTOR : FOCUSABLE_ELEMENT_SELECTOR;\n  for (let node of scope) {\n    if (node.matches(selector)) {\n      res.push(node);\n    }\n    res.push(...Array.from(node.querySelectorAll(selector)));\n  }\n  return res;\n}\n\nfunction useFocusContainment(scopeRef: RefObject<HTMLElement[]>, contain: boolean) {\n  let focusedNode = useRef<HTMLElement>();\n\n  let raf = useRef(null);\n  useEffect(() => {\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) {\n        return;\n      }\n\n      let focusedElement = document.activeElement as HTMLElement;\n      if (!isElementInScope(focusedElement, scope)) {\n        return;\n      }\n\n      let elements = getFocusableElementsInScope(scope, {tabbable: true});\n      let position = elements.indexOf(focusedElement);\n      let lastPosition = elements.length - 1;\n      let nextElement = null;\n\n      if (e.shiftKey) {\n        if (position <= 0) {\n          nextElement = elements[lastPosition];\n        } else {\n          nextElement = elements[position - 1];\n        }\n      } else {\n        if (position === lastPosition) {\n          nextElement = elements[0];\n        } else {\n          nextElement = elements[position + 1];\n        }\n      }\n\n      e.preventDefault();\n      if (nextElement) {\n        focusElement(nextElement, true);\n      }\n    };\n\n    let onFocus = (e) => {\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      let isInAnyScope = isElementInAnyScope(e.target, scopes);\n      if (!isInAnyScope) {\n        if (focusedNode.current) {\n          focusedNode.current.focus();\n        } else if (activeScope) {\n          focusFirstInScope(activeScope.current);\n        }\n      } else {\n        activeScope = scopeRef;\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        let isInAnyScope = isElementInAnyScope(document.activeElement, scopes);\n\n        if (!isInAnyScope) {\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, scopes: Set<RefObject<HTMLElement[]>>) {\n  for (let scope of scopes.values()) {\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 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 elements = getFocusableElementsInScope(scope, {tabbable: true});\n  focusElement(elements[0]);\n}\n\nfunction useAutoFocus(scopeRef: RefObject<HTMLElement[]>, autoFocus: boolean) {\n  useEffect(() => {\n    if (autoFocus) {\n      activeScope = scopeRef;\n      if (!isElementInScope(document.activeElement, activeScope.current)) {\n        focusFirstInScope(scopeRef.current);\n      }\n    }\n  }, [scopeRef, autoFocus]);\n}\n\nfunction useRestoreFocus(scopeRef: RefObject<HTMLElement[]>, restoreFocus: boolean, contain: boolean) {\n  // useLayoutEffect instead of useEffect so the active element is saved synchronously instead of asynchronously.\n  useLayoutEffect(() => {\n    let scope = scopeRef.current;\n    let nodeToRestore = document.activeElement as HTMLElement;\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, scope)) {\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 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, scope)) && 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, scope));\n\n        e.preventDefault();\n        e.stopPropagation();\n        if (nextElement) {\n          nextElement.focus();\n        } else {\n          // If there is no next element, blur the focused element to move focus to the body.\n          focusedElement.blur();\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, scope)) {\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) {\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          return NodeFilter.FILTER_ACCEPT;\n        }\n\n        return NodeFilter.FILTER_SKIP;\n      }\n    },\n    false\n  );\n\n  if (opts?.from) {\n    walker.currentNode = opts.from;\n  }\n\n  return walker;\n}\n","import {HTMLAttributes, useState} from 'react';\nimport {useFocus, useFocusVisible, useFocusWithin} from '@react-aria/interactions';\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 {within} = props;\n  let [isFocused, setFocused] = useState(false);\n  let [isFocusWithin, setFocusWithin] = useState(false);\n  let {isFocusVisible} = useFocusVisible(props);\n  let {focusProps} = useFocus({\n    isDisabled: within,\n    onFocusChange: setFocused\n  });\n  let {focusWithinProps} = useFocusWithin({\n    isDisabled: !within,\n    onFocusWithinChange: setFocusWithin\n  });\n\n  return {\n    isFocused: within ? isFocusWithin : isFocused,\n    isFocusVisible: (within ? isFocusWithin : isFocused) && isFocusVisible,\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 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","/*\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} from '@react-aria/utils';\nimport React, {HTMLAttributes, MutableRefObject, ReactNode, RefObject, useContext, useEffect} 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\n  useEffect(() => {\n    if (context && context.ref) {\n      context.ref.current = ref.current;\n      return () => {\n        context.ref.current = null;\n      };\n    }\n  }, [context, ref]);\n\n  return context;\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\n  useEffect(() => {\n    if (props.autoFocus && domRef.current) {\n      domRef.current.focus();\n    }\n  }, [props.autoFocus, domRef]);\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"}