'use client';


const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
const require_built = require('../@intlayer/config/dist/esm/built.cjs');
const require_IntlayerProvider = require('./IntlayerProvider.cjs');
const require_useDictionary = require('./useDictionary.cjs');
const require_useLoadDynamic = require('./useLoadDynamic.cjs');
let react = require("react");

//#region ../react-intlayer/dist/esm/client/useDictionaryDynamic.mjs
/**
* On the server side, Hook that transform a dictionary and return the content
*
* If the locale is not provided, it will use the locale from the client context
*/
const useDictionaryDynamic = (dictionaryPromise, key, locale) => {
	const { locale: currentLocale } = (0, react.useContext)(require_IntlayerProvider.IntlayerClientContext);
	const localeTarget = (0, react.useMemo)(() => locale ?? currentLocale ?? require_built.built_default?.internationalization.defaultLocale, [currentLocale, locale]);
	return require_useDictionary.useDictionary(require_useLoadDynamic.useLoadDynamic(`${String(key)}.${localeTarget}`, dictionaryPromise[localeTarget]?.()), localeTarget);
};

//#endregion
exports.useDictionaryDynamic = useDictionaryDynamic;
//# sourceMappingURL=useDictionaryDynamic.cjs.map