import React__default, { useState, useEffect, useMemo } from 'react';
import { T as TranslationsContext } from './translationsContext-4de1415e.js';
import defaultTranslations from './i18n-values/en-PH.js';
import hiTranslations from './i18n-values/hi-IN.js';
import idTranslations from './i18n-values/id-ID.js';
import kmTranslations from './i18n-values/km-KH.js';
import msTranslations from './i18n-values/ms-MY.js';
import myTranslations from './i18n-values/my-MM.js';
import thTranslations from './i18n-values/th-TH.js';
import tlTranslations from './i18n-values/tl-PH.js';
import viTranslations from './i18n-values/vi-VN.js';
import mbTranslations from './i18n-values/vi-VN_MB.js';
import zhSGTranslations from './i18n-values/zh-SG.js';
import zhTranslations from './i18n-values/zh-TW.js';

const translationsMap = {
    'en-PH': defaultTranslations,
    'vi-VN': viTranslations,
    'hi-IN': hiTranslations,
    'id-ID': idTranslations,
    'ms-MY': msTranslations,
    'my-MM': myTranslations,
    'km-KH': kmTranslations,
    'zh-TW': zhTranslations,
    'zh-SG': zhSGTranslations,
    'th-TH': thTranslations,
    'tl-PH': tlTranslations,
    'vi-VN_MB': mbTranslations,
};
/**
 * @deprecated Consider to use TranslationsProviderV2
 */
const TranslationsProvider = ({ locale = 'en-PH', overrides, overrideCurrentLocale, children, shouldLoadTranslation = true, loader = null, onTranslationsLoaded, }) => {
    const overridedValues = (overrides && overrides[locale]) || overrideCurrentLocale;
    const [values, setValues] = useState(() => (Object.assign(Object.assign({}, overridedValues), (shouldLoadTranslation ? translationsMap[locale] : {}))));
    useEffect(() => {
        setValues(Object.assign(Object.assign({}, overridedValues), (shouldLoadTranslation ? translationsMap[locale] : {})));
    }, [shouldLoadTranslation, locale]);
    const contextValue = useMemo(() => {
        if (!values) {
            return null;
        }
        return {
            locale,
            values,
        };
    }, [locale, values]);
    useEffect(() => {
        if (onTranslationsLoaded && Object.keys(values).length) {
            onTranslationsLoaded(values);
        }
    }, [values]);
    return (React__default.createElement(TranslationsContext.Provider, { value: contextValue }, contextValue ? children : loader));
};

export { TranslationsProvider as T, translationsMap as t };
