import "choerodon-ui/pro/lib/modal-container/style";
import _ModalContainer from "choerodon-ui/pro/lib/modal-container";
import React, { useEffect, useMemo } from 'react';
import { Route, Switch } from 'react-router-dom';
import { inject } from 'mobx-react';
import { asyncRouter, asyncLocaleProvider, nomatch } from '@choerodon/boot';
import { PermissionRoute, Charts } from '@choerodon/master';
import "./style/index.less";
var AppService = /*#__PURE__*/React.lazy(function () {
  return import("./routes/app-service");
});
var Code = /*#__PURE__*/React.lazy(function () {
  return import("./routes/code-manager");
});
var Resource = /*#__PURE__*/React.lazy(function () {
  return import("./routes/resource");
});
var Deployment = /*#__PURE__*/React.lazy(function () {
  return import("./routes/deployment");
});
var Pipeline = /*#__PURE__*/React.lazy(function () {
  return import("./routes/pipeline");
});
var Certificate = /*#__PURE__*/React.lazy(function () {
  return import("./routes/certificate");
});
var Cluster = /*#__PURE__*/React.lazy(function () {
  return import("./routes/cluster");
});
var Environment = /*#__PURE__*/React.lazy(function () {
  return import("./routes/environment");
});
var DeployReports = /*#__PURE__*/React.lazy(function () {
  return import("./routes/reports/DeployReportsIndex");
});
var DevelopReports = /*#__PURE__*/React.lazy(function () {
  return import("./routes/reports/ReportsIndex");
});
var Repository = /*#__PURE__*/React.lazy(function () {
  return import("./routes/repository");
});
var ProRepository = /*#__PURE__*/React.lazy(function () {
  return import("./routes/pro-repository");
});
var PVManager = /*#__PURE__*/React.lazy(function () {
  return import("./routes/pv-manager");
});
var PipelineManage = /*#__PURE__*/React.lazy(function () {
  return import("./routes/pipeline-manage");
});
var HostConfig = /*#__PURE__*/React.lazy(function () {
  return import("./routes/host-config");
});
var OrgTemplate = /*#__PURE__*/React.lazy(function () {
  return import("./routes/app-template/OrgIndex");
});
var SiteTemplate = /*#__PURE__*/React.lazy(function () {
  return import("./routes/app-template/SiteIndex");
});

function DEVOPSIndex(_ref) {
  var match = _ref.match,
      language = _ref.AppState.currentLanguage;
  var IntlProviderAsync = useMemo(function () {
    return asyncLocaleProvider(language, function () {
      return import("./locale/".concat(language));
    });
  }, []);
  return /*#__PURE__*/React.createElement(IntlProviderAsync, null, /*#__PURE__*/React.createElement("div", {
    className: "c7ncd-root"
  }, /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(PermissionRoute, {
    path: "".concat(match.url, "/app-service"),
    component: AppService,
    service: ['choerodon.code.project.develop.app-service.ps.default']
  }), /*#__PURE__*/React.createElement(PermissionRoute, {
    path: "".concat(match.url, "/code-management"),
    component: Code,
    service: ['choerodon.code.project.develop.code-management.ps.default']
  }), /*#__PURE__*/React.createElement(PermissionRoute, {
    path: "".concat(match.url, "/resource"),
    component: Resource,
    service: ['choerodon.code.project.deploy.app-deployment.resource.ps.default']
  }), /*#__PURE__*/React.createElement(PermissionRoute, {
    path: "".concat(match.url, "/deployment-operation"),
    component: Deployment,
    service: ['choerodon.code.project.deploy.app-deployment.deployment-operation.ps.default']
  }), /*#__PURE__*/React.createElement(PermissionRoute, {
    path: "".concat(match.url, "/pipeline-manage"),
    component: PipelineManage,
    service: ['choerodon.code.project.develop.ci-pipeline.ps.default']
  }), /*#__PURE__*/React.createElement(PermissionRoute, {
    path: "".concat(match.url, "/pipeline"),
    component: Pipeline,
    service: ['choerodon.code.project.deploy.app-deployment.pipeline.ps.default']
  }), /*#__PURE__*/React.createElement(PermissionRoute, {
    path: "".concat(match.url, "/environment"),
    component: Environment,
    service: ['choerodon.code.project.deploy.environment.ps.default']
  }), /*#__PURE__*/React.createElement(PermissionRoute, {
    path: "".concat(match.url, "/cert-management"),
    component: Certificate,
    service: ['choerodon.code.project.deploy.cluster.cert-management.ps.default']
  }), /*#__PURE__*/React.createElement(PermissionRoute, {
    path: "".concat(match.url, "/cluster-management"),
    component: Cluster,
    service: ['choerodon.code.project.deploy.cluster.cluster-management.ps.default']
  }), /*#__PURE__*/React.createElement(PermissionRoute, {
    path: "".concat(match.url, "/repository"),
    component: Repository,
    service: ['choerodon.code.organization.setting.repository.ps.default']
  }), /*#__PURE__*/React.createElement(PermissionRoute, {
    path: "".concat(match.url, "/project-repository"),
    component: ProRepository,
    service: ['choerodon.code.project.setting.setting-repository.ps.default']
  }), /*#__PURE__*/React.createElement(PermissionRoute, {
    path: "".concat(match.url, "/pv-management"),
    component: PVManager,
    service: ['choerodon.code.project.deploy.cluster.pv-management.ps.default']
  }), /*#__PURE__*/React.createElement(PermissionRoute, {
    path: "".concat(match.url, "/host-config"),
    component: HostConfig,
    service: ['choerodon.code.project.deploy.host.ps.default']
  }), /*#__PURE__*/React.createElement(PermissionRoute, {
    service: ['choerodon.code.organization.manager.application-template.ps.default'],
    path: "".concat(match.url, "/org-template"),
    component: OrgTemplate
  }), /*#__PURE__*/React.createElement(PermissionRoute, {
    service: ['choerodon.code.site.manager.application-template.ps.default'],
    path: "".concat(match.url, "/application-template"),
    component: SiteTemplate
  }), /*#__PURE__*/React.createElement(PermissionRoute, {
    service: ['choerodon.code.project.develop.chart.ps.default'],
    path: "".concat(match.url, "/charts/develop"),
    component: DevelopReports
  }), /*#__PURE__*/React.createElement(PermissionRoute, {
    service: ['choerodon.code.project.deploy.chart.ps.default'],
    path: "".concat(match.url, "/charts/deploy"),
    component: DeployReports
  }), /*#__PURE__*/React.createElement(Route, {
    path: "*",
    component: nomatch
  })), /*#__PURE__*/React.createElement(_ModalContainer, null)));
}

export default inject('AppState')(DEVOPSIndex);