"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _react = _interopRequireDefault(require("react"));

var _context = require("./context");

var _i18n = _interopRequireDefault(require("../i18n"));

var ConfigProvider = function ConfigProvider(props) {
  var locale = props.locale,
      children = props.children,
      prefix = props.prefix,
      getPopupContainer = props.getPopupContainer,
      _props$size = props.size,
      size = _props$size === void 0 ? 'medium' : _props$size;

  var resetGetPrefixClassName = function resetGetPrefixClassName(suffixCls, customPrefix) {
    var endPrefix = prefix || 'klein';

    if (customPrefix) {
      return customPrefix;
    }

    return suffixCls ? "".concat(endPrefix, "-").concat(suffixCls) : endPrefix;
  };

  var config = {
    locale: locale ? _i18n.default[locale] : _i18n.default.zh_CN,
    getPrefixClassName: _context.getPrefixClassName,
    size: size
  };

  if (prefix) {
    config.getPrefixClassName = resetGetPrefixClassName;
  }

  if (getPopupContainer) {
    config.getPopupContainer = getPopupContainer;
  }

  return /*#__PURE__*/_react.default.createElement(_context.ConfigContext.Provider, {
    value: config
  }, children);
};

var _default = ConfigProvider;
exports.default = _default;