import _ConfigProvider from "antd/es/config-provider";
import _theme from "antd/es/theme";
import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
var _excluded = ["locale", "theme"];
import React from 'react';
import moment from 'moment';
import 'moment/locale/zh-cn';
import zhCN from 'antd/es/locale/zh_CN';
var ConfigProvider = function ConfigProvider(props) {
  var locale = props.locale,
    theme = props.theme,
    rest = _objectWithoutPropertiesLoose(props, _excluded);
  var localeData = locale;
  if (typeof locale === 'string') {
    if (locale.toLowerCase() === 'zh-cn') {
      moment.locale('zh-cn');
      localeData = zhCN;
    } else if (locale.toLowerCase() === 'en-us') {
      moment.locale('en');
      // 默认为英文
      localeData = undefined;
    }
  }
  return /*#__PURE__*/React.createElement(_ConfigProvider, _extends({
    locale: localeData,
    theme: _extends({}, theme, {
      algorithm: theme.algorithm === 'dark' ? _theme.darkAlgorithm : _theme.compactAlgorithm
    })
  }, rest));
};
export default ConfigProvider;