const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
const require_loadContentDeclaration = require('./loadContentDeclaration.cjs');
let node_path = require("node:path");
let node_fs_promises = require("node:fs/promises");

//#region ../chokidar/dist/esm/loadDictionaries/loadLocalDictionaries.mjs
const loadLocalDictionaries = async (contentDeclarationsPaths, configuration) => {
	const { content } = configuration;
	const { dictionariesDir, baseDir } = content;
	if (typeof contentDeclarationsPaths === "string") contentDeclarationsPaths = [contentDeclarationsPaths];
	await (0, node_fs_promises.mkdir)((0, node_path.resolve)(dictionariesDir), { recursive: true });
	const result = [];
	for await (const contentDeclarationPath of contentDeclarationsPaths) {
		const dictionary = await require_loadContentDeclaration.loadContentDeclarations([contentDeclarationPath], configuration);
		const relativeFilePath = (0, node_path.relative)(baseDir, contentDeclarationPath);
		const dictionaryWithPath = {
			...dictionary[0],
			filePath: relativeFilePath
		};
		result.push(dictionaryWithPath);
	}
	return result;
};

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