import { jsx as e } from "react/jsx-runtime";
//#region src/shared/currencyAmount.tsx
var t = "—", n = 2, r = 2, i = 6, a = (e) => Object.is(e, -0) ? 0 : e;
function o(e, i = {}) {
	let o = i.fallback ?? t;
	if (e == null) return o;
	let s = Number(e.amount), c = e.currency.trim();
	if (!Number.isFinite(s) || c.length === 0) return o;
	let l = i.minimumFractionDigits ?? n, u = i.maximumFractionDigits ?? Math.max(r, l);
	try {
		return new Intl.NumberFormat(i.locale, {
			style: "currency",
			currency: c,
			currencyDisplay: i.currencyDisplay ?? "symbol",
			minimumFractionDigits: l,
			maximumFractionDigits: u
		}).format(a(s));
	} catch {
		return o;
	}
}
function s(e, t = {}) {
	return o(e, {
		...t,
		minimumFractionDigits: t.minimumFractionDigits ?? n,
		maximumFractionDigits: t.maximumFractionDigits ?? i
	});
}
var c = ({ amount: n, currency: r, locale: i, fallback: a, currencyDisplay: c, showOriginalAmountTitle: l = !1, className: u }) => {
	let d = null;
	n != null && r != null && (d = {
		amount: n,
		currency: r
	});
	let f = {};
	i != null && (f.locale = i), a != null && (f.fallback = a), c != null && (f.currencyDisplay = c);
	let p = o(d, f), m;
	l && (m = s(d, f));
	let h = f.fallback ?? t, g;
	return m != null && m !== h && (g = m), /* @__PURE__ */ e("span", {
		className: u,
		title: g,
		children: p
	});
};
//#endregion
export { c as MoneyAmount, o as formatCurrencyAmount, s as formatCurrencyAmountTitle };

//# sourceMappingURL=currencyAmount.js.map