//#region ../@intlayer/chokidar/dist/esm/config/dist/esm/logger.mjs
const logger = (content, details) => {
	const isVerbose = details?.isVerbose ?? false;
	const mode = details?.config?.mode ?? "default";
	const level = details?.level ?? "info";
	const prefix = details?.config?.prefix ? details?.config?.prefix : void 0;
	const log = details?.config?.log ?? console.log;
	const info = details?.config?.info ?? console.info;
	const warn = details?.config?.warn ?? console.warn;
	const error = details?.config?.error ?? console.error;
	const debug = details?.config?.debug ?? console.debug;
	if (mode === "disabled") return;
	if (isVerbose && mode !== "verbose") return;
	const flatContent = prefix ? [prefix, ...[content].flat()] : [content].flat();
	if (level === "debug") return debug(...flatContent);
	if (level === "info") return info(...flatContent);
	if (level === "warn") return warn(...flatContent);
	if (level === "error") return error(...flatContent);
	log(...flatContent);
};
let ANSIColors = /* @__PURE__ */ function(ANSIColors$1) {
	ANSIColors$1["RESET"] = "\x1B[0m";
	ANSIColors$1["GREY"] = "\x1B[90m";
	ANSIColors$1["GREY_DARK"] = "\x1B[38;5;239m";
	ANSIColors$1["GREY_LIGHT"] = "\x1B[38;5;252m";
	ANSIColors$1["BLUE"] = "\x1B[34m";
	ANSIColors$1["RED"] = "\x1B[31m";
	ANSIColors$1["GREEN"] = "\x1B[32m";
	ANSIColors$1["YELLOW"] = "\x1B[38;5;226m";
	ANSIColors$1["MAGENTA"] = "\x1B[35m";
	ANSIColors$1["BEIGE"] = "\x1B[38;5;3m";
	ANSIColors$1["ORANGE"] = "\x1B[38;5;208m";
	ANSIColors$1["CYAN"] = "\x1B[36m";
	ANSIColors$1["WHITE"] = "\x1B[37m";
	ANSIColors$1["BOLD"] = "\x1B[1m";
	return ANSIColors$1;
}({});
const spinnerFrames = [
	"⠋",
	"⠙",
	"⠹",
	"⠸",
	"⠼",
	"⠴",
	"⠦",
	"⠧",
	"⠇",
	"⠏"
];
/**
* The appLogger function takes the logger and merges it with the configuration from the intlayer config file.
* It allows overriding the default configuration by passing a config object in the details parameter.
* The configuration is merged with the default configuration from the intlayer config file.
*/
const getAppLogger = (configuration, globalDetails) => (content, details) => logger(content, {
	...details ?? {},
	config: {
		...configuration?.log,
		...globalDetails?.config,
		...details?.config ?? {}
	}
});
const colorize = (s, color, reset) => color ? `${color}${s}${reset ? typeof reset === "boolean" ? ANSIColors.RESET : reset : ANSIColors.RESET}` : s;
const colorizeKey = (keyPath, color = ANSIColors.BEIGE, reset = ANSIColors.RESET) => [keyPath].flat().map((key) => colorize(key, color, reset)).join(`, `);
const colorizePath = (path, color = ANSIColors.GREY, reset = ANSIColors.RESET) => [path].flat().map((p) => colorize(p, color, reset)).join(`, `);
const removeColor = (text) => text.replace(/\x1b\[[0-9;]*m/g, "");
const getLength = (length) => {
	let value = 0;
	if (typeof length === "number") value = length;
	if (typeof length === "string") value = length.length;
	if (Array.isArray(length) && length.every((l) => typeof l === "string")) value = Math.max(...length.map((str) => str.length));
	if (Array.isArray(length) && length.every((l) => typeof l === "number")) value = Math.max(...length);
	return Math.max(value, 0);
};
const defaultColonOptions = {
	colSize: 0,
	minSize: 0,
	maxSize: Infinity,
	pad: "right",
	padChar: "0"
};
/**
* Create a string of spaces of a given length.
*
* @param colSize - The length of the string to create.
* @returns A string of spaces.
*/
const colon = (text, options) => [text].flat().map((text$1) => {
	const { colSize, minSize, maxSize, pad, padChar } = {
		...defaultColonOptions,
		...options ?? {}
	};
	const length = getLength(colSize);
	const spacesLength = Math.max(minSize, Math.min(maxSize, length - removeColor(text$1).length));
	if (pad === "left") return `${" ".repeat(spacesLength)}${text$1}`;
	return `${text$1}${" ".repeat(spacesLength)}`;
}).join("");
const x = colorize("✗", ANSIColors.RED);
const v = colorize("✓", ANSIColors.GREEN);
colorize("⏲", ANSIColors.BLUE);

//#endregion
export { ANSIColors, colon, colorize, colorizeKey, colorizePath, getAppLogger, logger, spinnerFrames, v, x };
//# sourceMappingURL=logger.mjs.map