"use strict";

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

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

var _presenter = _interopRequireDefault(require("./presenter"));

var _reactRedux = require("../../../../../../common/react-redux");

var _modifications = require("../../../../../../common/actions/modifications");

var _quizEntries = require("../../../../../api/quizEntries");

function mapStateToProps(state, props) {
  var workingQuizEntry = props.quizEntry.getWorkingInstance();
  var properties = workingQuizEntry.properties;
  var sampleNum = properties.get('sampleNum');
  var selection = sampleNum > 0 ? 'rand' : 'all';
  return {
    workingBank: workingQuizEntry.getEntry(),
    workingQuizEntry: workingQuizEntry,
    questionSelection: properties.get('selection', selection),
    sampleNum: sampleNum,
    pointsPossible: workingQuizEntry.pointsPossible
  };
}

var _default = (0, _reactRedux.connect)(mapStateToProps, {
  changeQuizEntryPoints: _modifications.changeQuizEntryPoints,
  changeQuizEntryProperties: _modifications.changeQuizEntryProperties,
  changeQuizEntryEntry: _modifications.changeQuizEntryEntry,
  clearModifications: _modifications.clearModifications,
  updateQuizEntry: _quizEntries.updateQuizEntry
})(_presenter.default);

exports.default = _default;