Liferay.Loader.define("layout-content-page-editor-web@2.0.75/page_editor/app/reducers/index", ['module', 'exports', 'require', './baseReducer', './collectionsReducer', './editablesReducer', './fragmentEntryLinksReducer', './fragmentsReducer', './languageIdReducer', './layoutDataReducer', './mappedInfoItemsReducer', './masterLayoutReducer', './networkReducer', './pageContentsReducer', './permissionsReducer', './selectedViewportSizeReducer', './showResolvedCommentsReducer', './sidebarReducer', './undoReducer', './widgetsReducer'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.reducer = reducer;

    var _baseReducer = _interopRequireDefault(require("./baseReducer"));

    var _collectionsReducer = _interopRequireDefault(require("./collectionsReducer"));

    var _editablesReducer = _interopRequireDefault(require("./editablesReducer"));

    var _fragmentEntryLinksReducer = _interopRequireDefault(require("./fragmentEntryLinksReducer"));

    var _fragmentsReducer = _interopRequireDefault(require("./fragmentsReducer"));

    var _languageIdReducer = _interopRequireDefault(require("./languageIdReducer"));

    var _layoutDataReducer = _interopRequireDefault(require("./layoutDataReducer"));

    var _mappedInfoItemsReducer = _interopRequireDefault(require("./mappedInfoItemsReducer"));

    var _masterLayoutReducer = _interopRequireDefault(require("./masterLayoutReducer"));

    var _networkReducer = _interopRequireDefault(require("./networkReducer"));

    var _pageContentsReducer = _interopRequireDefault(require("./pageContentsReducer"));

    var _permissionsReducer = _interopRequireDefault(require("./permissionsReducer"));

    var _selectedViewportSizeReducer = _interopRequireDefault(require("./selectedViewportSizeReducer"));

    var _showResolvedCommentsReducer = _interopRequireDefault(require("./showResolvedCommentsReducer"));

    var _sidebarReducer = _interopRequireDefault(require("./sidebarReducer"));

    var _undoReducer = _interopRequireDefault(require("./undoReducer"));

    var _widgetsReducer = _interopRequireDefault(require("./widgetsReducer"));

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

    function ownKeys(object, enumerableOnly) {
      var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {
        var symbols = Object.getOwnPropertySymbols(object);if (enumerableOnly) symbols = symbols.filter(function (sym) {
          return Object.getOwnPropertyDescriptor(object, sym).enumerable;
        });keys.push.apply(keys, symbols);
      }return keys;
    }

    function _objectSpread(target) {
      for (var i = 1; i < arguments.length; i++) {
        var source = arguments[i] != null ? arguments[i] : {};if (i % 2) {
          ownKeys(Object(source), true).forEach(function (key) {
            _defineProperty(target, key, source[key]);
          });
        } else if (Object.getOwnPropertyDescriptors) {
          Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
        } else {
          ownKeys(Object(source)).forEach(function (key) {
            Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
          });
        }
      }return target;
    }

    function _defineProperty(obj, key, value) {
      if (key in obj) {
        Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });
      } else {
        obj[key] = value;
      }return obj;
    }

    function _slicedToArray(arr, i) {
      return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
    }

    function _nonIterableRest() {
      throw new TypeError("Invalid attempt to destructure non-iterable instance");
    }

    function _iterableToArrayLimit(arr, i) {
      if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
        return;
      }var _arr = [];var _n = true;var _d = false;var _e = undefined;try {
        for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
          _arr.push(_s.value);if (i && _arr.length === i) break;
        }
      } catch (err) {
        _d = true;_e = err;
      } finally {
        try {
          if (!_n && _i["return"] != null) _i["return"]();
        } finally {
          if (_d) throw _e;
        }
      }return _arr;
    }

    function _arrayWithHoles(arr) {
      if (Array.isArray(arr)) return arr;
    }

    function _toConsumableArray(arr) {
      return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
    }

    function _nonIterableSpread() {
      throw new TypeError("Invalid attempt to spread non-iterable instance");
    }

    function _iterableToArray(iter) {
      if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
    }

    function _arrayWithoutHoles(arr) {
      if (Array.isArray(arr)) {
        for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
          arr2[i] = arr[i];
        }return arr2;
      }
    }

    /**
     * Runs the base reducer plus any dynamically loaded reducers that have
     * been registered from plugins.
     */
    function reducer(state, action) {
      var nextState = (0, _undoReducer["default"])(state, action);
      return [combinedReducer].concat(_toConsumableArray(Object.values(state.reducers || {}))).reduce(function (nextState, nextReducer) {
        return nextReducer(nextState, action);
      }, nextState);
    }

    var combinedReducer = function combinedReducer(state, action) {
      return Object.entries({
        collections: _collectionsReducer["default"],
        editables: _editablesReducer["default"],
        fragmentEntryLinks: _fragmentEntryLinksReducer["default"],
        fragments: _fragmentsReducer["default"],
        languageId: _languageIdReducer["default"],
        layoutData: _layoutDataReducer["default"],
        mappedInfoItems: _mappedInfoItemsReducer["default"],
        masterLayout: _masterLayoutReducer["default"],
        network: _networkReducer["default"],
        pageContents: _pageContentsReducer["default"],
        permissions: _permissionsReducer["default"],
        reducers: _baseReducer["default"],
        selectedViewportSize: _selectedViewportSizeReducer["default"],
        showResolvedComments: _showResolvedCommentsReducer["default"],
        sidebar: _sidebarReducer["default"],
        widgets: _widgetsReducer["default"]
      }).reduce(function (nextState, _ref) {
        var _ref2 = _slicedToArray(_ref, 2),
            namespace = _ref2[0],
            reducer = _ref2[1];

        return _objectSpread({}, nextState, _defineProperty({}, namespace, reducer(nextState[namespace], action)));
      }, state);
    };
    //# sourceMappingURL=index.js.map
  }
});
//# sourceMappingURL=index.js.map