"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _reactRedux = require("react-redux");

var _actions = require("../../Application/Navigation/actions");

var _reducer = require("../Modal/reducer");

var _component = _interopRequireDefault(require("./component"));

var _reducer2 = require("./reducer");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

var mapStateToProps = function mapStateToProps(_ref) {
  var navigation = _ref.navigation,
      overlay = _ref.overlay;
  var showNavigation = navigation.showNavigation;
  var activeOverlays = overlay.activeOverlays;
  return {
    showNavigation: showNavigation,
    activeOverlays: activeOverlays
  };
};

var mergeProps = function mergeProps(state, _ref2) {
  var dispatch = _ref2.dispatch;
  var showNavigation = state.showNavigation;
  return _objectSpread({}, state, {
    onOverlayOpen: function onOverlayOpen() {
      dispatch((0, _reducer2.overlayShow)());
    },
    onOverlayHideAll: function onOverlayHideAll() {
      dispatch((0, _reducer2.overlayHideAll)());
      dispatch((0, _reducer.overlayModalsHideAll)());
      showNavigation && dispatch((0, _actions.navigationToggle)());
    }
  });
};

var _default = (0, _reactRedux.connect)(mapStateToProps, undefined, mergeProps)(_component.default);

exports.default = _default;