'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
var React = require('react');
var usePathMaps = require('./usePathMaps.js');
var filterItems = require('../utils/filterItems.js');

var useComboboxItems = function useComboboxItems(_ref) {
  var items = _ref.items,
    textValue = _ref.textValue,
    currentLabel = _ref.currentLabel,
    filter = _ref.filter;
  var filteredItems = React.useMemo(function () {
    return filterItems.filterItems(items, textValue, currentLabel, filter);
  }, [currentLabel, filter, items, textValue]);
  var _useNavigationMaps = usePathMaps.useNavigationMaps(filteredItems),
    _useNavigationMaps2 = _rollupPluginBabelHelpers.slicedToArray(_useNavigationMaps, 3),
    filteredPathMap = _useNavigationMaps2[0],
    filteredFocusedToValueMap = _useNavigationMaps2[1],
    filteredValueToPathMap = _useNavigationMaps2[2];
  return {
    filteredItems: filteredItems,
    filteredMaps: {
      pathMap: filteredPathMap,
      focusedToValueMap: filteredFocusedToValueMap,
      valueToPathMap: filteredValueToPathMap
    }
  };
};

exports.useComboboxItems = useComboboxItems;
