import { defineComponent, inject, computed } from 'vue';
import '../../../locale/index.mjs';
import { localReceiverProps } from './props.mjs';
import localeValues from '../../../locale/lang/en_US.mjs';

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

export { LocaleReceiver as default };
//# sourceMappingURL=LocaleReceiver.mjs.map
