'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
require('../../../locale/index.cjs');
var props = require('./props.cjs');
var en_US = require('../../../locale/lang/en_US.cjs');

var LocaleReceiver = /* @__PURE__ */ vue.defineComponent({
  compatConfig: {
    MODE: 3
  },
  name: "LocaleReceiver",
  props: props.localReceiverProps(),
  setup(props, {
    slots
  }) {
    const localeData = vue.inject("localeData", {});
    const getLocale = vue.computed(() => {
      const {
        componentName = "global",
        defaultLocale
      } = props;
      const locale = defaultLocale || en_US.default[componentName || "global"];
      const {
        antLocale
      } = localeData;
      const localeFromContext = componentName && antLocale ? antLocale[componentName] : {};
      return {
        ...typeof locale === "function" ? locale() : locale,
        ...localeFromContext || {}
      };
    });
    const getLocaleCode = vue.computed(() => {
      const {
        antLocale
      } = localeData;
      const localeCode = antLocale && antLocale.locale;
      if (antLocale && antLocale.exist && !localeCode)
        return en_US.default.locale;
      return localeCode;
    });
    return () => {
      const children = props.children || slots.default;
      const {
        antLocale
      } = localeData;
      return children == null ? void 0 : children(getLocale.value, getLocaleCode.value, antLocale);
    };
  }
});

exports.default = LocaleReceiver;
//# sourceMappingURL=LocaleReceiver.cjs.map
