const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
let __intlayer_config = require("@intlayer/config");
let __intlayer_unmerged_dictionaries_entry = require("@intlayer/unmerged-dictionaries-entry");
let __intlayer_core = require("@intlayer/core");
let __intlayer_dictionaries_entry = require("@intlayer/dictionaries-entry");

//#region src/test/listMissingTranslations.ts
const listMissingTranslations = (configurationOptions) => {
	const configuration = (0, __intlayer_config.getConfiguration)(configurationOptions);
	const unmergedDictionariesRecord = (0, __intlayer_unmerged_dictionaries_entry.getUnmergedDictionaries)(configuration);
	const mergedDictionaries = (0, __intlayer_dictionaries_entry.getDictionaries)(configuration);
	const missingTranslations = [];
	const { locales, requiredLocales } = configuration.internationalization;
	const dictionariesKeys = Object.keys(unmergedDictionariesRecord);
	for (const dictionaryKey of dictionariesKeys) {
		const dictionaries = unmergedDictionariesRecord[dictionaryKey];
		const multilingualDictionary = dictionaries.filter((dictionary) => !dictionary.locale);
		for (const dictionary of multilingualDictionary) {
			const missingLocales$2 = (0, __intlayer_core.getMissingLocalesContentFromDictionary)(dictionary, locales);
			if (missingLocales$2.length > 0) missingTranslations.push({
				key: dictionaryKey,
				id: dictionary.id,
				filePath: dictionary.filePath,
				locales: missingLocales$2
			});
		}
		if (dictionaries.filter((dictionary) => dictionary.locale).length === 0) continue;
		const mergedDictionary = mergedDictionaries[dictionaryKey];
		const missingLocales$1 = (0, __intlayer_core.getMissingLocalesContentFromDictionary)(mergedDictionary, locales);
		if (missingLocales$1.length > 0) missingTranslations.push({
			key: dictionaryKey,
			locales: missingLocales$1
		});
	}
	const missingLocalesSet = new Set(missingTranslations.flatMap((t) => t.locales));
	const missingLocales = Array.from(missingLocalesSet);
	return {
		missingTranslations,
		missingLocales,
		missingRequiredLocales: missingLocales.filter((locale) => (requiredLocales ?? locales).includes(locale))
	};
};

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