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,CAAC,CAAC,AADT,AAAA,CAAA,EAAA,EAAA,sBAAsB,AAAtB,EAAuB,EAAI,OAAO,CAAE,CAAC,SAAU,CAAA,CAAI,GACnC,QAAQ,GAEzC,EAEA,IAGA,IAAI,EAAW,IAAI,iBAAiB,GAQpC,OAPA,EAAS,OAAO,CAAC,EAAI,OAAO,CAAE,CAC5B,QAAS,CAAA,EACT,UAAW,CAAA,EACX,WAAY,CAAA,EACZ,gBAAiB,CAAC,WAAY,WAAW,AAC3C,GAEO,KAKL,EAAS,UAAU,EACrB,CACF,CACF,GAEO,CAAA,GAAqB,CAC9B,C,E,C,e,Q,oB,Q,M,Q,iD,O,E,E,E,C,E","sources":["<anon>","packages/@react-aria/focus/src/index.ts","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","packages/@react-aria/focus/src/useHasTabbableChild.ts"],"sourcesContent":["// modules are defined as an array\n// [ module function, map of requires ]\n//\n// map of requires is short require name -> numeric require\n//\n// anything defined in a previous bundle is accessed via the\n// orig method which is the require for previous bundles\n\n(function (modules, entry, mainEntry, parcelRequireName, globalName) {\n /* eslint-disable no-undef */\n var globalObject =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n /* eslint-enable no-undef */\n\n // Save the require from previous bundle to this closure if any\n var previousRequire =\n typeof globalObject[parcelRequireName] === 'function' &&\n globalObject[parcelRequireName];\n\n var cache = previousRequire.cache || {};\n // Do not use `require` to prevent Webpack from trying to bundle this call\n var nodeRequire =\n typeof module !== 'undefined' &&\n typeof module.require === 'function' &&\n module.require.bind(module);\n\n function newRequire(name, jumped) {\n if (!cache[name]) {\n if (!modules[name]) {\n // if we cannot find the module within our internal map or\n // cache jump to the current global require ie. the last bundle\n // that was added to the page.\n var currentRequire =\n typeof globalObject[parcelRequireName] === 'function' &&\n globalObject[parcelRequireName];\n if (!jumped && currentRequire) {\n return currentRequire(name, true);\n }\n\n // If there are other bundles on this page the require from the\n // previous one is saved to 'previousRequire'. Repeat this as\n // many times as there are bundles until the module is found or\n // we exhaust the require chain.\n if (previousRequire) {\n return previousRequire(name, true);\n }\n\n // Try the node require function if it exists.\n if (nodeRequire && typeof name === 'string') {\n return nodeRequire(name);\n }\n\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n }\n\n localRequire.resolve = resolve;\n localRequire.cache = {};\n\n var module = (cache[name] = new newRequire.Module(name));\n\n modules[name][0].call(\n module.exports,\n localRequire,\n module,\n module.exports,\n this\n );\n }\n\n return cache[name].exports;\n\n function localRequire(x) {\n var res = localRequire.resolve(x);\n return res === false ? {} : newRequire(res);\n }\n\n function resolve(x) {\n var id = modules[name][1][x];\n return id != null ? id : x;\n }\n }\n\n function Module(moduleName) {\n this.id = moduleName;\n this.bundle = newRequire;\n this.exports = {};\n }\n\n newRequire.isParcelRequire = true;\n newRequire.Module = Module;\n newRequire.modules = modules;\n newRequire.cache = cache;\n newRequire.parent = previousRequire;\n newRequire.register = function (id, exports) {\n modules[id] = [\n function (require, module) {\n module.exports = exports;\n },\n {},\n ];\n };\n\n Object.defineProperty(newRequire, 'root', {\n get: function () {\n return globalObject[parcelRequireName];\n },\n });\n\n globalObject[parcelRequireName] = newRequire;\n\n for (var i = 0; i < entry.length; i++) {\n newRequire(entry[i]);\n }\n\n if (mainEntry) {\n // Expose entry point to Node, AMD or browser globals\n // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js\n var mainExports = newRequire(mainEntry);\n\n // CommonJS\n if (typeof exports === 'object' && typeof module !== 'undefined') {\n module.exports = mainExports;\n\n // RequireJS\n } else if (typeof define === 'function' && define.amd) {\n define(function () {\n return mainExports;\n });\n\n // <script>\n } else if (globalName) {\n this[globalName] = mainExports;\n }\n }\n})({\"2jmlk\":[function(require,module,exports) {\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 */ var parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\nparcelHelpers.export(exports, \"FocusScope\", ()=>(0, _focusScope.FocusScope));\nparcelHelpers.export(exports, \"useFocusManager\", ()=>(0, _focusScope.useFocusManager));\nparcelHelpers.export(exports, \"getFocusableTreeWalker\", ()=>(0, _focusScope.getFocusableTreeWalker));\nparcelHelpers.export(exports, \"createFocusManager\", ()=>(0, _focusScope.createFocusManager));\nparcelHelpers.export(exports, \"isElementInChildOfActiveScope\", ()=>(0, _focusScope.isElementInChildOfActiveScope));\nparcelHelpers.export(exports, \"isFocusable\", ()=>(0, _focusScope.isFocusable));\nparcelHelpers.export(exports, \"FocusRing\", ()=>(0, _focusRing.FocusRing));\nparcelHelpers.export(exports, \"FocusableProvider\", ()=>(0, _useFocusable.FocusableProvider));\nparcelHelpers.export(exports, \"useFocusable\", ()=>(0, _useFocusable.useFocusable));\nparcelHelpers.export(exports, \"useFocusRing\", ()=>(0, _useFocusRing.useFocusRing));\nparcelHelpers.export(exports, \"focusSafely\", ()=>(0, _focusSafely.focusSafely));\nparcelHelpers.export(exports, \"useHasTabbableChild\", ()=>(0, _useHasTabbableChild.useHasTabbableChild));\nvar _focusScope = require(\"./FocusScope\");\nvar _focusRing = require(\"./FocusRing\");\nvar _useFocusable = require(\"./useFocusable\");\nvar _useFocusRing = require(\"./useFocusRing\");\nvar _focusSafely = require(\"./focusSafely\");\nvar _useHasTabbableChild = require(\"./useHasTabbableChild\");\n\n},{\"./FocusScope\":\"2L33g\",\"./FocusRing\":\"8bKAK\",\"./useFocusable\":\"agOAb\",\"./useFocusRing\":\"2dQWP\",\"./focusSafely\":\"ea7XL\",\"./useHasTabbableChild\":\"imt6h\",\"@parcel/transformer-js/src/esmodule-helpers.js\":\"diccK\"}],\"2L33g\":[function(require,module,exports) {\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 */ var parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\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/**\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 */ parcelHelpers.export(exports, \"FocusScope\", ()=>FocusScope);\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 */ parcelHelpers.export(exports, \"useFocusManager\", ()=>useFocusManager);\nparcelHelpers.export(exports, \"isFocusable\", ()=>isFocusable);\n/** @private */ parcelHelpers.export(exports, \"isElementInChildOfActiveScope\", ()=>isElementInChildOfActiveScope);\n/**\n * Create a [TreeWalker]{@link https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker}\n * that matches all focusable/tabbable elements.\n */ parcelHelpers.export(exports, \"getFocusableTreeWalker\", ()=>getFocusableTreeWalker);\n/**\n * Creates a FocusManager object that can be used to move focus within an element.\n */ parcelHelpers.export(exports, \"createFocusManager\", ()=>createFocusManager);\nparcelHelpers.export(exports, \"focusScopeTree\", ()=>focusScopeTree);\nvar _focusSafely = require(\"./focusSafely\");\nvar _utils = require(\"@react-aria/utils\");\nvar _isElementVisible = require(\"./isElementVisible\");\nvar _react = require(\"react\");\nvar _reactDefault = parcelHelpers.interopDefault(_react);\nconst FocusContext = /*#__PURE__*/ (0, _reactDefault.default).createContext(null);\nconst RESTORE_FOCUS_EVENT = 'react-aria-focus-scope-restore';\nlet activeScope = null;\nfunction FocusScope(props) {\n let { children, contain, restoreFocus, autoFocus } = props;\n let startRef = (0, _react.useRef)(null);\n let endRef = (0, _react.useRef)(null);\n let scopeRef = (0, _react.useRef)([]);\n let { parentNode } = (0, _react.useContext)(FocusContext) || {};\n // Create a tree node here so we can add children to it even before it is added to the tree.\n let node = (0, _react.useMemo)(()=>new TreeNode({\n scopeRef\n }), [\n scopeRef\n ]);\n (0, _utils.useLayoutEffect)(()=>{\n // If a new scope mounts outside the active scope, (e.g. DialogContainer launched from a menu),\n // use the active scope as the parent instead of the parent from context. Layout effects run bottom\n // up, so if the parent is not yet added to the tree, don't do this. Only the outer-most FocusScope\n // that is being added should get the activeScope as its parent.\n let parent = parentNode || focusScopeTree.root;\n if (focusScopeTree.getTreeNode(parent.scopeRef) && activeScope && !isAncestorScope(activeScope, parent.scopeRef)) {\n let activeNode = focusScopeTree.getTreeNode(activeScope);\n if (activeNode) parent = activeNode;\n }\n // Add the node to the parent, and to the tree.\n parent.addChild(node);\n focusScopeTree.addNode(node);\n }, [\n node,\n parentNode\n ]);\n (0, _utils.useLayoutEffect)(()=>{\n let node = focusScopeTree.getTreeNode(scopeRef);\n if (node) node.contain = !!contain;\n }, [\n contain\n ]);\n (0, _utils.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 let stopPropagation = (e)=>e.stopPropagation();\n while(node && node !== endRef.current){\n nodes.push(node);\n // Stop custom restore focus event from propagating to parent focus scopes.\n node.addEventListener(RESTORE_FOCUS_EVENT, stopPropagation);\n node = node.nextSibling;\n }\n scopeRef.current = nodes;\n return ()=>{\n for (let node of nodes)node.removeEventListener(RESTORE_FOCUS_EVENT, stopPropagation);\n };\n }, [\n children\n ]);\n useActiveScopeTracker(scopeRef, restoreFocus, contain);\n useFocusContainment(scopeRef, contain);\n useRestoreFocus(scopeRef, restoreFocus, contain);\n useAutoFocus(scopeRef, autoFocus);\n // This needs to be an effect so that activeScope is updated after the FocusScope tree is complete.\n // It cannot be a useLayoutEffect because the parent of this node hasn't been attached in the tree yet.\n (0, _react.useEffect)(()=>{\n const activeElement = (0, _utils.getOwnerDocument)(scopeRef.current ? scopeRef.current[0] : undefined).activeElement;\n let scope = null;\n if (isElementInScope(activeElement, scopeRef.current)) {\n // We need to traverse the focusScope tree and find the bottom most scope that\n // contains the active element and set that as the activeScope.\n for (let node of focusScopeTree.traverse())if (node.scopeRef && isElementInScope(activeElement, node.scopeRef.current)) scope = node;\n if (scope === focusScopeTree.getTreeNode(scopeRef)) activeScope = scope.scopeRef;\n }\n }, [\n scopeRef\n ]);\n // This layout effect cleanup is so that the tree node is removed synchronously with react before the RAF\n // in useRestoreFocus cleanup runs.\n (0, _utils.useLayoutEffect)(()=>{\n return ()=>{\n // Scope may have been re-parented.\n let parentScope = focusScopeTree.getTreeNode(scopeRef)?.parent?.scopeRef ?? null;\n if ((scopeRef === activeScope || isAncestorScope(scopeRef, activeScope)) && (!parentScope || focusScopeTree.getTreeNode(parentScope))) activeScope = parentScope;\n focusScopeTree.removeTreeNode(scopeRef);\n };\n }, [\n scopeRef\n ]);\n let focusManager = (0, _react.useMemo)(()=>createFocusManagerForScope(scopeRef), []);\n let value = (0, _react.useMemo)(()=>({\n focusManager,\n parentNode: node\n }), [\n node,\n focusManager\n ]);\n return /*#__PURE__*/ (0, _reactDefault.default).createElement(FocusContext.Provider, {\n value: value\n }, /*#__PURE__*/ (0, _reactDefault.default).createElement(\"span\", {\n \"data-focus-scope-start\": true,\n hidden: true,\n ref: startRef\n }), children, /*#__PURE__*/ (0, _reactDefault.default).createElement(\"span\", {\n \"data-focus-scope-end\": true,\n hidden: true,\n ref: endRef\n }));\n}\nfunction useFocusManager() {\n return (0, _react.useContext)(FocusContext)?.focusManager;\n}\nfunction createFocusManagerForScope(scopeRef) {\n return {\n focusNext (opts = {}) {\n let scope = scopeRef.current;\n let { from, tabbable, wrap, accept } = opts;\n let node = from || (0, _utils.getOwnerDocument)(scope[0]).activeElement;\n let sentinel = scope[0].previousElementSibling;\n let scopeRoot = getScopeRoot(scope);\n let walker = getFocusableTreeWalker(scopeRoot, {\n tabbable,\n accept\n }, scope);\n walker.currentNode = isElementInScope(node, scope) ? node : sentinel;\n let nextNode = walker.nextNode();\n if (!nextNode && wrap) {\n walker.currentNode = sentinel;\n nextNode = walker.nextNode();\n }\n if (nextNode) focusElement(nextNode, true);\n return nextNode;\n },\n focusPrevious (opts = {}) {\n let scope = scopeRef.current;\n let { from, tabbable, wrap, accept } = opts;\n let node = from || (0, _utils.getOwnerDocument)(scope[0]).activeElement;\n let sentinel = scope[scope.length - 1].nextElementSibling;\n let scopeRoot = getScopeRoot(scope);\n let walker = getFocusableTreeWalker(scopeRoot, {\n tabbable,\n accept\n }, scope);\n walker.currentNode = isElementInScope(node, scope) ? node : sentinel;\n let previousNode = walker.previousNode();\n if (!previousNode && wrap) {\n walker.currentNode = sentinel;\n previousNode = walker.previousNode();\n }\n if (previousNode) focusElement(previousNode, true);\n return previousNode;\n },\n focusFirst (opts = {}) {\n let scope = scopeRef.current;\n let { tabbable, accept } = opts;\n let scopeRoot = getScopeRoot(scope);\n let walker = getFocusableTreeWalker(scopeRoot, {\n tabbable,\n accept\n }, scope);\n walker.currentNode = scope[0].previousElementSibling;\n let nextNode = walker.nextNode();\n if (nextNode) focusElement(nextNode, true);\n return nextNode;\n },\n focusLast (opts = {}) {\n let scope = scopeRef.current;\n let { tabbable, accept } = opts;\n let scopeRoot = getScopeRoot(scope);\n let walker = getFocusableTreeWalker(scopeRoot, {\n tabbable,\n accept\n }, scope);\n walker.currentNode = scope[scope.length - 1].nextElementSibling;\n let previousNode = walker.previousNode();\n if (previousNode) focusElement(previousNode, true);\n return previousNode;\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];\nconst FOCUSABLE_ELEMENT_SELECTOR = focusableElements.join(':not([hidden]),') + ',[tabindex]:not([disabled]):not([hidden])';\nfocusableElements.push('[tabindex]:not([tabindex=\"-1\"]):not([disabled])');\nconst TABBABLE_ELEMENT_SELECTOR = focusableElements.join(':not([hidden]):not([tabindex=\"-1\"]),');\nfunction isFocusable(element) {\n return element.matches(FOCUSABLE_ELEMENT_SELECTOR);\n}\nfunction getScopeRoot(scope) {\n return scope[0].parentElement;\n}\nfunction shouldContainFocus(scopeRef) {\n let scope = focusScopeTree.getTreeNode(activeScope);\n while(scope && scope.scopeRef !== scopeRef){\n if (scope.contain) return false;\n scope = scope.parent;\n }\n return true;\n}\nfunction useFocusContainment(scopeRef, contain) {\n let focusedNode = (0, _react.useRef)(undefined);\n let raf = (0, _react.useRef)(undefined);\n (0, _utils.useLayoutEffect)(()=>{\n let scope = scopeRef.current;\n if (!contain) {\n // if contain was changed, then we should cancel any ongoing waits to pull focus back into containment\n if (raf.current) {\n cancelAnimationFrame(raf.current);\n raf.current = undefined;\n }\n return;\n }\n const ownerDocument = (0, _utils.getOwnerDocument)(scope ? scope[0] : undefined);\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 || !shouldContainFocus(scopeRef) || e.isComposing) return;\n let focusedElement = ownerDocument.activeElement;\n let scope = scopeRef.current;\n if (!scope || !isElementInScope(focusedElement, scope)) return;\n let scopeRoot = getScopeRoot(scope);\n let walker = getFocusableTreeWalker(scopeRoot, {\n tabbable: true\n }, scope);\n if (!focusedElement) return;\n walker.currentNode = focusedElement;\n let nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();\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 e.preventDefault();\n if (nextElement) focusElement(nextElement, true);\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)) && isElementInScope(e.target, scopeRef.current)) {\n activeScope = scopeRef;\n focusedNode.current = e.target;\n } else if (shouldContainFocus(scopeRef) && !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) focusedNode.current.focus();\n else if (activeScope && activeScope.current) focusFirstInScope(activeScope.current);\n } else if (shouldContainFocus(scopeRef)) focusedNode.current = e.target;\n };\n let onBlur = (e)=>{\n // Firefox doesn't shift focus back to the Dialog properly without this\n if (raf.current) cancelAnimationFrame(raf.current);\n raf.current = requestAnimationFrame(()=>{\n // Use document.activeElement instead of e.relatedTarget so we can tell if user clicked into iframe\n if (ownerDocument.activeElement && shouldContainFocus(scopeRef) && !isElementInChildScope(ownerDocument.activeElement, scopeRef)) {\n activeScope = scopeRef;\n if (ownerDocument.body.contains(e.target)) {\n focusedNode.current = e.target;\n focusedNode.current?.focus();\n } else if (activeScope.current) focusFirstInScope(activeScope.current);\n }\n });\n };\n ownerDocument.addEventListener('keydown', onKeyDown, false);\n ownerDocument.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 ownerDocument.removeEventListener('keydown', onKeyDown, false);\n ownerDocument.removeEventListener('focusin', onFocus, false);\n scope?.forEach((element)=>element.removeEventListener('focusin', onFocus, false));\n scope?.forEach((element)=>element.removeEventListener('focusout', onBlur, false));\n };\n }, [\n scopeRef,\n contain\n ]);\n // This is a useLayoutEffect so it is guaranteed to run before our async synthetic blur\n // eslint-disable-next-line arrow-body-style\n (0, _utils.useLayoutEffect)(()=>{\n return ()=>{\n if (raf.current) cancelAnimationFrame(raf.current);\n };\n }, [\n raf\n ]);\n}\nfunction isElementInAnyScope(element) {\n return isElementInChildScope(element);\n}\nfunction isElementInScope(element, scope) {\n if (!element) return false;\n if (!scope) return false;\n return scope.some((node)=>node.contains(element));\n}\nfunction isElementInChildScope(element, scope = null) {\n // If the element is within a top layer element (e.g. toasts), always allow moving focus there.\n if (element instanceof Element && element.closest('[data-react-aria-top-layer]')) return true;\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 { scopeRef: s } of focusScopeTree.traverse(focusScopeTree.getTreeNode(scope))){\n if (s && isElementInScope(element, s.current)) return true;\n }\n return false;\n}\nfunction isElementInChildOfActiveScope(element) {\n return isElementInChildScope(element, activeScope);\n}\nfunction isAncestorScope(ancestor, scope) {\n let parent = focusScopeTree.getTreeNode(scope)?.parent;\n while(parent){\n if (parent.scopeRef === ancestor) return true;\n parent = parent.parent;\n }\n return false;\n}\nfunction focusElement(element, scroll = false) {\n if (element != null && !scroll) try {\n (0, _focusSafely.focusSafely)(element);\n } catch (err) {\n // ignore\n }\n else if (element != null) try {\n element.focus();\n } catch (err) {\n // ignore\n }\n}\nfunction getFirstInScope(scope, tabbable = true) {\n let sentinel = scope[0].previousElementSibling;\n let scopeRoot = getScopeRoot(scope);\n let walker = getFocusableTreeWalker(scopeRoot, {\n tabbable\n }, scope);\n walker.currentNode = sentinel;\n let nextNode = walker.nextNode();\n // If the scope does not contain a tabbable element, use the first focusable element.\n if (tabbable && !nextNode) {\n scopeRoot = getScopeRoot(scope);\n walker = getFocusableTreeWalker(scopeRoot, {\n tabbable: false\n }, scope);\n walker.currentNode = sentinel;\n nextNode = walker.nextNode();\n }\n return nextNode;\n}\nfunction focusFirstInScope(scope, tabbable = true) {\n focusElement(getFirstInScope(scope, tabbable));\n}\nfunction useAutoFocus(scopeRef, autoFocus) {\n const autoFocusRef = (0, _reactDefault.default).useRef(autoFocus);\n (0, _react.useEffect)(()=>{\n if (autoFocusRef.current) {\n activeScope = scopeRef;\n const ownerDocument = (0, _utils.getOwnerDocument)(scopeRef.current ? scopeRef.current[0] : undefined);\n if (!isElementInScope(ownerDocument.activeElement, activeScope.current) && scopeRef.current) focusFirstInScope(scopeRef.current);\n }\n autoFocusRef.current = false;\n }, [\n scopeRef\n ]);\n}\nfunction useActiveScopeTracker(scopeRef, restore, contain) {\n // tracks the active scope, in case restore and contain are both false.\n // if either are true, this is tracked in useRestoreFocus or useFocusContainment.\n (0, _utils.useLayoutEffect)(()=>{\n if (restore || contain) return;\n let scope = scopeRef.current;\n const ownerDocument = (0, _utils.getOwnerDocument)(scope ? scope[0] : undefined);\n let onFocus = (e)=>{\n let target = e.target;\n if (isElementInScope(target, scopeRef.current)) activeScope = scopeRef;\n else if (!isElementInAnyScope(target)) activeScope = null;\n };\n ownerDocument.addEventListener('focusin', onFocus, false);\n scope?.forEach((element)=>element.addEventListener('focusin', onFocus, false));\n return ()=>{\n ownerDocument.removeEventListener('focusin', onFocus, false);\n scope?.forEach((element)=>element.removeEventListener('focusin', onFocus, false));\n };\n }, [\n scopeRef,\n restore,\n contain\n ]);\n}\nfunction shouldRestoreFocus(scopeRef) {\n let scope = focusScopeTree.getTreeNode(activeScope);\n while(scope && scope.scopeRef !== scopeRef){\n if (scope.nodeToRestore) return false;\n scope = scope.parent;\n }\n return scope?.scopeRef === scopeRef;\n}\nfunction useRestoreFocus(scopeRef, restoreFocus, contain) {\n // create a ref during render instead of useLayoutEffect so the active element is saved before a child with autoFocus=true mounts.\n // eslint-disable-next-line no-restricted-globals\n const nodeToRestoreRef = (0, _react.useRef)(typeof document !== 'undefined' ? (0, _utils.getOwnerDocument)(scopeRef.current ? scopeRef.current[0] : undefined).activeElement : null);\n // restoring scopes should all track if they are active regardless of contain, but contain already tracks it plus logic to contain the focus\n // restoring-non-containing scopes should only care if they become active so they can perform the restore\n (0, _utils.useLayoutEffect)(()=>{\n let scope = scopeRef.current;\n const ownerDocument = (0, _utils.getOwnerDocument)(scope ? scope[0] : undefined);\n if (!restoreFocus || contain) return;\n let onFocus = ()=>{\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)) && isElementInScope(ownerDocument.activeElement, scopeRef.current)) activeScope = scopeRef;\n };\n ownerDocument.addEventListener('focusin', onFocus, false);\n scope?.forEach((element)=>element.addEventListener('focusin', onFocus, false));\n return ()=>{\n ownerDocument.removeEventListener('focusin', onFocus, false);\n scope?.forEach((element)=>element.removeEventListener('focusin', onFocus, false));\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n scopeRef,\n contain\n ]);\n (0, _utils.useLayoutEffect)(()=>{\n const ownerDocument = (0, _utils.getOwnerDocument)(scopeRef.current ? scopeRef.current[0] : undefined);\n if (!restoreFocus) return;\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)=>{\n if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey || !shouldContainFocus(scopeRef) || e.isComposing) return;\n let focusedElement = ownerDocument.activeElement;\n if (!isElementInScope(focusedElement, scopeRef.current)) return;\n let treeNode = focusScopeTree.getTreeNode(scopeRef);\n if (!treeNode) return;\n let nodeToRestore = treeNode.nodeToRestore;\n // Create a DOM tree walker that matches all tabbable elements\n let walker = getFocusableTreeWalker(ownerDocument.body, {\n 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();\n if (!nodeToRestore || !ownerDocument.body.contains(nodeToRestore) || nodeToRestore === ownerDocument.body) {\n nodeToRestore = undefined;\n treeNode.nodeToRestore = undefined;\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 // Skip over elements within the scope, in case the scope immediately follows the node to restore.\n do nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();\n while (isElementInScope(nextElement, scopeRef.current));\n e.preventDefault();\n e.stopPropagation();\n if (nextElement) focusElement(nextElement, true);\n else // 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)) focusedElement.blur();\n else focusElement(nodeToRestore, true);\n }\n };\n if (!contain) ownerDocument.addEventListener('keydown', onKeyDown, true);\n return ()=>{\n if (!contain) ownerDocument.removeEventListener('keydown', onKeyDown, true);\n };\n }, [\n scopeRef,\n restoreFocus,\n contain\n ]);\n // useLayoutEffect instead of useEffect so the active element is saved synchronously instead of asynchronously.\n (0, _utils.useLayoutEffect)(()=>{\n const ownerDocument = (0, _utils.getOwnerDocument)(scopeRef.current ? scopeRef.current[0] : undefined);\n if (!restoreFocus) return;\n let treeNode = focusScopeTree.getTreeNode(scopeRef);\n if (!treeNode) return;\n treeNode.nodeToRestore = nodeToRestoreRef.current ?? undefined;\n return ()=>{\n let treeNode = focusScopeTree.getTreeNode(scopeRef);\n if (!treeNode) return;\n let nodeToRestore = treeNode.nodeToRestore;\n // if we already lost focus to the body and this was the active scope, then we should attempt to restore\n if (restoreFocus && nodeToRestore && // eslint-disable-next-line react-hooks/exhaustive-deps\n (isElementInScope(ownerDocument.activeElement, scopeRef.current) || ownerDocument.activeElement === ownerDocument.body && shouldRestoreFocus(scopeRef))) {\n // freeze the focusScopeTree so it persists after the raf, otherwise during unmount nodes are removed from it\n let clonedTree = focusScopeTree.clone();\n requestAnimationFrame(()=>{\n // Only restore focus if we've lost focus to the body, the alternative is that focus has been purposefully moved elsewhere\n if (ownerDocument.activeElement === ownerDocument.body) {\n // look up the tree starting with our scope to find a nodeToRestore still in the DOM\n let treeNode = clonedTree.getTreeNode(scopeRef);\n while(treeNode){\n if (treeNode.nodeToRestore && treeNode.nodeToRestore.isConnected) {\n restoreFocusToElement(treeNode.nodeToRestore);\n return;\n }\n treeNode = treeNode.parent;\n }\n // If no nodeToRestore was found, focus the first element in the nearest\n // ancestor scope that is still in the tree.\n treeNode = clonedTree.getTreeNode(scopeRef);\n while(treeNode){\n if (treeNode.scopeRef && treeNode.scopeRef.current && focusScopeTree.getTreeNode(treeNode.scopeRef)) {\n let node = getFirstInScope(treeNode.scopeRef.current, true);\n restoreFocusToElement(node);\n return;\n }\n treeNode = treeNode.parent;\n }\n }\n });\n }\n };\n }, [\n scopeRef,\n restoreFocus\n ]);\n}\nfunction restoreFocusToElement(node) {\n // Dispatch a custom event that parent elements can intercept to customize focus restoration.\n // For example, virtualized collection components reuse DOM elements, so the original element\n // might still exist in the DOM but representing a different item.\n if (node.dispatchEvent(new CustomEvent(RESTORE_FOCUS_EVENT, {\n bubbles: true,\n cancelable: true\n }))) focusElement(node);\n}\nfunction getFocusableTreeWalker(root, opts, scope) {\n let selector = opts?.tabbable ? TABBABLE_ELEMENT_SELECTOR : FOCUSABLE_ELEMENT_SELECTOR;\n let walker = (0, _utils.getOwnerDocument)(root).createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {\n acceptNode (node) {\n // Skip nodes inside the starting node.\n if (opts?.from?.contains(node)) return NodeFilter.FILTER_REJECT;\n if (node.matches(selector) && (0, _isElementVisible.isElementVisible)(node) && (!scope || isElementInScope(node, scope)) && (!opts?.accept || opts.accept(node))) return NodeFilter.FILTER_ACCEPT;\n return NodeFilter.FILTER_SKIP;\n }\n });\n if (opts?.from) walker.currentNode = opts.from;\n return walker;\n}\nfunction createFocusManager(ref, defaultOptions = {}) {\n return {\n focusNext (opts = {}) {\n let root = ref.current;\n if (!root) return null;\n let { from, tabbable = defaultOptions.tabbable, wrap = defaultOptions.wrap, accept = defaultOptions.accept } = opts;\n let node = from || (0, _utils.getOwnerDocument)(root).activeElement;\n let walker = getFocusableTreeWalker(root, {\n tabbable,\n accept\n });\n if (root.contains(node)) walker.currentNode = node;\n let nextNode = walker.nextNode();\n if (!nextNode && wrap) {\n walker.currentNode = root;\n nextNode = walker.nextNode();\n }\n if (nextNode) focusElement(nextNode, true);\n return nextNode;\n },\n focusPrevious (opts = defaultOptions) {\n let root = ref.current;\n if (!root) return null;\n let { from, tabbable = defaultOptions.tabbable, wrap = defaultOptions.wrap, accept = defaultOptions.accept } = opts;\n let node = from || (0, _utils.getOwnerDocument)(root).activeElement;\n let walker = getFocusableTreeWalker(root, {\n tabbable,\n accept\n });\n if (root.contains(node)) walker.currentNode = node;\n else {\n let next = last(walker);\n if (next) focusElement(next, true);\n return next ?? null;\n }\n let previousNode = walker.previousNode();\n if (!previousNode && wrap) {\n walker.currentNode = root;\n let lastNode = last(walker);\n if (!lastNode) // couldn't wrap\n return null;\n previousNode = lastNode;\n }\n if (previousNode) focusElement(previousNode, true);\n return previousNode ?? null;\n },\n focusFirst (opts = defaultOptions) {\n let root = ref.current;\n if (!root) return null;\n let { tabbable = defaultOptions.tabbable, accept = defaultOptions.accept } = opts;\n let walker = getFocusableTreeWalker(root, {\n tabbable,\n accept\n });\n let nextNode = walker.nextNode();\n if (nextNode) focusElement(nextNode, true);\n return nextNode;\n },\n focusLast (opts = defaultOptions) {\n let root = ref.current;\n if (!root) return null;\n let { tabbable = defaultOptions.tabbable, accept = defaultOptions.accept } = opts;\n let walker = getFocusableTreeWalker(root, {\n tabbable,\n accept\n });\n let next = last(walker);\n if (next) focusElement(next, true);\n return next ?? null;\n }\n };\n}\nfunction last(walker) {\n let next = undefined;\n let last;\n do {\n last = walker.lastChild();\n if (last) next = last;\n }while (last);\n return next;\n}\nclass Tree {\n constructor(){\n this.fastMap = new Map();\n this.root = new TreeNode({\n scopeRef: null\n });\n this.fastMap.set(null, this.root);\n }\n get size() {\n return this.fastMap.size;\n }\n getTreeNode(data) {\n return this.fastMap.get(data);\n }\n addTreeNode(scopeRef, parent, nodeToRestore) {\n let parentNode = this.fastMap.get(parent ?? null);\n if (!parentNode) return;\n let node = new TreeNode({\n scopeRef\n });\n parentNode.addChild(node);\n node.parent = parentNode;\n this.fastMap.set(scopeRef, node);\n if (nodeToRestore) node.nodeToRestore = nodeToRestore;\n }\n addNode(node) {\n this.fastMap.set(node.scopeRef, node);\n }\n removeTreeNode(scopeRef) {\n // never remove the root\n if (scopeRef === null) return;\n let node = this.fastMap.get(scopeRef);\n if (!node) return;\n let parentNode = node.parent;\n // when we remove a scope, check if any sibling scopes are trying to restore focus to something inside the scope we're removing\n // if we are, then replace the siblings restore with the restore from the scope we're removing\n for (let current of this.traverse())if (current !== node && node.nodeToRestore && current.nodeToRestore && node.scopeRef && node.scopeRef.current && isElementInScope(current.nodeToRestore, node.scopeRef.current)) current.nodeToRestore = node.nodeToRestore;\n let children = node.children;\n if (parentNode) {\n parentNode.removeChild(node);\n if (children.size > 0) children.forEach((child)=>parentNode && parentNode.addChild(child));\n }\n this.fastMap.delete(node.scopeRef);\n }\n // Pre Order Depth First\n *traverse(node = this.root) {\n if (node.scopeRef != null) yield node;\n if (node.children.size > 0) for (let child of node.children)yield* this.traverse(child);\n }\n clone() {\n let newTree = new Tree();\n for (let node of this.traverse())newTree.addTreeNode(node.scopeRef, node.parent?.scopeRef ?? null, node.nodeToRestore);\n return newTree;\n }\n}\nclass TreeNode {\n constructor(props){\n this.children = new Set();\n this.contain = false;\n this.scopeRef = props.scopeRef;\n }\n addChild(node) {\n this.children.add(node);\n node.parent = this;\n }\n removeChild(node) {\n this.children.delete(node);\n node.parent = undefined;\n }\n}\nlet focusScopeTree = new Tree();\n\n},{\"./focusSafely\":\"ea7XL\",\"@react-aria/utils\":\"e9Yvo\",\"./isElementVisible\":\"8PrDF\",\"react\":\"jEiK2\",\"@parcel/transformer-js/src/esmodule-helpers.js\":\"diccK\"}],\"ea7XL\":[function(require,module,exports) {\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 */ var parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\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 */ parcelHelpers.export(exports, \"focusSafely\", ()=>focusSafely);\nvar _utils = require(\"@react-aria/utils\");\nvar _interactions = require(\"@react-aria/interactions\");\nfunction focusSafely(element) {\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 const ownerDocument = (0, _utils.getOwnerDocument)(element);\n if ((0, _interactions.getInteractionModality)() === 'virtual') {\n let lastFocusedElement = ownerDocument.activeElement;\n (0, _utils.runAfterTransition)(()=>{\n // If focus did not move and the element is still in the document, focus it.\n if (ownerDocument.activeElement === lastFocusedElement && element.isConnected) (0, _utils.focusWithoutScrolling)(element);\n });\n } else (0, _utils.focusWithoutScrolling)(element);\n}\n\n},{\"@react-aria/utils\":\"e9Yvo\",\"@react-aria/interactions\":\"dtdXE\",\"@parcel/transformer-js/src/esmodule-helpers.js\":\"diccK\"}],\"8PrDF\":[function(require,module,exports) {\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 */ var parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\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 */ parcelHelpers.export(exports, \"isElementVisible\", ()=>isElementVisible);\nvar _utils = require(\"@react-aria/utils\");\nfunction isStyleVisible(element) {\n const windowObject = (0, _utils.getOwnerWindow)(element);\n if (!(element instanceof windowObject.HTMLElement) && !(element instanceof windowObject.SVGElement)) return false;\n let { display, visibility } = element.style;\n let isVisible = display !== 'none' && visibility !== 'hidden' && visibility !== 'collapse';\n if (isVisible) {\n const { getComputedStyle } = element.ownerDocument.defaultView;\n let { display: computedDisplay, visibility: computedVisibility } = getComputedStyle(element);\n isVisible = computedDisplay !== 'none' && computedVisibility !== 'hidden' && computedVisibility !== 'collapse';\n }\n return isVisible;\n}\nfunction isAttributeVisible(element, childElement) {\n return !element.hasAttribute('hidden') && // Ignore HiddenSelect when tree walking.\n !element.hasAttribute('data-react-aria-prevent-focus') && (element.nodeName === 'DETAILS' && childElement && childElement.nodeName !== 'SUMMARY' ? element.hasAttribute('open') : true);\n}\nfunction isElementVisible(element, childElement) {\n return element.nodeName !== '#comment' && isStyleVisible(element) && isAttributeVisible(element, childElement) && (!element.parentElement || isElementVisible(element.parentElement, element));\n}\n\n},{\"@react-aria/utils\":\"e9Yvo\",\"@parcel/transformer-js/src/esmodule-helpers.js\":\"diccK\"}],\"8bKAK\":[function(require,module,exports) {\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 */ var parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\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 */ parcelHelpers.export(exports, \"FocusRing\", ()=>FocusRing);\nvar _clsx = require(\"clsx\");\nvar _clsxDefault = parcelHelpers.interopDefault(_clsx);\nvar _utils = require(\"@react-aria/utils\");\nvar _react = require(\"react\");\nvar _reactDefault = parcelHelpers.interopDefault(_react);\nvar _useFocusRing = require(\"./useFocusRing\");\nfunction FocusRing(props) {\n let { children, focusClass, focusRingClass } = props;\n let { isFocused, isFocusVisible, focusProps } = (0, _useFocusRing.useFocusRing)(props);\n let child = (0, _reactDefault.default).Children.only(children);\n return /*#__PURE__*/ (0, _reactDefault.default).cloneElement(child, (0, _utils.mergeProps)(child.props, {\n ...focusProps,\n className: (0, _clsxDefault.default)({\n [focusClass || '']: isFocused,\n [focusRingClass || '']: isFocusVisible\n })\n }));\n}\n\n},{\"clsx\":\"8TJoV\",\"@react-aria/utils\":\"e9Yvo\",\"react\":\"jEiK2\",\"./useFocusRing\":\"2dQWP\",\"@parcel/transformer-js/src/esmodule-helpers.js\":\"diccK\"}],\"2dQWP\":[function(require,module,exports) {\nvar parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\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 */ parcelHelpers.export(exports, \"useFocusRing\", ()=>useFocusRing);\nvar _interactions = require(\"@react-aria/interactions\");\nvar _react = require(\"react\");\nfunction useFocusRing(props = {}) {\n let { autoFocus = false, isTextInput, within } = props;\n let state = (0, _react.useRef)({\n isFocused: false,\n isFocusVisible: autoFocus || (0, _interactions.isFocusVisible)()\n });\n let [isFocused, setFocused] = (0, _react.useState)(false);\n let [isFocusVisibleState, setFocusVisible] = (0, _react.useState)(()=>state.current.isFocused && state.current.isFocusVisible);\n let updateState = (0, _react.useCallback)(()=>setFocusVisible(state.current.isFocused && state.current.isFocusVisible), []);\n let onFocusChange = (0, _react.useCallback)((isFocused)=>{\n state.current.isFocused = isFocused;\n setFocused(isFocused);\n updateState();\n }, [\n updateState\n ]);\n (0, _interactions.useFocusVisibleListener)((isFocusVisible)=>{\n state.current.isFocusVisible = isFocusVisible;\n updateState();\n }, [], {\n isTextInput\n });\n let { focusProps } = (0, _interactions.useFocus)({\n isDisabled: within,\n onFocusChange\n });\n let { focusWithinProps } = (0, _interactions.useFocusWithin)({\n isDisabled: !within,\n onFocusWithinChange: onFocusChange\n });\n return {\n isFocused,\n isFocusVisible: isFocusVisibleState,\n focusProps: within ? focusWithinProps : focusProps\n };\n}\n\n},{\"@react-aria/interactions\":\"dtdXE\",\"react\":\"jEiK2\",\"@parcel/transformer-js/src/esmodule-helpers.js\":\"diccK\"}],\"agOAb\":[function(require,module,exports) {\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 */ var parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\nparcelHelpers.export(exports, \"FocusableProvider\", ()=>_FocusableProvider);\n/**\n * Used to make an element focusable and capable of auto focus.\n */ parcelHelpers.export(exports, \"useFocusable\", ()=>useFocusable);\nvar _ = require(\"./\");\nvar _utils = require(\"@react-aria/utils\");\nvar _react = require(\"react\");\nvar _reactDefault = parcelHelpers.interopDefault(_react);\nvar _interactions = require(\"@react-aria/interactions\");\nlet FocusableContext = /*#__PURE__*/ (0, _reactDefault.default).createContext(null);\nfunction useFocusableContext(ref) {\n let context = (0, _react.useContext)(FocusableContext) || {};\n (0, _utils.useSyncRef)(context, ref);\n // eslint-disable-next-line\n let { ref: _, ...otherProps } = context;\n return otherProps;\n}\n/**\n * Provides DOM props to the nearest focusable child.\n */ function FocusableProvider(props, ref) {\n let { children, ...otherProps } = props;\n let objRef = (0, _utils.useObjectRef)(ref);\n let context = {\n ...otherProps,\n ref: objRef\n };\n return /*#__PURE__*/ (0, _reactDefault.default).createElement(FocusableContext.Provider, {\n value: context\n }, children);\n}\nlet _FocusableProvider = /*#__PURE__*/ (0, _reactDefault.default).forwardRef(FocusableProvider);\nfunction useFocusable(props, domRef) {\n let { focusProps } = (0, _interactions.useFocus)(props);\n let { keyboardProps } = (0, _interactions.useKeyboard)(props);\n let interactions = (0, _utils.mergeProps)(focusProps, keyboardProps);\n let domProps = useFocusableContext(domRef);\n let interactionProps = props.isDisabled ? {} : domProps;\n let autoFocusRef = (0, _react.useRef)(props.autoFocus);\n (0, _react.useEffect)(()=>{\n if (autoFocusRef.current && domRef.current) (0, _.focusSafely)(domRef.current);\n autoFocusRef.current = false;\n }, [\n domRef\n ]);\n return {\n focusableProps: (0, _utils.mergeProps)({\n ...interactions,\n tabIndex: props.excludeFromTabOrder && !props.isDisabled ? -1 : undefined\n }, interactionProps)\n };\n}\n\n},{\"./\":\"2jmlk\",\"@react-aria/utils\":\"e9Yvo\",\"react\":\"jEiK2\",\"@react-aria/interactions\":\"dtdXE\",\"@parcel/transformer-js/src/esmodule-helpers.js\":\"diccK\"}],\"imt6h\":[function(require,module,exports) {\n/*\n * Copyright 2022 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 */ var parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\n// This was created for a special empty case of a component that can have child or\n// be empty, like Collection/Virtualizer/Table/ListView/etc. When these components\n// are empty they can have a message with a tabbable element, which is like them\n// being not empty, when it comes to focus and tab order.\n/**\n * Returns whether an element has a tabbable child, and updates as children change.\n * @private\n */ parcelHelpers.export(exports, \"useHasTabbableChild\", ()=>useHasTabbableChild);\nvar _focusScope = require(\"./FocusScope\");\nvar _utils = require(\"@react-aria/utils\");\nvar _react = require(\"react\");\nfunction useHasTabbableChild(ref, options) {\n let isDisabled = options?.isDisabled;\n let [hasTabbableChild, setHasTabbableChild] = (0, _react.useState)(false);\n (0, _utils.useLayoutEffect)(()=>{\n if (ref?.current && !isDisabled) {\n let update = ()=>{\n if (ref.current) {\n let walker = (0, _focusScope.getFocusableTreeWalker)(ref.current, {\n tabbable: true\n });\n setHasTabbableChild(!!walker.nextNode());\n }\n };\n update();\n // Update when new elements are inserted, or the tabIndex/disabled attribute updates.\n let observer = new MutationObserver(update);\n observer.observe(ref.current, {\n subtree: true,\n childList: true,\n attributes: true,\n attributeFilter: [\n 'tabIndex',\n 'disabled'\n ]\n });\n return ()=>{\n // Disconnect mutation observer when a React update occurs on the top-level component\n // so we update synchronously after re-rendering. Otherwise React will emit act warnings\n // in tests since mutation observers fire asynchronously. The mutation observer is necessary\n // so we also update if a child component re-renders and adds/removes something tabbable.\n observer.disconnect();\n };\n }\n });\n return isDisabled ? false : hasTabbableChild;\n}\n\n},{\"./FocusScope\":\"2L33g\",\"@react-aria/utils\":\"e9Yvo\",\"react\":\"jEiK2\",\"@parcel/transformer-js/src/esmodule-helpers.js\":\"diccK\"}]},[], null, \"parcelRequire94c2\")\n\n//# sourceMappingURL=useButton.stories.16ca2df7.js.map\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\nexport {FocusScope, useFocusManager, getFocusableTreeWalker, createFocusManager, isElementInChildOfActiveScope, isFocusable} from './FocusScope';\nexport {FocusRing} from './FocusRing';\nexport {FocusableProvider, useFocusable} from './useFocusable';\nexport {useFocusRing} from './useFocusRing';\nexport {focusSafely} from './focusSafely';\nexport {useHasTabbableChild} from './useHasTabbableChild';\n\nexport type {FocusScopeProps, FocusManager, FocusManagerOptions} from './FocusScope';\nexport type {FocusRingProps} from './FocusRing';\nexport type {FocusableAria, FocusableOptions, FocusableProviderProps} from './useFocusable';\nexport type {AriaFocusRingProps, FocusRingAria} from './useFocusRing';\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 {FocusableElement, RefObject} from '@react-types/shared';\nimport {focusSafely} from './focusSafely';\nimport {getOwnerDocument, useLayoutEffect} from '@react-aria/utils';\nimport {isElementVisible} from './isElementVisible';\nimport React, {ReactNode, useContext, useEffect, useMemo, useRef} from 'react';\n\nexport interface 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\nexport interface FocusManagerOptions {\n /** The element to start searching from. The currently focused element by default. */\n from?: Element,\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 /** A callback that determines whether the given element is focused. */\n accept?: (node: Element) => boolean\n}\n\nexport interface FocusManager {\n /** Moves focus to the next focusable or tabbable element in the focus scope. */\n focusNext(opts?: FocusManagerOptions): FocusableElement | null,\n /** Moves focus to the previous focusable or tabbable element in the focus scope. */\n focusPrevious(opts?: FocusManagerOptions): FocusableElement | null,\n /** Moves focus to the first focusable or tabbable element in the focus scope. */\n focusFirst(opts?: FocusManagerOptions): FocusableElement | null,\n /** Moves focus to the last focusable or tabbable element in the focus scope. */\n focusLast(opts?: FocusManagerOptions): FocusableElement | null\n}\n\ntype ScopeRef = RefObject<Element[] | null> | null;\ninterface IFocusContext {\n focusManager: FocusManager,\n parentNode: TreeNode | null\n}\n\nconst FocusContext = React.createContext<IFocusContext | null>(null);\nconst RESTORE_FOCUS_EVENT = 'react-aria-focus-scope-restore';\n\nlet activeScope: ScopeRef = null;\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\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>(null);\n let endRef = useRef<HTMLSpanElement>(null);\n let scopeRef = useRef<Element[]>([]);\n let {parentNode} = useContext(FocusContext) || {};\n\n // Create a tree node here so we can add children to it even before it is added to the tree.\n let node = useMemo(() => new TreeNode({scopeRef}), [scopeRef]);\n\n useLayoutEffect(() => {\n // If a new scope mounts outside the active scope, (e.g. DialogContainer launched from a menu),\n // use the active scope as the parent instead of the parent from context. Layout effects run bottom\n // up, so if the parent is not yet added to the tree, don't do this. Only the outer-most FocusScope\n // that is being added should get the activeScope as its parent.\n let parent = parentNode || focusScopeTree.root;\n if (focusScopeTree.getTreeNode(parent.scopeRef) && activeScope && !isAncestorScope(activeScope, parent.scopeRef)) {\n let activeNode = focusScopeTree.getTreeNode(activeScope);\n if (activeNode) {\n parent = activeNode;\n }\n }\n\n // Add the node to the parent, and to the tree.\n parent.addChild(node);\n focusScopeTree.addNode(node);\n }, [node, parentNode]);\n\n useLayoutEffect(() => {\n let node = focusScopeTree.getTreeNode(scopeRef);\n if (node) {\n node.contain = !!contain;\n }\n }, [contain]);\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: Element[] = [];\n let stopPropagation = e => e.stopPropagation();\n while (node && node !== endRef.current) {\n nodes.push(node as Element);\n // Stop custom restore focus event from propagating to parent focus scopes.\n node.addEventListener(RESTORE_FOCUS_EVENT, stopPropagation);\n node = node.nextSibling as Element;\n }\n\n scopeRef.current = nodes;\n\n return () => {\n for (let node of nodes) {\n node.removeEventListener(RESTORE_FOCUS_EVENT, stopPropagation);\n }\n };\n }, [children]);\n\n useActiveScopeTracker(scopeRef, restoreFocus, contain);\n useFocusContainment(scopeRef, contain);\n useRestoreFocus(scopeRef, restoreFocus, contain);\n useAutoFocus(scopeRef, autoFocus);\n\n // This needs to be an effect so that activeScope is updated after the FocusScope tree is complete.\n // It cannot be a useLayoutEffect because the parent of this node hasn't been attached in the tree yet.\n useEffect(() => {\n const activeElement = getOwnerDocument(scopeRef.current ? scopeRef.current[0] : undefined).activeElement;\n let scope: TreeNode | null = null;\n\n if (isElementInScope(activeElement, scopeRef.current)) {\n // We need to traverse the focusScope tree and find the bottom most scope that\n // contains the active element and set that as the activeScope.\n for (let node of focusScopeTree.traverse()) {\n if (node.scopeRef && isElementInScope(activeElement, node.scopeRef.current)) {\n scope = node;\n }\n }\n\n if (scope === focusScopeTree.getTreeNode(scopeRef)) {\n activeScope = scope.scopeRef;\n }\n }\n }, [scopeRef]);\n\n // This layout effect cleanup is so that the tree node is removed synchronously with react before the RAF\n // in useRestoreFocus cleanup runs.\n useLayoutEffect(() => {\n return () => {\n // Scope may have been re-parented.\n let parentScope = focusScopeTree.getTreeNode(scopeRef)?.parent?.scopeRef ?? null;\n\n if (\n (scopeRef === activeScope || isAncestorScope(scopeRef, activeScope)) &&\n (!parentScope || focusScopeTree.getTreeNode(parentScope))\n ) {\n activeScope = parentScope;\n }\n focusScopeTree.removeTreeNode(scopeRef);\n };\n }, [scopeRef]);\n\n let focusManager = useMemo(() => createFocusManagerForScope(scopeRef), []);\n let value = useMemo(() => ({\n focusManager,\n parentNode: node\n }), [node, focusManager]);\n\n return (\n <FocusContext.Provider value={value}>\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 | undefined {\n return useContext(FocusContext)?.focusManager;\n}\n\nfunction createFocusManagerForScope(scopeRef: React.RefObject<Element[] | null>): FocusManager {\n return {\n focusNext(opts: FocusManagerOptions = {}) {\n let scope = scopeRef.current!;\n let {from, tabbable, wrap, accept} = opts;\n let node = from || getOwnerDocument(scope[0]).activeElement!;\n let sentinel = scope[0].previousElementSibling!;\n let scopeRoot = getScopeRoot(scope);\n let walker = getFocusableTreeWalker(scopeRoot, {tabbable, accept}, scope);\n walker.currentNode = isElementInScope(node, scope) ? node : sentinel;\n let nextNode = walker.nextNode() as FocusableElement;\n if (!nextNode && wrap) {\n walker.currentNode = sentinel;\n nextNode = walker.nextNode() as FocusableElement;\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, accept} = opts;\n let node = from || getOwnerDocument(scope[0]).activeElement!;\n let sentinel = scope[scope.length - 1].nextElementSibling!;\n let scopeRoot = getScopeRoot(scope);\n let walker = getFocusableTreeWalker(scopeRoot, {tabbable, accept}, scope);\n walker.currentNode = isElementInScope(node, scope) ? node : sentinel;\n let previousNode = walker.previousNode() as FocusableElement;\n if (!previousNode && wrap) {\n walker.currentNode = sentinel;\n previousNode = walker.previousNode() as FocusableElement;\n }\n if (previousNode) {\n focusElement(previousNode, true);\n }\n return previousNode;\n },\n focusFirst(opts = {}) {\n let scope = scopeRef.current!;\n let {tabbable, accept} = opts;\n let scopeRoot = getScopeRoot(scope);\n let walker = getFocusableTreeWalker(scopeRoot, {tabbable, accept}, scope);\n walker.currentNode = scope[0].previousElementSibling!;\n let nextNode = walker.nextNode() as FocusableElement;\n if (nextNode) {\n focusElement(nextNode, true);\n }\n return nextNode;\n },\n focusLast(opts = {}) {\n let scope = scopeRef.current!;\n let {tabbable, accept} = opts;\n let scopeRoot = getScopeRoot(scope);\n let walker = getFocusableTreeWalker(scopeRoot, {tabbable, accept}, scope);\n walker.currentNode = scope[scope.length - 1].nextElementSibling!;\n let previousNode = walker.previousNode() as FocusableElement;\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\nexport function isFocusable(element: HTMLElement) {\n return element.matches(FOCUSABLE_ELEMENT_SELECTOR);\n}\n\nfunction getScopeRoot(scope: Element[]) {\n return scope[0].parentElement!;\n}\n\nfunction shouldContainFocus(scopeRef: ScopeRef) {\n let scope = focusScopeTree.getTreeNode(activeScope);\n while (scope && scope.scopeRef !== scopeRef) {\n if (scope.contain) {\n return false;\n }\n\n scope = scope.parent;\n }\n\n return true;\n}\n\nfunction useFocusContainment(scopeRef: RefObject<Element[] | null>, contain?: boolean) {\n let focusedNode = useRef<FocusableElement>(undefined);\n\n let raf = useRef<ReturnType<typeof requestAnimationFrame>>(undefined);\n useLayoutEffect(() => {\n let scope = scopeRef.current;\n if (!contain) {\n // if contain was changed, then we should cancel any ongoing waits to pull focus back into containment\n if (raf.current) {\n cancelAnimationFrame(raf.current);\n raf.current = undefined;\n }\n return;\n }\n\n const ownerDocument = getOwnerDocument(scope ? scope[0] : undefined);\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 || !shouldContainFocus(scopeRef) || e.isComposing) {\n return;\n }\n\n let focusedElement = ownerDocument.activeElement;\n let scope = scopeRef.current;\n if (!scope || !isElementInScope(focusedElement, scope)) {\n return;\n }\n\n let scopeRoot = getScopeRoot(scope);\n let walker = getFocusableTreeWalker(scopeRoot, {tabbable: true}, scope);\n if (!focusedElement) {\n return;\n }\n walker.currentNode = focusedElement;\n let nextElement = (e.shiftKey ? walker.previousNode() : walker.nextNode()) as FocusableElement;\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 FocusableElement;\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)) && isElementInScope(e.target, scopeRef.current)) {\n activeScope = scopeRef;\n focusedNode.current = e.target;\n } else if (shouldContainFocus(scopeRef) && !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 && activeScope.current) {\n focusFirstInScope(activeScope.current);\n }\n } else if (shouldContainFocus(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 if (raf.current) {\n cancelAnimationFrame(raf.current);\n }\n raf.current = requestAnimationFrame(() => {\n // Use document.activeElement instead of e.relatedTarget so we can tell if user clicked into iframe\n if (ownerDocument.activeElement && shouldContainFocus(scopeRef) && !isElementInChildScope(ownerDocument.activeElement, scopeRef)) {\n activeScope = scopeRef;\n if (ownerDocument.body.contains(e.target)) {\n focusedNode.current = e.target;\n focusedNode.current?.focus();\n } else if (activeScope.current) {\n focusFirstInScope(activeScope.current);\n }\n }\n });\n };\n\n ownerDocument.addEventListener('keydown', onKeyDown, false);\n ownerDocument.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 ownerDocument.removeEventListener('keydown', onKeyDown, false);\n ownerDocument.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 // This is a useLayoutEffect so it is guaranteed to run before our async synthetic blur\n // eslint-disable-next-line arrow-body-style\n useLayoutEffect(() => {\n return () => {\n if (raf.current) {\n cancelAnimationFrame(raf.current);\n }\n };\n }, [raf]);\n}\n\nfunction isElementInAnyScope(element: Element) {\n return isElementInChildScope(element);\n}\n\nfunction isElementInScope(element?: Element | null, scope?: Element[] | null) {\n if (!element) {\n return false;\n }\n if (!scope) {\n return false;\n }\n return scope.some(node => node.contains(element));\n}\n\nfunction isElementInChildScope(element: Element, scope: ScopeRef = null) {\n // If the element is within a top layer element (e.g. toasts), always allow moving focus there.\n if (element instanceof Element && element.closest('[data-react-aria-top-layer]')) {\n return true;\n }\n\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 {scopeRef: s} of focusScopeTree.traverse(focusScopeTree.getTreeNode(scope))) {\n if (s && isElementInScope(element, s.current)) {\n return true;\n }\n }\n\n return false;\n}\n\n/** @private */\nexport function isElementInChildOfActiveScope(element: Element) {\n return isElementInChildScope(element, activeScope);\n}\n\nfunction isAncestorScope(ancestor: ScopeRef, scope: ScopeRef) {\n let parent = focusScopeTree.getTreeNode(scope)?.parent;\n while (parent) {\n if (parent.scopeRef === ancestor) {\n return true;\n }\n parent = parent.parent;\n }\n return false;\n}\n\nfunction focusElement(element: FocusableElement | 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 getFirstInScope(scope: Element[], tabbable = true) {\n let sentinel = scope[0].previousElementSibling!;\n let scopeRoot = getScopeRoot(scope);\n let walker = getFocusableTreeWalker(scopeRoot, {tabbable}, scope);\n walker.currentNode = sentinel;\n let nextNode = walker.nextNode();\n\n // If the scope does not contain a tabbable element, use the first focusable element.\n if (tabbable && !nextNode) {\n scopeRoot = getScopeRoot(scope);\n walker = getFocusableTreeWalker(scopeRoot, {tabbable: false}, scope);\n walker.currentNode = sentinel;\n nextNode = walker.nextNode();\n }\n\n return nextNode as FocusableElement;\n}\n\nfunction focusFirstInScope(scope: Element[], tabbable:boolean = true) {\n focusElement(getFirstInScope(scope, tabbable));\n}\n\nfunction useAutoFocus(scopeRef: RefObject<Element[] | null>, autoFocus?: boolean) {\n const autoFocusRef = React.useRef(autoFocus);\n useEffect(() => {\n if (autoFocusRef.current) {\n activeScope = scopeRef;\n const ownerDocument = getOwnerDocument(scopeRef.current ? scopeRef.current[0] : undefined);\n if (!isElementInScope(ownerDocument.activeElement, activeScope.current) && scopeRef.current) {\n focusFirstInScope(scopeRef.current);\n }\n }\n autoFocusRef.current = false;\n }, [scopeRef]);\n}\n\nfunction useActiveScopeTracker(scopeRef: RefObject<Element[] | null>, restore?: boolean, contain?: boolean) {\n // tracks the active scope, in case restore and contain are both false.\n // if either are true, this is tracked in useRestoreFocus or useFocusContainment.\n useLayoutEffect(() => {\n if (restore || contain) {\n return;\n }\n\n let scope = scopeRef.current;\n const ownerDocument = getOwnerDocument(scope ? scope[0] : undefined);\n\n let onFocus = (e) => {\n let target = e.target as Element;\n if (isElementInScope(target, scopeRef.current)) {\n activeScope = scopeRef;\n } else if (!isElementInAnyScope(target)) {\n activeScope = null;\n }\n };\n\n ownerDocument.addEventListener('focusin', onFocus, false);\n scope?.forEach(element => element.addEventListener('focusin', onFocus, false));\n return () => {\n ownerDocument.removeEventListener('focusin', onFocus, false);\n scope?.forEach(element => element.removeEventListener('focusin', onFocus, false));\n };\n }, [scopeRef, restore, contain]);\n}\n\nfunction shouldRestoreFocus(scopeRef: ScopeRef) {\n let scope = focusScopeTree.getTreeNode(activeScope);\n while (scope && scope.scopeRef !== scopeRef) {\n if (scope.nodeToRestore) {\n return false;\n }\n\n scope = scope.parent;\n }\n\n return scope?.scopeRef === scopeRef;\n}\n\nfunction useRestoreFocus(scopeRef: RefObject<Element[] | null>, 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 // eslint-disable-next-line no-restricted-globals\n const nodeToRestoreRef = useRef(typeof document !== 'undefined' ? getOwnerDocument(scopeRef.current ? scopeRef.current[0] : undefined).activeElement as FocusableElement : null);\n\n // restoring scopes should all track if they are active regardless of contain, but contain already tracks it plus logic to contain the focus\n // restoring-non-containing scopes should only care if they become active so they can perform the restore\n useLayoutEffect(() => {\n let scope = scopeRef.current;\n const ownerDocument = getOwnerDocument(scope ? scope[0] : undefined);\n if (!restoreFocus || contain) {\n return;\n }\n\n let onFocus = () => {\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 isElementInScope(ownerDocument.activeElement, scopeRef.current)\n ) {\n activeScope = scopeRef;\n }\n };\n\n ownerDocument.addEventListener('focusin', onFocus, false);\n scope?.forEach(element => element.addEventListener('focusin', onFocus, false));\n return () => {\n ownerDocument.removeEventListener('focusin', onFocus, false);\n scope?.forEach(element => element.removeEventListener('focusin', onFocus, false));\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [scopeRef, contain]);\n\n useLayoutEffect(() => {\n const ownerDocument = getOwnerDocument(scopeRef.current ? scopeRef.current[0] : undefined);\n\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 || !shouldContainFocus(scopeRef) || e.isComposing) {\n return;\n }\n\n let focusedElement = ownerDocument.activeElement as FocusableElement;\n if (!isElementInScope(focusedElement, scopeRef.current)) {\n return;\n }\n let treeNode = focusScopeTree.getTreeNode(scopeRef);\n if (!treeNode) {\n return;\n }\n let nodeToRestore = treeNode.nodeToRestore;\n\n // Create a DOM tree walker that matches all tabbable elements\n let walker = getFocusableTreeWalker(ownerDocument.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 FocusableElement;\n\n if (!nodeToRestore || !ownerDocument.body.contains(nodeToRestore) || nodeToRestore === ownerDocument.body) {\n nodeToRestore = undefined;\n treeNode.nodeToRestore = undefined;\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 FocusableElement;\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 ownerDocument.addEventListener('keydown', onKeyDown, true);\n }\n\n return () => {\n if (!contain) {\n ownerDocument.removeEventListener('keydown', onKeyDown, true);\n }\n };\n }, [scopeRef, restoreFocus, contain]);\n\n // useLayoutEffect instead of useEffect so the active element is saved synchronously instead of asynchronously.\n useLayoutEffect(() => {\n const ownerDocument = getOwnerDocument(scopeRef.current ? scopeRef.current[0] : undefined);\n\n if (!restoreFocus) {\n return;\n }\n\n let treeNode = focusScopeTree.getTreeNode(scopeRef);\n if (!treeNode) {\n return;\n }\n treeNode.nodeToRestore = nodeToRestoreRef.current ?? undefined;\n return () => {\n let treeNode = focusScopeTree.getTreeNode(scopeRef);\n if (!treeNode) {\n return;\n }\n let nodeToRestore = treeNode.nodeToRestore;\n\n // if we already lost focus to the body and this was the active scope, then we should attempt to restore\n if (\n restoreFocus\n && nodeToRestore\n && (\n // eslint-disable-next-line react-hooks/exhaustive-deps\n (isElementInScope(ownerDocument.activeElement, scopeRef.current) || (ownerDocument.activeElement === ownerDocument.body && shouldRestoreFocus(scopeRef)))\n )\n ) {\n // freeze the focusScopeTree so it persists after the raf, otherwise during unmount nodes are removed from it\n let clonedTree = focusScopeTree.clone();\n requestAnimationFrame(() => {\n // Only restore focus if we've lost focus to the body, the alternative is that focus has been purposefully moved elsewhere\n if (ownerDocument.activeElement === ownerDocument.body) {\n // look up the tree starting with our scope to find a nodeToRestore still in the DOM\n let treeNode = clonedTree.getTreeNode(scopeRef);\n while (treeNode) {\n if (treeNode.nodeToRestore && treeNode.nodeToRestore.isConnected) {\n restoreFocusToElement(treeNode.nodeToRestore);\n return;\n }\n treeNode = treeNode.parent;\n }\n\n // If no nodeToRestore was found, focus the first element in the nearest\n // ancestor scope that is still in the tree.\n treeNode = clonedTree.getTreeNode(scopeRef);\n while (treeNode) {\n if (treeNode.scopeRef && treeNode.scopeRef.current && focusScopeTree.getTreeNode(treeNode.scopeRef)) {\n let node = getFirstInScope(treeNode.scopeRef.current, true);\n restoreFocusToElement(node);\n return;\n }\n treeNode = treeNode.parent;\n }\n }\n });\n }\n };\n }, [scopeRef, restoreFocus]);\n}\n\nfunction restoreFocusToElement(node: FocusableElement) {\n // Dispatch a custom event that parent elements can intercept to customize focus restoration.\n // For example, virtualized collection components reuse DOM elements, so the original element\n // might still exist in the DOM but representing a different item.\n if (node.dispatchEvent(new CustomEvent(RESTORE_FOCUS_EVENT, {bubbles: true, cancelable: true}))) {\n focusElement(node);\n }\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: Element, opts?: FocusManagerOptions, scope?: Element[]) {\n let selector = opts?.tabbable ? TABBABLE_ELEMENT_SELECTOR : FOCUSABLE_ELEMENT_SELECTOR;\n let walker = getOwnerDocument(root).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 Element).matches(selector)\n && isElementVisible(node as Element)\n && (!scope || isElementInScope(node as Element, scope))\n && (!opts?.accept || opts.accept(node as Element))\n ) {\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<Element | null>, defaultOptions: FocusManagerOptions = {}): FocusManager {\n return {\n focusNext(opts: FocusManagerOptions = {}) {\n let root = ref.current;\n if (!root) {\n return null;\n }\n let {from, tabbable = defaultOptions.tabbable, wrap = defaultOptions.wrap, accept = defaultOptions.accept} = opts;\n let node = from || getOwnerDocument(root).activeElement;\n let walker = getFocusableTreeWalker(root, {tabbable, accept});\n if (root.contains(node)) {\n walker.currentNode = node!;\n }\n let nextNode = walker.nextNode() as FocusableElement;\n if (!nextNode && wrap) {\n walker.currentNode = root;\n nextNode = walker.nextNode() as FocusableElement;\n }\n if (nextNode) {\n focusElement(nextNode, true);\n }\n return nextNode;\n },\n focusPrevious(opts: FocusManagerOptions = defaultOptions) {\n let root = ref.current;\n if (!root) {\n return null;\n }\n let {from, tabbable = defaultOptions.tabbable, wrap = defaultOptions.wrap, accept = defaultOptions.accept} = opts;\n let node = from || getOwnerDocument(root).activeElement;\n let walker = getFocusableTreeWalker(root, {tabbable, accept});\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 ?? null;\n }\n let previousNode = walker.previousNode() as FocusableElement;\n if (!previousNode && wrap) {\n walker.currentNode = root;\n let lastNode = last(walker);\n if (!lastNode) {\n // couldn't wrap\n return null;\n }\n previousNode = lastNode;\n }\n if (previousNode) {\n focusElement(previousNode, true);\n }\n return previousNode ?? null;\n },\n focusFirst(opts = defaultOptions) {\n let root = ref.current;\n if (!root) {\n return null;\n }\n let {tabbable = defaultOptions.tabbable, accept = defaultOptions.accept} = opts;\n let walker = getFocusableTreeWalker(root, {tabbable, accept});\n let nextNode = walker.nextNode() as FocusableElement;\n if (nextNode) {\n focusElement(nextNode, true);\n }\n return nextNode;\n },\n focusLast(opts = defaultOptions) {\n let root = ref.current;\n if (!root) {\n return null;\n }\n let {tabbable = defaultOptions.tabbable, accept = defaultOptions.accept} = opts;\n let walker = getFocusableTreeWalker(root, {tabbable, accept});\n let next = last(walker);\n if (next) {\n focusElement(next, true);\n }\n return next ?? null;\n }\n };\n}\n\nfunction last(walker: TreeWalker) {\n let next: FocusableElement | undefined = undefined;\n let last: FocusableElement;\n do {\n last = walker.lastChild() as FocusableElement;\n if (last) {\n next = last;\n }\n } while (last);\n return next;\n}\n\n\nclass Tree {\n root: TreeNode;\n private fastMap = new Map<ScopeRef, TreeNode>();\n\n constructor() {\n this.root = new TreeNode({scopeRef: null});\n this.fastMap.set(null, this.root);\n }\n\n get size() {\n return this.fastMap.size;\n }\n\n getTreeNode(data: ScopeRef) {\n return this.fastMap.get(data);\n }\n\n addTreeNode(scopeRef: ScopeRef, parent: ScopeRef, nodeToRestore?: FocusableElement) {\n let parentNode = this.fastMap.get(parent ?? null);\n if (!parentNode) {\n return;\n }\n let node = new TreeNode({scopeRef});\n parentNode.addChild(node);\n node.parent = parentNode;\n this.fastMap.set(scopeRef, node);\n if (nodeToRestore) {\n node.nodeToRestore = nodeToRestore;\n }\n }\n\n addNode(node: TreeNode) {\n this.fastMap.set(node.scopeRef, node);\n }\n\n removeTreeNode(scopeRef: ScopeRef) {\n // never remove the root\n if (scopeRef === null) {\n return;\n }\n let node = this.fastMap.get(scopeRef);\n if (!node) {\n return;\n }\n let parentNode = node.parent;\n // when we remove a scope, check if any sibling scopes are trying to restore focus to something inside the scope we're removing\n // if we are, then replace the siblings restore with the restore from the scope we're removing\n for (let current of this.traverse()) {\n if (\n current !== node &&\n node.nodeToRestore &&\n current.nodeToRestore &&\n node.scopeRef &&\n node.scopeRef.current &&\n isElementInScope(current.nodeToRestore, node.scopeRef.current)\n ) {\n current.nodeToRestore = node.nodeToRestore;\n }\n }\n let children = node.children;\n if (parentNode) {\n parentNode.removeChild(node);\n if (children.size > 0) {\n children.forEach(child => parentNode && parentNode.addChild(child));\n }\n }\n\n this.fastMap.delete(node.scopeRef);\n }\n\n // Pre Order Depth First\n *traverse(node: TreeNode = this.root): Generator<TreeNode> {\n if (node.scopeRef != null) {\n yield node;\n }\n if (node.children.size > 0) {\n for (let child of node.children) {\n yield* this.traverse(child);\n }\n }\n }\n\n clone(): Tree {\n let newTree = new Tree();\n for (let node of this.traverse()) {\n newTree.addTreeNode(node.scopeRef, node.parent?.scopeRef ?? null, node.nodeToRestore);\n }\n return newTree;\n }\n}\n\nclass TreeNode {\n public scopeRef: ScopeRef;\n public nodeToRestore?: FocusableElement;\n public parent?: TreeNode;\n public children: Set<TreeNode> = new Set();\n public contain = false;\n\n constructor(props: {scopeRef: ScopeRef}) {\n this.scopeRef = props.scopeRef;\n }\n addChild(node: TreeNode) {\n this.children.add(node);\n node.parent = this;\n }\n removeChild(node: TreeNode) {\n this.children.delete(node);\n node.parent = undefined;\n }\n}\n\nexport let focusScopeTree = new Tree();\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 {FocusableElement} from '@react-types/shared';\nimport {focusWithoutScrolling, getOwnerDocument, 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: FocusableElement) {\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 const ownerDocument = getOwnerDocument(element);\n if (getInteractionModality() === 'virtual') {\n let lastFocusedElement = ownerDocument.activeElement;\n runAfterTransition(() => {\n // If focus did not move and the element is still in the document, focus it.\n if (ownerDocument.activeElement === lastFocusedElement && element.isConnected) {\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\nimport {getOwnerWindow} from '@react-aria/utils';\n\nfunction isStyleVisible(element: Element) {\n const windowObject = getOwnerWindow(element);\n if (!(element instanceof windowObject.HTMLElement) && !(element instanceof windowObject.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 as unknown as Window;\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 // Ignore HiddenSelect when tree walking.\n !element.hasAttribute('data-react-aria-prevent-focus') &&\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\nexport interface 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 as any, {\n ...focusProps,\n className: clsx({\n [focusClass || '']: isFocused,\n [focusRingClass || '']: isFocusVisible\n })\n }));\n}\n","import {DOMAttributes} from '@react-types/shared';\nimport {isFocusVisible, useFocus, useFocusVisibleListener, useFocusWithin} from '@react-aria/interactions';\nimport {useCallback, useRef, useState} from 'react';\n\nexport interface AriaFocusRingProps {\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\nexport interface 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: DOMAttributes\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: AriaFocusRingProps = {}): FocusRingAria {\n let {\n autoFocus = false,\n isTextInput,\n within\n } = props;\n let state = useRef({\n isFocused: false,\n isFocusVisible: autoFocus || isFocusVisible()\n });\n let [isFocused, setFocused] = useState(false);\n let [isFocusVisibleState, setFocusVisible] = useState(() => state.current.isFocused && state.current.isFocusVisible);\n\n let updateState = useCallback(() => setFocusVisible(state.current.isFocused && state.current.isFocusVisible), []);\n\n let onFocusChange = useCallback(isFocused => {\n state.current.isFocused = isFocused;\n setFocused(isFocused);\n updateState();\n }, [updateState]);\n\n useFocusVisibleListener((isFocusVisible) => {\n state.current.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: 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 {DOMAttributes, FocusableDOMProps, FocusableElement, FocusableProps, RefObject} from '@react-types/shared';\nimport {focusSafely} from './';\nimport {mergeProps, useObjectRef, useSyncRef} from '@react-aria/utils';\nimport React, {ForwardedRef, MutableRefObject, ReactNode, useContext, useEffect, useRef} from 'react';\nimport {useFocus, useKeyboard} from '@react-aria/interactions';\n\nexport interface FocusableOptions extends FocusableProps, FocusableDOMProps {\n /** Whether focus should be disabled. */\n isDisabled?: boolean\n}\n\nexport interface FocusableProviderProps extends DOMAttributes {\n /** The child element to provide DOM props to. */\n children?: ReactNode\n}\n\ninterface FocusableContextValue extends FocusableProviderProps {\n ref?: MutableRefObject<FocusableElement | null>\n}\n\nlet FocusableContext = React.createContext<FocusableContextValue | null>(null);\n\nfunction useFocusableContext(ref: RefObject<FocusableElement | null>): 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: ForwardedRef<FocusableElement>) {\n let {children, ...otherProps} = props;\n let objRef = useObjectRef(ref);\n let context = {\n ...otherProps,\n ref: objRef\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\nexport interface FocusableAria {\n /** Props for the focusable element. */\n focusableProps: DOMAttributes\n}\n\n/**\n * Used to make an element focusable and capable of auto focus.\n */\nexport function useFocusable(props: FocusableOptions, domRef: RefObject<FocusableElement | null>): FocusableAria {\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 focusSafely(domRef.current);\n }\n autoFocusRef.current = false;\n }, [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","/*\n * Copyright 2022 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 {getFocusableTreeWalker} from './FocusScope';\nimport {RefObject} from '@react-types/shared';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useState} from 'react';\n\ninterface AriaHasTabbableChildOptions {\n isDisabled?: boolean\n}\n\n// This was created for a special empty case of a component that can have child or\n// be empty, like Collection/Virtualizer/Table/ListView/etc. When these components\n// are empty they can have a message with a tabbable element, which is like them\n// being not empty, when it comes to focus and tab order.\n\n/**\n * Returns whether an element has a tabbable child, and updates as children change.\n * @private\n */\nexport function useHasTabbableChild(ref: RefObject<Element | null>, options?: AriaHasTabbableChildOptions): boolean {\n let isDisabled = options?.isDisabled;\n let [hasTabbableChild, setHasTabbableChild] = useState(false);\n\n useLayoutEffect(() => {\n if (ref?.current && !isDisabled) {\n let update = () => {\n if (ref.current) {\n let walker = getFocusableTreeWalker(ref.current, {tabbable: true});\n setHasTabbableChild(!!walker.nextNode());\n }\n };\n\n update();\n\n // Update when new elements are inserted, or the tabIndex/disabled attribute updates.\n let observer = new MutationObserver(update);\n observer.observe(ref.current, {\n subtree: true,\n childList: true,\n attributes: true,\n attributeFilter: ['tabIndex', 'disabled']\n });\n\n return () => {\n // Disconnect mutation observer when a React update occurs on the top-level component\n // so we update synchronously after re-rendering. Otherwise React will emit act warnings\n // in tests since mutation observers fire asynchronously. The mutation observer is necessary\n // so we also update if a child component re-renders and adds/removes something tabbable.\n observer.disconnect();\n };\n }\n });\n\n return isDisabled ? false : hasTabbableChild;\n}\n"],"names":["modules","entry","mainEntry","parcelRequireName","globalName","globalObject","globalThis","self","window","global","previousRequire","cache","nodeRequire","module","require","bind","newRequire","name","jumped","currentRequire","err","Error","code","localRequire","resolve","x","id","Module","call","exports","res","isParcelRequire","moduleName","bundle","parent","register","Object","defineProperty","get","i","length","parcelHelpers","defineInteropFlag","export","_focusScope","FocusScope","useFocusManager","getFocusableTreeWalker","createFocusManager","isElementInChildOfActiveScope","isFocusable","_focusRing","FocusRing","_useFocusable","FocusableProvider","useFocusable","_useFocusRing","useFocusRing","_focusSafely","focusSafely","_useHasTabbableChild","useHasTabbableChild","focusScopeTree","_utils","_isElementVisible","_react","_reactDefault","interopDefault","FocusContext","default","createContext","RESTORE_FOCUS_EVENT","activeScope","props","focusedNode","raf","children","contain","restoreFocus","autoFocus","startRef","useRef","endRef","scopeRef","parentNode","useContext","node","useMemo","TreeNode","useLayoutEffect","root","getTreeNode","isAncestorScope","activeNode","addChild","addNode","current","nextSibling","nodes","stopPropagation","e","push","addEventListener","removeEventListener","restore","scope","ownerDocument","getOwnerDocument","undefined","onFocus","target","isElementInScope","isElementInChildScope","forEach","element","cancelAnimationFrame","onKeyDown","key","altKey","ctrlKey","metaKey","shouldContainFocus","isComposing","focusedElement","activeElement","walker","getScopeRoot","tabbable","currentNode","nextElement","shiftKey","previousNode","nextNode","nextElementSibling","previousElementSibling","preventDefault","focusElement","focus","focusFirstInScope","onBlur","requestAnimationFrame","body","contains","useRestoreFocus","nodeToRestoreRef","document","treeNode","nodeToRestore","blur","shouldRestoreFocus","clonedTree","clone","isConnected","restoreFocusToElement","getFirstInScope","useAutoFocus","autoFocusRef","useEffect","traverse","parentScope","removeTreeNode","focusManager","focusNext","opts","from","wrap","accept","sentinel","focusPrevious","focusFirst","focusLast","value","createElement","Provider","hidden","ref","focusableElements","FOCUSABLE_ELEMENT_SELECTOR","join","TABBABLE_ELEMENT_SELECTOR","matches","parentElement","some","Element","closest","s","ancestor","scroll","scopeRoot","dispatchEvent","CustomEvent","bubbles","cancelable","selector","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","FILTER_REJECT","isElementVisible","FILTER_ACCEPT","FILTER_SKIP","defaultOptions","next","last","lastNode","lastChild","Tree","constructor","fastMap","Map","set","size","data","addTreeNode","removeChild","child","delete","newTree","Set","add","_interactions","getInteractionModality","lastFocusedElement","runAfterTransition","focusWithoutScrolling","childElement","nodeName","isStyleVisible","windowObject","getOwnerWindow","HTMLElement","SVGElement","display","visibility","style","isVisible","getComputedStyle","defaultView","computedDisplay","computedVisibility","hasAttribute","_clsx","_clsxDefault","focusClass","focusRingClass","isFocused","isFocusVisible","focusProps","Children","only","cloneElement","mergeProps","className","isTextInput","within","state","setFocused","useState","isFocusVisibleState","setFocusVisible","updateState","useCallback","onFocusChange","useFocusVisibleListener","useFocus","isDisabled","focusWithinProps","useFocusWithin","onFocusWithinChange","_FocusableProvider","_","FocusableContext","forwardRef","otherProps","objRef","useObjectRef","context","domRef","keyboardProps","useKeyboard","interactions","domProps","useFocusableContext","useSyncRef","interactionProps","focusableProps","tabIndex","excludeFromTabOrder","options","hasTabbableChild","setHasTabbableChild","update","observer","MutationObserver","observe","subtree","childList","attributes","attributeFilter","disconnect"],"version":3,"file":"useButton.stories.16ca2df7.js.map"}