Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require("./chunk-C2EiDwsr.cjs");
let node_fs = require("node:fs");
let node_path = require("node:path");
//#region src/shared/tools/copy-assets.ts
/**
* List of allowed file extensions
*/
var fileExtensionWhitelist = [
	".woff2",
	".svg",
	".img",
	".jpg",
	".jpeg",
	".png"
];
/**
* Copy file from source to destination
*
* @param source - Source path
* @param target - Destination path
* @returns
*/
function copyFileSync(source, target) {
	let targetFile = target;
	if ((0, node_fs.existsSync)(target)) {
		if ((0, node_fs.lstatSync)(target).isDirectory()) targetFile = (0, node_path.join)(target, (0, node_path.basename)(source));
	}
	if (!fileExtensionWhitelist.includes((0, node_path.extname)(source))) return;
	(0, node_fs.copyFileSync)(source, targetFile);
}
/**
* Recursively copy directory from source to destination
*
* @param source - source directory
* @param target - destination directory
*/
function copyFolderRecursiveSync(source, target) {
	let files = [];
	const targetFolder = (0, node_path.join)(target, (0, node_path.basename)(source));
	if (!(0, node_fs.existsSync)(targetFolder)) (0, node_fs.mkdirSync)(targetFolder);
	if ((0, node_fs.lstatSync)(source).isDirectory()) {
		files = (0, node_fs.readdirSync)(source);
		for (const file of files) {
			const curSource = (0, node_path.join)(source, file);
			if ((0, node_fs.lstatSync)(curSource).isDirectory()) copyFolderRecursiveSync(curSource, targetFolder);
			else copyFileSync(curSource, targetFolder);
		}
	}
}
/**
* Copy asset directory from source to destination
*
* @param assetDir - destination directory
* @param assets - source directory
*/
var copyAssets = (assetDir, assets) => {
	if (!(0, node_fs.existsSync)(assetDir)) (0, node_fs.mkdirSync)(assetDir, { recursive: true });
	copyFolderRecursiveSync(assets, assetDir);
};
//#endregion
exports.copyAssets = copyAssets;
