//#region packages/@mantine/core/src/core/utils/units-converters/rem.ts
function scaleRem(remValue) {
	if (remValue === "0rem") return "0rem";
	return `calc(${remValue} * var(--mantine-scale))`;
}
function createConverter(units, { shouldScale = false } = {}) {
	function converter(value) {
		if (value === 0 || value === "0") return `0${units}`;
		if (typeof value === "number") {
			const val = `${value / 16}${units}`;
			return shouldScale ? scaleRem(val) : val;
		}
		if (typeof value === "string") {
			if (value === "") return value;
			if (value.startsWith("calc(") || value.startsWith("clamp(") || value.includes("rgba(")) return value;
			if (value.includes(",")) return value.split(",").map((val) => converter(val)).join(",");
			if (value.includes(" ")) return value.split(" ").map((val) => converter(val)).join(" ");
			const replaced = value.replace("px", "");
			if (!Number.isNaN(Number(replaced))) {
				const val = `${Number(replaced) / 16}${units}`;
				return shouldScale ? scaleRem(val) : val;
			}
		}
		return value;
	}
	return converter;
}
const rem = createConverter("rem", { shouldScale: true });
const em = createConverter("em");
//#endregion
exports.em = em;
exports.rem = rem;

//# sourceMappingURL=rem.cjs.map