"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"), _typeof = require("@babel/runtime/helpers/typeof");

Object.defineProperty(exports, "__esModule", {
  value: !0
}), exports.default = void 0;

var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")), _amosTool = require("amos-tool"), _rayProgress = _interopRequireDefault(require("ray-progress")), endConf = _interopRequireWildcard(require("amos-processor/lib/config/endconf")), _calcRoutes = _interopRequireDefault(require("./calcRoutes")), _customRoutes = _interopRequireDefault(require("./customRoutes")), _view = _interopRequireWildcard(require("./view"));

function _getRequireWildcardCache(e) {
  if ("function" != typeof WeakMap) return null;
  var r = new WeakMap, t = new WeakMap;
  return (_getRequireWildcardCache = function(e) {
    return e ? t : r;
  })(e);
}

function _interopRequireWildcard(e, r) {
  if (!r && e && e.__esModule) return e;
  if (null === e || "object" !== _typeof(e) && "function" != typeof e) return {
    default: e
  };
  var t = _getRequireWildcardCache(r);
  if (t && t.has(e)) return t.get(e);
  var o = {}, i = Object.defineProperty && Object.getOwnPropertyDescriptor;
  for (var n in e) if ("default" !== n && Object.prototype.hasOwnProperty.call(e, n)) {
    var u = i ? Object.getOwnPropertyDescriptor(e, n) : null;
    u && (u.get || u.set) ? Object.defineProperty(o, n, u) : o[n] = e[n];
  }
  return o.default = e, t && t.set(e, o), o;
}

var AmosConfig = endConf.AmosConfig, loginURI = AmosConfig.httpURI.loginURI, injectRoutes = function(e) {
  var r = (0, _customRoutes.default)((0, _calcRoutes.default)(e, _view.default));
  return [ {
    path: "login",
    component: _view.Login
  }, {
    path: "region",
    component: _view.RegionList
  }, {
    path: "main",
    component: _view.RootView,
    childRoutes: (0, _toConsumableArray2.default)(r)
  } ];
}, progressStart = function() {
  _rayProgress.default.start();
}, rootRoutes = function(e) {
  return {
    path: "/",
    onChange: progressStart,
    indexRedirect: _view.Login,
    indexRoute: {
      onEnter: function(e, r) {
        window.location.href = loginURI;
      }
    },
    childRoutes: injectRoutes(e)
  };
}, _default = rootRoutes;

exports.default = _default;