"use strict";

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

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

var _get = _interopRequireDefault(require("lodash/get"));

var _VocabularyPage = _interopRequireDefault(require("../../components/pages/VocabularyPage"));

var _prefs = require("../../actions/prefs");

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

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

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

const mapStateToProps = (state, ownProps) => {
  const {
    match
  } = ownProps;
  const csid = (0, _get.default)(match, ['params', 'csid']);
  const data = csid && csid !== 'new' ? (0, _reducers.getRecordData)(state, csid) : undefined;
  return {
    data,
    perms: (0, _reducers.getUserPerms)(state)
  };
};

const mapDispatchToProps = {
  readVocabularyItemRefs: _vocabulary.readVocabularyItemRefs,
  setToolTab: _prefs.setToolTab
};

var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_VocabularyPage.default);

exports.default = _default;