"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

exports.__esModule = true;
exports.Aggregates = Aggregates;

var _react = _interopRequireDefault(require("react"));

var _lib = require("@sentecacommerce-theme/lib");

var _Components = require("./Components");

var filtersMap = {
  checkbox: _Components.CheckboxFilter,
  color: _Components.ColorFilter,
  autocomplete: _Components.AutocompleteFilter,
  dropdown: _Components.DropdownSelectFilter,
  'attribute-checkbox': _Components.CheckboxFilter,
  'range-checkbox': _Components.CheckboxFilter,
  'text-with-link': _Components.TextWithLinkFilter,
  'range-slider': _Components.SlideFilter
};

var EmptyFilter = function EmptyFilter() {
  return null;
};

function Aggregates(_ref) {
  var data = _ref.data;
  var labels = (0, _lib.useLocalLabels)();
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_Components.SelectedFilters, {
    isInModal: true,
    data: data
  }), data == null ? void 0 : data.map(function (filter) {
    var Component = /*#__PURE__*/_react["default"].memo(filtersMap[filter.component] || EmptyFilter);

    return /*#__PURE__*/_react["default"].createElement(Component, {
      key: "Aggregate__" + filter.name + "-" + filter.type,
      data: filter,
      labels: labels
    });
  }));
}
//# sourceMappingURL=index.js.map