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MAAM,aAAa,GACpC,KAAK,SAAS,CACZ,QAAQ,EACR,iBAAkB,OACjB,WAED,EAAO,KAAK,MAAM,kBAAkB,EAAM,OAAQ,EAAM,QACxD,EAAO,MAAM,SAAS,EAAO,EAC/B,GACF,CACF,EACA,OAAQ,WAEN,KAAK,eAAc,GACnB,KAAK,SAAS,CACZ,iBAAkB,KAClB,QAAQ,GAEZ,EACA,IAAK,WAEH,KAAK,eAAc,EACrB,GAIF,OAAO,QAAU","file":"/npm/react-autocomplete@1.8.1/build/lib/Autocomplete.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/react-autocomplete@1.8.1/build/lib/Autocomplete.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict';\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar React = require('react');\nvar PropTypes = require('prop-types');\n\nvar _require = require('react-dom'),\n    findDOMNode = _require.findDOMNode;\n\nvar scrollIntoView = require('dom-scroll-into-view');\n\nvar IMPERATIVE_API = ['blur', 'checkValidity', 'click', 'focus', 'select', 'setCustomValidity', 'setSelectionRange', 'setRangeText'];\n\nfunction getScrollOffset() {\n  return {\n    x: window.pageXOffset !== undefined ? window.pageXOffset : (document.documentElement || document.body.parentNode || document.body).scrollLeft,\n    y: window.pageYOffset !== undefined ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop\n  };\n}\n\nvar Autocomplete = function (_React$Component) {\n  _inherits(Autocomplete, _React$Component);\n\n  function Autocomplete(props) {\n    _classCallCheck(this, Autocomplete);\n\n    var _this = _possibleConstructorReturn(this, (Autocomplete.__proto__ || Object.getPrototypeOf(Autocomplete)).call(this, props));\n\n    _this.state = {\n      isOpen: false,\n      highlightedIndex: null\n    };\n    _this._debugStates = [];\n    _this.ensureHighlightedIndex = _this.ensureHighlightedIndex.bind(_this);\n    _this.exposeAPI = _this.exposeAPI.bind(_this);\n    _this.handleInputFocus = _this.handleInputFocus.bind(_this);\n    _this.handleInputBlur = _this.handleInputBlur.bind(_this);\n    _this.handleChange = _this.handleChange.bind(_this);\n    _this.handleKeyDown = _this.handleKeyDown.bind(_this);\n    _this.handleInputClick = _this.handleInputClick.bind(_this);\n    _this.maybeAutoCompleteText = _this.maybeAutoCompleteText.bind(_this);\n    return _this;\n  }\n\n  _createClass(Autocomplete, [{\n    key: 'componentWillMount',\n    value: function componentWillMount() {\n      // this.refs is frozen, so we need to assign a new object to it\n      this.refs = {};\n      this._ignoreBlur = false;\n      this._ignoreFocus = false;\n      this._scrollOffset = null;\n      this._scrollTimer = null;\n    }\n  }, {\n    key: 'componentWillUnmount',\n    value: function componentWillUnmount() {\n      clearTimeout(this._scrollTimer);\n      this._scrollTimer = null;\n    }\n  }, {\n    key: 'componentWillReceiveProps',\n    value: function componentWillReceiveProps(nextProps) {\n      if (this.state.highlightedIndex !== null) {\n        this.setState(this.ensureHighlightedIndex);\n      }\n      if (nextProps.autoHighlight && (this.props.value !== nextProps.value || this.state.highlightedIndex === null)) {\n        this.setState(this.maybeAutoCompleteText);\n      }\n    }\n  }, {\n    key: 'componentDidMount',\n    value: function componentDidMount() {\n      if (this.isOpen()) {\n        this.setMenuPositions();\n      }\n    }\n  }, {\n    key: 'componentDidUpdate',\n    value: function componentDidUpdate(prevProps, prevState) {\n      if (this.state.isOpen && !prevState.isOpen || 'open' in this.props && this.props.open && !prevProps.open) this.setMenuPositions();\n\n      this.maybeScrollItemIntoView();\n      if (prevState.isOpen !== this.state.isOpen) {\n        this.props.onMenuVisibilityChange(this.state.isOpen);\n      }\n    }\n  }, {\n    key: 'exposeAPI',\n    value: function exposeAPI(el) {\n      var _this2 = this;\n\n      this.refs.input = el;\n      IMPERATIVE_API.forEach(function (ev) {\n        return _this2[ev] = el && el[ev] && el[ev].bind(el);\n      });\n    }\n  }, {\n    key: 'maybeScrollItemIntoView',\n    value: function maybeScrollItemIntoView() {\n      if (this.isOpen() && this.state.highlightedIndex !== null) {\n        var itemNode = this.refs['item-' + this.state.highlightedIndex];\n        var menuNode = this.refs.menu;\n        scrollIntoView(findDOMNode(itemNode), findDOMNode(menuNode), { onlyScrollIfNeeded: true });\n      }\n    }\n  }, {\n    key: 'handleKeyDown',\n    value: function handleKeyDown(event) {\n      if (Autocomplete.keyDownHandlers[event.key]) Autocomplete.keyDownHandlers[event.key].call(this, event);else if (!this.isOpen()) {\n        this.setState({\n          isOpen: true\n        });\n      }\n    }\n  }, {\n    key: 'handleChange',\n    value: function handleChange(event) {\n      this.props.onChange(event, event.target.value);\n    }\n  }, {\n    key: 'getFilteredItems',\n    value: function getFilteredItems(props) {\n      var items = props.items;\n\n      if (props.shouldItemRender) {\n        items = items.filter(function (item) {\n          return props.shouldItemRender(item, props.value);\n        });\n      }\n\n      if (props.sortItems) {\n        items.sort(function (a, b) {\n          return props.sortItems(a, b, props.value);\n        });\n      }\n\n      return items;\n    }\n  }, {\n    key: 'maybeAutoCompleteText',\n    value: function maybeAutoCompleteText(state, props) {\n      var highlightedIndex = state.highlightedIndex;\n      var value = props.value,\n          getItemValue = props.getItemValue;\n\n      var index = highlightedIndex === null ? 0 : highlightedIndex;\n      var items = this.getFilteredItems(props);\n      for (var i = 0; i < items.length; i++) {\n        if (props.isItemSelectable(items[index])) break;\n        index = (index + 1) % items.length;\n      }\n      var matchedItem = items[index] && props.isItemSelectable(items[index]) ? items[index] : null;\n      if (value !== '' && matchedItem) {\n        var itemValue = getItemValue(matchedItem);\n        var itemValueDoesMatch = itemValue.toLowerCase().indexOf(value.toLowerCase()) === 0;\n        if (itemValueDoesMatch) {\n          return { highlightedIndex: index };\n        }\n      }\n      return { highlightedIndex: null };\n    }\n  }, {\n    key: 'ensureHighlightedIndex',\n    value: function ensureHighlightedIndex(state, props) {\n      if (state.highlightedIndex >= this.getFilteredItems(props).length) {\n        return { highlightedIndex: null };\n      }\n    }\n  }, {\n    key: 'setMenuPositions',\n    value: function setMenuPositions() {\n      var node = this.refs.input;\n      var rect = node.getBoundingClientRect();\n      var computedStyle = global.window.getComputedStyle(node);\n      var marginBottom = parseInt(computedStyle.marginBottom, 10) || 0;\n      var marginLeft = parseInt(computedStyle.marginLeft, 10) || 0;\n      var marginRight = parseInt(computedStyle.marginRight, 10) || 0;\n      this.setState({\n        menuTop: rect.bottom + marginBottom,\n        menuLeft: rect.left + marginLeft,\n        menuWidth: rect.width + marginLeft + marginRight\n      });\n    }\n  }, {\n    key: 'highlightItemFromMouse',\n    value: function highlightItemFromMouse(index) {\n      this.setState({ highlightedIndex: index });\n    }\n  }, {\n    key: 'selectItemFromMouse',\n    value: function selectItemFromMouse(item) {\n      var _this3 = this;\n\n      var value = this.props.getItemValue(item);\n      // The menu will de-render before a mouseLeave event\n      // happens. Clear the flag to release control over focus\n      this.setIgnoreBlur(false);\n      this.setState({\n        isOpen: false,\n        highlightedIndex: null\n      }, function () {\n        _this3.props.onSelect(value, item);\n      });\n    }\n  }, {\n    key: 'setIgnoreBlur',\n    value: function setIgnoreBlur(ignore) {\n      this._ignoreBlur = ignore;\n    }\n  }, {\n    key: 'renderMenu',\n    value: function renderMenu() {\n      var _this4 = this;\n\n      var items = this.getFilteredItems(this.props).map(function (item, index) {\n        var element = _this4.props.renderItem(item, _this4.state.highlightedIndex === index, { cursor: 'default' });\n        return React.cloneElement(element, {\n          onMouseEnter: _this4.props.isItemSelectable(item) ? function () {\n            return _this4.highlightItemFromMouse(index);\n          } : null,\n          onClick: _this4.props.isItemSelectable(item) ? function () {\n            return _this4.selectItemFromMouse(item);\n          } : null,\n          ref: function ref(e) {\n            return _this4.refs['item-' + index] = e;\n          }\n        });\n      });\n      var style = {\n        left: this.state.menuLeft,\n        top: this.state.menuTop,\n        minWidth: this.state.menuWidth\n      };\n      var menu = this.props.renderMenu(items, this.props.value, style);\n      return React.cloneElement(menu, {\n        ref: function ref(e) {\n          return _this4.refs.menu = e;\n        },\n        // Ignore blur to prevent menu from de-rendering before we can process click\n        onTouchStart: function onTouchStart() {\n          return _this4.setIgnoreBlur(true);\n        },\n        onMouseEnter: function onMouseEnter() {\n          return _this4.setIgnoreBlur(true);\n        },\n        onMouseLeave: function onMouseLeave() {\n          return _this4.setIgnoreBlur(false);\n        }\n      });\n    }\n  }, {\n    key: 'handleInputBlur',\n    value: function handleInputBlur(event) {\n      var _this5 = this;\n\n      if (this._ignoreBlur) {\n        this._ignoreFocus = true;\n        this._scrollOffset = getScrollOffset();\n        this.refs.input.focus();\n        return;\n      }\n      var setStateCallback = void 0;\n      var highlightedIndex = this.state.highlightedIndex;\n\n      if (this.props.selectOnBlur && highlightedIndex !== null) {\n        var items = this.getFilteredItems(this.props);\n        var item = items[highlightedIndex];\n        var value = this.props.getItemValue(item);\n        setStateCallback = function setStateCallback() {\n          return _this5.props.onSelect(value, item);\n        };\n      }\n      this.setState({\n        isOpen: false,\n        highlightedIndex: null\n      }, setStateCallback);\n      var onBlur = this.props.inputProps.onBlur;\n\n      if (onBlur) {\n        onBlur(event);\n      }\n    }\n  }, {\n    key: 'handleInputFocus',\n    value: function handleInputFocus(event) {\n      var _this6 = this;\n\n      if (this._ignoreFocus) {\n        this._ignoreFocus = false;\n        var _scrollOffset = this._scrollOffset,\n            x = _scrollOffset.x,\n            y = _scrollOffset.y;\n\n        this._scrollOffset = null;\n        // Focus will cause the browser to scroll the <input> into view.\n        // This can cause the mouse coords to change, which in turn\n        // could cause a new highlight to happen, cancelling the click\n        // event (when selecting with the mouse)\n        window.scrollTo(x, y);\n        // Some browsers wait until all focus event handlers have been\n        // processed before scrolling the <input> into view, so let's\n        // scroll again on the next tick to ensure we're back to where\n        // the user was before focus was lost. We could do the deferred\n        // scroll only, but that causes a jarring split second jump in\n        // some browsers that scroll before the focus event handlers\n        // are triggered.\n        clearTimeout(this._scrollTimer);\n        this._scrollTimer = setTimeout(function () {\n          _this6._scrollTimer = null;\n          window.scrollTo(x, y);\n        }, 0);\n        return;\n      }\n      this.setState({ isOpen: true });\n      var onFocus = this.props.inputProps.onFocus;\n\n      if (onFocus) {\n        onFocus(event);\n      }\n    }\n  }, {\n    key: 'isInputFocused',\n    value: function isInputFocused() {\n      var el = this.refs.input;\n      return el.ownerDocument && el === el.ownerDocument.activeElement;\n    }\n  }, {\n    key: 'handleInputClick',\n    value: function handleInputClick() {\n      // Input will not be focused if it's disabled\n      if (this.isInputFocused() && !this.isOpen()) this.setState({ isOpen: true });\n    }\n  }, {\n    key: 'composeEventHandlers',\n    value: function composeEventHandlers(internal, external) {\n      return external ? function (e) {\n        internal(e);external(e);\n      } : internal;\n    }\n  }, {\n    key: 'isOpen',\n    value: function isOpen() {\n      return 'open' in this.props ? this.props.open : this.state.isOpen;\n    }\n  }, {\n    key: 'render',\n    value: function render() {\n      if (this.props.debug) {\n        // you don't like it, you love it\n        this._debugStates.push({\n          id: this._debugStates.length,\n          state: this.state\n        });\n      }\n\n      var inputProps = this.props.inputProps;\n\n      var open = this.isOpen();\n      return React.createElement(\n        'div',\n        _extends({ style: _extends({}, this.props.wrapperStyle) }, this.props.wrapperProps),\n        this.props.renderInput(_extends({}, inputProps, {\n          role: 'combobox',\n          'aria-autocomplete': 'list',\n          'aria-expanded': open,\n          autoComplete: 'off',\n          ref: this.exposeAPI,\n          onFocus: this.handleInputFocus,\n          onBlur: this.handleInputBlur,\n          onChange: this.handleChange,\n          onKeyDown: this.composeEventHandlers(this.handleKeyDown, inputProps.onKeyDown),\n          onClick: this.composeEventHandlers(this.handleInputClick, inputProps.onClick),\n          value: this.props.value\n        })),\n        open && this.renderMenu(),\n        this.props.debug && React.createElement(\n          'pre',\n          { style: { marginLeft: 300 } },\n          JSON.stringify(this._debugStates.slice(Math.max(0, this._debugStates.length - 5), this._debugStates.length), null, 2)\n        )\n      );\n    }\n  }]);\n\n  return Autocomplete;\n}(React.Component);\n\nAutocomplete.propTypes = {\n  /**\n   * The items to display in the dropdown menu\n   */\n  items: PropTypes.array.isRequired,\n  /**\n   * The value to display in the input field\n   */\n  value: PropTypes.any,\n  /**\n   * Arguments: `event: Event, value: String`\n   *\n   * Invoked every time the user changes the input's value.\n   */\n  onChange: PropTypes.func,\n  /**\n   * Arguments: `value: String, item: Any`\n   *\n   * Invoked when the user selects an item from the dropdown menu.\n   */\n  onSelect: PropTypes.func,\n  /**\n   * Arguments: `item: Any, value: String`\n   *\n   * Invoked for each entry in `items` and its return value is used to\n   * determine whether or not it should be displayed in the dropdown menu.\n   * By default all items are always rendered.\n   */\n  shouldItemRender: PropTypes.func,\n  /**\n   * Arguments: `item: Any`\n   *\n   * Invoked when attempting to select an item. The return value is used to\n   * determine whether the item should be selectable or not.\n   * By default all items are selectable.\n   */\n  isItemSelectable: PropTypes.func,\n  /**\n   * Arguments: `itemA: Any, itemB: Any, value: String`\n   *\n   * The function which is used to sort `items` before display.\n   */\n  sortItems: PropTypes.func,\n  /**\n   * Arguments: `item: Any`\n   *\n   * Used to read the display value from each entry in `items`.\n   */\n  getItemValue: PropTypes.func.isRequired,\n  /**\n   * Arguments: `item: Any, isHighlighted: Boolean, styles: Object`\n   *\n   * Invoked for each entry in `items` that also passes `shouldItemRender` to\n   * generate the render tree for each item in the dropdown menu. `styles` is\n   * an optional set of styles that can be applied to improve the look/feel\n   * of the items in the dropdown menu.\n   */\n  renderItem: PropTypes.func.isRequired,\n  /**\n   * Arguments: `items: Array<Any>, value: String, styles: Object`\n   *\n   * Invoked to generate the render tree for the dropdown menu. Ensure the\n   * returned tree includes every entry in `items` or else the highlight order\n   * and keyboard navigation logic will break. `styles` will contain\n   * { top, left, minWidth } which are the coordinates of the top-left corner\n   * and the width of the dropdown menu.\n   */\n  renderMenu: PropTypes.func,\n  /**\n   * Styles that are applied to the dropdown menu in the default `renderMenu`\n   * implementation. If you override `renderMenu` and you want to use\n   * `menuStyle` you must manually apply them (`this.props.menuStyle`).\n   */\n  menuStyle: PropTypes.object,\n  /**\n   * Arguments: `props: Object`\n   *\n   * Invoked to generate the input element. The `props` argument is the result\n   * of merging `props.inputProps` with a selection of props that are required\n   * both for functionality and accessibility. At the very least you need to\n   * apply `props.ref` and all `props.on<event>` event handlers. Failing to do\n   * this will cause `Autocomplete` to behave unexpectedly.\n   */\n  renderInput: PropTypes.func,\n  /**\n   * Props passed to `props.renderInput`. By default these props will be\n   * applied to the `<input />` element rendered by `Autocomplete`, unless you\n   * have specified a custom value for `props.renderInput`. Any properties\n   * supported by `HTMLInputElement` can be specified, apart from the\n   * following which are set by `Autocomplete`: value, autoComplete, role,\n   * aria-autocomplete. `inputProps` is commonly used for (but not limited to)\n   * placeholder, event handlers (onFocus, onBlur, etc.), autoFocus, etc..\n   */\n  inputProps: PropTypes.object,\n  /**\n   * Props that are applied to the element which wraps the `<input />` and\n   * dropdown menu elements rendered by `Autocomplete`.\n   */\n  wrapperProps: PropTypes.object,\n  /**\n   * This is a shorthand for `wrapperProps={{ style: <your styles> }}`.\n   * Note that `wrapperStyle` is applied before `wrapperProps`, so the latter\n   * will win if it contains a `style` entry.\n   */\n  wrapperStyle: PropTypes.object,\n  /**\n   * Whether or not to automatically highlight the top match in the dropdown\n   * menu.\n   */\n  autoHighlight: PropTypes.bool,\n  /**\n   * Whether or not to automatically select the highlighted item when the\n   * `<input>` loses focus.\n   */\n  selectOnBlur: PropTypes.bool,\n  /**\n   * Arguments: `isOpen: Boolean`\n   *\n   * Invoked every time the dropdown menu's visibility changes (i.e. every\n   * time it is displayed/hidden).\n   */\n  onMenuVisibilityChange: PropTypes.func,\n  /**\n   * Used to override the internal logic which displays/hides the dropdown\n   * menu. This is useful if you want to force a certain state based on your\n   * UX/business logic. Use it together with `onMenuVisibilityChange` for\n   * fine-grained control over the dropdown menu dynamics.\n   */\n  open: PropTypes.bool,\n  debug: PropTypes.bool\n};\nAutocomplete.defaultProps = {\n  value: '',\n  wrapperProps: {},\n  wrapperStyle: {\n    display: 'inline-block'\n  },\n  inputProps: {},\n  renderInput: function renderInput(props) {\n    return React.createElement('input', props);\n  },\n  onChange: function onChange() {},\n  onSelect: function onSelect() {},\n  isItemSelectable: function isItemSelectable() {\n    return true;\n  },\n  renderMenu: function renderMenu(items, value, style) {\n    return React.createElement('div', { style: _extends({}, style, this.menuStyle), children: items });\n  },\n\n  menuStyle: {\n    borderRadius: '3px',\n    boxShadow: '0 2px 12px rgba(0, 0, 0, 0.1)',\n    background: 'rgba(255, 255, 255, 0.9)',\n    padding: '2px 0',\n    fontSize: '90%',\n    position: 'fixed',\n    overflow: 'auto',\n    maxHeight: '50%' },\n  autoHighlight: true,\n  selectOnBlur: false,\n  onMenuVisibilityChange: function onMenuVisibilityChange() {}\n};\nAutocomplete.keyDownHandlers = {\n  ArrowDown: function ArrowDown(event) {\n    event.preventDefault();\n    var items = this.getFilteredItems(this.props);\n    if (!items.length) return;\n    var highlightedIndex = this.state.highlightedIndex;\n\n    var index = highlightedIndex === null ? -1 : highlightedIndex;\n    for (var i = 0; i < items.length; i++) {\n      var p = (index + i + 1) % items.length;\n      if (this.props.isItemSelectable(items[p])) {\n        index = p;\n        break;\n      }\n    }\n    if (index > -1 && index !== highlightedIndex) {\n      this.setState({\n        highlightedIndex: index,\n        isOpen: true\n      });\n    }\n  },\n  ArrowUp: function ArrowUp(event) {\n    event.preventDefault();\n    var items = this.getFilteredItems(this.props);\n    if (!items.length) return;\n    var highlightedIndex = this.state.highlightedIndex;\n\n    var index = highlightedIndex === null ? items.length : highlightedIndex;\n    for (var i = 0; i < items.length; i++) {\n      var p = (index - (1 + i) + items.length) % items.length;\n      if (this.props.isItemSelectable(items[p])) {\n        index = p;\n        break;\n      }\n    }\n    if (index !== items.length) {\n      this.setState({\n        highlightedIndex: index,\n        isOpen: true\n      });\n    }\n  },\n  Enter: function Enter(event) {\n    var _this7 = this;\n\n    // Key code 229 is used for selecting items from character selectors (Pinyin, Kana, etc)\n    if (event.keyCode !== 13) return;\n    // In case the user is currently hovering over the menu\n    this.setIgnoreBlur(false);\n    if (!this.isOpen()) {\n      // menu is closed so there is no selection to accept -> do nothing\n      return;\n    } else if (this.state.highlightedIndex == null) {\n      // input has focus but no menu item is selected + enter is hit -> close the menu, highlight whatever's in input\n      this.setState({\n        isOpen: false\n      }, function () {\n        _this7.refs.input.select();\n      });\n    } else {\n      // text entered + menu item has been highlighted + enter is hit -> update value to that of selected menu item, close the menu\n      event.preventDefault();\n      var item = this.getFilteredItems(this.props)[this.state.highlightedIndex];\n      var value = this.props.getItemValue(item);\n      this.setState({\n        isOpen: false,\n        highlightedIndex: null\n      }, function () {\n        //this.refs.input.focus() // TODO: file issue\n        _this7.refs.input.setSelectionRange(value.length, value.length);\n        _this7.props.onSelect(value, item);\n      });\n    }\n  },\n  Escape: function Escape() {\n    // In case the user is currently hovering over the menu\n    this.setIgnoreBlur(false);\n    this.setState({\n      highlightedIndex: null,\n      isOpen: false\n    });\n  },\n  Tab: function Tab() {\n    // In case the user is currently hovering over the menu\n    this.setIgnoreBlur(false);\n  }\n};\n\n\nmodule.exports = Autocomplete;"]}