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NrH,iBAAkBiQ,GAEtB,GAAG,CAACxN,IACA2F,IAAa,IAAAjG,cAAY,SAAU+N,GACrCzN,EAAS,CACPI,KAAMyE,GACNpH,aAAcgQ,GAElB,GAAG,CAACzN,IAYJ,MAAO,CAELuK,aAAcA,GACdb,cAAeA,GACfG,aAAcA,GACdkC,cAAeA,GACfP,qBAAsBA,GAEtB4B,WAAYA,GACZE,SAAUA,GACVD,UAAWA,GACXE,oBAAqBA,GACrBG,eAvBkB,IAAAhO,cAAY,SAAUiO,GACxC3N,EAAS,CACPI,KAAM0E,GACNpH,WAAYiQ,GAEhB,GAAG,CAAC3N,IAmBF2F,WAAYA,GACZiI,OAnBU,IAAAlO,cAAY,WACtBM,EAAS,CACPI,KAAM2E,IAEV,GAAG,CAAC/E,IAiBFzC,iBAAkBA,EAClBC,OAAQA,EACRC,aAAcA,EACdC,WAAYA,EAEhB,CAhaA0I,GAAYR,iBAAmBX,GAqfd,UACO,UACA,UACR,SACS,SACT,SACD,WACO,WACA,WACC,SACE,SACJ,WACI,WACV,UAAgB,CAC3B5B,iBAAkB,SAClBC,oBAAqB,SACrBvH,SAAU,UAAgB,CACxBO,eAAgB,SAChBN,cAAe,QACfmB,KAAM,W","sources":["webpack://typescript/./node_modules/downshift/dist/downshift.esm.js"],"sourcesContent":["import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/esm/objectWithoutPropertiesLoose';\nimport _extends from '@babel/runtime/helpers/esm/extends';\nimport _assertThisInitialized from '@babel/runtime/helpers/esm/assertThisInitialized';\nimport _inheritsLoose from '@babel/runtime/helpers/esm/inheritsLoose';\nimport PropTypes from 'prop-types';\nimport { cloneElement, Component, useRef, useEffect, useCallback, useLayoutEffect, useReducer, useMemo } from 'react';\nimport { isForwardRef } from 'react-is';\nimport compute from 'compute-scroll-into-view';\nimport { __assign } from 'tslib';\n\nvar idCounter = 0;\n\n/**\n * Accepts a parameter and returns it if it's a function\n * or a noop function if it's not. This allows us to\n * accept a callback, but not worry about it if it's not\n * passed.\n * @param {Function} cb the callback\n * @return {Function} a function\n */\nfunction cbToCb(cb) {\n return typeof cb === 'function' ? cb : noop;\n}\nfunction noop() {}\n\n/**\n * Scroll node into view if necessary\n * @param {HTMLElement} node the element that should scroll into view\n * @param {HTMLElement} menuNode the menu element of the component\n */\nfunction scrollIntoView(node, menuNode) {\n if (!node) {\n return;\n }\n var actions = compute(node, {\n boundary: menuNode,\n block: 'nearest',\n scrollMode: 'if-needed'\n });\n actions.forEach(function (_ref) {\n var el = _ref.el,\n top = _ref.top,\n left = _ref.left;\n el.scrollTop = top;\n el.scrollLeft = left;\n });\n}\n\n/**\n * @param {HTMLElement} parent the parent node\n * @param {HTMLElement} child the child node\n * @param {Window} environment The window context where downshift renders.\n * @return {Boolean} whether the parent is the child or the child is in the parent\n */\nfunction isOrContainsNode(parent, child, environment) {\n var result = parent === child || child instanceof environment.Node && parent.contains && parent.contains(child);\n return result;\n}\n\n/**\n * Simple debounce implementation. Will call the given\n * function once after the time given has passed since\n * it was last called.\n * @param {Function} fn the function to call after the time\n * @param {Number} time the time to wait\n * @return {Function} the debounced function\n */\nfunction debounce(fn, time) {\n var timeoutId;\n function cancel() {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n }\n function wrapper() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n cancel();\n timeoutId = setTimeout(function () {\n timeoutId = null;\n fn.apply(void 0, args);\n }, time);\n }\n wrapper.cancel = cancel;\n return wrapper;\n}\n\n/**\n * This is intended to be used to compose event handlers.\n * They are executed in order until one of them sets\n * `event.preventDownshiftDefault = true`.\n * @param {...Function} fns the event handler functions\n * @return {Function} the event handler to add to an element\n */\nfunction callAllEventHandlers() {\n for (var _len2 = arguments.length, fns = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n fns[_key2] = arguments[_key2];\n }\n return function (event) {\n for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {\n args[_key3 - 1] = arguments[_key3];\n }\n return fns.some(function (fn) {\n if (fn) {\n fn.apply(void 0, [event].concat(args));\n }\n return event.preventDownshiftDefault || event.hasOwnProperty('nativeEvent') && event.nativeEvent.preventDownshiftDefault;\n });\n };\n}\nfunction handleRefs() {\n for (var _len4 = arguments.length, refs = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n refs[_key4] = arguments[_key4];\n }\n return function (node) {\n refs.forEach(function (ref) {\n if (typeof ref === 'function') {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n });\n };\n}\n\n/**\n * This generates a unique ID for an instance of Downshift\n * @return {String} the unique ID\n */\nfunction generateId() {\n return String(idCounter++);\n}\n\n/**\n * Resets idCounter to 0. Used for SSR.\n */\nfunction resetIdCounter() {\n idCounter = 0;\n}\n\n/**\n * Default implementation for status message. Only added when menu is open.\n * Will specify if there are results in the list, and if so, how many,\n * and what keys are relevant.\n *\n * @param {Object} param the downshift state and other relevant properties\n * @return {String} the a11y status message\n */\nfunction getA11yStatusMessage$1(_ref2) {\n var isOpen = _ref2.isOpen,\n resultCount = _ref2.resultCount,\n previousResultCount = _ref2.previousResultCount;\n if (!isOpen) {\n return '';\n }\n if (!resultCount) {\n return 'No results are available.';\n }\n if (resultCount !== previousResultCount) {\n return resultCount + \" result\" + (resultCount === 1 ? ' is' : 's are') + \" available, use up and down arrow keys to navigate. Press Enter key to select.\";\n }\n return '';\n}\n\n/**\n * Takes an argument and if it's an array, returns the first item in the array\n * otherwise returns the argument\n * @param {*} arg the maybe-array\n * @param {*} defaultValue the value if arg is falsey not defined\n * @return {*} the arg or it's first item\n */\nfunction unwrapArray(arg, defaultValue) {\n arg = Array.isArray(arg) ? /* istanbul ignore next (preact) */arg[0] : arg;\n if (!arg && defaultValue) {\n return defaultValue;\n } else {\n return arg;\n }\n}\n\n/**\n * @param {Object} element (P)react element\n * @return {Boolean} whether it's a DOM element\n */\nfunction isDOMElement(element) {\n\n // then we assume this is react\n return typeof element.type === 'string';\n}\n\n/**\n * @param {Object} element (P)react element\n * @return {Object} the props\n */\nfunction getElementProps(element) {\n return element.props;\n}\n\n/**\n * Throws a helpful error message for required properties. Useful\n * to be used as a default in destructuring or object params.\n * @param {String} fnName the function name\n * @param {String} propName the prop name\n */\nfunction requiredProp(fnName, propName) {\n // eslint-disable-next-line no-console\n console.error(\"The property \\\"\" + propName + \"\\\" is required in \\\"\" + fnName + \"\\\"\");\n}\nvar stateKeys = ['highlightedIndex', 'inputValue', 'isOpen', 'selectedItem', 'type'];\n/**\n * @param {Object} state the state object\n * @return {Object} state that is relevant to downshift\n */\nfunction pickState(state) {\n if (state === void 0) {\n state = {};\n }\n var result = {};\n stateKeys.forEach(function (k) {\n if (state.hasOwnProperty(k)) {\n result[k] = state[k];\n }\n });\n return result;\n}\n\n/**\n * This will perform a shallow merge of the given state object\n * with the state coming from props\n * (for the controlled component scenario)\n * This is used in state updater functions so they're referencing\n * the right state regardless of where it comes from.\n *\n * @param {Object} state The state of the component/hook.\n * @param {Object} props The props that may contain controlled values.\n * @returns {Object} The merged controlled state.\n */\nfunction getState(state, props) {\n return Object.keys(state).reduce(function (prevState, key) {\n prevState[key] = isControlledProp(props, key) ? props[key] : state[key];\n return prevState;\n }, {});\n}\n\n/**\n * This determines whether a prop is a \"controlled prop\" meaning it is\n * state which is controlled by the outside of this component rather\n * than within this component.\n *\n * @param {Object} props The props that may contain controlled values.\n * @param {String} key the key to check\n * @return {Boolean} whether it is a controlled controlled prop\n */\nfunction isControlledProp(props, key) {\n return props[key] !== undefined;\n}\n\n/**\n * Normalizes the 'key' property of a KeyboardEvent in IE/Edge\n * @param {Object} event a keyboardEvent object\n * @return {String} keyboard key\n */\nfunction normalizeArrowKey(event) {\n var key = event.key,\n keyCode = event.keyCode;\n /* istanbul ignore next (ie) */\n if (keyCode >= 37 && keyCode <= 40 && key.indexOf('Arrow') !== 0) {\n return \"Arrow\" + key;\n }\n return key;\n}\n\n/**\n * Simple check if the value passed is object literal\n * @param {*} obj any things\n * @return {Boolean} whether it's object literal\n */\nfunction isPlainObject(obj) {\n return Object.prototype.toString.call(obj) === '[object Object]';\n}\n\n/**\n * Returns the new index in the list, in a circular way. If next value is out of bonds from the total,\n * it will wrap to either 0 or itemCount - 1.\n *\n * @param {number} moveAmount Number of positions to move. Negative to move backwards, positive forwards.\n * @param {number} baseIndex The initial position to move from.\n * @param {number} itemCount The total number of items.\n * @param {Function} getItemNodeFromIndex Used to check if item is disabled.\n * @param {boolean} circular Specify if navigation is circular. Default is true.\n * @returns {number} The new index after the move.\n */\nfunction getNextWrappingIndex(moveAmount, baseIndex, itemCount, getItemNodeFromIndex, circular) {\n if (circular === void 0) {\n circular = true;\n }\n if (itemCount === 0) {\n return -1;\n }\n var itemsLastIndex = itemCount - 1;\n if (typeof baseIndex !== 'number' || baseIndex < 0 || baseIndex >= itemCount) {\n baseIndex = moveAmount > 0 ? -1 : itemsLastIndex + 1;\n }\n var newIndex = baseIndex + moveAmount;\n if (newIndex < 0) {\n newIndex = circular ? itemsLastIndex : 0;\n } else if (newIndex > itemsLastIndex) {\n newIndex = circular ? 0 : itemsLastIndex;\n }\n var nonDisabledNewIndex = getNextNonDisabledIndex(moveAmount, newIndex, itemCount, getItemNodeFromIndex, circular);\n if (nonDisabledNewIndex === -1) {\n return baseIndex >= itemCount ? -1 : baseIndex;\n }\n return nonDisabledNewIndex;\n}\n\n/**\n * Returns the next index in the list of an item that is not disabled.\n *\n * @param {number} moveAmount Number of positions to move. Negative to move backwards, positive forwards.\n * @param {number} baseIndex The initial position to move from.\n * @param {number} itemCount The total number of items.\n * @param {Function} getItemNodeFromIndex Used to check if item is disabled.\n * @param {boolean} circular Specify if navigation is circular. Default is true.\n * @returns {number} The new index. Returns baseIndex if item is not disabled. Returns next non-disabled item otherwise. If no non-disabled found it will return -1.\n */\nfunction getNextNonDisabledIndex(moveAmount, baseIndex, itemCount, getItemNodeFromIndex, circular) {\n var currentElementNode = getItemNodeFromIndex(baseIndex);\n if (!currentElementNode || !currentElementNode.hasAttribute('disabled')) {\n return baseIndex;\n }\n if (moveAmount > 0) {\n for (var index = baseIndex + 1; index < itemCount; index++) {\n if (!getItemNodeFromIndex(index).hasAttribute('disabled')) {\n return index;\n }\n }\n } else {\n for (var _index = baseIndex - 1; _index >= 0; _index--) {\n if (!getItemNodeFromIndex(_index).hasAttribute('disabled')) {\n return _index;\n }\n }\n }\n if (circular) {\n return moveAmount > 0 ? getNextNonDisabledIndex(1, 0, itemCount, getItemNodeFromIndex, false) : getNextNonDisabledIndex(-1, itemCount - 1, itemCount, getItemNodeFromIndex, false);\n }\n return -1;\n}\n\n/**\n * Checks if event target is within the downshift elements.\n *\n * @param {EventTarget} target Target to check.\n * @param {HTMLElement[]} downshiftElements The elements that form downshift (list, toggle button etc).\n * @param {Window} environment The window context where downshift renders.\n * @param {boolean} checkActiveElement Whether to also check activeElement.\n *\n * @returns {boolean} Whether or not the target is within downshift elements.\n */\nfunction targetWithinDownshift(target, downshiftElements, environment, checkActiveElement) {\n if (checkActiveElement === void 0) {\n checkActiveElement = true;\n }\n return downshiftElements.some(function (contextNode) {\n return contextNode && (isOrContainsNode(contextNode, target, environment) || checkActiveElement && isOrContainsNode(contextNode, environment.document.activeElement, environment));\n });\n}\n\n// eslint-disable-next-line import/no-mutable-exports\nvar validateControlledUnchanged = noop;\n/* istanbul ignore next */\nif (process.env.NODE_ENV !== 'production') {\n validateControlledUnchanged = function validateControlledUnchanged(state, prevProps, nextProps) {\n var warningDescription = \"This prop should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled Downshift element for the lifetime of the component. More info: https://github.com/downshift-js/downshift#control-props\";\n Object.keys(state).forEach(function (propKey) {\n if (prevProps[propKey] !== undefined && nextProps[propKey] === undefined) {\n // eslint-disable-next-line no-console\n console.error(\"downshift: A component has changed the controlled prop \\\"\" + propKey + \"\\\" to be uncontrolled. \" + warningDescription);\n } else if (prevProps[propKey] === undefined && nextProps[propKey] !== undefined) {\n // eslint-disable-next-line no-console\n console.error(\"downshift: A component has changed the uncontrolled prop \\\"\" + propKey + \"\\\" to be controlled. \" + warningDescription);\n }\n });\n };\n}\n\nvar cleanupStatus = debounce(function (documentProp) {\n getStatusDiv(documentProp).textContent = '';\n}, 500);\n\n/**\n * @param {String} status the status message\n * @param {Object} documentProp document passed by the user.\n */\nfunction setStatus(status, documentProp) {\n var div = getStatusDiv(documentProp);\n if (!status) {\n return;\n }\n div.textContent = status;\n cleanupStatus(documentProp);\n}\n\n/**\n * Get the status node or create it if it does not already exist.\n * @param {Object} documentProp document passed by the user.\n * @return {HTMLElement} the status node.\n */\nfunction getStatusDiv(documentProp) {\n if (documentProp === void 0) {\n documentProp = document;\n }\n var statusDiv = documentProp.getElementById('a11y-status-message');\n if (statusDiv) {\n return statusDiv;\n }\n statusDiv = documentProp.createElement('div');\n statusDiv.setAttribute('id', 'a11y-status-message');\n statusDiv.setAttribute('role', 'status');\n statusDiv.setAttribute('aria-live', 'polite');\n statusDiv.setAttribute('aria-relevant', 'additions text');\n Object.assign(statusDiv.style, {\n border: '0',\n clip: 'rect(0 0 0 0)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: '0',\n position: 'absolute',\n width: '1px'\n });\n documentProp.body.appendChild(statusDiv);\n return statusDiv;\n}\n\nvar unknown = process.env.NODE_ENV !== \"production\" ? '__autocomplete_unknown__' : 0;\nvar mouseUp = process.env.NODE_ENV !== \"production\" ? '__autocomplete_mouseup__' : 1;\nvar itemMouseEnter = process.env.NODE_ENV !== \"production\" ? '__autocomplete_item_mouseenter__' : 2;\nvar keyDownArrowUp = process.env.NODE_ENV !== \"production\" ? '__autocomplete_keydown_arrow_up__' : 3;\nvar keyDownArrowDown = process.env.NODE_ENV !== \"production\" ? '__autocomplete_keydown_arrow_down__' : 4;\nvar keyDownEscape = process.env.NODE_ENV !== \"production\" ? '__autocomplete_keydown_escape__' : 5;\nvar keyDownEnter = process.env.NODE_ENV !== \"production\" ? '__autocomplete_keydown_enter__' : 6;\nvar keyDownHome = process.env.NODE_ENV !== \"production\" ? '__autocomplete_keydown_home__' : 7;\nvar keyDownEnd = process.env.NODE_ENV !== \"production\" ? '__autocomplete_keydown_end__' : 8;\nvar clickItem = process.env.NODE_ENV !== \"production\" ? '__autocomplete_click_item__' : 9;\nvar blurInput = process.env.NODE_ENV !== \"production\" ? '__autocomplete_blur_input__' : 10;\nvar changeInput = process.env.NODE_ENV !== \"production\" ? '__autocomplete_change_input__' : 11;\nvar keyDownSpaceButton = process.env.NODE_ENV !== \"production\" ? '__autocomplete_keydown_space_button__' : 12;\nvar clickButton = process.env.NODE_ENV !== \"production\" ? '__autocomplete_click_button__' : 13;\nvar blurButton = process.env.NODE_ENV !== \"production\" ? '__autocomplete_blur_button__' : 14;\nvar controlledPropUpdatedSelectedItem = process.env.NODE_ENV !== \"production\" ? '__autocomplete_controlled_prop_updated_selected_item__' : 15;\nvar touchEnd = process.env.NODE_ENV !== \"production\" ? '__autocomplete_touchend__' : 16;\n\nvar stateChangeTypes$3 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n unknown: unknown,\n mouseUp: mouseUp,\n itemMouseEnter: itemMouseEnter,\n keyDownArrowUp: keyDownArrowUp,\n keyDownArrowDown: keyDownArrowDown,\n keyDownEscape: keyDownEscape,\n keyDownEnter: keyDownEnter,\n keyDownHome: keyDownHome,\n keyDownEnd: keyDownEnd,\n clickItem: clickItem,\n blurInput: blurInput,\n changeInput: changeInput,\n keyDownSpaceButton: keyDownSpaceButton,\n clickButton: clickButton,\n blurButton: blurButton,\n controlledPropUpdatedSelectedItem: controlledPropUpdatedSelectedItem,\n touchEnd: touchEnd\n});\n\nvar _excluded$4 = [\"refKey\", \"ref\"],\n _excluded2$3 = [\"onClick\", \"onPress\", \"onKeyDown\", \"onKeyUp\", \"onBlur\"],\n _excluded3$2 = [\"onKeyDown\", \"onBlur\", \"onChange\", \"onInput\", \"onChangeText\"],\n _excluded4$1 = [\"refKey\", \"ref\"],\n _excluded5 = [\"onMouseMove\", \"onMouseDown\", \"onClick\", \"onPress\", \"index\", \"item\"];\nvar Downshift = /*#__PURE__*/function () {\n var Downshift = /*#__PURE__*/function (_Component) {\n _inheritsLoose(Downshift, _Component);\n function Downshift(_props) {\n var _this;\n _this = _Component.call(this, _props) || this;\n // fancy destructuring + defaults + aliases\n // this basically says each value of state should either be set to\n // the initial value or the default value if the initial value is not provided\n _this.id = _this.props.id || \"downshift-\" + generateId();\n _this.menuId = _this.props.menuId || _this.id + \"-menu\";\n _this.labelId = _this.props.labelId || _this.id + \"-label\";\n _this.inputId = _this.props.inputId || _this.id + \"-input\";\n _this.getItemId = _this.props.getItemId || function (index) {\n return _this.id + \"-item-\" + index;\n };\n _this.input = null;\n _this.items = [];\n // itemCount can be changed asynchronously\n // from within downshift (so it can't come from a prop)\n // this is why we store it as an instance and use\n // getItemCount rather than just use items.length\n // (to support windowing + async)\n _this.itemCount = null;\n _this.previousResultCount = 0;\n _this.timeoutIds = [];\n /**\n * @param {Function} fn the function to call after the time\n * @param {Number} time the time to wait\n */\n _this.internalSetTimeout = function (fn, time) {\n var id = setTimeout(function () {\n _this.timeoutIds = _this.timeoutIds.filter(function (i) {\n return i !== id;\n });\n fn();\n }, time);\n _this.timeoutIds.push(id);\n };\n _this.setItemCount = function (count) {\n _this.itemCount = count;\n };\n _this.unsetItemCount = function () {\n _this.itemCount = null;\n };\n _this.setHighlightedIndex = function (highlightedIndex, otherStateToSet) {\n if (highlightedIndex === void 0) {\n highlightedIndex = _this.props.defaultHighlightedIndex;\n }\n if (otherStateToSet === void 0) {\n otherStateToSet = {};\n }\n otherStateToSet = pickState(otherStateToSet);\n _this.internalSetState(_extends({\n highlightedIndex: highlightedIndex\n }, otherStateToSet));\n };\n _this.clearSelection = function (cb) {\n _this.internalSetState({\n selectedItem: null,\n inputValue: '',\n highlightedIndex: _this.props.defaultHighlightedIndex,\n isOpen: _this.props.defaultIsOpen\n }, cb);\n };\n _this.selectItem = function (item, otherStateToSet, cb) {\n otherStateToSet = pickState(otherStateToSet);\n _this.internalSetState(_extends({\n isOpen: _this.props.defaultIsOpen,\n highlightedIndex: _this.props.defaultHighlightedIndex,\n selectedItem: item,\n inputValue: _this.props.itemToString(item)\n }, otherStateToSet), cb);\n };\n _this.selectItemAtIndex = function (itemIndex, otherStateToSet, cb) {\n var item = _this.items[itemIndex];\n if (item == null) {\n return;\n }\n _this.selectItem(item, otherStateToSet, cb);\n };\n _this.selectHighlightedItem = function (otherStateToSet, cb) {\n return _this.selectItemAtIndex(_this.getState().highlightedIndex, otherStateToSet, cb);\n };\n // any piece of our state can live in two places:\n // 1. Uncontrolled: it's internal (this.state)\n // We will call this.setState to update that state\n // 2. Controlled: it's external (this.props)\n // We will call this.props.onStateChange to update that state\n //\n // In addition, we'll call this.props.onChange if the\n // selectedItem is changed.\n _this.internalSetState = function (stateToSet, cb) {\n var isItemSelected, onChangeArg;\n var onStateChangeArg = {};\n var isStateToSetFunction = typeof stateToSet === 'function';\n\n // we want to call `onInputValueChange` before the `setState` call\n // so someone controlling the `inputValue` state gets notified of\n // the input change as soon as possible. This avoids issues with\n // preserving the cursor position.\n // See https://github.com/downshift-js/downshift/issues/217 for more info.\n if (!isStateToSetFunction && stateToSet.hasOwnProperty('inputValue')) {\n _this.props.onInputValueChange(stateToSet.inputValue, _extends({}, _this.getStateAndHelpers(), stateToSet));\n }\n return _this.setState(function (state) {\n state = _this.getState(state);\n var newStateToSet = isStateToSetFunction ? stateToSet(state) : stateToSet;\n\n // Your own function that could modify the state that will be set.\n newStateToSet = _this.props.stateReducer(state, newStateToSet);\n\n // checks if an item is selected, regardless of if it's different from\n // what was selected before\n // used to determine if onSelect and onChange callbacks should be called\n isItemSelected = newStateToSet.hasOwnProperty('selectedItem');\n // this keeps track of the object we want to call with setState\n var nextState = {};\n // we need to call on change if the outside world is controlling any of our state\n // and we're trying to update that state. OR if the selection has changed and we're\n // trying to update the selection\n if (isItemSelected && newStateToSet.selectedItem !== state.selectedItem) {\n onChangeArg = newStateToSet.selectedItem;\n }\n newStateToSet.type = newStateToSet.type || unknown;\n Object.keys(newStateToSet).forEach(function (key) {\n // onStateChangeArg should only have the state that is\n // actually changing\n if (state[key] !== newStateToSet[key]) {\n onStateChangeArg[key] = newStateToSet[key];\n }\n // the type is useful for the onStateChangeArg\n // but we don't actually want to set it in internal state.\n // this is an undocumented feature for now... Not all internalSetState\n // calls support it and I'm not certain we want them to yet.\n // But it enables users controlling the isOpen state to know when\n // the isOpen state changes due to mouseup events which is quite handy.\n if (key === 'type') {\n return;\n }\n newStateToSet[key];\n // if it's coming from props, then we don't care to set it internally\n if (!isControlledProp(_this.props, key)) {\n nextState[key] = newStateToSet[key];\n }\n });\n\n // if stateToSet is a function, then we weren't able to call onInputValueChange\n // earlier, so we'll call it now that we know what the inputValue state will be.\n if (isStateToSetFunction && newStateToSet.hasOwnProperty('inputValue')) {\n _this.props.onInputValueChange(newStateToSet.inputValue, _extends({}, _this.getStateAndHelpers(), newStateToSet));\n }\n return nextState;\n }, function () {\n // call the provided callback if it's a function\n cbToCb(cb)();\n\n // only call the onStateChange and onChange callbacks if\n // we have relevant information to pass them.\n var hasMoreStateThanType = Object.keys(onStateChangeArg).length > 1;\n if (hasMoreStateThanType) {\n _this.props.onStateChange(onStateChangeArg, _this.getStateAndHelpers());\n }\n if (isItemSelected) {\n _this.props.onSelect(stateToSet.selectedItem, _this.getStateAndHelpers());\n }\n if (onChangeArg !== undefined) {\n _this.props.onChange(onChangeArg, _this.getStateAndHelpers());\n }\n // this is currently undocumented and therefore subject to change\n // We'll try to not break it, but just be warned.\n _this.props.onUserAction(onStateChangeArg, _this.getStateAndHelpers());\n });\n };\n //////////////////////////// ROOT\n _this.rootRef = function (node) {\n return _this._rootNode = node;\n };\n _this.getRootProps = function (_temp, _temp2) {\n var _extends2;\n var _ref = _temp === void 0 ? {} : _temp,\n _ref$refKey = _ref.refKey,\n refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey,\n ref = _ref.ref,\n rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);\n var _ref2 = _temp2 === void 0 ? {} : _temp2,\n _ref2$suppressRefErro = _ref2.suppressRefError,\n suppressRefError = _ref2$suppressRefErro === void 0 ? false : _ref2$suppressRefErro;\n // this is used in the render to know whether the user has called getRootProps.\n // It uses that to know whether to apply the props automatically\n _this.getRootProps.called = true;\n _this.getRootProps.refKey = refKey;\n _this.getRootProps.suppressRefError = suppressRefError;\n var _this$getState = _this.getState(),\n isOpen = _this$getState.isOpen;\n return _extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, _this.rootRef), _extends2.role = 'combobox', _extends2['aria-expanded'] = isOpen, _extends2['aria-haspopup'] = 'listbox', _extends2['aria-owns'] = isOpen ? _this.menuId : null, _extends2['aria-labelledby'] = _this.labelId, _extends2), rest);\n };\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ROOT\n _this.keyDownHandlers = {\n ArrowDown: function ArrowDown(event) {\n var _this2 = this;\n event.preventDefault();\n if (this.getState().isOpen) {\n var amount = event.shiftKey ? 5 : 1;\n this.moveHighlightedIndex(amount, {\n type: keyDownArrowDown\n });\n } else {\n this.internalSetState({\n isOpen: true,\n type: keyDownArrowDown\n }, function () {\n var itemCount = _this2.getItemCount();\n if (itemCount > 0) {\n var _this2$getState = _this2.getState(),\n highlightedIndex = _this2$getState.highlightedIndex;\n var nextHighlightedIndex = getNextWrappingIndex(1, highlightedIndex, itemCount, function (index) {\n return _this2.getItemNodeFromIndex(index);\n });\n _this2.setHighlightedIndex(nextHighlightedIndex, {\n type: keyDownArrowDown\n });\n }\n });\n }\n },\n ArrowUp: function ArrowUp(event) {\n var _this3 = this;\n event.preventDefault();\n if (this.getState().isOpen) {\n var amount = event.shiftKey ? -5 : -1;\n this.moveHighlightedIndex(amount, {\n type: keyDownArrowUp\n });\n } else {\n this.internalSetState({\n isOpen: true,\n type: keyDownArrowUp\n }, function () {\n var itemCount = _this3.getItemCount();\n if (itemCount > 0) {\n var _this3$getState = _this3.getState(),\n highlightedIndex = _this3$getState.highlightedIndex;\n var nextHighlightedIndex = getNextWrappingIndex(-1, highlightedIndex, itemCount, function (index) {\n return _this3.getItemNodeFromIndex(index);\n });\n _this3.setHighlightedIndex(nextHighlightedIndex, {\n type: keyDownArrowUp\n });\n }\n });\n }\n },\n Enter: function Enter(event) {\n if (event.which === 229) {\n return;\n }\n var _this$getState2 = this.getState(),\n isOpen = _this$getState2.isOpen,\n highlightedIndex = _this$getState2.highlightedIndex;\n if (isOpen && highlightedIndex != null) {\n event.preventDefault();\n var item = this.items[highlightedIndex];\n var itemNode = this.getItemNodeFromIndex(highlightedIndex);\n if (item == null || itemNode && itemNode.hasAttribute('disabled')) {\n return;\n }\n this.selectHighlightedItem({\n type: keyDownEnter\n });\n }\n },\n Escape: function Escape(event) {\n event.preventDefault();\n this.reset(_extends({\n type: keyDownEscape\n }, !this.state.isOpen && {\n selectedItem: null,\n inputValue: ''\n }));\n }\n };\n //////////////////////////// BUTTON\n _this.buttonKeyDownHandlers = _extends({}, _this.keyDownHandlers, {\n ' ': function _(event) {\n event.preventDefault();\n this.toggleMenu({\n type: keyDownSpaceButton\n });\n }\n });\n _this.inputKeyDownHandlers = _extends({}, _this.keyDownHandlers, {\n Home: function Home(event) {\n var _this4 = this;\n var _this$getState3 = this.getState(),\n isOpen = _this$getState3.isOpen;\n if (!isOpen) {\n return;\n }\n event.preventDefault();\n var itemCount = this.getItemCount();\n if (itemCount <= 0 || !isOpen) {\n return;\n }\n\n // get next non-disabled starting downwards from 0 if that's disabled.\n var newHighlightedIndex = getNextNonDisabledIndex(1, 0, itemCount, function (index) {\n return _this4.getItemNodeFromIndex(index);\n }, false);\n this.setHighlightedIndex(newHighlightedIndex, {\n type: keyDownHome\n });\n },\n End: function End(event) {\n var _this5 = this;\n var _this$getState4 = this.getState(),\n isOpen = _this$getState4.isOpen;\n if (!isOpen) {\n return;\n }\n event.preventDefault();\n var itemCount = this.getItemCount();\n if (itemCount <= 0 || !isOpen) {\n return;\n }\n\n // get next non-disabled starting upwards from last index if that's disabled.\n var newHighlightedIndex = getNextNonDisabledIndex(-1, itemCount - 1, itemCount, function (index) {\n return _this5.getItemNodeFromIndex(index);\n }, false);\n this.setHighlightedIndex(newHighlightedIndex, {\n type: keyDownEnd\n });\n }\n });\n _this.getToggleButtonProps = function (_temp3) {\n var _ref3 = _temp3 === void 0 ? {} : _temp3,\n onClick = _ref3.onClick;\n _ref3.onPress;\n var onKeyDown = _ref3.onKeyDown,\n onKeyUp = _ref3.onKeyUp,\n onBlur = _ref3.onBlur,\n rest = _objectWithoutPropertiesLoose(_ref3, _excluded2$3);\n var _this$getState5 = _this.getState(),\n isOpen = _this$getState5.isOpen;\n var enabledEventHandlers = {\n onClick: callAllEventHandlers(onClick, _this.buttonHandleClick),\n onKeyDown: callAllEventHandlers(onKeyDown, _this.buttonHandleKeyDown),\n onKeyUp: callAllEventHandlers(onKeyUp, _this.buttonHandleKeyUp),\n onBlur: callAllEventHandlers(onBlur, _this.buttonHandleBlur)\n };\n var eventHandlers = rest.disabled ? {} : enabledEventHandlers;\n return _extends({\n type: 'button',\n role: 'button',\n 'aria-label': isOpen ? 'close menu' : 'open menu',\n 'aria-haspopup': true,\n 'data-toggle': true\n }, eventHandlers, rest);\n };\n _this.buttonHandleKeyUp = function (event) {\n // Prevent click event from emitting in Firefox\n event.preventDefault();\n };\n _this.buttonHandleKeyDown = function (event) {\n var key = normalizeArrowKey(event);\n if (_this.buttonKeyDownHandlers[key]) {\n _this.buttonKeyDownHandlers[key].call(_assertThisInitialized(_this), event);\n }\n };\n _this.buttonHandleClick = function (event) {\n event.preventDefault();\n // handle odd case for Safari and Firefox which\n // don't give the button the focus properly.\n /* istanbul ignore if (can't reasonably test this) */\n if (_this.props.environment.document.activeElement === _this.props.environment.document.body) {\n event.target.focus();\n }\n // to simplify testing components that use downshift, we'll not wrap this in a setTimeout\n // if the NODE_ENV is test. With the proper build system, this should be dead code eliminated\n // when building for production and should therefore have no impact on production code.\n if (process.env.NODE_ENV === 'test') {\n _this.toggleMenu({\n type: clickButton\n });\n } else {\n // Ensure that toggle of menu occurs after the potential blur event in iOS\n _this.internalSetTimeout(function () {\n return _this.toggleMenu({\n type: clickButton\n });\n });\n }\n };\n _this.buttonHandleBlur = function (event) {\n var blurTarget = event.target; // Save blur target for comparison with activeElement later\n // Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not body element\n _this.internalSetTimeout(function () {\n if (!_this.isMouseDown && (_this.props.environment.document.activeElement == null || _this.props.environment.document.activeElement.id !== _this.inputId) && _this.props.environment.document.activeElement !== blurTarget // Do nothing if we refocus the same element again (to solve issue in Safari on iOS)\n ) {\n _this.reset({\n type: blurButton\n });\n }\n });\n };\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ BUTTON\n /////////////////////////////// LABEL\n _this.getLabelProps = function (props) {\n return _extends({\n htmlFor: _this.inputId,\n id: _this.labelId\n }, props);\n };\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ LABEL\n /////////////////////////////// INPUT\n _this.getInputProps = function (_temp4) {\n var _ref4 = _temp4 === void 0 ? {} : _temp4,\n onKeyDown = _ref4.onKeyDown,\n onBlur = _ref4.onBlur,\n onChange = _ref4.onChange,\n onInput = _ref4.onInput;\n _ref4.onChangeText;\n var rest = _objectWithoutPropertiesLoose(_ref4, _excluded3$2);\n var onChangeKey;\n var eventHandlers = {};\n\n /* istanbul ignore next (preact) */\n {\n onChangeKey = 'onChange';\n }\n var _this$getState6 = _this.getState(),\n inputValue = _this$getState6.inputValue,\n isOpen = _this$getState6.isOpen,\n highlightedIndex = _this$getState6.highlightedIndex;\n if (!rest.disabled) {\n var _eventHandlers;\n eventHandlers = (_eventHandlers = {}, _eventHandlers[onChangeKey] = callAllEventHandlers(onChange, onInput, _this.inputHandleChange), _eventHandlers.onKeyDown = callAllEventHandlers(onKeyDown, _this.inputHandleKeyDown), _eventHandlers.onBlur = callAllEventHandlers(onBlur, _this.inputHandleBlur), _eventHandlers);\n }\n return _extends({\n 'aria-autocomplete': 'list',\n 'aria-activedescendant': isOpen && typeof highlightedIndex === 'number' && highlightedIndex >= 0 ? _this.getItemId(highlightedIndex) : null,\n 'aria-controls': isOpen ? _this.menuId : null,\n 'aria-labelledby': rest && rest['aria-label'] ? undefined : _this.labelId,\n // https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion\n // revert back since autocomplete=\"nope\" is ignored on latest Chrome and Opera\n autoComplete: 'off',\n value: inputValue,\n id: _this.inputId\n }, eventHandlers, rest);\n };\n _this.inputHandleKeyDown = function (event) {\n var key = normalizeArrowKey(event);\n if (key && _this.inputKeyDownHandlers[key]) {\n _this.inputKeyDownHandlers[key].call(_assertThisInitialized(_this), event);\n }\n };\n _this.inputHandleChange = function (event) {\n _this.internalSetState({\n type: changeInput,\n isOpen: true,\n inputValue: event.target.value,\n highlightedIndex: _this.props.defaultHighlightedIndex\n });\n };\n _this.inputHandleBlur = function () {\n // Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not the body element\n _this.internalSetTimeout(function () {\n var downshiftButtonIsActive = _this.props.environment.document && !!_this.props.environment.document.activeElement && !!_this.props.environment.document.activeElement.dataset && _this.props.environment.document.activeElement.dataset.toggle && _this._rootNode && _this._rootNode.contains(_this.props.environment.document.activeElement);\n if (!_this.isMouseDown && !downshiftButtonIsActive) {\n _this.reset({\n type: blurInput\n });\n }\n });\n };\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ INPUT\n /////////////////////////////// MENU\n _this.menuRef = function (node) {\n _this._menuNode = node;\n };\n _this.getMenuProps = function (_temp5, _temp6) {\n var _extends3;\n var _ref5 = _temp5 === void 0 ? {} : _temp5,\n _ref5$refKey = _ref5.refKey,\n refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,\n ref = _ref5.ref,\n props = _objectWithoutPropertiesLoose(_ref5, _excluded4$1);\n var _ref6 = _temp6 === void 0 ? {} : _temp6,\n _ref6$suppressRefErro = _ref6.suppressRefError,\n suppressRefError = _ref6$suppressRefErro === void 0 ? false : _ref6$suppressRefErro;\n _this.getMenuProps.called = true;\n _this.getMenuProps.refKey = refKey;\n _this.getMenuProps.suppressRefError = suppressRefError;\n return _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, _this.menuRef), _extends3.role = 'listbox', _extends3['aria-labelledby'] = props && props['aria-label'] ? null : _this.labelId, _extends3.id = _this.menuId, _extends3), props);\n };\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ MENU\n /////////////////////////////// ITEM\n _this.getItemProps = function (_temp7) {\n var _enabledEventHandlers;\n var _ref7 = _temp7 === void 0 ? {} : _temp7,\n onMouseMove = _ref7.onMouseMove,\n onMouseDown = _ref7.onMouseDown,\n onClick = _ref7.onClick;\n _ref7.onPress;\n var index = _ref7.index,\n _ref7$item = _ref7.item,\n item = _ref7$item === void 0 ? process.env.NODE_ENV === 'production' ? /* istanbul ignore next */undefined : requiredProp('getItemProps', 'item') : _ref7$item,\n rest = _objectWithoutPropertiesLoose(_ref7, _excluded5);\n if (index === undefined) {\n _this.items.push(item);\n index = _this.items.indexOf(item);\n } else {\n _this.items[index] = item;\n }\n var onSelectKey = 'onClick';\n var customClickHandler = onClick;\n var enabledEventHandlers = (_enabledEventHandlers = {\n // onMouseMove is used over onMouseEnter here. onMouseMove\n // is only triggered on actual mouse movement while onMouseEnter\n // can fire on DOM changes, interrupting keyboard navigation\n onMouseMove: callAllEventHandlers(onMouseMove, function () {\n if (index === _this.getState().highlightedIndex) {\n return;\n }\n _this.setHighlightedIndex(index, {\n type: itemMouseEnter\n });\n\n // We never want to manually scroll when changing state based\n // on `onMouseMove` because we will be moving the element out\n // from under the user which is currently scrolling/moving the\n // cursor\n _this.avoidScrolling = true;\n _this.internalSetTimeout(function () {\n return _this.avoidScrolling = false;\n }, 250);\n }),\n onMouseDown: callAllEventHandlers(onMouseDown, function (event) {\n // This prevents the activeElement from being changed\n // to the item so it can remain with the current activeElement\n // which is a more common use case.\n event.preventDefault();\n })\n }, _enabledEventHandlers[onSelectKey] = callAllEventHandlers(customClickHandler, function () {\n _this.selectItemAtIndex(index, {\n type: clickItem\n });\n }), _enabledEventHandlers);\n\n // Passing down the onMouseDown handler to prevent redirect\n // of the activeElement if clicking on disabled items\n var eventHandlers = rest.disabled ? {\n onMouseDown: enabledEventHandlers.onMouseDown\n } : enabledEventHandlers;\n return _extends({\n id: _this.getItemId(index),\n role: 'option',\n 'aria-selected': _this.getState().highlightedIndex === index\n }, eventHandlers, rest);\n };\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ITEM\n _this.clearItems = function () {\n _this.items = [];\n };\n _this.reset = function (otherStateToSet, cb) {\n if (otherStateToSet === void 0) {\n otherStateToSet = {};\n }\n otherStateToSet = pickState(otherStateToSet);\n _this.internalSetState(function (_ref8) {\n var selectedItem = _ref8.selectedItem;\n return _extends({\n isOpen: _this.props.defaultIsOpen,\n highlightedIndex: _this.props.defaultHighlightedIndex,\n inputValue: _this.props.itemToString(selectedItem)\n }, otherStateToSet);\n }, cb);\n };\n _this.toggleMenu = function (otherStateToSet, cb) {\n if (otherStateToSet === void 0) {\n otherStateToSet = {};\n }\n otherStateToSet = pickState(otherStateToSet);\n _this.internalSetState(function (_ref9) {\n var isOpen = _ref9.isOpen;\n return _extends({\n isOpen: !isOpen\n }, isOpen && {\n highlightedIndex: _this.props.defaultHighlightedIndex\n }, otherStateToSet);\n }, function () {\n var _this$getState7 = _this.getState(),\n isOpen = _this$getState7.isOpen,\n highlightedIndex = _this$getState7.highlightedIndex;\n if (isOpen) {\n if (_this.getItemCount() > 0 && typeof highlightedIndex === 'number') {\n _this.setHighlightedIndex(highlightedIndex, otherStateToSet);\n }\n }\n cbToCb(cb)();\n });\n };\n _this.openMenu = function (cb) {\n _this.internalSetState({\n isOpen: true\n }, cb);\n };\n _this.closeMenu = function (cb) {\n _this.internalSetState({\n isOpen: false\n }, cb);\n };\n _this.updateStatus = debounce(function () {\n var state = _this.getState();\n var item = _this.items[state.highlightedIndex];\n var resultCount = _this.getItemCount();\n var status = _this.props.getA11yStatusMessage(_extends({\n itemToString: _this.props.itemToString,\n previousResultCount: _this.previousResultCount,\n resultCount: resultCount,\n highlightedItem: item\n }, state));\n _this.previousResultCount = resultCount;\n setStatus(status, _this.props.environment.document);\n }, 200);\n var _this$props = _this.props,\n defaultHighlightedIndex = _this$props.defaultHighlightedIndex,\n _this$props$initialHi = _this$props.initialHighlightedIndex,\n _highlightedIndex = _this$props$initialHi === void 0 ? defaultHighlightedIndex : _this$props$initialHi,\n defaultIsOpen = _this$props.defaultIsOpen,\n _this$props$initialIs = _this$props.initialIsOpen,\n _isOpen = _this$props$initialIs === void 0 ? defaultIsOpen : _this$props$initialIs,\n _this$props$initialIn = _this$props.initialInputValue,\n _inputValue = _this$props$initialIn === void 0 ? '' : _this$props$initialIn,\n _this$props$initialSe = _this$props.initialSelectedItem,\n _selectedItem = _this$props$initialSe === void 0 ? null : _this$props$initialSe;\n var _state = _this.getState({\n highlightedIndex: _highlightedIndex,\n isOpen: _isOpen,\n inputValue: _inputValue,\n selectedItem: _selectedItem\n });\n if (_state.selectedItem != null && _this.props.initialInputValue === undefined) {\n _state.inputValue = _this.props.itemToString(_state.selectedItem);\n }\n _this.state = _state;\n return _this;\n }\n var _proto = Downshift.prototype;\n /**\n * Clear all running timeouts\n */\n _proto.internalClearTimeouts = function internalClearTimeouts() {\n this.timeoutIds.forEach(function (id) {\n clearTimeout(id);\n });\n this.timeoutIds = [];\n }\n\n /**\n * Gets the state based on internal state or props\n * If a state value is passed via props, then that\n * is the value given, otherwise it's retrieved from\n * stateToMerge\n *\n * @param {Object} stateToMerge defaults to this.state\n * @return {Object} the state\n */;\n _proto.getState = function getState$1(stateToMerge) {\n if (stateToMerge === void 0) {\n stateToMerge = this.state;\n }\n return getState(stateToMerge, this.props);\n };\n _proto.getItemCount = function getItemCount() {\n // things read better this way. They're in priority order:\n // 1. `this.itemCount`\n // 2. `this.props.itemCount`\n // 3. `this.items.length`\n var itemCount = this.items.length;\n if (this.itemCount != null) {\n itemCount = this.itemCount;\n } else if (this.props.itemCount !== undefined) {\n itemCount = this.props.itemCount;\n }\n return itemCount;\n };\n _proto.getItemNodeFromIndex = function getItemNodeFromIndex(index) {\n return this.props.environment.document.getElementById(this.getItemId(index));\n };\n _proto.scrollHighlightedItemIntoView = function scrollHighlightedItemIntoView() {\n /* istanbul ignore else (react-native) */\n {\n var node = this.getItemNodeFromIndex(this.getState().highlightedIndex);\n this.props.scrollIntoView(node, this._menuNode);\n }\n };\n _proto.moveHighlightedIndex = function moveHighlightedIndex(amount, otherStateToSet) {\n var _this6 = this;\n var itemCount = this.getItemCount();\n var _this$getState8 = this.getState(),\n highlightedIndex = _this$getState8.highlightedIndex;\n if (itemCount > 0) {\n var nextHighlightedIndex = getNextWrappingIndex(amount, highlightedIndex, itemCount, function (index) {\n return _this6.getItemNodeFromIndex(index);\n });\n this.setHighlightedIndex(nextHighlightedIndex, otherStateToSet);\n }\n };\n _proto.getStateAndHelpers = function getStateAndHelpers() {\n var _this$getState9 = this.getState(),\n highlightedIndex = _this$getState9.highlightedIndex,\n inputValue = _this$getState9.inputValue,\n selectedItem = _this$getState9.selectedItem,\n isOpen = _this$getState9.isOpen;\n var itemToString = this.props.itemToString;\n var id = this.id;\n var getRootProps = this.getRootProps,\n getToggleButtonProps = this.getToggleButtonProps,\n getLabelProps = this.getLabelProps,\n getMenuProps = this.getMenuProps,\n getInputProps = this.getInputProps,\n getItemProps = this.getItemProps,\n openMenu = this.openMenu,\n closeMenu = this.closeMenu,\n toggleMenu = this.toggleMenu,\n selectItem = this.selectItem,\n selectItemAtIndex = this.selectItemAtIndex,\n selectHighlightedItem = this.selectHighlightedItem,\n setHighlightedIndex = this.setHighlightedIndex,\n clearSelection = this.clearSelection,\n clearItems = this.clearItems,\n reset = this.reset,\n setItemCount = this.setItemCount,\n unsetItemCount = this.unsetItemCount,\n setState = this.internalSetState;\n return {\n // prop getters\n getRootProps: getRootProps,\n getToggleButtonProps: getToggleButtonProps,\n getLabelProps: getLabelProps,\n getMenuProps: getMenuProps,\n getInputProps: getInputProps,\n getItemProps: getItemProps,\n // actions\n reset: reset,\n openMenu: openMenu,\n closeMenu: closeMenu,\n toggleMenu: toggleMenu,\n selectItem: selectItem,\n selectItemAtIndex: selectItemAtIndex,\n selectHighlightedItem: selectHighlightedItem,\n setHighlightedIndex: setHighlightedIndex,\n clearSelection: clearSelection,\n clearItems: clearItems,\n setItemCount: setItemCount,\n unsetItemCount: unsetItemCount,\n setState: setState,\n // props\n itemToString: itemToString,\n // derived\n id: id,\n // state\n highlightedIndex: highlightedIndex,\n inputValue: inputValue,\n isOpen: isOpen,\n selectedItem: selectedItem\n };\n };\n _proto.componentDidMount = function componentDidMount() {\n var _this7 = this;\n /* istanbul ignore if (react-native) */\n if (process.env.NODE_ENV !== 'production' && !false && this.getMenuProps.called && !this.getMenuProps.suppressRefError) {\n validateGetMenuPropsCalledCorrectly(this._menuNode, this.getMenuProps);\n }\n\n /* istanbul ignore if (react-native) */\n {\n // this.isMouseDown helps us track whether the mouse is currently held down.\n // This is useful when the user clicks on an item in the list, but holds the mouse\n // down long enough for the list to disappear (because the blur event fires on the input)\n // this.isMouseDown is used in the blur handler on the input to determine whether the blur event should\n // trigger hiding the menu.\n var onMouseDown = function onMouseDown() {\n _this7.isMouseDown = true;\n };\n var onMouseUp = function onMouseUp(event) {\n _this7.isMouseDown = false;\n // if the target element or the activeElement is within a downshift node\n // then we don't want to reset downshift\n var contextWithinDownshift = targetWithinDownshift(event.target, [_this7._rootNode, _this7._menuNode], _this7.props.environment);\n if (!contextWithinDownshift && _this7.getState().isOpen) {\n _this7.reset({\n type: mouseUp\n }, function () {\n return _this7.props.onOuterClick(_this7.getStateAndHelpers());\n });\n }\n };\n // Touching an element in iOS gives focus and hover states, but touching out of\n // the element will remove hover, and persist the focus state, resulting in the\n // blur event not being triggered.\n // this.isTouchMove helps us track whether the user is tapping or swiping on a touch screen.\n // If the user taps outside of Downshift, the component should be reset,\n // but not if the user is swiping\n var onTouchStart = function onTouchStart() {\n _this7.isTouchMove = false;\n };\n var onTouchMove = function onTouchMove() {\n _this7.isTouchMove = true;\n };\n var onTouchEnd = function onTouchEnd(event) {\n var contextWithinDownshift = targetWithinDownshift(event.target, [_this7._rootNode, _this7._menuNode], _this7.props.environment, false);\n if (!_this7.isTouchMove && !contextWithinDownshift && _this7.getState().isOpen) {\n _this7.reset({\n type: touchEnd\n }, function () {\n return _this7.props.onOuterClick(_this7.getStateAndHelpers());\n });\n }\n };\n var environment = this.props.environment;\n environment.addEventListener('mousedown', onMouseDown);\n environment.addEventListener('mouseup', onMouseUp);\n environment.addEventListener('touchstart', onTouchStart);\n environment.addEventListener('touchmove', onTouchMove);\n environment.addEventListener('touchend', onTouchEnd);\n this.cleanup = function () {\n _this7.internalClearTimeouts();\n _this7.updateStatus.cancel();\n environment.removeEventListener('mousedown', onMouseDown);\n environment.removeEventListener('mouseup', onMouseUp);\n environment.removeEventListener('touchstart', onTouchStart);\n environment.removeEventListener('touchmove', onTouchMove);\n environment.removeEventListener('touchend', onTouchEnd);\n };\n }\n };\n _proto.shouldScroll = function shouldScroll(prevState, prevProps) {\n var _ref10 = this.props.highlightedIndex === undefined ? this.getState() : this.props,\n currentHighlightedIndex = _ref10.highlightedIndex;\n var _ref11 = prevProps.highlightedIndex === undefined ? prevState : prevProps,\n prevHighlightedIndex = _ref11.highlightedIndex;\n var scrollWhenOpen = currentHighlightedIndex && this.getState().isOpen && !prevState.isOpen;\n var scrollWhenNavigating = currentHighlightedIndex !== prevHighlightedIndex;\n return scrollWhenOpen || scrollWhenNavigating;\n };\n _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {\n if (process.env.NODE_ENV !== 'production') {\n validateControlledUnchanged(this.state, prevProps, this.props);\n /* istanbul ignore if (react-native) */\n if (this.getMenuProps.called && !this.getMenuProps.suppressRefError) {\n validateGetMenuPropsCalledCorrectly(this._menuNode, this.getMenuProps);\n }\n }\n if (isControlledProp(this.props, 'selectedItem') && this.props.selectedItemChanged(prevProps.selectedItem, this.props.selectedItem)) {\n this.internalSetState({\n type: controlledPropUpdatedSelectedItem,\n inputValue: this.props.itemToString(this.props.selectedItem)\n });\n }\n if (!this.avoidScrolling && this.shouldScroll(prevState, prevProps)) {\n this.scrollHighlightedItemIntoView();\n }\n\n /* istanbul ignore else (react-native) */\n {\n this.updateStatus();\n }\n };\n _proto.componentWillUnmount = function componentWillUnmount() {\n this.cleanup(); // avoids memory leak\n };\n _proto.render = function render() {\n var children = unwrapArray(this.props.children, noop);\n // because the items are rerendered every time we call the children\n // we clear this out each render and it will be populated again as\n // getItemProps is called.\n this.clearItems();\n // we reset this so we know whether the user calls getRootProps during\n // this render. If they do then we don't need to do anything,\n // if they don't then we need to clone the element they return and\n // apply the props for them.\n this.getRootProps.called = false;\n this.getRootProps.refKey = undefined;\n this.getRootProps.suppressRefError = undefined;\n // we do something similar for getMenuProps\n this.getMenuProps.called = false;\n this.getMenuProps.refKey = undefined;\n this.getMenuProps.suppressRefError = undefined;\n // we do something similar for getLabelProps\n this.getLabelProps.called = false;\n // and something similar for getInputProps\n this.getInputProps.called = false;\n var element = unwrapArray(children(this.getStateAndHelpers()));\n if (!element) {\n return null;\n }\n if (this.getRootProps.called || this.props.suppressRefError) {\n if (process.env.NODE_ENV !== 'production' && !this.getRootProps.suppressRefError && !this.props.suppressRefError) {\n validateGetRootPropsCalledCorrectly(element, this.getRootProps);\n }\n return element;\n } else if (isDOMElement(element)) {\n // they didn't apply the root props, but we can clone\n // this and apply the props ourselves\n return /*#__PURE__*/cloneElement(element, this.getRootProps(getElementProps(element)));\n }\n\n /* istanbul ignore else */\n if (process.env.NODE_ENV !== 'production') {\n // they didn't apply the root props, but they need to\n // otherwise we can't query around the autocomplete\n\n throw new Error('downshift: If you return a non-DOM element, you must apply the getRootProps function');\n }\n\n /* istanbul ignore next */\n return undefined;\n };\n return Downshift;\n }(Component);\n Downshift.defaultProps = {\n defaultHighlightedIndex: null,\n defaultIsOpen: false,\n getA11yStatusMessage: getA11yStatusMessage$1,\n itemToString: function itemToString(i) {\n if (i == null) {\n return '';\n }\n if (process.env.NODE_ENV !== 'production' && isPlainObject(i) && !i.hasOwnProperty('toString')) {\n // eslint-disable-next-line no-console\n console.warn('downshift: An object was passed to the default implementation of `itemToString`. You should probably provide your own `itemToString` implementation. Please refer to the `itemToString` API documentation.', 'The object that was passed:', i);\n }\n return String(i);\n },\n onStateChange: noop,\n onInputValueChange: noop,\n onUserAction: noop,\n onChange: noop,\n onSelect: noop,\n onOuterClick: noop,\n selectedItemChanged: function selectedItemChanged(prevItem, item) {\n return prevItem !== item;\n },\n environment: /* istanbul ignore next (ssr) */\n typeof window === 'undefined' ? {} : window,\n stateReducer: function stateReducer(state, stateToSet) {\n return stateToSet;\n },\n suppressRefError: false,\n scrollIntoView: scrollIntoView\n };\n Downshift.stateChangeTypes = stateChangeTypes$3;\n return Downshift;\n}();\nprocess.env.NODE_ENV !== \"production\" ? Downshift.propTypes = {\n children: PropTypes.func,\n defaultHighlightedIndex: PropTypes.number,\n defaultIsOpen: PropTypes.bool,\n initialHighlightedIndex: PropTypes.number,\n initialSelectedItem: PropTypes.any,\n initialInputValue: PropTypes.string,\n initialIsOpen: PropTypes.bool,\n getA11yStatusMessage: PropTypes.func,\n itemToString: PropTypes.func,\n onChange: PropTypes.func,\n onSelect: PropTypes.func,\n onStateChange: PropTypes.func,\n onInputValueChange: PropTypes.func,\n onUserAction: PropTypes.func,\n onOuterClick: PropTypes.func,\n selectedItemChanged: PropTypes.func,\n stateReducer: PropTypes.func,\n itemCount: PropTypes.number,\n id: PropTypes.string,\n environment: PropTypes.shape({\n addEventListener: PropTypes.func,\n removeEventListener: PropTypes.func,\n document: PropTypes.shape({\n getElementById: PropTypes.func,\n activeElement: PropTypes.any,\n body: PropTypes.any\n })\n }),\n suppressRefError: PropTypes.bool,\n scrollIntoView: PropTypes.func,\n // things we keep in state for uncontrolled components\n // but can accept as props for controlled components\n /* eslint-disable react/no-unused-prop-types */\n selectedItem: PropTypes.any,\n isOpen: PropTypes.bool,\n inputValue: PropTypes.string,\n highlightedIndex: PropTypes.number,\n labelId: PropTypes.string,\n inputId: PropTypes.string,\n menuId: PropTypes.string,\n getItemId: PropTypes.func\n /* eslint-enable react/no-unused-prop-types */\n} : void 0;\nvar Downshift$1 = Downshift;\nfunction validateGetMenuPropsCalledCorrectly(node, _ref12) {\n var refKey = _ref12.refKey;\n if (!node) {\n // eslint-disable-next-line no-console\n console.error(\"downshift: The ref prop \\\"\" + refKey + \"\\\" from getMenuProps was not applied correctly on your menu element.\");\n }\n}\nfunction validateGetRootPropsCalledCorrectly(element, _ref13) {\n var refKey = _ref13.refKey;\n var refKeySpecified = refKey !== 'ref';\n var isComposite = !isDOMElement(element);\n if (isComposite && !refKeySpecified && !isForwardRef(element)) {\n // eslint-disable-next-line no-console\n console.error('downshift: You returned a non-DOM element. You must specify a refKey in getRootProps');\n } else if (!isComposite && refKeySpecified) {\n // eslint-disable-next-line no-console\n console.error(\"downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified \\\"\" + refKey + \"\\\"\");\n }\n if (!isForwardRef(element) && !getElementProps(element)[refKey]) {\n // eslint-disable-next-line no-console\n console.error(\"downshift: You must apply the ref prop \\\"\" + refKey + \"\\\" from getRootProps onto your root element.\");\n }\n}\n\nvar _excluded$3 = [\"isInitialMount\", \"highlightedIndex\", \"items\", \"environment\"];\nvar dropdownDefaultStateValues = {\n highlightedIndex: -1,\n isOpen: false,\n selectedItem: null,\n inputValue: ''\n};\nfunction callOnChangeProps(action, state, newState) {\n var props = action.props,\n type = action.type;\n var changes = {};\n Object.keys(state).forEach(function (key) {\n invokeOnChangeHandler(key, action, state, newState);\n if (newState[key] !== state[key]) {\n changes[key] = newState[key];\n }\n });\n if (props.onStateChange && Object.keys(changes).length) {\n props.onStateChange(_extends({\n type: type\n }, changes));\n }\n}\nfunction invokeOnChangeHandler(key, action, state, newState) {\n var props = action.props,\n type = action.type;\n var handler = \"on\" + capitalizeString(key) + \"Change\";\n if (props[handler] && newState[key] !== undefined && newState[key] !== state[key]) {\n props[handler](_extends({\n type: type\n }, newState));\n }\n}\n\n/**\n * Default state reducer that returns the changes.\n *\n * @param {Object} s state.\n * @param {Object} a action with changes.\n * @returns {Object} changes.\n */\nfunction stateReducer(s, a) {\n return a.changes;\n}\n\n/**\n * Returns a message to be added to aria-live region when item is selected.\n *\n * @param {Object} selectionParameters Parameters required to build the message.\n * @returns {string} The a11y message.\n */\nfunction getA11ySelectionMessage(selectionParameters) {\n var selectedItem = selectionParameters.selectedItem,\n itemToStringLocal = selectionParameters.itemToString;\n return selectedItem ? itemToStringLocal(selectedItem) + \" has been selected.\" : '';\n}\n\n/**\n * Debounced call for updating the a11y message.\n */\nvar updateA11yStatus = debounce(function (getA11yMessage, document) {\n setStatus(getA11yMessage(), document);\n}, 200);\n\n// istanbul ignore next\nvar useIsomorphicLayoutEffect = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined' ? useLayoutEffect : useEffect;\nfunction useElementIds(_ref) {\n var _ref$id = _ref.id,\n id = _ref$id === void 0 ? \"downshift-\" + generateId() : _ref$id,\n labelId = _ref.labelId,\n menuId = _ref.menuId,\n getItemId = _ref.getItemId,\n toggleButtonId = _ref.toggleButtonId,\n inputId = _ref.inputId;\n var elementIdsRef = useRef({\n labelId: labelId || id + \"-label\",\n menuId: menuId || id + \"-menu\",\n getItemId: getItemId || function (index) {\n return id + \"-item-\" + index;\n },\n toggleButtonId: toggleButtonId || id + \"-toggle-button\",\n inputId: inputId || id + \"-input\"\n });\n return elementIdsRef.current;\n}\nfunction getItemAndIndex(itemProp, indexProp, items, errorMessage) {\n var item, index;\n if (itemProp === undefined) {\n if (indexProp === undefined) {\n throw new Error(errorMessage);\n }\n item = items[indexProp];\n index = indexProp;\n } else {\n index = indexProp === undefined ? items.indexOf(itemProp) : indexProp;\n item = itemProp;\n }\n return [item, index];\n}\nfunction itemToString(item) {\n return item ? String(item) : '';\n}\nfunction isAcceptedCharacterKey(key) {\n return /^\\S{1}$/.test(key);\n}\nfunction capitalizeString(string) {\n return \"\" + string.slice(0, 1).toUpperCase() + string.slice(1);\n}\nfunction useLatestRef(val) {\n var ref = useRef(val);\n // technically this is not \"concurrent mode safe\" because we're manipulating\n // the value during render (so it's not idempotent). However, the places this\n // hook is used is to support memoizing callbacks which will be called\n // *during* render, so we need the latest values *during* render.\n // If not for this, then we'd probably want to use useLayoutEffect instead.\n ref.current = val;\n return ref;\n}\n\n/**\n * Computes the controlled state using a the previous state, props,\n * two reducers, one from downshift and an optional one from the user.\n * Also calls the onChange handlers for state values that have changed.\n *\n * @param {Function} reducer Reducer function from downshift.\n * @param {Object} initialState Initial state of the hook.\n * @param {Object} props The hook props.\n * @returns {Array} An array with the state and an action dispatcher.\n */\nfunction useEnhancedReducer(reducer, initialState, props) {\n var prevStateRef = useRef();\n var actionRef = useRef();\n var enhancedReducer = useCallback(function (state, action) {\n actionRef.current = action;\n state = getState(state, action.props);\n var changes = reducer(state, action);\n var newState = action.props.stateReducer(state, _extends({}, action, {\n changes: changes\n }));\n return newState;\n }, [reducer]);\n var _useReducer = useReducer(enhancedReducer, initialState),\n state = _useReducer[0],\n dispatch = _useReducer[1];\n var propsRef = useLatestRef(props);\n var dispatchWithProps = useCallback(function (action) {\n return dispatch(_extends({\n props: propsRef.current\n }, action));\n }, [propsRef]);\n var action = actionRef.current;\n useEffect(function () {\n if (action && prevStateRef.current && prevStateRef.current !== state) {\n callOnChangeProps(action, getState(prevStateRef.current, action.props), state);\n }\n prevStateRef.current = state;\n }, [state, props, action]);\n return [state, dispatchWithProps];\n}\n\n/**\n * Wraps the useEnhancedReducer and applies the controlled prop values before\n * returning the new state.\n *\n * @param {Function} reducer Reducer function from downshift.\n * @param {Object} initialState Initial state of the hook.\n * @param {Object} props The hook props.\n * @returns {Array} An array with the state and an action dispatcher.\n */\nfunction useControlledReducer$1(reducer, initialState, props) {\n var _useEnhancedReducer = useEnhancedReducer(reducer, initialState, props),\n state = _useEnhancedReducer[0],\n dispatch = _useEnhancedReducer[1];\n return [getState(state, props), dispatch];\n}\nvar defaultProps$3 = {\n itemToString: itemToString,\n stateReducer: stateReducer,\n getA11ySelectionMessage: getA11ySelectionMessage,\n scrollIntoView: scrollIntoView,\n environment: /* istanbul ignore next (ssr) */\n typeof window === 'undefined' ? {} : window\n};\nfunction getDefaultValue$1(props, propKey, defaultStateValues) {\n if (defaultStateValues === void 0) {\n defaultStateValues = dropdownDefaultStateValues;\n }\n var defaultValue = props[\"default\" + capitalizeString(propKey)];\n if (defaultValue !== undefined) {\n return defaultValue;\n }\n return defaultStateValues[propKey];\n}\nfunction getInitialValue$1(props, propKey, defaultStateValues) {\n if (defaultStateValues === void 0) {\n defaultStateValues = dropdownDefaultStateValues;\n }\n var value = props[propKey];\n if (value !== undefined) {\n return value;\n }\n var initialValue = props[\"initial\" + capitalizeString(propKey)];\n if (initialValue !== undefined) {\n return initialValue;\n }\n return getDefaultValue$1(props, propKey, defaultStateValues);\n}\nfunction getInitialState$2(props) {\n var selectedItem = getInitialValue$1(props, 'selectedItem');\n var isOpen = getInitialValue$1(props, 'isOpen');\n var highlightedIndex = getInitialValue$1(props, 'highlightedIndex');\n var inputValue = getInitialValue$1(props, 'inputValue');\n return {\n highlightedIndex: highlightedIndex < 0 && selectedItem && isOpen ? props.items.indexOf(selectedItem) : highlightedIndex,\n isOpen: isOpen,\n selectedItem: selectedItem,\n inputValue: inputValue\n };\n}\nfunction getHighlightedIndexOnOpen(props, state, offset) {\n var items = props.items,\n initialHighlightedIndex = props.initialHighlightedIndex,\n defaultHighlightedIndex = props.defaultHighlightedIndex;\n var selectedItem = state.selectedItem,\n highlightedIndex = state.highlightedIndex;\n if (items.length === 0) {\n return -1;\n }\n\n // initialHighlightedIndex will give value to highlightedIndex on initial state only.\n if (initialHighlightedIndex !== undefined && highlightedIndex === initialHighlightedIndex) {\n return initialHighlightedIndex;\n }\n if (defaultHighlightedIndex !== undefined) {\n return defaultHighlightedIndex;\n }\n if (selectedItem) {\n return items.indexOf(selectedItem);\n }\n if (offset === 0) {\n return -1;\n }\n return offset < 0 ? items.length - 1 : 0;\n}\n\n/**\n * Reuse the movement tracking of mouse and touch events.\n *\n * @param {boolean} isOpen Whether the dropdown is open or not.\n * @param {Array} downshiftElementRefs Downshift element refs to track movement (toggleButton, menu etc.)\n * @param {Object} environment Environment where component/hook exists.\n * @param {Function} handleBlur Handler on blur from mouse or touch.\n * @returns {Object} Ref containing whether mouseDown or touchMove event is happening\n */\nfunction useMouseAndTouchTracker(isOpen, downshiftElementRefs, environment, handleBlur) {\n var mouseAndTouchTrackersRef = useRef({\n isMouseDown: false,\n isTouchMove: false\n });\n useEffect(function () {\n if ((environment == null ? void 0 : environment.addEventListener) == null) {\n return;\n }\n\n // The same strategy for checking if a click occurred inside or outside downshift\n // as in downshift.js.\n var onMouseDown = function onMouseDown() {\n mouseAndTouchTrackersRef.current.isMouseDown = true;\n };\n var onMouseUp = function onMouseUp(event) {\n mouseAndTouchTrackersRef.current.isMouseDown = false;\n if (isOpen && !targetWithinDownshift(event.target, downshiftElementRefs.map(function (ref) {\n return ref.current;\n }), environment)) {\n handleBlur();\n }\n };\n var onTouchStart = function onTouchStart() {\n mouseAndTouchTrackersRef.current.isTouchMove = false;\n };\n var onTouchMove = function onTouchMove() {\n mouseAndTouchTrackersRef.current.isTouchMove = true;\n };\n var onTouchEnd = function onTouchEnd(event) {\n if (isOpen && !mouseAndTouchTrackersRef.current.isTouchMove && !targetWithinDownshift(event.target, downshiftElementRefs.map(function (ref) {\n return ref.current;\n }), environment, false)) {\n handleBlur();\n }\n };\n environment.addEventListener('mousedown', onMouseDown);\n environment.addEventListener('mouseup', onMouseUp);\n environment.addEventListener('touchstart', onTouchStart);\n environment.addEventListener('touchmove', onTouchMove);\n environment.addEventListener('touchend', onTouchEnd);\n\n // eslint-disable-next-line consistent-return\n return function cleanup() {\n environment.removeEventListener('mousedown', onMouseDown);\n environment.removeEventListener('mouseup', onMouseUp);\n environment.removeEventListener('touchstart', onTouchStart);\n environment.removeEventListener('touchmove', onTouchMove);\n environment.removeEventListener('touchend', onTouchEnd);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpen, environment]);\n return mouseAndTouchTrackersRef;\n}\n\n/* istanbul ignore next */\n// eslint-disable-next-line import/no-mutable-exports\nvar useGetterPropsCalledChecker = function useGetterPropsCalledChecker() {\n return noop;\n};\n/**\n * Custom hook that checks if getter props are called correctly.\n *\n * @param {...any} propKeys Getter prop names to be handled.\n * @returns {Function} Setter function called inside getter props to set call information.\n */\n/* istanbul ignore next */\nif (process.env.NODE_ENV !== 'production') {\n useGetterPropsCalledChecker = function useGetterPropsCalledChecker() {\n var isInitialMountRef = useRef(true);\n for (var _len = arguments.length, propKeys = new Array(_len), _key = 0; _key < _len; _key++) {\n propKeys[_key] = arguments[_key];\n }\n var getterPropsCalledRef = useRef(propKeys.reduce(function (acc, propKey) {\n acc[propKey] = {};\n return acc;\n }, {}));\n useEffect(function () {\n Object.keys(getterPropsCalledRef.current).forEach(function (propKey) {\n var propCallInfo = getterPropsCalledRef.current[propKey];\n if (isInitialMountRef.current) {\n if (!Object.keys(propCallInfo).length) {\n // eslint-disable-next-line no-console\n console.error(\"downshift: You forgot to call the \" + propKey + \" getter function on your component / element.\");\n return;\n }\n }\n var suppressRefError = propCallInfo.suppressRefError,\n refKey = propCallInfo.refKey,\n elementRef = propCallInfo.elementRef;\n if ((!elementRef || !elementRef.current) && !suppressRefError) {\n // eslint-disable-next-line no-console\n console.error(\"downshift: The ref prop \\\"\" + refKey + \"\\\" from \" + propKey + \" was not applied correctly on your element.\");\n }\n });\n isInitialMountRef.current = false;\n });\n var setGetterPropCallInfo = useCallback(function (propKey, suppressRefError, refKey, elementRef) {\n getterPropsCalledRef.current[propKey] = {\n suppressRefError: suppressRefError,\n refKey: refKey,\n elementRef: elementRef\n };\n }, []);\n return setGetterPropCallInfo;\n };\n}\nfunction useA11yMessageSetter(getA11yMessage, dependencyArray, _ref2) {\n var isInitialMount = _ref2.isInitialMount,\n highlightedIndex = _ref2.highlightedIndex,\n items = _ref2.items,\n environment = _ref2.environment,\n rest = _objectWithoutPropertiesLoose(_ref2, _excluded$3);\n // Sets a11y status message on changes in state.\n useEffect(function () {\n if (isInitialMount || false) {\n return;\n }\n updateA11yStatus(function () {\n return getA11yMessage(_extends({\n highlightedIndex: highlightedIndex,\n highlightedItem: items[highlightedIndex],\n resultCount: items.length\n }, rest));\n }, environment.document);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, dependencyArray);\n}\nfunction useScrollIntoView(_ref3) {\n var highlightedIndex = _ref3.highlightedIndex,\n isOpen = _ref3.isOpen,\n itemRefs = _ref3.itemRefs,\n getItemNodeFromIndex = _ref3.getItemNodeFromIndex,\n menuElement = _ref3.menuElement,\n scrollIntoViewProp = _ref3.scrollIntoView;\n // used not to scroll on highlight by mouse.\n var shouldScrollRef = useRef(true);\n // Scroll on highlighted item if change comes from keyboard.\n useIsomorphicLayoutEffect(function () {\n if (highlightedIndex < 0 || !isOpen || !Object.keys(itemRefs.current).length) {\n return;\n }\n if (shouldScrollRef.current === false) {\n shouldScrollRef.current = true;\n } else {\n scrollIntoViewProp(getItemNodeFromIndex(highlightedIndex), menuElement);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [highlightedIndex]);\n return shouldScrollRef;\n}\n\n// eslint-disable-next-line import/no-mutable-exports\nvar useControlPropsValidator = noop;\n/* istanbul ignore next */\nif (process.env.NODE_ENV !== 'production') {\n useControlPropsValidator = function useControlPropsValidator(_ref4) {\n var isInitialMount = _ref4.isInitialMount,\n props = _ref4.props,\n state = _ref4.state;\n // used for checking when props are moving from controlled to uncontrolled.\n var prevPropsRef = useRef(props);\n useEffect(function () {\n if (isInitialMount) {\n return;\n }\n validateControlledUnchanged(state, prevPropsRef.current, props);\n prevPropsRef.current = props;\n }, [state, props, isInitialMount]);\n };\n}\n\n/**\n * Handles selection on Enter / Alt + ArrowUp. Closes the menu and resets the highlighted index, unless there is a highlighted.\n * In that case, selects the item and resets to defaults for open state and highlighted idex.\n * @param {Object} props The useCombobox props.\n * @param {number} highlightedIndex The index from the state.\n * @param {boolean} inputValue Also return the input value for state.\n * @returns The changes for the state.\n */\nfunction getChangesOnSelection(props, highlightedIndex, inputValue) {\n var _props$items;\n if (inputValue === void 0) {\n inputValue = true;\n }\n var shouldSelect = ((_props$items = props.items) == null ? void 0 : _props$items.length) && highlightedIndex >= 0;\n return _extends({\n isOpen: false,\n highlightedIndex: -1\n }, shouldSelect && _extends({\n selectedItem: props.items[highlightedIndex],\n isOpen: getDefaultValue$1(props, 'isOpen'),\n highlightedIndex: getDefaultValue$1(props, 'highlightedIndex')\n }, inputValue && {\n inputValue: props.itemToString(props.items[highlightedIndex])\n }));\n}\n\nfunction downshiftCommonReducer(state, action, stateChangeTypes) {\n var type = action.type,\n props = action.props;\n var changes;\n switch (type) {\n case stateChangeTypes.ItemMouseMove:\n changes = {\n highlightedIndex: action.disabled ? -1 : action.index\n };\n break;\n case stateChangeTypes.MenuMouseLeave:\n changes = {\n highlightedIndex: -1\n };\n break;\n case stateChangeTypes.ToggleButtonClick:\n case stateChangeTypes.FunctionToggleMenu:\n changes = {\n isOpen: !state.isOpen,\n highlightedIndex: state.isOpen ? -1 : getHighlightedIndexOnOpen(props, state, 0)\n };\n break;\n case stateChangeTypes.FunctionOpenMenu:\n changes = {\n isOpen: true,\n highlightedIndex: getHighlightedIndexOnOpen(props, state, 0)\n };\n break;\n case stateChangeTypes.FunctionCloseMenu:\n changes = {\n isOpen: false\n };\n break;\n case stateChangeTypes.FunctionSetHighlightedIndex:\n changes = {\n highlightedIndex: action.highlightedIndex\n };\n break;\n case stateChangeTypes.FunctionSetInputValue:\n changes = {\n inputValue: action.inputValue\n };\n break;\n case stateChangeTypes.FunctionReset:\n changes = {\n highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),\n isOpen: getDefaultValue$1(props, 'isOpen'),\n selectedItem: getDefaultValue$1(props, 'selectedItem'),\n inputValue: getDefaultValue$1(props, 'inputValue')\n };\n break;\n default:\n throw new Error('Reducer called without proper action type.');\n }\n return _extends({}, state, changes);\n}\n/* eslint-enable complexity */\n\nfunction getItemIndexByCharacterKey(_a) {\n var keysSoFar = _a.keysSoFar, highlightedIndex = _a.highlightedIndex, items = _a.items, itemToString = _a.itemToString, getItemNodeFromIndex = _a.getItemNodeFromIndex;\n var lowerCasedKeysSoFar = keysSoFar.toLowerCase();\n for (var index = 0; index < items.length; index++) {\n // if we already have a search query in progress, we also consider the current highlighted item.\n var offsetIndex = (index + highlightedIndex + (keysSoFar.length < 2 ? 1 : 0)) % items.length;\n var item = items[offsetIndex];\n if (item !== undefined &&\n itemToString(item).toLowerCase().startsWith(lowerCasedKeysSoFar)) {\n var element = getItemNodeFromIndex(offsetIndex);\n if (!(element === null || element === void 0 ? void 0 : element.hasAttribute('disabled'))) {\n return offsetIndex;\n }\n }\n }\n return highlightedIndex;\n}\nvar propTypes$2 = {\n items: PropTypes.array.isRequired,\n itemToString: PropTypes.func,\n getA11yStatusMessage: PropTypes.func,\n getA11ySelectionMessage: PropTypes.func,\n highlightedIndex: PropTypes.number,\n defaultHighlightedIndex: PropTypes.number,\n initialHighlightedIndex: PropTypes.number,\n isOpen: PropTypes.bool,\n defaultIsOpen: PropTypes.bool,\n initialIsOpen: PropTypes.bool,\n selectedItem: PropTypes.any,\n initialSelectedItem: PropTypes.any,\n defaultSelectedItem: PropTypes.any,\n id: PropTypes.string,\n labelId: PropTypes.string,\n menuId: PropTypes.string,\n getItemId: PropTypes.func,\n toggleButtonId: PropTypes.string,\n stateReducer: PropTypes.func,\n onSelectedItemChange: PropTypes.func,\n onHighlightedIndexChange: PropTypes.func,\n onStateChange: PropTypes.func,\n onIsOpenChange: PropTypes.func,\n environment: PropTypes.shape({\n addEventListener: PropTypes.func,\n removeEventListener: PropTypes.func,\n document: PropTypes.shape({\n getElementById: PropTypes.func,\n activeElement: PropTypes.any,\n body: PropTypes.any\n })\n })\n};\n/**\n * Default implementation for status message. Only added when menu is open.\n * Will specift if there are results in the list, and if so, how many,\n * and what keys are relevant.\n *\n * @param {Object} param the downshift state and other relevant properties\n * @return {String} the a11y status message\n */\nfunction getA11yStatusMessage(_a) {\n var isOpen = _a.isOpen, resultCount = _a.resultCount, previousResultCount = _a.previousResultCount;\n if (!isOpen) {\n return '';\n }\n if (!resultCount) {\n return 'No results are available.';\n }\n if (resultCount !== previousResultCount) {\n return \"\".concat(resultCount, \" result\").concat(resultCount === 1 ? ' is' : 's are', \" available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select.\");\n }\n return '';\n}\nvar defaultProps$2 = __assign(__assign({}, defaultProps$3), { getA11yStatusMessage: getA11yStatusMessage });\n// eslint-disable-next-line import/no-mutable-exports\nvar validatePropTypes$2 = noop;\n/* istanbul ignore next */\nif (process.env.NODE_ENV !== 'production') {\n validatePropTypes$2 = function (options, caller) {\n PropTypes.checkPropTypes(propTypes$2, options, 'prop', caller.name);\n };\n}\n\nvar ToggleButtonClick$1 = process.env.NODE_ENV !== \"production\" ? '__togglebutton_click__' : 0;\nvar ToggleButtonKeyDownArrowDown = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_arrow_down__' : 1;\nvar ToggleButtonKeyDownArrowUp = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_arrow_up__' : 2;\nvar ToggleButtonKeyDownCharacter = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_character__' : 3;\nvar ToggleButtonKeyDownEscape = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_escape__' : 4;\nvar ToggleButtonKeyDownHome = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_home__' : 5;\nvar ToggleButtonKeyDownEnd = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_end__' : 6;\nvar ToggleButtonKeyDownEnter = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_enter__' : 7;\nvar ToggleButtonKeyDownSpaceButton = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_space_button__' : 8;\nvar ToggleButtonKeyDownPageUp = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_page_up__' : 9;\nvar ToggleButtonKeyDownPageDown = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_page_down__' : 10;\nvar ToggleButtonBlur = process.env.NODE_ENV !== \"production\" ? '__togglebutton_blur__' : 11;\nvar MenuMouseLeave$1 = process.env.NODE_ENV !== \"production\" ? '__menu_mouse_leave__' : 12;\nvar ItemMouseMove$1 = process.env.NODE_ENV !== \"production\" ? '__item_mouse_move__' : 13;\nvar ItemClick$1 = process.env.NODE_ENV !== \"production\" ? '__item_click__' : 14;\nvar FunctionToggleMenu$1 = process.env.NODE_ENV !== \"production\" ? '__function_toggle_menu__' : 15;\nvar FunctionOpenMenu$1 = process.env.NODE_ENV !== \"production\" ? '__function_open_menu__' : 16;\nvar FunctionCloseMenu$1 = process.env.NODE_ENV !== \"production\" ? '__function_close_menu__' : 17;\nvar FunctionSetHighlightedIndex$1 = process.env.NODE_ENV !== \"production\" ? '__function_set_highlighted_index__' : 18;\nvar FunctionSelectItem$1 = process.env.NODE_ENV !== \"production\" ? '__function_select_item__' : 19;\nvar FunctionSetInputValue$1 = process.env.NODE_ENV !== \"production\" ? '__function_set_input_value__' : 20;\nvar FunctionReset$2 = process.env.NODE_ENV !== \"production\" ? '__function_reset__' : 21;\n\nvar stateChangeTypes$2 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n ToggleButtonClick: ToggleButtonClick$1,\n ToggleButtonKeyDownArrowDown: ToggleButtonKeyDownArrowDown,\n ToggleButtonKeyDownArrowUp: ToggleButtonKeyDownArrowUp,\n ToggleButtonKeyDownCharacter: ToggleButtonKeyDownCharacter,\n ToggleButtonKeyDownEscape: ToggleButtonKeyDownEscape,\n ToggleButtonKeyDownHome: ToggleButtonKeyDownHome,\n ToggleButtonKeyDownEnd: ToggleButtonKeyDownEnd,\n ToggleButtonKeyDownEnter: ToggleButtonKeyDownEnter,\n ToggleButtonKeyDownSpaceButton: ToggleButtonKeyDownSpaceButton,\n ToggleButtonKeyDownPageUp: ToggleButtonKeyDownPageUp,\n ToggleButtonKeyDownPageDown: ToggleButtonKeyDownPageDown,\n ToggleButtonBlur: ToggleButtonBlur,\n MenuMouseLeave: MenuMouseLeave$1,\n ItemMouseMove: ItemMouseMove$1,\n ItemClick: ItemClick$1,\n FunctionToggleMenu: FunctionToggleMenu$1,\n FunctionOpenMenu: FunctionOpenMenu$1,\n FunctionCloseMenu: FunctionCloseMenu$1,\n FunctionSetHighlightedIndex: FunctionSetHighlightedIndex$1,\n FunctionSelectItem: FunctionSelectItem$1,\n FunctionSetInputValue: FunctionSetInputValue$1,\n FunctionReset: FunctionReset$2\n});\n\n/* eslint-disable complexity */\nfunction downshiftSelectReducer(state, action) {\n var _props$items;\n var type = action.type,\n props = action.props,\n altKey = action.altKey;\n var changes;\n switch (type) {\n case ItemClick$1:\n changes = {\n isOpen: getDefaultValue$1(props, 'isOpen'),\n highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),\n selectedItem: props.items[action.index]\n };\n break;\n case ToggleButtonKeyDownCharacter:\n {\n var lowercasedKey = action.key;\n var inputValue = \"\" + state.inputValue + lowercasedKey;\n var prevHighlightedIndex = !state.isOpen && state.selectedItem ? props.items.indexOf(state.selectedItem) : state.highlightedIndex;\n var highlightedIndex = getItemIndexByCharacterKey({\n keysSoFar: inputValue,\n highlightedIndex: prevHighlightedIndex,\n items: props.items,\n itemToString: props.itemToString,\n getItemNodeFromIndex: action.getItemNodeFromIndex\n });\n changes = {\n inputValue: inputValue,\n highlightedIndex: highlightedIndex,\n isOpen: true\n };\n }\n break;\n case ToggleButtonKeyDownArrowDown:\n {\n var _highlightedIndex = state.isOpen ? getNextWrappingIndex(1, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, false) : altKey && state.selectedItem == null ? -1 : getHighlightedIndexOnOpen(props, state, 1);\n changes = {\n highlightedIndex: _highlightedIndex,\n isOpen: true\n };\n }\n break;\n case ToggleButtonKeyDownArrowUp:\n if (state.isOpen && altKey) {\n changes = getChangesOnSelection(props, state.highlightedIndex, false);\n } else {\n var _highlightedIndex2 = state.isOpen ? getNextWrappingIndex(-1, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, false) : getHighlightedIndexOnOpen(props, state, -1);\n changes = {\n highlightedIndex: _highlightedIndex2,\n isOpen: true\n };\n }\n break;\n // only triggered when menu is open.\n case ToggleButtonKeyDownEnter:\n case ToggleButtonKeyDownSpaceButton:\n changes = getChangesOnSelection(props, state.highlightedIndex, false);\n break;\n case ToggleButtonKeyDownHome:\n changes = {\n highlightedIndex: getNextNonDisabledIndex(1, 0, props.items.length, action.getItemNodeFromIndex, false),\n isOpen: true\n };\n break;\n case ToggleButtonKeyDownEnd:\n changes = {\n highlightedIndex: getNextNonDisabledIndex(-1, props.items.length - 1, props.items.length, action.getItemNodeFromIndex, false),\n isOpen: true\n };\n break;\n case ToggleButtonKeyDownPageUp:\n changes = {\n highlightedIndex: getNextWrappingIndex(-10, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, false)\n };\n break;\n case ToggleButtonKeyDownPageDown:\n changes = {\n highlightedIndex: getNextWrappingIndex(10, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, false)\n };\n break;\n case ToggleButtonKeyDownEscape:\n changes = {\n isOpen: false,\n highlightedIndex: -1\n };\n break;\n case ToggleButtonBlur:\n changes = _extends({\n isOpen: false,\n highlightedIndex: -1\n }, state.highlightedIndex >= 0 && ((_props$items = props.items) == null ? void 0 : _props$items.length) && {\n selectedItem: props.items[state.highlightedIndex]\n });\n break;\n case FunctionSelectItem$1:\n changes = {\n selectedItem: action.selectedItem\n };\n break;\n default:\n return downshiftCommonReducer(state, action, stateChangeTypes$2);\n }\n return _extends({}, state, changes);\n}\n/* eslint-enable complexity */\n\nvar _excluded$2 = [\"onMouseLeave\", \"refKey\", \"onKeyDown\", \"onBlur\", \"ref\"],\n _excluded2$2 = [\"onBlur\", \"onClick\", \"onPress\", \"onKeyDown\", \"refKey\", \"ref\"],\n _excluded3$1 = [\"item\", \"index\", \"onMouseMove\", \"onClick\", \"onPress\", \"refKey\", \"ref\", \"disabled\"];\nuseSelect.stateChangeTypes = stateChangeTypes$2;\nfunction useSelect(userProps) {\n if (userProps === void 0) {\n userProps = {};\n }\n validatePropTypes$2(userProps, useSelect);\n // Props defaults and destructuring.\n var props = _extends({}, defaultProps$2, userProps);\n var items = props.items,\n scrollIntoView = props.scrollIntoView,\n environment = props.environment,\n itemToString = props.itemToString,\n getA11ySelectionMessage = props.getA11ySelectionMessage,\n getA11yStatusMessage = props.getA11yStatusMessage;\n // Initial state depending on controlled props.\n var initialState = getInitialState$2(props);\n var _useControlledReducer = useControlledReducer$1(downshiftSelectReducer, initialState, props),\n state = _useControlledReducer[0],\n dispatch = _useControlledReducer[1];\n var isOpen = state.isOpen,\n highlightedIndex = state.highlightedIndex,\n selectedItem = state.selectedItem,\n inputValue = state.inputValue;\n\n // Element efs.\n var toggleButtonRef = useRef(null);\n var menuRef = useRef(null);\n var itemRefs = useRef({});\n // used to keep the inputValue clearTimeout object between renders.\n var clearTimeoutRef = useRef(null);\n // prevent id re-generation between renders.\n var elementIds = useElementIds(props);\n // used to keep track of how many items we had on previous cycle.\n var previousResultCountRef = useRef();\n var isInitialMountRef = useRef(true);\n // utility callback to get item element.\n var latest = useLatestRef({\n state: state,\n props: props\n });\n\n // Some utils.\n var getItemNodeFromIndex = useCallback(function (index) {\n return itemRefs.current[elementIds.getItemId(index)];\n }, [elementIds]);\n\n // Effects.\n // Sets a11y status message on changes in state.\n useA11yMessageSetter(getA11yStatusMessage, [isOpen, highlightedIndex, inputValue, items], _extends({\n isInitialMount: isInitialMountRef.current,\n previousResultCount: previousResultCountRef.current,\n items: items,\n environment: environment,\n itemToString: itemToString\n }, state));\n // Sets a11y status message on changes in selectedItem.\n useA11yMessageSetter(getA11ySelectionMessage, [selectedItem], _extends({\n isInitialMount: isInitialMountRef.current,\n previousResultCount: previousResultCountRef.current,\n items: items,\n environment: environment,\n itemToString: itemToString\n }, state));\n // Scroll on highlighted item if change comes from keyboard.\n var shouldScrollRef = useScrollIntoView({\n menuElement: menuRef.current,\n highlightedIndex: highlightedIndex,\n isOpen: isOpen,\n itemRefs: itemRefs,\n scrollIntoView: scrollIntoView,\n getItemNodeFromIndex: getItemNodeFromIndex\n });\n\n // Sets cleanup for the keysSoFar callback, debounded after 500ms.\n useEffect(function () {\n // init the clean function here as we need access to dispatch.\n clearTimeoutRef.current = debounce(function (outerDispatch) {\n outerDispatch({\n type: FunctionSetInputValue$1,\n inputValue: ''\n });\n }, 500);\n\n // Cancel any pending debounced calls on mount\n return function () {\n clearTimeoutRef.current.cancel();\n };\n }, []);\n\n // Invokes the keysSoFar callback set up above.\n useEffect(function () {\n if (!inputValue) {\n return;\n }\n clearTimeoutRef.current(dispatch);\n }, [dispatch, inputValue]);\n useControlPropsValidator({\n isInitialMount: isInitialMountRef.current,\n props: props,\n state: state\n });\n useEffect(function () {\n if (isInitialMountRef.current) {\n return;\n }\n previousResultCountRef.current = items.length;\n });\n // Add mouse/touch events to document.\n var mouseAndTouchTrackersRef = useMouseAndTouchTracker(isOpen, [menuRef, toggleButtonRef], environment, function () {\n dispatch({\n type: ToggleButtonBlur\n });\n });\n var setGetterPropCallInfo = useGetterPropsCalledChecker('getMenuProps', 'getToggleButtonProps');\n // Make initial ref false.\n useEffect(function () {\n isInitialMountRef.current = false;\n return function () {\n isInitialMountRef.current = true;\n };\n }, []);\n // Reset itemRefs on close.\n useEffect(function () {\n if (!isOpen) {\n itemRefs.current = {};\n }\n }, [isOpen]);\n\n // Event handler functions.\n var toggleButtonKeyDownHandlers = useMemo(function () {\n return {\n ArrowDown: function ArrowDown(event) {\n event.preventDefault();\n dispatch({\n type: ToggleButtonKeyDownArrowDown,\n getItemNodeFromIndex: getItemNodeFromIndex,\n altKey: event.altKey\n });\n },\n ArrowUp: function ArrowUp(event) {\n event.preventDefault();\n dispatch({\n type: ToggleButtonKeyDownArrowUp,\n getItemNodeFromIndex: getItemNodeFromIndex,\n altKey: event.altKey\n });\n },\n Home: function Home(event) {\n event.preventDefault();\n dispatch({\n type: ToggleButtonKeyDownHome,\n getItemNodeFromIndex: getItemNodeFromIndex\n });\n },\n End: function End(event) {\n event.preventDefault();\n dispatch({\n type: ToggleButtonKeyDownEnd,\n getItemNodeFromIndex: getItemNodeFromIndex\n });\n },\n Escape: function Escape() {\n if (latest.current.state.isOpen) {\n dispatch({\n type: ToggleButtonKeyDownEscape\n });\n }\n },\n Enter: function Enter(event) {\n event.preventDefault();\n dispatch({\n type: latest.current.state.isOpen ? ToggleButtonKeyDownEnter : ToggleButtonClick$1\n });\n },\n PageUp: function PageUp(event) {\n if (latest.current.state.isOpen) {\n event.preventDefault();\n dispatch({\n type: ToggleButtonKeyDownPageUp,\n getItemNodeFromIndex: getItemNodeFromIndex\n });\n }\n },\n PageDown: function PageDown(event) {\n if (latest.current.state.isOpen) {\n event.preventDefault();\n dispatch({\n type: ToggleButtonKeyDownPageDown,\n getItemNodeFromIndex: getItemNodeFromIndex\n });\n }\n },\n ' ': function _(event) {\n event.preventDefault();\n var currentState = latest.current.state;\n if (!currentState.isOpen) {\n dispatch({\n type: ToggleButtonClick$1\n });\n return;\n }\n if (currentState.inputValue) {\n dispatch({\n type: ToggleButtonKeyDownCharacter,\n key: ' ',\n getItemNodeFromIndex: getItemNodeFromIndex\n });\n } else {\n dispatch({\n type: ToggleButtonKeyDownSpaceButton\n });\n }\n }\n };\n }, [dispatch, getItemNodeFromIndex, latest]);\n\n // Action functions.\n var toggleMenu = useCallback(function () {\n dispatch({\n type: FunctionToggleMenu$1\n });\n }, [dispatch]);\n var closeMenu = useCallback(function () {\n dispatch({\n type: FunctionCloseMenu$1\n });\n }, [dispatch]);\n var openMenu = useCallback(function () {\n dispatch({\n type: FunctionOpenMenu$1\n });\n }, [dispatch]);\n var setHighlightedIndex = useCallback(function (newHighlightedIndex) {\n dispatch({\n type: FunctionSetHighlightedIndex$1,\n highlightedIndex: newHighlightedIndex\n });\n }, [dispatch]);\n var selectItem = useCallback(function (newSelectedItem) {\n dispatch({\n type: FunctionSelectItem$1,\n selectedItem: newSelectedItem\n });\n }, [dispatch]);\n var reset = useCallback(function () {\n dispatch({\n type: FunctionReset$2\n });\n }, [dispatch]);\n var setInputValue = useCallback(function (newInputValue) {\n dispatch({\n type: FunctionSetInputValue$1,\n inputValue: newInputValue\n });\n }, [dispatch]);\n // Getter functions.\n var getLabelProps = useCallback(function (labelProps) {\n return _extends({\n id: elementIds.labelId,\n htmlFor: elementIds.toggleButtonId\n }, labelProps);\n }, [elementIds]);\n var getMenuProps = useCallback(function (_temp, _temp2) {\n var _extends2;\n var _ref = _temp === void 0 ? {} : _temp,\n onMouseLeave = _ref.onMouseLeave,\n _ref$refKey = _ref.refKey,\n refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey;\n _ref.onKeyDown;\n _ref.onBlur;\n var ref = _ref.ref,\n rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);\n var _ref2 = _temp2 === void 0 ? {} : _temp2,\n _ref2$suppressRefErro = _ref2.suppressRefError,\n suppressRefError = _ref2$suppressRefErro === void 0 ? false : _ref2$suppressRefErro;\n var menuHandleMouseLeave = function menuHandleMouseLeave() {\n dispatch({\n type: MenuMouseLeave$1\n });\n };\n setGetterPropCallInfo('getMenuProps', suppressRefError, refKey, menuRef);\n return _extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, function (menuNode) {\n menuRef.current = menuNode;\n }), _extends2.id = elementIds.menuId, _extends2.role = 'listbox', _extends2['aria-labelledby'] = rest && rest['aria-label'] ? undefined : \"\" + elementIds.labelId, _extends2.onMouseLeave = callAllEventHandlers(onMouseLeave, menuHandleMouseLeave), _extends2), rest);\n }, [dispatch, setGetterPropCallInfo, elementIds]);\n var getToggleButtonProps = useCallback(function (_temp3, _temp4) {\n var _extends3;\n var _ref3 = _temp3 === void 0 ? {} : _temp3,\n onBlur = _ref3.onBlur,\n onClick = _ref3.onClick;\n _ref3.onPress;\n var onKeyDown = _ref3.onKeyDown,\n _ref3$refKey = _ref3.refKey,\n refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,\n ref = _ref3.ref,\n rest = _objectWithoutPropertiesLoose(_ref3, _excluded2$2);\n var _ref4 = _temp4 === void 0 ? {} : _temp4,\n _ref4$suppressRefErro = _ref4.suppressRefError,\n suppressRefError = _ref4$suppressRefErro === void 0 ? false : _ref4$suppressRefErro;\n var latestState = latest.current.state;\n var toggleButtonHandleClick = function toggleButtonHandleClick() {\n dispatch({\n type: ToggleButtonClick$1\n });\n };\n var toggleButtonHandleBlur = function toggleButtonHandleBlur() {\n if (latestState.isOpen && !mouseAndTouchTrackersRef.current.isMouseDown) {\n dispatch({\n type: ToggleButtonBlur\n });\n }\n };\n var toggleButtonHandleKeyDown = function toggleButtonHandleKeyDown(event) {\n var key = normalizeArrowKey(event);\n if (key && toggleButtonKeyDownHandlers[key]) {\n toggleButtonKeyDownHandlers[key](event);\n } else if (isAcceptedCharacterKey(key)) {\n dispatch({\n type: ToggleButtonKeyDownCharacter,\n key: key,\n getItemNodeFromIndex: getItemNodeFromIndex\n });\n }\n };\n var toggleProps = _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function (toggleButtonNode) {\n toggleButtonRef.current = toggleButtonNode;\n }), _extends3['aria-activedescendant'] = latestState.isOpen && latestState.highlightedIndex > -1 ? elementIds.getItemId(latestState.highlightedIndex) : '', _extends3['aria-controls'] = elementIds.menuId, _extends3['aria-expanded'] = latest.current.state.isOpen, _extends3['aria-haspopup'] = 'listbox', _extends3['aria-labelledby'] = rest && rest['aria-label'] ? undefined : \"\" + elementIds.labelId, _extends3.id = elementIds.toggleButtonId, _extends3.role = 'combobox', _extends3.tabIndex = 0, _extends3.onBlur = callAllEventHandlers(onBlur, toggleButtonHandleBlur), _extends3), rest);\n if (!rest.disabled) {\n /* istanbul ignore if (react-native) */\n {\n toggleProps.onClick = callAllEventHandlers(onClick, toggleButtonHandleClick);\n toggleProps.onKeyDown = callAllEventHandlers(onKeyDown, toggleButtonHandleKeyDown);\n }\n }\n setGetterPropCallInfo('getToggleButtonProps', suppressRefError, refKey, toggleButtonRef);\n return toggleProps;\n }, [latest, elementIds, setGetterPropCallInfo, dispatch, mouseAndTouchTrackersRef, toggleButtonKeyDownHandlers, getItemNodeFromIndex]);\n var getItemProps = useCallback(function (_temp5) {\n var _extends4;\n var _ref5 = _temp5 === void 0 ? {} : _temp5,\n itemProp = _ref5.item,\n indexProp = _ref5.index,\n onMouseMove = _ref5.onMouseMove,\n onClick = _ref5.onClick;\n _ref5.onPress;\n var _ref5$refKey = _ref5.refKey,\n refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,\n ref = _ref5.ref,\n disabled = _ref5.disabled,\n rest = _objectWithoutPropertiesLoose(_ref5, _excluded3$1);\n var _latest$current = latest.current,\n latestState = _latest$current.state,\n latestProps = _latest$current.props;\n var _getItemAndIndex = getItemAndIndex(itemProp, indexProp, latestProps.items, 'Pass either item or index to getItemProps!'),\n item = _getItemAndIndex[0],\n index = _getItemAndIndex[1];\n var itemHandleMouseMove = function itemHandleMouseMove() {\n if (index === latestState.highlightedIndex) {\n return;\n }\n shouldScrollRef.current = false;\n dispatch({\n type: ItemMouseMove$1,\n index: index,\n disabled: disabled\n });\n };\n var itemHandleClick = function itemHandleClick() {\n dispatch({\n type: ItemClick$1,\n index: index\n });\n };\n var itemProps = _extends((_extends4 = {\n disabled: disabled,\n role: 'option',\n 'aria-selected': \"\" + (item === selectedItem),\n id: elementIds.getItemId(index)\n }, _extends4[refKey] = handleRefs(ref, function (itemNode) {\n if (itemNode) {\n itemRefs.current[elementIds.getItemId(index)] = itemNode;\n }\n }), _extends4), rest);\n if (!disabled) {\n /* istanbul ignore next (react-native) */\n {\n itemProps.onClick = callAllEventHandlers(onClick, itemHandleClick);\n }\n }\n itemProps.onMouseMove = callAllEventHandlers(onMouseMove, itemHandleMouseMove);\n return itemProps;\n }, [latest, selectedItem, elementIds, shouldScrollRef, dispatch]);\n return {\n // prop getters.\n getToggleButtonProps: getToggleButtonProps,\n getLabelProps: getLabelProps,\n getMenuProps: getMenuProps,\n getItemProps: getItemProps,\n // actions.\n toggleMenu: toggleMenu,\n openMenu: openMenu,\n closeMenu: closeMenu,\n setHighlightedIndex: setHighlightedIndex,\n selectItem: selectItem,\n reset: reset,\n setInputValue: setInputValue,\n // state.\n highlightedIndex: highlightedIndex,\n isOpen: isOpen,\n selectedItem: selectedItem,\n inputValue: inputValue\n };\n}\n\nvar InputKeyDownArrowDown = process.env.NODE_ENV !== \"production\" ? '__input_keydown_arrow_down__' : 0;\nvar InputKeyDownArrowUp = process.env.NODE_ENV !== \"production\" ? '__input_keydown_arrow_up__' : 1;\nvar InputKeyDownEscape = process.env.NODE_ENV !== \"production\" ? '__input_keydown_escape__' : 2;\nvar InputKeyDownHome = process.env.NODE_ENV !== \"production\" ? '__input_keydown_home__' : 3;\nvar InputKeyDownEnd = process.env.NODE_ENV !== \"production\" ? '__input_keydown_end__' : 4;\nvar InputKeyDownPageUp = process.env.NODE_ENV !== \"production\" ? '__input_keydown_page_up__' : 5;\nvar InputKeyDownPageDown = process.env.NODE_ENV !== \"production\" ? '__input_keydown_page_down__' : 6;\nvar InputKeyDownEnter = process.env.NODE_ENV !== \"production\" ? '__input_keydown_enter__' : 7;\nvar InputChange = process.env.NODE_ENV !== \"production\" ? '__input_change__' : 8;\nvar InputBlur = process.env.NODE_ENV !== \"production\" ? '__input_blur__' : 9;\nvar InputFocus = process.env.NODE_ENV !== \"production\" ? '__input_focus__' : 10;\nvar MenuMouseLeave = process.env.NODE_ENV !== \"production\" ? '__menu_mouse_leave__' : 11;\nvar ItemMouseMove = process.env.NODE_ENV !== \"production\" ? '__item_mouse_move__' : 12;\nvar ItemClick = process.env.NODE_ENV !== \"production\" ? '__item_click__' : 13;\nvar ToggleButtonClick = process.env.NODE_ENV !== \"production\" ? '__togglebutton_click__' : 14;\nvar FunctionToggleMenu = process.env.NODE_ENV !== \"production\" ? '__function_toggle_menu__' : 15;\nvar FunctionOpenMenu = process.env.NODE_ENV !== \"production\" ? '__function_open_menu__' : 16;\nvar FunctionCloseMenu = process.env.NODE_ENV !== \"production\" ? '__function_close_menu__' : 17;\nvar FunctionSetHighlightedIndex = process.env.NODE_ENV !== \"production\" ? '__function_set_highlighted_index__' : 18;\nvar FunctionSelectItem = process.env.NODE_ENV !== \"production\" ? '__function_select_item__' : 19;\nvar FunctionSetInputValue = process.env.NODE_ENV !== \"production\" ? '__function_set_input_value__' : 20;\nvar FunctionReset$1 = process.env.NODE_ENV !== \"production\" ? '__function_reset__' : 21;\nvar ControlledPropUpdatedSelectedItem = process.env.NODE_ENV !== \"production\" ? '__controlled_prop_updated_selected_item__' : 22;\n\nvar stateChangeTypes$1 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n InputKeyDownArrowDown: InputKeyDownArrowDown,\n InputKeyDownArrowUp: InputKeyDownArrowUp,\n InputKeyDownEscape: InputKeyDownEscape,\n InputKeyDownHome: InputKeyDownHome,\n InputKeyDownEnd: InputKeyDownEnd,\n InputKeyDownPageUp: InputKeyDownPageUp,\n InputKeyDownPageDown: InputKeyDownPageDown,\n InputKeyDownEnter: InputKeyDownEnter,\n InputChange: InputChange,\n InputBlur: InputBlur,\n InputFocus: InputFocus,\n MenuMouseLeave: MenuMouseLeave,\n ItemMouseMove: ItemMouseMove,\n ItemClick: ItemClick,\n ToggleButtonClick: ToggleButtonClick,\n FunctionToggleMenu: FunctionToggleMenu,\n FunctionOpenMenu: FunctionOpenMenu,\n FunctionCloseMenu: FunctionCloseMenu,\n FunctionSetHighlightedIndex: FunctionSetHighlightedIndex,\n FunctionSelectItem: FunctionSelectItem,\n FunctionSetInputValue: FunctionSetInputValue,\n FunctionReset: FunctionReset$1,\n ControlledPropUpdatedSelectedItem: ControlledPropUpdatedSelectedItem\n});\n\nfunction getInitialState$1(props) {\n var initialState = getInitialState$2(props);\n var selectedItem = initialState.selectedItem;\n var inputValue = initialState.inputValue;\n if (inputValue === '' && selectedItem && props.defaultInputValue === undefined && props.initialInputValue === undefined && props.inputValue === undefined) {\n inputValue = props.itemToString(selectedItem);\n }\n return _extends({}, initialState, {\n inputValue: inputValue\n });\n}\nvar propTypes$1 = {\n items: PropTypes.array.isRequired,\n itemToString: PropTypes.func,\n selectedItemChanged: PropTypes.func,\n getA11yStatusMessage: PropTypes.func,\n getA11ySelectionMessage: PropTypes.func,\n highlightedIndex: PropTypes.number,\n defaultHighlightedIndex: PropTypes.number,\n initialHighlightedIndex: PropTypes.number,\n isOpen: PropTypes.bool,\n defaultIsOpen: PropTypes.bool,\n initialIsOpen: PropTypes.bool,\n selectedItem: PropTypes.any,\n initialSelectedItem: PropTypes.any,\n defaultSelectedItem: PropTypes.any,\n inputValue: PropTypes.string,\n defaultInputValue: PropTypes.string,\n initialInputValue: PropTypes.string,\n id: PropTypes.string,\n labelId: PropTypes.string,\n menuId: PropTypes.string,\n getItemId: PropTypes.func,\n inputId: PropTypes.string,\n toggleButtonId: PropTypes.string,\n stateReducer: PropTypes.func,\n onSelectedItemChange: PropTypes.func,\n onHighlightedIndexChange: PropTypes.func,\n onStateChange: PropTypes.func,\n onIsOpenChange: PropTypes.func,\n onInputValueChange: PropTypes.func,\n environment: PropTypes.shape({\n addEventListener: PropTypes.func,\n removeEventListener: PropTypes.func,\n document: PropTypes.shape({\n getElementById: PropTypes.func,\n activeElement: PropTypes.any,\n body: PropTypes.any\n })\n })\n};\n\n/**\n * The useCombobox version of useControlledReducer, which also\n * checks if the controlled prop selectedItem changed between\n * renders. If so, it will also update inputValue with its\n * string equivalent. It uses the common useEnhancedReducer to\n * compute the rest of the state.\n *\n * @param {Function} reducer Reducer function from downshift.\n * @param {Object} initialState Initial state of the hook.\n * @param {Object} props The hook props.\n * @returns {Array} An array with the state and an action dispatcher.\n */\nfunction useControlledReducer(reducer, initialState, props) {\n var previousSelectedItemRef = useRef();\n var _useEnhancedReducer = useEnhancedReducer(reducer, initialState, props),\n state = _useEnhancedReducer[0],\n dispatch = _useEnhancedReducer[1];\n\n // ToDo: if needed, make same approach as selectedItemChanged from Downshift.\n useEffect(function () {\n if (!isControlledProp(props, 'selectedItem')) {\n return;\n }\n if (props.selectedItemChanged(previousSelectedItemRef.current, props.selectedItem)) {\n dispatch({\n type: ControlledPropUpdatedSelectedItem,\n inputValue: props.itemToString(props.selectedItem)\n });\n }\n previousSelectedItemRef.current = state.selectedItem === previousSelectedItemRef.current ? props.selectedItem : state.selectedItem;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [state.selectedItem, props.selectedItem]);\n return [getState(state, props), dispatch];\n}\n\n// eslint-disable-next-line import/no-mutable-exports\nvar validatePropTypes$1 = noop;\n/* istanbul ignore next */\nif (process.env.NODE_ENV !== 'production') {\n validatePropTypes$1 = function validatePropTypes(options, caller) {\n PropTypes.checkPropTypes(propTypes$1, options, 'prop', caller.name);\n };\n}\nvar defaultProps$1 = _extends({}, defaultProps$3, {\n selectedItemChanged: function selectedItemChanged(prevItem, item) {\n return prevItem !== item;\n },\n getA11yStatusMessage: getA11yStatusMessage$1\n});\n\n/* eslint-disable complexity */\nfunction downshiftUseComboboxReducer(state, action) {\n var _props$items;\n var type = action.type,\n props = action.props,\n altKey = action.altKey;\n var changes;\n switch (type) {\n case ItemClick:\n changes = {\n isOpen: getDefaultValue$1(props, 'isOpen'),\n highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),\n selectedItem: props.items[action.index],\n inputValue: props.itemToString(props.items[action.index])\n };\n break;\n case InputKeyDownArrowDown:\n if (state.isOpen) {\n changes = {\n highlightedIndex: getNextWrappingIndex(1, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, true)\n };\n } else {\n changes = {\n highlightedIndex: altKey && state.selectedItem == null ? -1 : getHighlightedIndexOnOpen(props, state, 1, action.getItemNodeFromIndex),\n isOpen: props.items.length >= 0\n };\n }\n break;\n case InputKeyDownArrowUp:\n if (state.isOpen) {\n if (altKey) {\n changes = getChangesOnSelection(props, state.highlightedIndex);\n } else {\n changes = {\n highlightedIndex: getNextWrappingIndex(-1, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, true)\n };\n }\n } else {\n changes = {\n highlightedIndex: getHighlightedIndexOnOpen(props, state, -1, action.getItemNodeFromIndex),\n isOpen: props.items.length >= 0\n };\n }\n break;\n case InputKeyDownEnter:\n changes = getChangesOnSelection(props, state.highlightedIndex);\n break;\n case InputKeyDownEscape:\n changes = _extends({\n isOpen: false,\n highlightedIndex: -1\n }, !state.isOpen && {\n selectedItem: null,\n inputValue: ''\n });\n break;\n case InputKeyDownPageUp:\n changes = {\n highlightedIndex: getNextWrappingIndex(-10, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, false)\n };\n break;\n case InputKeyDownPageDown:\n changes = {\n highlightedIndex: getNextWrappingIndex(10, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, false)\n };\n break;\n case InputKeyDownHome:\n changes = {\n highlightedIndex: getNextNonDisabledIndex(1, 0, props.items.length, action.getItemNodeFromIndex, false)\n };\n break;\n case InputKeyDownEnd:\n changes = {\n highlightedIndex: getNextNonDisabledIndex(-1, props.items.length - 1, props.items.length, action.getItemNodeFromIndex, false)\n };\n break;\n case InputBlur:\n changes = _extends({\n isOpen: false,\n highlightedIndex: -1\n }, state.highlightedIndex >= 0 && ((_props$items = props.items) == null ? void 0 : _props$items.length) && action.selectItem && {\n selectedItem: props.items[state.highlightedIndex],\n inputValue: props.itemToString(props.items[state.highlightedIndex])\n });\n break;\n case InputChange:\n changes = {\n isOpen: true,\n highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),\n inputValue: action.inputValue\n };\n break;\n case InputFocus:\n changes = {\n isOpen: true,\n highlightedIndex: getHighlightedIndexOnOpen(props, state, 0)\n };\n break;\n case FunctionSelectItem:\n changes = {\n selectedItem: action.selectedItem,\n inputValue: props.itemToString(action.selectedItem)\n };\n break;\n case ControlledPropUpdatedSelectedItem:\n changes = {\n inputValue: action.inputValue\n };\n break;\n default:\n return downshiftCommonReducer(state, action, stateChangeTypes$1);\n }\n return _extends({}, state, changes);\n}\n/* eslint-enable complexity */\n\nvar _excluded$1 = [\"onMouseLeave\", \"refKey\", \"ref\"],\n _excluded2$1 = [\"item\", \"index\", \"refKey\", \"ref\", \"onMouseMove\", \"onMouseDown\", \"onClick\", \"onPress\", \"disabled\"],\n _excluded3 = [\"onClick\", \"onPress\", \"refKey\", \"ref\"],\n _excluded4 = [\"onKeyDown\", \"onChange\", \"onInput\", \"onFocus\", \"onBlur\", \"onChangeText\", \"refKey\", \"ref\"];\nuseCombobox.stateChangeTypes = stateChangeTypes$1;\nfunction useCombobox(userProps) {\n if (userProps === void 0) {\n userProps = {};\n }\n validatePropTypes$1(userProps, useCombobox);\n // Props defaults and destructuring.\n var props = _extends({}, defaultProps$1, userProps);\n var initialIsOpen = props.initialIsOpen,\n defaultIsOpen = props.defaultIsOpen,\n items = props.items,\n scrollIntoView = props.scrollIntoView,\n environment = props.environment,\n getA11yStatusMessage = props.getA11yStatusMessage,\n getA11ySelectionMessage = props.getA11ySelectionMessage,\n itemToString = props.itemToString;\n // Initial state depending on controlled props.\n var initialState = getInitialState$1(props);\n var _useControlledReducer = useControlledReducer(downshiftUseComboboxReducer, initialState, props),\n state = _useControlledReducer[0],\n dispatch = _useControlledReducer[1];\n var isOpen = state.isOpen,\n highlightedIndex = state.highlightedIndex,\n selectedItem = state.selectedItem,\n inputValue = state.inputValue;\n\n // Element refs.\n var menuRef = useRef(null);\n var itemRefs = useRef({});\n var inputRef = useRef(null);\n var toggleButtonRef = useRef(null);\n var isInitialMountRef = useRef(true);\n // prevent id re-generation between renders.\n var elementIds = useElementIds(props);\n // used to keep track of how many items we had on previous cycle.\n var previousResultCountRef = useRef();\n // utility callback to get item element.\n var latest = useLatestRef({\n state: state,\n props: props\n });\n var getItemNodeFromIndex = useCallback(function (index) {\n return itemRefs.current[elementIds.getItemId(index)];\n }, [elementIds]);\n\n // Effects.\n // Sets a11y status message on changes in state.\n useA11yMessageSetter(getA11yStatusMessage, [isOpen, highlightedIndex, inputValue, items], _extends({\n isInitialMount: isInitialMountRef.current,\n previousResultCount: previousResultCountRef.current,\n items: items,\n environment: environment,\n itemToString: itemToString\n }, state));\n // Sets a11y status message on changes in selectedItem.\n useA11yMessageSetter(getA11ySelectionMessage, [selectedItem], _extends({\n isInitialMount: isInitialMountRef.current,\n previousResultCount: previousResultCountRef.current,\n items: items,\n environment: environment,\n itemToString: itemToString\n }, state));\n // Scroll on highlighted item if change comes from keyboard.\n var shouldScrollRef = useScrollIntoView({\n menuElement: menuRef.current,\n highlightedIndex: highlightedIndex,\n isOpen: isOpen,\n itemRefs: itemRefs,\n scrollIntoView: scrollIntoView,\n getItemNodeFromIndex: getItemNodeFromIndex\n });\n useControlPropsValidator({\n isInitialMount: isInitialMountRef.current,\n props: props,\n state: state\n });\n // Focus the input on first render if required.\n useEffect(function () {\n var focusOnOpen = initialIsOpen || defaultIsOpen || isOpen;\n if (focusOnOpen && inputRef.current) {\n inputRef.current.focus();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n useEffect(function () {\n if (isInitialMountRef.current) {\n return;\n }\n previousResultCountRef.current = items.length;\n });\n // Add mouse/touch events to document.\n var mouseAndTouchTrackersRef = useMouseAndTouchTracker(isOpen, [inputRef, menuRef, toggleButtonRef], environment, function () {\n dispatch({\n type: InputBlur,\n selectItem: false\n });\n });\n var setGetterPropCallInfo = useGetterPropsCalledChecker('getInputProps', 'getMenuProps');\n // Make initial ref false.\n useEffect(function () {\n isInitialMountRef.current = false;\n return function () {\n isInitialMountRef.current = true;\n };\n }, []);\n // Reset itemRefs on close.\n useEffect(function () {\n var _environment$document;\n if (!isOpen) {\n itemRefs.current = {};\n } else if (((_environment$document = environment.document) == null ? void 0 : _environment$document.activeElement) !== inputRef.current) {\n var _inputRef$current;\n inputRef == null || (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();\n }\n }, [isOpen, environment]);\n\n /* Event handler functions */\n var inputKeyDownHandlers = useMemo(function () {\n return {\n ArrowDown: function ArrowDown(event) {\n event.preventDefault();\n dispatch({\n type: InputKeyDownArrowDown,\n altKey: event.altKey,\n getItemNodeFromIndex: getItemNodeFromIndex\n });\n },\n ArrowUp: function ArrowUp(event) {\n event.preventDefault();\n dispatch({\n type: InputKeyDownArrowUp,\n altKey: event.altKey,\n getItemNodeFromIndex: getItemNodeFromIndex\n });\n },\n Home: function Home(event) {\n if (!latest.current.state.isOpen) {\n return;\n }\n event.preventDefault();\n dispatch({\n type: InputKeyDownHome,\n getItemNodeFromIndex: getItemNodeFromIndex\n });\n },\n End: function End(event) {\n if (!latest.current.state.isOpen) {\n return;\n }\n event.preventDefault();\n dispatch({\n type: InputKeyDownEnd,\n getItemNodeFromIndex: getItemNodeFromIndex\n });\n },\n Escape: function Escape(event) {\n var latestState = latest.current.state;\n if (latestState.isOpen || latestState.inputValue || latestState.selectedItem || latestState.highlightedIndex > -1) {\n event.preventDefault();\n dispatch({\n type: InputKeyDownEscape\n });\n }\n },\n Enter: function Enter(event) {\n var latestState = latest.current.state;\n // if closed or no highlighted index, do nothing.\n if (!latestState.isOpen || event.which === 229 // if IME composing, wait for next Enter keydown event.\n ) {\n return;\n }\n event.preventDefault();\n dispatch({\n type: InputKeyDownEnter,\n getItemNodeFromIndex: getItemNodeFromIndex\n });\n },\n PageUp: function PageUp(event) {\n if (latest.current.state.isOpen) {\n event.preventDefault();\n dispatch({\n type: InputKeyDownPageUp,\n getItemNodeFromIndex: getItemNodeFromIndex\n });\n }\n },\n PageDown: function PageDown(event) {\n if (latest.current.state.isOpen) {\n event.preventDefault();\n dispatch({\n type: InputKeyDownPageDown,\n getItemNodeFromIndex: getItemNodeFromIndex\n });\n }\n }\n };\n }, [dispatch, latest, getItemNodeFromIndex]);\n\n // Getter props.\n var getLabelProps = useCallback(function (labelProps) {\n return _extends({\n id: elementIds.labelId,\n htmlFor: elementIds.inputId\n }, labelProps);\n }, [elementIds]);\n var getMenuProps = useCallback(function (_temp, _temp2) {\n var _extends2;\n var _ref = _temp === void 0 ? {} : _temp,\n onMouseLeave = _ref.onMouseLeave,\n _ref$refKey = _ref.refKey,\n refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey,\n ref = _ref.ref,\n rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);\n var _ref2 = _temp2 === void 0 ? {} : _temp2,\n _ref2$suppressRefErro = _ref2.suppressRefError,\n suppressRefError = _ref2$suppressRefErro === void 0 ? false : _ref2$suppressRefErro;\n setGetterPropCallInfo('getMenuProps', suppressRefError, refKey, menuRef);\n return _extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, function (menuNode) {\n menuRef.current = menuNode;\n }), _extends2.id = elementIds.menuId, _extends2.role = 'listbox', _extends2['aria-labelledby'] = rest && rest['aria-label'] ? undefined : \"\" + elementIds.labelId, _extends2.onMouseLeave = callAllEventHandlers(onMouseLeave, function () {\n dispatch({\n type: MenuMouseLeave\n });\n }), _extends2), rest);\n }, [dispatch, setGetterPropCallInfo, elementIds]);\n var getItemProps = useCallback(function (_temp3) {\n var _extends3, _ref4;\n var _ref3 = _temp3 === void 0 ? {} : _temp3,\n itemProp = _ref3.item,\n indexProp = _ref3.index,\n _ref3$refKey = _ref3.refKey,\n refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,\n ref = _ref3.ref,\n onMouseMove = _ref3.onMouseMove,\n onMouseDown = _ref3.onMouseDown,\n onClick = _ref3.onClick;\n _ref3.onPress;\n var disabled = _ref3.disabled,\n rest = _objectWithoutPropertiesLoose(_ref3, _excluded2$1);\n var _latest$current = latest.current,\n latestProps = _latest$current.props,\n latestState = _latest$current.state;\n var _getItemAndIndex = getItemAndIndex(itemProp, indexProp, latestProps.items, 'Pass either item or index to getItemProps!'),\n index = _getItemAndIndex[1];\n var onSelectKey = 'onClick';\n var customClickHandler = onClick;\n var itemHandleMouseMove = function itemHandleMouseMove() {\n if (index === latestState.highlightedIndex) {\n return;\n }\n shouldScrollRef.current = false;\n dispatch({\n type: ItemMouseMove,\n index: index,\n disabled: disabled\n });\n };\n var itemHandleClick = function itemHandleClick() {\n dispatch({\n type: ItemClick,\n index: index\n });\n };\n var itemHandleMouseDown = function itemHandleMouseDown(e) {\n return e.preventDefault();\n };\n return _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function (itemNode) {\n if (itemNode) {\n itemRefs.current[elementIds.getItemId(index)] = itemNode;\n }\n }), _extends3.disabled = disabled, _extends3.role = 'option', _extends3['aria-selected'] = \"\" + (index === latestState.highlightedIndex), _extends3.id = elementIds.getItemId(index), _extends3), !disabled && (_ref4 = {}, _ref4[onSelectKey] = callAllEventHandlers(customClickHandler, itemHandleClick), _ref4), {\n onMouseMove: callAllEventHandlers(onMouseMove, itemHandleMouseMove),\n onMouseDown: callAllEventHandlers(onMouseDown, itemHandleMouseDown)\n }, rest);\n }, [dispatch, latest, shouldScrollRef, elementIds]);\n var getToggleButtonProps = useCallback(function (_temp4) {\n var _extends4;\n var _ref5 = _temp4 === void 0 ? {} : _temp4,\n onClick = _ref5.onClick;\n _ref5.onPress;\n var _ref5$refKey = _ref5.refKey,\n refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,\n ref = _ref5.ref,\n rest = _objectWithoutPropertiesLoose(_ref5, _excluded3);\n var latestState = latest.current.state;\n var toggleButtonHandleClick = function toggleButtonHandleClick() {\n dispatch({\n type: ToggleButtonClick\n });\n };\n return _extends((_extends4 = {}, _extends4[refKey] = handleRefs(ref, function (toggleButtonNode) {\n toggleButtonRef.current = toggleButtonNode;\n }), _extends4['aria-controls'] = elementIds.menuId, _extends4['aria-expanded'] = latestState.isOpen, _extends4.id = elementIds.toggleButtonId, _extends4.tabIndex = -1, _extends4), !rest.disabled && _extends({}, {\n onClick: callAllEventHandlers(onClick, toggleButtonHandleClick)\n }), rest);\n }, [dispatch, latest, elementIds]);\n var getInputProps = useCallback(function (_temp5, _temp6) {\n var _extends5;\n var _ref6 = _temp5 === void 0 ? {} : _temp5,\n onKeyDown = _ref6.onKeyDown,\n onChange = _ref6.onChange,\n onInput = _ref6.onInput,\n onFocus = _ref6.onFocus,\n onBlur = _ref6.onBlur;\n _ref6.onChangeText;\n var _ref6$refKey = _ref6.refKey,\n refKey = _ref6$refKey === void 0 ? 'ref' : _ref6$refKey,\n ref = _ref6.ref,\n rest = _objectWithoutPropertiesLoose(_ref6, _excluded4);\n var _ref7 = _temp6 === void 0 ? {} : _temp6,\n _ref7$suppressRefErro = _ref7.suppressRefError,\n suppressRefError = _ref7$suppressRefErro === void 0 ? false : _ref7$suppressRefErro;\n setGetterPropCallInfo('getInputProps', suppressRefError, refKey, inputRef);\n var latestState = latest.current.state;\n var inputHandleKeyDown = function inputHandleKeyDown(event) {\n var key = normalizeArrowKey(event);\n if (key && inputKeyDownHandlers[key]) {\n inputKeyDownHandlers[key](event);\n }\n };\n var inputHandleChange = function inputHandleChange(event) {\n dispatch({\n type: InputChange,\n inputValue: event.target.value\n });\n };\n var inputHandleBlur = function inputHandleBlur(event) {\n /* istanbul ignore else */\n if (latestState.isOpen && !mouseAndTouchTrackersRef.current.isMouseDown) {\n var isBlurByTabChange = event.relatedTarget === null && environment.document.activeElement !== environment.document.body;\n dispatch({\n type: InputBlur,\n selectItem: !isBlurByTabChange\n });\n }\n };\n var inputHandleFocus = function inputHandleFocus() {\n if (!latestState.isOpen) {\n dispatch({\n type: InputFocus\n });\n }\n };\n\n /* istanbul ignore next (preact) */\n var onChangeKey = 'onChange';\n var eventHandlers = {};\n if (!rest.disabled) {\n var _eventHandlers;\n eventHandlers = (_eventHandlers = {}, _eventHandlers[onChangeKey] = callAllEventHandlers(onChange, onInput, inputHandleChange), _eventHandlers.onKeyDown = callAllEventHandlers(onKeyDown, inputHandleKeyDown), _eventHandlers.onBlur = callAllEventHandlers(onBlur, inputHandleBlur), _eventHandlers.onFocus = callAllEventHandlers(onFocus, inputHandleFocus), _eventHandlers);\n }\n return _extends((_extends5 = {}, _extends5[refKey] = handleRefs(ref, function (inputNode) {\n inputRef.current = inputNode;\n }), _extends5['aria-activedescendant'] = latestState.isOpen && latestState.highlightedIndex > -1 ? elementIds.getItemId(latestState.highlightedIndex) : '', _extends5['aria-autocomplete'] = 'list', _extends5['aria-controls'] = elementIds.menuId, _extends5['aria-expanded'] = latestState.isOpen, _extends5['aria-labelledby'] = rest && rest['aria-label'] ? undefined : \"\" + elementIds.labelId, _extends5.autoComplete = 'off', _extends5.id = elementIds.inputId, _extends5.role = 'combobox', _extends5.value = latestState.inputValue, _extends5), eventHandlers, rest);\n }, [setGetterPropCallInfo, latest, elementIds, inputKeyDownHandlers, dispatch, mouseAndTouchTrackersRef, environment]);\n\n // returns\n var toggleMenu = useCallback(function () {\n dispatch({\n type: FunctionToggleMenu\n });\n }, [dispatch]);\n var closeMenu = useCallback(function () {\n dispatch({\n type: FunctionCloseMenu\n });\n }, [dispatch]);\n var openMenu = useCallback(function () {\n dispatch({\n type: FunctionOpenMenu\n });\n }, [dispatch]);\n var setHighlightedIndex = useCallback(function (newHighlightedIndex) {\n dispatch({\n type: FunctionSetHighlightedIndex,\n highlightedIndex: newHighlightedIndex\n });\n }, [dispatch]);\n var selectItem = useCallback(function (newSelectedItem) {\n dispatch({\n type: FunctionSelectItem,\n selectedItem: newSelectedItem\n });\n }, [dispatch]);\n var setInputValue = useCallback(function (newInputValue) {\n dispatch({\n type: FunctionSetInputValue,\n inputValue: newInputValue\n });\n }, [dispatch]);\n var reset = useCallback(function () {\n dispatch({\n type: FunctionReset$1\n });\n }, [dispatch]);\n return {\n // prop getters.\n getItemProps: getItemProps,\n getLabelProps: getLabelProps,\n getMenuProps: getMenuProps,\n getInputProps: getInputProps,\n getToggleButtonProps: getToggleButtonProps,\n // actions.\n toggleMenu: toggleMenu,\n openMenu: openMenu,\n closeMenu: closeMenu,\n setHighlightedIndex: setHighlightedIndex,\n setInputValue: setInputValue,\n selectItem: selectItem,\n reset: reset,\n // state.\n highlightedIndex: highlightedIndex,\n isOpen: isOpen,\n selectedItem: selectedItem,\n inputValue: inputValue\n };\n}\n\nvar defaultStateValues = {\n activeIndex: -1,\n selectedItems: []\n};\n\n/**\n * Returns the initial value for a state key in the following order:\n * 1. controlled prop, 2. initial prop, 3. default prop, 4. default\n * value from Downshift.\n *\n * @param {Object} props Props passed to the hook.\n * @param {string} propKey Props key to generate the value for.\n * @returns {any} The initial value for that prop.\n */\nfunction getInitialValue(props, propKey) {\n return getInitialValue$1(props, propKey, defaultStateValues);\n}\n\n/**\n * Returns the default value for a state key in the following order:\n * 1. controlled prop, 2. default prop, 3. default value from Downshift.\n *\n * @param {Object} props Props passed to the hook.\n * @param {string} propKey Props key to generate the value for.\n * @returns {any} The initial value for that prop.\n */\nfunction getDefaultValue(props, propKey) {\n return getDefaultValue$1(props, propKey, defaultStateValues);\n}\n\n/**\n * Gets the initial state based on the provided props. It uses initial, default\n * and controlled props related to state in order to compute the initial value.\n *\n * @param {Object} props Props passed to the hook.\n * @returns {Object} The initial state.\n */\nfunction getInitialState(props) {\n var activeIndex = getInitialValue(props, 'activeIndex');\n var selectedItems = getInitialValue(props, 'selectedItems');\n return {\n activeIndex: activeIndex,\n selectedItems: selectedItems\n };\n}\n\n/**\n * Returns true if dropdown keydown operation is permitted. Should not be\n * allowed on keydown with modifier keys (ctrl, alt, shift, meta), on\n * input element with text content that is either highlighted or selection\n * cursor is not at the starting position.\n *\n * @param {KeyboardEvent} event The event from keydown.\n * @returns {boolean} Whether the operation is allowed.\n */\nfunction isKeyDownOperationPermitted(event) {\n if (event.shiftKey || event.metaKey || event.ctrlKey || event.altKey) {\n return false;\n }\n var element = event.target;\n if (element instanceof HTMLInputElement &&\n // if element is a text input\n element.value !== '' && (\n // and we have text in it\n // and cursor is either not at the start or is currently highlighting text.\n element.selectionStart !== 0 || element.selectionEnd !== 0)) {\n return false;\n }\n return true;\n}\n\n/**\n * Returns a message to be added to aria-live region when item is removed.\n *\n * @param {Object} selectionParameters Parameters required to build the message.\n * @returns {string} The a11y message.\n */\nfunction getA11yRemovalMessage(selectionParameters) {\n var removedSelectedItem = selectionParameters.removedSelectedItem,\n itemToStringLocal = selectionParameters.itemToString;\n return itemToStringLocal(removedSelectedItem) + \" has been removed.\";\n}\nvar propTypes = {\n selectedItems: PropTypes.array,\n initialSelectedItems: PropTypes.array,\n defaultSelectedItems: PropTypes.array,\n itemToString: PropTypes.func,\n getA11yRemovalMessage: PropTypes.func,\n stateReducer: PropTypes.func,\n activeIndex: PropTypes.number,\n initialActiveIndex: PropTypes.number,\n defaultActiveIndex: PropTypes.number,\n onActiveIndexChange: PropTypes.func,\n onSelectedItemsChange: PropTypes.func,\n keyNavigationNext: PropTypes.string,\n keyNavigationPrevious: PropTypes.string,\n environment: PropTypes.shape({\n addEventListener: PropTypes.func,\n removeEventListener: PropTypes.func,\n document: PropTypes.shape({\n getElementById: PropTypes.func,\n activeElement: PropTypes.any,\n body: PropTypes.any\n })\n })\n};\nvar defaultProps = {\n itemToString: defaultProps$3.itemToString,\n stateReducer: defaultProps$3.stateReducer,\n environment: defaultProps$3.environment,\n getA11yRemovalMessage: getA11yRemovalMessage,\n keyNavigationNext: 'ArrowRight',\n keyNavigationPrevious: 'ArrowLeft'\n};\n\n// eslint-disable-next-line import/no-mutable-exports\nvar validatePropTypes = noop;\n/* istanbul ignore next */\nif (process.env.NODE_ENV !== 'production') {\n validatePropTypes = function validatePropTypes(options, caller) {\n PropTypes.checkPropTypes(propTypes, options, 'prop', caller.name);\n };\n}\n\nvar SelectedItemClick = process.env.NODE_ENV !== \"production\" ? '__selected_item_click__' : 0;\nvar SelectedItemKeyDownDelete = process.env.NODE_ENV !== \"production\" ? '__selected_item_keydown_delete__' : 1;\nvar SelectedItemKeyDownBackspace = process.env.NODE_ENV !== \"production\" ? '__selected_item_keydown_backspace__' : 2;\nvar SelectedItemKeyDownNavigationNext = process.env.NODE_ENV !== \"production\" ? '__selected_item_keydown_navigation_next__' : 3;\nvar SelectedItemKeyDownNavigationPrevious = process.env.NODE_ENV !== \"production\" ? '__selected_item_keydown_navigation_previous__' : 4;\nvar DropdownKeyDownNavigationPrevious = process.env.NODE_ENV !== \"production\" ? '__dropdown_keydown_navigation_previous__' : 5;\nvar DropdownKeyDownBackspace = process.env.NODE_ENV !== \"production\" ? '__dropdown_keydown_backspace__' : 6;\nvar DropdownClick = process.env.NODE_ENV !== \"production\" ? '__dropdown_click__' : 7;\nvar FunctionAddSelectedItem = process.env.NODE_ENV !== \"production\" ? '__function_add_selected_item__' : 8;\nvar FunctionRemoveSelectedItem = process.env.NODE_ENV !== \"production\" ? '__function_remove_selected_item__' : 9;\nvar FunctionSetSelectedItems = process.env.NODE_ENV !== \"production\" ? '__function_set_selected_items__' : 10;\nvar FunctionSetActiveIndex = process.env.NODE_ENV !== \"production\" ? '__function_set_active_index__' : 11;\nvar FunctionReset = process.env.NODE_ENV !== \"production\" ? '__function_reset__' : 12;\n\nvar stateChangeTypes = /*#__PURE__*/Object.freeze({\n __proto__: null,\n SelectedItemClick: SelectedItemClick,\n SelectedItemKeyDownDelete: SelectedItemKeyDownDelete,\n SelectedItemKeyDownBackspace: SelectedItemKeyDownBackspace,\n SelectedItemKeyDownNavigationNext: SelectedItemKeyDownNavigationNext,\n SelectedItemKeyDownNavigationPrevious: SelectedItemKeyDownNavigationPrevious,\n DropdownKeyDownNavigationPrevious: DropdownKeyDownNavigationPrevious,\n DropdownKeyDownBackspace: DropdownKeyDownBackspace,\n DropdownClick: DropdownClick,\n FunctionAddSelectedItem: FunctionAddSelectedItem,\n FunctionRemoveSelectedItem: FunctionRemoveSelectedItem,\n FunctionSetSelectedItems: FunctionSetSelectedItems,\n FunctionSetActiveIndex: FunctionSetActiveIndex,\n FunctionReset: FunctionReset\n});\n\n/* eslint-disable complexity */\nfunction downshiftMultipleSelectionReducer(state, action) {\n var type = action.type,\n index = action.index,\n props = action.props,\n selectedItem = action.selectedItem;\n var activeIndex = state.activeIndex,\n selectedItems = state.selectedItems;\n var changes;\n switch (type) {\n case SelectedItemClick:\n changes = {\n activeIndex: index\n };\n break;\n case SelectedItemKeyDownNavigationPrevious:\n changes = {\n activeIndex: activeIndex - 1 < 0 ? 0 : activeIndex - 1\n };\n break;\n case SelectedItemKeyDownNavigationNext:\n changes = {\n activeIndex: activeIndex + 1 >= selectedItems.length ? -1 : activeIndex + 1\n };\n break;\n case SelectedItemKeyDownBackspace:\n case SelectedItemKeyDownDelete:\n {\n if (activeIndex < 0) {\n break;\n }\n var newActiveIndex = activeIndex;\n if (selectedItems.length === 1) {\n newActiveIndex = -1;\n } else if (activeIndex === selectedItems.length - 1) {\n newActiveIndex = selectedItems.length - 2;\n }\n changes = _extends({\n selectedItems: [].concat(selectedItems.slice(0, activeIndex), selectedItems.slice(activeIndex + 1))\n }, {\n activeIndex: newActiveIndex\n });\n break;\n }\n case DropdownKeyDownNavigationPrevious:\n changes = {\n activeIndex: selectedItems.length - 1\n };\n break;\n case DropdownKeyDownBackspace:\n changes = {\n selectedItems: selectedItems.slice(0, selectedItems.length - 1)\n };\n break;\n case FunctionAddSelectedItem:\n changes = {\n selectedItems: [].concat(selectedItems, [selectedItem])\n };\n break;\n case DropdownClick:\n changes = {\n activeIndex: -1\n };\n break;\n case FunctionRemoveSelectedItem:\n {\n var _newActiveIndex = activeIndex;\n var selectedItemIndex = selectedItems.indexOf(selectedItem);\n if (selectedItemIndex < 0) {\n break;\n }\n if (selectedItems.length === 1) {\n _newActiveIndex = -1;\n } else if (selectedItemIndex === selectedItems.length - 1) {\n _newActiveIndex = selectedItems.length - 2;\n }\n changes = {\n selectedItems: [].concat(selectedItems.slice(0, selectedItemIndex), selectedItems.slice(selectedItemIndex + 1)),\n activeIndex: _newActiveIndex\n };\n break;\n }\n case FunctionSetSelectedItems:\n {\n var newSelectedItems = action.selectedItems;\n changes = {\n selectedItems: newSelectedItems\n };\n break;\n }\n case FunctionSetActiveIndex:\n {\n var _newActiveIndex2 = action.activeIndex;\n changes = {\n activeIndex: _newActiveIndex2\n };\n break;\n }\n case FunctionReset:\n changes = {\n activeIndex: getDefaultValue(props, 'activeIndex'),\n selectedItems: getDefaultValue(props, 'selectedItems')\n };\n break;\n default:\n throw new Error('Reducer called without proper action type.');\n }\n return _extends({}, state, changes);\n}\n\nvar _excluded = [\"refKey\", \"ref\", \"onClick\", \"onKeyDown\", \"selectedItem\", \"index\"],\n _excluded2 = [\"refKey\", \"ref\", \"onKeyDown\", \"onClick\", \"preventKeyAction\"];\nuseMultipleSelection.stateChangeTypes = stateChangeTypes;\nfunction useMultipleSelection(userProps) {\n if (userProps === void 0) {\n userProps = {};\n }\n validatePropTypes(userProps, useMultipleSelection);\n // Props defaults and destructuring.\n var props = _extends({}, defaultProps, userProps);\n var getA11yRemovalMessage = props.getA11yRemovalMessage,\n itemToString = props.itemToString,\n environment = props.environment,\n keyNavigationNext = props.keyNavigationNext,\n keyNavigationPrevious = props.keyNavigationPrevious;\n\n // Reducer init.\n var _useControlledReducer = useControlledReducer$1(downshiftMultipleSelectionReducer, getInitialState(props), props),\n state = _useControlledReducer[0],\n dispatch = _useControlledReducer[1];\n var activeIndex = state.activeIndex,\n selectedItems = state.selectedItems;\n\n // Refs.\n var isInitialMountRef = useRef(true);\n var dropdownRef = useRef(null);\n var previousSelectedItemsRef = useRef(selectedItems);\n var selectedItemRefs = useRef();\n selectedItemRefs.current = [];\n var latest = useLatestRef({\n state: state,\n props: props\n });\n\n // Effects.\n /* Sets a11y status message on changes in selectedItem. */\n useEffect(function () {\n if (isInitialMountRef.current || false) {\n return;\n }\n if (selectedItems.length < previousSelectedItemsRef.current.length) {\n var removedSelectedItem = previousSelectedItemsRef.current.find(function (item) {\n return selectedItems.indexOf(item) < 0;\n });\n setStatus(getA11yRemovalMessage({\n itemToString: itemToString,\n resultCount: selectedItems.length,\n removedSelectedItem: removedSelectedItem,\n activeIndex: activeIndex,\n activeSelectedItem: selectedItems[activeIndex]\n }), environment.document);\n }\n previousSelectedItemsRef.current = selectedItems;\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedItems.length]);\n // Sets focus on active item.\n useEffect(function () {\n if (isInitialMountRef.current) {\n return;\n }\n if (activeIndex === -1 && dropdownRef.current) {\n dropdownRef.current.focus();\n } else if (selectedItemRefs.current[activeIndex]) {\n selectedItemRefs.current[activeIndex].focus();\n }\n }, [activeIndex]);\n useControlPropsValidator({\n isInitialMount: isInitialMountRef.current,\n props: props,\n state: state\n });\n var setGetterPropCallInfo = useGetterPropsCalledChecker('getDropdownProps');\n // Make initial ref false.\n useEffect(function () {\n isInitialMountRef.current = false;\n return function () {\n isInitialMountRef.current = true;\n };\n }, []);\n\n // Event handler functions.\n var selectedItemKeyDownHandlers = useMemo(function () {\n var _ref;\n return _ref = {}, _ref[keyNavigationPrevious] = function () {\n dispatch({\n type: SelectedItemKeyDownNavigationPrevious\n });\n }, _ref[keyNavigationNext] = function () {\n dispatch({\n type: SelectedItemKeyDownNavigationNext\n });\n }, _ref.Delete = function Delete() {\n dispatch({\n type: SelectedItemKeyDownDelete\n });\n }, _ref.Backspace = function Backspace() {\n dispatch({\n type: SelectedItemKeyDownBackspace\n });\n }, _ref;\n }, [dispatch, keyNavigationNext, keyNavigationPrevious]);\n var dropdownKeyDownHandlers = useMemo(function () {\n var _ref2;\n return _ref2 = {}, _ref2[keyNavigationPrevious] = function (event) {\n if (isKeyDownOperationPermitted(event)) {\n dispatch({\n type: DropdownKeyDownNavigationPrevious\n });\n }\n }, _ref2.Backspace = function Backspace(event) {\n if (isKeyDownOperationPermitted(event)) {\n dispatch({\n type: DropdownKeyDownBackspace\n });\n }\n }, _ref2;\n }, [dispatch, keyNavigationPrevious]);\n\n // Getter props.\n var getSelectedItemProps = useCallback(function (_temp) {\n var _extends2;\n var _ref3 = _temp === void 0 ? {} : _temp,\n _ref3$refKey = _ref3.refKey,\n refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,\n ref = _ref3.ref,\n onClick = _ref3.onClick,\n onKeyDown = _ref3.onKeyDown,\n selectedItemProp = _ref3.selectedItem,\n indexProp = _ref3.index,\n rest = _objectWithoutPropertiesLoose(_ref3, _excluded);\n var latestState = latest.current.state;\n var _getItemAndIndex = getItemAndIndex(selectedItemProp, indexProp, latestState.selectedItems, 'Pass either item or index to getSelectedItemProps!'),\n index = _getItemAndIndex[1];\n var isFocusable = index > -1 && index === latestState.activeIndex;\n var selectedItemHandleClick = function selectedItemHandleClick() {\n dispatch({\n type: SelectedItemClick,\n index: index\n });\n };\n var selectedItemHandleKeyDown = function selectedItemHandleKeyDown(event) {\n var key = normalizeArrowKey(event);\n if (key && selectedItemKeyDownHandlers[key]) {\n selectedItemKeyDownHandlers[key](event);\n }\n };\n return _extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, function (selectedItemNode) {\n if (selectedItemNode) {\n selectedItemRefs.current.push(selectedItemNode);\n }\n }), _extends2.tabIndex = isFocusable ? 0 : -1, _extends2.onClick = callAllEventHandlers(onClick, selectedItemHandleClick), _extends2.onKeyDown = callAllEventHandlers(onKeyDown, selectedItemHandleKeyDown), _extends2), rest);\n }, [dispatch, latest, selectedItemKeyDownHandlers]);\n var getDropdownProps = useCallback(function (_temp2, _temp3) {\n var _extends3;\n var _ref4 = _temp2 === void 0 ? {} : _temp2,\n _ref4$refKey = _ref4.refKey,\n refKey = _ref4$refKey === void 0 ? 'ref' : _ref4$refKey,\n ref = _ref4.ref,\n onKeyDown = _ref4.onKeyDown,\n onClick = _ref4.onClick,\n _ref4$preventKeyActio = _ref4.preventKeyAction,\n preventKeyAction = _ref4$preventKeyActio === void 0 ? false : _ref4$preventKeyActio,\n rest = _objectWithoutPropertiesLoose(_ref4, _excluded2);\n var _ref5 = _temp3 === void 0 ? {} : _temp3,\n _ref5$suppressRefErro = _ref5.suppressRefError,\n suppressRefError = _ref5$suppressRefErro === void 0 ? false : _ref5$suppressRefErro;\n setGetterPropCallInfo('getDropdownProps', suppressRefError, refKey, dropdownRef);\n var dropdownHandleKeyDown = function dropdownHandleKeyDown(event) {\n var key = normalizeArrowKey(event);\n if (key && dropdownKeyDownHandlers[key]) {\n dropdownKeyDownHandlers[key](event);\n }\n };\n var dropdownHandleClick = function dropdownHandleClick() {\n dispatch({\n type: DropdownClick\n });\n };\n return _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function (dropdownNode) {\n if (dropdownNode) {\n dropdownRef.current = dropdownNode;\n }\n }), _extends3), !preventKeyAction && {\n onKeyDown: callAllEventHandlers(onKeyDown, dropdownHandleKeyDown),\n onClick: callAllEventHandlers(onClick, dropdownHandleClick)\n }, rest);\n }, [dispatch, dropdownKeyDownHandlers, setGetterPropCallInfo]);\n\n // returns\n var addSelectedItem = useCallback(function (selectedItem) {\n dispatch({\n type: FunctionAddSelectedItem,\n selectedItem: selectedItem\n });\n }, [dispatch]);\n var removeSelectedItem = useCallback(function (selectedItem) {\n dispatch({\n type: FunctionRemoveSelectedItem,\n selectedItem: selectedItem\n });\n }, [dispatch]);\n var setSelectedItems = useCallback(function (newSelectedItems) {\n dispatch({\n type: FunctionSetSelectedItems,\n selectedItems: newSelectedItems\n });\n }, [dispatch]);\n var setActiveIndex = useCallback(function (newActiveIndex) {\n dispatch({\n type: FunctionSetActiveIndex,\n activeIndex: newActiveIndex\n });\n }, [dispatch]);\n var reset = useCallback(function () {\n dispatch({\n type: FunctionReset\n });\n }, [dispatch]);\n return {\n getSelectedItemProps: getSelectedItemProps,\n getDropdownProps: getDropdownProps,\n addSelectedItem: addSelectedItem,\n removeSelectedItem: removeSelectedItem,\n setSelectedItems: setSelectedItems,\n setActiveIndex: setActiveIndex,\n reset: reset,\n selectedItems: selectedItems,\n activeIndex: activeIndex\n };\n}\n\nexport { Downshift$1 as default, resetIdCounter, useCombobox, useMultipleSelection, useSelect };\n"],"names":["idCounter","noop","isOrContainsNode","parent","child","environment","Node","contains","debounce","fn","time","timeoutId","cancel","clearTimeout","wrapper","_len","arguments","length","args","Array","_key","setTimeout","apply","callAllEventHandlers","_len2","fns","_key2","event","_len3","_key3","some","concat","preventDownshiftDefault","hasOwnProperty","nativeEvent","handleRefs","_len4","refs","_key4","node","forEach","ref","current","getState","state","props","Object","keys","reduce","prevState","key","isControlledProp","undefined","getNextWrappingIndex","moveAmount","baseIndex","itemCount","getItemNodeFromIndex","circular","itemsLastIndex","newIndex","nonDisabledNewIndex","getNextNonDisabledIndex","currentElementNode","hasAttribute","index","_index","targetWithinDownshift","target","downshiftElements","checkActiveElement","contextNode","document","activeElement","cleanupStatus","documentProp","getStatusDiv","textContent","statusDiv","getElementById","createElement","setAttribute","assign","style","border","clip","height","margin","overflow","padding","position","width","body","appendChild","_excluded$3","dropdownDefaultStateValues","highlightedIndex","isOpen","selectedItem","inputValue","updateA11yStatus","getA11yMessage","status","div","useIsomorphicLayoutEffect","window","useLayoutEffect","useEffect","useElementIds","_ref","_ref$id","id","String","labelId","menuId","getItemId","toggleButtonId","inputId","useRef","capitalizeString","string","slice","toUpperCase","useLatestRef","val","useEnhancedReducer","reducer","initialState","prevStateRef","actionRef","enhancedReducer","useCallback","action","changes","stateReducer","_useReducer","useReducer","dispatch","propsRef","dispatchWithProps","newState","type","handler","invokeOnChangeHandler","onStateChange","callOnChangeProps","defaultProps$3","itemToString","item","s","a","getA11ySelectionMessage","selectionParameters","itemToStringLocal","scrollIntoView","menuNode","boundary","block","scrollMode","el","top","left","scrollTop","scrollLeft","getDefaultValue$1","propKey","defaultStateValues","defaultValue","getInitialValue$1","value","initialValue","getHighlightedIndexOnOpen","offset","items","initialHighlightedIndex","defaultHighlightedIndex","indexOf","useGetterPropsCalledChecker","useA11yMessageSetter","dependencyArray","_ref2","isInitialMount","rest","highlightedItem","resultCount","useControlPropsValidator","getChangesOnSelection","_props$items","shouldSelect","isRequired","addEventListener","removeEventListener","getA11yStatusMessage","_a","previousResultCount","InputKeyDownArrowDown","InputKeyDownArrowUp","InputKeyDownEscape","InputKeyDownHome","InputKeyDownEnd","InputKeyDownPageUp","InputKeyDownPageDown","InputKeyDownEnter","InputChange","InputBlur","InputFocus","MenuMouseLeave","ItemMouseMove","ItemClick","ToggleButtonClick","FunctionToggleMenu","FunctionOpenMenu","FunctionCloseMenu","FunctionSetHighlightedIndex","FunctionSelectItem","FunctionSetInputValue","FunctionReset$1","ControlledPropUpdatedSelectedItem","stateChangeTypes$1","freeze","__proto__","FunctionReset","validatePropTypes$1","defaultProps$1","selectedItemChanged","prevItem","downshiftUseComboboxReducer","altKey","selectItem","stateChangeTypes","disabled","Error","downshiftCommonReducer","_excluded$1","_excluded2$1","_excluded3","_excluded4","useCombobox","userProps","initialIsOpen","defaultIsOpen","getInitialState$2","defaultInputValue","initialInputValue","getInitialState$1","_useControlledReducer","previousSelectedItemRef","_useEnhancedReducer","useControlledReducer","menuRef","itemRefs","inputRef","toggleButtonRef","isInitialMountRef","elementIds","previousResultCountRef","latest","shouldScrollRef","_ref3","menuElement","scrollIntoViewProp","useScrollIntoView","focus","mouseAndTouchTrackersRef","downshiftElementRefs","handleBlur","isMouseDown","isTouchMove","onMouseDown","onMouseUp","map","onTouchStart","onTouchMove","onTouchEnd","useMouseAndTouchTracker","setGetterPropCallInfo","_environment$document","_inputRef$current","inputKeyDownHandlers","useMemo","ArrowDown","preventDefault","ArrowUp","Home","End","Escape","latestState","Enter","which","PageUp","PageDown","getLabelProps","labelProps","htmlFor","getMenuProps","_temp","_temp2","_extends2","onMouseLeave","_ref$refKey","refKey","_ref2$suppressRefErro","suppressRefError","role","getItemProps","_temp3","_extends3","_ref4","itemProp","indexProp","_ref3$refKey","onMouseMove","onClick","onPress","_latest$current","latestProps","errorMessage","getItemAndIndex","customClickHandler","itemNode","e","getToggleButtonProps","_temp4","_extends4","_ref5","_ref5$refKey","toggleButtonNode","tabIndex","getInputProps","_temp5","_temp6","_extends5","_ref6","onKeyDown","onChange","onInput","onFocus","onBlur","onChangeText","_ref6$refKey","_ref7$suppressRefErro","_eventHandlers","eventHandlers","keyCode","normalizeArrowKey","isBlurByTabChange","relatedTarget","inputNode","autoComplete","toggleMenu","closeMenu","openMenu","setHighlightedIndex","newHighlightedIndex","newSelectedItem","setInputValue","newInputValue","reset"],"sourceRoot":""}