"use strict";

exports.__esModule = true;
exports["default"] = void 0;
var _lodash = require("lodash");
var _reselect = require("reselect");
var _arrayUtils = require("../utils/arrayUtils");
var _editorUtils = require("../utils/editorUtils");
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
var _default = (0, _reselect.createSelector)(function () {
  return window.localStorage.getItem("customEnzymes");
}, function (state, additionalEnzymes) {
  return additionalEnzymes;
}, function (customEnzymesString, additionalEnzymes) {
  return (0, _arrayUtils.getLowerCaseObj)((0, _lodash.pickBy)(_extends({}, additionalEnzymes, (0, _editorUtils.getCustomEnzymes)(customEnzymesString)), function (val, key) {
    if (!val) {
      console.error("43ti3523: Error: Missing enzyme data for key: ", key, "Ignoring this enzyme");
      return false;
    }

    // eslint-disable-next-line no-unused-vars
    for (var _i = 0, _arr = ["forwardRegex", "reverseRegex", "topSnipOffset", "bottomSnipOffset", "site"]; _i < _arr.length; _i++) {
      var prop = _arr[_i];
      if (val[prop] === undefined || val[prop] === null) {
        console.error("23483g93h Error: Missing property " + prop + " for enzyme " + key + ". Ignoring this enzyme");
        return false;
      }
    }
    return true;
  }));
});
exports["default"] = _default;
module.exports = exports.default;