import { parsePhoneNumber, formatPhoneNumber as formatPhoneNumber$1 } from 'react-phone-number-input';

const localizeNumberFormat = (num, locale, maximumFractionDigits = 2) => {
    return Intl.NumberFormat(undefined, {
        maximumFractionDigits,
    }).format(num);
};
const convertLocalizedStringToNumber = (value) => {
    return Number(value.replace(/,/gi, '.'));
};
const formatPhoneNumber = (phone) => {
    try {
        const parseData = parsePhoneNumber(phone, 'VN');
        if (!(parseData === null || parseData === void 0 ? void 0 : parseData.number)) {
            throw new Error('Invalid number');
        }
        return formatPhoneNumber$1(parseData.number);
    }
    catch (error) {
        console.log('🚀 ~ formatPhoneNumber ~ error:', error);
        return phone;
    }
};

export { convertLocalizedStringToNumber as c, formatPhoneNumber as f, localizeNumberFormat as l };
