import { built_default } from "../config/dist/esm/built.mjs";
import { CachedIntl } from "../utils/intl.mjs";

//#region ../react-intlayer/dist/esm/@intlayer/core/dist/esm/formatters/currency.mjs
/**
* Formats a numeric or string value into a localized currency string using the Intl API.
*
*  @example
* currency({ value: 1234.5, currency: 'EUR' });
* // "€1,234.50"
*
* @example
* currency({ value: "5000", locale: Locales.FRENCH, currency: "CAD", currencyDisplay: "code" });
* // "5 000,00 CAD"
*/
const currency = (value, options) => new CachedIntl.NumberFormat(options?.locale ?? built_default?.internationalization?.defaultLocale, {
	style: "currency",
	currency: options?.currency ?? "USD",
	currencyDisplay: options?.currencyDisplay ?? "symbol",
	minimumFractionDigits: options?.minimumFractionDigits ?? 2,
	maximumFractionDigits: options?.maximumFractionDigits ?? 2,
	...options
}).format(Number(value));

//#endregion
export { currency };
//# sourceMappingURL=currency.mjs.map