var _createMergedDefaultS;
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 createAction from "./utils/createMetaAction";
import createMergedDefaultStateReducer from "./utils/createMergedDefaultStateReducer";

// ------------------------------------
// Actions
// ------------------------------------
export var toggleFindTool = createAction("TOGGLE_FIND_TOOL", function () {}); //NOTE!!:: second argument sanitizes actions so no payload is passed!
export var toggleHighlightAll = createAction("toggleHighlightAll", function () {}); //NOTE!!:: second argument sanitizes actions so no payload is passed!
export var toggleIsInline = createAction("toggleIsInline", function () {}); //NOTE!!:: second argument sanitizes actions so no payload is passed!
export var updateSearchText = createAction("updateSearchText");
export var updateAmbiguousOrLiteral = createAction("updateAmbiguousOrLiteral");
export var updateDnaOrAA = createAction("updateDnaOrAA");
export var updateMatchNumber = createAction("updateMatchNumber");

// ------------------------------------
// Reducer
// ------------------------------------
export default createMergedDefaultStateReducer((_createMergedDefaultS = {}, _createMergedDefaultS[toggleFindTool] = function (state) {
  return _extends({}, state, {
    isOpen: !state.isOpen
  });
}, _createMergedDefaultS[toggleHighlightAll] = function (state) {
  return _extends({}, state, {
    highlightAll: !state.highlightAll
  });
}, _createMergedDefaultS[toggleIsInline] = function (state) {
  localStorage.setItem("veFindBarIsExpanded", state.isInline);
  return _extends({}, state, {
    isInline: !state.isInline
  });
}, _createMergedDefaultS[updateAmbiguousOrLiteral] = function (state, payload) {
  return _extends({}, state, {
    matchNumber: 0,
    ambiguousOrLiteral: payload
  });
}, _createMergedDefaultS[updateDnaOrAA] = function (state, payload) {
  return _extends({}, state, {
    matchNumber: 0,
    dnaOrAA: payload
  });
}, _createMergedDefaultS[updateSearchText] = function (state, payload) {
  return _extends({}, state, {
    matchNumber: 0,
    searchText: payload
  });
}, _createMergedDefaultS[updateMatchNumber] = function (state, payload) {
  return _extends({}, state, {
    matchNumber: payload
  });
}, _createMergedDefaultS), {
  isOpen: false,
  isInline: !localStorage.getItem("veFindBarIsExpanded"),
  searchText: "",
  dnaOrAA: "DNA",
  ambiguousOrLiteral: "LITERAL",
  highlightAll: false,
  matchNumber: 0
});