"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _configProvider = _interopRequireDefault(require("antd/lib/config-provider"));
var _theme2 = _interopRequireDefault(require("antd/lib/theme"));
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
var _react = _interopRequireDefault(require("react"));
var _moment = _interopRequireDefault(require("moment"));
require("moment/locale/zh-cn");
var _zh_CN = _interopRequireDefault(require("antd/es/locale/zh_CN"));
var _excluded = ["locale", "theme"];
var ConfigProvider = function ConfigProvider(props) {
  var locale = props.locale,
    theme = props.theme,
    rest = (0, _objectWithoutPropertiesLoose2["default"])(props, _excluded);
  var localeData = locale;
  if (typeof locale === 'string') {
    if (locale.toLowerCase() === 'zh-cn') {
      _moment["default"].locale('zh-cn');
      localeData = _zh_CN["default"];
    } else if (locale.toLowerCase() === 'en-us') {
      _moment["default"].locale('en');
      // 默认为英文
      localeData = undefined;
    }
  }
  return /*#__PURE__*/_react["default"].createElement(_configProvider["default"], (0, _extends2["default"])({
    locale: localeData,
    theme: (0, _extends2["default"])({}, theme, {
      algorithm: theme.algorithm === 'dark' ? _theme2["default"].darkAlgorithm : _theme2["default"].compactAlgorithm
    })
  }, rest));
};
var _default = exports["default"] = ConfigProvider;