"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireWildcard(require("react"));
var _reactRedux = require("react-redux");
var _ui = require("@redux-devtools/ui");
var _Slider = _interopRequireDefault(require("./monitors/Slider"));
var _actions = require("../actions");
var _instances = require("../reducers/instances");
var _DevTools = _interopRequireDefault(require("../containers/DevTools"));
var _Dispatcher = _interopRequireDefault(require("./monitors/Dispatcher"));
var _TopButtons = _interopRequireDefault(require("../components/TopButtons"));
var _BottomButtons = _interopRequireDefault(require("../components/BottomButtons"));
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
class Actions extends _react.Component {
  render() {
    const {
      monitor,
      dispatcherIsOpen,
      sliderIsOpen,
      options,
      liftedState,
      liftedDispatch,
      stateTreeSettings
    } = this.props;
    return /*#__PURE__*/_react.default.createElement(_ui.Container, null, /*#__PURE__*/_react.default.createElement(_TopButtons.default, {
      dispatch: liftedDispatch,
      liftedState: liftedState,
      options: options
    }), /*#__PURE__*/_react.default.createElement(_DevTools.default, {
      monitor: monitor,
      liftedState: liftedState,
      monitorState: this.props.monitorState,
      dispatch: liftedDispatch,
      features: options.features,
      stateTreeSettings: stateTreeSettings
    }), sliderIsOpen && options.connectionId && options.features.jump && /*#__PURE__*/_react.default.createElement(_Slider.default, {
      liftedState: liftedState,
      dispatch: liftedDispatch
    }), dispatcherIsOpen && options.connectionId && options.features.dispatch && /*#__PURE__*/_react.default.createElement(_Dispatcher.default, {
      options: options
    }), /*#__PURE__*/_react.default.createElement(_BottomButtons.default, {
      dispatcherIsOpen: dispatcherIsOpen,
      sliderIsOpen: sliderIsOpen,
      options: options
    }));
  }
}
const mapStateToProps = state => {
  const instances = state.instances;
  const id = (0, _instances.getActiveInstance)(instances);
  return {
    liftedState: instances.states[id],
    monitorState: state.monitor.monitorState,
    options: instances.options[id],
    monitor: state.monitor.selected,
    dispatcherIsOpen: state.monitor.dispatcherIsOpen,
    sliderIsOpen: state.monitor.sliderIsOpen,
    reports: state.reports.data,
    stateTreeSettings: state.stateTreeSettings
  };
};
const actionCreators = {
  liftedDispatch: _actions.liftedDispatch,
  getReport: _actions.getReport
};
var _default = exports.default = (0, _reactRedux.connect)(mapStateToProps, actionCreators)(Actions);