// #region Imports
/**
 * @public
 */
export var InputParsers;
(function (InputParsers) {
    /**
     * Parses a currency formatted string into a number.
     * @param locale - The locale code (e.g., 'en-US', 'de-DE').
     * @param code - The currency code (e.g., 'USD', 'EUR').
     * @returns {InputParserFn} - The function that parses the currency string into a number.
     */
    function currency(locale, code) {
        return (value) => {
            const numberFormat = new Intl.NumberFormat(locale, {
                style: 'currency',
                currency: code
            });
            const parts = numberFormat.formatToParts(12345.67);
            const currencySymbol = parts.find((part) => part.type === 'currency')?.value ?? '';
            const numericString = value.replace(new RegExp('[^\\d.-]', 'g'), '').replace(currencySymbol, '');
            const parsedNumber = parseFloat(numericString);
            if (isNaN(parsedNumber)) {
                return undefined;
            }
            return parsedNumber.toString();
        };
    }
    InputParsers.currency = currency;
    /**
     * Parses a percentage formatted string into a number.
     * @returns {InputParserFn} - The function that parses the percentage string into a number.
     */
    function percentage() {
        return (value) => {
            const numericString = value.replace('%', '').trim();
            const parsedNumber = parseFloat(numericString);
            if (isNaN(parsedNumber)) {
                return undefined;
            }
            return (parsedNumber / 100).toString();
        };
    }
    InputParsers.percentage = percentage;
    /**
     * Parses a custom formatted string into a number.
     * @param {string} locale - The locale code (e.g., 'en-US', 'de-DE').
     * @returns {InputParserFn} - The function that parses the custom formatted string into a number.
     */
    function custom(locale) {
        return (value) => {
            const numberFormat = new Intl.NumberFormat(locale);
            const numericString = value.replace(new RegExp('[^\\d.-]', 'g'), '');
            const parsedNumber = parseFloat(numericString);
            if (isNaN(parsedNumber)) {
                return undefined;
            }
            return parsedNumber.toString();
        };
    }
    InputParsers.custom = custom;
})(InputParsers || (InputParsers = {}));
export { InputParsers as default };
//# sourceMappingURL=InputParserFn.js.map