"use strict";

function calcRoutes() {
  var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [],
    u = 1 < arguments.length ? arguments[1] : void 0,
    t = [];
  return e && 0 < e.length && function c(e, i, r) {
    e.map(function(e) {
      if (e.path) {
        var t = e.path.split("/"),
          l = t[r + 1];
        if (2 < t.length) {
          l = {
            path: l,
            component: u(l),
            childRoutes: []
          };
          if (t.length > r + 2)
            for (var n = l.childRoutes, h = r + 2; h < t.length; h++) {
              var o = {
                path: t[h],
                component: u(t[h]),
                childRoutes: []
              };
              n.push(o), n = o.childRoutes
            }
          e.children && 0 < e.children.length && c(e.children, l.childRoutes, r + 1), i.push(l)
        } else e.children && 0 < e.children.length && c(e.children, i, r)
      }
    })
  }(e, t, 1), t
}
Object.defineProperty(exports, "__esModule", {
  value: !0
}), exports.default = calcRoutes, module.exports = exports.default;
