'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _defineProperty2 = require('babel-runtime/helpers/defineProperty');

var _defineProperty3 = _interopRequireDefault(_defineProperty2);

var _immutable = require('immutable');

var _constants = require('../../constants');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

exports.default = function () {
  var _editingActions;

  var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (0, _immutable.Map)();
  var action = arguments[1];

  var editingActions = (_editingActions = {}, (0, _defineProperty3.default)(_editingActions, _constants.START_EDIT, state.set(action.componentId, true).set('initialFocusId', action.initialFocusId)), (0, _defineProperty3.default)(_editingActions, _constants.END_EDIT, state.set(action.componentId, false)), (0, _defineProperty3.default)(_editingActions, _constants.TOGGLE_EDIT, state.set(action.componentId, !state.get(action.componentId))), _editingActions);

  return editingActions[action.type] || state;
};