"use client";
//#region packages/@mantine/core/src/components/RollingNumber/get-digit-parts.ts
const PLAIN_FORMAT = new Intl.NumberFormat("en-US", {
	useGrouping: false,
	maximumFractionDigits: 20
});
function toPlainString(num, decimalScale) {
	if (!Number.isFinite(num)) return "0";
	if (decimalScale !== void 0) return new Intl.NumberFormat("en-US", {
		useGrouping: false,
		minimumFractionDigits: decimalScale,
		maximumFractionDigits: decimalScale
	}).format(num);
	const str = String(num);
	if (!str.includes("e") && !str.includes("E")) return str;
	return PLAIN_FORMAT.format(num);
}
function getDigitParts({ value, decimalScale, fixedDecimalScale }) {
	let str = toPlainString(Math.abs(value), decimalScale);
	if (!fixedDecimalScale && decimalScale !== void 0) {
		const parts = str.split(".");
		if (parts[1]) {
			const trimmed = parts[1].replace(/0+$/, "");
			str = trimmed ? `${parts[0]}.${trimmed}` : parts[0];
		}
	}
	const dotIdx = str.indexOf(".");
	const intStr = dotIdx >= 0 ? str.slice(0, dotIdx) : str;
	const fracStr = dotIdx >= 0 ? str.slice(dotIdx + 1) : "";
	return {
		negative: value < 0,
		intDigits: intStr.split(""),
		fracDigits: fracStr ? fracStr.split("") : [],
		hasDecimal: dotIdx >= 0
	};
}
//#endregion
exports.getDigitParts = getDigitParts;

//# sourceMappingURL=get-digit-parts.cjs.map