"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _reactRedux = require("react-redux");
var _SearchResultTraverser = _interopRequireDefault(require("../../components/search/SearchResultTraverser"));
var _searchHelpers = require("../../helpers/searchHelpers");
var _search = require("../../actions/search");
var _reducers = require("../../reducers");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const mapStateToProps = (state, ownProps) => {
  const {
    searchName,
    searchDescriptor
  } = ownProps;
  const nextPageSearchDescriptor = (0, _searchHelpers.getNextPageSearchDescriptor)(searchDescriptor);
  const prevPageSearchDescriptor = (0, _searchHelpers.getPreviousPageSearchDescriptor)(searchDescriptor);
  return {
    nextPageSearchDescriptor,
    prevPageSearchDescriptor,
    searchState: (0, _reducers.getSearchState)(state, searchName, searchDescriptor),
    nextPageSearchState: (0, _reducers.getSearchState)(state, searchName, nextPageSearchDescriptor),
    prevPageSearchState: prevPageSearchDescriptor ? (0, _reducers.getSearchState)(state, searchName, prevPageSearchDescriptor) : undefined
  };
};
const mapDispatchToProps = {
  search: _search.search
};
var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_SearchResultTraverser.default);
exports.default = _default;