"use strict";

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

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

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

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

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

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

const mapStateToProps = (state, ownProps) => {
  const {
    source
  } = ownProps;
  const vocabulary = (0, _reducers.getVocabulary)(state, source);
  return {
    perms: (0, _reducers.getUserPerms)(state),
    terms: vocabulary ? vocabulary.items : null
  };
};

const mapDispatchToProps = {
  readTerms: _vocabulary.readVocabularyItems
};
const ConnectedTermPickerInput = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_TermPickerInput.default);
ConnectedTermPickerInput.propTypes = _TermPickerInput.default.propTypes;
var _default = ConnectedTermPickerInput;
exports.default = _default;