"use strict";

exports.__esModule = true;
exports.toggleCopyOption = exports.defaultCopyOptions = exports["default"] = void 0;
var _reduxAct = require("redux-act");
var _createMetaAction = _interopRequireDefault(require("./utils/createMetaAction"));
var _createReducer;
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 toggleCopyOption = (0, _createMetaAction["default"])("TOGGLE_COPY_OPTION"); //NOTE!!:: second argument sanitizes actions so no payload is passed
exports.toggleCopyOption = toggleCopyOption;
var defaultCopyOptions = {
  features: true,
  partialFeatures: false,
  parts: true,
  partialParts: false
};

// ------------------------------------
// Reducer
// ------------------------------------
exports.defaultCopyOptions = defaultCopyOptions;
var _default = (0, _reduxAct.createReducer)((_createReducer = {}, _createReducer[toggleCopyOption] = function (state, type) {
  var _extends2;
  return _extends({}, state, type === "partialFeatures" && !state[type] && {
    features: true
  }, type === "partialParts" && !state[type] && {
    parts: true
  }, type === "features" && {
    partialFeatures: !state[type]
  }, type === "parts" && {
    partialParts: !state[type]
  }, (_extends2 = {}, _extends2[type] = !state[type], _extends2));
}, _createReducer), defaultCopyOptions);
exports["default"] = _default;