'use strict';

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

var _immutable = require('immutable');

var _presenter = require('./presenter');

var _presenter2 = _interopRequireDefault(_presenter);

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

var _stateHelper = require('../../../../common/util/stateHelper');

var _stateHelper2 = _interopRequireDefault(_stateHelper);

var _quizzes = require('../../../../common/api/quizzes');

var _itemAnalyses = require('../../../../reporting/api/itemAnalyses');

var _quizAnalyses = require('../../../../reporting/api/quizAnalyses');

var _reporting = require('../../../../common/actions/reporting');

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

function mapStateToProps(state, props) {
  var helper = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _stateHelper2.default;

  return {
    openRows: state.getIn(['reporting', 'item_analysis_row_open'], (0, _immutable.Map)()).toJS(),
    quizAnalysisNotFound: state.getIn(['reporting', 'quiz_analysis', props.activeQuizId, 'notFound'], false),
    quiz: helper.activeQuiz(),
    outcomesEndpoint: state.getIn(['outcomes', 'outcomesEndpoint']),
    outcomesToken: state.getIn(['outcomes', 'outcomesToken'])
  };
}

exports.default = (0, _reactRedux.connect)(mapStateToProps, {
  getExistingQuiz: _quizzes.getExistingQuiz,
  getItemAnalyses: _itemAnalyses.getItemAnalyses,
  getQuizAnalysis: _quizAnalyses.getQuizAnalysis,
  toggleItemAnalysisRowExpanded: _reporting.toggleItemAnalysisRowExpanded
})(_presenter2.default);