'use strict';

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

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

var _vocabulary = require('../../actions/vocabulary');

var _reducers = require('../../reducers');

var _TermPickerInput = require('../../components/record/TermPickerInput');

var _TermPickerInput2 = _interopRequireDefault(_TermPickerInput);

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

var mapStateToProps = function mapStateToProps(state, ownProps) {
  var source = ownProps.source;


  var vocabulary = (0, _reducers.getVocabulary)(state, source);

  return {
    perms: (0, _reducers.getUserPerms)(state),
    terms: vocabulary ? vocabulary.items : null
  };
};

var mapDispatchToProps = {
  readTerms: _vocabulary.readVocabularyItems
};

var ConnectedTermPickerInput = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_TermPickerInput2.default);

ConnectedTermPickerInput.propTypes = _TermPickerInput2.default.propTypes;

exports.default = ConnectedTermPickerInput;