"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")), _asyncView = _interopRequireWildcard(require("./asyncView"));

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 = {}, n = Object.defineProperty && Object.getOwnPropertyDescriptor;
  for (var i in e) if ("default" !== i && Object.prototype.hasOwnProperty.call(e, i)) {
    var u = n ? Object.getOwnPropertyDescriptor(e, i) : null;
    u && (u.get || u.set) ? Object.defineProperty(o, i, u) : o[i] = e[i];
  }
  return o.default = e, t && t.set(e, o), o;
}

var AmosConfig = endConf.AmosConfig, loginURI = AmosConfig.httpURI.loginURI, progressStart = function() {
  _rayProgress.default.start();
}, injectRoutes = function(e) {
  var r = (0, _customRoutes.default)((0, _calcRoutes.default)(e, _asyncView.default));
  return [ {
    path: "login",
    component: _asyncView.AsyncLogin
  }, {
    path: "region",
    component: _asyncView.AsyncRegionList
  }, {
    path: "main",
    component: _asyncView.AsyncRootView,
    childRoutes: (0, _toConsumableArray2.default)(r)
  } ];
}, rootRoutes = function(e) {
  return {
    path: "/",
    onChange: progressStart,
    indexRedirect: _asyncView.AsyncLogin,
    indexRoute: {
      onEnter: function(e, r) {
        r("/login");
      }
    },
    childRoutes: injectRoutes(e)
  };
}, _default = rootRoutes;

exports.default = _default;