'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.mapDispatchToProps = exports.mapStateToProps = undefined;
var _default_enIE_number = Intl.NumberFormat('en-IE', { style: 'decimal' }).format;

var _redux = require('redux');

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

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

var _presenter2 = _interopRequireDefault(_presenter);

var _scrolling = require('../../../../actions/scrolling');

var _formatMessage = require('../../../../format-message');

var _formatMessage2 = _interopRequireDefault(_formatMessage);

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

var mapStateToProps = exports.mapStateToProps = function mapStateToProps(state, props) {
  var displayPosition = props.quizEntry ? props.quizEntry.positionToDisplay(props.position) : _default_enIE_number(props.position);

  return {
    displayPosition: displayPosition
  };
};

var mapDispatchToProps = exports.mapDispatchToProps = function mapDispatchToProps(dispatch, props) {
  return {
    scrollToItem: props.scrollToItem || (0, _redux.bindActionCreators)(_scrolling.scrollToItem, dispatch)
  };
};

exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_presenter2.default);