{"version":3,"sources":["webpack:///./node_modules/@instructure/ui-portal/es/Portal/ReactPortal.js","webpack:///./node_modules/@instructure/ui-portal/es/Portal/SubtreePortal.js","webpack:///./node_modules/@instructure/ui-portal/es/Portal/index.js","webpack:///./node_modules/@instructure/ui-prop-types/es/element.js","webpack:///./node_modules/@instructure/ui-dom-utils/es/contains.js","webpack:///./node_modules/@instructure/ui-dom-utils/es/requestAnimationFrame.js","webpack:///./node_modules/@instructure/ui-dom-utils/es/containsActiveElement.js","webpack:///./node_modules/@instructure/ui-dialog/es/Dialog/index.js","webpack:///./node_modules/@instructure/ui-a11y-utils/es/FocusRegionManager.js","webpack:///./node_modules/@instructure/ui-dom-utils/es/getFrameDocumentSafe.js","webpack:///./node_modules/@instructure/ui-a11y-utils/es/ScreenReaderFocusRegion.js","webpack:///./node_modules/@instructure/ui-a11y-utils/es/scopeTab.js","webpack:///./node_modules/@instructure/ui-a11y-utils/es/KeyboardFocusRegion.js","webpack:///./node_modules/@instructure/ui-a11y-utils/es/FocusRegion.js","webpack:///./node_modules/@instructure/ui-dom-utils/es/findTabbable.js","webpack:///./node_modules/@instructure/ui-dom-utils/es/addEventListener.js"],"names":["_dec","_class","_class2","_temp","bidirectional","_React$Component","ReactPortal","_super","props","_this","this","call","state","mountNode","findMountNode","key","value","open","onOpen","DOMNode","prevProps","setState","onClose","removeNode","children","Children","count","createPortal","insertNode","parentNode","removeChild","elementRef","_this$props","insertAt","node","document","createElement","attributes","passthroughProps","dir","Object","keys","forEach","name","setAttribute","appendChild","insertBefore","firstChild","nodeName","body","get","displayName","Component","propTypes","bool","func","oneOfType","oneOf","defaultProps","el","_Component","SubtreePortal","apply","arguments","renderPortal","nextProps","nextState","shallowEqual","removePortal","passThroughProps","isInitialMount","content","length","handleMount","unstable_renderSubtreeIntoContainer","unmounted","unmountComponentAtNode","_node","set","IS_CREATE_PORTAL_SUPPORTED","Portal","_len","args","Array","_key","concat","handleElementRef","assign","canUseDOM","window","element","instanceOf","Element","containsWithDOM","context","container","contains","compareDocumentPosition","containsFallback","requestAnimationFrame","cancelAnimationFrame","cb","id","cancel","prev","Date","getTime","curr","ms","Math","max","req","setTimeout","clearTimeout","containsActiveElement","active","Dialog","_raf","_focusRegion","getRef","_root","close","updateElement","contentElement","request","_this2","options","push","activateRegion","blurRegion","focusRegion","ElementType","ref","role","label","className","isFocused","as","elementType","display","string","onBlur","onDismiss","defaultFocusElement","liveRegion","arrayOf","shouldContainFocus","shouldReturnFocus","shouldCloseOnDocumentClick","shouldCloseOnEscape","shouldFocusOnOpen","event","ENTRIES","FocusRegionManager","idOrOptions","entry","getEntry","addEntry","region","focus","_FocusRegionManager$a","getActiveEntry","find","_ref","focused","findEntry","index","findIndex","activeEntry","keyboardFocusable","_ref2","deactivate","keyboard","activate","parent","removeEntry","splice","clearEntries","_ref3","blur","getFrameDocumentSafe","contentDocument","contentWindow","err","ScreenReaderFocusRegion","_observer","_attributes","_nodes","_parents","handleDOMMutation","records","record","addedNodes","from","removedNodes","hideNodes","removedNode","tagName","toLowerCase","restoreNode","iframeBodies","parseIframeBodies","iframeBody","_liveRegion","isArray","_contextElement","_options","attribute","getAttribute","removeAttribute","observe","childList","nodes","_this3","nodeType","indexOf","hideNode","iframes","getElementsByTagName","map","iframe","e","filter","MutationObserver","parentElement","muteNode","prototype","slice","childNodes","disconnect","scopeTab","onLeavingFinalTabbable","findDOMNode","tabbable","findTabbable","preventDefault","activeElement","getActiveElement","finalTabbable","shiftKey","leavingFinalTabbable","isActiveElement","target","KeyboardFocusRegion","_focusLaterElement","_needToFocus","_listeners","_active","handleDismiss","handleKeyDown","keyCode","codes","tab","handleClick","_wasDocumentClick","handleWindowBlur","handleFocus","focusDefaultElement","handleFirstTabbableKeyDown","handleLastTabbableKeyDown","addEventListener","doc","firstTabbable","lastTabbable","win","listener","remove","_preventCloseOnDocumentClick","includes","findFocusable","pop","focusable","ownerDocument","ownerWindow","FocusRegion","documentClick","captureDocumentClick","button","handleDocumentClick","handleFrameClick","frame","handleKeyUp","escape","defaultPrevented","_screenReaderFocusRegion","_keyboardFocusRegion","_id","uid","frameDoc","_ref$keyboard","shouldSearchRootNode","isInvalidTabIndex","tabIndex","isNaN","handler","capture","removeEventListener"],"mappings":";;;;;;;;;;;;;;;;;AAOA,IAAIA,EAAMC,EAAQC,EAASC;AAsC3B,IAAI,GAAeH,EAAO,OAAAI,EAAA,QAAiBJ,EAAKC,GAAUE,EAAQD,EAAuB,SAAUG,GACjG,eAAUC,EAAaD;AAEvB,IAAIE,EAAS,eAAaD;AAE1B,SAASA,EAAYE,GACnB,IAAIC;AAEJ,eAAgBC,KAAMJ;AAEtBG,EAAQF,EAAOI,KAAKD,KAAMF;AAC1BC,EAAMG,MAAQ,CACZC,UAAWJ,EAAMK,cAAcN;AAEjC,OAAOC,EAGT,eAAaH,EAAa,CAAC,CACzBS,IAAK,oBACLC,MAAO,WAEDN,KAAKF,MAAMS,MAAqC,oBAAtBP,KAAKF,MAAMU,QACvCR,KAAKF,MAAMU,OAAOR,KAAKS,WAG1B,CACDJ,IAAK,qBACLC,MAAO,SAA4BI,GACjC,IAAIP,EAAYH,KAAKI,cAAcJ,KAAKF;AAEpCK,IAAcH,KAAKE,MAAMC,WAE3BH,KAAKW,SAAS,CACZR,UAAWA;AAKXH,KAAKF,MAAMS,OAASG,EAAUH,MAAqC,oBAAtBP,KAAKF,MAAMU,QAC1DR,KAAKF,MAAMU,OAAOR,KAAKS;CAIpBT,KAAKF,MAAMS,MAAQG,EAAUH,MAAsC,oBAAvBP,KAAKF,MAAMc,SAC1DZ,KAAKF,MAAMc,YAGd,CACDP,IAAK,uBACLC,MAAO,WACLN,KAAKa;AAEDb,KAAKF,MAAMS,MAAsC,oBAAvBP,KAAKF,MAAMc,SACvCZ,KAAKF,MAAMc,YAGd,CACDP,IAAK,SACLC,MAAO,WACL,IAAIQ,EAAWd,KAAKF,MAAMgB;AAC1B,OAAOd,KAAKF,MAAMS,MAAQ,IAAMQ,SAASC,MAAMF,GAAY,EAAI,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DxO,IAAK,oBACLmC,IAAK,WACH,OAAQ,OAAAwL,EAAA,MAAahO,KAAKmM,kBAAoB,IAAIrI,OAAS;AAI/D,OAAO0M,EAjKsB,I;ACjC/B;AAAA;AAyBA,SAASxC,EAAa/K,EAAIuO,GACxB,OAAO,eAAcvO,GAAI,SAAU+B,GACjC,OAAQyM,EAAkBzM,EAAQsH,aAAa,eAC9CkF,GAGL,SAASC,EAAkBC,GACzB,OAAQC,MAAMD,IAAaA,EAAW,I;AChCxC;AAAA;AAqCA,SAAShC,EAAiBzM,EAAI4F,EAAO+I,EAASC,GAC5C,IAAIrQ,EAAOyB,IAAO8B,QAAU9B,IAAOxB,SAAWwB,EAAK,eAAYA;AAC/DzB,EAAKkO,iBAAiB7G,EAAO+I,EAASC;AACtC,MAAO,CACL7B,OAAQ,WACNxO,EAAKsQ,oBAAoBjJ,EAAO+I,EAASC","file":"3-c-e5559a96fe.js","sourcesContent":["import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\n\nvar _dec, _class, _class2, _temp;\n\n/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 - present Instructure, Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport ReactDOM from 'react-dom';\nimport { passthroughProps } from '@instructure/ui-react-utils';\nimport { bidirectional } from '@instructure/ui-i18n';\nimport { element } from '@instructure/ui-prop-types';\n/**\n---\nprivate: true\n---\n@module ReactPortal\n**/\n\nvar ReactPortal = (_dec = bidirectional(), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_React$Component) {\n _inherits(ReactPortal, _React$Component);\n\n var _super = _createSuper(ReactPortal);\n\n function ReactPortal(props) {\n var _this;\n\n _classCallCheck(this, ReactPortal);\n\n _this = _super.call(this, props);\n _this.state = {\n mountNode: _this.findMountNode(props)\n };\n return _this;\n }\n\n _createClass(ReactPortal, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n // If Portal is mounting in an open condition fire onOpen handler\n if (this.props.open && typeof this.props.onOpen === 'function') {\n this.props.onOpen(this.DOMNode);\n }\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps) {\n var mountNode = this.findMountNode(this.props);\n\n if (mountNode !== this.state.mountNode) {\n // set state here to make the component re-render\n this.setState({\n mountNode: mountNode\n });\n } // If Portal was closed but is now open fire onOpen handler\n\n\n if (this.props.open && !prevProps.open && typeof this.props.onOpen === 'function') {\n this.props.onOpen(this.DOMNode);\n } // If Portal was open but is now closed fire onClose handler\n\n\n if (!this.props.open && prevProps.open && typeof this.props.onClose === 'function') {\n this.props.onClose();\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n this.removeNode(); // If Portal was open fire onClose handler\n\n if (this.props.open && typeof this.props.onClose === 'function') {\n this.props.onClose();\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n var children = this.props.children;\n return this.props.open && React.Children.count(children) > 0 ? ReactDOM.createPortal(children, this.insertNode()) : null;\n }\n }, {\n key: \"removeNode\",\n value: function removeNode() {\n if (this.DOMNode && this.DOMNode.parentNode && typeof this.DOMNode.parentNode.removeChild === 'function') {\n this.DOMNode.parentNode.removeChild(this.DOMNode);\n this.DOMNode = null;\n this.props.elementRef(this.DOMNode);\n }\n }\n }, {\n key: \"insertNode\",\n value: function insertNode() {\n var _this$props = this.props,\n open = _this$props.open,\n insertAt = _this$props.insertAt,\n onOpen = _this$props.onOpen,\n onClose = _this$props.onClose,\n mountNode = _this$props.mountNode,\n children = _this$props.children,\n elementRef = _this$props.elementRef,\n props = _objectWithoutProperties(_this$props, [\"open\", \"insertAt\", \"onOpen\", \"onClose\", \"mountNode\", \"children\", \"elementRef\"]); // Create node if it doesn't already exist\n\n\n if (!this.DOMNode) {\n var node = document.createElement('span');\n\n var attributes = _objectSpread({}, passthroughProps(props), {\n dir: this.dir\n });\n\n Object.keys(attributes).forEach(function (name) {\n node.setAttribute(name, attributes[name]);\n });\n elementRef(node);\n this.DOMNode = node;\n } // Append node to container if it isn't already\n\n\n if (this.DOMNode.parentNode !== this.state.mountNode) {\n if (insertAt === 'bottom') {\n this.state.mountNode.appendChild(this.DOMNode);\n } else {\n this.state.mountNode.insertBefore(this.DOMNode, this.state.mountNode.firstChild);\n }\n }\n\n return this.DOMNode;\n }\n }, {\n key: \"findMountNode\",\n value: function findMountNode(props) {\n var mountNode;\n\n if (typeof props.mountNode === 'function') {\n mountNode = props.mountNode();\n } else if (props.mountNode) {\n mountNode = props.mountNode;\n }\n\n if (!mountNode || !mountNode.nodeName) {\n mountNode = document.body;\n }\n\n return mountNode;\n }\n }, {\n key: \"node\",\n get: function get() {\n return this.DOMNode;\n }\n }]);\n\n ReactPortal.displayName = \"ReactPortal\";\n return ReactPortal;\n}(React.Component), _class2.propTypes = {\n /**\n * Wheter or not the `` is open\n */\n open: PropTypes.bool,\n\n /**\n * Callback fired when `` content has been mounted in the DOM\n */\n onOpen: PropTypes.func,\n\n /**\n * Callback fired when `` has been unmounted from the DOM\n */\n onClose: PropTypes.func,\n\n /**\n * An element or a function returning an element to use as the mount node\n * for the `` (defaults to `document.body`)\n */\n mountNode: PropTypes.oneOfType([element, PropTypes.func]),\n\n /**\n * Insert the element at the 'top' of the mountNode or at the 'bottom'\n */\n insertAt: PropTypes.oneOf(['bottom', 'top']),\n\n /**\n * The children to be rendered within the ``\n */\n children: PropTypes.node,\n\n /**\n * provides a reference to the underlying html element\n */\n elementRef: PropTypes.func\n}, _class2.defaultProps = {\n open: false,\n insertAt: 'bottom',\n onOpen: function onOpen(DOMNode) {},\n onClose: function onClose() {},\n mountNode: void 0,\n children: null,\n elementRef: function elementRef(el) {}\n}, _temp)) || _class);\nexport default ReactPortal;\nexport { ReactPortal };","import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\n\nvar _dec, _class, _class2, _temp;\n\n/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 - present Instructure, Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport ReactDOM from 'react-dom';\nimport { passthroughProps } from '@instructure/ui-react-utils';\nimport { bidirectional } from '@instructure/ui-i18n';\nimport { element } from '@instructure/ui-prop-types';\nimport { shallowEqual } from '@instructure/ui-utils';\n/* istanbul ignore file */\n\n/**\n---\nprivate: true\n---\n@module SubtreePortal\n**/\n\nvar SubtreePortal = (_dec = bidirectional(), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {\n _inherits(SubtreePortal, _Component);\n\n var _super = _createSuper(SubtreePortal);\n\n function SubtreePortal() {\n _classCallCheck(this, SubtreePortal);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(SubtreePortal, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.renderPortal(this.props);\n }\n }, {\n key: \"shouldComponentUpdate\",\n value: function shouldComponentUpdate(nextProps, nextState) {\n return !(shallowEqual(this.props, nextProps) && shallowEqual(this.state, nextState));\n }\n }, {\n key: \"componentWillReceiveProps\",\n value: function componentWillReceiveProps(nextProps) {\n this.renderPortal(nextProps);\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n this.removePortal(this.props);\n }\n }, {\n key: \"render\",\n value: function render() {\n return null;\n }\n }, {\n key: \"renderPortal\",\n value: function renderPortal(props) {\n var _this = this;\n\n var open = props.open,\n insertAt = props.insertAt,\n onOpen = props.onOpen,\n onClose = props.onClose,\n elementRef = props.elementRef,\n children = props.children,\n passThroughProps = _objectWithoutProperties(props, [\"open\", \"insertAt\", \"onOpen\", \"onClose\", \"elementRef\", \"children\"]);\n\n var isInitialMount = !this.DOMNode;\n var mountNode = this.mountNode;\n var content = children; // Wrap text in a span since subtree will only render a single top-level node\n\n if (typeof content === 'string' && content.length > 0) {\n content = /*#__PURE__*/React.createElement(\"span\", null, content);\n } // Render subtree if Portal is open and has children to render\n\n\n if (open && React.Children.count(content) > 0) {\n // Create node if it doesn't already exist\n if (!this.DOMNode) {\n var node = document.createElement('span');\n\n var attributes = _objectSpread({}, passthroughProps(passThroughProps), {\n dir: this.dir\n });\n\n Object.keys(attributes).forEach(function (name) {\n node.setAttribute(name, attributes[name]);\n });\n elementRef(node);\n this.DOMNode = node;\n } // Append node to container if it isn't already\n\n\n if (this.DOMNode.parentNode !== mountNode) {\n if (insertAt === 'bottom') {\n mountNode.appendChild(this.DOMNode);\n } else {\n mountNode.insertBefore(this.DOMNode, mountNode.firstChild);\n }\n } // Notify that subtree has been rendered if props ask for it\n\n\n var handleMount = function handleMount() {\n // Only fire onOpen if Portal was closed and is now open\n if ((isInitialMount || !_this.props.open && open) && typeof onOpen === 'function') {\n onOpen(_this.DOMNode);\n }\n };\n\n ReactDOM.unstable_renderSubtreeIntoContainer(this, content, this.DOMNode, handleMount);\n } else {\n this.removePortal(props);\n }\n }\n }, {\n key: \"removePortal\",\n value: function removePortal(props) {\n var unmounted;\n\n if (this.DOMNode) {\n unmounted = ReactDOM.unmountComponentAtNode(this.DOMNode);\n this.DOMNode.parentNode && this.DOMNode.parentNode.removeChild(this.DOMNode);\n this.DOMNode = null;\n this.props.elementRef(this.DOMNode);\n }\n\n if (unmounted && typeof props.onClose === 'function') {\n props.onClose();\n }\n }\n }, {\n key: \"mountNode\",\n get: function get() {\n var mountNode;\n\n if (typeof this.props.mountNode === 'function') {\n mountNode = this.props.mountNode();\n } else if (this.props.mountNode) {\n mountNode = this.props.mountNode;\n }\n\n if (!mountNode || !mountNode.nodeName) {\n mountNode = document.body;\n }\n\n return mountNode;\n }\n }, {\n key: \"DOMNode\",\n get: function get() {\n return this._node;\n },\n set: function set(el) {\n this._node = el;\n } // for backwards compatibility:\n\n }, {\n key: \"node\",\n get: function get() {\n return this.DOMNode;\n }\n }]);\n\n SubtreePortal.displayName = \"SubtreePortal\";\n return SubtreePortal;\n}(Component), _class2.propTypes = {\n /**\n * Wheter or not the `` is open\n */\n open: PropTypes.bool,\n\n /**\n * Callback fired when `` content has been mounted in the DOM\n */\n onOpen: PropTypes.func,\n\n /**\n * Callback fired when `` has been unmounted from the DOM\n */\n onClose: PropTypes.func,\n\n /**\n * An element or a function returning an element to use as the mount node\n * for the `` (defaults to `document.body`)\n */\n mountNode: PropTypes.oneOfType([element, PropTypes.func]),\n\n /**\n * Insert the element at the 'top' of the mountNode or at the 'bottom'\n */\n insertAt: PropTypes.oneOf(['bottom', 'top']),\n\n /**\n * The children to be rendered within the ``\n */\n children: PropTypes.node,\n\n /**\n * provides a reference to the underlying html element\n */\n elementRef: PropTypes.func\n}, _class2.defaultProps = {\n open: false,\n insertAt: 'bottom',\n onOpen: function onOpen(DOMNode) {},\n onClose: function onClose() {},\n mountNode: null,\n children: null,\n elementRef: function elementRef(el) {}\n}, _temp)) || _class);\nexport default SubtreePortal;\nexport { SubtreePortal };","import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\n\n/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 - present Instructure, Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport ReactDOM from 'react-dom';\nimport { element } from '@instructure/ui-prop-types';\nimport { ReactPortal } from './ReactPortal';\nimport { SubtreePortal } from './SubtreePortal';\nvar IS_CREATE_PORTAL_SUPPORTED = typeof ReactDOM.createPortal === 'function';\n/**\n---\ncategory: components/utilities\n---\n@module Portal\n**/\n\nvar Portal = /*#__PURE__*/function (_Component) {\n _inherits(Portal, _Component);\n\n var _super = _createSuper(Portal);\n\n function Portal() {\n var _this;\n\n _classCallCheck(this, Portal);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _this.handleElementRef = function (el) {\n if (el) {\n _this.DOMNode = el;\n\n if (typeof _this.props.elementRef === 'function') {\n _this.props.elementRef(el);\n }\n }\n };\n\n return _this;\n }\n\n _createClass(Portal, [{\n key: \"render\",\n value: function render() {\n return IS_CREATE_PORTAL_SUPPORTED ? /*#__PURE__*/React.createElement(ReactPortal, Object.assign({}, this.props, {\n elementRef: this.handleElementRef\n })) : /*#__PURE__*/React.createElement(SubtreePortal, Object.assign({}, this.props, {\n elementRef: this.handleElementRef\n }));\n }\n }]);\n\n Portal.displayName = \"Portal\";\n return Portal;\n}(Component);\n\nPortal.propTypes = {\n /**\n * Wheter or not the `` is open\n */\n open: PropTypes.bool,\n\n /**\n * Callback fired when `` content has been mounted in the DOM\n */\n onOpen: PropTypes.func,\n\n /**\n * Callback fired when `` has been unmounted from the DOM\n */\n onClose: PropTypes.func,\n\n /**\n * An element or a function returning an element to use as the mount node\n * for the `` (defaults to `document.body`)\n */\n mountNode: PropTypes.oneOfType([element, PropTypes.func]),\n\n /**\n * Insert the element at the 'top' of the mountNode or at the 'bottom'\n */\n insertAt: PropTypes.oneOf(['bottom', 'top']),\n\n /**\n * The children to be rendered within the ``\n */\n children: PropTypes.node,\n\n /**\n * provides a reference to the underlying html element\n */\n elementRef: PropTypes.func\n};\nPortal.defaultProps = {\n open: false,\n insertAt: 'bottom',\n onOpen: function onOpen(DOMNode) {},\n onClose: function onClose() {},\n mountNode: null,\n children: null,\n elementRef: function elementRef(el) {}\n};\nexport default Portal;\nexport { Portal };","/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 - present Instructure, Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nimport PropTypes from 'prop-types'; // TODO: Remove when we further break up ui-utils and bringing this in no longer creates\n// a circular dep\n\nvar canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);\n/**\n * ---\n * category: utilities/PropTypes\n * ---\n * Verify that the given prop is a valid React element. If the DOM is accessible,\n * also verify if the prop is an instance of `Element`.\n */\n\nvar element = canUseDOM ? PropTypes.oneOfType([PropTypes.element, PropTypes.instanceOf(Element)]) : PropTypes.element;\nexport default element;\nexport { element };","/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 - present Instructure, Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nimport { findDOMNode } from './findDOMNode';\nimport { canUseDOM } from './canUseDOM';\n/**\n * ---\n * category: utilities/DOM\n * ---\n *\n * Determine if an element contains another DOM node\n *\n * @param {ReactComponent|DomNode} context - component or DOM node\n * @param {ReactComponent|DomNode} el - component or DOM node which we want to determine if contained within the context\n * @returns {boolean} if the element is contained within the context\n */\n\nfunction containsWithDOM(context, el) {\n var container = findDOMNode(context);\n var node = findDOMNode(el);\n\n if (!container || !node) {\n return false;\n } else if (container.contains) {\n return container.contains(node);\n } else if (container.compareDocumentPosition) {\n return container === node || !!(container.compareDocumentPosition(node) & 16); // eslint-disable-line no-bitwise\n } else {\n return containsFallback(container, node);\n }\n}\n/* istanbul ignore next */\n\n\nfunction containsFallback(context, el) {\n var node = el;\n\n while (node) {\n if (node === context) {\n return true;\n }\n\n node = node.parentNode;\n }\n\n return false;\n}\n\nvar contains = canUseDOM ? containsWithDOM : containsFallback;\nexport default contains;\nexport { contains };","/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 - present Instructure, Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nimport { canUseDOM } from './canUseDOM';\n/**\n * ---\n * category: utilities/DOM\n * ---\n *\n * If DOM is usable, returns a function wrapper for\n * window.requestAnimationFrame. Otherwise sets\n * a manual timeout.\n *\n * @returns {function} requestAnimationFrame takes a callback function as an argument and returns a cancel method\n */\n\nvar requestAnimationFrame = function () {\n var requestAnimationFrame;\n /* istanbul ignore else */\n\n if (canUseDOM && window.requestAnimationFrame && window.cancelAnimationFrame) {\n requestAnimationFrame = function requestAnimationFrame(cb) {\n var id = window.requestAnimationFrame(cb);\n return {\n cancel: function cancel() {\n return window.cancelAnimationFrame(id);\n }\n };\n };\n } else {\n /* https://github.com/component/raf */\n var prev = new Date().getTime();\n\n requestAnimationFrame = function requestAnimationFrame(cb) {\n var curr = new Date().getTime();\n var ms = Math.max(0, 16 - (curr - prev));\n var req = setTimeout(cb, ms);\n prev = curr;\n return {\n cancel: function cancel() {\n return clearTimeout(req);\n }\n };\n };\n }\n\n return requestAnimationFrame;\n}();\n\nexport default requestAnimationFrame;\nexport { requestAnimationFrame };","/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 - present Instructure, Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nimport { findDOMNode } from './findDOMNode';\nimport { contains } from './contains';\nimport { getActiveElement } from './getActiveElement';\n/**\n * ---\n * category: utilities/DOM\n * ---\n *\n * Determine if an element contains the active element\n *\n * @param {ReactComponent|DomNode} el - component or DOM node\n * @returns {boolean} if the element contains the active element\n */\n\nfunction containsActiveElement(el) {\n var node = el && findDOMNode(el);\n var active = getActiveElement();\n return node && (active === node || contains(node, active));\n}\n\nexport default containsActiveElement;\nexport { containsActiveElement };","import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport { error as _error } from \"@instructure/console\";\n\n/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 - present Instructure, Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { omitProps, getElementType } from '@instructure/ui-react-utils';\nimport { findDOMNode, requestAnimationFrame } from '@instructure/ui-dom-utils';\nimport { FocusRegionManager } from '@instructure/ui-a11y-utils';\n/**\n---\ncategory: components/utilities\n---\n@module Dialog\n**/\n\nvar Dialog = /*#__PURE__*/function (_Component) {\n _inherits(Dialog, _Component);\n\n var _super = _createSuper(Dialog);\n\n function Dialog() {\n var _this;\n\n _classCallCheck(this, Dialog);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n _this._raf = [];\n _this._focusRegion = null;\n\n _this.getRef = function (el) {\n _this._root = el;\n };\n\n return _this;\n }\n\n _createClass(Dialog, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n if (this.props.open) {\n this.open();\n }\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps) {\n var open = this.props.open;\n\n if (open && !prevProps.open) {\n this.open();\n } else if (!open && prevProps.open) {\n this.close();\n }\n\n if (this._focusRegion) {\n this._focusRegion.updateElement(this.contentElement);\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n if (this.props.open) {\n this.close();\n }\n\n this._raf.forEach(function (request) {\n return request.cancel();\n });\n\n this._raf = [];\n }\n }, {\n key: \"open\",\n value: function open() {\n var _this2 = this;\n\n var _this$props = this.props,\n open = _this$props.open,\n contentElement = _this$props.contentElement,\n options = _objectWithoutProperties(_this$props, [\"open\", \"contentElement\"]);\n\n this._raf.push(requestAnimationFrame(function () {\n _this2._focusRegion = FocusRegionManager.activateRegion(_this2.contentElement, _objectSpread({}, options));\n }));\n }\n }, {\n key: \"close\",\n value: function close() {\n if (this._focusRegion) {\n FocusRegionManager.blurRegion(this.contentElement, this._focusRegion.id);\n }\n }\n }, {\n key: \"focus\",\n value: function focus() {\n if (!this.props.open || !this.contentElement) {\n /*#__PURE__*/\n\n /*#__PURE__*/\n _error(false, '[Dialog] Can\\'t focus a Dialog that isn\\'t open.');\n\n return;\n }\n\n if (this._focusRegion) {\n FocusRegionManager.focusRegion(this.contentElement, this._focusRegion.id);\n }\n }\n }, {\n key: \"blur\",\n value: function blur() {\n if (!this.props.open || !this.contentElement) {\n /*#__PURE__*/\n\n /*#__PURE__*/\n _error(false, '[Dialog] Can\\'t blur a Dialog that isn\\'t open.');\n\n return;\n }\n\n this.close();\n }\n }, {\n key: \"render\",\n value: function render() {\n var ElementType = getElementType(Dialog, this.props);\n return this.props.open ? /*#__PURE__*/React.createElement(ElementType, Object.assign({}, omitProps(this.props, Dialog.propTypes), {\n ref: this.getRef,\n role: this.props.label ? 'dialog' : null,\n \"aria-label\": this.props.label,\n className: this.props.className // eslint-disable-line react/prop-types\n\n }), this.props.children) : null;\n }\n }, {\n key: \"contentElement\",\n get: function get() {\n var contentElement = findDOMNode(this.props.contentElement);\n\n if (!contentElement) {\n contentElement = findDOMNode(this._root);\n }\n\n return contentElement;\n }\n }, {\n key: \"focused\",\n get: function get() {\n return this.contentElement && this._focusRegion && FocusRegionManager.isFocused(this.contentElement, this._focusRegion.id);\n }\n }]);\n\n Dialog.displayName = \"Dialog\";\n return Dialog;\n}(Component);\n\nDialog.propTypes = {\n /**\n * The children to be rendered within the ``\n */\n children: PropTypes.node,\n\n /**\n * The element to render as the component root, `span` by default\n */\n as: PropTypes.elementType,\n // eslint-disable-line react/require-default-props\n display: PropTypes.oneOf(['auto', 'block', 'inline-block']),\n label: PropTypes.string,\n\n /**\n * Whether or not the `` is open\n */\n open: PropTypes.bool,\n\n /**\n * Function called when tab focus leaves the `` focusable content. This only\n * occurs when `shouldContainFocus` is set to false.\n */\n onBlur: PropTypes.func,\n onDismiss: PropTypes.func,\n\n /**\n * An element or a function returning an element to focus by default\n */\n defaultFocusElement: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),\n\n /**\n * An element or a function returning an element that wraps the content of the ``\n */\n contentElement: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),\n\n /**\n * An element, function returning an element, or array of elements that will not be hidden from\n * the screen reader when the `` is open\n */\n liveRegion: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element), PropTypes.element, PropTypes.func]),\n shouldContainFocus: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['keyboard', 'screenreader'])]),\n shouldReturnFocus: PropTypes.bool,\n shouldCloseOnDocumentClick: PropTypes.bool,\n shouldCloseOnEscape: PropTypes.bool,\n shouldFocusOnOpen: PropTypes.bool\n};\nDialog.defaultProps = {\n children: null,\n display: void 0,\n label: void 0,\n open: false,\n shouldFocusOnOpen: true,\n shouldContainFocus: false,\n shouldReturnFocus: false,\n shouldCloseOnDocumentClick: true,\n shouldCloseOnEscape: true,\n defaultFocusElement: null,\n contentElement: null,\n liveRegion: null,\n onBlur: function onBlur(event) {},\n onDismiss: function onDismiss(event) {}\n};\nexport default Dialog;\nexport { Dialog };","import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport { error as _error } from \"@instructure/console\";\nimport { FocusRegion } from './FocusRegion';\nvar ENTRIES = [];\n\nvar FocusRegionManager = function FocusRegionManager() {\n _classCallCheck(this, FocusRegionManager);\n};\n\nFocusRegionManager.focusRegion = function (element) {\n var idOrOptions = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n var entry;\n\n if (typeof idOrOptions === 'string') {\n entry = FocusRegionManager.getEntry(element, idOrOptions);\n } else {\n entry = FocusRegionManager.addEntry(element, idOrOptions);\n }\n\n if (entry && entry.region && typeof entry.region.focus === 'function') {\n entry.region.focus();\n return entry.region;\n } else {\n /*#__PURE__*/\n\n /*#__PURE__*/\n _error(false, \"[FocusRegionManager] Could not focus region with element: \".concat(element));\n }\n};\n\nFocusRegionManager.activateRegion = function (element, options) {\n var _FocusRegionManager$a = FocusRegionManager.addEntry(element, options),\n region = _FocusRegionManager$a.region;\n\n return region;\n};\n\nFocusRegionManager.getActiveEntry = function () {\n return ENTRIES.find(function (_ref) {\n var region = _ref.region;\n return region.focused;\n });\n};\n\nFocusRegionManager.findEntry = function (element, id) {\n var index;\n\n if (id) {\n index = ENTRIES.findIndex(function (entry) {\n return entry.id === id;\n });\n } else {\n index = ENTRIES.findIndex(function (entry) {\n return entry.element === element;\n });\n }\n\n return index;\n};\n\nFocusRegionManager.getEntry = function (element, id) {\n return ENTRIES[FocusRegionManager.findEntry(element, id)];\n};\n\nFocusRegionManager.addEntry = function (element) {\n var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n var region = new FocusRegion(element, options);\n var activeEntry = FocusRegionManager.getActiveEntry();\n var keyboardFocusable = region.keyboardFocusable;\n ENTRIES.forEach(function (_ref2) {\n var region = _ref2.region;\n\n if (region) {\n // If the active region is triggering a new focus region that does not have\n // keyboard focusable content, don't deactivate the active region's keyboard\n // focus region\n region.deactivate(region.focused && !keyboardFocusable && {\n keyboard: false\n });\n }\n });\n region.activate();\n\n if (options.shouldFocusOnOpen) {\n region.focus();\n }\n\n var entry = {\n id: region.id,\n element: element,\n region: region,\n children: [],\n parent: activeEntry\n };\n ENTRIES.push(entry);\n\n if (activeEntry) {\n activeEntry.children.push(entry);\n }\n\n return entry;\n};\n\nFocusRegionManager.removeEntry = function (element, id) {\n var index = FocusRegionManager.findEntry(element, id);\n var entry = ENTRIES[index];\n\n if (index > -1) {\n ENTRIES.splice(index, 1);\n }\n\n return entry;\n};\n\nFocusRegionManager.isFocused = function (element, id) {\n var entry = FocusRegionManager.getActiveEntry();\n\n if (id) {\n return entry && entry.region && entry.id === id;\n } else {\n return entry && entry.region && entry.element === element;\n }\n};\n\nFocusRegionManager.clearEntries = function () {\n ENTRIES = [];\n};\n\nFocusRegionManager.blurRegion = function (element, id) {\n var entry = FocusRegionManager.removeEntry(element, id);\n\n if (entry) {\n var children = entry.children,\n region = entry.region,\n parent = entry.parent; // deactivate the region...\n\n region && region.deactivate(); // and any regions created from it\n\n if (children) {\n children.forEach(function (_ref3) {\n var id = _ref3.id,\n element = _ref3.element;\n var entry = FocusRegionManager.removeEntry(element, id);\n entry && entry.region && entry.region.deactivate();\n });\n } // activate the region's parent if it exists\n\n\n parent && parent.region && parent.region.activate();\n region && region.blur(); // this should focus the parent region\n }\n};\n\nexport default FocusRegionManager;\nexport {\n/**\n * ---\n * category: utilities/a11y\n * ---\n * @module FocusManager\n * Class for focus operations.\n * - Scoping focus within a given context,\n * - Mark active element for focus later\n * - Return focus to the marked element\n */\nFocusRegionManager };","/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 - present Instructure, Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nfunction getFrameDocumentSafe(el) {\n try {\n return el.contentDocument || el.contentWindow.document;\n } catch (err) {\n return null;\n }\n}\n\nexport default getFrameDocumentSafe;\nexport { getFrameDocumentSafe };","import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport { warn as _warn } from \"@instructure/console\";\n\nvar ScreenReaderFocusRegion = /*#__PURE__*/function () {\n function ScreenReaderFocusRegion(element) {\n var _this = this;\n\n var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {\n shouldContainFocus: true,\n liveRegion: []\n };\n\n _classCallCheck(this, ScreenReaderFocusRegion);\n\n this._observer = null;\n this._attributes = [];\n this._nodes = [];\n this._parents = [];\n\n this.handleDOMMutation = function (records) {\n records.forEach(function (record) {\n var addedNodes = Array.from(record.addedNodes);\n var removedNodes = Array.from(record.removedNodes);\n\n _this.hideNodes(addedNodes);\n\n removedNodes.forEach(function (removedNode) {\n // Node has been removed from the DOM, make sure it is\n // removed from our list of hidden nodes as well\n if (removedNode.tagName.toLowerCase() !== 'iframe') {\n _this.restoreNode(removedNode);\n }\n\n var iframeBodies = _this.parseIframeBodies(removedNode);\n\n iframeBodies.forEach(function (iframeBody) {\n _this.restoreNode(iframeBody);\n });\n });\n });\n };\n\n var liveRegion = typeof options.liveRegion === 'function' ? options.liveRegion() : options.liveRegion;\n this._liveRegion = Array.isArray(liveRegion) ? liveRegion : [liveRegion];\n this._contextElement = element;\n this._options = options;\n }\n\n _createClass(ScreenReaderFocusRegion, [{\n key: \"updateElement\",\n value: function updateElement(element) {\n this._contextElement = element;\n }\n }, {\n key: \"muteNode\",\n value: function muteNode(node) {\n var _this2 = this;\n\n if (node && node.tagName.toLowerCase() !== 'script') {\n // When we are trapping screen reader focus on an element that\n // is deep inside the DOM, we can't apply aria-hidden to the\n // parents, so parent regions will be read if they have a role\n // and/or aria-label assigned. To optimize SR ux we remove the role,\n // aria-label, and aria-hidden attrs temporarily when the region\n // is focused, and then we restore them when focus is lost.\n ['role', 'aria-label', 'aria-hidden' // this should never happen right?\n ].forEach(function (attribute) {\n var value = node.getAttribute(attribute);\n\n if (value !== null) {\n _this2._attributes.push([node, attribute, value]);\n\n node.removeAttribute(attribute);\n }\n });\n\n this._observer.observe(node, {\n childList: true\n });\n }\n }\n }, {\n key: \"hideNodes\",\n value: function hideNodes(nodes) {\n var _this3 = this;\n\n nodes.forEach(function (node) {\n if (node && node.nodeType === 1 && node.tagName.toLowerCase() !== 'script' && _this3._parents.indexOf(node) === -1 && _this3._nodes.indexOf(node) === -1 && _this3._liveRegion.indexOf(node) === -1 && !_this3._contextElement.contains(node)) {\n if (node.tagName.toLowerCase() !== 'iframe') {\n _this3.hideNode(node);\n }\n\n var iframeBodies = _this3.parseIframeBodies(node);\n\n iframeBodies.forEach(function (iframeBody) {\n _this3.hideNode(iframeBody);\n });\n }\n });\n }\n }, {\n key: \"hideNode\",\n value: function hideNode(node) {\n if (node.getAttribute('aria-hidden') !== 'true') {\n node.setAttribute('aria-hidden', 'true');\n\n this._nodes.push(node);\n }\n }\n }, {\n key: \"restoreNode\",\n value: function restoreNode(removedNode) {\n var index = this._nodes.indexOf(removedNode);\n\n if (index >= 0) {\n removedNode.removeAttribute('aria-hidden');\n\n this._nodes.splice(index, 1);\n }\n }\n }, {\n key: \"parseIframeBodies\",\n value: function parseIframeBodies(node) {\n if (!node) return [];\n var iframes = [];\n\n if (node.tagName.toLowerCase() === 'iframe') {\n iframes.push(node);\n } else {\n if (node.getElementsByTagName) {\n iframes = Array.from(node.getElementsByTagName('iframe'));\n }\n }\n\n return iframes.map(function (iframe) {\n var body = null;\n\n try {\n body = iframe.contentDocument.body;\n } catch (e) {\n /*#__PURE__*/\n\n /*#__PURE__*/\n _warn(false, \"[ui-a11y] could not find a document for iframe: \".concat(e), iframe);\n }\n\n return body;\n }).filter(function (body) {\n return body !== null;\n });\n }\n }, {\n key: \"activate\",\n value: function activate() {\n if (!this._options.shouldContainFocus) {\n return;\n }\n\n this._observer = new MutationObserver(this.handleDOMMutation);\n var node = this._contextElement;\n\n while (node && node.nodeType === 1 && node.tagName.toLowerCase() !== 'body') {\n var parent = node.parentElement; // can be null\n\n if (parent) {\n this._parents.push(parent);\n\n this.muteNode(parent);\n this.hideNodes(Array.prototype.slice.call(parent.childNodes));\n }\n\n node = node.parentNode; // should never be null, will default to doc element\n }\n }\n }, {\n key: \"deactivate\",\n value: function deactivate() {\n if (this._observer) {\n this._observer.disconnect();\n\n this._observer = null;\n }\n\n this._nodes.forEach(function (node) {\n node.removeAttribute('aria-hidden');\n });\n\n this._nodes = [];\n\n this._attributes.forEach(function (attribute) {\n attribute[0].setAttribute(attribute[1], attribute[2] || '');\n });\n\n this._attributes = [];\n this._parents = [];\n }\n }]);\n\n return ScreenReaderFocusRegion;\n}();\n\nexport default ScreenReaderFocusRegion;\nexport {\n/**\n * ---\n * category: utilities/a11y\n * ---\n * @module ScreenReaderFocusRegion\n * Utility that hides all DOM elements outside of a specified node. Used,\n * for example, in overlay components where we want to restrict the screen\n * readers to the overlay content\n */\nScreenReaderFocusRegion };","/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 - present Instructure, Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nimport { findDOMNode, findTabbable, isActiveElement, containsActiveElement, getActiveElement } from '@instructure/ui-dom-utils';\n\nfunction scopeTab(element, event, onLeavingFinalTabbable) {\n var node = findDOMNode(element);\n var tabbable = findTabbable(node);\n\n if (!tabbable.length) {\n event.preventDefault();\n return;\n } // Account for a changing tabindex of the active element\n // (a case that happens with Menu for KO a11y)\n\n\n if (containsActiveElement(element)) {\n var activeElement = getActiveElement();\n\n if (tabbable.indexOf(activeElement) === -1) {\n tabbable.push(activeElement);\n }\n }\n\n var finalTabbable = tabbable[event.shiftKey ? 0 : tabbable.length - 1];\n var leavingFinalTabbable = isActiveElement(finalTabbable) || // handle immediate shift+tab after opening with mouse\n isActiveElement(node) || // already left final tabbable\n !containsActiveElement(element);\n if (!leavingFinalTabbable) return;\n\n if (typeof onLeavingFinalTabbable === 'function') {\n onLeavingFinalTabbable();\n return;\n }\n\n event.preventDefault();\n var target = tabbable[event.shiftKey ? tabbable.length - 1 : 0];\n target.focus();\n}\n\nexport default scopeTab;\nexport {\n/**\n * ---\n * category: utilities/a11y\n * ---\n *\n * Scope tab in order to trap focus within a specified\n * element.\n *\n * @param {ReactElement|DOMNode} element\n * @param {Event} event the DOM Event that was fired\n * @param {function} function executed when leaving final tabbable instead of the default behavior\n */\nscopeTab };","import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport { error as _error } from \"@instructure/console\";\n\n/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 - present Instructure, Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nimport { findDOMNode, findTabbable, findFocusable, ownerWindow, getActiveElement, addEventListener, ownerDocument, containsActiveElement, requestAnimationFrame } from '@instructure/ui-dom-utils';\nimport keycode from 'keycode';\nimport { scopeTab } from './scopeTab';\n\nvar KeyboardFocusRegion = /*#__PURE__*/function () {\n function KeyboardFocusRegion(element, options) {\n var _this = this;\n\n _classCallCheck(this, KeyboardFocusRegion);\n\n this._contextElement = null;\n this._focusLaterElement = null;\n this._needToFocus = false;\n this._listeners = [];\n this._raf = [];\n this._active = false;\n\n this.handleDismiss = function (event) {\n _this._options.onDismiss(event);\n };\n\n this.handleKeyDown = function (event) {\n if (event.keyCode === keycode.codes.tab) {\n scopeTab(_this._contextElement, event);\n }\n };\n\n this.handleClick = function (event) {\n _this._wasDocumentClick = true;\n };\n\n this.handleWindowBlur = function (event) {\n if (_this._wasDocumentClick) {\n _this._wasDocumentClick = false;\n return;\n }\n\n _this._needToFocus = true;\n };\n\n this.handleFocus = function (event) {\n if (_this._needToFocus) {\n _this._needToFocus = false;\n\n if (!_this._contextElement) {\n return;\n } // need to see how jQuery shims document.on('focusin') so we don't need the\n // setTimeout, firefox doesn't support focusin, if it did, we could focus\n // the element outside of a setTimeout. Side-effect of this implementation\n // is that the document.body gets focus, and then we focus our element right\n // after, seems fine.\n\n\n _this._raf.push(requestAnimationFrame(function () {\n if (containsActiveElement(_this._contextElement)) {\n return;\n }\n\n _this.focusDefaultElement();\n }));\n }\n };\n\n this.handleFirstTabbableKeyDown = function (event) {\n if (event.keyCode === keycode.codes.tab && event.shiftKey) {\n _this._options.onBlur(event);\n }\n };\n\n this.handleLastTabbableKeyDown = function (event) {\n if (event.keyCode === keycode.codes.tab && !event.shiftKey) {\n _this._options.onBlur(event);\n }\n };\n\n this._contextElement = findDOMNode(element);\n this._options = options || {\n shouldContainFocus: true,\n shouldReturnFocus: true,\n onBlur: function onBlur(event) {},\n onDismiss: function onDismiss(event) {},\n defaultFocusElement: null\n };\n\n if (this._options.shouldReturnFocus) {\n this._focusLaterElement = this.activeElement;\n }\n }\n\n _createClass(KeyboardFocusRegion, [{\n key: \"updateElement\",\n value: function updateElement(element) {\n this._contextElement = findDOMNode(element);\n }\n }, {\n key: \"focusDefaultElement\",\n value: function focusDefaultElement() {\n var defaultFocusElement = this.defaultFocusElement,\n shouldContainFocus = this.shouldContainFocus;\n\n if (defaultFocusElement) {\n defaultFocusElement.focus();\n } else {\n if (shouldContainFocus) {\n // Blur the active element to place focus on the document body\n this.activeElement.blur();\n\n /*#__PURE__*/\n\n /*#__PURE__*/\n _error(true, \"\\n [KeyboardFocusRegion] No `defaultFocusElement` was provided and `shouldContainFocus`\\n was set to `true`. Focus has been moved to the document body instead.\\n \");\n }\n }\n }\n }, {\n key: \"focus\",\n value: function focus() {\n var _this2 = this;\n\n if (this.focused) {\n return;\n }\n\n this._raf.push(requestAnimationFrame(function () {\n _this2.focusDefaultElement();\n }));\n }\n }, {\n key: \"blur\",\n value: function blur() {\n if (this._options.shouldReturnFocus && this._focusLaterElement) {\n try {\n this._focusLaterElement.focus();\n } catch (e) {\n /*#__PURE__*/\n\n /*#__PURE__*/\n _error(false, \"\\n [KeyboardFocusRegion] You tried to return focus to \".concat(this._focusLaterElement, \"\\n but it is not in the DOM anymore: \").concat(e, \"\\n \"));\n }\n\n this._focusLaterElement = null;\n }\n }\n }, {\n key: \"activate\",\n value: function activate() {\n var defaultFocusElement = this.defaultFocusElement,\n shouldContainFocus = this.shouldContainFocus;\n\n if (!this._active) {\n if (defaultFocusElement || shouldContainFocus) {\n if (shouldContainFocus) {\n this._listeners.push(addEventListener(this.doc, 'keydown', this.handleKeyDown));\n } else {\n this._listeners.push(addEventListener(this.firstTabbable || defaultFocusElement, 'keydown', this.handleFirstTabbableKeyDown));\n\n this._listeners.push(addEventListener(this.lastTabbable || defaultFocusElement, 'keydown', this.handleLastTabbableKeyDown));\n }\n\n this._listeners.push(addEventListener(this.doc, 'click', this.handleClick, true));\n\n this._listeners.push(addEventListener(this.win, 'blur', this.handleWindowBlur, false));\n\n this._listeners.push(addEventListener(this.doc, 'focus', this.handleFocus, true));\n\n this._active = true;\n }\n }\n }\n }, {\n key: \"deactivate\",\n value: function deactivate() {\n if (this._active) {\n this._listeners.forEach(function (listener) {\n listener.remove();\n });\n\n this._listeners = [];\n\n this._raf.forEach(function (request) {\n return request.cancel();\n });\n\n this._raf = [];\n this._preventCloseOnDocumentClick = false;\n this._active = false;\n }\n }\n }, {\n key: \"focused\",\n get: function get() {\n return containsActiveElement(this._contextElement);\n }\n }, {\n key: \"shouldContainFocus\",\n get: function get() {\n var shouldContainFocus = this._options.shouldContainFocus;\n return shouldContainFocus === true || Array.isArray(shouldContainFocus) && shouldContainFocus.includes['keyboard'];\n }\n }, {\n key: \"focusable\",\n get: function get() {\n return findFocusable(this._contextElement, function () {\n return true;\n }, true) || [];\n }\n }, {\n key: \"tabbable\",\n get: function get() {\n return findTabbable(this._contextElement) || [];\n }\n }, {\n key: \"firstTabbable\",\n get: function get() {\n return this.tabbable[0];\n }\n }, {\n key: \"lastTabbable\",\n get: function get() {\n return this.tabbable.pop();\n }\n }, {\n key: \"firstFocusable\",\n get: function get() {\n return this.focusable[0];\n }\n }, {\n key: \"lastFocusable\",\n get: function get() {\n return this.focusable.pop();\n }\n }, {\n key: \"doc\",\n get: function get() {\n return ownerDocument(this._contextElement);\n }\n }, {\n key: \"win\",\n get: function get() {\n return ownerWindow(this._contextElement);\n }\n }, {\n key: \"activeElement\",\n get: function get() {\n return getActiveElement(this.doc);\n }\n }, {\n key: \"defaultFocusElement\",\n get: function get() {\n var defaultFocusElement = this._options.defaultFocusElement;\n var element = findDOMNode(typeof defaultFocusElement === 'function' ? defaultFocusElement() : defaultFocusElement);\n\n if (element && this._contextElement && this._contextElement.contains(element)) {\n return element;\n }\n\n var firstTabbable = this.firstTabbable;\n\n if (firstTabbable) {\n return firstTabbable;\n }\n\n if (this.focusable.includes(this._contextElement)) {\n return this._contextElement;\n }\n\n return null;\n }\n }]);\n\n return KeyboardFocusRegion;\n}();\n\nexport default KeyboardFocusRegion;\nexport {\n/**\n * ---\n * category: utilities/a11y\n * ---\n * @module KeyboardFocusRegion\n * Class for focus operations.\n * - Scoping focus within a given context (DOM node),\n * - Mark active element for focus later\n * - Return focus to the marked element\n */\nKeyboardFocusRegion };","import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport { error as _error } from \"@instructure/console\";\n\n/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 - present Instructure, Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nimport keycode from 'keycode';\nimport { contains, addEventListener, getFrameDocumentSafe, ownerDocument, findTabbable } from '@instructure/ui-dom-utils';\nimport { uid } from '@instructure/uid';\nimport { ScreenReaderFocusRegion } from './ScreenReaderFocusRegion';\nimport { KeyboardFocusRegion } from './KeyboardFocusRegion';\n\nvar FocusRegion = /*#__PURE__*/function () {\n function FocusRegion(element, options) {\n var _this = this;\n\n _classCallCheck(this, FocusRegion);\n\n this._contextElement = null;\n this._preventCloseOnDocumentClick = false;\n this._listeners = [];\n this._active = false;\n\n this.handleDismiss = function (event, documentClick) {\n _this._options.onDismiss(event, documentClick);\n };\n\n this.captureDocumentClick = function (event) {\n var target = event.target;\n _this._preventCloseOnDocumentClick = event.button !== 0 || contains(_this._contextElement, target);\n };\n\n this.handleDocumentClick = function (event) {\n if (_this._options.shouldCloseOnDocumentClick && !_this._preventCloseOnDocumentClick) {\n _this.handleDismiss(event, true);\n }\n };\n\n this.handleFrameClick = function (event, frame) {\n if (!contains(_this._contextElement, frame)) {\n // dismiss if frame is not within the region\n _this.handleDismiss(event, true);\n }\n };\n\n this.handleKeyUp = function (event) {\n if (_this._options.shouldCloseOnEscape && event.keyCode === keycode.codes.escape && !event.defaultPrevented) {\n _this.handleDismiss(event);\n }\n };\n\n this._options = options || {\n shouldCloseOnDocumentClick: true,\n shouldCloseOnEscape: true,\n onDismiss: function onDismiss(event) {}\n };\n this._contextElement = element;\n this._screenReaderFocusRegion = new ScreenReaderFocusRegion(element, options);\n this._keyboardFocusRegion = new KeyboardFocusRegion(element, options);\n this._id = uid();\n }\n\n _createClass(FocusRegion, [{\n key: \"updateElement\",\n value: function updateElement(element) {\n this._contextElement = element;\n\n if (this._keyboardFocusRegion) {\n this._keyboardFocusRegion.updateElement(element);\n }\n\n if (this._screenReaderFocusRegion) {\n this._screenReaderFocusRegion.updateElement(element);\n }\n }\n }, {\n key: \"activate\",\n value: function activate() {\n var _this2 = this;\n\n if (!this._active) {\n var doc = ownerDocument(this._contextElement);\n\n this._keyboardFocusRegion.activate();\n\n this._screenReaderFocusRegion.activate();\n\n if (this._options.shouldCloseOnDocumentClick) {\n this._listeners.push(addEventListener(doc, 'click', this.captureDocumentClick, true));\n\n this._listeners.push(addEventListener(doc, 'click', this.handleDocumentClick));\n\n Array.from(doc.getElementsByTagName('iframe')).forEach(function (el) {\n // listen for mouseup events on any iframes in the document\n var frameDoc = getFrameDocumentSafe(el);\n\n if (frameDoc) {\n _this2._listeners.push(addEventListener(frameDoc, 'mouseup', function (event) {\n _this2.handleFrameClick(event, el);\n }));\n }\n });\n }\n\n if (this._options.shouldCloseOnEscape) {\n this._listeners.push(addEventListener(doc, 'keyup', this.handleKeyUp));\n }\n\n this._active = true;\n }\n }\n }, {\n key: \"deactivate\",\n value: function deactivate() {\n var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {},\n _ref$keyboard = _ref.keyboard,\n keyboard = _ref$keyboard === void 0 ? true : _ref$keyboard;\n\n if (this._active) {\n this._listeners.forEach(function (listener) {\n listener.remove();\n });\n\n this._listeners = [];\n\n if (keyboard) {\n this._keyboardFocusRegion.deactivate();\n }\n\n this._screenReaderFocusRegion.deactivate();\n\n this._active = false;\n }\n }\n }, {\n key: \"focus\",\n value: function focus() {\n /*#__PURE__*/\n\n /*#__PURE__*/\n _error(this._active, \"[FocusRegion] Cannot call '.focus()' on a region that is not currently active.\");\n\n this._keyboardFocusRegion.focus();\n }\n }, {\n key: \"blur\",\n value: function blur() {\n /*#__PURE__*/\n\n /*#__PURE__*/\n _error(!this._active, \"[FocusRegion] Cannot call '.blur()' on a region that is currently active.\");\n\n this._keyboardFocusRegion.blur();\n }\n }, {\n key: \"id\",\n get: function get() {\n return this._id;\n } // Focused returns when the focus region is active. Checking focused with the active element\n // is inconsistent across browsers (Safari/Firefox do not focus elements on click)\n\n }, {\n key: \"focused\",\n get: function get() {\n return this._active;\n }\n }, {\n key: \"keyboardFocusable\",\n get: function get() {\n return (findTabbable(this._contextElement) || []).length > 0;\n }\n }]);\n\n return FocusRegion;\n}();\n\nexport default FocusRegion;\nexport {\n/**\n * ---\n * category: utilities/a11y\n * ---\n * @module FocusRegion\n * Class for focus operations.\n * - Scoping focus within a given context (DOM node),\n * - Mark active element for focus later\n * - Return focus to the marked element\n */\nFocusRegion };","/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 - present Instructure, Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nimport { findFocusable } from './findFocusable';\n\nfunction findTabbable(el, shouldSearchRootNode) {\n return findFocusable(el, function (element) {\n return !isInvalidTabIndex(element.getAttribute('tabindex'));\n }, shouldSearchRootNode);\n}\n\nfunction isInvalidTabIndex(tabIndex) {\n return !isNaN(tabIndex) && tabIndex < 0;\n}\n\nexport default findTabbable;\nexport {\n/**\n * ---\n * category: utilities/a11y\n * ---\n *\n * Given an element, finds and returns all visible, tabbable children.\n * Tabbable elements include input, select, textarea, button, and object.\n * Anchor tags are also tabbable if they include an href or zero or positive\n * tabindex attribute (to include elements with negative tabindex attributes,\n * use findFocusable).\n *\n * @param {ReactComponent|DomNode} el - component or DOM node\n * @param {Boolean} shouldSearchRootNode - should the root node be included in the search\n * @returns {Array} array of all tabbable children\n */\nfindTabbable };","/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 - present Instructure, Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nimport { findDOMNode } from './findDOMNode';\n/**\n * ---\n * category: utilities/DOM\n * ---\n * Wrapper function for DOM addEventListener\n * @module addEventListener\n * @param {DOMNode} el - DOM node which will have the event listener attached\n * @param {String} event - a string specifying the event name ('click', 'focus', etc)\n * @param {Function} handler - function to run when event occurs\n * @param {Boolean} capture - should the event be executed in the capturing or bubbling phase\n * @returns {Function} a method to remove the event listener\n */\n\nfunction addEventListener(el, event, handler, capture) {\n var node = el === window || el === document ? el : findDOMNode(el);\n node.addEventListener(event, handler, capture);\n return {\n remove: function remove() {\n node.removeEventListener(event, handler, capture);\n }\n };\n}\n\nexport default addEventListener;\nexport { addEventListener };"],"sourceRoot":""}