const formatPhone = (value: string) => { if (value.length <= 2) return value; if (value.length <= 5) return `${value.slice(0, 2)} ${value.slice(2)}`; if (value.length <= 7) return `${value.slice(0, 2)} ${value.slice(2, 5)} ${value.slice(5)}`; return `${value.slice(0, 2)} ${value.slice(2, 5)} ${value.slice( 5, 7, )} ${value.slice(7)}`; }; const normalizeDigits = (value: string) => value.replace(/\D/g, '').slice(0, 9); export { formatPhone, normalizeDigits };