Liferay.Loader.define("layout-content-page-editor-web@2.0.123/page_editor/app/components/App", ['module', 'exports', 'require', 'frontend-js-react-web$prop-types', 'frontend-js-react-web$react', '../../plugins/page-design-options/hooks/useStyleBook', '../actions/types', '../config/index', '../reducers/index', '../store/index', '../utils/dragAndDrop/useDragAndDrop', './CollectionActiveItemContext', './Controls', './DragPreview', './LayoutViewport', './ShortcutManager', './Sidebar', './Toolbar', './URLParser', './fragment-content/EditableProcessorContext'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    function _typeof(obj) {
      "@babel/helpers - typeof";
      if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
        _typeof = function _typeof(obj) {
          return typeof obj;
        };
      } else {
        _typeof = function _typeof(obj) {
          return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
        };
      }return _typeof(obj);
    }

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

    var _propTypes = _interopRequireDefault(require("frontend-js-react-web$prop-types"));

    var _react = _interopRequireWildcard(require("frontend-js-react-web$react"));

    var _useStyleBook = require("../../plugins/page-design-options/hooks/useStyleBook");

    var _types = require("../actions/types");

    var _index = require("../config/index");

    var _index2 = require("../reducers/index");

    var _index3 = require("../store/index");

    var _useDragAndDrop = require("../utils/dragAndDrop/useDragAndDrop");

    var _CollectionActiveItemContext = require("./CollectionActiveItemContext");

    var _Controls = require("./Controls");

    var _DragPreview = _interopRequireDefault(require("./DragPreview"));

    var _LayoutViewport = _interopRequireDefault(require("./LayoutViewport"));

    var _ShortcutManager = _interopRequireDefault(require("./ShortcutManager"));

    var _Sidebar = _interopRequireDefault(require("./Sidebar"));

    var _Toolbar = _interopRequireDefault(require("./Toolbar"));

    var _URLParser = _interopRequireDefault(require("./URLParser"));

    var _EditableProcessorContext = require("./fragment-content/EditableProcessorContext");

    function _getRequireWildcardCache() {
      if (typeof WeakMap !== "function") return null;var cache = new WeakMap();_getRequireWildcardCache = function _getRequireWildcardCache() {
        return cache;
      };return cache;
    }

    function _interopRequireWildcard(obj) {
      if (obj && obj.__esModule) {
        return obj;
      }if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
        return { default: obj };
      }var cache = _getRequireWildcardCache();if (cache && cache.has(obj)) {
        return cache.get(obj);
      }var newObj = {};var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;for (var key in obj) {
        if (Object.prototype.hasOwnProperty.call(obj, key)) {
          var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;if (desc && (desc.get || desc.set)) {
            Object.defineProperty(newObj, key, desc);
          } else {
            newObj[key] = obj[key];
          }
        }
      }newObj.default = obj;if (cache) {
        cache.set(obj, newObj);
      }return newObj;
    }

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

    /**
     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
     *
     * This library is free software; you can redistribute it and/or modify it under
     * the terms of the GNU Lesser General Public License as published by the Free
     * Software Foundation; either version 2.1 of the License, or (at your option)
     * any later version.
     *
     * This library is distributed in the hope that it will be useful, but WITHOUT
     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
     * details.
     */
    var DEFAULT_SESSION_LENGTH = 60 * 1000;

    function App(_ref) {
      var state = _ref.state;
      var initialState = (0, _index2.reducer)(state, {
        type: _types.INIT
      });
      (0, _react.useEffect)(function () {
        if (Liferay.Session && _index.config.autoExtendSessionEnabled) {
          var sessionLength = Liferay.Session.get('sessionLength') || DEFAULT_SESSION_LENGTH;
          var interval = setInterval(function () {
            Liferay.Session.extend();
          }, sessionLength / 2);
          return function () {
            return clearInterval(interval);
          };
        }
      }, []);
      return (/*#__PURE__*/_react.default.createElement(_index3.StoreContextProvider, {
          initialState: initialState,
          reducer: _index2.reducer
        }, /*#__PURE__*/_react.default.createElement(LanguageDirection, null), /*#__PURE__*/_react.default.createElement(_URLParser.default, null), /*#__PURE__*/_react.default.createElement(_Controls.ControlsProvider, null, /*#__PURE__*/_react.default.createElement(_CollectionActiveItemContext.CollectionActiveItemContextProvider, null, /*#__PURE__*/_react.default.createElement(_useDragAndDrop.DragAndDropContextProvider, null, /*#__PURE__*/_react.default.createElement(_EditableProcessorContext.EditableProcessorContextProvider, null, /*#__PURE__*/_react.default.createElement(_DragPreview.default, null), /*#__PURE__*/_react.default.createElement(_Toolbar.default, null), /*#__PURE__*/_react.default.createElement(_LayoutViewport.default, null), /*#__PURE__*/_react.default.createElement(_ShortcutManager.default, null), /*#__PURE__*/_react.default.createElement(_useStyleBook.StyleBookContextProvider, null, /*#__PURE__*/_react.default.createElement(_Sidebar.default, null)))))))
      );
    }

    var LanguageDirection = function LanguageDirection() {
      var languageId = (0, _index3.useSelector)(function (state) {
        return state.languageId;
      });
      (0, _react.useEffect)(function () {
        var currentLanguageDirection = _index.config.languageDirection[languageId];
        var wrapper = document.getElementById('wrapper');

        if (wrapper) {
          wrapper.dir = currentLanguageDirection;
          wrapper.lang = languageId;
        }
      }, [languageId]);
      return null;
    };
    //# sourceMappingURL=App.js.map
  }
});
//# sourceMappingURL=App.js.map