const require_built = require('../@intlayer/config/dist/esm/built.cjs');
const require_serverContext = require('./serverContext.cjs');
const require_IntlayerServerProvider = require('./IntlayerServerProvider.cjs');
const require_useDictionary = require('./useDictionary.cjs');
const require_useLoadDynamic = require('./useLoadDynamic.cjs');

//#region ../react-intlayer/dist/esm/server/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 server context
*/
const useDictionaryDynamic = (dictionaryPromise, key, locale) => {
	const localeTarget = locale ?? require_serverContext.getServerContext(require_IntlayerServerProvider.IntlayerServerContext) ?? require_built.built_default?.internationalization.defaultLocale;
	return require_useDictionary.useDictionary(require_useLoadDynamic.useLoadDynamic(`${String(key)}.${localeTarget}`, dictionaryPromise[localeTarget]?.()), localeTarget);
};

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