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); }
import { forEach } from "lodash";
import { createSelector } from "reselect";
import { defaultEnzymesByName, aliasedEnzymesByName } from "@teselagen/sequence-utils";
export default createSelector(function () {
  return defaultEnzymesByName;
}, function (state, additionalEnzymes) {
  return additionalEnzymes;
}, function () {
  return localStorage.getItem("enzymeGroups");
},
//it should recompute if the enzyme groups change in localstorage
function (defaultEnzymesByName, additionalEnzymes) {
  var enzymesFromGroups = {};
  forEach(window.getExistingEnzymeGroups(), function (group) {
    forEach(group, function (enzymeName) {
      var enzyme = _extends({}, aliasedEnzymesByName, additionalEnzymes)[enzymeName.toLowerCase()];
      if (!enzyme) {
        console.warn("ruh roh, no enzyme found for: ", enzymeName);
      } else {
        enzymesFromGroups[enzymeName.toLowerCase()] = enzyme;
      }
    });
  });
  return _extends({}, defaultEnzymesByName, additionalEnzymes, enzymesFromGroups);
});