import { safeJsonStringify as e } from "./serialize.utils.mjs";
//#region libs/shared/common/src/functions/utils/amounts.utils.ts
function t(e) {
	return typeof e == "object" && "toBigInt" in e ? e.toBigInt() : BigInt(e);
}
var n = (t) => {
	if (Array.isArray(t) && t.length === 32) {
		let e = 0n;
		for (let n = 0; n < 32; n += 1) e = e << 8n | BigInt(t[n]);
		return e;
	}
	if (typeof t == "string" || typeof t == "number") return BigInt(t);
	if (typeof t == "bigint") return t;
	throw Error(`Cannot convert value to BigInt: ${typeof t}, value: ${e(t)}`);
};
function r(...e) {
	return e.reduce((e, t) => t > e ? t : e);
}
function i(e, t) {
	return e === 0 ? 0 : e < 9.9999e-7 ? " < 0.000001" : +Number(e).toFixed(t ?? 6);
}
var a = (e, t) => {
	let n = e.toFixed(20), r = n.indexOf(".");
	if (r === -1) return n;
	let i = r + t + 1;
	return n.substring(0, i);
}, o = (e) => e < 0n ? -e : e, s = (e, t) => e > t ? e : t, c = (e) => e.reduce((e, { amount: t }) => e + t, 0n);
//#endregion
export { o as absBigInt, n as advancedToBigInt, r as bigintMax, c as countTotalAmountInUtxos, i as fixDecimalsAmount, a as getValueFirstNDigit, s as maxBigInt, t as toBigInt };
