/**
 * Masked value formatting utilities
 * Used for TFN, ABN, phone numbers, and other formatted inputs
 */
/**
 * Format a raw value using a display format template
 * X in the format represents a digit position
 * @param value - Raw unformatted value (digits only)
 * @param display_format - Format template (e.g., "XXX XXX XXX")
 * @returns Formatted value
 */
export function format_masked_value(value, display_format) {
    if (!value || !display_format)
        return value || '';
    const digits = value.replace(/\D/g, '');
    let result = '';
    let digit_index = 0;
    for (let i = 0; i < display_format.length && digit_index < digits.length; i++) {
        if (display_format[i] === 'X' || display_format[i] === '#') {
            result += digits[digit_index];
            digit_index++;
        }
        else {
            result += display_format[i];
        }
    }
    return result;
}
/**
 * Extract raw digits from a formatted value
 * @param value - Formatted value that may contain spaces, dashes, etc.
 * @param digit_count - Expected number of digits
 * @returns Raw digits string
 */
export function extract_raw_value(value, digit_count) {
    if (!value)
        return '';
    const digits = value.replace(/\D/g, '');
    return digits.slice(0, digit_count);
}
//# sourceMappingURL=mask_format.js.map