"use strict";

exports.__esModule = true;
exports.default = exports.buildReducer = exports.history = exports.getBaseUrl = void 0;

var _redux = require("redux");

var _immutable = _interopRequireDefault(require("immutable"));

var _reduxApiMiddleware = require("redux-api-middleware");

var _immutable2 = require("connected-react-router/immutable");

var _history = require("history");

var _reduxImmutable = require("redux-immutable");

var _spawnerMiddleware = require("./spawnerMiddleware");

var _applications = _interopRequireDefault(require("./reducers/applications"));

var _authentication = _interopRequireDefault(require("./reducers/authentication"));

var _localeFactory = _interopRequireWildcard(require("./reducers/localeFactory"));

var _navigation = _interopRequireDefault(require("./reducers/navigation"));

var _request = _interopRequireDefault(require("./reducers/request"));

var _scopes = _interopRequireDefault(require("./reducers/scopes"));

var _settings = _interopRequireDefault(require("./reducers/settings"));

var _toasts = _interopRequireDefault(require("./reducers/toasts"));

var _view = _interopRequireDefault(require("./reducers/view"));

var _versionInfo = _interopRequireDefault(require("./reducers/versionInfo"));

var _countries = _interopRequireDefault(require("./reducers/countries"));

var _timezones = _interopRequireDefault(require("./reducers/timezones"));

var _modules = _interopRequireDefault(require("./reducers/modules"));

var _metadata = _interopRequireDefault(require("./reducers/metadata"));

var _requestStates = _interopRequireDefault(require("./reducers/requestStates"));

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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 }; }

(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();

(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();

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; }

var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};

var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};

window.BUILD_ID = BUILD_ID;
window.BUILD_NUMBER = BUILD_NUMBER;
var basename = window.BASE_PATH || "";

var getBaseUrl = function getBaseUrl() {
  var appBasePath = (window.BASE_PATH || "").split("/")[1] || "";
  return appBasePath ? window.location.origin.concat("/", appBasePath) : window.location.origin;
};

exports.getBaseUrl = getBaseUrl;
var history = (0, _history.createBrowserHistory)({
  basename: basename
});
exports.history = history;
var buildReducer;
exports.buildReducer = buildReducer;

var initialState = _immutable.default.Map();

var buildStore = function buildStore(reducers, devOptions) {
  if (devOptions === void 0) {
    devOptions = {};
  }

  var composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__(devOptions) : _redux.compose;
  var enhancer = composeEnhancers((0, _redux.applyMiddleware)((0, _immutable2.routerMiddleware)(history), _reduxApiMiddleware.apiMiddleware, _spawnerMiddleware.spawnerMiddleware));
  var supportedLocales = SUPPORTED_LOCALES || [{
    language: "English",
    cultureIso: _localeFactory.cultureByDefault
  }];
  var localeReducer = (0, _localeFactory.default)(supportedLocales);

  exports.buildReducer = buildReducer = function buildReducer(reducers) {
    return (0, _reduxImmutable.combineReducers)(_objectSpread(_objectSpread({}, reducers), {}, {
      applications: _applications.default,
      authentication: _authentication.default,
      locale: localeReducer,
      navigation: _navigation.default,
      router: (0, _immutable2.connectRouter)(history),
      requests: _request.default,
      scopes: _scopes.default,
      settings: _settings.default,
      toasts: _toasts.default,
      versionInfo: _versionInfo.default,
      view: _view.default,
      countries: _countries.default,
      timezones: _timezones.default,
      modules: _modules.default,
      metadata: _metadata.default,
      requestStates: _requestStates.default
    }));
  };

  var rootReducer = buildReducer(reducers);
  return (0, _redux.createStore)(rootReducer, initialState, enhancer);
};

var _default = buildStore;
var _default2 = _default;
var _default3 = _default2;
exports.default = _default3;
;

(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;

  if (!reactHotLoader) {
    return;
  }

  reactHotLoader.register(basename, "basename", "/home/vsts/work/1/s/src/buildStore.js");
  reactHotLoader.register(getBaseUrl, "getBaseUrl", "/home/vsts/work/1/s/src/buildStore.js");
  reactHotLoader.register(history, "history", "/home/vsts/work/1/s/src/buildStore.js");
  reactHotLoader.register(buildReducer, "buildReducer", "/home/vsts/work/1/s/src/buildStore.js");
  reactHotLoader.register(initialState, "initialState", "/home/vsts/work/1/s/src/buildStore.js");
  reactHotLoader.register(buildStore, "buildStore", "/home/vsts/work/1/s/src/buildStore.js");
  reactHotLoader.register(_default, "default", "/home/vsts/work/1/s/src/buildStore.js");
})();

;

(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();

;

(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;

  if (!reactHotLoader) {
    return;
  }

  reactHotLoader.register(basename, "basename", "/home/vsts/work/1/s/src/buildStore.js");
  reactHotLoader.register(getBaseUrl, "getBaseUrl", "/home/vsts/work/1/s/src/buildStore.js");
  reactHotLoader.register(history, "history", "/home/vsts/work/1/s/src/buildStore.js");
  reactHotLoader.register(buildReducer, "buildReducer", "/home/vsts/work/1/s/src/buildStore.js");
  reactHotLoader.register(initialState, "initialState", "/home/vsts/work/1/s/src/buildStore.js");
  reactHotLoader.register(buildStore, "buildStore", "/home/vsts/work/1/s/src/buildStore.js");
  reactHotLoader.register(_default2, "default", "/home/vsts/work/1/s/src/buildStore.js");
})();

;

(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();