import { setupI18n } from '../../../../../../node_modules/@lingui/core/dist/index.mjs';
import { compileMessage } from '../../../../../../node_modules/@lingui/message-utils/dist/compileMessage.mjs';
import { I18nProvider } from '../../../../../../node_modules/@lingui/react/dist/index.mjs';
import React__default, { useMemo, useState, useEffect } from 'react';

const I18nProviderWrapper = ({ children, messages, overrides })=>{
    const mergedMessages = useMemo(()=>{
        return {
            ...messages,
            ...overrides
        };
    }, [
        messages,
        overrides
    ]);
    const [i18n] = useState(()=>{
        const instance = setupI18n({
            locale: 'en',
            messages: {
                en: mergedMessages
            }
        });
        // We need to support runtime compilation for developer-supplied messages;
        // the following is needed to ensure that works in production builds
        // see: https://lingui.dev/ref/core#i18n.setMessagesCompiler
        instance.setMessagesCompiler(compileMessage);
        return instance;
    });
    useEffect(()=>{
        i18n.load({
            en: mergedMessages
        });
    }, [
        i18n,
        mergedMessages
    ]);
    return /*#__PURE__*/ React__default.createElement(I18nProvider, {
        i18n: i18n
    }, children);
};

export { I18nProviderWrapper };
//# sourceMappingURL=I18nProviderWrapper.mjs.map
