"use strict";

exports.__esModule = true;
exports.updateSearchText = exports.updateMatchNumber = exports.updateDnaOrAA = exports.updateAmbiguousOrLiteral = exports.toggleIsInline = exports.toggleHighlightAll = exports.toggleFindTool = exports["default"] = void 0;
var _createMetaAction = _interopRequireDefault(require("./utils/createMetaAction"));
var _createMergedDefaultStateReducer = _interopRequireDefault(require("./utils/createMergedDefaultStateReducer"));
var _createMergedDefaultS;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
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); }
// ------------------------------------
// Actions
// ------------------------------------
var toggleFindTool = (0, _createMetaAction["default"])("TOGGLE_FIND_TOOL", function () {}); //NOTE!!:: second argument sanitizes actions so no payload is passed!
exports.toggleFindTool = toggleFindTool;
var toggleHighlightAll = (0, _createMetaAction["default"])("toggleHighlightAll", function () {}); //NOTE!!:: second argument sanitizes actions so no payload is passed!
exports.toggleHighlightAll = toggleHighlightAll;
var toggleIsInline = (0, _createMetaAction["default"])("toggleIsInline", function () {}); //NOTE!!:: second argument sanitizes actions so no payload is passed!
exports.toggleIsInline = toggleIsInline;
var updateSearchText = (0, _createMetaAction["default"])("updateSearchText");
exports.updateSearchText = updateSearchText;
var updateAmbiguousOrLiteral = (0, _createMetaAction["default"])("updateAmbiguousOrLiteral");
exports.updateAmbiguousOrLiteral = updateAmbiguousOrLiteral;
var updateDnaOrAA = (0, _createMetaAction["default"])("updateDnaOrAA");
exports.updateDnaOrAA = updateDnaOrAA;
var updateMatchNumber = (0, _createMetaAction["default"])("updateMatchNumber");

// ------------------------------------
// Reducer
// ------------------------------------
exports.updateMatchNumber = updateMatchNumber;
var _default = (0, _createMergedDefaultStateReducer["default"])((_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
});
exports["default"] = _default;