From 32aa4622547d050d0ee299b98e95794f8170e273 Mon Sep 17 00:00:00 2001 From: RgnDunes Date: Thu, 18 Jan 2024 12:11:23 +0530 Subject: [PATCH 01/28] add formatDate - DateTime Module --- src/modules/dateTime/formatDate.ts | 29 +++++++++++++++++++++++++++++ src/modules/dateTime/types.ts | 10 ++++++++++ 2 files changed, 39 insertions(+) create mode 100644 src/modules/dateTime/formatDate.ts create mode 100644 src/modules/dateTime/types.ts diff --git a/src/modules/dateTime/formatDate.ts b/src/modules/dateTime/formatDate.ts new file mode 100644 index 00000000..84179a0a --- /dev/null +++ b/src/modules/dateTime/formatDate.ts @@ -0,0 +1,29 @@ +import { withErrorBoundary } from '../../common/errorBoundary'; +import formatDateTime from './formatDateTime'; +import { + DateInput, + Locale, + DateTimeFormatOptions, + DateFormatOptions, +} from './types'; + +/** + * Formats date based on the locale. + * @param {DateInput} date - Date object or date string. + * @param {Locale} locale - Locale string (default: 'en-IN'). + * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional). + * @returns {string} Formatted date string. + */ +const formatDate = ( + date: DateInput, + locale: Locale = 'en-IN', + options: DateFormatOptions = {}, +): string => { + const fullOptions: DateTimeFormatOptions = { + ...options, + timeStyle: undefined, + }; + return formatDateTime(date, locale, fullOptions); +}; + +export default withErrorBoundary(formatDate); diff --git a/src/modules/dateTime/types.ts b/src/modules/dateTime/types.ts new file mode 100644 index 00000000..2a8e1dec --- /dev/null +++ b/src/modules/dateTime/types.ts @@ -0,0 +1,10 @@ +export type DateInput = Date | string; +export type Locale = string; + +export interface DateTimeFormatOptions extends Intl.DateTimeFormatOptions {} + +export interface DateFormatOptions + extends Omit {} + +export interface TimeFormatOptions + extends Omit {} From 763e7e0405af9016f38887269da4eee1c621d187 Mon Sep 17 00:00:00 2001 From: RgnDunes Date: Thu, 18 Jan 2024 12:14:08 +0530 Subject: [PATCH 02/28] add formatDateTime - DateTime Module --- src/modules/dateTime/formatDateTime.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/modules/dateTime/formatDateTime.ts diff --git a/src/modules/dateTime/formatDateTime.ts b/src/modules/dateTime/formatDateTime.ts new file mode 100644 index 00000000..4d2d96fd --- /dev/null +++ b/src/modules/dateTime/formatDateTime.ts @@ -0,0 +1,21 @@ +import { withErrorBoundary } from '../../common/errorBoundary'; +import { DateInput, Locale, DateTimeFormatOptions } from './types'; + +/** + * Formats date and time based on the locale. + * @param {DateInput} date - Date object or date string. + * @param {Locale} locale - Locale string (default: 'en-IN'). + * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional). + * @returns {string} Formatted date and time string. + */ +const formatDateTime = ( + date: DateInput, + locale: Locale = 'en-IN', + options: DateTimeFormatOptions = {}, +): string => { + const dateObj: Date = date instanceof Date ? date : new Date(date); + const formatter = new Intl.DateTimeFormat(locale, options); + return formatter.format(dateObj); +} + +export default withErrorBoundary(formatDateTime); From a616f421527ebd98e1a179731753332cd5df0f64 Mon Sep 17 00:00:00 2001 From: RgnDunes Date: Thu, 18 Jan 2024 12:14:32 +0530 Subject: [PATCH 03/28] add formatTime - DateTime Module --- src/modules/dateTime/formatTime.ts | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/modules/dateTime/formatTime.ts diff --git a/src/modules/dateTime/formatTime.ts b/src/modules/dateTime/formatTime.ts new file mode 100644 index 00000000..97af7c36 --- /dev/null +++ b/src/modules/dateTime/formatTime.ts @@ -0,0 +1,29 @@ +import { withErrorBoundary } from '../../common/errorBoundary'; +import formatDateTime from './formatDateTime'; +import { + DateInput, + Locale, + DateTimeFormatOptions, + TimeFormatOptions, +} from './types'; + +/** + * Formats time based on the locale. + * @param {DateInput} date - Date object or date string. + * @param {Locale} locale - Locale string (default: 'en-IN'). + * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional). + * @returns {string} Formatted time string. + */ +const formatTime = ( + date: DateInput, + locale: Locale = 'en-IN', + options: TimeFormatOptions = {}, +): string => { + const fullOptions: DateTimeFormatOptions = { + ...options, + dateStyle: undefined, + }; + return formatDateTime(date, locale, fullOptions); +}; + +export default withErrorBoundary(formatTime); From ab603315cdec49bbc7d557217ddca10f4a069720 Mon Sep 17 00:00:00 2001 From: RgnDunes Date: Thu, 18 Jan 2024 12:15:11 +0530 Subject: [PATCH 04/28] add add & subtract - DateTime Module --- src/modules/dateTime/add.ts | 31 +++++++++++++++++++++++++++++++ src/modules/dateTime/subtract.ts | 20 ++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 src/modules/dateTime/add.ts create mode 100644 src/modules/dateTime/subtract.ts diff --git a/src/modules/dateTime/add.ts b/src/modules/dateTime/add.ts new file mode 100644 index 00000000..3c1317fd --- /dev/null +++ b/src/modules/dateTime/add.ts @@ -0,0 +1,31 @@ +import { withErrorBoundary } from '../../common/errorBoundary'; + +/** + * Adds a specified amount of time to a date. + * + * @param date The original date. + * @param value The amount to add. + * @param unit The unit of time to add (e.g., 'days', 'months', 'years'). + * @returns A new Date object with the time added. + */ +const add = ( + date: Date, + value: number, + unit: 'days' | 'months' | 'years', +): Date => { + const result = new Date(date); + switch (unit) { + case 'days': + result.setDate(result.getDate() + value); + break; + case 'months': + result.setMonth(result.getMonth() + value); + break; + case 'years': + result.setFullYear(result.getFullYear() + value); + break; + } + return result; +}; + +export default withErrorBoundary(add); diff --git a/src/modules/dateTime/subtract.ts b/src/modules/dateTime/subtract.ts new file mode 100644 index 00000000..24e5c80d --- /dev/null +++ b/src/modules/dateTime/subtract.ts @@ -0,0 +1,20 @@ +import { withErrorBoundary } from '../../common/errorBoundary'; +import add from './add'; + +/** + * Subtracts a specified amount of time from a date. + * + * @param date The original date. + * @param value The amount to subtract. + * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years'). + * @returns A new Date object with the time subtracted. + */ +const subtract = ( + date: Date, + value: number, + unit: 'days' | 'months' | 'years', +): Date => { + return add(date, -value, unit); // Reuse the add function with negative value +}; + +export default withErrorBoundary(subtract); From 0e341d65316247f5b87aee2694bb1f9425913c15 Mon Sep 17 00:00:00 2001 From: RgnDunes Date: Thu, 18 Jan 2024 12:16:01 +0530 Subject: [PATCH 05/28] add getFirstDayOfWeek, getQuarter, getWeek, getWeekdays - DateTime Module --- src/modules/dateTime/getFirstDayOfWeek.ts | 18 ++++++++++++++++++ src/modules/dateTime/getQuarter.ts | 13 +++++++++++++ src/modules/dateTime/getWeek.ts | 15 +++++++++++++++ src/modules/dateTime/getWeekdays.ts | 17 +++++++++++++++++ 4 files changed, 63 insertions(+) create mode 100644 src/modules/dateTime/getFirstDayOfWeek.ts create mode 100644 src/modules/dateTime/getQuarter.ts create mode 100644 src/modules/dateTime/getWeek.ts create mode 100644 src/modules/dateTime/getWeekdays.ts diff --git a/src/modules/dateTime/getFirstDayOfWeek.ts b/src/modules/dateTime/getFirstDayOfWeek.ts new file mode 100644 index 00000000..197699bf --- /dev/null +++ b/src/modules/dateTime/getFirstDayOfWeek.ts @@ -0,0 +1,18 @@ +import { withErrorBoundary } from '../../common/errorBoundary'; + +/** + * Gets the first day of the week for a given locale. + * + * @param locale The locale to determine the first day of the week for. + * @returns The first day of the week (0-6, where 0 is Sunday). + */ +function getFirstDayOfWeek(locale: string): number { + const formatter = new Intl.DateTimeFormat(locale, { weekday: 'short' }); + const sampleDate = new Date(2000, 0, 2); // A Sunday + const formatted = formatter.format(sampleDate); + return ['su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'].indexOf( + formatted.slice(0, 2).toLowerCase(), + ); +} + +export default withErrorBoundary(getFirstDayOfWeek); diff --git a/src/modules/dateTime/getQuarter.ts b/src/modules/dateTime/getQuarter.ts new file mode 100644 index 00000000..551f1aed --- /dev/null +++ b/src/modules/dateTime/getQuarter.ts @@ -0,0 +1,13 @@ +import { withErrorBoundary } from '../../common/errorBoundary'; + +/** + * Determines the quarter of the year for a given date. + * + * @param date The date to determine the quarter for. + * @returns The quarter of the year (1-4). + */ +const getQuarter = (date: Date): number => { + return Math.ceil((date.getMonth() + 1) / 3); +}; + +export default withErrorBoundary(getQuarter); diff --git a/src/modules/dateTime/getWeek.ts b/src/modules/dateTime/getWeek.ts new file mode 100644 index 00000000..9f32bdac --- /dev/null +++ b/src/modules/dateTime/getWeek.ts @@ -0,0 +1,15 @@ +import { withErrorBoundary } from '../../common/errorBoundary'; + +/** + * Calculates the week number of the year for a given date. + * + * @param date The date to calculate the week number for. + * @returns The week number of the year. + */ +const getWeek = (date: Date): number => { + const firstDayOfYear = new Date(date.getFullYear(), 0, 1); + const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000; + return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7); +}; + +export default withErrorBoundary(getWeek); diff --git a/src/modules/dateTime/getWeekdays.ts b/src/modules/dateTime/getWeekdays.ts new file mode 100644 index 00000000..2b752977 --- /dev/null +++ b/src/modules/dateTime/getWeekdays.ts @@ -0,0 +1,17 @@ +import { withErrorBoundary } from '../../common/errorBoundary'; +import { Locale } from './types'; + +/** + * Returns an array of weekdays according to the specified locale. + * + * @param locale The locale to get weekdays for. + * @returns An array of weekday names. + */ +const getWeekdays = (locale: Locale): string[] => { + const formatter = new Intl.DateTimeFormat(locale, { weekday: 'long' }); + return Array.from({ length: 7 }, (_, i) => + formatter.format(new Date(1970, 0, 4 + i)), + ); +} + +export default withErrorBoundary(getWeekdays); From a8087d548a7e15ea8b83b0f71ca44392b72520ca Mon Sep 17 00:00:00 2001 From: RgnDunes Date: Thu, 18 Jan 2024 12:16:54 +0530 Subject: [PATCH 06/28] add isAfter, isBefore, isLeapYear, isSameDay, isValidDate --- src/modules/dateTime/isAfter.ts | 16 ++++++++++++++++ src/modules/dateTime/isBefore.ts | 16 ++++++++++++++++ src/modules/dateTime/isLeapYear.ts | 13 +++++++++++++ src/modules/dateTime/isSameDay.ts | 18 ++++++++++++++++++ src/modules/dateTime/isValidDate.ts | 13 +++++++++++++ 5 files changed, 76 insertions(+) create mode 100644 src/modules/dateTime/isAfter.ts create mode 100644 src/modules/dateTime/isBefore.ts create mode 100644 src/modules/dateTime/isLeapYear.ts create mode 100644 src/modules/dateTime/isSameDay.ts create mode 100644 src/modules/dateTime/isValidDate.ts diff --git a/src/modules/dateTime/isAfter.ts b/src/modules/dateTime/isAfter.ts new file mode 100644 index 00000000..d7799f4b --- /dev/null +++ b/src/modules/dateTime/isAfter.ts @@ -0,0 +1,16 @@ +import { withErrorBoundary } from '../../common/errorBoundary'; +import { DateInput } from './types'; + +/** + * Compares two dates to determine if the first is after the second. + * @param {DateInput} date1 - First date object or date string. + * @param {DateInput} date2 - Second date object or date string. + * @returns {boolean} True if date1 is after date2. + */ +const isAfter = (date1: DateInput, date2: DateInput): boolean => { + const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1); + const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2); + return dateObj1 > dateObj2; +}; + +export default withErrorBoundary(isAfter); diff --git a/src/modules/dateTime/isBefore.ts b/src/modules/dateTime/isBefore.ts new file mode 100644 index 00000000..8998933b --- /dev/null +++ b/src/modules/dateTime/isBefore.ts @@ -0,0 +1,16 @@ +import { withErrorBoundary } from '../../common/errorBoundary'; +import { DateInput } from './types'; + +/** + * Compares two dates to determine if the first is before the second. + * @param {DateInput} date1 - First date object or date string. + * @param {DateInput} date2 - Second date object or date string. + * @returns {boolean} True if date1 is before date2. + */ +const isBefore = (date1: DateInput, date2: DateInput): boolean => { + const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1); + const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2); + return dateObj1 < dateObj2; +}; + +export default withErrorBoundary(isBefore); diff --git a/src/modules/dateTime/isLeapYear.ts b/src/modules/dateTime/isLeapYear.ts new file mode 100644 index 00000000..ab43c7b9 --- /dev/null +++ b/src/modules/dateTime/isLeapYear.ts @@ -0,0 +1,13 @@ +import { withErrorBoundary } from '../../common/errorBoundary'; + +/** + * Checks if a given year is a leap year. + * + * @param year The year to check. + * @returns True if the year is a leap year, false otherwise. + */ +const isLeapYear = (year: number): boolean => { + return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; +} + +export default withErrorBoundary(isLeapYear); diff --git a/src/modules/dateTime/isSameDay.ts b/src/modules/dateTime/isSameDay.ts new file mode 100644 index 00000000..3adbbd86 --- /dev/null +++ b/src/modules/dateTime/isSameDay.ts @@ -0,0 +1,18 @@ +import { withErrorBoundary } from '../../common/errorBoundary'; + +/** + * Checks if two dates fall on the same day. + * + * @param date1 The first date. + * @param date2 The second date. + * @returns True if both dates are on the same day, false otherwise. + */ +const isSameDay = (date1: Date, date2: Date): boolean => { + return ( + date1.getDate() === date2.getDate() && + date1.getMonth() === date2.getMonth() && + date1.getFullYear() === date2.getFullYear() + ); +} + +export default withErrorBoundary(isSameDay); diff --git a/src/modules/dateTime/isValidDate.ts b/src/modules/dateTime/isValidDate.ts new file mode 100644 index 00000000..791a59ae --- /dev/null +++ b/src/modules/dateTime/isValidDate.ts @@ -0,0 +1,13 @@ +import { withErrorBoundary } from '../../common/errorBoundary'; + +/** + * Checks if a given object is a valid Date object. + * + * @param date The object to check. + * @returns True if the object is a valid Date, false otherwise. + */ +const isValidDate = (date: any): boolean => { + return date instanceof Date && !isNaN(date.getTime()); +} + +export default withErrorBoundary(isValidDate); From e8fd26b31e6bd18eb9170cbc17d123e9bd8d7b70 Mon Sep 17 00:00:00 2001 From: RgnDunes Date: Thu, 18 Jan 2024 12:17:18 +0530 Subject: [PATCH 07/28] add getRelativeTime - DateTime Module --- src/modules/dateTime/getRelativeTime.ts | 61 +++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/modules/dateTime/getRelativeTime.ts diff --git a/src/modules/dateTime/getRelativeTime.ts b/src/modules/dateTime/getRelativeTime.ts new file mode 100644 index 00000000..4e90472e --- /dev/null +++ b/src/modules/dateTime/getRelativeTime.ts @@ -0,0 +1,61 @@ +import { withErrorBoundary } from '../../common/errorBoundary'; + +/** + * Provides a relative time string (e.g., '3 hours ago', 'in 2 days'). + * This function calculates the difference between the given date and the base date, + * then formats it in a locale-sensitive manner. It allows customization of the output + * through Intl.RelativeTimeFormat options. + * + * @param date - The date to compare. + * @param baseDate - The date to compare against (default: current date). + * @param locale - The locale to use for formatting (default: 'en-IN'). + * @param options - Options for the Intl.RelativeTimeFormat (optional). + * @returns The relative time as a string. + */ +const getRelativeTime = ( + date: Date, + baseDate: Date = new Date(), + locale: string = 'en-IN', + options?: Intl.RelativeTimeFormatOptions, +): string => { + const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000; + + // Define time units in seconds + const minute = 60; + const hour = minute * 60; + const day = hour * 24; + const week = day * 7; + const month = day * 30; + const year = day * 365; + + let value: number; + let unit: Intl.RelativeTimeFormatUnit; + + if (Math.abs(diffInSeconds) < minute) { + value = diffInSeconds; + unit = 'second'; + } else if (Math.abs(diffInSeconds) < hour) { + value = diffInSeconds / minute; + unit = 'minute'; + } else if (Math.abs(diffInSeconds) < day) { + value = diffInSeconds / hour; + unit = 'hour'; + } else if (Math.abs(diffInSeconds) < week) { + value = diffInSeconds / day; + unit = 'day'; + } else if (Math.abs(diffInSeconds) < month) { + value = diffInSeconds / week; + unit = 'week'; + } else if (Math.abs(diffInSeconds) < year) { + value = diffInSeconds / month; + unit = 'month'; + } else { + value = diffInSeconds / year; + unit = 'year'; + } + + const rtf = new Intl.RelativeTimeFormat(locale, options); + return rtf.format(Math.round(value), unit); +} + +export default withErrorBoundary(getRelativeTime); From 868db86e7075df58c4d7e2cfc00502a167f8d3a1 Mon Sep 17 00:00:00 2001 From: RgnDunes Date: Thu, 18 Jan 2024 12:18:16 +0530 Subject: [PATCH 08/28] add parseDate, parseDateWithFormat, localeDateFormats - DateTime Module --- .../dateTime/data/localeDateFormats.ts | 97 +++++++++++++++++++ src/modules/dateTime/index.ts | 21 ++++ src/modules/dateTime/parseDate.ts | 22 +++++ src/modules/dateTime/parseDateWithFormat.ts | 75 ++++++++++++++ 4 files changed, 215 insertions(+) create mode 100644 src/modules/dateTime/data/localeDateFormats.ts create mode 100644 src/modules/dateTime/index.ts create mode 100644 src/modules/dateTime/parseDate.ts create mode 100644 src/modules/dateTime/parseDateWithFormat.ts diff --git a/src/modules/dateTime/data/localeDateFormats.ts b/src/modules/dateTime/data/localeDateFormats.ts new file mode 100644 index 00000000..93fa70cb --- /dev/null +++ b/src/modules/dateTime/data/localeDateFormats.ts @@ -0,0 +1,97 @@ +export const LOCALE_DATE_FORMATS: { [key: string]: string } = { + 'ar-AE': 'DD/MM/YYYY', // Arabic (U.A.E.) + 'sq-AL': 'DD.MM.YYYY', // Albanian (Albania) + 'hy-AM': 'DD.MM.YYYY', // Armenian (Armenia) + 'es-AR': 'DD/MM/YYYY', // Spanish (Argentina) + 'en-AU': 'DD/MM/YYYY', // English (Australia) + 'nl-AW': 'DD-MM-YYYY', // Dutch (Aruba) + 'en-BB': 'MM/DD/YYYY', // English (Barbados) + 'bn-BD': 'DD/MM/YYYY', // Bengali (Bangladesh) + 'en-BM': 'MM/DD/YYYY', // English (Bermuda) + 'ms-BN': 'DD/MM/YYYY', // Malay (Brunei) + 'es-BO': 'DD/MM/YYYY', // Spanish (Bolivia) + 'en-BS': 'MM/DD/YYYY', // English (Bahamas) + 'en-BW': 'DD/MM/YYYY', // English (Botswana) + 'en-BZ': 'MM/DD/YYYY', // English (Belize) + 'en-CA': 'DD/MM/YYYY', // English (Canada) + 'de-CH': 'DD.MM.YYYY', // German (Switzerland) + 'zh-CN': 'YYYY/MM/DD', // Chinese (China) + 'es-CO': 'DD/MM/YYYY', // Spanish (Colombia) + 'es-CR': 'DD/MM/YYYY', // Spanish (Costa Rica) + 'es-CU': 'DD/MM/YYYY', // Spanish (Cuba) + 'cs-CZ': 'DD.MM.YYYY', // Czech (Czech Republic) + 'da-DK': 'DD-MM-YYYY', // Danish (Denmark) + 'es-DO': 'DD/MM/YYYY', // Spanish (Dominican Republic) + 'ar-DZ': 'DD/MM/YYYY', // Arabic (Algeria) + 'ar-EG': 'DD/MM/YYYY', // Arabic (Egypt) + 'am-ET': 'DD/MM/YYYY', // Amharic (Ethiopia) + 'en-EU': 'DD/MM/YYYY', // English (European Union) + 'en-FJ': 'DD/MM/YYYY', // English (Fiji) + 'en-GB': 'DD/MM/YYYY', // English (United Kingdom) + 'en-GH': 'DD/MM/YYYY', // English (Ghana) + 'en-GI': 'DD/MM/YYYY', // English (Gibraltar) + 'en-GM': 'DD/MM/YYYY', // English (Gambia) + 'es-GT': 'DD/MM/YYYY', // Spanish (Guatemala) + 'en-GY': 'DD/MM/YYYY', // English (Guyana) + 'en-HK': 'DD/MM/YYYY', // English (Hong Kong) + 'es-HN': 'DD/MM/YYYY', // Spanish (Honduras) + 'hr-HR': 'DD.MM.YYYY', // Croatian (Croatia) + 'ht-HT': 'MM/DD/YYYY', // Haitian (Haiti) + 'hu-HU': 'YYYY. MM. DD.', // Hungarian (Hungary) + 'id-ID': 'DD/MM/YYYY', // Indonesian (Indonesia) + 'he-IL': 'DD/MM/YYYY', // Hebrew (Israel) + 'en-IN': 'DD-MM-YYYY', // English (India) + 'en-JM': 'MM/DD/YYYY', // English (Jamaica) + 'en-KE': 'DD/MM/YYYY', // English (Kenya) + 'ky-KG': 'DD.MM.YYYY', // Kyrgyz (Kyrgyzstan) + 'km-KH': 'DD/MM/YYYY', // Khmer (Cambodia) + 'en-KY': 'MM/DD/YYYY', // English (Cayman Islands) + 'kk-KZ': 'DD.MM.YYYY', // Kazakh (Kazakhstan) + 'lo-LA': 'DD/MM/YYYY', // Lao (Laos) + 'si-LK': 'YYYY-MM-DD', // Sinhala (Sri Lanka) + 'en-LR': 'MM/DD/YYYY', // English (Liberia) + 'en-LS': 'DD/MM/YYYY', // English (Lesotho) + 'ar-MA': 'DD/MM/YYYY', // Arabic (Morocco) + 'ro-MD': 'DD.MM.YYYY', // Romanian (Moldova) + 'mk-MK': 'DD.MM.YYYY', // Macedonian (North Macedonia) + 'my-MM': 'DD/MM/YYYY', // Burmese (Myanmar) + 'mn-MN': 'YYYY.MM.DD', // Mongolian (Mongolia) + 'zh-MO': 'DD/MM/YYYY', // Chinese (Macao) + 'en-MU': 'DD/MM/YYYY', // English (Mauritius) + 'dv-MV': 'DD/MM/YYYY', // Divehi (Maldives) + 'en-MW': 'DD/MM/YYYY', // English (Malawi) + 'es-MX': 'DD/MM/YYYY', // Spanish (Mexico) + 'ms-MY': 'DD/MM/YYYY', // Malay (Malaysia) + 'en-NA': 'DD/MM/YYYY', // English (Namibia) + 'en-NG': 'DD/MM/YYYY', // English (Nigeria) + 'es-NI': 'DD/MM/YYYY', // Spanish (Nicaragua) + 'no-NO': 'DD.MM.YYYY', // Norwegian (Norway) + 'ne-NP': 'YYYY/MM/DD', // Nepali (Nepal) + 'en-NZ': 'DD/MM/YYYY', // English (New Zealand) + 'es-PE': 'DD/MM/YYYY', // Spanish (Peru) + 'en-PG': 'DD/MM/YYYY', // English (Papua New Guinea) + 'en-PH': 'MM/DD/YYYY', // English (Philippines) + 'en-PK': 'DD/MM/YYYY', // English (Pakistan) + 'ar-QA': 'DD/MM/YYYY', // Arabic (Qatar) + 'ru-RU': 'DD.MM.YYYY', // Russian (Russia) + 'ar-SA': 'DD/MM/YYYY', // Arabic (Saudi Arabia) + 'en-SC': 'DD/MM/YYYY', // English (Seychelles) + 'sv-SE': 'YYYY-MM-DD', // Swedish (Sweden) + 'en-SG': 'DD/MM/YYYY', // English (Singapore) + 'en-SL': 'DD/MM/YYYY', // English (Sierra Leone) + 'so-SO': 'DD/MM/YYYY', // Somali (Somalia) + 'en-SS': 'DD/MM/YYYY', // English (South Sudan) + 'es-SV': 'DD/MM/YYYY', // Spanish (El Salvador) + 'en-SZ': 'DD/MM/YYYY', // English (Eswatini) + 'th-TH': 'DD/MM/YYYY', // Thai (Thailand) + 'en-TT': 'MM/DD/YYYY', // English (Trinidad and Tobago) + 'sw-TZ': 'DD/MM/YYYY', // Swahili (Tanzania) + 'en-US': 'MM/DD/YYYY', // English (United States) + 'es-UY': 'DD/MM/YYYY', // Spanish (Uruguay) + 'uz-UZ': 'DD/MM/YYYY', // Uzbek (Uzbekistan) + 'ar-YE': 'DD/MM/YYYY', // Arabic (Yemen) + 'en-ZA': 'YYYY/MM/DD', // English (South Africa) + 'ar-KW': 'DD/MM/YYYY', // Arabic (Kuwait) + 'ar-BH': 'DD/MM/YYYY', // Arabic (Bahrain) + 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman) +}; diff --git a/src/modules/dateTime/index.ts b/src/modules/dateTime/index.ts new file mode 100644 index 00000000..7edf62be --- /dev/null +++ b/src/modules/dateTime/index.ts @@ -0,0 +1,21 @@ +/** + * This module provides functions for formatting and manipulating dates and times + * in a locale-sensitive manner using the JavaScript Intl API & Date object. + */ + +export { default as add } from './add'; +export { default as formatDate } from './formatDate'; +export { default as formatDateTime } from './formatDateTime'; +export { default as formatTime } from './formatTime'; +export { default as getFirstDayOfWeek } from './getFirstDayOfWeek'; +export { default as getQuarter } from './getQuarter'; +export { default as getRelativeTime } from './getRelativeTime'; +export { default as getWeek } from './getWeek'; +export { default as getWeekdays } from './getWeekdays'; +export { default as isAfter } from './isAfter'; +export { default as isBefore } from './isBefore'; +export { default as isLeapYear } from './isLeapYear'; +export { default as isSameDay } from './isSameDay'; +export { default as isValidDate } from './isValidDate'; +export { default as parseDate } from './parseDate'; +export { default as subtract } from './subtract'; diff --git a/src/modules/dateTime/parseDate.ts b/src/modules/dateTime/parseDate.ts new file mode 100644 index 00000000..dee860af --- /dev/null +++ b/src/modules/dateTime/parseDate.ts @@ -0,0 +1,22 @@ +import { withErrorBoundary } from '../../common/errorBoundary'; +import { LOCALE_DATE_FORMATS } from './data/localeDateFormats'; +import parseDateWithFormat from './parseDateWithFormat'; + +/** + * Attempts to parse a string into a date object based on locale. + * Uses the localeDateFormats mapping for determining the date format. + * + * @param dateString - The date string to parse. + * @param locale - The locale to use for parsing. + * @returns The parsed Date object or null if parsing fails. + */ +const parseDate = (dateString: string, locale: string): Date | null => { + const format = LOCALE_DATE_FORMATS[locale]; + if (!format) { + console.warn(`No date format found for locale: ${locale}`); + return null; + } + return parseDateWithFormat(dateString, format); +}; + +export default withErrorBoundary(parseDate); diff --git a/src/modules/dateTime/parseDateWithFormat.ts b/src/modules/dateTime/parseDateWithFormat.ts new file mode 100644 index 00000000..33bc0b1d --- /dev/null +++ b/src/modules/dateTime/parseDateWithFormat.ts @@ -0,0 +1,75 @@ +import { withErrorBoundary } from '../../common/errorBoundary'; + +/** + * Parses a date string based on a specific format. + * + * @param dateString The date string to parse. + * @param format The format to use for parsing. + * @returns The parsed Date object or null if parsing fails. + */ +const parseDateWithFormat = ( + dateString: string, + format: string, +): Date | null => { + // Determine the separator based on the format (supports '/', '.', or '-') + const separator = format.includes('/') + ? '/' + : format.includes('.') + ? '.' + : '-'; + const formatParts = format.split(separator); + const dateParts = dateString.split(separator).map((num) => parseInt(num, 10)); + + let year: number = 0, + month: number = 0, + day: number = 0; + let yearSet: boolean = false, + monthSet: boolean = false, + daySet: boolean = false; + + // Check for format and date string mismatch + if (dateParts.length !== formatParts.length) { + return null; // Mismatch between date string and format + } + + formatParts.forEach((part, index) => { + // Check for non-numeric values in date string + if (isNaN(dateParts[index])) { + return null; // Invalid date part + } + + // Assign year, month, and day based on the format + switch (part) { + case 'DD': + day = dateParts[index]; + daySet = true; + break; + case 'MM': + month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date + monthSet = true; + break; + case 'YYYY': + year = dateParts[index]; + yearSet = true; + break; + } + }); + + // Validate and create the date only if all parts are set + if (yearSet && monthSet && daySet) { + const parsedDate = new Date(year, month, day); + // Validate date to catch invalid dates like February 30th + if ( + parsedDate.getFullYear() === year && + parsedDate.getMonth() === month && + parsedDate.getDate() === day + ) { + return parsedDate; + } + } + return null; // Invalid date or incomplete date information +}; + +export default withErrorBoundary( + parseDateWithFormat, +); From 87386cfdf37faaa0d73c437394d716220f3d7a28 Mon Sep 17 00:00:00 2001 From: RgnDunes Date: Thu, 18 Jan 2024 12:29:37 +0530 Subject: [PATCH 09/28] [fix]: syntax errors --- src/modules/dateTime/formatDateTime.ts | 2 +- src/modules/dateTime/getRelativeTime.ts | 2 +- src/modules/dateTime/getWeekdays.ts | 2 +- src/modules/dateTime/isLeapYear.ts | 2 +- src/modules/dateTime/isSameDay.ts | 2 +- src/modules/dateTime/isValidDate.ts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/modules/dateTime/formatDateTime.ts b/src/modules/dateTime/formatDateTime.ts index 4d2d96fd..8515616f 100644 --- a/src/modules/dateTime/formatDateTime.ts +++ b/src/modules/dateTime/formatDateTime.ts @@ -16,6 +16,6 @@ const formatDateTime = ( const dateObj: Date = date instanceof Date ? date : new Date(date); const formatter = new Intl.DateTimeFormat(locale, options); return formatter.format(dateObj); -} +}; export default withErrorBoundary(formatDateTime); diff --git a/src/modules/dateTime/getRelativeTime.ts b/src/modules/dateTime/getRelativeTime.ts index 4e90472e..e264b7a5 100644 --- a/src/modules/dateTime/getRelativeTime.ts +++ b/src/modules/dateTime/getRelativeTime.ts @@ -56,6 +56,6 @@ const getRelativeTime = ( const rtf = new Intl.RelativeTimeFormat(locale, options); return rtf.format(Math.round(value), unit); -} +}; export default withErrorBoundary(getRelativeTime); diff --git a/src/modules/dateTime/getWeekdays.ts b/src/modules/dateTime/getWeekdays.ts index 2b752977..1f012f34 100644 --- a/src/modules/dateTime/getWeekdays.ts +++ b/src/modules/dateTime/getWeekdays.ts @@ -12,6 +12,6 @@ const getWeekdays = (locale: Locale): string[] => { return Array.from({ length: 7 }, (_, i) => formatter.format(new Date(1970, 0, 4 + i)), ); -} +}; export default withErrorBoundary(getWeekdays); diff --git a/src/modules/dateTime/isLeapYear.ts b/src/modules/dateTime/isLeapYear.ts index ab43c7b9..4ba58443 100644 --- a/src/modules/dateTime/isLeapYear.ts +++ b/src/modules/dateTime/isLeapYear.ts @@ -8,6 +8,6 @@ import { withErrorBoundary } from '../../common/errorBoundary'; */ const isLeapYear = (year: number): boolean => { return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; -} +}; export default withErrorBoundary(isLeapYear); diff --git a/src/modules/dateTime/isSameDay.ts b/src/modules/dateTime/isSameDay.ts index 3adbbd86..cec4ac3b 100644 --- a/src/modules/dateTime/isSameDay.ts +++ b/src/modules/dateTime/isSameDay.ts @@ -13,6 +13,6 @@ const isSameDay = (date1: Date, date2: Date): boolean => { date1.getMonth() === date2.getMonth() && date1.getFullYear() === date2.getFullYear() ); -} +}; export default withErrorBoundary(isSameDay); diff --git a/src/modules/dateTime/isValidDate.ts b/src/modules/dateTime/isValidDate.ts index 791a59ae..d90cc9ce 100644 --- a/src/modules/dateTime/isValidDate.ts +++ b/src/modules/dateTime/isValidDate.ts @@ -8,6 +8,6 @@ import { withErrorBoundary } from '../../common/errorBoundary'; */ const isValidDate = (date: any): boolean => { return date instanceof Date && !isNaN(date.getTime()); -} +}; export default withErrorBoundary(isValidDate); From 661f50d207fe990aad107623f16d48fd298e6e80 Mon Sep 17 00:00:00 2001 From: RgnDunes Date: Thu, 18 Jan 2024 12:31:41 +0530 Subject: [PATCH 10/28] add dateTime module export --- src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/index.ts b/src/index.ts index c0b5c56a..e550133e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,4 @@ export * from './modules/core'; export * from './modules/currency'; export * from './modules/phoneNumber'; +export * from './modules/dateTime'; From 555f445fa2e473fa76708f609dddb7ef654c9c58 Mon Sep 17 00:00:00 2001 From: Divyansh Singh Date: Thu, 18 Jan 2024 12:32:32 +0530 Subject: [PATCH 11/28] Create cuddly-eggs-design.md --- .changeset/cuddly-eggs-design.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/cuddly-eggs-design.md diff --git a/.changeset/cuddly-eggs-design.md b/.changeset/cuddly-eggs-design.md new file mode 100644 index 00000000..ffb6b9b9 --- /dev/null +++ b/.changeset/cuddly-eggs-design.md @@ -0,0 +1,5 @@ +--- +"@razorpay/i18nify-js": patch +--- + +feat[ATLAS-104]: Introducing Date & Time Module From 31f8f7a36ddc8540f77e6a1ac4d98119d8e795ea Mon Sep 17 00:00:00 2001 From: RgnDunes Date: Thu, 18 Jan 2024 13:06:02 +0530 Subject: [PATCH 12/28] add locale check and state support for locale estimation --- src/modules/dateTime/formatDate.ts | 28 ++++++++++++++++++--- src/modules/dateTime/formatDateTime.ts | 26 +++++++++++++++++--- src/modules/dateTime/formatTime.ts | 28 ++++++++++++++++++--- src/modules/dateTime/getFirstDayOfWeek.ts | 30 +++++++++++++++++++---- src/modules/dateTime/getRelativeTime.ts | 30 ++++++++++++++++++++--- src/modules/dateTime/getWeekdays.ts | 24 +++++++++++++++--- src/modules/dateTime/parseDate.ts | 15 +++++++++--- 7 files changed, 156 insertions(+), 25 deletions(-) diff --git a/src/modules/dateTime/formatDate.ts b/src/modules/dateTime/formatDate.ts index 84179a0a..1b1905f2 100644 --- a/src/modules/dateTime/formatDate.ts +++ b/src/modules/dateTime/formatDate.ts @@ -1,4 +1,6 @@ import { withErrorBoundary } from '../../common/errorBoundary'; +import state from '../.internal/state'; +import { getLocale } from '../.internal/utils'; import formatDateTime from './formatDateTime'; import { DateInput, @@ -10,20 +12,40 @@ import { /** * Formats date based on the locale. * @param {DateInput} date - Date object or date string. - * @param {Locale} locale - Locale string (default: 'en-IN'). + * @param {Locale} locale - Locale string. * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional). * @returns {string} Formatted date string. */ const formatDate = ( date: DateInput, - locale: Locale = 'en-IN', + locale: Locale, options: DateFormatOptions = {}, ): string => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) locale = state.getState().locale || getLocale(); + const fullOptions: DateTimeFormatOptions = { ...options, timeStyle: undefined, }; - return formatDateTime(date, locale, fullOptions); + + let formattedDate; + + try { + formattedDate = formatDateTime(date, locale, fullOptions); + } catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + + return formattedDate; }; export default withErrorBoundary(formatDate); diff --git a/src/modules/dateTime/formatDateTime.ts b/src/modules/dateTime/formatDateTime.ts index 8515616f..5933ca09 100644 --- a/src/modules/dateTime/formatDateTime.ts +++ b/src/modules/dateTime/formatDateTime.ts @@ -1,20 +1,40 @@ import { withErrorBoundary } from '../../common/errorBoundary'; +import state from '../.internal/state'; +import { getLocale } from '../.internal/utils'; import { DateInput, Locale, DateTimeFormatOptions } from './types'; /** * Formats date and time based on the locale. * @param {DateInput} date - Date object or date string. - * @param {Locale} locale - Locale string (default: 'en-IN'). + * @param {Locale} locale - Locale string. * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional). * @returns {string} Formatted date and time string. */ const formatDateTime = ( date: DateInput, - locale: Locale = 'en-IN', + locale: Locale, options: DateTimeFormatOptions = {}, ): string => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) locale = state.getState().locale || getLocale(); + const dateObj: Date = date instanceof Date ? date : new Date(date); - const formatter = new Intl.DateTimeFormat(locale, options); + let formatter; + + try { + formatter = new Intl.DateTimeFormat(locale, options); + } catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + return formatter.format(dateObj); }; diff --git a/src/modules/dateTime/formatTime.ts b/src/modules/dateTime/formatTime.ts index 97af7c36..12d45ef9 100644 --- a/src/modules/dateTime/formatTime.ts +++ b/src/modules/dateTime/formatTime.ts @@ -1,4 +1,6 @@ import { withErrorBoundary } from '../../common/errorBoundary'; +import state from '../.internal/state'; +import { getLocale } from '../.internal/utils'; import formatDateTime from './formatDateTime'; import { DateInput, @@ -10,20 +12,40 @@ import { /** * Formats time based on the locale. * @param {DateInput} date - Date object or date string. - * @param {Locale} locale - Locale string (default: 'en-IN'). + * @param {Locale} locale - Locale string. * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional). * @returns {string} Formatted time string. */ const formatTime = ( date: DateInput, - locale: Locale = 'en-IN', + locale: Locale, options: TimeFormatOptions = {}, ): string => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) locale = state.getState().locale || getLocale(); + const fullOptions: DateTimeFormatOptions = { ...options, dateStyle: undefined, }; - return formatDateTime(date, locale, fullOptions); + + let formattedTime; + + try { + formattedTime = formatDateTime(date, locale, fullOptions); + } catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + + return formattedTime; }; export default withErrorBoundary(formatTime); diff --git a/src/modules/dateTime/getFirstDayOfWeek.ts b/src/modules/dateTime/getFirstDayOfWeek.ts index 197699bf..980f3cdf 100644 --- a/src/modules/dateTime/getFirstDayOfWeek.ts +++ b/src/modules/dateTime/getFirstDayOfWeek.ts @@ -1,4 +1,6 @@ import { withErrorBoundary } from '../../common/errorBoundary'; +import state from '../.internal/state'; +import { getLocale } from '../.internal/utils'; /** * Gets the first day of the week for a given locale. @@ -6,13 +8,31 @@ import { withErrorBoundary } from '../../common/errorBoundary'; * @param locale The locale to determine the first day of the week for. * @returns The first day of the week (0-6, where 0 is Sunday). */ -function getFirstDayOfWeek(locale: string): number { - const formatter = new Intl.DateTimeFormat(locale, { weekday: 'short' }); - const sampleDate = new Date(2000, 0, 2); // A Sunday - const formatted = formatter.format(sampleDate); +const getFirstDayOfWeek = (locale: string): number => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) locale = state.getState().locale || getLocale(); + + let formatted; + + try { + const formatter = new Intl.DateTimeFormat(locale, { weekday: 'short' }); + const sampleDate = new Date(2000, 0, 2); // A Sunday + formatted = formatter.format(sampleDate); + } catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + return ['su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'].indexOf( formatted.slice(0, 2).toLowerCase(), ); -} +}; export default withErrorBoundary(getFirstDayOfWeek); diff --git a/src/modules/dateTime/getRelativeTime.ts b/src/modules/dateTime/getRelativeTime.ts index e264b7a5..106d8736 100644 --- a/src/modules/dateTime/getRelativeTime.ts +++ b/src/modules/dateTime/getRelativeTime.ts @@ -1,4 +1,7 @@ import { withErrorBoundary } from '../../common/errorBoundary'; +import state from '../.internal/state'; +import { getLocale } from '../.internal/utils'; +import { Locale } from './types'; /** * Provides a relative time string (e.g., '3 hours ago', 'in 2 days'). @@ -8,16 +11,23 @@ import { withErrorBoundary } from '../../common/errorBoundary'; * * @param date - The date to compare. * @param baseDate - The date to compare against (default: current date). - * @param locale - The locale to use for formatting (default: 'en-IN'). + * @param locale - The locale to use for formatting. * @param options - Options for the Intl.RelativeTimeFormat (optional). * @returns The relative time as a string. */ const getRelativeTime = ( date: Date, baseDate: Date = new Date(), - locale: string = 'en-IN', + locale: Locale, options?: Intl.RelativeTimeFormatOptions, ): string => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) locale = state.getState().locale || getLocale(); + const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000; // Define time units in seconds @@ -54,8 +64,20 @@ const getRelativeTime = ( unit = 'year'; } - const rtf = new Intl.RelativeTimeFormat(locale, options); - return rtf.format(Math.round(value), unit); + let relativeTime; + + try { + const rtf = new Intl.RelativeTimeFormat(locale, options); + relativeTime = rtf.format(Math.round(value), unit); + } catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + + return relativeTime; }; export default withErrorBoundary(getRelativeTime); diff --git a/src/modules/dateTime/getWeekdays.ts b/src/modules/dateTime/getWeekdays.ts index 1f012f34..827f499d 100644 --- a/src/modules/dateTime/getWeekdays.ts +++ b/src/modules/dateTime/getWeekdays.ts @@ -1,4 +1,6 @@ import { withErrorBoundary } from '../../common/errorBoundary'; +import state from '../.internal/state'; +import { getLocale } from '../.internal/utils'; import { Locale } from './types'; /** @@ -8,10 +10,24 @@ import { Locale } from './types'; * @returns An array of weekday names. */ const getWeekdays = (locale: Locale): string[] => { - const formatter = new Intl.DateTimeFormat(locale, { weekday: 'long' }); - return Array.from({ length: 7 }, (_, i) => - formatter.format(new Date(1970, 0, 4 + i)), - ); + try { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) locale = state.getState().locale || getLocale(); + const formatter = new Intl.DateTimeFormat(locale, { weekday: 'long' }); + return Array.from({ length: 7 }, (_, i) => + formatter.format(new Date(1970, 0, 4 + i)), + ); + } catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } else { + throw new Error(`An unknown error occurred = ${err}`); + } + } }; export default withErrorBoundary(getWeekdays); diff --git a/src/modules/dateTime/parseDate.ts b/src/modules/dateTime/parseDate.ts index dee860af..90c211d8 100644 --- a/src/modules/dateTime/parseDate.ts +++ b/src/modules/dateTime/parseDate.ts @@ -1,6 +1,9 @@ import { withErrorBoundary } from '../../common/errorBoundary'; +import state from '../.internal/state'; +import { getLocale } from '../.internal/utils'; import { LOCALE_DATE_FORMATS } from './data/localeDateFormats'; import parseDateWithFormat from './parseDateWithFormat'; +import { Locale } from './types'; /** * Attempts to parse a string into a date object based on locale. @@ -10,11 +13,17 @@ import parseDateWithFormat from './parseDateWithFormat'; * @param locale - The locale to use for parsing. * @returns The parsed Date object or null if parsing fails. */ -const parseDate = (dateString: string, locale: string): Date | null => { +const parseDate = (dateString: string, locale: Locale): Date | null => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) locale = state.getState().locale || getLocale(); + const format = LOCALE_DATE_FORMATS[locale]; if (!format) { - console.warn(`No date format found for locale: ${locale}`); - return null; + throw new Error(`No date format found for locale: ${locale}`); } return parseDateWithFormat(dateString, format); }; From 37709702159af918183f824a5561cb5bbe378696 Mon Sep 17 00:00:00 2001 From: RgnDunes Date: Thu, 18 Jan 2024 13:20:11 +0530 Subject: [PATCH 13/28] push build --- .gitignore | 2 +- lib/cjs/index.js | 1582 +++++++++++++++++++++++++++++ lib/esm/core/index.d.ts | 13 + lib/esm/core/index.js | 110 +++ lib/esm/core/index.js.map | 1 + lib/esm/currency/index.d.ts | 35 + lib/esm/currency/index.js | 289 ++++++ lib/esm/currency/index.js.map | 1 + lib/esm/dateTime/index.d.ts | 41 + lib/esm/dateTime/index.js | 620 ++++++++++++ lib/esm/dateTime/index.js.map | 1 + lib/esm/index.js | 1556 +++++++++++++++++++++++++++++ lib/esm/index.js.map | 1 + lib/esm/index.min.js | 2 + lib/esm/index.min.js.map | 1 + lib/esm/phoneNumber/index.d.ts | 13 + lib/esm/phoneNumber/index.js | 723 ++++++++++++++ lib/esm/phoneNumber/index.js.map | 1 + lib/types/index.d.ts | 99 ++ lib/umd/index.js | 1589 ++++++++++++++++++++++++++++++ lib/umd/index.js.map | 1 + lib/umd/index.min.js | 2 + lib/umd/index.min.js.map | 1 + 23 files changed, 6683 insertions(+), 1 deletion(-) create mode 100644 lib/cjs/index.js create mode 100644 lib/esm/core/index.d.ts create mode 100644 lib/esm/core/index.js create mode 100644 lib/esm/core/index.js.map create mode 100644 lib/esm/currency/index.d.ts create mode 100644 lib/esm/currency/index.js create mode 100644 lib/esm/currency/index.js.map create mode 100644 lib/esm/dateTime/index.d.ts create mode 100644 lib/esm/dateTime/index.js create mode 100644 lib/esm/dateTime/index.js.map create mode 100644 lib/esm/index.js create mode 100644 lib/esm/index.js.map create mode 100644 lib/esm/index.min.js create mode 100644 lib/esm/index.min.js.map create mode 100644 lib/esm/phoneNumber/index.d.ts create mode 100644 lib/esm/phoneNumber/index.js create mode 100644 lib/esm/phoneNumber/index.js.map create mode 100644 lib/types/index.d.ts create mode 100644 lib/umd/index.js create mode 100644 lib/umd/index.js.map create mode 100644 lib/umd/index.min.js create mode 100644 lib/umd/index.min.js.map diff --git a/.gitignore b/.gitignore index 5fa318a0..e7b05377 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ node_modules -lib +# lib .DS_Store coverage /test-results/ diff --git a/lib/cjs/index.js b/lib/cjs/index.js new file mode 100644 index 00000000..61a6ef8d --- /dev/null +++ b/lib/cjs/index.js @@ -0,0 +1,1582 @@ +'use strict'; + +// Custom Error class to extend properties to error object +class I18nifyError extends Error { + constructor(message) { + super(message); + this.name = 'i18nify Error'; + this.timestamp = new Date(); + // more params like type of error/severity can be added in future for better debugging. + } +} +/** + * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block. + * It appends additional attributes and serves as a centralized error-handling service. + * Usage => + * const wrappedUtilityFn = withErrorBoundary(utilityFn) + * + * @param fn utility that is wrapped in error boundary + * @returns {Function} returns the function wrapped in try/catch block + */ +const withErrorBoundary = (fn) => { + return function (...rest) { + try { + return fn.call(this, ...rest); + } + catch (err) { + console.warn('[I18N Error]: ', err); + // Currently, we are throwing the error as it is to consumers. + // In the future, this can be modified as per our requirement, like an error logging service. + throw new I18nifyError(err); + } + }; +}; + +function getDefaultState() { + return { + locale: '', + direction: '', + country: '', + }; +} + +class I18nStateManager { + constructor() { + this.state = getDefaultState(); + } + static getInstance() { + if (!I18nStateManager.instance) { + I18nStateManager.instance = new I18nStateManager(); + } + return I18nStateManager.instance; + } + static resetInstance() { + I18nStateManager.instance = undefined; + } + getState() { + return Object.assign({}, this.state); + } + setState(newState) { + this.state = Object.assign(Object.assign({}, this.state), newState); + } + resetState() { + this.state = getDefaultState(); + } +} +var state = I18nStateManager.getInstance(); + +/** + * function to return active i18n state + * + * ===== USAGE ===== + * import { getState } from '@razorpay/i18nify-js'; + * + * console.log(getState()) + * + * @returns i18n state + */ +const getState = () => { + return state.getState(); +}; +var getState$1 = withErrorBoundary(getState); + +/** + * Function to set and override the active state in i18nify SDK + * + * ===== USAGE ===== + * import { setState } from "@razorpay/i18nify-js"; + * setState({locale: 'en-US'}) + * + * @param newState data to set in i18nState instance + */ +const setState = (newState) => { + state.setState(newState); +}; +var setState$1 = withErrorBoundary(setState); + +/** + * Function to reset the active state in i18nify SDK + * + * ===== USAGE ===== + * import { resetState } from "@razorpay/i18nify-js"; + * resetState() + * + * @param newState data to set in i18nState instance + */ +const resetState = () => { + state.resetState(); +}; +var resetState$1 = withErrorBoundary(resetState); + +const getLocale = () => { + // Check if running in a non-browser environment (e.g., Node.js or older browsers). + if (typeof navigator === 'undefined') { + return 'en-IN'; + } + // Check if the browser supports the Intl object and user language preferences. + if (window.Intl && + typeof window.Intl === 'object' && + (window.navigator.languages || window.navigator.language)) { + const userLocales = window.navigator.languages || [ + window.navigator.language, + ]; + return userLocales[0]; + } + // Fallback to a supported locale or the default locale. + return 'en-IN'; +}; + +const getIntlInstanceWithOptions = (options = {}) => { + /** retrieve locale from below areas in order of preference + * 1. options.locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + let locale = (options === null || options === void 0 ? void 0 : options.locale) || state.getState().locale; + // If a specific locale is provided, use it; otherwise, use the browser's locale + if (!locale) { + locale = getLocale(); + } + const intlOptions = (options === null || options === void 0 ? void 0 : options.intlOptions) ? Object.assign({}, options.intlOptions) : {}; + if ((options === null || options === void 0 ? void 0 : options.currency) || intlOptions.currency) { + intlOptions.style = 'currency'; + intlOptions.currency = (options.currency || intlOptions.currency); + } + if (!locale) + throw new Error('Pass valid locale !'); + return new Intl.NumberFormat(locale || undefined, intlOptions); +}; + +// this function formats number based on different arguments passed +const formatNumber = (amount, options = {}) => { + if (!Number(amount) && Number(amount) !== 0) + throw new Error('Parameter `amount` is not a number!'); + let formattedAmount = ''; + try { + formattedAmount = getIntlInstanceWithOptions(options).format(Number(amount)); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + return formattedAmount; +}; +var formatNumber$1 = withErrorBoundary(formatNumber); + +const CURRENCIES = { + AED: { symbol: 'د.إ', name: 'United Arab Emirates Dirham' }, + ALL: { symbol: 'Lek', name: 'Albanian Lek' }, + AMD: { symbol: '֏', name: 'Armenian Dram' }, + ARS: { symbol: 'ARS', name: 'Argentine Peso' }, + AUD: { symbol: 'A$', name: 'Australian Dollar' }, + AWG: { symbol: 'Afl.', name: 'Aruban Florin' }, + BBD: { symbol: '$', name: 'Barbadian Dollar' }, + BDT: { symbol: '৳', name: 'Bangladeshi Taka' }, + BMD: { symbol: '$', name: 'Bermudian Dollar' }, + BND: { symbol: 'BND', name: 'Brunei Dollar' }, + BOB: { symbol: 'Bs', name: 'Bolivian Boliviano' }, + BSD: { symbol: 'B$', name: 'Bahamian Dollar' }, + BWP: { symbol: 'P', name: 'Botswanan Pula' }, + BZD: { symbol: 'BZ$', name: 'Belize Dollar' }, + CAD: { symbol: 'C$', name: 'Canadian Dollar' }, + CHF: { symbol: 'CHf', name: 'Swiss Franc' }, + CNY: { symbol: '¥', name: 'Chinese Yuan' }, + COP: { symbol: 'COL$', name: 'Colombian Peso' }, + CRC: { symbol: '₡', name: 'Costa Rican Colón' }, + CUP: { symbol: '$MN', name: 'Cuban Peso' }, + CZK: { symbol: 'Kč', name: 'Czech Koruna' }, + DKK: { symbol: 'DKK', name: 'Danish Krone' }, + DOP: { symbol: 'RD$', name: 'Dominican Peso' }, + DZD: { symbol: 'د.ج', name: 'Algerian Dinar' }, + EGP: { symbol: 'E£', name: 'Egyptian Pound' }, + ETB: { symbol: 'ብር', name: 'Ethiopian Birr' }, + EUR: { symbol: '€', name: 'Euro' }, + FJD: { symbol: 'FJ$', name: 'Fijian Dollar' }, + GBP: { symbol: '£', name: 'British Pound' }, + GHS: { symbol: 'GH₵', name: 'Ghanaian Cedi' }, + GIP: { symbol: 'GIP', name: 'Gibraltar Pound' }, + GMD: { symbol: 'D', name: 'Gambian Dalasi' }, + GTQ: { symbol: 'Q', name: 'Guatemalan Quetzal' }, + GYD: { symbol: 'G$', name: 'Guyanese Dollar' }, + HKD: { symbol: 'HK$', name: 'Hong Kong Dollar' }, + HNL: { symbol: 'HNL', name: 'Honduran Lempira' }, + HRK: { symbol: 'kn', name: 'Croatian Kuna' }, + HTG: { symbol: 'G', name: 'Haitian Gourde' }, + HUF: { symbol: 'Ft', name: 'Hungarian Forint' }, + IDR: { symbol: 'Rp', name: 'Indonesian Rupiah' }, + ILS: { symbol: '₪', name: 'Israeli New Shekel' }, + INR: { symbol: '₹', name: 'Indian Rupee' }, + JMD: { symbol: 'J$', name: 'Jamaican Dollar' }, + KES: { symbol: 'Ksh', name: 'Kenyan Shilling' }, + KGS: { symbol: 'Лв', name: 'Kyrgystani Som' }, + KHR: { symbol: '៛', name: 'Cambodian Riel' }, + KYD: { symbol: 'CI$', name: 'Cayman Islands Dollar' }, + KZT: { symbol: '₸', name: 'Kazakhstani Tenge' }, + LAK: { symbol: '₭', name: 'Laotian Kip' }, + LKR: { symbol: 'රු', name: 'Sri Lankan Rupee' }, + LRD: { symbol: 'L$', name: 'Liberian Dollar' }, + LSL: { symbol: 'LSL', name: 'Lesotho Loti' }, + MAD: { symbol: 'د.م.', name: 'Moroccan Dirham' }, + MDL: { symbol: 'MDL', name: 'Moldovan Leu' }, + MKD: { symbol: 'ден', name: 'Macedonian Denar' }, + MMK: { symbol: 'MMK', name: 'Myanmar Kyat' }, + MNT: { symbol: '₮', name: 'Mongolian Tugrik' }, + MOP: { symbol: 'MOP$', name: 'Macanese Pataca' }, + MUR: { symbol: '₨', name: 'Mauritian Rupee' }, + MVR: { symbol: 'Rf', name: 'Maldivian Rufiyaa' }, + MWK: { symbol: 'MK', name: 'Malawian Kwacha' }, + MXN: { symbol: 'Mex$', name: 'Mexican Peso' }, + MYR: { symbol: 'RM', name: 'Malaysian Ringgit' }, + NAD: { symbol: 'N$', name: 'Namibian Dollar' }, + NGN: { symbol: '₦', name: 'Nigerian Naira' }, + NIO: { symbol: 'NIO', name: 'Nicaraguan Córdoba' }, + NOK: { symbol: 'NOK', name: 'Norwegian Krone' }, + NPR: { symbol: 'रू', name: 'Nepalese Rupee' }, + NZD: { symbol: 'NZ$', name: 'New Zealand Dollar' }, + PEN: { symbol: 'S/', name: 'Peruvian Nuevo Sol' }, + PGK: { symbol: 'PGK', name: 'Papua New Guinean Kina' }, + PHP: { symbol: '₱', name: 'Philippine Peso' }, + PKR: { symbol: '₨', name: 'Pakistani Rupee' }, + QAR: { symbol: 'QR', name: 'Qatari Riyal' }, + RUB: { symbol: '₽', name: 'Russian Ruble' }, + SAR: { symbol: 'SR', name: 'Saudi Riyal' }, + SCR: { symbol: 'SRe', name: 'Seychellois Rupee' }, + SEK: { symbol: 'SEK', name: 'Swedish Krona' }, + SGD: { symbol: 'S$', name: 'Singapore Dollar' }, + SLL: { symbol: 'Le', name: 'Sierra Leonean Leone' }, + SOS: { symbol: 'Sh.so.', name: 'Somali Shilling' }, + SSP: { symbol: 'SS£', name: 'South Sudanese Pound' }, + SVC: { symbol: '₡', name: 'Salvadoran Colón' }, + SZL: { symbol: 'E', name: 'Swazi Lilangeni' }, + THB: { symbol: '฿', name: 'Thai Baht' }, + TTD: { symbol: 'TT$', name: 'Trinidad and Tobago Dollar' }, + TZS: { symbol: 'Sh', name: 'Tanzanian Shilling' }, + USD: { symbol: '$', name: 'United States Dollar' }, + UYU: { symbol: '$U', name: 'Uruguayan Peso' }, + UZS: { symbol: "so'm", name: 'Uzbekistani Som' }, + YER: { symbol: '﷼', name: 'Yemeni Rial' }, + ZAR: { symbol: 'R', name: 'South African Rand' }, + KWD: { symbol: 'د.ك', name: 'Kuwaiti Dinar' }, + BHD: { symbol: 'د.ب.', name: 'Bahraini Dinar' }, + OMR: { symbol: 'ر.ع.', name: 'Omani Rial' }, +}; + +const getCurrencyList = () => { + return CURRENCIES; +}; +var getCurrencyList$1 = withErrorBoundary(getCurrencyList); + +const getCurrencySymbol = (currencyCode) => { + var _a; + if (currencyCode in CURRENCIES) + return (_a = CURRENCIES[currencyCode]) === null || _a === void 0 ? void 0 : _a.symbol; + else + throw new Error('Invalid currencyCode!'); +}; +var getCurrencySymbol$1 = withErrorBoundary(getCurrencySymbol); + +const ALLOWED_FORMAT_PARTS_KEYS = [ + 'nan', + 'infinity', + 'percent', + 'integer', + 'group', + 'decimal', + 'fraction', + 'plusSign', + 'minusSign', + 'percentSign', + 'currency', + 'code', + 'symbol', + 'name', + 'compact', + 'exponentInteger', + 'exponentMinusSign', + 'exponentSeparator', + 'unit', +]; + +const formatNumberByParts = (amount, options = {}) => { + if (!Number(amount) && Number(amount) !== 0) + throw new Error('Parameter `amount` is not a number!'); + try { + const formattedAmount = getIntlInstanceWithOptions(options).formatToParts(Number(amount)); + const parts = formattedAmount; + const formattedObj = {}; + parts.forEach((p) => { + if (p.type === 'group') { + formattedObj.integer = (formattedObj.integer || '') + p.value; + } + else if (ALLOWED_FORMAT_PARTS_KEYS.findIndex((item) => item === p.type) != -1) { + // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal' is skipped + formattedObj[p.type] = (formattedObj[p.type] || '') + p.value; + } + }); + return Object.assign(Object.assign({}, formattedObj), { isPrefixSymbol: parts[0].type === 'currency', rawParts: parts }); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } +}; +var formatNumberByParts$1 = withErrorBoundary(formatNumberByParts); + +const PHONE_REGEX_MAPPER = { + IN: /^(?:(?:\+|0{0,2})91\s*[-]?\s*|[0]?)?[6789]\d{9}$/, + MY: /^(\+?6?0)?(\d{1,3})[-. ]?(\d{7,8})$/, + AE: /^(?:\+?971|0)?(?:2|3|4|6|7|9)\d{8}$/, + AL: /^(?:\+?355)?(?:[4-9]\d{7}|6\d{8})$/, + AM: /^(?:\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/, + AR: /^(?:(?:\+|0{0,2})54)?(?:11|[2368]\d)(?:(?=\d{0,2}15)\d{2})??\d{8}$/, + AU: /^(?:\+?61|0)4\d{8}$/, + AW: /^(?:(?:\+297)?(?!0)\d{7})$/, + BB: /^(?:(?:\+1)?246)?(?:\d{3})?\d{7}$/, + BD: /^(?:\+?880|0)1[13456789]\d{8}$/, + BM: /^(?:(?:\+1)?441)?(?:\d{2})?\d{7}$/, + BN: /^(?:\+?673)?(?:\d{3})?\d{4}$/, + BO: /^(?:(?:\+|0{0,2})591)?(?:(?:2|3|7|6)\d{7})$/, + BS: /^(?:(?:\+1)?242)?(?:\d{3})?\d{7}$/, + BW: /^(?:(?:\+267)?\s?)?[74]\d{7}$/, + BZ: /^(?:(?:\+501)?\s?)?[622]\d{4}$/, + CH: /^(?:(?:\+41|0)(?:\s*\(?0\)?\s*))?(?:\d{2}\s*)?\d{3}\s*\d{2}\s*\d{2}$/, + CN: /^(?:(?:\+|00)86)?1\d{10}$/, + CO: /^(?:(?:\+57|0057)?)?[1-8]{1}\d{6,7}$/, + OM: /^(?:\+?968)?(?:95|96|97|98)\d{6}$/, + CR: /^(?:(?:\+506)?\s*|0)?[1-9]\d{7}$/, + CU: /^(?:\+?53)?(?:[5-8]\d{7})$/, + CZ: /^(?:\+?420)?(?:\d{9})$/, + DK: /^(?:\+?45)?(?:\d{8})$/, + DO: /^(?:(?:\+1)?809|1-8(?:00|88|89))(?:\d{7})$/, + DZ: /^(?:\+?213|0)([567]\d{8})$/, + EG: /^(?:(?:\+20|20)?(\d{10}))$/, + ET: /^(?:\+?251)?[1-59]\d{8}$/, + EU: /^(?:(?:\+?3)?8)?\s*(?:\d{3}\s*){3}\d{2}$/, + FJ: /^(?:(?:\+?679)?\s?\d{3}\s?\d{4})?$/, + GB: /^(?:(?:\+44\s?|0)7\d{3}(\s?\d{4,})?)$/, + GH: /^(?:(?:\+233)|0)?(?:\d{9})$/, + GI: /^(?:\+350)?\d{5}$/, + GM: /^(?:\+220)?\d{5,7}$/, + GT: /^(?:\+502)?[2468]\d{7,8}$/, + GY: /^(?:(?:\+592)?(?:(?:\s)?[2-9])(?:(?:\s)?\d))?(?:(?:\s)?\d{4})$/, + HK: /^(?:\+852\s?)?[456789]\d{3}\s?\d{4}$/, + HN: /^(?:\+504)?[89]\d{7}$/, + HR: /^(?:\+?385)?\d{8,9}$/, + HT: /^(?:\+?509)?\d{8}$/, + HU: /^(?:(?:\+36))(\s?\d{2}\s?\d{3}\s?\d{4})$/, + ID: /^(?:\+?62|0[1-9])[\s-]?\d{2,4}[\s-]?\d{3,4}[\s-]?\d{3,4}$/, + IL: /^(?:(?:\+972|0)(?:-)?)[23489]\d{7}$/, + JM: /^(?:(?:\+1876))\d{7,10}$/, + KE: /^(?:(?:\+254)|(?:0))(?:\d{6,7})$/, + KG: /^(?:\+996)?\s?\d{9}$/, + KH: /^(?:(?:\+855)|(?:0))(?:\s?[1-9]\d{7,8})$/, + KY: /^(?:\+?1\s?(345))\d{6}$/, + KZ: /^(?:\+?7|8)?7\d{9}$/, + LA: /^(?:(?:\+?856)|0)(20\d{7,9})$/, + LK: /^(?:(?:\+94)|0)(?:\d{9})$/, + LR: /^(?:\+231)[ -\d]{4}[ -\d]{4}$/, + LS: /^(?:(?:\+?266)|0)?[56]\d{7}$/, + MA: /^(?:(?:\+?212(\s*[-|\s*]?\d{1,9})?)|(?:0))(?:\d{9})$/, + MD: /^(?:(?:\+373)|(?:0))(?:\d{7,8})$/, + MK: /^(?:\+389|0)(?:(?:2[0-4]|[3-9])\s?)?\d{6}$/, + MM: /^(?:(?:\+?95)|0)?[1-9]\d{9}$/, + MN: /^(?:\+976|0)\d{8}$/, + MO: /^(?:(?:\+?853)|[0-9])?\d{8}$/, + MU: /^(?:\+230|0)?\d{8}$/, + MV: /^(?:(?:\+?960)|0)?\d{7}$/, + MW: /^(?:\+265)[1-9]\d{6}$/, + MX: /^(?:(?:\+?52)?\s?(?:1|01)?\s?)?(?:\d{3}\s?\d{3}\s?\d{4})$/, + NA: /^(?:(?:\+264)|0)?\d{8}$/, + NG: /^(?:(?:\+234)|(?:0))(?:\d{7,8})$/, + NI: /^(?:(?:\+505))?(?:\d{8})$/, + NO: /^(?:(?:\+?47)|\d{2}|\d{3})\s?\d{2}\s?\d{3}$/, + NP: /^(?:(?:\+977))?(\d{9,10})$/, + NZ: /^(?:\+?64|0)(\d{2,5} \d{4,8}|\d{3,4} \d{4})$/, + PE: /^(?:(?:\+51)|0)?(?:9\d{8})$/, + PG: /^(?:\+?675)?(?:[7-9]\d{7})$/, + PH: /^(?:(?:\+?63)|0)(?:\d{10})$/, + PK: /^(?:(?:\+92)|0)?[345]\d{9}$/, + QA: /^(?:\+?974)?-?33\d{5}$/, + RU: /^(?:\+?7|8)?[ -]?\(?9\d{2}\)?[ -]?\d{3}[ -]?\d{2}[ -]?\d{2}$/, + SA: /^(?:\+?966)?\s?1?[\s-]?(?:[45]\d{2}|5\d{3})[\s-]?\d{4}$/, + SC: /^(?:(?:\+248)|\d{4})\d{5}$/, + SE: /^(?:\+?46|0)\s?[1-57-9](?:[0-9]\s?){8}$/, + SG: /^(?:(?:\+65)|(?:\(\+65\))|(?:65))\d{4}\d{4}$/, + SL: /^(?:(?:\+232)|(?:0))?\d{9}$/, + SO: /^(?:\+252|0)?[567]\d{7}$/, + SS: /^(?:\+211|0)?[1-9]\d{7,9}$/, + SV: /^(?:(?:\+?503)|(?:0))(?:\d{8})$/, + SZ: /^(?:\+?268)?\d{7,8}$/, + TH: /^(?:(?:\+66)|0)\d{9}$/, + TT: /^(?:(?:\+?1-868)|\(?868\)?)(\d{7})$/, + TZ: /^(?:(?:\+?255)|0)?[67]\d{8}$/, + US: /^(\+\d{1,2}\s?)?([2-9]{1}\d{2}[2-9]{1}\d{6})$/, + CA: /^(\+\d{1,2}\s?)?([2-9]{1}\d{2}[2-9]{1}\d{6})$/, + UY: /^(?:(?:\+598|0)\s?(9\d{3}|2\d{2}|[4-9]\d{6}))$/, + UZ: /^(?:\+?998)?\s?[3456789]\d{8}$/, + YE: /^(?:\+?967)?(?:\d{7,8})$/, + ZA: /^(?:(?:\+27)|0)(\d{9})$/, + KW: /^(?:\+?965)[569]\d{7}$/, + BH: /^(?:\+?973)?[356]\d{7}$/, + TL: /^(?:(?:\+670)\s?)?[0-9]{3}\s?[0-9]{3,4}$/, + VC: /^(?:(?:\+1)?784)?(?:\d{3})?\d{7}$/, + VE: /^(?:(?:\+58)|0)?4\d{9}$/, + VN: /^(?:(?:\+84)|0)?[1-9]\d{8}$/, + ZM: /^(?:(?:\+260)|0)?[123456789]\d{8,9}$/, + ZW: /^(?:(?:\+263)|0)?(?:\d{9,10})$/, + LT: /^(?:(?:\+370)|8)\d{8}$/, + LU: /^(?:(?:\+352)?(6|2(6|7|8|9))\d{6})$/, + LV: /^(?:(?:\+371)?2\d{7})$/, + ME: /^(?:(?:\+382)?[67]\d{7,20})$/, + MG: /^(?:(?:\+261)?3[234568]\d{7})$/, + MZ: /^(?:(?:\+258)|(?:258))?8[234567]\d{7,8}$/, + NL: /^(?:(?:\+31)|0(6(?:\d{8})|[1-9](?:(?:\d{8})|(?:\s\d{3}\s\d{4}))|(?:\d{8})))$/, + PA: /^(?:(?:\+507)\s?)?[46]\d{6,7}$/, + PL: /^(?:(?:\+48)?(?:\s?\d{3}\s?\d{3}\s?\d{3}|(?:\d{2}\s?){4}\d{2}|\d{3}-\d{3}-\d{3}))$/, + PR: /^(?:(?:\+1)?787|939)\d{7}$/, + PS: /^(?:(?:\+970))(5[2349])\d{7}$/, + PT: /^(?:(?:\+351)?9(1\d|2[1-9]|6[12345789]|7[12345789])\d{7})$/, + PY: /^(?:(?:\+595|0)9[9876]\d{7})$/, + RO: /^(?:(?:\+40|0))(?:7[2-8]\d{7}|21\d{8})$/, + RS: /^(?:(?:\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/, + RW: /^(?:(?:\+250)|(0))\d{9}$/, + SI: /^(?:(?:\+386)|0)?[1-59]\d{7,8}$/, + SK: /^(?:(?:\+421))?(0|9[0-8])\d{8}$/, + SM: /^(?:(?:\+378)|(0549|6\d{4}))\d{5}$/, + SN: /^(?:(?:\+221)|0)?[3679]\d{7}$/, + SR: /^(?:(?:\+597))\d{7}$/, + TG: /^(?:(?:\+228))\d{8}$/, + TJ: /^(?:(?:\+992))(37|55|77)\d{7}$/, + TN: /^(?:(?:\+216)|22|9[1-9])\d{7}$/, + TR: /^(?:(?:\+90)|(0))\s?5\d{9}$/, + TW: /^(?:(?:\+886)|0)?9\d{8}$/, + UA: /^(?:(?:\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\d{7}$/, + UG: /^(?:(?:\+256)|0)?[39]\d{8}$/, +}; + +/* Source: Google LibPhoneNumber Metadata: https://github.com/google/libphonenumber/blob/master/javascript/i18n/phonenumbers/metadata.js */ +const DIAL_CODE_MAPPER = { + 1: [ + 'US', + 'AG', + 'AI', + 'AS', + 'BB', + 'BM', + 'BS', + 'CA', + 'DM', + 'DO', + 'GD', + 'GU', + 'JM', + 'KN', + 'KY', + 'LC', + 'MP', + 'MS', + 'PR', + 'SX', + 'TC', + 'TT', + 'VC', + 'VG', + 'VI', + ], + 7: ['RU', 'KZ'], + 20: ['EG'], + 27: ['ZA'], + 30: ['GR'], + 31: ['NL'], + 32: ['BE'], + 33: ['FR'], + 34: ['ES'], + 36: ['HU'], + 39: ['IT', 'VA'], + 40: ['RO'], + 41: ['CH'], + 43: ['AT'], + 44: ['GB', 'GG', 'IM', 'JE'], + 45: ['DK'], + 46: ['SE'], + 47: ['NO', 'SJ'], + 48: ['PL'], + 49: ['DE'], + 51: ['PE'], + 52: ['MX'], + 53: ['CU'], + 54: ['AR'], + 55: ['BR'], + 56: ['CL'], + 57: ['CO'], + 58: ['VE'], + 60: ['MY'], + 61: ['AU', 'CC', 'CX'], + 62: ['ID'], + 63: ['PH'], + 64: ['NZ'], + 65: ['SG'], + 66: ['TH'], + 81: ['JP'], + 82: ['KR'], + 84: ['VN'], + 86: ['CN'], + 90: ['TR'], + 91: ['IN'], + 92: ['PK'], + 93: ['AF'], + 94: ['LK'], + 95: ['MM'], + 98: ['IR'], + 211: ['SS'], + 212: ['MA', 'EH'], + 213: ['DZ'], + 216: ['TN'], + 218: ['LY'], + 220: ['GM'], + 221: ['SN'], + 222: ['MR'], + 223: ['ML'], + 224: ['GN'], + 225: ['CI'], + 226: ['BF'], + 227: ['NE'], + 228: ['TG'], + 229: ['BJ'], + 230: ['MU'], + 231: ['LR'], + 232: ['SL'], + 233: ['GH'], + 234: ['NG'], + 235: ['TD'], + 236: ['CF'], + 237: ['CM'], + 238: ['CV'], + 239: ['ST'], + 240: ['GQ'], + 241: ['GA'], + 242: ['CG'], + 243: ['CD'], + 244: ['AO'], + 245: ['GW'], + 246: ['IO'], + 247: ['AC'], + 248: ['SC'], + 249: ['SD'], + 250: ['RW'], + 251: ['ET'], + 252: ['SO'], + 253: ['DJ'], + 254: ['KE'], + 255: ['TZ'], + 256: ['UG'], + 257: ['BI'], + 258: ['MZ'], + 260: ['ZM'], + 261: ['MG'], + 262: ['RE', 'YT'], + 263: ['ZW'], + 264: ['NA'], + 265: ['MW'], + 266: ['LS'], + 267: ['BW'], + 268: ['SZ'], + 269: ['KM'], + 290: ['SH', 'TA'], + 291: ['ER'], + 297: ['AW'], + 298: ['FO'], + 299: ['GL'], + 350: ['GI'], + 351: ['PT'], + 352: ['LU'], + 353: ['IE'], + 354: ['IS'], + 355: ['AL'], + 356: ['MT'], + 357: ['CY'], + 358: ['FI', 'AX'], + 359: ['BG'], + 370: ['LT'], + 371: ['LV'], + 372: ['EE'], + 373: ['MD'], + 374: ['AM'], + 375: ['BY'], + 376: ['AD'], + 377: ['MC'], + 378: ['SM'], + 380: ['UA'], + 381: ['RS'], + 382: ['ME'], + 383: ['XK'], + 385: ['HR'], + 386: ['SI'], + 387: ['BA'], + 389: ['MK'], + 420: ['CZ'], + 421: ['SK'], + 423: ['LI'], + 500: ['FK'], + 501: ['BZ'], + 502: ['GT'], + 503: ['SV'], + 504: ['HN'], + 505: ['NI'], + 506: ['CR'], + 507: ['PA'], + 508: ['PM'], + 509: ['HT'], + 590: ['GP', 'BL', 'MF'], + 591: ['BO'], + 592: ['GY'], + 593: ['EC'], + 594: ['GF'], + 595: ['PY'], + 596: ['MQ'], + 597: ['SR'], + 598: ['UY'], + 599: ['CW', 'BQ'], + 670: ['TL'], + 672: ['NF'], + 673: ['BN'], + 674: ['NR'], + 675: ['PG'], + 676: ['TO'], + 677: ['SB'], + 678: ['VU'], + 679: ['FJ'], + 680: ['PW'], + 681: ['WF'], + 682: ['CK'], + 683: ['NU'], + 685: ['WS'], + 686: ['KI'], + 687: ['NC'], + 688: ['TV'], + 689: ['PF'], + 690: ['TK'], + 691: ['FM'], + 692: ['MH'], + 800: ['001'], + 808: ['001'], + 850: ['KP'], + 852: ['HK'], + 853: ['MO'], + 855: ['KH'], + 856: ['LA'], + 870: ['001'], + 878: ['001'], + 880: ['BD'], + 881: ['001'], + 882: ['001'], + 883: ['001'], + 886: ['TW'], + 888: ['001'], + 960: ['MV'], + 961: ['LB'], + 962: ['JO'], + 963: ['SY'], + 964: ['IQ'], + 965: ['KW'], + 966: ['SA'], + 967: ['YE'], + 968: ['OM'], + 970: ['PS'], + 971: ['AE'], + 972: ['IL'], + 973: ['BH'], + 974: ['QA'], + 975: ['BT'], + 976: ['MN'], + 977: ['NP'], + 979: ['001'], + 992: ['TJ'], + 993: ['TM'], + 994: ['AZ'], + 995: ['GE'], + 996: ['KG'], + 998: ['UZ'], +}; + +/** + * Determines the country code based on the provided phone number. + * This function employs a multi-step approach to identify the country code: + * - If the phone number starts with '+', it extracts the numeric characters + * and matches the leading digits with known dial codes mapped to countries. + * - For matched dial codes, it further filters based on country-specific regex patterns + * to validate the phone number format for those countries. + * - If the phone number doesn't start with '+', it directly matches the number + * against regular expressions associated with various countries to identify the code. + * + * @param phoneNumber The input phone number (string or number). + * @returns The detected country code or an empty string if not found. + */ +const detectCountryCodeFromDialCode = (phoneNumber) => { + // If the phone number starts with '+', extract numeric characters + if (phoneNumber.toString().charAt(0) === '+') { + const cleanedPhoneNumberWithoutPlusPrefix = phoneNumber + .toString() + .replace(/\D/g, ''); + const matchingCountries = []; + // Iterate through dial codes and check for matches with cleaned phone number + for (const code in DIAL_CODE_MAPPER) { + if (cleanedPhoneNumberWithoutPlusPrefix.startsWith(code)) { + matchingCountries.push(...DIAL_CODE_MAPPER[code]); + } + } + // Filter matching countries based on phone number validation regex + const matchedCountryCode = matchingCountries.find((countryCode) => { + const regex = PHONE_REGEX_MAPPER[countryCode]; + if (regex && regex.test(phoneNumber.toString())) + return countryCode; + return undefined; + }); + // Return the first matched country code, if any + return matchedCountryCode || ''; + } + else { + // If phone number doesn't start with '+', directly match against country regexes + for (const countryCode in PHONE_REGEX_MAPPER) { + const regex = PHONE_REGEX_MAPPER[countryCode]; + if (regex.test(phoneNumber.toString())) { + return countryCode; + } + } + } + // Return empty string if no country code is detected + return ''; +}; +const cleanPhoneNumber = (phoneNumber) => { + // Regular expression to match all characters except numbers and + sign at the start + const regex = /[^0-9+]|(?!A)\+/g; + // Replace matched characters with an empty string + const cleanedPhoneNumber = phoneNumber.replace(regex, ''); + return phoneNumber[0] === '+' ? `+${cleanedPhoneNumber}` : cleanedPhoneNumber; +}; + +// Validates whether a given phone number is valid based on the provided country code or auto-detects the country code and checks if the number matches the defined regex pattern for that country. +const isValidPhoneNumber = (phoneNumber, countryCode) => { + // Clean the provided phoneNumber by removing non-numeric characters + const cleanedPhoneNumber = cleanPhoneNumber(phoneNumber.toString()); + // Detect or validate the country code + countryCode = + countryCode && countryCode in PHONE_REGEX_MAPPER + ? countryCode + : detectCountryCodeFromDialCode(cleanedPhoneNumber); + // Return false if phoneNumber is empty + if (!phoneNumber) + return false; + // Check if the countryCode exists in the PHONE_REGEX_MAPPER + if (countryCode in PHONE_REGEX_MAPPER) { + // Fetch the regex pattern for the countryCode + const regex = PHONE_REGEX_MAPPER[countryCode]; + // Test if the cleanedPhoneNumber matches the regex pattern + return regex.test(cleanedPhoneNumber); + } + // Return false if the countryCode is not supported + return false; +}; +var isValidPhoneNumber$1 = withErrorBoundary(isValidPhoneNumber); + +const PHONE_FORMATTER_MAPPER = { + IN: 'xxxx xxxxxx', + MY: 'xx xxxxx xx', + AE: 'xx xxx xxxx', + AL: 'xxx xx xxxx', + AM: 'xx xx xx xx', + AR: 'xxxx-xxxx', + AU: 'xxx xxx xxx', + AW: 'xxx-xxxx', + BB: 'xxx-xxxx', + BD: 'xxxx-xxxxxx', + BM: 'xxx-xxxx', + BN: 'xxxx-xxxx', + BO: 'xxxx-xxxx', + BS: 'xxx-xxxx', + BW: 'xx xxxx xxxx', + BZ: 'xxx-xxxx', + CA: 'xxx-xxx-xxxx', + CH: 'xxx xxx xxx', + CN: 'xxxx-xxxxxxx', + CO: 'xxxx-xxxxxxx', + CR: 'xxxx-xxxx', + CU: 'xxxx-xxxx', + CZ: 'xxx xxx xxx', + DK: 'xx xx xx xx', + DO: 'xxx-xxxxxxx', + DZ: 'xxxx-xxxx-xxx', + EG: 'xx xxx xxxx', + ET: 'xx xxx xxxx', + EU: 'xxx xx xx xx', + FJ: 'xxxx xxxx', + GB: 'xxxx xxx xxx', + GH: 'xxx xxx xxxx', + GI: 'xxxx xxxx', + GM: 'xxxx-xxxx', + GT: 'xxxx-xxxx', + GY: 'xxx-xxxx', + HK: 'xxxx xxxx', + HN: 'xxxx-xxxx', + HR: 'xxx xxx xxxx', + HT: 'xxx-xxxx', + HU: 'xxx xxx xxxx', + ID: 'xxxx-xxxx-xxxx', + IL: 'xxxx-xxx-xxx', + JM: 'xxx-xxxx', + KE: 'xxx xxxxxx', + KG: 'xxx-xx-xx-xx', + KH: 'xxx-xxx-xxx', + KY: 'xxx-xxxx', + KZ: 'xxx-xxx-xx-xx', + LA: 'xxx xx xxxx', + LK: 'xx xxx xxxx', + LR: 'xxx-xxx-xxxx', + LS: 'xxx xx xxxx', + LT: 'xxx xxxxx', + LU: 'xxx xx xxx', + LV: 'xxxx xxxx', + MA: 'xxxx-xxxxxx', + MD: 'xx xxxxxx', + ME: 'xx xxxxxx', + MG: 'xx xx xx xx xx', + MK: 'xx xx xx xx', + MM: 'xx xxxxxx', + MN: 'xxx-xx-xxxx', + MO: 'xxxx xxxx', + MU: 'xx xxxx xxxx', + MV: 'xxxxxx', + MW: 'xx xxxx xxxx', + MX: 'xxx-xxx-xxxx', + MZ: 'xx xxxxxxx', + NA: 'xx xxxx xxxx', + NG: 'xxx xxx xxxx', + NI: 'xxxx-xxxx', + NL: 'xxx-xxxxxxx', + NO: 'xxxx xxxx', + NP: 'xxxx-xxxxxxx', + NZ: 'xxx-xxxxxxx', + OM: 'xxxx-xxxx', + PA: 'xxx-xxxx', + PE: 'xxx-xxx-xxx', + PG: 'xxx-xxxxxx', + PH: 'xxx-xxxx', + PK: 'xxx-xxxxxxx', + PL: 'xxx xxx xxx', + PR: 'xxx-xxx-xxxx', + PS: 'xxxx-xxxxxxx', + PT: 'xxx xxx xxx', + PY: 'xxx-xxxxxx', + QA: 'xxxx xxxx', + RO: 'xxx xxx xxxx', + RS: 'xxx xxxxx', + RU: 'xxx xxx-xx-xx', + RW: 'xxx xxxxxx', + SA: 'xxx-xxxxxxx', + SC: 'xx xxxxx', + SE: 'xxx-xxx xx xx', + SG: 'xxxx xxxx', + SI: 'xx xxxxxx', + SK: 'xxx xxx xxx', + SL: 'xxx-xxxxxx', + SM: 'xxxxx xxxxx', + SN: 'xx xxx xx xx', + SO: 'xxx xxxxxxx', + SR: 'xxx-xxxx', + SS: 'xxx xxxx xxx', + SV: 'xxxx-xxxx', + SZ: 'xxx xx xxxx', + TG: 'xx xx xx xx', + TH: 'xxx-xxxxxxx', + TJ: 'xxx xx xx xx', + TL: 'xxx-xxxxxxx', + TN: 'xx xxxxxx', + TR: 'xxx xxx xx xx', + TT: 'xxx-xxxx', + TW: 'xxxx-xxxxxx', + TZ: 'xxx xxx xxxx', + UA: 'xx xxx xx xx', + UG: 'xxx xxxxxxx', + US: 'xxx-xxx-xxxx', + UY: 'xxx-xxxxx', + UZ: 'xxx-xxx-xx-xx', + VC: 'xxx-xxxx', + VE: 'xxxx-xxx-xxxx', + VN: 'xxxx-xxxxxxx', + YE: 'xxxx-xxxx', + ZA: 'xxx-xxx-xxxx', + ZM: 'xxx-xxxxxxx', + ZW: 'xx xxx xxxx', + KW: 'xxx xx xxxx', + BH: 'xxxx xxxx', +}; + +// Formats a provided phone number according to the predefined format for a specific country code, or auto-detects the country code and formats the number accordingly. +const formatPhoneNumber = (phoneNumber, countryCode) => { + // Throw errors if phoneNumber is invalid + if (!phoneNumber) + throw new Error('Parameter `phoneNumber` is invalid!'); + // Convert phoneNumber to string and clean it by removing non-numeric characters + phoneNumber = phoneNumber.toString(); + phoneNumber = cleanPhoneNumber(phoneNumber); + // Detect or validate the country code + countryCode = + countryCode && countryCode in PHONE_FORMATTER_MAPPER + ? countryCode + : detectCountryCodeFromDialCode(phoneNumber); + // Fetch the pattern for the countryCode from the PHONE_FORMATTER_MAPPER + const pattern = PHONE_FORMATTER_MAPPER[countryCode]; + if (!pattern) + return phoneNumber; + // Count the number of 'x' characters in the format pattern + let charCountInFormatterPattern = 0; + for (let i = 0; i < pattern.length; i++) { + if (pattern[i] === 'x') { + charCountInFormatterPattern++; + } + } + // Calculate the difference between phoneNumber length and 'x' characters count in pattern + const diff = phoneNumber.length - charCountInFormatterPattern; + // Extract the phoneNumber without the prefix + const phoneNumberWithoutPrefix = phoneNumber.slice(diff); + const formattedNumber = []; + let numberIndex = 0; + // Loop through the pattern to format the phoneNumber + for (let i = 0; i < pattern.length; i++) { + const patternChar = pattern[i]; + if (patternChar === 'x') { + // Insert phoneNumber digits at 'x' positions + if (numberIndex < phoneNumberWithoutPrefix.length) { + formattedNumber.push(phoneNumberWithoutPrefix[numberIndex]); + numberIndex++; + } + } + else { + // Insert non-digit characters from the pattern + formattedNumber.push(patternChar); + } + } + // Join the formattedNumber array to create the formattedPhoneNumber without prefix + const formattedPhoneNumberWithoutPrefix = formattedNumber.join(''); + // Combine the prefix and formattedPhoneNumberWithoutPrefix + const formattedPhoneNumberWithPrefix = phoneNumber.slice(0, diff) + ' ' + formattedPhoneNumberWithoutPrefix; + // Return the formattedPhoneNumber with prefix after trimming whitespace + return formattedPhoneNumberWithPrefix.trim(); +}; +var formatPhoneNumber$1 = withErrorBoundary(formatPhoneNumber); + +// Parses a given phone number, identifies its country code (if not provided), and returns an object with details including the country code, formatted phone number, dial code, and format template. +const parsePhoneNumber = (phoneNumber, country) => { + // Throw errors if phoneNumber is invalid + if (!phoneNumber) + throw new Error('Parameter `phoneNumber` is invalid!'); + // Clean the phoneNumber by removing non-numeric characters + phoneNumber = phoneNumber.toString(); + phoneNumber = cleanPhoneNumber(phoneNumber); + // Detect or validate the country code + const countryCode = country && country in PHONE_FORMATTER_MAPPER + ? country + : detectCountryCodeFromDialCode(phoneNumber); + // Format the phone number using the detected/validated country code + const formattedPhoneNumber = formatPhoneNumber$1(phoneNumber, countryCode); + // Fetch the pattern associated with the countryCode from the PHONE_FORMATTER_MAPPER + const pattern = PHONE_FORMATTER_MAPPER[countryCode]; + if (!pattern) + return { + countryCode: countryCode || '', + dialCode: '', + formattedPhoneNumber: phoneNumber, + formatTemplate: '', + }; + // Count the number of 'x' characters in the format pattern + let charCountInFormatterPattern = 0; + for (let i = 0; i < pattern.length; i++) { + if (pattern[i] === 'x') { + charCountInFormatterPattern++; + } + } + // Calculate the difference between phoneNumber length and 'x' characters count in pattern + const diff = phoneNumber.length - charCountInFormatterPattern; + // Extract the dialCode from the phoneNumber + const dialCode = phoneNumber.slice(0, diff); + // Obtain the format template associated with the countryCode + const formatTemplate = PHONE_FORMATTER_MAPPER[countryCode]; + // Return the parsed phone number information + return { + countryCode, + formattedPhoneNumber, + dialCode, + formatTemplate, + }; +}; +var parsePhoneNumber$1 = withErrorBoundary(parsePhoneNumber); + +/** + * Adds a specified amount of time to a date. + * + * @param date The original date. + * @param value The amount to add. + * @param unit The unit of time to add (e.g., 'days', 'months', 'years'). + * @returns A new Date object with the time added. + */ +const add = (date, value, unit) => { + const result = new Date(date); + switch (unit) { + case 'days': + result.setDate(result.getDate() + value); + break; + case 'months': + result.setMonth(result.getMonth() + value); + break; + case 'years': + result.setFullYear(result.getFullYear() + value); + break; + } + return result; +}; +var add$1 = withErrorBoundary(add); + +/** + * Formats date and time based on the locale. + * @param {DateInput} date - Date object or date string. + * @param {Locale} locale - Locale string. + * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional). + * @returns {string} Formatted date and time string. + */ +const formatDateTime = (date, locale, options = {}) => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) + locale = state.getState().locale || getLocale(); + const dateObj = date instanceof Date ? date : new Date(date); + let formatter; + try { + formatter = new Intl.DateTimeFormat(locale, options); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + return formatter.format(dateObj); +}; +var formatDateTime$1 = withErrorBoundary(formatDateTime); + +/** + * Formats date based on the locale. + * @param {DateInput} date - Date object or date string. + * @param {Locale} locale - Locale string. + * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional). + * @returns {string} Formatted date string. + */ +const formatDate = (date, locale, options = {}) => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) + locale = state.getState().locale || getLocale(); + const fullOptions = Object.assign(Object.assign({}, options), { timeStyle: undefined }); + let formattedDate; + try { + formattedDate = formatDateTime$1(date, locale, fullOptions); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + return formattedDate; +}; +var formatDate$1 = withErrorBoundary(formatDate); + +/** + * Formats time based on the locale. + * @param {DateInput} date - Date object or date string. + * @param {Locale} locale - Locale string. + * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional). + * @returns {string} Formatted time string. + */ +const formatTime = (date, locale, options = {}) => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) + locale = state.getState().locale || getLocale(); + const fullOptions = Object.assign(Object.assign({}, options), { dateStyle: undefined }); + let formattedTime; + try { + formattedTime = formatDateTime$1(date, locale, fullOptions); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + return formattedTime; +}; +var formatTime$1 = withErrorBoundary(formatTime); + +/** + * Gets the first day of the week for a given locale. + * + * @param locale The locale to determine the first day of the week for. + * @returns The first day of the week (0-6, where 0 is Sunday). + */ +const getFirstDayOfWeek = (locale) => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) + locale = state.getState().locale || getLocale(); + let formatted; + try { + const formatter = new Intl.DateTimeFormat(locale, { weekday: 'short' }); + const sampleDate = new Date(2000, 0, 2); // A Sunday + formatted = formatter.format(sampleDate); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + return ['su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'].indexOf(formatted.slice(0, 2).toLowerCase()); +}; +var getFirstDayOfWeek$1 = withErrorBoundary(getFirstDayOfWeek); + +/** + * Determines the quarter of the year for a given date. + * + * @param date The date to determine the quarter for. + * @returns The quarter of the year (1-4). + */ +const getQuarter = (date) => { + return Math.ceil((date.getMonth() + 1) / 3); +}; +var getQuarter$1 = withErrorBoundary(getQuarter); + +/** + * Provides a relative time string (e.g., '3 hours ago', 'in 2 days'). + * This function calculates the difference between the given date and the base date, + * then formats it in a locale-sensitive manner. It allows customization of the output + * through Intl.RelativeTimeFormat options. + * + * @param date - The date to compare. + * @param baseDate - The date to compare against (default: current date). + * @param locale - The locale to use for formatting. + * @param options - Options for the Intl.RelativeTimeFormat (optional). + * @returns The relative time as a string. + */ +const getRelativeTime = (date, baseDate = new Date(), locale, options) => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) + locale = state.getState().locale || getLocale(); + const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000; + // Define time units in seconds + const minute = 60; + const hour = minute * 60; + const day = hour * 24; + const week = day * 7; + const month = day * 30; + const year = day * 365; + let value; + let unit; + if (Math.abs(diffInSeconds) < minute) { + value = diffInSeconds; + unit = 'second'; + } + else if (Math.abs(diffInSeconds) < hour) { + value = diffInSeconds / minute; + unit = 'minute'; + } + else if (Math.abs(diffInSeconds) < day) { + value = diffInSeconds / hour; + unit = 'hour'; + } + else if (Math.abs(diffInSeconds) < week) { + value = diffInSeconds / day; + unit = 'day'; + } + else if (Math.abs(diffInSeconds) < month) { + value = diffInSeconds / week; + unit = 'week'; + } + else if (Math.abs(diffInSeconds) < year) { + value = diffInSeconds / month; + unit = 'month'; + } + else { + value = diffInSeconds / year; + unit = 'year'; + } + let relativeTime; + try { + const rtf = new Intl.RelativeTimeFormat(locale, options); + relativeTime = rtf.format(Math.round(value), unit); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + return relativeTime; +}; +var getRelativeTime$1 = withErrorBoundary(getRelativeTime); + +/** + * Calculates the week number of the year for a given date. + * + * @param date The date to calculate the week number for. + * @returns The week number of the year. + */ +const getWeek = (date) => { + const firstDayOfYear = new Date(date.getFullYear(), 0, 1); + const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000; + return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7); +}; +var getWeek$1 = withErrorBoundary(getWeek); + +/** + * Returns an array of weekdays according to the specified locale. + * + * @param locale The locale to get weekdays for. + * @returns An array of weekday names. + */ +const getWeekdays = (locale) => { + try { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) + locale = state.getState().locale || getLocale(); + const formatter = new Intl.DateTimeFormat(locale, { weekday: 'long' }); + return Array.from({ length: 7 }, (_, i) => formatter.format(new Date(1970, 0, 4 + i))); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } +}; +var getWeekdays$1 = withErrorBoundary(getWeekdays); + +/** + * Compares two dates to determine if the first is after the second. + * @param {DateInput} date1 - First date object or date string. + * @param {DateInput} date2 - Second date object or date string. + * @returns {boolean} True if date1 is after date2. + */ +const isAfter = (date1, date2) => { + const dateObj1 = date1 instanceof Date ? date1 : new Date(date1); + const dateObj2 = date2 instanceof Date ? date2 : new Date(date2); + return dateObj1 > dateObj2; +}; +var isAfter$1 = withErrorBoundary(isAfter); + +/** + * Compares two dates to determine if the first is before the second. + * @param {DateInput} date1 - First date object or date string. + * @param {DateInput} date2 - Second date object or date string. + * @returns {boolean} True if date1 is before date2. + */ +const isBefore = (date1, date2) => { + const dateObj1 = date1 instanceof Date ? date1 : new Date(date1); + const dateObj2 = date2 instanceof Date ? date2 : new Date(date2); + return dateObj1 < dateObj2; +}; +var isBefore$1 = withErrorBoundary(isBefore); + +/** + * Checks if a given year is a leap year. + * + * @param year The year to check. + * @returns True if the year is a leap year, false otherwise. + */ +const isLeapYear = (year) => { + return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; +}; +var isLeapYear$1 = withErrorBoundary(isLeapYear); + +/** + * Checks if two dates fall on the same day. + * + * @param date1 The first date. + * @param date2 The second date. + * @returns True if both dates are on the same day, false otherwise. + */ +const isSameDay = (date1, date2) => { + return (date1.getDate() === date2.getDate() && + date1.getMonth() === date2.getMonth() && + date1.getFullYear() === date2.getFullYear()); +}; +var isSameDay$1 = withErrorBoundary(isSameDay); + +/** + * Checks if a given object is a valid Date object. + * + * @param date The object to check. + * @returns True if the object is a valid Date, false otherwise. + */ +const isValidDate = (date) => { + return date instanceof Date && !isNaN(date.getTime()); +}; +var isValidDate$1 = withErrorBoundary(isValidDate); + +const LOCALE_DATE_FORMATS = { + 'ar-AE': 'DD/MM/YYYY', + 'sq-AL': 'DD.MM.YYYY', + 'hy-AM': 'DD.MM.YYYY', + 'es-AR': 'DD/MM/YYYY', + 'en-AU': 'DD/MM/YYYY', + 'nl-AW': 'DD-MM-YYYY', + 'en-BB': 'MM/DD/YYYY', + 'bn-BD': 'DD/MM/YYYY', + 'en-BM': 'MM/DD/YYYY', + 'ms-BN': 'DD/MM/YYYY', + 'es-BO': 'DD/MM/YYYY', + 'en-BS': 'MM/DD/YYYY', + 'en-BW': 'DD/MM/YYYY', + 'en-BZ': 'MM/DD/YYYY', + 'en-CA': 'DD/MM/YYYY', + 'de-CH': 'DD.MM.YYYY', + 'zh-CN': 'YYYY/MM/DD', + 'es-CO': 'DD/MM/YYYY', + 'es-CR': 'DD/MM/YYYY', + 'es-CU': 'DD/MM/YYYY', + 'cs-CZ': 'DD.MM.YYYY', + 'da-DK': 'DD-MM-YYYY', + 'es-DO': 'DD/MM/YYYY', + 'ar-DZ': 'DD/MM/YYYY', + 'ar-EG': 'DD/MM/YYYY', + 'am-ET': 'DD/MM/YYYY', + 'en-EU': 'DD/MM/YYYY', + 'en-FJ': 'DD/MM/YYYY', + 'en-GB': 'DD/MM/YYYY', + 'en-GH': 'DD/MM/YYYY', + 'en-GI': 'DD/MM/YYYY', + 'en-GM': 'DD/MM/YYYY', + 'es-GT': 'DD/MM/YYYY', + 'en-GY': 'DD/MM/YYYY', + 'en-HK': 'DD/MM/YYYY', + 'es-HN': 'DD/MM/YYYY', + 'hr-HR': 'DD.MM.YYYY', + 'ht-HT': 'MM/DD/YYYY', + 'hu-HU': 'YYYY. MM. DD.', + 'id-ID': 'DD/MM/YYYY', + 'he-IL': 'DD/MM/YYYY', + 'en-IN': 'DD-MM-YYYY', + 'en-JM': 'MM/DD/YYYY', + 'en-KE': 'DD/MM/YYYY', + 'ky-KG': 'DD.MM.YYYY', + 'km-KH': 'DD/MM/YYYY', + 'en-KY': 'MM/DD/YYYY', + 'kk-KZ': 'DD.MM.YYYY', + 'lo-LA': 'DD/MM/YYYY', + 'si-LK': 'YYYY-MM-DD', + 'en-LR': 'MM/DD/YYYY', + 'en-LS': 'DD/MM/YYYY', + 'ar-MA': 'DD/MM/YYYY', + 'ro-MD': 'DD.MM.YYYY', + 'mk-MK': 'DD.MM.YYYY', + 'my-MM': 'DD/MM/YYYY', + 'mn-MN': 'YYYY.MM.DD', + 'zh-MO': 'DD/MM/YYYY', + 'en-MU': 'DD/MM/YYYY', + 'dv-MV': 'DD/MM/YYYY', + 'en-MW': 'DD/MM/YYYY', + 'es-MX': 'DD/MM/YYYY', + 'ms-MY': 'DD/MM/YYYY', + 'en-NA': 'DD/MM/YYYY', + 'en-NG': 'DD/MM/YYYY', + 'es-NI': 'DD/MM/YYYY', + 'no-NO': 'DD.MM.YYYY', + 'ne-NP': 'YYYY/MM/DD', + 'en-NZ': 'DD/MM/YYYY', + 'es-PE': 'DD/MM/YYYY', + 'en-PG': 'DD/MM/YYYY', + 'en-PH': 'MM/DD/YYYY', + 'en-PK': 'DD/MM/YYYY', + 'ar-QA': 'DD/MM/YYYY', + 'ru-RU': 'DD.MM.YYYY', + 'ar-SA': 'DD/MM/YYYY', + 'en-SC': 'DD/MM/YYYY', + 'sv-SE': 'YYYY-MM-DD', + 'en-SG': 'DD/MM/YYYY', + 'en-SL': 'DD/MM/YYYY', + 'so-SO': 'DD/MM/YYYY', + 'en-SS': 'DD/MM/YYYY', + 'es-SV': 'DD/MM/YYYY', + 'en-SZ': 'DD/MM/YYYY', + 'th-TH': 'DD/MM/YYYY', + 'en-TT': 'MM/DD/YYYY', + 'sw-TZ': 'DD/MM/YYYY', + 'en-US': 'MM/DD/YYYY', + 'es-UY': 'DD/MM/YYYY', + 'uz-UZ': 'DD/MM/YYYY', + 'ar-YE': 'DD/MM/YYYY', + 'en-ZA': 'YYYY/MM/DD', + 'ar-KW': 'DD/MM/YYYY', + 'ar-BH': 'DD/MM/YYYY', + 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman) +}; + +/** + * Parses a date string based on a specific format. + * + * @param dateString The date string to parse. + * @param format The format to use for parsing. + * @returns The parsed Date object or null if parsing fails. + */ +const parseDateWithFormat = (dateString, format) => { + // Determine the separator based on the format (supports '/', '.', or '-') + const separator = format.includes('/') + ? '/' + : format.includes('.') + ? '.' + : '-'; + const formatParts = format.split(separator); + const dateParts = dateString.split(separator).map((num) => parseInt(num, 10)); + let year = 0, month = 0, day = 0; + let yearSet = false, monthSet = false, daySet = false; + // Check for format and date string mismatch + if (dateParts.length !== formatParts.length) { + return null; // Mismatch between date string and format + } + formatParts.forEach((part, index) => { + // Check for non-numeric values in date string + if (isNaN(dateParts[index])) { + return null; // Invalid date part + } + // Assign year, month, and day based on the format + switch (part) { + case 'DD': + day = dateParts[index]; + daySet = true; + break; + case 'MM': + month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date + monthSet = true; + break; + case 'YYYY': + year = dateParts[index]; + yearSet = true; + break; + } + }); + // Validate and create the date only if all parts are set + if (yearSet && monthSet && daySet) { + const parsedDate = new Date(year, month, day); + // Validate date to catch invalid dates like February 30th + if (parsedDate.getFullYear() === year && + parsedDate.getMonth() === month && + parsedDate.getDate() === day) { + return parsedDate; + } + } + return null; // Invalid date or incomplete date information +}; +var parseDateWithFormat$1 = withErrorBoundary(parseDateWithFormat); + +/** + * Attempts to parse a string into a date object based on locale. + * Uses the localeDateFormats mapping for determining the date format. + * + * @param dateString - The date string to parse. + * @param locale - The locale to use for parsing. + * @returns The parsed Date object or null if parsing fails. + */ +const parseDate = (dateString, locale) => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) + locale = state.getState().locale || getLocale(); + const format = LOCALE_DATE_FORMATS[locale]; + if (!format) { + throw new Error(`No date format found for locale: ${locale}`); + } + return parseDateWithFormat$1(dateString, format); +}; +var parseDate$1 = withErrorBoundary(parseDate); + +/** + * Subtracts a specified amount of time from a date. + * + * @param date The original date. + * @param value The amount to subtract. + * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years'). + * @returns A new Date object with the time subtracted. + */ +const subtract = (date, value, unit) => { + return add$1(date, -value, unit); // Reuse the add function with negative value +}; +var subtract$1 = withErrorBoundary(subtract); + +exports.add = add$1; +exports.formatDate = formatDate$1; +exports.formatDateTime = formatDateTime$1; +exports.formatNumber = formatNumber$1; +exports.formatNumberByParts = formatNumberByParts$1; +exports.formatPhoneNumber = formatPhoneNumber$1; +exports.formatTime = formatTime$1; +exports.getCurrencyList = getCurrencyList$1; +exports.getCurrencySymbol = getCurrencySymbol$1; +exports.getFirstDayOfWeek = getFirstDayOfWeek$1; +exports.getQuarter = getQuarter$1; +exports.getRelativeTime = getRelativeTime$1; +exports.getState = getState$1; +exports.getWeek = getWeek$1; +exports.getWeekdays = getWeekdays$1; +exports.isAfter = isAfter$1; +exports.isBefore = isBefore$1; +exports.isLeapYear = isLeapYear$1; +exports.isSameDay = isSameDay$1; +exports.isValidDate = isValidDate$1; +exports.isValidPhoneNumber = isValidPhoneNumber$1; +exports.parseDate = parseDate$1; +exports.parsePhoneNumber = parsePhoneNumber$1; +exports.resetState = resetState$1; +exports.setState = setState$1; +exports.subtract = subtract$1; diff --git a/lib/esm/core/index.d.ts b/lib/esm/core/index.d.ts new file mode 100644 index 00000000..13c528ac --- /dev/null +++ b/lib/esm/core/index.d.ts @@ -0,0 +1,13 @@ +interface I18nState { + locale: string; + direction: 'ltr' | 'rtl' | string; + country: string; +} + +declare const _default$2: () => I18nState; + +declare const _default$1: (newState: Partial) => void; + +declare const _default: () => void; + +export { _default$2 as getState, _default as resetState, _default$1 as setState }; diff --git a/lib/esm/core/index.js b/lib/esm/core/index.js new file mode 100644 index 00000000..1f8d0378 --- /dev/null +++ b/lib/esm/core/index.js @@ -0,0 +1,110 @@ +// Custom Error class to extend properties to error object +class I18nifyError extends Error { + constructor(message) { + super(message); + this.name = 'i18nify Error'; + this.timestamp = new Date(); + // more params like type of error/severity can be added in future for better debugging. + } +} +/** + * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block. + * It appends additional attributes and serves as a centralized error-handling service. + * Usage => + * const wrappedUtilityFn = withErrorBoundary(utilityFn) + * + * @param fn utility that is wrapped in error boundary + * @returns {Function} returns the function wrapped in try/catch block + */ +const withErrorBoundary = (fn) => { + return function (...rest) { + try { + return fn.call(this, ...rest); + } + catch (err) { + console.warn('[I18N Error]: ', err); + // Currently, we are throwing the error as it is to consumers. + // In the future, this can be modified as per our requirement, like an error logging service. + throw new I18nifyError(err); + } + }; +}; + +function getDefaultState() { + return { + locale: '', + direction: '', + country: '', + }; +} + +class I18nStateManager { + constructor() { + this.state = getDefaultState(); + } + static getInstance() { + if (!I18nStateManager.instance) { + I18nStateManager.instance = new I18nStateManager(); + } + return I18nStateManager.instance; + } + static resetInstance() { + I18nStateManager.instance = undefined; + } + getState() { + return Object.assign({}, this.state); + } + setState(newState) { + this.state = Object.assign(Object.assign({}, this.state), newState); + } + resetState() { + this.state = getDefaultState(); + } +} +var state = I18nStateManager.getInstance(); + +/** + * function to return active i18n state + * + * ===== USAGE ===== + * import { getState } from '@razorpay/i18nify-js'; + * + * console.log(getState()) + * + * @returns i18n state + */ +const getState = () => { + return state.getState(); +}; +var getState$1 = withErrorBoundary(getState); + +/** + * Function to set and override the active state in i18nify SDK + * + * ===== USAGE ===== + * import { setState } from "@razorpay/i18nify-js"; + * setState({locale: 'en-US'}) + * + * @param newState data to set in i18nState instance + */ +const setState = (newState) => { + state.setState(newState); +}; +var setState$1 = withErrorBoundary(setState); + +/** + * Function to reset the active state in i18nify SDK + * + * ===== USAGE ===== + * import { resetState } from "@razorpay/i18nify-js"; + * resetState() + * + * @param newState data to set in i18nState instance + */ +const resetState = () => { + state.resetState(); +}; +var resetState$1 = withErrorBoundary(resetState); + +export { getState$1 as getState, resetState$1 as resetState, setState$1 as setState }; +//# sourceMappingURL=index.js.map diff --git a/lib/esm/core/index.js.map b/lib/esm/core/index.js.map new file mode 100644 index 00000000..c6bb15e0 --- /dev/null +++ b/lib/esm/core/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["../../../src/common/errorBoundary/index.ts","../../../src/modules/.internal/utils/getDefaultState.ts","../../../src/modules/.internal/state/index.ts","../../../src/modules/core/getState.ts","../../../src/modules/core/setState.ts","../../../src/modules/core/resetState.ts"],"sourcesContent":["// Custom Error class to extend properties to error object\nexport class I18nifyError extends Error {\n timestamp: Date;\n constructor(message: string | undefined) {\n super(message);\n this.name = 'i18nify Error';\n this.timestamp = new Date();\n // more params like type of error/severity can be added in future for better debugging.\n }\n}\n\n/**\n * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block.\n * It appends additional attributes and serves as a centralized error-handling service.\n * Usage =>\n * const wrappedUtilityFn = withErrorBoundary(utilityFn)\n *\n * @param fn utility that is wrapped in error boundary\n * @returns {Function} returns the function wrapped in try/catch block\n */\nexport const withErrorBoundary = any>(\n fn: T,\n): ((...args: Parameters) => ReturnType) => {\n return function (this: unknown, ...rest: Parameters): ReturnType {\n try {\n return fn.call(this, ...rest) as ReturnType;\n } catch (err) {\n console.warn('[I18N Error]: ', err);\n // Currently, we are throwing the error as it is to consumers.\n // In the future, this can be modified as per our requirement, like an error logging service.\n throw new I18nifyError(err as string | undefined);\n }\n };\n};\n","import type { I18nState } from '../state/types';\n\nexport function getDefaultState(): I18nState {\n return {\n locale: '',\n direction: '',\n country: '',\n };\n}\n","import { I18nState } from './types';\nimport { getDefaultState } from '../utils/getDefaultState';\n\nexport class I18nStateManager {\n private static instance: I18nStateManager | undefined;\n private state: I18nState;\n\n private constructor() {\n this.state = getDefaultState();\n }\n\n public static getInstance(): I18nStateManager {\n if (!I18nStateManager.instance) {\n I18nStateManager.instance = new I18nStateManager();\n }\n\n return I18nStateManager.instance;\n }\n\n public static resetInstance(): void {\n I18nStateManager.instance = undefined;\n }\n\n public getState(): I18nState {\n return { ...this.state };\n }\n\n public setState(newState: Partial): void {\n this.state = { ...this.state, ...newState };\n }\n\n public resetState(): void {\n this.state = getDefaultState();\n }\n}\n\nexport default I18nStateManager.getInstance();\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * function to return active i18n state\n *\n * ===== USAGE =====\n * import { getState } from '@razorpay/i18nify-js';\n *\n * console.log(getState())\n *\n * @returns i18n state\n */\nconst getState = (): I18nState => {\n return state.getState();\n};\n\nexport default withErrorBoundary(getState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * Function to set and override the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { setState } from \"@razorpay/i18nify-js\";\n * setState({locale: 'en-US'})\n *\n * @param newState data to set in i18nState instance\n */\nconst setState = (newState: Partial): void => {\n state.setState(newState);\n};\n\nexport default withErrorBoundary(setState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\n\n/**\n * Function to reset the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { resetState } from \"@razorpay/i18nify-js\";\n * resetState()\n *\n * @param newState data to set in i18nState instance\n */\nconst resetState = (): void => {\n state.resetState();\n};\n\nexport default withErrorBoundary(resetState);\n"],"names":[],"mappings":"AAAA;AACM,MAAO,YAAa,SAAQ,KAAK,CAAA;AAErC,IAAA,WAAA,CAAY,OAA2B,EAAA;QACrC,KAAK,CAAC,OAAO,CAAC,CAAC;AACf,QAAA,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;AAC5B,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;;KAE7B;AACF,CAAA;AAED;;;;;;;;AAQG;AACI,MAAM,iBAAiB,GAAG,CAC/B,EAAK,KAC0C;IAC/C,OAAO,UAAyB,GAAG,IAAmB,EAAA;QACpD,IAAI;YACF,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAkB,CAAC;AAChD,SAAA;AAAC,QAAA,OAAO,GAAG,EAAE;AACZ,YAAA,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC;;;AAGpC,YAAA,MAAM,IAAI,YAAY,CAAC,GAAyB,CAAC,CAAC;AACnD,SAAA;AACH,KAAC,CAAC;AACJ,CAAC;;SC/Be,eAAe,GAAA;IAC7B,OAAO;AACL,QAAA,MAAM,EAAE,EAAE;AACV,QAAA,SAAS,EAAE,EAAE;AACb,QAAA,OAAO,EAAE,EAAE;KACZ,CAAC;AACJ;;MCLa,gBAAgB,CAAA;AAI3B,IAAA,WAAA,GAAA;AACE,QAAA,IAAI,CAAC,KAAK,GAAG,eAAe,EAAE,CAAC;KAChC;AAEM,IAAA,OAAO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ts b/lib/esm/currency/index.d.ts new file mode 100644 index 00000000..75ba176c --- /dev/null +++ b/lib/esm/currency/index.d.ts @@ -0,0 +1,35 @@ +declare const _default$3: (amount: string | number, options?: { + currency?: string | number | undefined; + locale?: string | undefined; + intlOptions?: Intl.NumberFormatOptions | undefined; +} | undefined) => string; + +declare const _default$2: () => { + [key: string]: { + symbol: string; + name: string; + }; +}; + +declare const _default$1: (currencyCode: string | number) => string; + +declare const ALLOWED_FORMAT_PARTS_KEYS: readonly ["nan", "infinity", "percent", "integer", "group", "decimal", "fraction", "plusSign", "minusSign", "percentSign", "currency", "code", "symbol", "name", "compact", "exponentInteger", "exponentMinusSign", "exponentSeparator", "unit"]; + +type FormattedPartsObject = { + [key in (typeof ALLOWED_FORMAT_PARTS_KEYS)[number]]?: string | undefined; +}; +interface ByParts extends FormattedPartsObject { + isPrefixSymbol: boolean; + rawParts: Array<{ + type: string; + value: unknown; + }>; +} + +declare const _default: (amount: string | number, options?: { + currency?: string | number | undefined; + locale?: string | undefined; + intlOptions?: Intl.NumberFormatOptions | undefined; +} | undefined) => ByParts; + +export { _default$3 as formatNumber, _default as formatNumberByParts, _default$2 as getCurrencyList, _default$1 as getCurrencySymbol }; diff --git a/lib/esm/currency/index.js b/lib/esm/currency/index.js new file mode 100644 index 00000000..fa44224f --- /dev/null +++ b/lib/esm/currency/index.js @@ -0,0 +1,289 @@ +// Custom Error class to extend properties to error object +class I18nifyError extends Error { + constructor(message) { + super(message); + this.name = 'i18nify Error'; + this.timestamp = new Date(); + // more params like type of error/severity can be added in future for better debugging. + } +} +/** + * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block. + * It appends additional attributes and serves as a centralized error-handling service. + * Usage => + * const wrappedUtilityFn = withErrorBoundary(utilityFn) + * + * @param fn utility that is wrapped in error boundary + * @returns {Function} returns the function wrapped in try/catch block + */ +const withErrorBoundary = (fn) => { + return function (...rest) { + try { + return fn.call(this, ...rest); + } + catch (err) { + console.warn('[I18N Error]: ', err); + // Currently, we are throwing the error as it is to consumers. + // In the future, this can be modified as per our requirement, like an error logging service. + throw new I18nifyError(err); + } + }; +}; + +function getDefaultState() { + return { + locale: '', + direction: '', + country: '', + }; +} + +class I18nStateManager { + constructor() { + this.state = getDefaultState(); + } + static getInstance() { + if (!I18nStateManager.instance) { + I18nStateManager.instance = new I18nStateManager(); + } + return I18nStateManager.instance; + } + static resetInstance() { + I18nStateManager.instance = undefined; + } + getState() { + return Object.assign({}, this.state); + } + setState(newState) { + this.state = Object.assign(Object.assign({}, this.state), newState); + } + resetState() { + this.state = getDefaultState(); + } +} +var state = I18nStateManager.getInstance(); + +const getLocale = () => { + // Check if running in a non-browser environment (e.g., Node.js or older browsers). + if (typeof navigator === 'undefined') { + return 'en-IN'; + } + // Check if the browser supports the Intl object and user language preferences. + if (window.Intl && + typeof window.Intl === 'object' && + (window.navigator.languages || window.navigator.language)) { + const userLocales = window.navigator.languages || [ + window.navigator.language, + ]; + return userLocales[0]; + } + // Fallback to a supported locale or the default locale. + return 'en-IN'; +}; + +const getIntlInstanceWithOptions = (options = {}) => { + /** retrieve locale from below areas in order of preference + * 1. options.locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + let locale = (options === null || options === void 0 ? void 0 : options.locale) || state.getState().locale; + // If a specific locale is provided, use it; otherwise, use the browser's locale + if (!locale) { + locale = getLocale(); + } + const intlOptions = (options === null || options === void 0 ? void 0 : options.intlOptions) ? Object.assign({}, options.intlOptions) : {}; + if ((options === null || options === void 0 ? void 0 : options.currency) || intlOptions.currency) { + intlOptions.style = 'currency'; + intlOptions.currency = (options.currency || intlOptions.currency); + } + if (!locale) + throw new Error('Pass valid locale !'); + return new Intl.NumberFormat(locale || undefined, intlOptions); +}; + +// this function formats number based on different arguments passed +const formatNumber = (amount, options = {}) => { + if (!Number(amount) && Number(amount) !== 0) + throw new Error('Parameter `amount` is not a number!'); + let formattedAmount = ''; + try { + formattedAmount = getIntlInstanceWithOptions(options).format(Number(amount)); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + return formattedAmount; +}; +var formatNumber$1 = withErrorBoundary(formatNumber); + +const CURRENCIES = { + AED: { symbol: 'د.إ', name: 'United Arab Emirates Dirham' }, + ALL: { symbol: 'Lek', name: 'Albanian Lek' }, + AMD: { symbol: '֏', name: 'Armenian Dram' }, + ARS: { symbol: 'ARS', name: 'Argentine Peso' }, + AUD: { symbol: 'A$', name: 'Australian Dollar' }, + AWG: { symbol: 'Afl.', name: 'Aruban Florin' }, + BBD: { symbol: '$', name: 'Barbadian Dollar' }, + BDT: { symbol: '৳', name: 'Bangladeshi Taka' }, + BMD: { symbol: '$', name: 'Bermudian Dollar' }, + BND: { symbol: 'BND', name: 'Brunei Dollar' }, + BOB: { symbol: 'Bs', name: 'Bolivian Boliviano' }, + BSD: { symbol: 'B$', name: 'Bahamian Dollar' }, + BWP: { symbol: 'P', name: 'Botswanan Pula' }, + BZD: { symbol: 'BZ$', name: 'Belize Dollar' }, + CAD: { symbol: 'C$', name: 'Canadian Dollar' }, + CHF: { symbol: 'CHf', name: 'Swiss Franc' }, + CNY: { symbol: '¥', name: 'Chinese Yuan' }, + COP: { symbol: 'COL$', name: 'Colombian Peso' }, + CRC: { symbol: '₡', name: 'Costa Rican Colón' }, + CUP: { symbol: '$MN', name: 'Cuban Peso' }, + CZK: { symbol: 'Kč', name: 'Czech Koruna' }, + DKK: { symbol: 'DKK', name: 'Danish Krone' }, + DOP: { symbol: 'RD$', name: 'Dominican Peso' }, + DZD: { symbol: 'د.ج', name: 'Algerian Dinar' }, + EGP: { symbol: 'E£', name: 'Egyptian Pound' }, + ETB: { symbol: 'ብር', name: 'Ethiopian Birr' }, + EUR: { symbol: '€', name: 'Euro' }, + FJD: { symbol: 'FJ$', name: 'Fijian Dollar' }, + GBP: { symbol: '£', name: 'British Pound' }, + GHS: { symbol: 'GH₵', name: 'Ghanaian Cedi' }, + GIP: { symbol: 'GIP', name: 'Gibraltar Pound' }, + GMD: { symbol: 'D', name: 'Gambian Dalasi' }, + GTQ: { symbol: 'Q', name: 'Guatemalan Quetzal' }, + GYD: { symbol: 'G$', name: 'Guyanese Dollar' }, + HKD: { symbol: 'HK$', name: 'Hong Kong Dollar' }, + HNL: { symbol: 'HNL', name: 'Honduran Lempira' }, + HRK: { symbol: 'kn', name: 'Croatian Kuna' }, + HTG: { symbol: 'G', name: 'Haitian Gourde' }, + HUF: { symbol: 'Ft', name: 'Hungarian Forint' }, + IDR: { symbol: 'Rp', name: 'Indonesian Rupiah' }, + ILS: { symbol: '₪', name: 'Israeli New Shekel' }, + INR: { symbol: '₹', name: 'Indian Rupee' }, + JMD: { symbol: 'J$', name: 'Jamaican Dollar' }, + KES: { symbol: 'Ksh', name: 'Kenyan Shilling' }, + KGS: { symbol: 'Лв', name: 'Kyrgystani Som' }, + KHR: { symbol: '៛', name: 'Cambodian Riel' }, + KYD: { symbol: 'CI$', name: 'Cayman Islands Dollar' }, + KZT: { symbol: '₸', name: 'Kazakhstani Tenge' }, + LAK: { symbol: '₭', name: 'Laotian Kip' }, + LKR: { symbol: 'රු', name: 'Sri Lankan Rupee' }, + LRD: { symbol: 'L$', name: 'Liberian Dollar' }, + LSL: { symbol: 'LSL', name: 'Lesotho Loti' }, + MAD: { symbol: 'د.م.', name: 'Moroccan Dirham' }, + MDL: { symbol: 'MDL', name: 'Moldovan Leu' }, + MKD: { symbol: 'ден', name: 'Macedonian Denar' }, + MMK: { symbol: 'MMK', name: 'Myanmar Kyat' }, + MNT: { symbol: '₮', name: 'Mongolian Tugrik' }, + MOP: { symbol: 'MOP$', name: 'Macanese Pataca' }, + MUR: { symbol: '₨', name: 'Mauritian Rupee' }, + MVR: { symbol: 'Rf', name: 'Maldivian Rufiyaa' }, + MWK: { symbol: 'MK', name: 'Malawian Kwacha' }, + MXN: { symbol: 'Mex$', name: 'Mexican Peso' }, + MYR: { symbol: 'RM', name: 'Malaysian Ringgit' }, + NAD: { symbol: 'N$', name: 'Namibian Dollar' }, + NGN: { symbol: '₦', name: 'Nigerian Naira' }, + NIO: { symbol: 'NIO', name: 'Nicaraguan Córdoba' }, + NOK: { symbol: 'NOK', name: 'Norwegian Krone' }, + NPR: { symbol: 'रू', name: 'Nepalese Rupee' }, + NZD: { symbol: 'NZ$', name: 'New Zealand Dollar' }, + PEN: { symbol: 'S/', name: 'Peruvian Nuevo Sol' }, + PGK: { symbol: 'PGK', name: 'Papua New Guinean Kina' }, + PHP: { symbol: '₱', name: 'Philippine Peso' }, + PKR: { symbol: '₨', name: 'Pakistani Rupee' }, + QAR: { symbol: 'QR', name: 'Qatari Riyal' }, + RUB: { symbol: '₽', name: 'Russian Ruble' }, + SAR: { symbol: 'SR', name: 'Saudi Riyal' }, + SCR: { symbol: 'SRe', name: 'Seychellois Rupee' }, + SEK: { symbol: 'SEK', name: 'Swedish Krona' }, + SGD: { symbol: 'S$', name: 'Singapore Dollar' }, + SLL: { symbol: 'Le', name: 'Sierra Leonean Leone' }, + SOS: { symbol: 'Sh.so.', name: 'Somali Shilling' }, + SSP: { symbol: 'SS£', name: 'South Sudanese Pound' }, + SVC: { symbol: '₡', name: 'Salvadoran Colón' }, + SZL: { symbol: 'E', name: 'Swazi Lilangeni' }, + THB: { symbol: '฿', name: 'Thai Baht' }, + TTD: { symbol: 'TT$', name: 'Trinidad and Tobago Dollar' }, + TZS: { symbol: 'Sh', name: 'Tanzanian Shilling' }, + USD: { symbol: '$', name: 'United States Dollar' }, + UYU: { symbol: '$U', name: 'Uruguayan Peso' }, + UZS: { symbol: "so'm", name: 'Uzbekistani Som' }, + YER: { symbol: '﷼', name: 'Yemeni Rial' }, + ZAR: { symbol: 'R', name: 'South African Rand' }, + KWD: { symbol: 'د.ك', name: 'Kuwaiti Dinar' }, + BHD: { symbol: 'د.ب.', name: 'Bahraini Dinar' }, + OMR: { symbol: 'ر.ع.', name: 'Omani Rial' }, +}; + +const getCurrencyList = () => { + return CURRENCIES; +}; +var getCurrencyList$1 = withErrorBoundary(getCurrencyList); + +const getCurrencySymbol = (currencyCode) => { + var _a; + if (currencyCode in CURRENCIES) + return (_a = CURRENCIES[currencyCode]) === null || _a === void 0 ? void 0 : _a.symbol; + else + throw new Error('Invalid currencyCode!'); +}; +var getCurrencySymbol$1 = withErrorBoundary(getCurrencySymbol); + +const ALLOWED_FORMAT_PARTS_KEYS = [ + 'nan', + 'infinity', + 'percent', + 'integer', + 'group', + 'decimal', + 'fraction', + 'plusSign', + 'minusSign', + 'percentSign', + 'currency', + 'code', + 'symbol', + 'name', + 'compact', + 'exponentInteger', + 'exponentMinusSign', + 'exponentSeparator', + 'unit', +]; + +const formatNumberByParts = (amount, options = {}) => { + if (!Number(amount) && Number(amount) !== 0) + throw new Error('Parameter `amount` is not a number!'); + try { + const formattedAmount = getIntlInstanceWithOptions(options).formatToParts(Number(amount)); + const parts = formattedAmount; + const formattedObj = {}; + parts.forEach((p) => { + if (p.type === 'group') { + formattedObj.integer = (formattedObj.integer || '') + p.value; + } + else if (ALLOWED_FORMAT_PARTS_KEYS.findIndex((item) => item === p.type) != -1) { + // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal' is skipped + formattedObj[p.type] = (formattedObj[p.type] || '') + p.value; + } + }); + return Object.assign(Object.assign({}, formattedObj), { isPrefixSymbol: parts[0].type === 'currency', rawParts: parts }); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } +}; +var formatNumberByParts$1 = withErrorBoundary(formatNumberByParts); + +export { formatNumber$1 as formatNumber, formatNumberByParts$1 as formatNumberByParts, getCurrencyList$1 as getCurrencyList, getCurrencySymbol$1 as getCurrencySymbol }; +//# sourceMappingURL=index.js.map diff --git a/lib/esm/currency/index.js.map b/lib/esm/currency/index.js.map new file mode 100644 index 00000000..1d984277 --- /dev/null +++ b/lib/esm/currency/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["../../../src/common/errorBoundary/index.ts","../../../src/modules/.internal/utils/getDefaultState.ts","../../../src/modules/.internal/state/index.ts","../../../src/modules/.internal/utils/getLocale.ts","../../../src/modules/.internal/utils/getIntlInstanceWithOptions.ts","../../../src/modules/currency/formatNumber.ts","../../../src/modules/currency/data/currencies.ts","../../../src/modules/currency/getCurrencyList.ts","../../../src/modules/currency/getCurrencySymbol.ts","../../../src/modules/currency/constants.ts","../../../src/modules/currency/formatNumberByParts.ts"],"sourcesContent":["// Custom Error class to extend properties to error object\nexport class I18nifyError extends Error {\n timestamp: Date;\n constructor(message: string | undefined) {\n super(message);\n this.name = 'i18nify Error';\n this.timestamp = new Date();\n // more params like type of error/severity can be added in future for better debugging.\n }\n}\n\n/**\n * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block.\n * It appends additional attributes and serves as a centralized error-handling service.\n * Usage =>\n * const wrappedUtilityFn = withErrorBoundary(utilityFn)\n *\n * @param fn utility that is wrapped in error boundary\n * @returns {Function} returns the function wrapped in try/catch block\n */\nexport const withErrorBoundary = any>(\n fn: T,\n): ((...args: Parameters) => ReturnType) => {\n return function (this: unknown, ...rest: Parameters): ReturnType {\n try {\n return fn.call(this, ...rest) as ReturnType;\n } catch (err) {\n console.warn('[I18N Error]: ', err);\n // Currently, we are throwing the error as it is to consumers.\n // In the future, this can be modified as per our requirement, like an error logging service.\n throw new I18nifyError(err as string | undefined);\n }\n };\n};\n","import type { I18nState } from '../state/types';\n\nexport function getDefaultState(): I18nState {\n return {\n locale: '',\n direction: '',\n country: '',\n };\n}\n","import { I18nState } from './types';\nimport { getDefaultState } from '../utils/getDefaultState';\n\nexport class I18nStateManager {\n private static instance: I18nStateManager | undefined;\n private state: I18nState;\n\n private constructor() {\n this.state = getDefaultState();\n }\n\n public static getInstance(): I18nStateManager {\n if (!I18nStateManager.instance) {\n I18nStateManager.instance = new I18nStateManager();\n }\n\n return I18nStateManager.instance;\n }\n\n public static resetInstance(): void {\n I18nStateManager.instance = undefined;\n }\n\n public getState(): I18nState {\n return { ...this.state };\n }\n\n public setState(newState: Partial): void {\n this.state = { ...this.state, ...newState };\n }\n\n public resetState(): void {\n this.state = getDefaultState();\n }\n}\n\nexport default I18nStateManager.getInstance();\n","export const getLocale = (): string => {\n // Check if running in a non-browser environment (e.g., Node.js or older browsers).\n if (typeof navigator === 'undefined') {\n return 'en-IN';\n }\n\n // Check if the browser supports the Intl object and user language preferences.\n if (\n window.Intl &&\n typeof window.Intl === 'object' &&\n (window.navigator.languages || window.navigator.language)\n ) {\n const userLocales = window.navigator.languages || [\n window.navigator.language,\n ];\n return userLocales[0];\n }\n\n // Fallback to a supported locale or the default locale.\n return 'en-IN';\n};\n","import { CURRENCIES } from '../../currency/data/currencies';\nimport state from '../state';\nimport { getLocale } from './getLocale';\n\nexport const getIntlInstanceWithOptions = (\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n) => {\n /** retrieve locale from below areas in order of preference\n * 1. options.locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n let locale = options?.locale || state.getState().locale;\n\n // If a specific locale is provided, use it; otherwise, use the browser's locale\n if (!locale) {\n locale = getLocale();\n }\n\n const intlOptions = options?.intlOptions ? { ...options.intlOptions } : {};\n\n if (options?.currency || intlOptions.currency) {\n intlOptions.style = 'currency';\n intlOptions.currency = (options.currency || intlOptions.currency) as string;\n }\n\n if (!locale) throw new Error('Pass valid locale !');\n\n return new Intl.NumberFormat(locale || undefined, intlOptions);\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\n\n// this function formats number based on different arguments passed\nconst formatNumber = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): string => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n let formattedAmount = '';\n\n try {\n formattedAmount = getIntlInstanceWithOptions(options).format(\n Number(amount),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedAmount;\n};\n\nexport default withErrorBoundary(formatNumber);\n","export const CURRENCIES: { [key: string]: { symbol: string; name: string } } = {\n AED: { symbol: 'د.إ', name: 'United Arab Emirates Dirham' },\n ALL: { symbol: 'Lek', name: 'Albanian Lek' },\n AMD: { symbol: '֏', name: 'Armenian Dram' },\n ARS: { symbol: 'ARS', name: 'Argentine Peso' },\n AUD: { symbol: 'A$', name: 'Australian Dollar' },\n AWG: { symbol: 'Afl.', name: 'Aruban Florin' },\n BBD: { symbol: '$', name: 'Barbadian Dollar' },\n BDT: { symbol: '৳', name: 'Bangladeshi Taka' },\n BMD: { symbol: '$', name: 'Bermudian Dollar' },\n BND: { symbol: 'BND', name: 'Brunei Dollar' },\n BOB: { symbol: 'Bs', name: 'Bolivian Boliviano' },\n BSD: { symbol: 'B$', name: 'Bahamian Dollar' },\n BWP: { symbol: 'P', name: 'Botswanan Pula' },\n BZD: { symbol: 'BZ$', name: 'Belize Dollar' },\n CAD: { symbol: 'C$', name: 'Canadian Dollar' },\n CHF: { symbol: 'CHf', name: 'Swiss Franc' },\n CNY: { symbol: '¥', name: 'Chinese Yuan' },\n COP: { symbol: 'COL$', name: 'Colombian Peso' },\n CRC: { symbol: '₡', name: 'Costa Rican Colón' },\n CUP: { symbol: '$MN', name: 'Cuban Peso' },\n CZK: { symbol: 'Kč', name: 'Czech Koruna' },\n DKK: { symbol: 'DKK', name: 'Danish Krone' },\n DOP: { symbol: 'RD$', name: 'Dominican Peso' },\n DZD: { symbol: 'د.ج', name: 'Algerian Dinar' },\n EGP: { symbol: 'E£', name: 'Egyptian Pound' },\n ETB: { symbol: 'ብር', name: 'Ethiopian Birr' },\n EUR: { symbol: '€', name: 'Euro' },\n FJD: { symbol: 'FJ$', name: 'Fijian Dollar' },\n GBP: { symbol: '£', name: 'British Pound' },\n GHS: { symbol: 'GH₵', name: 'Ghanaian Cedi' },\n GIP: { symbol: 'GIP', name: 'Gibraltar Pound' },\n GMD: { symbol: 'D', name: 'Gambian Dalasi' },\n GTQ: { symbol: 'Q', name: 'Guatemalan Quetzal' },\n GYD: { symbol: 'G$', name: 'Guyanese Dollar' },\n HKD: { symbol: 'HK$', name: 'Hong Kong Dollar' },\n HNL: { symbol: 'HNL', name: 'Honduran Lempira' },\n HRK: { symbol: 'kn', name: 'Croatian Kuna' },\n HTG: { symbol: 'G', name: 'Haitian Gourde' },\n HUF: { symbol: 'Ft', name: 'Hungarian Forint' },\n IDR: { symbol: 'Rp', name: 'Indonesian Rupiah' },\n ILS: { symbol: '₪', name: 'Israeli New Shekel' },\n INR: { symbol: '₹', name: 'Indian Rupee' },\n JMD: { symbol: 'J$', name: 'Jamaican Dollar' },\n KES: { symbol: 'Ksh', name: 'Kenyan Shilling' },\n KGS: { symbol: 'Лв', name: 'Kyrgystani Som' },\n KHR: { symbol: '៛', name: 'Cambodian Riel' },\n KYD: { symbol: 'CI$', name: 'Cayman Islands Dollar' },\n KZT: { symbol: '₸', name: 'Kazakhstani Tenge' },\n LAK: { symbol: '₭', name: 'Laotian Kip' },\n LKR: { symbol: 'රු', name: 'Sri Lankan Rupee' },\n LRD: { symbol: 'L$', name: 'Liberian Dollar' },\n LSL: { symbol: 'LSL', name: 'Lesotho Loti' },\n MAD: { symbol: 'د.م.', name: 'Moroccan Dirham' },\n MDL: { symbol: 'MDL', name: 'Moldovan Leu' },\n MKD: { symbol: 'ден', name: 'Macedonian Denar' },\n MMK: { symbol: 'MMK', name: 'Myanmar Kyat' },\n MNT: { symbol: '₮', name: 'Mongolian Tugrik' },\n MOP: { symbol: 'MOP$', name: 'Macanese Pataca' },\n MUR: { symbol: '₨', name: 'Mauritian Rupee' },\n MVR: { symbol: 'Rf', name: 'Maldivian Rufiyaa' },\n MWK: { symbol: 'MK', name: 'Malawian Kwacha' },\n MXN: { symbol: 'Mex$', name: 'Mexican Peso' },\n MYR: { symbol: 'RM', name: 'Malaysian Ringgit' },\n NAD: { symbol: 'N$', name: 'Namibian Dollar' },\n NGN: { symbol: '₦', name: 'Nigerian Naira' },\n NIO: { symbol: 'NIO', name: 'Nicaraguan Córdoba' },\n NOK: { symbol: 'NOK', name: 'Norwegian Krone' },\n NPR: { symbol: 'रू', name: 'Nepalese Rupee' },\n NZD: { symbol: 'NZ$', name: 'New Zealand Dollar' },\n PEN: { symbol: 'S/', name: 'Peruvian Nuevo Sol' },\n PGK: { symbol: 'PGK', name: 'Papua New Guinean Kina' },\n PHP: { symbol: '₱', name: 'Philippine Peso' },\n PKR: { symbol: '₨', name: 'Pakistani Rupee' },\n QAR: { symbol: 'QR', name: 'Qatari Riyal' },\n RUB: { symbol: '₽', name: 'Russian Ruble' },\n SAR: { symbol: 'SR', name: 'Saudi Riyal' },\n SCR: { symbol: 'SRe', name: 'Seychellois Rupee' },\n SEK: { symbol: 'SEK', name: 'Swedish Krona' },\n SGD: { symbol: 'S$', name: 'Singapore Dollar' },\n SLL: { symbol: 'Le', name: 'Sierra Leonean Leone' },\n SOS: { symbol: 'Sh.so.', name: 'Somali Shilling' },\n SSP: { symbol: 'SS£', name: 'South Sudanese Pound' },\n SVC: { symbol: '₡', name: 'Salvadoran Colón' },\n SZL: { symbol: 'E', name: 'Swazi Lilangeni' },\n THB: { symbol: '฿', name: 'Thai Baht' },\n TTD: { symbol: 'TT$', name: 'Trinidad and Tobago Dollar' },\n TZS: { symbol: 'Sh', name: 'Tanzanian Shilling' },\n USD: { symbol: '$', name: 'United States Dollar' },\n UYU: { symbol: '$U', name: 'Uruguayan Peso' },\n UZS: { symbol: \"so'm\", name: 'Uzbekistani Som' },\n YER: { symbol: '﷼', name: 'Yemeni Rial' },\n ZAR: { symbol: 'R', name: 'South African Rand' },\n KWD: { symbol: 'د.ك', name: 'Kuwaiti Dinar' },\n BHD: { symbol: 'د.ب.', name: 'Bahraini Dinar' },\n OMR: { symbol: 'ر.ع.', name: 'Omani Rial' },\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencyList = () => {\n return CURRENCIES;\n};\n\nexport default withErrorBoundary(getCurrencyList);\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencySymbol = (currencyCode: keyof typeof CURRENCIES): string => {\n if (currencyCode in CURRENCIES) return CURRENCIES[currencyCode]?.symbol;\n else throw new Error('Invalid currencyCode!');\n};\n\nexport default withErrorBoundary(getCurrencySymbol);\n","export const ALLOWED_FORMAT_PARTS_KEYS = [\n 'nan',\n 'infinity',\n 'percent',\n 'integer',\n 'group',\n 'decimal',\n 'fraction',\n 'plusSign',\n 'minusSign',\n 'percentSign',\n 'currency',\n 'code',\n 'symbol',\n 'name',\n 'compact',\n 'exponentInteger',\n 'exponentMinusSign',\n 'exponentSeparator',\n 'unit',\n] as const;\n","import { CURRENCIES } from './data/currencies';\nimport { ByParts, FormattedPartsObject } from './types';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\nimport { ALLOWED_FORMAT_PARTS_KEYS } from './constants';\n\nconst formatNumberByParts = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): ByParts => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n try {\n const formattedAmount = getIntlInstanceWithOptions(options).formatToParts(\n Number(amount),\n );\n\n const parts = formattedAmount;\n\n const formattedObj: FormattedPartsObject = {};\n\n parts.forEach((p) => {\n if (p.type === 'group') {\n formattedObj.integer = (formattedObj.integer || '') + p.value;\n } else if (\n ALLOWED_FORMAT_PARTS_KEYS.findIndex((item) => item === p.type) != -1\n ) {\n // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal' is skipped\n formattedObj[p.type] = (formattedObj[p.type] || '') + p.value;\n }\n });\n\n return {\n ...formattedObj,\n isPrefixSymbol: parts[0].type === 'currency',\n rawParts: parts,\n };\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(\n formatNumberByParts,\n);\n"],"names":[],"mappings":"AAAA;AACM,MAAO,YAAa,SAAQ,KAAK,CAAA;AAErC,IAAA,WAAA,CAAY,OAA2B,EAAA;QACrC,KAAK,CAAC,OAAO,CAAC,CAAC;AACf,QAAA,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;AAC5B,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;;KAE7B;AACF,CAAA;AAED;;;;;;;;AAQG;AACI,MAAM,iBAAiB,GAAG,CAC/B,EAAK,KAC0C;IAC/C,OAAO,UAAyB,GAAG,IAAmB,EAAA;QACpD,IAAI;YACF,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAkB,CAAC;AAChD,SAAA;AAAC,QAAA,OAAO,GAAG,EAAE;AACZ,YAAA,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC;;;AAGpC,YAAA,MAAM,IAAI,YAAY,CAAC,GAAyB,CAAC,CAAC;AACnD,SAAA;AACH,KAAC,CAAC;AACJ,CAAC;;SC/Be,eAAe,GAAA;IAC7B,OAAO;AACL,QAAA,MAAM,EAAE,EAAE;AACV,QAAA,SAAS,EAAE,EAAE;AACb,QAAA,OAAO,EAAE,EAAE;KACZ,CAAC;AACJ;;MCLa,gBAAgB,CAAA;AAI3B,IAAA,WAAA,GAAA;AACE,QAAA,IAAI,CAAC,KAAK,GAAG,eAAe,EAAE,CAAC;KACh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 index 00000000..0066db40 --- /dev/null +++ b/lib/esm/dateTime/index.d.ts @@ -0,0 +1,41 @@ +declare const _default$f: (date: Date, value: number, unit: "days" | "months" | "years") => Date; + +type DateInput = Date | string; +interface DateTimeFormatOptions extends Intl.DateTimeFormatOptions { +} +interface DateFormatOptions extends Omit { +} +interface TimeFormatOptions extends Omit { +} + +declare const _default$e: (date: DateInput, locale: string, options?: DateFormatOptions | undefined) => string; + +declare const _default$d: (date: DateInput, locale: string, options?: DateTimeFormatOptions | undefined) => string; + +declare const _default$c: (date: DateInput, locale: string, options?: TimeFormatOptions | undefined) => string; + +declare const _default$b: (locale: string) => number; + +declare const _default$a: (date: Date) => number; + +declare const _default$9: (date: Date, baseDate: Date | undefined, locale: string, options?: Intl.RelativeTimeFormatOptions | undefined) => string; + +declare const _default$8: (date: Date) => number; + +declare const _default$7: (locale: string) => string[]; + +declare const _default$6: (date1: DateInput, date2: DateInput) => boolean; + +declare const _default$5: (date1: DateInput, date2: DateInput) => boolean; + +declare const _default$4: (year: number) => boolean; + +declare const _default$3: (date1: Date, date2: Date) => boolean; + +declare const _default$2: (date: any) => boolean; + +declare const _default$1: (dateString: string, locale: string) => Date | null; + +declare const _default: (date: Date, value: number, unit: "days" | "months" | "years") => Date; + +export { _default$f as add, _default$e as formatDate, _default$d as formatDateTime, _default$c as formatTime, _default$b as getFirstDayOfWeek, _default$a as getQuarter, _default$9 as getRelativeTime, _default$8 as getWeek, _default$7 as getWeekdays, _default$6 as isAfter, _default$5 as isBefore, _default$4 as isLeapYear, _default$3 as isSameDay, _default$2 as isValidDate, _default$1 as parseDate, _default as subtract }; diff --git a/lib/esm/dateTime/index.js b/lib/esm/dateTime/index.js new file mode 100644 index 00000000..4d73eb43 --- /dev/null +++ b/lib/esm/dateTime/index.js @@ -0,0 +1,620 @@ +// Custom Error class to extend properties to error object +class I18nifyError extends Error { + constructor(message) { + super(message); + this.name = 'i18nify Error'; + this.timestamp = new Date(); + // more params like type of error/severity can be added in future for better debugging. + } +} +/** + * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block. + * It appends additional attributes and serves as a centralized error-handling service. + * Usage => + * const wrappedUtilityFn = withErrorBoundary(utilityFn) + * + * @param fn utility that is wrapped in error boundary + * @returns {Function} returns the function wrapped in try/catch block + */ +const withErrorBoundary = (fn) => { + return function (...rest) { + try { + return fn.call(this, ...rest); + } + catch (err) { + console.warn('[I18N Error]: ', err); + // Currently, we are throwing the error as it is to consumers. + // In the future, this can be modified as per our requirement, like an error logging service. + throw new I18nifyError(err); + } + }; +}; + +/** + * Adds a specified amount of time to a date. + * + * @param date The original date. + * @param value The amount to add. + * @param unit The unit of time to add (e.g., 'days', 'months', 'years'). + * @returns A new Date object with the time added. + */ +const add = (date, value, unit) => { + const result = new Date(date); + switch (unit) { + case 'days': + result.setDate(result.getDate() + value); + break; + case 'months': + result.setMonth(result.getMonth() + value); + break; + case 'years': + result.setFullYear(result.getFullYear() + value); + break; + } + return result; +}; +var add$1 = withErrorBoundary(add); + +function getDefaultState() { + return { + locale: '', + direction: '', + country: '', + }; +} + +class I18nStateManager { + constructor() { + this.state = getDefaultState(); + } + static getInstance() { + if (!I18nStateManager.instance) { + I18nStateManager.instance = new I18nStateManager(); + } + return I18nStateManager.instance; + } + static resetInstance() { + I18nStateManager.instance = undefined; + } + getState() { + return Object.assign({}, this.state); + } + setState(newState) { + this.state = Object.assign(Object.assign({}, this.state), newState); + } + resetState() { + this.state = getDefaultState(); + } +} +var state = I18nStateManager.getInstance(); + +const getLocale = () => { + // Check if running in a non-browser environment (e.g., Node.js or older browsers). + if (typeof navigator === 'undefined') { + return 'en-IN'; + } + // Check if the browser supports the Intl object and user language preferences. + if (window.Intl && + typeof window.Intl === 'object' && + (window.navigator.languages || window.navigator.language)) { + const userLocales = window.navigator.languages || [ + window.navigator.language, + ]; + return userLocales[0]; + } + // Fallback to a supported locale or the default locale. + return 'en-IN'; +}; + +/** + * Formats date and time based on the locale. + * @param {DateInput} date - Date object or date string. + * @param {Locale} locale - Locale string. + * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional). + * @returns {string} Formatted date and time string. + */ +const formatDateTime = (date, locale, options = {}) => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) + locale = state.getState().locale || getLocale(); + const dateObj = date instanceof Date ? date : new Date(date); + let formatter; + try { + formatter = new Intl.DateTimeFormat(locale, options); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + return formatter.format(dateObj); +}; +var formatDateTime$1 = withErrorBoundary(formatDateTime); + +/** + * Formats date based on the locale. + * @param {DateInput} date - Date object or date string. + * @param {Locale} locale - Locale string. + * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional). + * @returns {string} Formatted date string. + */ +const formatDate = (date, locale, options = {}) => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) + locale = state.getState().locale || getLocale(); + const fullOptions = Object.assign(Object.assign({}, options), { timeStyle: undefined }); + let formattedDate; + try { + formattedDate = formatDateTime$1(date, locale, fullOptions); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + return formattedDate; +}; +var formatDate$1 = withErrorBoundary(formatDate); + +/** + * Formats time based on the locale. + * @param {DateInput} date - Date object or date string. + * @param {Locale} locale - Locale string. + * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional). + * @returns {string} Formatted time string. + */ +const formatTime = (date, locale, options = {}) => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) + locale = state.getState().locale || getLocale(); + const fullOptions = Object.assign(Object.assign({}, options), { dateStyle: undefined }); + let formattedTime; + try { + formattedTime = formatDateTime$1(date, locale, fullOptions); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + return formattedTime; +}; +var formatTime$1 = withErrorBoundary(formatTime); + +/** + * Gets the first day of the week for a given locale. + * + * @param locale The locale to determine the first day of the week for. + * @returns The first day of the week (0-6, where 0 is Sunday). + */ +const getFirstDayOfWeek = (locale) => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) + locale = state.getState().locale || getLocale(); + let formatted; + try { + const formatter = new Intl.DateTimeFormat(locale, { weekday: 'short' }); + const sampleDate = new Date(2000, 0, 2); // A Sunday + formatted = formatter.format(sampleDate); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + return ['su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'].indexOf(formatted.slice(0, 2).toLowerCase()); +}; +var getFirstDayOfWeek$1 = withErrorBoundary(getFirstDayOfWeek); + +/** + * Determines the quarter of the year for a given date. + * + * @param date The date to determine the quarter for. + * @returns The quarter of the year (1-4). + */ +const getQuarter = (date) => { + return Math.ceil((date.getMonth() + 1) / 3); +}; +var getQuarter$1 = withErrorBoundary(getQuarter); + +/** + * Provides a relative time string (e.g., '3 hours ago', 'in 2 days'). + * This function calculates the difference between the given date and the base date, + * then formats it in a locale-sensitive manner. It allows customization of the output + * through Intl.RelativeTimeFormat options. + * + * @param date - The date to compare. + * @param baseDate - The date to compare against (default: current date). + * @param locale - The locale to use for formatting. + * @param options - Options for the Intl.RelativeTimeFormat (optional). + * @returns The relative time as a string. + */ +const getRelativeTime = (date, baseDate = new Date(), locale, options) => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) + locale = state.getState().locale || getLocale(); + const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000; + // Define time units in seconds + const minute = 60; + const hour = minute * 60; + const day = hour * 24; + const week = day * 7; + const month = day * 30; + const year = day * 365; + let value; + let unit; + if (Math.abs(diffInSeconds) < minute) { + value = diffInSeconds; + unit = 'second'; + } + else if (Math.abs(diffInSeconds) < hour) { + value = diffInSeconds / minute; + unit = 'minute'; + } + else if (Math.abs(diffInSeconds) < day) { + value = diffInSeconds / hour; + unit = 'hour'; + } + else if (Math.abs(diffInSeconds) < week) { + value = diffInSeconds / day; + unit = 'day'; + } + else if (Math.abs(diffInSeconds) < month) { + value = diffInSeconds / week; + unit = 'week'; + } + else if (Math.abs(diffInSeconds) < year) { + value = diffInSeconds / month; + unit = 'month'; + } + else { + value = diffInSeconds / year; + unit = 'year'; + } + let relativeTime; + try { + const rtf = new Intl.RelativeTimeFormat(locale, options); + relativeTime = rtf.format(Math.round(value), unit); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + return relativeTime; +}; +var getRelativeTime$1 = withErrorBoundary(getRelativeTime); + +/** + * Calculates the week number of the year for a given date. + * + * @param date The date to calculate the week number for. + * @returns The week number of the year. + */ +const getWeek = (date) => { + const firstDayOfYear = new Date(date.getFullYear(), 0, 1); + const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000; + return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7); +}; +var getWeek$1 = withErrorBoundary(getWeek); + +/** + * Returns an array of weekdays according to the specified locale. + * + * @param locale The locale to get weekdays for. + * @returns An array of weekday names. + */ +const getWeekdays = (locale) => { + try { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) + locale = state.getState().locale || getLocale(); + const formatter = new Intl.DateTimeFormat(locale, { weekday: 'long' }); + return Array.from({ length: 7 }, (_, i) => formatter.format(new Date(1970, 0, 4 + i))); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } +}; +var getWeekdays$1 = withErrorBoundary(getWeekdays); + +/** + * Compares two dates to determine if the first is after the second. + * @param {DateInput} date1 - First date object or date string. + * @param {DateInput} date2 - Second date object or date string. + * @returns {boolean} True if date1 is after date2. + */ +const isAfter = (date1, date2) => { + const dateObj1 = date1 instanceof Date ? date1 : new Date(date1); + const dateObj2 = date2 instanceof Date ? date2 : new Date(date2); + return dateObj1 > dateObj2; +}; +var isAfter$1 = withErrorBoundary(isAfter); + +/** + * Compares two dates to determine if the first is before the second. + * @param {DateInput} date1 - First date object or date string. + * @param {DateInput} date2 - Second date object or date string. + * @returns {boolean} True if date1 is before date2. + */ +const isBefore = (date1, date2) => { + const dateObj1 = date1 instanceof Date ? date1 : new Date(date1); + const dateObj2 = date2 instanceof Date ? date2 : new Date(date2); + return dateObj1 < dateObj2; +}; +var isBefore$1 = withErrorBoundary(isBefore); + +/** + * Checks if a given year is a leap year. + * + * @param year The year to check. + * @returns True if the year is a leap year, false otherwise. + */ +const isLeapYear = (year) => { + return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; +}; +var isLeapYear$1 = withErrorBoundary(isLeapYear); + +/** + * Checks if two dates fall on the same day. + * + * @param date1 The first date. + * @param date2 The second date. + * @returns True if both dates are on the same day, false otherwise. + */ +const isSameDay = (date1, date2) => { + return (date1.getDate() === date2.getDate() && + date1.getMonth() === date2.getMonth() && + date1.getFullYear() === date2.getFullYear()); +}; +var isSameDay$1 = withErrorBoundary(isSameDay); + +/** + * Checks if a given object is a valid Date object. + * + * @param date The object to check. + * @returns True if the object is a valid Date, false otherwise. + */ +const isValidDate = (date) => { + return date instanceof Date && !isNaN(date.getTime()); +}; +var isValidDate$1 = withErrorBoundary(isValidDate); + +const LOCALE_DATE_FORMATS = { + 'ar-AE': 'DD/MM/YYYY', + 'sq-AL': 'DD.MM.YYYY', + 'hy-AM': 'DD.MM.YYYY', + 'es-AR': 'DD/MM/YYYY', + 'en-AU': 'DD/MM/YYYY', + 'nl-AW': 'DD-MM-YYYY', + 'en-BB': 'MM/DD/YYYY', + 'bn-BD': 'DD/MM/YYYY', + 'en-BM': 'MM/DD/YYYY', + 'ms-BN': 'DD/MM/YYYY', + 'es-BO': 'DD/MM/YYYY', + 'en-BS': 'MM/DD/YYYY', + 'en-BW': 'DD/MM/YYYY', + 'en-BZ': 'MM/DD/YYYY', + 'en-CA': 'DD/MM/YYYY', + 'de-CH': 'DD.MM.YYYY', + 'zh-CN': 'YYYY/MM/DD', + 'es-CO': 'DD/MM/YYYY', + 'es-CR': 'DD/MM/YYYY', + 'es-CU': 'DD/MM/YYYY', + 'cs-CZ': 'DD.MM.YYYY', + 'da-DK': 'DD-MM-YYYY', + 'es-DO': 'DD/MM/YYYY', + 'ar-DZ': 'DD/MM/YYYY', + 'ar-EG': 'DD/MM/YYYY', + 'am-ET': 'DD/MM/YYYY', + 'en-EU': 'DD/MM/YYYY', + 'en-FJ': 'DD/MM/YYYY', + 'en-GB': 'DD/MM/YYYY', + 'en-GH': 'DD/MM/YYYY', + 'en-GI': 'DD/MM/YYYY', + 'en-GM': 'DD/MM/YYYY', + 'es-GT': 'DD/MM/YYYY', + 'en-GY': 'DD/MM/YYYY', + 'en-HK': 'DD/MM/YYYY', + 'es-HN': 'DD/MM/YYYY', + 'hr-HR': 'DD.MM.YYYY', + 'ht-HT': 'MM/DD/YYYY', + 'hu-HU': 'YYYY. MM. DD.', + 'id-ID': 'DD/MM/YYYY', + 'he-IL': 'DD/MM/YYYY', + 'en-IN': 'DD-MM-YYYY', + 'en-JM': 'MM/DD/YYYY', + 'en-KE': 'DD/MM/YYYY', + 'ky-KG': 'DD.MM.YYYY', + 'km-KH': 'DD/MM/YYYY', + 'en-KY': 'MM/DD/YYYY', + 'kk-KZ': 'DD.MM.YYYY', + 'lo-LA': 'DD/MM/YYYY', + 'si-LK': 'YYYY-MM-DD', + 'en-LR': 'MM/DD/YYYY', + 'en-LS': 'DD/MM/YYYY', + 'ar-MA': 'DD/MM/YYYY', + 'ro-MD': 'DD.MM.YYYY', + 'mk-MK': 'DD.MM.YYYY', + 'my-MM': 'DD/MM/YYYY', + 'mn-MN': 'YYYY.MM.DD', + 'zh-MO': 'DD/MM/YYYY', + 'en-MU': 'DD/MM/YYYY', + 'dv-MV': 'DD/MM/YYYY', + 'en-MW': 'DD/MM/YYYY', + 'es-MX': 'DD/MM/YYYY', + 'ms-MY': 'DD/MM/YYYY', + 'en-NA': 'DD/MM/YYYY', + 'en-NG': 'DD/MM/YYYY', + 'es-NI': 'DD/MM/YYYY', + 'no-NO': 'DD.MM.YYYY', + 'ne-NP': 'YYYY/MM/DD', + 'en-NZ': 'DD/MM/YYYY', + 'es-PE': 'DD/MM/YYYY', + 'en-PG': 'DD/MM/YYYY', + 'en-PH': 'MM/DD/YYYY', + 'en-PK': 'DD/MM/YYYY', + 'ar-QA': 'DD/MM/YYYY', + 'ru-RU': 'DD.MM.YYYY', + 'ar-SA': 'DD/MM/YYYY', + 'en-SC': 'DD/MM/YYYY', + 'sv-SE': 'YYYY-MM-DD', + 'en-SG': 'DD/MM/YYYY', + 'en-SL': 'DD/MM/YYYY', + 'so-SO': 'DD/MM/YYYY', + 'en-SS': 'DD/MM/YYYY', + 'es-SV': 'DD/MM/YYYY', + 'en-SZ': 'DD/MM/YYYY', + 'th-TH': 'DD/MM/YYYY', + 'en-TT': 'MM/DD/YYYY', + 'sw-TZ': 'DD/MM/YYYY', + 'en-US': 'MM/DD/YYYY', + 'es-UY': 'DD/MM/YYYY', + 'uz-UZ': 'DD/MM/YYYY', + 'ar-YE': 'DD/MM/YYYY', + 'en-ZA': 'YYYY/MM/DD', + 'ar-KW': 'DD/MM/YYYY', + 'ar-BH': 'DD/MM/YYYY', + 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman) +}; + +/** + * Parses a date string based on a specific format. + * + * @param dateString The date string to parse. + * @param format The format to use for parsing. + * @returns The parsed Date object or null if parsing fails. + */ +const parseDateWithFormat = (dateString, format) => { + // Determine the separator based on the format (supports '/', '.', or '-') + const separator = format.includes('/') + ? '/' + : format.includes('.') + ? '.' + : '-'; + const formatParts = format.split(separator); + const dateParts = dateString.split(separator).map((num) => parseInt(num, 10)); + let year = 0, month = 0, day = 0; + let yearSet = false, monthSet = false, daySet = false; + // Check for format and date string mismatch + if (dateParts.length !== formatParts.length) { + return null; // Mismatch between date string and format + } + formatParts.forEach((part, index) => { + // Check for non-numeric values in date string + if (isNaN(dateParts[index])) { + return null; // Invalid date part + } + // Assign year, month, and day based on the format + switch (part) { + case 'DD': + day = dateParts[index]; + daySet = true; + break; + case 'MM': + month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date + monthSet = true; + break; + case 'YYYY': + year = dateParts[index]; + yearSet = true; + break; + } + }); + // Validate and create the date only if all parts are set + if (yearSet && monthSet && daySet) { + const parsedDate = new Date(year, month, day); + // Validate date to catch invalid dates like February 30th + if (parsedDate.getFullYear() === year && + parsedDate.getMonth() === month && + parsedDate.getDate() === day) { + return parsedDate; + } + } + return null; // Invalid date or incomplete date information +}; +var parseDateWithFormat$1 = withErrorBoundary(parseDateWithFormat); + +/** + * Attempts to parse a string into a date object based on locale. + * Uses the localeDateFormats mapping for determining the date format. + * + * @param dateString - The date string to parse. + * @param locale - The locale to use for parsing. + * @returns The parsed Date object or null if parsing fails. + */ +const parseDate = (dateString, locale) => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) + locale = state.getState().locale || getLocale(); + const format = LOCALE_DATE_FORMATS[locale]; + if (!format) { + throw new Error(`No date format found for locale: ${locale}`); + } + return parseDateWithFormat$1(dateString, format); +}; +var parseDate$1 = withErrorBoundary(parseDate); + +/** + * Subtracts a specified amount of time from a date. + * + * @param date The original date. + * @param value The amount to subtract. + * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years'). + * @returns A new Date object with the time subtracted. + */ +const subtract = (date, value, unit) => { + return add$1(date, -value, unit); // Reuse the add function with negative value +}; +var subtract$1 = withErrorBoundary(subtract); + +export { add$1 as add, formatDate$1 as formatDate, formatDateTime$1 as formatDateTime, formatTime$1 as formatTime, getFirstDayOfWeek$1 as getFirstDayOfWeek, getQuarter$1 as getQuarter, getRelativeTime$1 as getRelativeTime, getWeek$1 as getWeek, getWeekdays$1 as getWeekdays, isAfter$1 as isAfter, isBefore$1 as isBefore, isLeapYear$1 as isLeapYear, isSameDay$1 as isSameDay, isValidDate$1 as isValidDate, parseDate$1 as parseDate, subtract$1 as subtract }; +//# sourceMappingURL=index.js.map diff --git a/lib/esm/dateTime/index.js.map b/lib/esm/dateTime/index.js.map new file mode 100644 index 00000000..97389a95 --- /dev/null +++ b/lib/esm/dateTime/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["../../../src/common/errorBoundary/index.ts","../../../src/modules/dateTime/add.ts","../../../src/modules/.internal/utils/getDefaultState.ts","../../../src/modules/.internal/state/index.ts","../../../src/modules/.internal/utils/getLocale.ts","../../../src/modules/dateTime/formatDateTime.ts","../../../src/modules/dateTime/formatDate.ts","../../../src/modules/dateTime/formatTime.ts","../../../src/modules/dateTime/getFirstDayOfWeek.ts","../../../src/modules/dateTime/getQuarter.ts","../../../src/modules/dateTime/getRelativeTime.ts","../../../src/modules/dateTime/getWeek.ts","../../../src/modules/dateTime/getWeekdays.ts","../../../src/modules/dateTime/isAfter.ts","../../../src/modules/dateTime/isBefore.ts","../../../src/modules/dateTime/isLeapYear.ts","../../../src/modules/dateTime/isSameDay.ts","../../../src/modules/dateTime/isValidDate.ts","../../../src/modules/dateTime/data/localeDateFormats.ts","../../../src/modules/dateTime/parseDateWithFormat.ts","../../../src/modules/dateTime/parseDate.ts","../../../src/modules/dateTime/subtract.ts"],"sourcesContent":["// Custom Error class to extend properties to error object\nexport class I18nifyError extends Error {\n timestamp: Date;\n constructor(message: string | undefined) {\n super(message);\n this.name = 'i18nify Error';\n this.timestamp = new Date();\n // more params like type of error/severity can be added in future for better debugging.\n }\n}\n\n/**\n * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block.\n * It appends additional attributes and serves as a centralized error-handling service.\n * Usage =>\n * const wrappedUtilityFn = withErrorBoundary(utilityFn)\n *\n * @param fn utility that is wrapped in error boundary\n * @returns {Function} returns the function wrapped in try/catch block\n */\nexport const withErrorBoundary = any>(\n fn: T,\n): ((...args: Parameters) => ReturnType) => {\n return function (this: unknown, ...rest: Parameters): ReturnType {\n try {\n return fn.call(this, ...rest) as ReturnType;\n } catch (err) {\n console.warn('[I18N Error]: ', err);\n // Currently, we are throwing the error as it is to consumers.\n // In the future, this can be modified as per our requirement, like an error logging service.\n throw new I18nifyError(err as string | undefined);\n }\n };\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Adds a specified amount of time to a date.\n *\n * @param date The original date.\n * @param value The amount to add.\n * @param unit The unit of time to add (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time added.\n */\nconst add = (\n date: Date,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n const result = new Date(date);\n switch (unit) {\n case 'days':\n result.setDate(result.getDate() + value);\n break;\n case 'months':\n result.setMonth(result.getMonth() + value);\n break;\n case 'years':\n result.setFullYear(result.getFullYear() + value);\n break;\n }\n return result;\n};\n\nexport default withErrorBoundary(add);\n","import type { I18nState } from '../state/types';\n\nexport function getDefaultState(): I18nState {\n return {\n locale: '',\n direction: '',\n country: '',\n };\n}\n","import { I18nState } from './types';\nimport { getDefaultState } from '../utils/getDefaultState';\n\nexport class I18nStateManager {\n private static instance: I18nStateManager | undefined;\n private state: I18nState;\n\n private constructor() {\n this.state = getDefaultState();\n }\n\n public static getInstance(): I18nStateManager {\n if (!I18nStateManager.instance) {\n I18nStateManager.instance = new I18nStateManager();\n }\n\n return I18nStateManager.instance;\n }\n\n public static resetInstance(): void {\n I18nStateManager.instance = undefined;\n }\n\n public getState(): I18nState {\n return { ...this.state };\n }\n\n public setState(newState: Partial): void {\n this.state = { ...this.state, ...newState };\n }\n\n public resetState(): void {\n this.state = getDefaultState();\n }\n}\n\nexport default I18nStateManager.getInstance();\n","export const getLocale = (): string => {\n // Check if running in a non-browser environment (e.g., Node.js or older browsers).\n if (typeof navigator === 'undefined') {\n return 'en-IN';\n }\n\n // Check if the browser supports the Intl object and user language preferences.\n if (\n window.Intl &&\n typeof window.Intl === 'object' &&\n (window.navigator.languages || window.navigator.language)\n ) {\n const userLocales = window.navigator.languages || [\n window.navigator.language,\n ];\n return userLocales[0];\n }\n\n // Fallback to a supported locale or the default locale.\n return 'en-IN';\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale, DateTimeFormatOptions } from './types';\n\n/**\n * Formats date and time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional).\n * @returns {string} Formatted date and time string.\n */\nconst formatDateTime = (\n date: DateInput,\n locale: Locale,\n options: DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const dateObj: Date = date instanceof Date ? date : new Date(date);\n let formatter;\n\n try {\n formatter = new Intl.DateTimeFormat(locale, options);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formatter.format(dateObj);\n};\n\nexport default withErrorBoundary(formatDateTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n DateFormatOptions,\n} from './types';\n\n/**\n * Formats date based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional).\n * @returns {string} Formatted date string.\n */\nconst formatDate = (\n date: DateInput,\n locale: Locale,\n options: DateFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n timeStyle: undefined,\n };\n\n let formattedDate;\n\n try {\n formattedDate = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedDate;\n};\n\nexport default withErrorBoundary(formatDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n TimeFormatOptions,\n} from './types';\n\n/**\n * Formats time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional).\n * @returns {string} Formatted time string.\n */\nconst formatTime = (\n date: DateInput,\n locale: Locale,\n options: TimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n dateStyle: undefined,\n };\n\n let formattedTime;\n\n try {\n formattedTime = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedTime;\n};\n\nexport default withErrorBoundary(formatTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\n\n/**\n * Gets the first day of the week for a given locale.\n *\n * @param locale The locale to determine the first day of the week for.\n * @returns The first day of the week (0-6, where 0 is Sunday).\n */\nconst getFirstDayOfWeek = (locale: string): number => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n let formatted;\n\n try {\n const formatter = new Intl.DateTimeFormat(locale, { weekday: 'short' });\n const sampleDate = new Date(2000, 0, 2); // A Sunday\n formatted = formatter.format(sampleDate);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return ['su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'].indexOf(\n formatted.slice(0, 2).toLowerCase(),\n );\n};\n\nexport default withErrorBoundary(getFirstDayOfWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Determines the quarter of the year for a given date.\n *\n * @param date The date to determine the quarter for.\n * @returns The quarter of the year (1-4).\n */\nconst getQuarter = (date: Date): number => {\n return Math.ceil((date.getMonth() + 1) / 3);\n};\n\nexport default withErrorBoundary(getQuarter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Provides a relative time string (e.g., '3 hours ago', 'in 2 days').\n * This function calculates the difference between the given date and the base date,\n * then formats it in a locale-sensitive manner. It allows customization of the output\n * through Intl.RelativeTimeFormat options.\n *\n * @param date - The date to compare.\n * @param baseDate - The date to compare against (default: current date).\n * @param locale - The locale to use for formatting.\n * @param options - Options for the Intl.RelativeTimeFormat (optional).\n * @returns The relative time as a string.\n */\nconst getRelativeTime = (\n date: Date,\n baseDate: Date = new Date(),\n locale: Locale,\n options?: Intl.RelativeTimeFormatOptions,\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000;\n\n // Define time units in seconds\n const minute = 60;\n const hour = minute * 60;\n const day = hour * 24;\n const week = day * 7;\n const month = day * 30;\n const year = day * 365;\n\n let value: number;\n let unit: Intl.RelativeTimeFormatUnit;\n\n if (Math.abs(diffInSeconds) < minute) {\n value = diffInSeconds;\n unit = 'second';\n } else if (Math.abs(diffInSeconds) < hour) {\n value = diffInSeconds / minute;\n unit = 'minute';\n } else if (Math.abs(diffInSeconds) < day) {\n value = diffInSeconds / hour;\n unit = 'hour';\n } else if (Math.abs(diffInSeconds) < week) {\n value = diffInSeconds / day;\n unit = 'day';\n } else if (Math.abs(diffInSeconds) < month) {\n value = diffInSeconds / week;\n unit = 'week';\n } else if (Math.abs(diffInSeconds) < year) {\n value = diffInSeconds / month;\n unit = 'month';\n } else {\n value = diffInSeconds / year;\n unit = 'year';\n }\n\n let relativeTime;\n\n try {\n const rtf = new Intl.RelativeTimeFormat(locale, options);\n relativeTime = rtf.format(Math.round(value), unit);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return relativeTime;\n};\n\nexport default withErrorBoundary(getRelativeTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Calculates the week number of the year for a given date.\n *\n * @param date The date to calculate the week number for.\n * @returns The week number of the year.\n */\nconst getWeek = (date: Date): number => {\n const firstDayOfYear = new Date(date.getFullYear(), 0, 1);\n const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000;\n return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7);\n};\n\nexport default withErrorBoundary(getWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Returns an array of weekdays according to the specified locale.\n *\n * @param locale The locale to get weekdays for.\n * @returns An array of weekday names.\n */\nconst getWeekdays = (locale: Locale): string[] => {\n try {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n const formatter = new Intl.DateTimeFormat(locale, { weekday: 'long' });\n return Array.from({ length: 7 }, (_, i) =>\n formatter.format(new Date(1970, 0, 4 + i)),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(getWeekdays);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\n\n/**\n * Compares two dates to determine if the first is after the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is after date2.\n */\nconst isAfter = (date1: DateInput, date2: DateInput): boolean => {\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 > dateObj2;\n};\n\nexport default withErrorBoundary(isAfter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\n\n/**\n * Compares two dates to determine if the first is before the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is before date2.\n */\nconst isBefore = (date1: DateInput, date2: DateInput): boolean => {\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 < dateObj2;\n};\n\nexport default withErrorBoundary(isBefore);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given year is a leap year.\n *\n * @param year The year to check.\n * @returns True if the year is a leap year, false otherwise.\n */\nconst isLeapYear = (year: number): boolean => {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n};\n\nexport default withErrorBoundary(isLeapYear);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if two dates fall on the same day.\n *\n * @param date1 The first date.\n * @param date2 The second date.\n * @returns True if both dates are on the same day, false otherwise.\n */\nconst isSameDay = (date1: Date, date2: Date): boolean => {\n return (\n date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear()\n );\n};\n\nexport default withErrorBoundary(isSameDay);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given object is a valid Date object.\n *\n * @param date The object to check.\n * @returns True if the object is a valid Date, false otherwise.\n */\nconst isValidDate = (date: any): boolean => {\n return date instanceof Date && !isNaN(date.getTime());\n};\n\nexport default withErrorBoundary(isValidDate);\n","export const LOCALE_DATE_FORMATS: { [key: string]: string } = {\n 'ar-AE': 'DD/MM/YYYY', // Arabic (U.A.E.)\n 'sq-AL': 'DD.MM.YYYY', // Albanian (Albania)\n 'hy-AM': 'DD.MM.YYYY', // Armenian (Armenia)\n 'es-AR': 'DD/MM/YYYY', // Spanish (Argentina)\n 'en-AU': 'DD/MM/YYYY', // English (Australia)\n 'nl-AW': 'DD-MM-YYYY', // Dutch (Aruba)\n 'en-BB': 'MM/DD/YYYY', // English (Barbados)\n 'bn-BD': 'DD/MM/YYYY', // Bengali (Bangladesh)\n 'en-BM': 'MM/DD/YYYY', // English (Bermuda)\n 'ms-BN': 'DD/MM/YYYY', // Malay (Brunei)\n 'es-BO': 'DD/MM/YYYY', // Spanish (Bolivia)\n 'en-BS': 'MM/DD/YYYY', // English (Bahamas)\n 'en-BW': 'DD/MM/YYYY', // English (Botswana)\n 'en-BZ': 'MM/DD/YYYY', // English (Belize)\n 'en-CA': 'DD/MM/YYYY', // English (Canada)\n 'de-CH': 'DD.MM.YYYY', // German (Switzerland)\n 'zh-CN': 'YYYY/MM/DD', // Chinese (China)\n 'es-CO': 'DD/MM/YYYY', // Spanish (Colombia)\n 'es-CR': 'DD/MM/YYYY', // Spanish (Costa Rica)\n 'es-CU': 'DD/MM/YYYY', // Spanish (Cuba)\n 'cs-CZ': 'DD.MM.YYYY', // Czech (Czech Republic)\n 'da-DK': 'DD-MM-YYYY', // Danish (Denmark)\n 'es-DO': 'DD/MM/YYYY', // Spanish (Dominican Republic)\n 'ar-DZ': 'DD/MM/YYYY', // Arabic (Algeria)\n 'ar-EG': 'DD/MM/YYYY', // Arabic (Egypt)\n 'am-ET': 'DD/MM/YYYY', // Amharic (Ethiopia)\n 'en-EU': 'DD/MM/YYYY', // English (European Union)\n 'en-FJ': 'DD/MM/YYYY', // English (Fiji)\n 'en-GB': 'DD/MM/YYYY', // English (United Kingdom)\n 'en-GH': 'DD/MM/YYYY', // English (Ghana)\n 'en-GI': 'DD/MM/YYYY', // English (Gibraltar)\n 'en-GM': 'DD/MM/YYYY', // English (Gambia)\n 'es-GT': 'DD/MM/YYYY', // Spanish (Guatemala)\n 'en-GY': 'DD/MM/YYYY', // English (Guyana)\n 'en-HK': 'DD/MM/YYYY', // English (Hong Kong)\n 'es-HN': 'DD/MM/YYYY', // Spanish (Honduras)\n 'hr-HR': 'DD.MM.YYYY', // Croatian (Croatia)\n 'ht-HT': 'MM/DD/YYYY', // Haitian (Haiti)\n 'hu-HU': 'YYYY. MM. DD.', // Hungarian (Hungary)\n 'id-ID': 'DD/MM/YYYY', // Indonesian (Indonesia)\n 'he-IL': 'DD/MM/YYYY', // Hebrew (Israel)\n 'en-IN': 'DD-MM-YYYY', // English (India)\n 'en-JM': 'MM/DD/YYYY', // English (Jamaica)\n 'en-KE': 'DD/MM/YYYY', // English (Kenya)\n 'ky-KG': 'DD.MM.YYYY', // Kyrgyz (Kyrgyzstan)\n 'km-KH': 'DD/MM/YYYY', // Khmer (Cambodia)\n 'en-KY': 'MM/DD/YYYY', // English (Cayman Islands)\n 'kk-KZ': 'DD.MM.YYYY', // Kazakh (Kazakhstan)\n 'lo-LA': 'DD/MM/YYYY', // Lao (Laos)\n 'si-LK': 'YYYY-MM-DD', // Sinhala (Sri Lanka)\n 'en-LR': 'MM/DD/YYYY', // English (Liberia)\n 'en-LS': 'DD/MM/YYYY', // English (Lesotho)\n 'ar-MA': 'DD/MM/YYYY', // Arabic (Morocco)\n 'ro-MD': 'DD.MM.YYYY', // Romanian (Moldova)\n 'mk-MK': 'DD.MM.YYYY', // Macedonian (North Macedonia)\n 'my-MM': 'DD/MM/YYYY', // Burmese (Myanmar)\n 'mn-MN': 'YYYY.MM.DD', // Mongolian (Mongolia)\n 'zh-MO': 'DD/MM/YYYY', // Chinese (Macao)\n 'en-MU': 'DD/MM/YYYY', // English (Mauritius)\n 'dv-MV': 'DD/MM/YYYY', // Divehi (Maldives)\n 'en-MW': 'DD/MM/YYYY', // English (Malawi)\n 'es-MX': 'DD/MM/YYYY', // Spanish (Mexico)\n 'ms-MY': 'DD/MM/YYYY', // Malay (Malaysia)\n 'en-NA': 'DD/MM/YYYY', // English (Namibia)\n 'en-NG': 'DD/MM/YYYY', // English (Nigeria)\n 'es-NI': 'DD/MM/YYYY', // Spanish (Nicaragua)\n 'no-NO': 'DD.MM.YYYY', // Norwegian (Norway)\n 'ne-NP': 'YYYY/MM/DD', // Nepali (Nepal)\n 'en-NZ': 'DD/MM/YYYY', // English (New Zealand)\n 'es-PE': 'DD/MM/YYYY', // Spanish (Peru)\n 'en-PG': 'DD/MM/YYYY', // English (Papua New Guinea)\n 'en-PH': 'MM/DD/YYYY', // English (Philippines)\n 'en-PK': 'DD/MM/YYYY', // English (Pakistan)\n 'ar-QA': 'DD/MM/YYYY', // Arabic (Qatar)\n 'ru-RU': 'DD.MM.YYYY', // Russian (Russia)\n 'ar-SA': 'DD/MM/YYYY', // Arabic (Saudi Arabia)\n 'en-SC': 'DD/MM/YYYY', // English (Seychelles)\n 'sv-SE': 'YYYY-MM-DD', // Swedish (Sweden)\n 'en-SG': 'DD/MM/YYYY', // English (Singapore)\n 'en-SL': 'DD/MM/YYYY', // English (Sierra Leone)\n 'so-SO': 'DD/MM/YYYY', // Somali (Somalia)\n 'en-SS': 'DD/MM/YYYY', // English (South Sudan)\n 'es-SV': 'DD/MM/YYYY', // Spanish (El Salvador)\n 'en-SZ': 'DD/MM/YYYY', // English (Eswatini)\n 'th-TH': 'DD/MM/YYYY', // Thai (Thailand)\n 'en-TT': 'MM/DD/YYYY', // English (Trinidad and Tobago)\n 'sw-TZ': 'DD/MM/YYYY', // Swahili (Tanzania)\n 'en-US': 'MM/DD/YYYY', // English (United States)\n 'es-UY': 'DD/MM/YYYY', // Spanish (Uruguay)\n 'uz-UZ': 'DD/MM/YYYY', // Uzbek (Uzbekistan)\n 'ar-YE': 'DD/MM/YYYY', // Arabic (Yemen)\n 'en-ZA': 'YYYY/MM/DD', // English (South Africa)\n 'ar-KW': 'DD/MM/YYYY', // Arabic (Kuwait)\n 'ar-BH': 'DD/MM/YYYY', // Arabic (Bahrain)\n 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman)\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Parses a date string based on a specific format.\n *\n * @param dateString The date string to parse.\n * @param format The format to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDateWithFormat = (\n dateString: string,\n format: string,\n): Date | null => {\n // Determine the separator based on the format (supports '/', '.', or '-')\n const separator = format.includes('/')\n ? '/'\n : format.includes('.')\n ? '.'\n : '-';\n const formatParts = format.split(separator);\n const dateParts = dateString.split(separator).map((num) => parseInt(num, 10));\n\n let year: number = 0,\n month: number = 0,\n day: number = 0;\n let yearSet: boolean = false,\n monthSet: boolean = false,\n daySet: boolean = false;\n\n // Check for format and date string mismatch\n if (dateParts.length !== formatParts.length) {\n return null; // Mismatch between date string and format\n }\n\n formatParts.forEach((part, index) => {\n // Check for non-numeric values in date string\n if (isNaN(dateParts[index])) {\n return null; // Invalid date part\n }\n\n // Assign year, month, and day based on the format\n switch (part) {\n case 'DD':\n day = dateParts[index];\n daySet = true;\n break;\n case 'MM':\n month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date\n monthSet = true;\n break;\n case 'YYYY':\n year = dateParts[index];\n yearSet = true;\n break;\n }\n });\n\n // Validate and create the date only if all parts are set\n if (yearSet && monthSet && daySet) {\n const parsedDate = new Date(year, month, day);\n // Validate date to catch invalid dates like February 30th\n if (\n parsedDate.getFullYear() === year &&\n parsedDate.getMonth() === month &&\n parsedDate.getDate() === day\n ) {\n return parsedDate;\n }\n }\n return null; // Invalid date or incomplete date information\n};\n\nexport default withErrorBoundary(\n parseDateWithFormat,\n);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { LOCALE_DATE_FORMATS } from './data/localeDateFormats';\nimport parseDateWithFormat from './parseDateWithFormat';\nimport { Locale } from './types';\n\n/**\n * Attempts to parse a string into a date object based on locale.\n * Uses the localeDateFormats mapping for determining the date format.\n *\n * @param dateString - The date string to parse.\n * @param locale - The locale to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDate = (dateString: string, locale: Locale): Date | null => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const format = LOCALE_DATE_FORMATS[locale];\n if (!format) {\n throw new Error(`No date format found for locale: ${locale}`);\n }\n return parseDateWithFormat(dateString, format);\n};\n\nexport default withErrorBoundary(parseDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport add from './add';\n\n/**\n * Subtracts a specified amount of time from a date.\n *\n * @param date The original date.\n * @param value The amount to subtract.\n * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time subtracted.\n */\nconst subtract = (\n date: Date,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n return add(date, -value, unit); // Reuse the add function with negative value\n};\n\nexport default withErrorBoundary(subtract);\n"],"names":["formatDateTime","parseDateWithFormat","add"],"mappings":"AAAA;AACM,MAAO,YAAa,SAAQ,KAAK,CAAA;AAErC,IAAA,WAAA,CAAY,OAA2B,EAAA;QACrC,KAAK,CAAC,OAAO,CAAC,CAAC;AACf,QAAA,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;AAC5B,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;;KAE7B;AACF,CAAA;AAED;;;;;;;;AAQG;AACI,MAAM,iBAAiB,GAAG,CAC/B,EAAK,KAC0C;IAC/C,OAAO,UAAyB,GAAG,IAAmB,EAAA;QACpD,IAAI;YACF,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAkB,CAAC;AAChD,SAAA;AAAC,QAAA,OAAO,GAAG,EAAE;AACZ,YAAA,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC;;;AAGp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AC,oCAAoC,MAAM,CAAA,CAAE,CAAC,CAAC;AAC/D,KAAA;AACD,IAAA,OAAOC,qBAAmB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC,CAAC;AAEF,kBAAe,iBAAiB,CAAmB,SAAS,CAAC;;AC3B7D;;;;;;;AAOG;AACH,MAAM,QAAQ,GAAG,CACf,IAAU,EACV,KAAa,EACb,IAAiC,KACzB;IACR,OAAOC,KAAG,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACjC,CAAC,CAAC;AAEF,iBAAe,iBAAiB,CAAkB,QAAQ,CAAC;;;;"} \ No newline at end of file diff --git a/lib/esm/index.js b/lib/esm/index.js new file mode 100644 index 00000000..30bf12f0 --- /dev/null +++ b/lib/esm/index.js @@ -0,0 +1,1556 @@ +// Custom Error class to extend properties to error object +class I18nifyError extends Error { + constructor(message) { + super(message); + this.name = 'i18nify Error'; + this.timestamp = new Date(); + // more params like type of error/severity can be added in future for better debugging. + } +} +/** + * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block. + * It appends additional attributes and serves as a centralized error-handling service. + * Usage => + * const wrappedUtilityFn = withErrorBoundary(utilityFn) + * + * @param fn utility that is wrapped in error boundary + * @returns {Function} returns the function wrapped in try/catch block + */ +const withErrorBoundary = (fn) => { + return function (...rest) { + try { + return fn.call(this, ...rest); + } + catch (err) { + console.warn('[I18N Error]: ', err); + // Currently, we are throwing the error as it is to consumers. + // In the future, this can be modified as per our requirement, like an error logging service. + throw new I18nifyError(err); + } + }; +}; + +function getDefaultState() { + return { + locale: '', + direction: '', + country: '', + }; +} + +class I18nStateManager { + constructor() { + this.state = getDefaultState(); + } + static getInstance() { + if (!I18nStateManager.instance) { + I18nStateManager.instance = new I18nStateManager(); + } + return I18nStateManager.instance; + } + static resetInstance() { + I18nStateManager.instance = undefined; + } + getState() { + return Object.assign({}, this.state); + } + setState(newState) { + this.state = Object.assign(Object.assign({}, this.state), newState); + } + resetState() { + this.state = getDefaultState(); + } +} +var state = I18nStateManager.getInstance(); + +/** + * function to return active i18n state + * + * ===== USAGE ===== + * import { getState } from '@razorpay/i18nify-js'; + * + * console.log(getState()) + * + * @returns i18n state + */ +const getState = () => { + return state.getState(); +}; +var getState$1 = withErrorBoundary(getState); + +/** + * Function to set and override the active state in i18nify SDK + * + * ===== USAGE ===== + * import { setState } from "@razorpay/i18nify-js"; + * setState({locale: 'en-US'}) + * + * @param newState data to set in i18nState instance + */ +const setState = (newState) => { + state.setState(newState); +}; +var setState$1 = withErrorBoundary(setState); + +/** + * Function to reset the active state in i18nify SDK + * + * ===== USAGE ===== + * import { resetState } from "@razorpay/i18nify-js"; + * resetState() + * + * @param newState data to set in i18nState instance + */ +const resetState = () => { + state.resetState(); +}; +var resetState$1 = withErrorBoundary(resetState); + +const getLocale = () => { + // Check if running in a non-browser environment (e.g., Node.js or older browsers). + if (typeof navigator === 'undefined') { + return 'en-IN'; + } + // Check if the browser supports the Intl object and user language preferences. + if (window.Intl && + typeof window.Intl === 'object' && + (window.navigator.languages || window.navigator.language)) { + const userLocales = window.navigator.languages || [ + window.navigator.language, + ]; + return userLocales[0]; + } + // Fallback to a supported locale or the default locale. + return 'en-IN'; +}; + +const getIntlInstanceWithOptions = (options = {}) => { + /** retrieve locale from below areas in order of preference + * 1. options.locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + let locale = (options === null || options === void 0 ? void 0 : options.locale) || state.getState().locale; + // If a specific locale is provided, use it; otherwise, use the browser's locale + if (!locale) { + locale = getLocale(); + } + const intlOptions = (options === null || options === void 0 ? void 0 : options.intlOptions) ? Object.assign({}, options.intlOptions) : {}; + if ((options === null || options === void 0 ? void 0 : options.currency) || intlOptions.currency) { + intlOptions.style = 'currency'; + intlOptions.currency = (options.currency || intlOptions.currency); + } + if (!locale) + throw new Error('Pass valid locale !'); + return new Intl.NumberFormat(locale || undefined, intlOptions); +}; + +// this function formats number based on different arguments passed +const formatNumber = (amount, options = {}) => { + if (!Number(amount) && Number(amount) !== 0) + throw new Error('Parameter `amount` is not a number!'); + let formattedAmount = ''; + try { + formattedAmount = getIntlInstanceWithOptions(options).format(Number(amount)); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + return formattedAmount; +}; +var formatNumber$1 = withErrorBoundary(formatNumber); + +const CURRENCIES = { + AED: { symbol: 'د.إ', name: 'United Arab Emirates Dirham' }, + ALL: { symbol: 'Lek', name: 'Albanian Lek' }, + AMD: { symbol: '֏', name: 'Armenian Dram' }, + ARS: { symbol: 'ARS', name: 'Argentine Peso' }, + AUD: { symbol: 'A$', name: 'Australian Dollar' }, + AWG: { symbol: 'Afl.', name: 'Aruban Florin' }, + BBD: { symbol: '$', name: 'Barbadian Dollar' }, + BDT: { symbol: '৳', name: 'Bangladeshi Taka' }, + BMD: { symbol: '$', name: 'Bermudian Dollar' }, + BND: { symbol: 'BND', name: 'Brunei Dollar' }, + BOB: { symbol: 'Bs', name: 'Bolivian Boliviano' }, + BSD: { symbol: 'B$', name: 'Bahamian Dollar' }, + BWP: { symbol: 'P', name: 'Botswanan Pula' }, + BZD: { symbol: 'BZ$', name: 'Belize Dollar' }, + CAD: { symbol: 'C$', name: 'Canadian Dollar' }, + CHF: { symbol: 'CHf', name: 'Swiss Franc' }, + CNY: { symbol: '¥', name: 'Chinese Yuan' }, + COP: { symbol: 'COL$', name: 'Colombian Peso' }, + CRC: { symbol: '₡', name: 'Costa Rican Colón' }, + CUP: { symbol: '$MN', name: 'Cuban Peso' }, + CZK: { symbol: 'Kč', name: 'Czech Koruna' }, + DKK: { symbol: 'DKK', name: 'Danish Krone' }, + DOP: { symbol: 'RD$', name: 'Dominican Peso' }, + DZD: { symbol: 'د.ج', name: 'Algerian Dinar' }, + EGP: { symbol: 'E£', name: 'Egyptian Pound' }, + ETB: { symbol: 'ብር', name: 'Ethiopian Birr' }, + EUR: { symbol: '€', name: 'Euro' }, + FJD: { symbol: 'FJ$', name: 'Fijian Dollar' }, + GBP: { symbol: '£', name: 'British Pound' }, + GHS: { symbol: 'GH₵', name: 'Ghanaian Cedi' }, + GIP: { symbol: 'GIP', name: 'Gibraltar Pound' }, + GMD: { symbol: 'D', name: 'Gambian Dalasi' }, + GTQ: { symbol: 'Q', name: 'Guatemalan Quetzal' }, + GYD: { symbol: 'G$', name: 'Guyanese Dollar' }, + HKD: { symbol: 'HK$', name: 'Hong Kong Dollar' }, + HNL: { symbol: 'HNL', name: 'Honduran Lempira' }, + HRK: { symbol: 'kn', name: 'Croatian Kuna' }, + HTG: { symbol: 'G', name: 'Haitian Gourde' }, + HUF: { symbol: 'Ft', name: 'Hungarian Forint' }, + IDR: { symbol: 'Rp', name: 'Indonesian Rupiah' }, + ILS: { symbol: '₪', name: 'Israeli New Shekel' }, + INR: { symbol: '₹', name: 'Indian Rupee' }, + JMD: { symbol: 'J$', name: 'Jamaican Dollar' }, + KES: { symbol: 'Ksh', name: 'Kenyan Shilling' }, + KGS: { symbol: 'Лв', name: 'Kyrgystani Som' }, + KHR: { symbol: '៛', name: 'Cambodian Riel' }, + KYD: { symbol: 'CI$', name: 'Cayman Islands Dollar' }, + KZT: { symbol: '₸', name: 'Kazakhstani Tenge' }, + LAK: { symbol: '₭', name: 'Laotian Kip' }, + LKR: { symbol: 'රු', name: 'Sri Lankan Rupee' }, + LRD: { symbol: 'L$', name: 'Liberian Dollar' }, + LSL: { symbol: 'LSL', name: 'Lesotho Loti' }, + MAD: { symbol: 'د.م.', name: 'Moroccan Dirham' }, + MDL: { symbol: 'MDL', name: 'Moldovan Leu' }, + MKD: { symbol: 'ден', name: 'Macedonian Denar' }, + MMK: { symbol: 'MMK', name: 'Myanmar Kyat' }, + MNT: { symbol: '₮', name: 'Mongolian Tugrik' }, + MOP: { symbol: 'MOP$', name: 'Macanese Pataca' }, + MUR: { symbol: '₨', name: 'Mauritian Rupee' }, + MVR: { symbol: 'Rf', name: 'Maldivian Rufiyaa' }, + MWK: { symbol: 'MK', name: 'Malawian Kwacha' }, + MXN: { symbol: 'Mex$', name: 'Mexican Peso' }, + MYR: { symbol: 'RM', name: 'Malaysian Ringgit' }, + NAD: { symbol: 'N$', name: 'Namibian Dollar' }, + NGN: { symbol: '₦', name: 'Nigerian Naira' }, + NIO: { symbol: 'NIO', name: 'Nicaraguan Córdoba' }, + NOK: { symbol: 'NOK', name: 'Norwegian Krone' }, + NPR: { symbol: 'रू', name: 'Nepalese Rupee' }, + NZD: { symbol: 'NZ$', name: 'New Zealand Dollar' }, + PEN: { symbol: 'S/', name: 'Peruvian Nuevo Sol' }, + PGK: { symbol: 'PGK', name: 'Papua New Guinean Kina' }, + PHP: { symbol: '₱', name: 'Philippine Peso' }, + PKR: { symbol: '₨', name: 'Pakistani Rupee' }, + QAR: { symbol: 'QR', name: 'Qatari Riyal' }, + RUB: { symbol: '₽', name: 'Russian Ruble' }, + SAR: { symbol: 'SR', name: 'Saudi Riyal' }, + SCR: { symbol: 'SRe', name: 'Seychellois Rupee' }, + SEK: { symbol: 'SEK', name: 'Swedish Krona' }, + SGD: { symbol: 'S$', name: 'Singapore Dollar' }, + SLL: { symbol: 'Le', name: 'Sierra Leonean Leone' }, + SOS: { symbol: 'Sh.so.', name: 'Somali Shilling' }, + SSP: { symbol: 'SS£', name: 'South Sudanese Pound' }, + SVC: { symbol: '₡', name: 'Salvadoran Colón' }, + SZL: { symbol: 'E', name: 'Swazi Lilangeni' }, + THB: { symbol: '฿', name: 'Thai Baht' }, + TTD: { symbol: 'TT$', name: 'Trinidad and Tobago Dollar' }, + TZS: { symbol: 'Sh', name: 'Tanzanian Shilling' }, + USD: { symbol: '$', name: 'United States Dollar' }, + UYU: { symbol: '$U', name: 'Uruguayan Peso' }, + UZS: { symbol: "so'm", name: 'Uzbekistani Som' }, + YER: { symbol: '﷼', name: 'Yemeni Rial' }, + ZAR: { symbol: 'R', name: 'South African Rand' }, + KWD: { symbol: 'د.ك', name: 'Kuwaiti Dinar' }, + BHD: { symbol: 'د.ب.', name: 'Bahraini Dinar' }, + OMR: { symbol: 'ر.ع.', name: 'Omani Rial' }, +}; + +const getCurrencyList = () => { + return CURRENCIES; +}; +var getCurrencyList$1 = withErrorBoundary(getCurrencyList); + +const getCurrencySymbol = (currencyCode) => { + var _a; + if (currencyCode in CURRENCIES) + return (_a = CURRENCIES[currencyCode]) === null || _a === void 0 ? void 0 : _a.symbol; + else + throw new Error('Invalid currencyCode!'); +}; +var getCurrencySymbol$1 = withErrorBoundary(getCurrencySymbol); + +const ALLOWED_FORMAT_PARTS_KEYS = [ + 'nan', + 'infinity', + 'percent', + 'integer', + 'group', + 'decimal', + 'fraction', + 'plusSign', + 'minusSign', + 'percentSign', + 'currency', + 'code', + 'symbol', + 'name', + 'compact', + 'exponentInteger', + 'exponentMinusSign', + 'exponentSeparator', + 'unit', +]; + +const formatNumberByParts = (amount, options = {}) => { + if (!Number(amount) && Number(amount) !== 0) + throw new Error('Parameter `amount` is not a number!'); + try { + const formattedAmount = getIntlInstanceWithOptions(options).formatToParts(Number(amount)); + const parts = formattedAmount; + const formattedObj = {}; + parts.forEach((p) => { + if (p.type === 'group') { + formattedObj.integer = (formattedObj.integer || '') + p.value; + } + else if (ALLOWED_FORMAT_PARTS_KEYS.findIndex((item) => item === p.type) != -1) { + // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal' is skipped + formattedObj[p.type] = (formattedObj[p.type] || '') + p.value; + } + }); + return Object.assign(Object.assign({}, formattedObj), { isPrefixSymbol: parts[0].type === 'currency', rawParts: parts }); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } +}; +var formatNumberByParts$1 = withErrorBoundary(formatNumberByParts); + +const PHONE_REGEX_MAPPER = { + IN: /^(?:(?:\+|0{0,2})91\s*[-]?\s*|[0]?)?[6789]\d{9}$/, + MY: /^(\+?6?0)?(\d{1,3})[-. ]?(\d{7,8})$/, + AE: /^(?:\+?971|0)?(?:2|3|4|6|7|9)\d{8}$/, + AL: /^(?:\+?355)?(?:[4-9]\d{7}|6\d{8})$/, + AM: /^(?:\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/, + AR: /^(?:(?:\+|0{0,2})54)?(?:11|[2368]\d)(?:(?=\d{0,2}15)\d{2})??\d{8}$/, + AU: /^(?:\+?61|0)4\d{8}$/, + AW: /^(?:(?:\+297)?(?!0)\d{7})$/, + BB: /^(?:(?:\+1)?246)?(?:\d{3})?\d{7}$/, + BD: /^(?:\+?880|0)1[13456789]\d{8}$/, + BM: /^(?:(?:\+1)?441)?(?:\d{2})?\d{7}$/, + BN: /^(?:\+?673)?(?:\d{3})?\d{4}$/, + BO: /^(?:(?:\+|0{0,2})591)?(?:(?:2|3|7|6)\d{7})$/, + BS: /^(?:(?:\+1)?242)?(?:\d{3})?\d{7}$/, + BW: /^(?:(?:\+267)?\s?)?[74]\d{7}$/, + BZ: /^(?:(?:\+501)?\s?)?[622]\d{4}$/, + CH: /^(?:(?:\+41|0)(?:\s*\(?0\)?\s*))?(?:\d{2}\s*)?\d{3}\s*\d{2}\s*\d{2}$/, + CN: /^(?:(?:\+|00)86)?1\d{10}$/, + CO: /^(?:(?:\+57|0057)?)?[1-8]{1}\d{6,7}$/, + OM: /^(?:\+?968)?(?:95|96|97|98)\d{6}$/, + CR: /^(?:(?:\+506)?\s*|0)?[1-9]\d{7}$/, + CU: /^(?:\+?53)?(?:[5-8]\d{7})$/, + CZ: /^(?:\+?420)?(?:\d{9})$/, + DK: /^(?:\+?45)?(?:\d{8})$/, + DO: /^(?:(?:\+1)?809|1-8(?:00|88|89))(?:\d{7})$/, + DZ: /^(?:\+?213|0)([567]\d{8})$/, + EG: /^(?:(?:\+20|20)?(\d{10}))$/, + ET: /^(?:\+?251)?[1-59]\d{8}$/, + EU: /^(?:(?:\+?3)?8)?\s*(?:\d{3}\s*){3}\d{2}$/, + FJ: /^(?:(?:\+?679)?\s?\d{3}\s?\d{4})?$/, + GB: /^(?:(?:\+44\s?|0)7\d{3}(\s?\d{4,})?)$/, + GH: /^(?:(?:\+233)|0)?(?:\d{9})$/, + GI: /^(?:\+350)?\d{5}$/, + GM: /^(?:\+220)?\d{5,7}$/, + GT: /^(?:\+502)?[2468]\d{7,8}$/, + GY: /^(?:(?:\+592)?(?:(?:\s)?[2-9])(?:(?:\s)?\d))?(?:(?:\s)?\d{4})$/, + HK: /^(?:\+852\s?)?[456789]\d{3}\s?\d{4}$/, + HN: /^(?:\+504)?[89]\d{7}$/, + HR: /^(?:\+?385)?\d{8,9}$/, + HT: /^(?:\+?509)?\d{8}$/, + HU: /^(?:(?:\+36))(\s?\d{2}\s?\d{3}\s?\d{4})$/, + ID: /^(?:\+?62|0[1-9])[\s-]?\d{2,4}[\s-]?\d{3,4}[\s-]?\d{3,4}$/, + IL: /^(?:(?:\+972|0)(?:-)?)[23489]\d{7}$/, + JM: /^(?:(?:\+1876))\d{7,10}$/, + KE: /^(?:(?:\+254)|(?:0))(?:\d{6,7})$/, + KG: /^(?:\+996)?\s?\d{9}$/, + KH: /^(?:(?:\+855)|(?:0))(?:\s?[1-9]\d{7,8})$/, + KY: /^(?:\+?1\s?(345))\d{6}$/, + KZ: /^(?:\+?7|8)?7\d{9}$/, + LA: /^(?:(?:\+?856)|0)(20\d{7,9})$/, + LK: /^(?:(?:\+94)|0)(?:\d{9})$/, + LR: /^(?:\+231)[ -\d]{4}[ -\d]{4}$/, + LS: /^(?:(?:\+?266)|0)?[56]\d{7}$/, + MA: /^(?:(?:\+?212(\s*[-|\s*]?\d{1,9})?)|(?:0))(?:\d{9})$/, + MD: /^(?:(?:\+373)|(?:0))(?:\d{7,8})$/, + MK: /^(?:\+389|0)(?:(?:2[0-4]|[3-9])\s?)?\d{6}$/, + MM: /^(?:(?:\+?95)|0)?[1-9]\d{9}$/, + MN: /^(?:\+976|0)\d{8}$/, + MO: /^(?:(?:\+?853)|[0-9])?\d{8}$/, + MU: /^(?:\+230|0)?\d{8}$/, + MV: /^(?:(?:\+?960)|0)?\d{7}$/, + MW: /^(?:\+265)[1-9]\d{6}$/, + MX: /^(?:(?:\+?52)?\s?(?:1|01)?\s?)?(?:\d{3}\s?\d{3}\s?\d{4})$/, + NA: /^(?:(?:\+264)|0)?\d{8}$/, + NG: /^(?:(?:\+234)|(?:0))(?:\d{7,8})$/, + NI: /^(?:(?:\+505))?(?:\d{8})$/, + NO: /^(?:(?:\+?47)|\d{2}|\d{3})\s?\d{2}\s?\d{3}$/, + NP: /^(?:(?:\+977))?(\d{9,10})$/, + NZ: /^(?:\+?64|0)(\d{2,5} \d{4,8}|\d{3,4} \d{4})$/, + PE: /^(?:(?:\+51)|0)?(?:9\d{8})$/, + PG: /^(?:\+?675)?(?:[7-9]\d{7})$/, + PH: /^(?:(?:\+?63)|0)(?:\d{10})$/, + PK: /^(?:(?:\+92)|0)?[345]\d{9}$/, + QA: /^(?:\+?974)?-?33\d{5}$/, + RU: /^(?:\+?7|8)?[ -]?\(?9\d{2}\)?[ -]?\d{3}[ -]?\d{2}[ -]?\d{2}$/, + SA: /^(?:\+?966)?\s?1?[\s-]?(?:[45]\d{2}|5\d{3})[\s-]?\d{4}$/, + SC: /^(?:(?:\+248)|\d{4})\d{5}$/, + SE: /^(?:\+?46|0)\s?[1-57-9](?:[0-9]\s?){8}$/, + SG: /^(?:(?:\+65)|(?:\(\+65\))|(?:65))\d{4}\d{4}$/, + SL: /^(?:(?:\+232)|(?:0))?\d{9}$/, + SO: /^(?:\+252|0)?[567]\d{7}$/, + SS: /^(?:\+211|0)?[1-9]\d{7,9}$/, + SV: /^(?:(?:\+?503)|(?:0))(?:\d{8})$/, + SZ: /^(?:\+?268)?\d{7,8}$/, + TH: /^(?:(?:\+66)|0)\d{9}$/, + TT: /^(?:(?:\+?1-868)|\(?868\)?)(\d{7})$/, + TZ: /^(?:(?:\+?255)|0)?[67]\d{8}$/, + US: /^(\+\d{1,2}\s?)?([2-9]{1}\d{2}[2-9]{1}\d{6})$/, + CA: /^(\+\d{1,2}\s?)?([2-9]{1}\d{2}[2-9]{1}\d{6})$/, + UY: /^(?:(?:\+598|0)\s?(9\d{3}|2\d{2}|[4-9]\d{6}))$/, + UZ: /^(?:\+?998)?\s?[3456789]\d{8}$/, + YE: /^(?:\+?967)?(?:\d{7,8})$/, + ZA: /^(?:(?:\+27)|0)(\d{9})$/, + KW: /^(?:\+?965)[569]\d{7}$/, + BH: /^(?:\+?973)?[356]\d{7}$/, + TL: /^(?:(?:\+670)\s?)?[0-9]{3}\s?[0-9]{3,4}$/, + VC: /^(?:(?:\+1)?784)?(?:\d{3})?\d{7}$/, + VE: /^(?:(?:\+58)|0)?4\d{9}$/, + VN: /^(?:(?:\+84)|0)?[1-9]\d{8}$/, + ZM: /^(?:(?:\+260)|0)?[123456789]\d{8,9}$/, + ZW: /^(?:(?:\+263)|0)?(?:\d{9,10})$/, + LT: /^(?:(?:\+370)|8)\d{8}$/, + LU: /^(?:(?:\+352)?(6|2(6|7|8|9))\d{6})$/, + LV: /^(?:(?:\+371)?2\d{7})$/, + ME: /^(?:(?:\+382)?[67]\d{7,20})$/, + MG: /^(?:(?:\+261)?3[234568]\d{7})$/, + MZ: /^(?:(?:\+258)|(?:258))?8[234567]\d{7,8}$/, + NL: /^(?:(?:\+31)|0(6(?:\d{8})|[1-9](?:(?:\d{8})|(?:\s\d{3}\s\d{4}))|(?:\d{8})))$/, + PA: /^(?:(?:\+507)\s?)?[46]\d{6,7}$/, + PL: /^(?:(?:\+48)?(?:\s?\d{3}\s?\d{3}\s?\d{3}|(?:\d{2}\s?){4}\d{2}|\d{3}-\d{3}-\d{3}))$/, + PR: /^(?:(?:\+1)?787|939)\d{7}$/, + PS: /^(?:(?:\+970))(5[2349])\d{7}$/, + PT: /^(?:(?:\+351)?9(1\d|2[1-9]|6[12345789]|7[12345789])\d{7})$/, + PY: /^(?:(?:\+595|0)9[9876]\d{7})$/, + RO: /^(?:(?:\+40|0))(?:7[2-8]\d{7}|21\d{8})$/, + RS: /^(?:(?:\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/, + RW: /^(?:(?:\+250)|(0))\d{9}$/, + SI: /^(?:(?:\+386)|0)?[1-59]\d{7,8}$/, + SK: /^(?:(?:\+421))?(0|9[0-8])\d{8}$/, + SM: /^(?:(?:\+378)|(0549|6\d{4}))\d{5}$/, + SN: /^(?:(?:\+221)|0)?[3679]\d{7}$/, + SR: /^(?:(?:\+597))\d{7}$/, + TG: /^(?:(?:\+228))\d{8}$/, + TJ: /^(?:(?:\+992))(37|55|77)\d{7}$/, + TN: /^(?:(?:\+216)|22|9[1-9])\d{7}$/, + TR: /^(?:(?:\+90)|(0))\s?5\d{9}$/, + TW: /^(?:(?:\+886)|0)?9\d{8}$/, + UA: /^(?:(?:\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\d{7}$/, + UG: /^(?:(?:\+256)|0)?[39]\d{8}$/, +}; + +/* Source: Google LibPhoneNumber Metadata: https://github.com/google/libphonenumber/blob/master/javascript/i18n/phonenumbers/metadata.js */ +const DIAL_CODE_MAPPER = { + 1: [ + 'US', + 'AG', + 'AI', + 'AS', + 'BB', + 'BM', + 'BS', + 'CA', + 'DM', + 'DO', + 'GD', + 'GU', + 'JM', + 'KN', + 'KY', + 'LC', + 'MP', + 'MS', + 'PR', + 'SX', + 'TC', + 'TT', + 'VC', + 'VG', + 'VI', + ], + 7: ['RU', 'KZ'], + 20: ['EG'], + 27: ['ZA'], + 30: ['GR'], + 31: ['NL'], + 32: ['BE'], + 33: ['FR'], + 34: ['ES'], + 36: ['HU'], + 39: ['IT', 'VA'], + 40: ['RO'], + 41: ['CH'], + 43: ['AT'], + 44: ['GB', 'GG', 'IM', 'JE'], + 45: ['DK'], + 46: ['SE'], + 47: ['NO', 'SJ'], + 48: ['PL'], + 49: ['DE'], + 51: ['PE'], + 52: ['MX'], + 53: ['CU'], + 54: ['AR'], + 55: ['BR'], + 56: ['CL'], + 57: ['CO'], + 58: ['VE'], + 60: ['MY'], + 61: ['AU', 'CC', 'CX'], + 62: ['ID'], + 63: ['PH'], + 64: ['NZ'], + 65: ['SG'], + 66: ['TH'], + 81: ['JP'], + 82: ['KR'], + 84: ['VN'], + 86: ['CN'], + 90: ['TR'], + 91: ['IN'], + 92: ['PK'], + 93: ['AF'], + 94: ['LK'], + 95: ['MM'], + 98: ['IR'], + 211: ['SS'], + 212: ['MA', 'EH'], + 213: ['DZ'], + 216: ['TN'], + 218: ['LY'], + 220: ['GM'], + 221: ['SN'], + 222: ['MR'], + 223: ['ML'], + 224: ['GN'], + 225: ['CI'], + 226: ['BF'], + 227: ['NE'], + 228: ['TG'], + 229: ['BJ'], + 230: ['MU'], + 231: ['LR'], + 232: ['SL'], + 233: ['GH'], + 234: ['NG'], + 235: ['TD'], + 236: ['CF'], + 237: ['CM'], + 238: ['CV'], + 239: ['ST'], + 240: ['GQ'], + 241: ['GA'], + 242: ['CG'], + 243: ['CD'], + 244: ['AO'], + 245: ['GW'], + 246: ['IO'], + 247: ['AC'], + 248: ['SC'], + 249: ['SD'], + 250: ['RW'], + 251: ['ET'], + 252: ['SO'], + 253: ['DJ'], + 254: ['KE'], + 255: ['TZ'], + 256: ['UG'], + 257: ['BI'], + 258: ['MZ'], + 260: ['ZM'], + 261: ['MG'], + 262: ['RE', 'YT'], + 263: ['ZW'], + 264: ['NA'], + 265: ['MW'], + 266: ['LS'], + 267: ['BW'], + 268: ['SZ'], + 269: ['KM'], + 290: ['SH', 'TA'], + 291: ['ER'], + 297: ['AW'], + 298: ['FO'], + 299: ['GL'], + 350: ['GI'], + 351: ['PT'], + 352: ['LU'], + 353: ['IE'], + 354: ['IS'], + 355: ['AL'], + 356: ['MT'], + 357: ['CY'], + 358: ['FI', 'AX'], + 359: ['BG'], + 370: ['LT'], + 371: ['LV'], + 372: ['EE'], + 373: ['MD'], + 374: ['AM'], + 375: ['BY'], + 376: ['AD'], + 377: ['MC'], + 378: ['SM'], + 380: ['UA'], + 381: ['RS'], + 382: ['ME'], + 383: ['XK'], + 385: ['HR'], + 386: ['SI'], + 387: ['BA'], + 389: ['MK'], + 420: ['CZ'], + 421: ['SK'], + 423: ['LI'], + 500: ['FK'], + 501: ['BZ'], + 502: ['GT'], + 503: ['SV'], + 504: ['HN'], + 505: ['NI'], + 506: ['CR'], + 507: ['PA'], + 508: ['PM'], + 509: ['HT'], + 590: ['GP', 'BL', 'MF'], + 591: ['BO'], + 592: ['GY'], + 593: ['EC'], + 594: ['GF'], + 595: ['PY'], + 596: ['MQ'], + 597: ['SR'], + 598: ['UY'], + 599: ['CW', 'BQ'], + 670: ['TL'], + 672: ['NF'], + 673: ['BN'], + 674: ['NR'], + 675: ['PG'], + 676: ['TO'], + 677: ['SB'], + 678: ['VU'], + 679: ['FJ'], + 680: ['PW'], + 681: ['WF'], + 682: ['CK'], + 683: ['NU'], + 685: ['WS'], + 686: ['KI'], + 687: ['NC'], + 688: ['TV'], + 689: ['PF'], + 690: ['TK'], + 691: ['FM'], + 692: ['MH'], + 800: ['001'], + 808: ['001'], + 850: ['KP'], + 852: ['HK'], + 853: ['MO'], + 855: ['KH'], + 856: ['LA'], + 870: ['001'], + 878: ['001'], + 880: ['BD'], + 881: ['001'], + 882: ['001'], + 883: ['001'], + 886: ['TW'], + 888: ['001'], + 960: ['MV'], + 961: ['LB'], + 962: ['JO'], + 963: ['SY'], + 964: ['IQ'], + 965: ['KW'], + 966: ['SA'], + 967: ['YE'], + 968: ['OM'], + 970: ['PS'], + 971: ['AE'], + 972: ['IL'], + 973: ['BH'], + 974: ['QA'], + 975: ['BT'], + 976: ['MN'], + 977: ['NP'], + 979: ['001'], + 992: ['TJ'], + 993: ['TM'], + 994: ['AZ'], + 995: ['GE'], + 996: ['KG'], + 998: ['UZ'], +}; + +/** + * Determines the country code based on the provided phone number. + * This function employs a multi-step approach to identify the country code: + * - If the phone number starts with '+', it extracts the numeric characters + * and matches the leading digits with known dial codes mapped to countries. + * - For matched dial codes, it further filters based on country-specific regex patterns + * to validate the phone number format for those countries. + * - If the phone number doesn't start with '+', it directly matches the number + * against regular expressions associated with various countries to identify the code. + * + * @param phoneNumber The input phone number (string or number). + * @returns The detected country code or an empty string if not found. + */ +const detectCountryCodeFromDialCode = (phoneNumber) => { + // If the phone number starts with '+', extract numeric characters + if (phoneNumber.toString().charAt(0) === '+') { + const cleanedPhoneNumberWithoutPlusPrefix = phoneNumber + .toString() + .replace(/\D/g, ''); + const matchingCountries = []; + // Iterate through dial codes and check for matches with cleaned phone number + for (const code in DIAL_CODE_MAPPER) { + if (cleanedPhoneNumberWithoutPlusPrefix.startsWith(code)) { + matchingCountries.push(...DIAL_CODE_MAPPER[code]); + } + } + // Filter matching countries based on phone number validation regex + const matchedCountryCode = matchingCountries.find((countryCode) => { + const regex = PHONE_REGEX_MAPPER[countryCode]; + if (regex && regex.test(phoneNumber.toString())) + return countryCode; + return undefined; + }); + // Return the first matched country code, if any + return matchedCountryCode || ''; + } + else { + // If phone number doesn't start with '+', directly match against country regexes + for (const countryCode in PHONE_REGEX_MAPPER) { + const regex = PHONE_REGEX_MAPPER[countryCode]; + if (regex.test(phoneNumber.toString())) { + return countryCode; + } + } + } + // Return empty string if no country code is detected + return ''; +}; +const cleanPhoneNumber = (phoneNumber) => { + // Regular expression to match all characters except numbers and + sign at the start + const regex = /[^0-9+]|(?!A)\+/g; + // Replace matched characters with an empty string + const cleanedPhoneNumber = phoneNumber.replace(regex, ''); + return phoneNumber[0] === '+' ? `+${cleanedPhoneNumber}` : cleanedPhoneNumber; +}; + +// Validates whether a given phone number is valid based on the provided country code or auto-detects the country code and checks if the number matches the defined regex pattern for that country. +const isValidPhoneNumber = (phoneNumber, countryCode) => { + // Clean the provided phoneNumber by removing non-numeric characters + const cleanedPhoneNumber = cleanPhoneNumber(phoneNumber.toString()); + // Detect or validate the country code + countryCode = + countryCode && countryCode in PHONE_REGEX_MAPPER + ? countryCode + : detectCountryCodeFromDialCode(cleanedPhoneNumber); + // Return false if phoneNumber is empty + if (!phoneNumber) + return false; + // Check if the countryCode exists in the PHONE_REGEX_MAPPER + if (countryCode in PHONE_REGEX_MAPPER) { + // Fetch the regex pattern for the countryCode + const regex = PHONE_REGEX_MAPPER[countryCode]; + // Test if the cleanedPhoneNumber matches the regex pattern + return regex.test(cleanedPhoneNumber); + } + // Return false if the countryCode is not supported + return false; +}; +var isValidPhoneNumber$1 = withErrorBoundary(isValidPhoneNumber); + +const PHONE_FORMATTER_MAPPER = { + IN: 'xxxx xxxxxx', + MY: 'xx xxxxx xx', + AE: 'xx xxx xxxx', + AL: 'xxx xx xxxx', + AM: 'xx xx xx xx', + AR: 'xxxx-xxxx', + AU: 'xxx xxx xxx', + AW: 'xxx-xxxx', + BB: 'xxx-xxxx', + BD: 'xxxx-xxxxxx', + BM: 'xxx-xxxx', + BN: 'xxxx-xxxx', + BO: 'xxxx-xxxx', + BS: 'xxx-xxxx', + BW: 'xx xxxx xxxx', + BZ: 'xxx-xxxx', + CA: 'xxx-xxx-xxxx', + CH: 'xxx xxx xxx', + CN: 'xxxx-xxxxxxx', + CO: 'xxxx-xxxxxxx', + CR: 'xxxx-xxxx', + CU: 'xxxx-xxxx', + CZ: 'xxx xxx xxx', + DK: 'xx xx xx xx', + DO: 'xxx-xxxxxxx', + DZ: 'xxxx-xxxx-xxx', + EG: 'xx xxx xxxx', + ET: 'xx xxx xxxx', + EU: 'xxx xx xx xx', + FJ: 'xxxx xxxx', + GB: 'xxxx xxx xxx', + GH: 'xxx xxx xxxx', + GI: 'xxxx xxxx', + GM: 'xxxx-xxxx', + GT: 'xxxx-xxxx', + GY: 'xxx-xxxx', + HK: 'xxxx xxxx', + HN: 'xxxx-xxxx', + HR: 'xxx xxx xxxx', + HT: 'xxx-xxxx', + HU: 'xxx xxx xxxx', + ID: 'xxxx-xxxx-xxxx', + IL: 'xxxx-xxx-xxx', + JM: 'xxx-xxxx', + KE: 'xxx xxxxxx', + KG: 'xxx-xx-xx-xx', + KH: 'xxx-xxx-xxx', + KY: 'xxx-xxxx', + KZ: 'xxx-xxx-xx-xx', + LA: 'xxx xx xxxx', + LK: 'xx xxx xxxx', + LR: 'xxx-xxx-xxxx', + LS: 'xxx xx xxxx', + LT: 'xxx xxxxx', + LU: 'xxx xx xxx', + LV: 'xxxx xxxx', + MA: 'xxxx-xxxxxx', + MD: 'xx xxxxxx', + ME: 'xx xxxxxx', + MG: 'xx xx xx xx xx', + MK: 'xx xx xx xx', + MM: 'xx xxxxxx', + MN: 'xxx-xx-xxxx', + MO: 'xxxx xxxx', + MU: 'xx xxxx xxxx', + MV: 'xxxxxx', + MW: 'xx xxxx xxxx', + MX: 'xxx-xxx-xxxx', + MZ: 'xx xxxxxxx', + NA: 'xx xxxx xxxx', + NG: 'xxx xxx xxxx', + NI: 'xxxx-xxxx', + NL: 'xxx-xxxxxxx', + NO: 'xxxx xxxx', + NP: 'xxxx-xxxxxxx', + NZ: 'xxx-xxxxxxx', + OM: 'xxxx-xxxx', + PA: 'xxx-xxxx', + PE: 'xxx-xxx-xxx', + PG: 'xxx-xxxxxx', + PH: 'xxx-xxxx', + PK: 'xxx-xxxxxxx', + PL: 'xxx xxx xxx', + PR: 'xxx-xxx-xxxx', + PS: 'xxxx-xxxxxxx', + PT: 'xxx xxx xxx', + PY: 'xxx-xxxxxx', + QA: 'xxxx xxxx', + RO: 'xxx xxx xxxx', + RS: 'xxx xxxxx', + RU: 'xxx xxx-xx-xx', + RW: 'xxx xxxxxx', + SA: 'xxx-xxxxxxx', + SC: 'xx xxxxx', + SE: 'xxx-xxx xx xx', + SG: 'xxxx xxxx', + SI: 'xx xxxxxx', + SK: 'xxx xxx xxx', + SL: 'xxx-xxxxxx', + SM: 'xxxxx xxxxx', + SN: 'xx xxx xx xx', + SO: 'xxx xxxxxxx', + SR: 'xxx-xxxx', + SS: 'xxx xxxx xxx', + SV: 'xxxx-xxxx', + SZ: 'xxx xx xxxx', + TG: 'xx xx xx xx', + TH: 'xxx-xxxxxxx', + TJ: 'xxx xx xx xx', + TL: 'xxx-xxxxxxx', + TN: 'xx xxxxxx', + TR: 'xxx xxx xx xx', + TT: 'xxx-xxxx', + TW: 'xxxx-xxxxxx', + TZ: 'xxx xxx xxxx', + UA: 'xx xxx xx xx', + UG: 'xxx xxxxxxx', + US: 'xxx-xxx-xxxx', + UY: 'xxx-xxxxx', + UZ: 'xxx-xxx-xx-xx', + VC: 'xxx-xxxx', + VE: 'xxxx-xxx-xxxx', + VN: 'xxxx-xxxxxxx', + YE: 'xxxx-xxxx', + ZA: 'xxx-xxx-xxxx', + ZM: 'xxx-xxxxxxx', + ZW: 'xx xxx xxxx', + KW: 'xxx xx xxxx', + BH: 'xxxx xxxx', +}; + +// Formats a provided phone number according to the predefined format for a specific country code, or auto-detects the country code and formats the number accordingly. +const formatPhoneNumber = (phoneNumber, countryCode) => { + // Throw errors if phoneNumber is invalid + if (!phoneNumber) + throw new Error('Parameter `phoneNumber` is invalid!'); + // Convert phoneNumber to string and clean it by removing non-numeric characters + phoneNumber = phoneNumber.toString(); + phoneNumber = cleanPhoneNumber(phoneNumber); + // Detect or validate the country code + countryCode = + countryCode && countryCode in PHONE_FORMATTER_MAPPER + ? countryCode + : detectCountryCodeFromDialCode(phoneNumber); + // Fetch the pattern for the countryCode from the PHONE_FORMATTER_MAPPER + const pattern = PHONE_FORMATTER_MAPPER[countryCode]; + if (!pattern) + return phoneNumber; + // Count the number of 'x' characters in the format pattern + let charCountInFormatterPattern = 0; + for (let i = 0; i < pattern.length; i++) { + if (pattern[i] === 'x') { + charCountInFormatterPattern++; + } + } + // Calculate the difference between phoneNumber length and 'x' characters count in pattern + const diff = phoneNumber.length - charCountInFormatterPattern; + // Extract the phoneNumber without the prefix + const phoneNumberWithoutPrefix = phoneNumber.slice(diff); + const formattedNumber = []; + let numberIndex = 0; + // Loop through the pattern to format the phoneNumber + for (let i = 0; i < pattern.length; i++) { + const patternChar = pattern[i]; + if (patternChar === 'x') { + // Insert phoneNumber digits at 'x' positions + if (numberIndex < phoneNumberWithoutPrefix.length) { + formattedNumber.push(phoneNumberWithoutPrefix[numberIndex]); + numberIndex++; + } + } + else { + // Insert non-digit characters from the pattern + formattedNumber.push(patternChar); + } + } + // Join the formattedNumber array to create the formattedPhoneNumber without prefix + const formattedPhoneNumberWithoutPrefix = formattedNumber.join(''); + // Combine the prefix and formattedPhoneNumberWithoutPrefix + const formattedPhoneNumberWithPrefix = phoneNumber.slice(0, diff) + ' ' + formattedPhoneNumberWithoutPrefix; + // Return the formattedPhoneNumber with prefix after trimming whitespace + return formattedPhoneNumberWithPrefix.trim(); +}; +var formatPhoneNumber$1 = withErrorBoundary(formatPhoneNumber); + +// Parses a given phone number, identifies its country code (if not provided), and returns an object with details including the country code, formatted phone number, dial code, and format template. +const parsePhoneNumber = (phoneNumber, country) => { + // Throw errors if phoneNumber is invalid + if (!phoneNumber) + throw new Error('Parameter `phoneNumber` is invalid!'); + // Clean the phoneNumber by removing non-numeric characters + phoneNumber = phoneNumber.toString(); + phoneNumber = cleanPhoneNumber(phoneNumber); + // Detect or validate the country code + const countryCode = country && country in PHONE_FORMATTER_MAPPER + ? country + : detectCountryCodeFromDialCode(phoneNumber); + // Format the phone number using the detected/validated country code + const formattedPhoneNumber = formatPhoneNumber$1(phoneNumber, countryCode); + // Fetch the pattern associated with the countryCode from the PHONE_FORMATTER_MAPPER + const pattern = PHONE_FORMATTER_MAPPER[countryCode]; + if (!pattern) + return { + countryCode: countryCode || '', + dialCode: '', + formattedPhoneNumber: phoneNumber, + formatTemplate: '', + }; + // Count the number of 'x' characters in the format pattern + let charCountInFormatterPattern = 0; + for (let i = 0; i < pattern.length; i++) { + if (pattern[i] === 'x') { + charCountInFormatterPattern++; + } + } + // Calculate the difference between phoneNumber length and 'x' characters count in pattern + const diff = phoneNumber.length - charCountInFormatterPattern; + // Extract the dialCode from the phoneNumber + const dialCode = phoneNumber.slice(0, diff); + // Obtain the format template associated with the countryCode + const formatTemplate = PHONE_FORMATTER_MAPPER[countryCode]; + // Return the parsed phone number information + return { + countryCode, + formattedPhoneNumber, + dialCode, + formatTemplate, + }; +}; +var parsePhoneNumber$1 = withErrorBoundary(parsePhoneNumber); + +/** + * Adds a specified amount of time to a date. + * + * @param date The original date. + * @param value The amount to add. + * @param unit The unit of time to add (e.g., 'days', 'months', 'years'). + * @returns A new Date object with the time added. + */ +const add = (date, value, unit) => { + const result = new Date(date); + switch (unit) { + case 'days': + result.setDate(result.getDate() + value); + break; + case 'months': + result.setMonth(result.getMonth() + value); + break; + case 'years': + result.setFullYear(result.getFullYear() + value); + break; + } + return result; +}; +var add$1 = withErrorBoundary(add); + +/** + * Formats date and time based on the locale. + * @param {DateInput} date - Date object or date string. + * @param {Locale} locale - Locale string. + * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional). + * @returns {string} Formatted date and time string. + */ +const formatDateTime = (date, locale, options = {}) => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) + locale = state.getState().locale || getLocale(); + const dateObj = date instanceof Date ? date : new Date(date); + let formatter; + try { + formatter = new Intl.DateTimeFormat(locale, options); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + return formatter.format(dateObj); +}; +var formatDateTime$1 = withErrorBoundary(formatDateTime); + +/** + * Formats date based on the locale. + * @param {DateInput} date - Date object or date string. + * @param {Locale} locale - Locale string. + * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional). + * @returns {string} Formatted date string. + */ +const formatDate = (date, locale, options = {}) => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) + locale = state.getState().locale || getLocale(); + const fullOptions = Object.assign(Object.assign({}, options), { timeStyle: undefined }); + let formattedDate; + try { + formattedDate = formatDateTime$1(date, locale, fullOptions); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + return formattedDate; +}; +var formatDate$1 = withErrorBoundary(formatDate); + +/** + * Formats time based on the locale. + * @param {DateInput} date - Date object or date string. + * @param {Locale} locale - Locale string. + * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional). + * @returns {string} Formatted time string. + */ +const formatTime = (date, locale, options = {}) => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) + locale = state.getState().locale || getLocale(); + const fullOptions = Object.assign(Object.assign({}, options), { dateStyle: undefined }); + let formattedTime; + try { + formattedTime = formatDateTime$1(date, locale, fullOptions); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + return formattedTime; +}; +var formatTime$1 = withErrorBoundary(formatTime); + +/** + * Gets the first day of the week for a given locale. + * + * @param locale The locale to determine the first day of the week for. + * @returns The first day of the week (0-6, where 0 is Sunday). + */ +const getFirstDayOfWeek = (locale) => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) + locale = state.getState().locale || getLocale(); + let formatted; + try { + const formatter = new Intl.DateTimeFormat(locale, { weekday: 'short' }); + const sampleDate = new Date(2000, 0, 2); // A Sunday + formatted = formatter.format(sampleDate); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + return ['su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'].indexOf(formatted.slice(0, 2).toLowerCase()); +}; +var getFirstDayOfWeek$1 = withErrorBoundary(getFirstDayOfWeek); + +/** + * Determines the quarter of the year for a given date. + * + * @param date The date to determine the quarter for. + * @returns The quarter of the year (1-4). + */ +const getQuarter = (date) => { + return Math.ceil((date.getMonth() + 1) / 3); +}; +var getQuarter$1 = withErrorBoundary(getQuarter); + +/** + * Provides a relative time string (e.g., '3 hours ago', 'in 2 days'). + * This function calculates the difference between the given date and the base date, + * then formats it in a locale-sensitive manner. It allows customization of the output + * through Intl.RelativeTimeFormat options. + * + * @param date - The date to compare. + * @param baseDate - The date to compare against (default: current date). + * @param locale - The locale to use for formatting. + * @param options - Options for the Intl.RelativeTimeFormat (optional). + * @returns The relative time as a string. + */ +const getRelativeTime = (date, baseDate = new Date(), locale, options) => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) + locale = state.getState().locale || getLocale(); + const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000; + // Define time units in seconds + const minute = 60; + const hour = minute * 60; + const day = hour * 24; + const week = day * 7; + const month = day * 30; + const year = day * 365; + let value; + let unit; + if (Math.abs(diffInSeconds) < minute) { + value = diffInSeconds; + unit = 'second'; + } + else if (Math.abs(diffInSeconds) < hour) { + value = diffInSeconds / minute; + unit = 'minute'; + } + else if (Math.abs(diffInSeconds) < day) { + value = diffInSeconds / hour; + unit = 'hour'; + } + else if (Math.abs(diffInSeconds) < week) { + value = diffInSeconds / day; + unit = 'day'; + } + else if (Math.abs(diffInSeconds) < month) { + value = diffInSeconds / week; + unit = 'week'; + } + else if (Math.abs(diffInSeconds) < year) { + value = diffInSeconds / month; + unit = 'month'; + } + else { + value = diffInSeconds / year; + unit = 'year'; + } + let relativeTime; + try { + const rtf = new Intl.RelativeTimeFormat(locale, options); + relativeTime = rtf.format(Math.round(value), unit); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + return relativeTime; +}; +var getRelativeTime$1 = withErrorBoundary(getRelativeTime); + +/** + * Calculates the week number of the year for a given date. + * + * @param date The date to calculate the week number for. + * @returns The week number of the year. + */ +const getWeek = (date) => { + const firstDayOfYear = new Date(date.getFullYear(), 0, 1); + const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000; + return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7); +}; +var getWeek$1 = withErrorBoundary(getWeek); + +/** + * Returns an array of weekdays according to the specified locale. + * + * @param locale The locale to get weekdays for. + * @returns An array of weekday names. + */ +const getWeekdays = (locale) => { + try { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) + locale = state.getState().locale || getLocale(); + const formatter = new Intl.DateTimeFormat(locale, { weekday: 'long' }); + return Array.from({ length: 7 }, (_, i) => formatter.format(new Date(1970, 0, 4 + i))); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } +}; +var getWeekdays$1 = withErrorBoundary(getWeekdays); + +/** + * Compares two dates to determine if the first is after the second. + * @param {DateInput} date1 - First date object or date string. + * @param {DateInput} date2 - Second date object or date string. + * @returns {boolean} True if date1 is after date2. + */ +const isAfter = (date1, date2) => { + const dateObj1 = date1 instanceof Date ? date1 : new Date(date1); + const dateObj2 = date2 instanceof Date ? date2 : new Date(date2); + return dateObj1 > dateObj2; +}; +var isAfter$1 = withErrorBoundary(isAfter); + +/** + * Compares two dates to determine if the first is before the second. + * @param {DateInput} date1 - First date object or date string. + * @param {DateInput} date2 - Second date object or date string. + * @returns {boolean} True if date1 is before date2. + */ +const isBefore = (date1, date2) => { + const dateObj1 = date1 instanceof Date ? date1 : new Date(date1); + const dateObj2 = date2 instanceof Date ? date2 : new Date(date2); + return dateObj1 < dateObj2; +}; +var isBefore$1 = withErrorBoundary(isBefore); + +/** + * Checks if a given year is a leap year. + * + * @param year The year to check. + * @returns True if the year is a leap year, false otherwise. + */ +const isLeapYear = (year) => { + return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; +}; +var isLeapYear$1 = withErrorBoundary(isLeapYear); + +/** + * Checks if two dates fall on the same day. + * + * @param date1 The first date. + * @param date2 The second date. + * @returns True if both dates are on the same day, false otherwise. + */ +const isSameDay = (date1, date2) => { + return (date1.getDate() === date2.getDate() && + date1.getMonth() === date2.getMonth() && + date1.getFullYear() === date2.getFullYear()); +}; +var isSameDay$1 = withErrorBoundary(isSameDay); + +/** + * Checks if a given object is a valid Date object. + * + * @param date The object to check. + * @returns True if the object is a valid Date, false otherwise. + */ +const isValidDate = (date) => { + return date instanceof Date && !isNaN(date.getTime()); +}; +var isValidDate$1 = withErrorBoundary(isValidDate); + +const LOCALE_DATE_FORMATS = { + 'ar-AE': 'DD/MM/YYYY', + 'sq-AL': 'DD.MM.YYYY', + 'hy-AM': 'DD.MM.YYYY', + 'es-AR': 'DD/MM/YYYY', + 'en-AU': 'DD/MM/YYYY', + 'nl-AW': 'DD-MM-YYYY', + 'en-BB': 'MM/DD/YYYY', + 'bn-BD': 'DD/MM/YYYY', + 'en-BM': 'MM/DD/YYYY', + 'ms-BN': 'DD/MM/YYYY', + 'es-BO': 'DD/MM/YYYY', + 'en-BS': 'MM/DD/YYYY', + 'en-BW': 'DD/MM/YYYY', + 'en-BZ': 'MM/DD/YYYY', + 'en-CA': 'DD/MM/YYYY', + 'de-CH': 'DD.MM.YYYY', + 'zh-CN': 'YYYY/MM/DD', + 'es-CO': 'DD/MM/YYYY', + 'es-CR': 'DD/MM/YYYY', + 'es-CU': 'DD/MM/YYYY', + 'cs-CZ': 'DD.MM.YYYY', + 'da-DK': 'DD-MM-YYYY', + 'es-DO': 'DD/MM/YYYY', + 'ar-DZ': 'DD/MM/YYYY', + 'ar-EG': 'DD/MM/YYYY', + 'am-ET': 'DD/MM/YYYY', + 'en-EU': 'DD/MM/YYYY', + 'en-FJ': 'DD/MM/YYYY', + 'en-GB': 'DD/MM/YYYY', + 'en-GH': 'DD/MM/YYYY', + 'en-GI': 'DD/MM/YYYY', + 'en-GM': 'DD/MM/YYYY', + 'es-GT': 'DD/MM/YYYY', + 'en-GY': 'DD/MM/YYYY', + 'en-HK': 'DD/MM/YYYY', + 'es-HN': 'DD/MM/YYYY', + 'hr-HR': 'DD.MM.YYYY', + 'ht-HT': 'MM/DD/YYYY', + 'hu-HU': 'YYYY. MM. DD.', + 'id-ID': 'DD/MM/YYYY', + 'he-IL': 'DD/MM/YYYY', + 'en-IN': 'DD-MM-YYYY', + 'en-JM': 'MM/DD/YYYY', + 'en-KE': 'DD/MM/YYYY', + 'ky-KG': 'DD.MM.YYYY', + 'km-KH': 'DD/MM/YYYY', + 'en-KY': 'MM/DD/YYYY', + 'kk-KZ': 'DD.MM.YYYY', + 'lo-LA': 'DD/MM/YYYY', + 'si-LK': 'YYYY-MM-DD', + 'en-LR': 'MM/DD/YYYY', + 'en-LS': 'DD/MM/YYYY', + 'ar-MA': 'DD/MM/YYYY', + 'ro-MD': 'DD.MM.YYYY', + 'mk-MK': 'DD.MM.YYYY', + 'my-MM': 'DD/MM/YYYY', + 'mn-MN': 'YYYY.MM.DD', + 'zh-MO': 'DD/MM/YYYY', + 'en-MU': 'DD/MM/YYYY', + 'dv-MV': 'DD/MM/YYYY', + 'en-MW': 'DD/MM/YYYY', + 'es-MX': 'DD/MM/YYYY', + 'ms-MY': 'DD/MM/YYYY', + 'en-NA': 'DD/MM/YYYY', + 'en-NG': 'DD/MM/YYYY', + 'es-NI': 'DD/MM/YYYY', + 'no-NO': 'DD.MM.YYYY', + 'ne-NP': 'YYYY/MM/DD', + 'en-NZ': 'DD/MM/YYYY', + 'es-PE': 'DD/MM/YYYY', + 'en-PG': 'DD/MM/YYYY', + 'en-PH': 'MM/DD/YYYY', + 'en-PK': 'DD/MM/YYYY', + 'ar-QA': 'DD/MM/YYYY', + 'ru-RU': 'DD.MM.YYYY', + 'ar-SA': 'DD/MM/YYYY', + 'en-SC': 'DD/MM/YYYY', + 'sv-SE': 'YYYY-MM-DD', + 'en-SG': 'DD/MM/YYYY', + 'en-SL': 'DD/MM/YYYY', + 'so-SO': 'DD/MM/YYYY', + 'en-SS': 'DD/MM/YYYY', + 'es-SV': 'DD/MM/YYYY', + 'en-SZ': 'DD/MM/YYYY', + 'th-TH': 'DD/MM/YYYY', + 'en-TT': 'MM/DD/YYYY', + 'sw-TZ': 'DD/MM/YYYY', + 'en-US': 'MM/DD/YYYY', + 'es-UY': 'DD/MM/YYYY', + 'uz-UZ': 'DD/MM/YYYY', + 'ar-YE': 'DD/MM/YYYY', + 'en-ZA': 'YYYY/MM/DD', + 'ar-KW': 'DD/MM/YYYY', + 'ar-BH': 'DD/MM/YYYY', + 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman) +}; + +/** + * Parses a date string based on a specific format. + * + * @param dateString The date string to parse. + * @param format The format to use for parsing. + * @returns The parsed Date object or null if parsing fails. + */ +const parseDateWithFormat = (dateString, format) => { + // Determine the separator based on the format (supports '/', '.', or '-') + const separator = format.includes('/') + ? '/' + : format.includes('.') + ? '.' + : '-'; + const formatParts = format.split(separator); + const dateParts = dateString.split(separator).map((num) => parseInt(num, 10)); + let year = 0, month = 0, day = 0; + let yearSet = false, monthSet = false, daySet = false; + // Check for format and date string mismatch + if (dateParts.length !== formatParts.length) { + return null; // Mismatch between date string and format + } + formatParts.forEach((part, index) => { + // Check for non-numeric values in date string + if (isNaN(dateParts[index])) { + return null; // Invalid date part + } + // Assign year, month, and day based on the format + switch (part) { + case 'DD': + day = dateParts[index]; + daySet = true; + break; + case 'MM': + month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date + monthSet = true; + break; + case 'YYYY': + year = dateParts[index]; + yearSet = true; + break; + } + }); + // Validate and create the date only if all parts are set + if (yearSet && monthSet && daySet) { + const parsedDate = new Date(year, month, day); + // Validate date to catch invalid dates like February 30th + if (parsedDate.getFullYear() === year && + parsedDate.getMonth() === month && + parsedDate.getDate() === day) { + return parsedDate; + } + } + return null; // Invalid date or incomplete date information +}; +var parseDateWithFormat$1 = withErrorBoundary(parseDateWithFormat); + +/** + * Attempts to parse a string into a date object based on locale. + * Uses the localeDateFormats mapping for determining the date format. + * + * @param dateString - The date string to parse. + * @param locale - The locale to use for parsing. + * @returns The parsed Date object or null if parsing fails. + */ +const parseDate = (dateString, locale) => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) + locale = state.getState().locale || getLocale(); + const format = LOCALE_DATE_FORMATS[locale]; + if (!format) { + throw new Error(`No date format found for locale: ${locale}`); + } + return parseDateWithFormat$1(dateString, format); +}; +var parseDate$1 = withErrorBoundary(parseDate); + +/** + * Subtracts a specified amount of time from a date. + * + * @param date The original date. + * @param value The amount to subtract. + * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years'). + * @returns A new Date object with the time subtracted. + */ +const subtract = (date, value, unit) => { + return add$1(date, -value, unit); // Reuse the add function with negative value +}; +var subtract$1 = withErrorBoundary(subtract); + +export { add$1 as add, formatDate$1 as formatDate, formatDateTime$1 as formatDateTime, formatNumber$1 as formatNumber, formatNumberByParts$1 as formatNumberByParts, formatPhoneNumber$1 as formatPhoneNumber, formatTime$1 as formatTime, getCurrencyList$1 as getCurrencyList, getCurrencySymbol$1 as getCurrencySymbol, getFirstDayOfWeek$1 as getFirstDayOfWeek, getQuarter$1 as getQuarter, getRelativeTime$1 as getRelativeTime, getState$1 as getState, getWeek$1 as getWeek, getWeekdays$1 as getWeekdays, isAfter$1 as isAfter, isBefore$1 as isBefore, isLeapYear$1 as isLeapYear, isSameDay$1 as isSameDay, isValidDate$1 as isValidDate, isValidPhoneNumber$1 as isValidPhoneNumber, parseDate$1 as parseDate, parsePhoneNumber$1 as parsePhoneNumber, resetState$1 as resetState, setState$1 as setState, subtract$1 as subtract }; +//# sourceMappingURL=index.js.map diff --git a/lib/esm/index.js.map b/lib/esm/index.js.map new file mode 100644 index 00000000..84bb68f9 --- /dev/null +++ b/lib/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["../../src/common/errorBoundary/index.ts","../../src/modules/.internal/utils/getDefaultState.ts","../../src/modules/.internal/state/index.ts","../../src/modules/core/getState.ts","../../src/modules/core/setState.ts","../../src/modules/core/resetState.ts","../../src/modules/.internal/utils/getLocale.ts","../../src/modules/.internal/utils/getIntlInstanceWithOptions.ts","../../src/modules/currency/formatNumber.ts","../../src/modules/currency/data/currencies.ts","../../src/modules/currency/getCurrencyList.ts","../../src/modules/currency/getCurrencySymbol.ts","../../src/modules/currency/constants.ts","../../src/modules/currency/formatNumberByParts.ts","../../src/modules/phoneNumber/data/phoneRegexMapper.ts","../../src/modules/phoneNumber/data/dialCodeMapper.ts","../../src/modules/phoneNumber/utils.ts","../../src/modules/phoneNumber/isValidPhoneNumber.ts","../../src/modules/phoneNumber/data/phoneFormatterMapper.ts","../../src/modules/phoneNumber/formatPhoneNumber.ts","../../src/modules/phoneNumber/parsePhoneNumber.ts","../../src/modules/dateTime/add.ts","../../src/modules/dateTime/formatDateTime.ts","../../src/modules/dateTime/formatDate.ts","../../src/modules/dateTime/formatTime.ts","../../src/modules/dateTime/getFirstDayOfWeek.ts","../../src/modules/dateTime/getQuarter.ts","../../src/modules/dateTime/getRelativeTime.ts","../../src/modules/dateTime/getWeek.ts","../../src/modules/dateTime/getWeekdays.ts","../../src/modules/dateTime/isAfter.ts","../../src/modules/dateTime/isBefore.ts","../../src/modules/dateTime/isLeapYear.ts","../../src/modules/dateTime/isSameDay.ts","../../src/modules/dateTime/isValidDate.ts","../../src/modules/dateTime/data/localeDateFormats.ts","../../src/modules/dateTime/parseDateWithFormat.ts","../../src/modules/dateTime/parseDate.ts","../../src/modules/dateTime/subtract.ts"],"sourcesContent":["// Custom Error class to extend properties to error object\nexport class I18nifyError extends Error {\n timestamp: Date;\n constructor(message: string | undefined) {\n super(message);\n this.name = 'i18nify Error';\n this.timestamp = new Date();\n // more params like type of error/severity can be added in future for better debugging.\n }\n}\n\n/**\n * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block.\n * It appends additional attributes and serves as a centralized error-handling service.\n * Usage =>\n * const wrappedUtilityFn = withErrorBoundary(utilityFn)\n *\n * @param fn utility that is wrapped in error boundary\n * @returns {Function} returns the function wrapped in try/catch block\n */\nexport const withErrorBoundary = any>(\n fn: T,\n): ((...args: Parameters) => ReturnType) => {\n return function (this: unknown, ...rest: Parameters): ReturnType {\n try {\n return fn.call(this, ...rest) as ReturnType;\n } catch (err) {\n console.warn('[I18N Error]: ', err);\n // Currently, we are throwing the error as it is to consumers.\n // In the future, this can be modified as per our requirement, like an error logging service.\n throw new I18nifyError(err as string | undefined);\n }\n };\n};\n","import type { I18nState } from '../state/types';\n\nexport function getDefaultState(): I18nState {\n return {\n locale: '',\n direction: '',\n country: '',\n };\n}\n","import { I18nState } from './types';\nimport { getDefaultState } from '../utils/getDefaultState';\n\nexport class I18nStateManager {\n private static instance: I18nStateManager | undefined;\n private state: I18nState;\n\n private constructor() {\n this.state = getDefaultState();\n }\n\n public static getInstance(): I18nStateManager {\n if (!I18nStateManager.instance) {\n I18nStateManager.instance = new I18nStateManager();\n }\n\n return I18nStateManager.instance;\n }\n\n public static resetInstance(): void {\n I18nStateManager.instance = undefined;\n }\n\n public getState(): I18nState {\n return { ...this.state };\n }\n\n public setState(newState: Partial): void {\n this.state = { ...this.state, ...newState };\n }\n\n public resetState(): void {\n this.state = getDefaultState();\n }\n}\n\nexport default I18nStateManager.getInstance();\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * function to return active i18n state\n *\n * ===== USAGE =====\n * import { getState } from '@razorpay/i18nify-js';\n *\n * console.log(getState())\n *\n * @returns i18n state\n */\nconst getState = (): I18nState => {\n return state.getState();\n};\n\nexport default withErrorBoundary(getState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * Function to set and override the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { setState } from \"@razorpay/i18nify-js\";\n * setState({locale: 'en-US'})\n *\n * @param newState data to set in i18nState instance\n */\nconst setState = (newState: Partial): void => {\n state.setState(newState);\n};\n\nexport default withErrorBoundary(setState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\n\n/**\n * Function to reset the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { resetState } from \"@razorpay/i18nify-js\";\n * resetState()\n *\n * @param newState data to set in i18nState instance\n */\nconst resetState = (): void => {\n state.resetState();\n};\n\nexport default withErrorBoundary(resetState);\n","export const getLocale = (): string => {\n // Check if running in a non-browser environment (e.g., Node.js or older browsers).\n if (typeof navigator === 'undefined') {\n return 'en-IN';\n }\n\n // Check if the browser supports the Intl object and user language preferences.\n if (\n window.Intl &&\n typeof window.Intl === 'object' &&\n (window.navigator.languages || window.navigator.language)\n ) {\n const userLocales = window.navigator.languages || [\n window.navigator.language,\n ];\n return userLocales[0];\n }\n\n // Fallback to a supported locale or the default locale.\n return 'en-IN';\n};\n","import { CURRENCIES } from '../../currency/data/currencies';\nimport state from '../state';\nimport { getLocale } from './getLocale';\n\nexport const getIntlInstanceWithOptions = (\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n) => {\n /** retrieve locale from below areas in order of preference\n * 1. options.locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n let locale = options?.locale || state.getState().locale;\n\n // If a specific locale is provided, use it; otherwise, use the browser's locale\n if (!locale) {\n locale = getLocale();\n }\n\n const intlOptions = options?.intlOptions ? { ...options.intlOptions } : {};\n\n if (options?.currency || intlOptions.currency) {\n intlOptions.style = 'currency';\n intlOptions.currency = (options.currency || intlOptions.currency) as string;\n }\n\n if (!locale) throw new Error('Pass valid locale !');\n\n return new Intl.NumberFormat(locale || undefined, intlOptions);\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\n\n// this function formats number based on different arguments passed\nconst formatNumber = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): string => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n let formattedAmount = '';\n\n try {\n formattedAmount = getIntlInstanceWithOptions(options).format(\n Number(amount),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedAmount;\n};\n\nexport default withErrorBoundary(formatNumber);\n","export const CURRENCIES: { [key: string]: { symbol: string; name: string } } = {\n AED: { symbol: 'د.إ', name: 'United Arab Emirates Dirham' },\n ALL: { symbol: 'Lek', name: 'Albanian Lek' },\n AMD: { symbol: '֏', name: 'Armenian Dram' },\n ARS: { symbol: 'ARS', name: 'Argentine Peso' },\n AUD: { symbol: 'A$', name: 'Australian Dollar' },\n AWG: { symbol: 'Afl.', name: 'Aruban Florin' },\n BBD: { symbol: '$', name: 'Barbadian Dollar' },\n BDT: { symbol: '৳', name: 'Bangladeshi Taka' },\n BMD: { symbol: '$', name: 'Bermudian Dollar' },\n BND: { symbol: 'BND', name: 'Brunei Dollar' },\n BOB: { symbol: 'Bs', name: 'Bolivian Boliviano' },\n BSD: { symbol: 'B$', name: 'Bahamian Dollar' },\n BWP: { symbol: 'P', name: 'Botswanan Pula' },\n BZD: { symbol: 'BZ$', name: 'Belize Dollar' },\n CAD: { symbol: 'C$', name: 'Canadian Dollar' },\n CHF: { symbol: 'CHf', name: 'Swiss Franc' },\n CNY: { symbol: '¥', name: 'Chinese Yuan' },\n COP: { symbol: 'COL$', name: 'Colombian Peso' },\n CRC: { symbol: '₡', name: 'Costa Rican Colón' },\n CUP: { symbol: '$MN', name: 'Cuban Peso' },\n CZK: { symbol: 'Kč', name: 'Czech Koruna' },\n DKK: { symbol: 'DKK', name: 'Danish Krone' },\n DOP: { symbol: 'RD$', name: 'Dominican Peso' },\n DZD: { symbol: 'د.ج', name: 'Algerian Dinar' },\n EGP: { symbol: 'E£', name: 'Egyptian Pound' },\n ETB: { symbol: 'ብር', name: 'Ethiopian Birr' },\n EUR: { symbol: '€', name: 'Euro' },\n FJD: { symbol: 'FJ$', name: 'Fijian Dollar' },\n GBP: { symbol: '£', name: 'British Pound' },\n GHS: { symbol: 'GH₵', name: 'Ghanaian Cedi' },\n GIP: { symbol: 'GIP', name: 'Gibraltar Pound' },\n GMD: { symbol: 'D', name: 'Gambian Dalasi' },\n GTQ: { symbol: 'Q', name: 'Guatemalan Quetzal' },\n GYD: { symbol: 'G$', name: 'Guyanese Dollar' },\n HKD: { symbol: 'HK$', name: 'Hong Kong Dollar' },\n HNL: { symbol: 'HNL', name: 'Honduran Lempira' },\n HRK: { symbol: 'kn', name: 'Croatian Kuna' },\n HTG: { symbol: 'G', name: 'Haitian Gourde' },\n HUF: { symbol: 'Ft', name: 'Hungarian Forint' },\n IDR: { symbol: 'Rp', name: 'Indonesian Rupiah' },\n ILS: { symbol: '₪', name: 'Israeli New Shekel' },\n INR: { symbol: '₹', name: 'Indian Rupee' },\n JMD: { symbol: 'J$', name: 'Jamaican Dollar' },\n KES: { symbol: 'Ksh', name: 'Kenyan Shilling' },\n KGS: { symbol: 'Лв', name: 'Kyrgystani Som' },\n KHR: { symbol: '៛', name: 'Cambodian Riel' },\n KYD: { symbol: 'CI$', name: 'Cayman Islands Dollar' },\n KZT: { symbol: '₸', name: 'Kazakhstani Tenge' },\n LAK: { symbol: '₭', name: 'Laotian Kip' },\n LKR: { symbol: 'රු', name: 'Sri Lankan Rupee' },\n LRD: { symbol: 'L$', name: 'Liberian Dollar' },\n LSL: { symbol: 'LSL', name: 'Lesotho Loti' },\n MAD: { symbol: 'د.م.', name: 'Moroccan Dirham' },\n MDL: { symbol: 'MDL', name: 'Moldovan Leu' },\n MKD: { symbol: 'ден', name: 'Macedonian Denar' },\n MMK: { symbol: 'MMK', name: 'Myanmar Kyat' },\n MNT: { symbol: '₮', name: 'Mongolian Tugrik' },\n MOP: { symbol: 'MOP$', name: 'Macanese Pataca' },\n MUR: { symbol: '₨', name: 'Mauritian Rupee' },\n MVR: { symbol: 'Rf', name: 'Maldivian Rufiyaa' },\n MWK: { symbol: 'MK', name: 'Malawian Kwacha' },\n MXN: { symbol: 'Mex$', name: 'Mexican Peso' },\n MYR: { symbol: 'RM', name: 'Malaysian Ringgit' },\n NAD: { symbol: 'N$', name: 'Namibian Dollar' },\n NGN: { symbol: '₦', name: 'Nigerian Naira' },\n NIO: { symbol: 'NIO', name: 'Nicaraguan Córdoba' },\n NOK: { symbol: 'NOK', name: 'Norwegian Krone' },\n NPR: { symbol: 'रू', name: 'Nepalese Rupee' },\n NZD: { symbol: 'NZ$', name: 'New Zealand Dollar' },\n PEN: { symbol: 'S/', name: 'Peruvian Nuevo Sol' },\n PGK: { symbol: 'PGK', name: 'Papua New Guinean Kina' },\n PHP: { symbol: '₱', name: 'Philippine Peso' },\n PKR: { symbol: '₨', name: 'Pakistani Rupee' },\n QAR: { symbol: 'QR', name: 'Qatari Riyal' },\n RUB: { symbol: '₽', name: 'Russian Ruble' },\n SAR: { symbol: 'SR', name: 'Saudi Riyal' },\n SCR: { symbol: 'SRe', name: 'Seychellois Rupee' },\n SEK: { symbol: 'SEK', name: 'Swedish Krona' },\n SGD: { symbol: 'S$', name: 'Singapore Dollar' },\n SLL: { symbol: 'Le', name: 'Sierra Leonean Leone' },\n SOS: { symbol: 'Sh.so.', name: 'Somali Shilling' },\n SSP: { symbol: 'SS£', name: 'South Sudanese Pound' },\n SVC: { symbol: '₡', name: 'Salvadoran Colón' },\n SZL: { symbol: 'E', name: 'Swazi Lilangeni' },\n THB: { symbol: '฿', name: 'Thai Baht' },\n TTD: { symbol: 'TT$', name: 'Trinidad and Tobago Dollar' },\n TZS: { symbol: 'Sh', name: 'Tanzanian Shilling' },\n USD: { symbol: '$', name: 'United States Dollar' },\n UYU: { symbol: '$U', name: 'Uruguayan Peso' },\n UZS: { symbol: \"so'm\", name: 'Uzbekistani Som' },\n YER: { symbol: '﷼', name: 'Yemeni Rial' },\n ZAR: { symbol: 'R', name: 'South African Rand' },\n KWD: { symbol: 'د.ك', name: 'Kuwaiti Dinar' },\n BHD: { symbol: 'د.ب.', name: 'Bahraini Dinar' },\n OMR: { symbol: 'ر.ع.', name: 'Omani Rial' },\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencyList = () => {\n return CURRENCIES;\n};\n\nexport default withErrorBoundary(getCurrencyList);\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencySymbol = (currencyCode: keyof typeof CURRENCIES): string => {\n if (currencyCode in CURRENCIES) return CURRENCIES[currencyCode]?.symbol;\n else throw new Error('Invalid currencyCode!');\n};\n\nexport default withErrorBoundary(getCurrencySymbol);\n","export const ALLOWED_FORMAT_PARTS_KEYS = [\n 'nan',\n 'infinity',\n 'percent',\n 'integer',\n 'group',\n 'decimal',\n 'fraction',\n 'plusSign',\n 'minusSign',\n 'percentSign',\n 'currency',\n 'code',\n 'symbol',\n 'name',\n 'compact',\n 'exponentInteger',\n 'exponentMinusSign',\n 'exponentSeparator',\n 'unit',\n] as const;\n","import { CURRENCIES } from './data/currencies';\nimport { ByParts, FormattedPartsObject } from './types';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\nimport { ALLOWED_FORMAT_PARTS_KEYS } from './constants';\n\nconst formatNumberByParts = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): ByParts => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n try {\n const formattedAmount = getIntlInstanceWithOptions(options).formatToParts(\n Number(amount),\n );\n\n const parts = formattedAmount;\n\n const formattedObj: FormattedPartsObject = {};\n\n parts.forEach((p) => {\n if (p.type === 'group') {\n formattedObj.integer = (formattedObj.integer || '') + p.value;\n } else if (\n ALLOWED_FORMAT_PARTS_KEYS.findIndex((item) => item === p.type) != -1\n ) {\n // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal' is skipped\n formattedObj[p.type] = (formattedObj[p.type] || '') + p.value;\n }\n });\n\n return {\n ...formattedObj,\n isPrefixSymbol: parts[0].type === 'currency',\n rawParts: parts,\n };\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(\n formatNumberByParts,\n);\n","export const PHONE_REGEX_MAPPER: { [key: string]: RegExp } = {\n IN: /^(?:(?:\\+|0{0,2})91\\s*[-]?\\s*|[0]?)?[6789]\\d{9}$/,\n MY: /^(\\+?6?0)?(\\d{1,3})[-. ]?(\\d{7,8})$/,\n AE: /^(?:\\+?971|0)?(?:2|3|4|6|7|9)\\d{8}$/,\n AL: /^(?:\\+?355)?(?:[4-9]\\d{7}|6\\d{8})$/,\n AM: /^(?:\\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/,\n AR: /^(?:(?:\\+|0{0,2})54)?(?:11|[2368]\\d)(?:(?=\\d{0,2}15)\\d{2})??\\d{8}$/,\n AU: /^(?:\\+?61|0)4\\d{8}$/,\n AW: /^(?:(?:\\+297)?(?!0)\\d{7})$/,\n BB: /^(?:(?:\\+1)?246)?(?:\\d{3})?\\d{7}$/,\n BD: /^(?:\\+?880|0)1[13456789]\\d{8}$/,\n BM: /^(?:(?:\\+1)?441)?(?:\\d{2})?\\d{7}$/,\n BN: /^(?:\\+?673)?(?:\\d{3})?\\d{4}$/,\n BO: /^(?:(?:\\+|0{0,2})591)?(?:(?:2|3|7|6)\\d{7})$/,\n BS: /^(?:(?:\\+1)?242)?(?:\\d{3})?\\d{7}$/,\n BW: /^(?:(?:\\+267)?\\s?)?[74]\\d{7}$/,\n BZ: /^(?:(?:\\+501)?\\s?)?[622]\\d{4}$/,\n CH: /^(?:(?:\\+41|0)(?:\\s*\\(?0\\)?\\s*))?(?:\\d{2}\\s*)?\\d{3}\\s*\\d{2}\\s*\\d{2}$/,\n CN: /^(?:(?:\\+|00)86)?1\\d{10}$/,\n CO: /^(?:(?:\\+57|0057)?)?[1-8]{1}\\d{6,7}$/,\n OM: /^(?:\\+?968)?(?:95|96|97|98)\\d{6}$/,\n CR: /^(?:(?:\\+506)?\\s*|0)?[1-9]\\d{7}$/,\n CU: /^(?:\\+?53)?(?:[5-8]\\d{7})$/,\n CZ: /^(?:\\+?420)?(?:\\d{9})$/,\n DK: /^(?:\\+?45)?(?:\\d{8})$/,\n DO: /^(?:(?:\\+1)?809|1-8(?:00|88|89))(?:\\d{7})$/,\n DZ: /^(?:\\+?213|0)([567]\\d{8})$/,\n EG: /^(?:(?:\\+20|20)?(\\d{10}))$/,\n ET: /^(?:\\+?251)?[1-59]\\d{8}$/,\n EU: /^(?:(?:\\+?3)?8)?\\s*(?:\\d{3}\\s*){3}\\d{2}$/,\n FJ: /^(?:(?:\\+?679)?\\s?\\d{3}\\s?\\d{4})?$/,\n GB: /^(?:(?:\\+44\\s?|0)7\\d{3}(\\s?\\d{4,})?)$/,\n GH: /^(?:(?:\\+233)|0)?(?:\\d{9})$/,\n GI: /^(?:\\+350)?\\d{5}$/,\n GM: /^(?:\\+220)?\\d{5,7}$/,\n GT: /^(?:\\+502)?[2468]\\d{7,8}$/,\n GY: /^(?:(?:\\+592)?(?:(?:\\s)?[2-9])(?:(?:\\s)?\\d))?(?:(?:\\s)?\\d{4})$/,\n HK: /^(?:\\+852\\s?)?[456789]\\d{3}\\s?\\d{4}$/,\n HN: /^(?:\\+504)?[89]\\d{7}$/,\n HR: /^(?:\\+?385)?\\d{8,9}$/,\n HT: /^(?:\\+?509)?\\d{8}$/,\n HU: /^(?:(?:\\+36))(\\s?\\d{2}\\s?\\d{3}\\s?\\d{4})$/,\n ID: /^(?:\\+?62|0[1-9])[\\s-]?\\d{2,4}[\\s-]?\\d{3,4}[\\s-]?\\d{3,4}$/,\n IL: /^(?:(?:\\+972|0)(?:-)?)[23489]\\d{7}$/,\n JM: /^(?:(?:\\+1876))\\d{7,10}$/,\n KE: /^(?:(?:\\+254)|(?:0))(?:\\d{6,7})$/,\n KG: /^(?:\\+996)?\\s?\\d{9}$/,\n KH: /^(?:(?:\\+855)|(?:0))(?:\\s?[1-9]\\d{7,8})$/,\n KY: /^(?:\\+?1\\s?(345))\\d{6}$/,\n KZ: /^(?:\\+?7|8)?7\\d{9}$/,\n LA: /^(?:(?:\\+?856)|0)(20\\d{7,9})$/,\n LK: /^(?:(?:\\+94)|0)(?:\\d{9})$/,\n LR: /^(?:\\+231)[ -\\d]{4}[ -\\d]{4}$/,\n LS: /^(?:(?:\\+?266)|0)?[56]\\d{7}$/,\n MA: /^(?:(?:\\+?212(\\s*[-|\\s*]?\\d{1,9})?)|(?:0))(?:\\d{9})$/,\n MD: /^(?:(?:\\+373)|(?:0))(?:\\d{7,8})$/,\n MK: /^(?:\\+389|0)(?:(?:2[0-4]|[3-9])\\s?)?\\d{6}$/,\n MM: /^(?:(?:\\+?95)|0)?[1-9]\\d{9}$/,\n MN: /^(?:\\+976|0)\\d{8}$/,\n MO: /^(?:(?:\\+?853)|[0-9])?\\d{8}$/,\n MU: /^(?:\\+230|0)?\\d{8}$/,\n MV: /^(?:(?:\\+?960)|0)?\\d{7}$/,\n MW: /^(?:\\+265)[1-9]\\d{6}$/,\n MX: /^(?:(?:\\+?52)?\\s?(?:1|01)?\\s?)?(?:\\d{3}\\s?\\d{3}\\s?\\d{4})$/,\n NA: /^(?:(?:\\+264)|0)?\\d{8}$/,\n NG: /^(?:(?:\\+234)|(?:0))(?:\\d{7,8})$/,\n NI: /^(?:(?:\\+505))?(?:\\d{8})$/,\n NO: /^(?:(?:\\+?47)|\\d{2}|\\d{3})\\s?\\d{2}\\s?\\d{3}$/,\n NP: /^(?:(?:\\+977))?(\\d{9,10})$/,\n NZ: /^(?:\\+?64|0)(\\d{2,5} \\d{4,8}|\\d{3,4} \\d{4})$/,\n PE: /^(?:(?:\\+51)|0)?(?:9\\d{8})$/,\n PG: /^(?:\\+?675)?(?:[7-9]\\d{7})$/,\n PH: /^(?:(?:\\+?63)|0)(?:\\d{10})$/,\n PK: /^(?:(?:\\+92)|0)?[345]\\d{9}$/,\n QA: /^(?:\\+?974)?-?33\\d{5}$/,\n RU: /^(?:\\+?7|8)?[ -]?\\(?9\\d{2}\\)?[ -]?\\d{3}[ -]?\\d{2}[ -]?\\d{2}$/,\n SA: /^(?:\\+?966)?\\s?1?[\\s-]?(?:[45]\\d{2}|5\\d{3})[\\s-]?\\d{4}$/,\n SC: /^(?:(?:\\+248)|\\d{4})\\d{5}$/,\n SE: /^(?:\\+?46|0)\\s?[1-57-9](?:[0-9]\\s?){8}$/,\n SG: /^(?:(?:\\+65)|(?:\\(\\+65\\))|(?:65))\\d{4}\\d{4}$/,\n SL: /^(?:(?:\\+232)|(?:0))?\\d{9}$/,\n SO: /^(?:\\+252|0)?[567]\\d{7}$/,\n SS: /^(?:\\+211|0)?[1-9]\\d{7,9}$/,\n SV: /^(?:(?:\\+?503)|(?:0))(?:\\d{8})$/,\n SZ: /^(?:\\+?268)?\\d{7,8}$/,\n TH: /^(?:(?:\\+66)|0)\\d{9}$/,\n TT: /^(?:(?:\\+?1-868)|\\(?868\\)?)(\\d{7})$/,\n TZ: /^(?:(?:\\+?255)|0)?[67]\\d{8}$/,\n US: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n CA: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n UY: /^(?:(?:\\+598|0)\\s?(9\\d{3}|2\\d{2}|[4-9]\\d{6}))$/,\n UZ: /^(?:\\+?998)?\\s?[3456789]\\d{8}$/,\n YE: /^(?:\\+?967)?(?:\\d{7,8})$/,\n ZA: /^(?:(?:\\+27)|0)(\\d{9})$/,\n KW: /^(?:\\+?965)[569]\\d{7}$/,\n BH: /^(?:\\+?973)?[356]\\d{7}$/,\n TL: /^(?:(?:\\+670)\\s?)?[0-9]{3}\\s?[0-9]{3,4}$/,\n VC: /^(?:(?:\\+1)?784)?(?:\\d{3})?\\d{7}$/,\n VE: /^(?:(?:\\+58)|0)?4\\d{9}$/,\n VN: /^(?:(?:\\+84)|0)?[1-9]\\d{8}$/,\n ZM: /^(?:(?:\\+260)|0)?[123456789]\\d{8,9}$/,\n ZW: /^(?:(?:\\+263)|0)?(?:\\d{9,10})$/,\n LT: /^(?:(?:\\+370)|8)\\d{8}$/,\n LU: /^(?:(?:\\+352)?(6|2(6|7|8|9))\\d{6})$/,\n LV: /^(?:(?:\\+371)?2\\d{7})$/,\n ME: /^(?:(?:\\+382)?[67]\\d{7,20})$/,\n MG: /^(?:(?:\\+261)?3[234568]\\d{7})$/,\n MZ: /^(?:(?:\\+258)|(?:258))?8[234567]\\d{7,8}$/,\n NL: /^(?:(?:\\+31)|0(6(?:\\d{8})|[1-9](?:(?:\\d{8})|(?:\\s\\d{3}\\s\\d{4}))|(?:\\d{8})))$/,\n PA: /^(?:(?:\\+507)\\s?)?[46]\\d{6,7}$/,\n PL: /^(?:(?:\\+48)?(?:\\s?\\d{3}\\s?\\d{3}\\s?\\d{3}|(?:\\d{2}\\s?){4}\\d{2}|\\d{3}-\\d{3}-\\d{3}))$/,\n PR: /^(?:(?:\\+1)?787|939)\\d{7}$/,\n PS: /^(?:(?:\\+970))(5[2349])\\d{7}$/,\n PT: /^(?:(?:\\+351)?9(1\\d|2[1-9]|6[12345789]|7[12345789])\\d{7})$/,\n PY: /^(?:(?:\\+595|0)9[9876]\\d{7})$/,\n RO: /^(?:(?:\\+40|0))(?:7[2-8]\\d{7}|21\\d{8})$/,\n RS: /^(?:(?:\\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/,\n RW: /^(?:(?:\\+250)|(0))\\d{9}$/,\n SI: /^(?:(?:\\+386)|0)?[1-59]\\d{7,8}$/,\n SK: /^(?:(?:\\+421))?(0|9[0-8])\\d{8}$/,\n SM: /^(?:(?:\\+378)|(0549|6\\d{4}))\\d{5}$/,\n SN: /^(?:(?:\\+221)|0)?[3679]\\d{7}$/,\n SR: /^(?:(?:\\+597))\\d{7}$/,\n TG: /^(?:(?:\\+228))\\d{8}$/,\n TJ: /^(?:(?:\\+992))(37|55|77)\\d{7}$/,\n TN: /^(?:(?:\\+216)|22|9[1-9])\\d{7}$/,\n TR: /^(?:(?:\\+90)|(0))\\s?5\\d{9}$/,\n TW: /^(?:(?:\\+886)|0)?9\\d{8}$/,\n UA: /^(?:(?:\\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\\d{7}$/,\n UG: /^(?:(?:\\+256)|0)?[39]\\d{8}$/,\n};\n","/* Source: Google LibPhoneNumber Metadata: https://github.com/google/libphonenumber/blob/master/javascript/i18n/phonenumbers/metadata.js */\n\nexport const DIAL_CODE_MAPPER: { [key: number]: string[] } = {\n 1: [\n 'US',\n 'AG',\n 'AI',\n 'AS',\n 'BB',\n 'BM',\n 'BS',\n 'CA',\n 'DM',\n 'DO',\n 'GD',\n 'GU',\n 'JM',\n 'KN',\n 'KY',\n 'LC',\n 'MP',\n 'MS',\n 'PR',\n 'SX',\n 'TC',\n 'TT',\n 'VC',\n 'VG',\n 'VI',\n ],\n 7: ['RU', 'KZ'],\n 20: ['EG'],\n 27: ['ZA'],\n 30: ['GR'],\n 31: ['NL'],\n 32: ['BE'],\n 33: ['FR'],\n 34: ['ES'],\n 36: ['HU'],\n 39: ['IT', 'VA'],\n 40: ['RO'],\n 41: ['CH'],\n 43: ['AT'],\n 44: ['GB', 'GG', 'IM', 'JE'],\n 45: ['DK'],\n 46: ['SE'],\n 47: ['NO', 'SJ'],\n 48: ['PL'],\n 49: ['DE'],\n 51: ['PE'],\n 52: ['MX'],\n 53: ['CU'],\n 54: ['AR'],\n 55: ['BR'],\n 56: ['CL'],\n 57: ['CO'],\n 58: ['VE'],\n 60: ['MY'],\n 61: ['AU', 'CC', 'CX'],\n 62: ['ID'],\n 63: ['PH'],\n 64: ['NZ'],\n 65: ['SG'],\n 66: ['TH'],\n 81: ['JP'],\n 82: ['KR'],\n 84: ['VN'],\n 86: ['CN'],\n 90: ['TR'],\n 91: ['IN'],\n 92: ['PK'],\n 93: ['AF'],\n 94: ['LK'],\n 95: ['MM'],\n 98: ['IR'],\n 211: ['SS'],\n 212: ['MA', 'EH'],\n 213: ['DZ'],\n 216: ['TN'],\n 218: ['LY'],\n 220: ['GM'],\n 221: ['SN'],\n 222: ['MR'],\n 223: ['ML'],\n 224: ['GN'],\n 225: ['CI'],\n 226: ['BF'],\n 227: ['NE'],\n 228: ['TG'],\n 229: ['BJ'],\n 230: ['MU'],\n 231: ['LR'],\n 232: ['SL'],\n 233: ['GH'],\n 234: ['NG'],\n 235: ['TD'],\n 236: ['CF'],\n 237: ['CM'],\n 238: ['CV'],\n 239: ['ST'],\n 240: ['GQ'],\n 241: ['GA'],\n 242: ['CG'],\n 243: ['CD'],\n 244: ['AO'],\n 245: ['GW'],\n 246: ['IO'],\n 247: ['AC'],\n 248: ['SC'],\n 249: ['SD'],\n 250: ['RW'],\n 251: ['ET'],\n 252: ['SO'],\n 253: ['DJ'],\n 254: ['KE'],\n 255: ['TZ'],\n 256: ['UG'],\n 257: ['BI'],\n 258: ['MZ'],\n 260: ['ZM'],\n 261: ['MG'],\n 262: ['RE', 'YT'],\n 263: ['ZW'],\n 264: ['NA'],\n 265: ['MW'],\n 266: ['LS'],\n 267: ['BW'],\n 268: ['SZ'],\n 269: ['KM'],\n 290: ['SH', 'TA'],\n 291: ['ER'],\n 297: ['AW'],\n 298: ['FO'],\n 299: ['GL'],\n 350: ['GI'],\n 351: ['PT'],\n 352: ['LU'],\n 353: ['IE'],\n 354: ['IS'],\n 355: ['AL'],\n 356: ['MT'],\n 357: ['CY'],\n 358: ['FI', 'AX'],\n 359: ['BG'],\n 370: ['LT'],\n 371: ['LV'],\n 372: ['EE'],\n 373: ['MD'],\n 374: ['AM'],\n 375: ['BY'],\n 376: ['AD'],\n 377: ['MC'],\n 378: ['SM'],\n 380: ['UA'],\n 381: ['RS'],\n 382: ['ME'],\n 383: ['XK'],\n 385: ['HR'],\n 386: ['SI'],\n 387: ['BA'],\n 389: ['MK'],\n 420: ['CZ'],\n 421: ['SK'],\n 423: ['LI'],\n 500: ['FK'],\n 501: ['BZ'],\n 502: ['GT'],\n 503: ['SV'],\n 504: ['HN'],\n 505: ['NI'],\n 506: ['CR'],\n 507: ['PA'],\n 508: ['PM'],\n 509: ['HT'],\n 590: ['GP', 'BL', 'MF'],\n 591: ['BO'],\n 592: ['GY'],\n 593: ['EC'],\n 594: ['GF'],\n 595: ['PY'],\n 596: ['MQ'],\n 597: ['SR'],\n 598: ['UY'],\n 599: ['CW', 'BQ'],\n 670: ['TL'],\n 672: ['NF'],\n 673: ['BN'],\n 674: ['NR'],\n 675: ['PG'],\n 676: ['TO'],\n 677: ['SB'],\n 678: ['VU'],\n 679: ['FJ'],\n 680: ['PW'],\n 681: ['WF'],\n 682: ['CK'],\n 683: ['NU'],\n 685: ['WS'],\n 686: ['KI'],\n 687: ['NC'],\n 688: ['TV'],\n 689: ['PF'],\n 690: ['TK'],\n 691: ['FM'],\n 692: ['MH'],\n 800: ['001'],\n 808: ['001'],\n 850: ['KP'],\n 852: ['HK'],\n 853: ['MO'],\n 855: ['KH'],\n 856: ['LA'],\n 870: ['001'],\n 878: ['001'],\n 880: ['BD'],\n 881: ['001'],\n 882: ['001'],\n 883: ['001'],\n 886: ['TW'],\n 888: ['001'],\n 960: ['MV'],\n 961: ['LB'],\n 962: ['JO'],\n 963: ['SY'],\n 964: ['IQ'],\n 965: ['KW'],\n 966: ['SA'],\n 967: ['YE'],\n 968: ['OM'],\n 970: ['PS'],\n 971: ['AE'],\n 972: ['IL'],\n 973: ['BH'],\n 974: ['QA'],\n 975: ['BT'],\n 976: ['MN'],\n 977: ['NP'],\n 979: ['001'],\n 992: ['TJ'],\n 993: ['TM'],\n 994: ['AZ'],\n 995: ['GE'],\n 996: ['KG'],\n 998: ['UZ'],\n};\n","import { DIAL_CODE_MAPPER } from './data/dialCodeMapper';\nimport { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\n\n/**\n * Determines the country code based on the provided phone number.\n * This function employs a multi-step approach to identify the country code:\n * - If the phone number starts with '+', it extracts the numeric characters\n * and matches the leading digits with known dial codes mapped to countries.\n * - For matched dial codes, it further filters based on country-specific regex patterns\n * to validate the phone number format for those countries.\n * - If the phone number doesn't start with '+', it directly matches the number\n * against regular expressions associated with various countries to identify the code.\n *\n * @param phoneNumber The input phone number (string or number).\n * @returns The detected country code or an empty string if not found.\n */\nexport const detectCountryCodeFromDialCode = (\n phoneNumber: string | number,\n): string => {\n // If the phone number starts with '+', extract numeric characters\n if (phoneNumber.toString().charAt(0) === '+') {\n const cleanedPhoneNumberWithoutPlusPrefix = phoneNumber\n .toString()\n .replace(/\\D/g, '');\n\n const matchingCountries: string[] = [];\n\n // Iterate through dial codes and check for matches with cleaned phone number\n for (const code in DIAL_CODE_MAPPER) {\n if (cleanedPhoneNumberWithoutPlusPrefix.startsWith(code)) {\n matchingCountries.push(...DIAL_CODE_MAPPER[code]);\n }\n }\n\n // Filter matching countries based on phone number validation regex\n const matchedCountryCode = matchingCountries.find((countryCode: string) => {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex && regex.test(phoneNumber.toString())) return countryCode;\n return undefined;\n });\n\n // Return the first matched country code, if any\n return matchedCountryCode || '';\n } else {\n // If phone number doesn't start with '+', directly match against country regexes\n for (const countryCode in PHONE_REGEX_MAPPER) {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex.test(phoneNumber.toString())) {\n return countryCode;\n }\n }\n }\n\n // Return empty string if no country code is detected\n return '';\n};\n\nexport const cleanPhoneNumber = (phoneNumber: string) => {\n // Regular expression to match all characters except numbers and + sign at the start\n const regex = /[^0-9+]|(?!A)\\+/g;\n // Replace matched characters with an empty string\n const cleanedPhoneNumber = phoneNumber.replace(regex, '');\n return phoneNumber[0] === '+' ? `+${cleanedPhoneNumber}` : cleanedPhoneNumber;\n};\n","import { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Validates whether a given phone number is valid based on the provided country code or auto-detects the country code and checks if the number matches the defined regex pattern for that country.\nconst isValidPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_REGEX_MAPPER,\n): boolean => {\n // Clean the provided phoneNumber by removing non-numeric characters\n const cleanedPhoneNumber = cleanPhoneNumber(phoneNumber.toString());\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_REGEX_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(cleanedPhoneNumber);\n\n // Return false if phoneNumber is empty\n if (!phoneNumber) return false;\n\n // Check if the countryCode exists in the PHONE_REGEX_MAPPER\n if (countryCode in PHONE_REGEX_MAPPER) {\n // Fetch the regex pattern for the countryCode\n const regex = PHONE_REGEX_MAPPER[countryCode];\n // Test if the cleanedPhoneNumber matches the regex pattern\n return regex.test(cleanedPhoneNumber as string);\n }\n\n // Return false if the countryCode is not supported\n return false;\n};\n\nexport default withErrorBoundary(isValidPhoneNumber);\n","export const PHONE_FORMATTER_MAPPER: { [key: string]: string } = {\n IN: 'xxxx xxxxxx',\n MY: 'xx xxxxx xx',\n AE: 'xx xxx xxxx',\n AL: 'xxx xx xxxx',\n AM: 'xx xx xx xx',\n AR: 'xxxx-xxxx',\n AU: 'xxx xxx xxx',\n AW: 'xxx-xxxx',\n BB: 'xxx-xxxx',\n BD: 'xxxx-xxxxxx',\n BM: 'xxx-xxxx',\n BN: 'xxxx-xxxx',\n BO: 'xxxx-xxxx',\n BS: 'xxx-xxxx',\n BW: 'xx xxxx xxxx',\n BZ: 'xxx-xxxx',\n CA: 'xxx-xxx-xxxx',\n CH: 'xxx xxx xxx',\n CN: 'xxxx-xxxxxxx',\n CO: 'xxxx-xxxxxxx',\n CR: 'xxxx-xxxx',\n CU: 'xxxx-xxxx',\n CZ: 'xxx xxx xxx',\n DK: 'xx xx xx xx',\n DO: 'xxx-xxxxxxx',\n DZ: 'xxxx-xxxx-xxx',\n EG: 'xx xxx xxxx',\n ET: 'xx xxx xxxx',\n EU: 'xxx xx xx xx',\n FJ: 'xxxx xxxx',\n GB: 'xxxx xxx xxx',\n GH: 'xxx xxx xxxx',\n GI: 'xxxx xxxx',\n GM: 'xxxx-xxxx',\n GT: 'xxxx-xxxx',\n GY: 'xxx-xxxx',\n HK: 'xxxx xxxx',\n HN: 'xxxx-xxxx',\n HR: 'xxx xxx xxxx',\n HT: 'xxx-xxxx',\n HU: 'xxx xxx xxxx',\n ID: 'xxxx-xxxx-xxxx',\n IL: 'xxxx-xxx-xxx',\n JM: 'xxx-xxxx',\n KE: 'xxx xxxxxx',\n KG: 'xxx-xx-xx-xx',\n KH: 'xxx-xxx-xxx',\n KY: 'xxx-xxxx',\n KZ: 'xxx-xxx-xx-xx',\n LA: 'xxx xx xxxx',\n LK: 'xx xxx xxxx',\n LR: 'xxx-xxx-xxxx',\n LS: 'xxx xx xxxx',\n LT: 'xxx xxxxx',\n LU: 'xxx xx xxx',\n LV: 'xxxx xxxx',\n MA: 'xxxx-xxxxxx',\n MD: 'xx xxxxxx',\n ME: 'xx xxxxxx',\n MG: 'xx xx xx xx xx',\n MK: 'xx xx xx xx',\n MM: 'xx xxxxxx',\n MN: 'xxx-xx-xxxx',\n MO: 'xxxx xxxx',\n MU: 'xx xxxx xxxx',\n MV: 'xxxxxx',\n MW: 'xx xxxx xxxx',\n MX: 'xxx-xxx-xxxx',\n MZ: 'xx xxxxxxx',\n NA: 'xx xxxx xxxx',\n NG: 'xxx xxx xxxx',\n NI: 'xxxx-xxxx',\n NL: 'xxx-xxxxxxx',\n NO: 'xxxx xxxx',\n NP: 'xxxx-xxxxxxx',\n NZ: 'xxx-xxxxxxx',\n OM: 'xxxx-xxxx',\n PA: 'xxx-xxxx',\n PE: 'xxx-xxx-xxx',\n PG: 'xxx-xxxxxx',\n PH: 'xxx-xxxx',\n PK: 'xxx-xxxxxxx',\n PL: 'xxx xxx xxx',\n PR: 'xxx-xxx-xxxx',\n PS: 'xxxx-xxxxxxx',\n PT: 'xxx xxx xxx',\n PY: 'xxx-xxxxxx',\n QA: 'xxxx xxxx',\n RO: 'xxx xxx xxxx',\n RS: 'xxx xxxxx',\n RU: 'xxx xxx-xx-xx',\n RW: 'xxx xxxxxx',\n SA: 'xxx-xxxxxxx',\n SC: 'xx xxxxx',\n SE: 'xxx-xxx xx xx',\n SG: 'xxxx xxxx',\n SI: 'xx xxxxxx',\n SK: 'xxx xxx xxx',\n SL: 'xxx-xxxxxx',\n SM: 'xxxxx xxxxx',\n SN: 'xx xxx xx xx',\n SO: 'xxx xxxxxxx',\n SR: 'xxx-xxxx',\n SS: 'xxx xxxx xxx',\n SV: 'xxxx-xxxx',\n SZ: 'xxx xx xxxx',\n TG: 'xx xx xx xx',\n TH: 'xxx-xxxxxxx',\n TJ: 'xxx xx xx xx',\n TL: 'xxx-xxxxxxx',\n TN: 'xx xxxxxx',\n TR: 'xxx xxx xx xx',\n TT: 'xxx-xxxx',\n TW: 'xxxx-xxxxxx',\n TZ: 'xxx xxx xxxx',\n UA: 'xx xxx xx xx',\n UG: 'xxx xxxxxxx',\n US: 'xxx-xxx-xxxx',\n UY: 'xxx-xxxxx',\n UZ: 'xxx-xxx-xx-xx',\n VC: 'xxx-xxxx',\n VE: 'xxxx-xxx-xxxx',\n VN: 'xxxx-xxxxxxx',\n YE: 'xxxx-xxxx',\n ZA: 'xxx-xxx-xxxx',\n ZM: 'xxx-xxxxxxx',\n ZW: 'xx xxx xxxx',\n KW: 'xxx xx xxxx',\n BH: 'xxxx xxxx',\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Formats a provided phone number according to the predefined format for a specific country code, or auto-detects the country code and formats the number accordingly.\nconst formatPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_FORMATTER_MAPPER,\n): string => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Convert phoneNumber to string and clean it by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_FORMATTER_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Fetch the pattern for the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern) return phoneNumber;\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n // Extract the phoneNumber without the prefix\n const phoneNumberWithoutPrefix = phoneNumber.slice(diff);\n const formattedNumber: string[] = [];\n let numberIndex = 0;\n\n // Loop through the pattern to format the phoneNumber\n for (let i = 0; i < pattern.length; i++) {\n const patternChar = pattern[i];\n if (patternChar === 'x') {\n // Insert phoneNumber digits at 'x' positions\n if (numberIndex < phoneNumberWithoutPrefix.length) {\n formattedNumber.push(phoneNumberWithoutPrefix[numberIndex]);\n numberIndex++;\n }\n } else {\n // Insert non-digit characters from the pattern\n formattedNumber.push(patternChar);\n }\n }\n\n // Join the formattedNumber array to create the formattedPhoneNumber without prefix\n const formattedPhoneNumberWithoutPrefix = formattedNumber.join('');\n // Combine the prefix and formattedPhoneNumberWithoutPrefix\n const formattedPhoneNumberWithPrefix =\n phoneNumber.slice(0, diff) + ' ' + formattedPhoneNumberWithoutPrefix;\n\n // Return the formattedPhoneNumber with prefix after trimming whitespace\n return formattedPhoneNumberWithPrefix.trim();\n};\n\nexport default withErrorBoundary(formatPhoneNumber);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport formatPhoneNumber from './formatPhoneNumber';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\ninterface PhoneInfo {\n countryCode: string;\n dialCode: string;\n formattedPhoneNumber: string;\n formatTemplate: string;\n}\n\n// Parses a given phone number, identifies its country code (if not provided), and returns an object with details including the country code, formatted phone number, dial code, and format template.\nconst parsePhoneNumber = (phoneNumber: string, country?: string): PhoneInfo => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Clean the phoneNumber by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n const countryCode =\n country && country in PHONE_FORMATTER_MAPPER\n ? country\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Format the phone number using the detected/validated country code\n const formattedPhoneNumber = formatPhoneNumber(phoneNumber, countryCode);\n\n // Fetch the pattern associated with the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern)\n return {\n countryCode: countryCode || '',\n dialCode: '',\n formattedPhoneNumber: phoneNumber,\n formatTemplate: '',\n };\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n\n // Extract the dialCode from the phoneNumber\n const dialCode = phoneNumber.slice(0, diff);\n\n // Obtain the format template associated with the countryCode\n const formatTemplate = PHONE_FORMATTER_MAPPER[countryCode];\n\n // Return the parsed phone number information\n return {\n countryCode,\n formattedPhoneNumber,\n dialCode,\n formatTemplate,\n };\n};\n\nexport default withErrorBoundary(parsePhoneNumber);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Adds a specified amount of time to a date.\n *\n * @param date The original date.\n * @param value The amount to add.\n * @param unit The unit of time to add (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time added.\n */\nconst add = (\n date: Date,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n const result = new Date(date);\n switch (unit) {\n case 'days':\n result.setDate(result.getDate() + value);\n break;\n case 'months':\n result.setMonth(result.getMonth() + value);\n break;\n case 'years':\n result.setFullYear(result.getFullYear() + value);\n break;\n }\n return result;\n};\n\nexport default withErrorBoundary(add);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale, DateTimeFormatOptions } from './types';\n\n/**\n * Formats date and time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional).\n * @returns {string} Formatted date and time string.\n */\nconst formatDateTime = (\n date: DateInput,\n locale: Locale,\n options: DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const dateObj: Date = date instanceof Date ? date : new Date(date);\n let formatter;\n\n try {\n formatter = new Intl.DateTimeFormat(locale, options);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formatter.format(dateObj);\n};\n\nexport default withErrorBoundary(formatDateTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n DateFormatOptions,\n} from './types';\n\n/**\n * Formats date based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional).\n * @returns {string} Formatted date string.\n */\nconst formatDate = (\n date: DateInput,\n locale: Locale,\n options: DateFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n timeStyle: undefined,\n };\n\n let formattedDate;\n\n try {\n formattedDate = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedDate;\n};\n\nexport default withErrorBoundary(formatDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n TimeFormatOptions,\n} from './types';\n\n/**\n * Formats time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional).\n * @returns {string} Formatted time string.\n */\nconst formatTime = (\n date: DateInput,\n locale: Locale,\n options: TimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n dateStyle: undefined,\n };\n\n let formattedTime;\n\n try {\n formattedTime = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedTime;\n};\n\nexport default withErrorBoundary(formatTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\n\n/**\n * Gets the first day of the week for a given locale.\n *\n * @param locale The locale to determine the first day of the week for.\n * @returns The first day of the week (0-6, where 0 is Sunday).\n */\nconst getFirstDayOfWeek = (locale: string): number => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n let formatted;\n\n try {\n const formatter = new Intl.DateTimeFormat(locale, { weekday: 'short' });\n const sampleDate = new Date(2000, 0, 2); // A Sunday\n formatted = formatter.format(sampleDate);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return ['su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'].indexOf(\n formatted.slice(0, 2).toLowerCase(),\n );\n};\n\nexport default withErrorBoundary(getFirstDayOfWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Determines the quarter of the year for a given date.\n *\n * @param date The date to determine the quarter for.\n * @returns The quarter of the year (1-4).\n */\nconst getQuarter = (date: Date): number => {\n return Math.ceil((date.getMonth() + 1) / 3);\n};\n\nexport default withErrorBoundary(getQuarter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Provides a relative time string (e.g., '3 hours ago', 'in 2 days').\n * This function calculates the difference between the given date and the base date,\n * then formats it in a locale-sensitive manner. It allows customization of the output\n * through Intl.RelativeTimeFormat options.\n *\n * @param date - The date to compare.\n * @param baseDate - The date to compare against (default: current date).\n * @param locale - The locale to use for formatting.\n * @param options - Options for the Intl.RelativeTimeFormat (optional).\n * @returns The relative time as a string.\n */\nconst getRelativeTime = (\n date: Date,\n baseDate: Date = new Date(),\n locale: Locale,\n options?: Intl.RelativeTimeFormatOptions,\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000;\n\n // Define time units in seconds\n const minute = 60;\n const hour = minute * 60;\n const day = hour * 24;\n const week = day * 7;\n const month = day * 30;\n const year = day * 365;\n\n let value: number;\n let unit: Intl.RelativeTimeFormatUnit;\n\n if (Math.abs(diffInSeconds) < minute) {\n value = diffInSeconds;\n unit = 'second';\n } else if (Math.abs(diffInSeconds) < hour) {\n value = diffInSeconds / minute;\n unit = 'minute';\n } else if (Math.abs(diffInSeconds) < day) {\n value = diffInSeconds / hour;\n unit = 'hour';\n } else if (Math.abs(diffInSeconds) < week) {\n value = diffInSeconds / day;\n unit = 'day';\n } else if (Math.abs(diffInSeconds) < month) {\n value = diffInSeconds / week;\n unit = 'week';\n } else if (Math.abs(diffInSeconds) < year) {\n value = diffInSeconds / month;\n unit = 'month';\n } else {\n value = diffInSeconds / year;\n unit = 'year';\n }\n\n let relativeTime;\n\n try {\n const rtf = new Intl.RelativeTimeFormat(locale, options);\n relativeTime = rtf.format(Math.round(value), unit);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return relativeTime;\n};\n\nexport default withErrorBoundary(getRelativeTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Calculates the week number of the year for a given date.\n *\n * @param date The date to calculate the week number for.\n * @returns The week number of the year.\n */\nconst getWeek = (date: Date): number => {\n const firstDayOfYear = new Date(date.getFullYear(), 0, 1);\n const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000;\n return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7);\n};\n\nexport default withErrorBoundary(getWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Returns an array of weekdays according to the specified locale.\n *\n * @param locale The locale to get weekdays for.\n * @returns An array of weekday names.\n */\nconst getWeekdays = (locale: Locale): string[] => {\n try {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n const formatter = new Intl.DateTimeFormat(locale, { weekday: 'long' });\n return Array.from({ length: 7 }, (_, i) =>\n formatter.format(new Date(1970, 0, 4 + i)),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(getWeekdays);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\n\n/**\n * Compares two dates to determine if the first is after the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is after date2.\n */\nconst isAfter = (date1: DateInput, date2: DateInput): boolean => {\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 > dateObj2;\n};\n\nexport default withErrorBoundary(isAfter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\n\n/**\n * Compares two dates to determine if the first is before the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is before date2.\n */\nconst isBefore = (date1: DateInput, date2: DateInput): boolean => {\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 < dateObj2;\n};\n\nexport default withErrorBoundary(isBefore);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given year is a leap year.\n *\n * @param year The year to check.\n * @returns True if the year is a leap year, false otherwise.\n */\nconst isLeapYear = (year: number): boolean => {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n};\n\nexport default withErrorBoundary(isLeapYear);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if two dates fall on the same day.\n *\n * @param date1 The first date.\n * @param date2 The second date.\n * @returns True if both dates are on the same day, false otherwise.\n */\nconst isSameDay = (date1: Date, date2: Date): boolean => {\n return (\n date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear()\n );\n};\n\nexport default withErrorBoundary(isSameDay);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given object is a valid Date object.\n *\n * @param date The object to check.\n * @returns True if the object is a valid Date, false otherwise.\n */\nconst isValidDate = (date: any): boolean => {\n return date instanceof Date && !isNaN(date.getTime());\n};\n\nexport default withErrorBoundary(isValidDate);\n","export const LOCALE_DATE_FORMATS: { [key: string]: string } = {\n 'ar-AE': 'DD/MM/YYYY', // Arabic (U.A.E.)\n 'sq-AL': 'DD.MM.YYYY', // Albanian (Albania)\n 'hy-AM': 'DD.MM.YYYY', // Armenian (Armenia)\n 'es-AR': 'DD/MM/YYYY', // Spanish (Argentina)\n 'en-AU': 'DD/MM/YYYY', // English (Australia)\n 'nl-AW': 'DD-MM-YYYY', // Dutch (Aruba)\n 'en-BB': 'MM/DD/YYYY', // English (Barbados)\n 'bn-BD': 'DD/MM/YYYY', // Bengali (Bangladesh)\n 'en-BM': 'MM/DD/YYYY', // English (Bermuda)\n 'ms-BN': 'DD/MM/YYYY', // Malay (Brunei)\n 'es-BO': 'DD/MM/YYYY', // Spanish (Bolivia)\n 'en-BS': 'MM/DD/YYYY', // English (Bahamas)\n 'en-BW': 'DD/MM/YYYY', // English (Botswana)\n 'en-BZ': 'MM/DD/YYYY', // English (Belize)\n 'en-CA': 'DD/MM/YYYY', // English (Canada)\n 'de-CH': 'DD.MM.YYYY', // German (Switzerland)\n 'zh-CN': 'YYYY/MM/DD', // Chinese (China)\n 'es-CO': 'DD/MM/YYYY', // Spanish (Colombia)\n 'es-CR': 'DD/MM/YYYY', // Spanish (Costa Rica)\n 'es-CU': 'DD/MM/YYYY', // Spanish (Cuba)\n 'cs-CZ': 'DD.MM.YYYY', // Czech (Czech Republic)\n 'da-DK': 'DD-MM-YYYY', // Danish (Denmark)\n 'es-DO': 'DD/MM/YYYY', // Spanish (Dominican Republic)\n 'ar-DZ': 'DD/MM/YYYY', // Arabic (Algeria)\n 'ar-EG': 'DD/MM/YYYY', // Arabic (Egypt)\n 'am-ET': 'DD/MM/YYYY', // Amharic (Ethiopia)\n 'en-EU': 'DD/MM/YYYY', // English (European Union)\n 'en-FJ': 'DD/MM/YYYY', // English (Fiji)\n 'en-GB': 'DD/MM/YYYY', // English (United Kingdom)\n 'en-GH': 'DD/MM/YYYY', // English (Ghana)\n 'en-GI': 'DD/MM/YYYY', // English (Gibraltar)\n 'en-GM': 'DD/MM/YYYY', // English (Gambia)\n 'es-GT': 'DD/MM/YYYY', // Spanish (Guatemala)\n 'en-GY': 'DD/MM/YYYY', // English (Guyana)\n 'en-HK': 'DD/MM/YYYY', // English (Hong Kong)\n 'es-HN': 'DD/MM/YYYY', // Spanish (Honduras)\n 'hr-HR': 'DD.MM.YYYY', // Croatian (Croatia)\n 'ht-HT': 'MM/DD/YYYY', // Haitian (Haiti)\n 'hu-HU': 'YYYY. MM. DD.', // Hungarian (Hungary)\n 'id-ID': 'DD/MM/YYYY', // Indonesian (Indonesia)\n 'he-IL': 'DD/MM/YYYY', // Hebrew (Israel)\n 'en-IN': 'DD-MM-YYYY', // English (India)\n 'en-JM': 'MM/DD/YYYY', // English (Jamaica)\n 'en-KE': 'DD/MM/YYYY', // English (Kenya)\n 'ky-KG': 'DD.MM.YYYY', // Kyrgyz (Kyrgyzstan)\n 'km-KH': 'DD/MM/YYYY', // Khmer (Cambodia)\n 'en-KY': 'MM/DD/YYYY', // English (Cayman Islands)\n 'kk-KZ': 'DD.MM.YYYY', // Kazakh (Kazakhstan)\n 'lo-LA': 'DD/MM/YYYY', // Lao (Laos)\n 'si-LK': 'YYYY-MM-DD', // Sinhala (Sri Lanka)\n 'en-LR': 'MM/DD/YYYY', // English (Liberia)\n 'en-LS': 'DD/MM/YYYY', // English (Lesotho)\n 'ar-MA': 'DD/MM/YYYY', // Arabic (Morocco)\n 'ro-MD': 'DD.MM.YYYY', // Romanian (Moldova)\n 'mk-MK': 'DD.MM.YYYY', // Macedonian (North Macedonia)\n 'my-MM': 'DD/MM/YYYY', // Burmese (Myanmar)\n 'mn-MN': 'YYYY.MM.DD', // Mongolian (Mongolia)\n 'zh-MO': 'DD/MM/YYYY', // Chinese (Macao)\n 'en-MU': 'DD/MM/YYYY', // English (Mauritius)\n 'dv-MV': 'DD/MM/YYYY', // Divehi (Maldives)\n 'en-MW': 'DD/MM/YYYY', // English (Malawi)\n 'es-MX': 'DD/MM/YYYY', // Spanish (Mexico)\n 'ms-MY': 'DD/MM/YYYY', // Malay (Malaysia)\n 'en-NA': 'DD/MM/YYYY', // English (Namibia)\n 'en-NG': 'DD/MM/YYYY', // English (Nigeria)\n 'es-NI': 'DD/MM/YYYY', // Spanish (Nicaragua)\n 'no-NO': 'DD.MM.YYYY', // Norwegian (Norway)\n 'ne-NP': 'YYYY/MM/DD', // Nepali (Nepal)\n 'en-NZ': 'DD/MM/YYYY', // English (New Zealand)\n 'es-PE': 'DD/MM/YYYY', // Spanish (Peru)\n 'en-PG': 'DD/MM/YYYY', // English (Papua New Guinea)\n 'en-PH': 'MM/DD/YYYY', // English (Philippines)\n 'en-PK': 'DD/MM/YYYY', // English (Pakistan)\n 'ar-QA': 'DD/MM/YYYY', // Arabic (Qatar)\n 'ru-RU': 'DD.MM.YYYY', // Russian (Russia)\n 'ar-SA': 'DD/MM/YYYY', // Arabic (Saudi Arabia)\n 'en-SC': 'DD/MM/YYYY', // English (Seychelles)\n 'sv-SE': 'YYYY-MM-DD', // Swedish (Sweden)\n 'en-SG': 'DD/MM/YYYY', // English (Singapore)\n 'en-SL': 'DD/MM/YYYY', // English (Sierra Leone)\n 'so-SO': 'DD/MM/YYYY', // Somali (Somalia)\n 'en-SS': 'DD/MM/YYYY', // English (South Sudan)\n 'es-SV': 'DD/MM/YYYY', // Spanish (El Salvador)\n 'en-SZ': 'DD/MM/YYYY', // English (Eswatini)\n 'th-TH': 'DD/MM/YYYY', // Thai (Thailand)\n 'en-TT': 'MM/DD/YYYY', // English (Trinidad and Tobago)\n 'sw-TZ': 'DD/MM/YYYY', // Swahili (Tanzania)\n 'en-US': 'MM/DD/YYYY', // English (United States)\n 'es-UY': 'DD/MM/YYYY', // Spanish (Uruguay)\n 'uz-UZ': 'DD/MM/YYYY', // Uzbek (Uzbekistan)\n 'ar-YE': 'DD/MM/YYYY', // Arabic (Yemen)\n 'en-ZA': 'YYYY/MM/DD', // English (South Africa)\n 'ar-KW': 'DD/MM/YYYY', // Arabic (Kuwait)\n 'ar-BH': 'DD/MM/YYYY', // Arabic (Bahrain)\n 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman)\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Parses a date string based on a specific format.\n *\n * @param dateString The date string to parse.\n * @param format The format to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDateWithFormat = (\n dateString: string,\n format: string,\n): Date | null => {\n // Determine the separator based on the format (supports '/', '.', or '-')\n const separator = format.includes('/')\n ? '/'\n : format.includes('.')\n ? '.'\n : '-';\n const formatParts = format.split(separator);\n const dateParts = dateString.split(separator).map((num) => parseInt(num, 10));\n\n let year: number = 0,\n month: number = 0,\n day: number = 0;\n let yearSet: boolean = false,\n monthSet: boolean = false,\n daySet: boolean = false;\n\n // Check for format and date string mismatch\n if (dateParts.length !== formatParts.length) {\n return null; // Mismatch between date string and format\n }\n\n formatParts.forEach((part, index) => {\n // Check for non-numeric values in date string\n if (isNaN(dateParts[index])) {\n return null; // Invalid date part\n }\n\n // Assign year, month, and day based on the format\n switch (part) {\n case 'DD':\n day = dateParts[index];\n daySet = true;\n break;\n case 'MM':\n month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date\n monthSet = true;\n break;\n case 'YYYY':\n year = dateParts[index];\n yearSet = true;\n break;\n }\n });\n\n // Validate and create the date only if all parts are set\n if (yearSet && monthSet && daySet) {\n const parsedDate = new Date(year, month, day);\n // Validate date to catch invalid dates like February 30th\n if (\n parsedDate.getFullYear() === year &&\n parsedDate.getMonth() === month &&\n parsedDate.getDate() === day\n ) {\n return parsedDate;\n }\n }\n return null; // Invalid date or incomplete date information\n};\n\nexport default withErrorBoundary(\n parseDateWithFormat,\n);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { LOCALE_DATE_FORMATS } from './data/localeDateFormats';\nimport parseDateWithFormat from './parseDateWithFormat';\nimport { Locale } from './types';\n\n/**\n * Attempts to parse a string into a date object based on locale.\n * Uses the localeDateFormats mapping for determining the date format.\n *\n * @param dateString - The date string to parse.\n * @param locale - The locale to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDate = (dateString: string, locale: Locale): Date | null => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const format = LOCALE_DATE_FORMATS[locale];\n if (!format) {\n throw new Error(`No date format found for locale: ${locale}`);\n }\n return parseDateWithFormat(dateString, format);\n};\n\nexport default withErrorBoundary(parseDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport add from './add';\n\n/**\n * Subtracts a specified amount of time from a date.\n *\n * @param date The original date.\n * @param value The amount to subtract.\n * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time subtracted.\n */\nconst subtract = (\n date: Date,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n return add(date, -value, unit); // Reuse the add function with negative value\n};\n\nexport default withErrorBoundary(subtract);\n"],"names":["formatPhoneNumber","formatDateTime","parseDateWithFormat","add"],"mappings":"AAAA;AACM,MAAO,YAAa,SAAQ,KAAK,CAAA;AAErC,IAAA,WAAA,CAAY,OAA2B,EAAA;QACrC,KAAK,CAAC,OAAO,CAAC,CAAC;AACf,QAAA,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;AAC5B,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;;KAE7B;AACF,CAAA;AAED;;;;;;;;AAQG;AACI,MAAM,iBAAiB,GAAG,CAC/B,EAAK,KAC0C;IAC/C,OAAO,UAAyB,GAAG,IAAmB,EAAA;QACpD,IAA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AM,CAAC,CAAC;AACjD,CAAC,CAAC;AAEF,kBAAe,iBAAiB,CAAmB,SAAS,CAAC;;AC3B7D;;;;;;;AAOG;AACH,MAAM,QAAQ,GAAG,CACf,IAAU,EACV,KAAa,EACb,IAAiC,KACzB;IACR,OAAOC,KAAG,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACjC,CAAC,CAAC;AAEF,iBAAe,iBAAiB,CAAkB,QAAQ,CAAC;;;;"} \ No newline at end of file diff --git a/lib/esm/index.min.js b/lib/esm/index.min.js new file mode 100644 index 00000000..e5d64819 --- /dev/null +++ b/lib/esm/index.min.js @@ -0,0 +1,2 @@ +class x extends Error{constructor(x){super(x),this.name="i18nify Error",this.timestamp=new Date}}const e=e=>function(...a){try{return e.call(this,...a)}catch(e){throw console.warn("[I18N Error]: ",e),new x(e)}};class a{constructor(){this.state={locale:"",direction:"",country:""}}static getInstance(){return a.instance||(a.instance=new a),a.instance}static resetInstance(){a.instance=void 0}getState(){return Object.assign({},this.state)}setState(x){this.state=Object.assign(Object.assign({},this.state),x)}resetState(){this.state={locale:"",direction:"",country:""}}}var n=a.getInstance();var r=e((()=>n.getState()));var t=e((x=>{n.setState(x)}));var o=e((()=>{n.resetState()}));const s=()=>{if("undefined"==typeof navigator)return"en-IN";if(window.Intl&&"object"==typeof window.Intl&&(window.navigator.languages||window.navigator.language)){return(window.navigator.languages||[window.navigator.language])[0]}return"en-IN"},Y=(x={})=>{let e=(null==x?void 0:x.locale)||n.getState().locale;e||(e=s());const a=(null==x?void 0:x.intlOptions)?Object.assign({},x.intlOptions):{};if(((null==x?void 0:x.currency)||a.currency)&&(a.style="currency",a.currency=x.currency||a.currency),!e)throw new Error("Pass valid locale !");return new Intl.NumberFormat(e||void 0,a)};var M=e(((x,e={})=>{if(!Number(x)&&0!==Number(x))throw new Error("Parameter `amount` is not a number!");let a="";try{a=Y(e).format(Number(x))}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return a}));const D={AED:{symbol:"د.إ",name:"United Arab Emirates Dirham"},ALL:{symbol:"Lek",name:"Albanian Lek"},AMD:{symbol:"֏",name:"Armenian Dram"},ARS:{symbol:"ARS",name:"Argentine Peso"},AUD:{symbol:"A$",name:"Australian Dollar"},AWG:{symbol:"Afl.",name:"Aruban Florin"},BBD:{symbol:"$",name:"Barbadian Dollar"},BDT:{symbol:"৳",name:"Bangladeshi Taka"},BMD:{symbol:"$",name:"Bermudian Dollar"},BND:{symbol:"BND",name:"Brunei Dollar"},BOB:{symbol:"Bs",name:"Bolivian Boliviano"},BSD:{symbol:"B$",name:"Bahamian Dollar"},BWP:{symbol:"P",name:"Botswanan Pula"},BZD:{symbol:"BZ$",name:"Belize Dollar"},CAD:{symbol:"C$",name:"Canadian Dollar"},CHF:{symbol:"CHf",name:"Swiss Franc"},CNY:{symbol:"¥",name:"Chinese Yuan"},COP:{symbol:"COL$",name:"Colombian Peso"},CRC:{symbol:"₡",name:"Costa Rican Colón"},CUP:{symbol:"$MN",name:"Cuban Peso"},CZK:{symbol:"Kč",name:"Czech Koruna"},DKK:{symbol:"DKK",name:"Danish Krone"},DOP:{symbol:"RD$",name:"Dominican Peso"},DZD:{symbol:"د.ج",name:"Algerian Dinar"},EGP:{symbol:"E£",name:"Egyptian Pound"},ETB:{symbol:"ብር",name:"Ethiopian Birr"},EUR:{symbol:"€",name:"Euro"},FJD:{symbol:"FJ$",name:"Fijian Dollar"},GBP:{symbol:"£",name:"British Pound"},GHS:{symbol:"GH₵",name:"Ghanaian Cedi"},GIP:{symbol:"GIP",name:"Gibraltar Pound"},GMD:{symbol:"D",name:"Gambian Dalasi"},GTQ:{symbol:"Q",name:"Guatemalan Quetzal"},GYD:{symbol:"G$",name:"Guyanese Dollar"},HKD:{symbol:"HK$",name:"Hong Kong Dollar"},HNL:{symbol:"HNL",name:"Honduran Lempira"},HRK:{symbol:"kn",name:"Croatian Kuna"},HTG:{symbol:"G",name:"Haitian Gourde"},HUF:{symbol:"Ft",name:"Hungarian Forint"},IDR:{symbol:"Rp",name:"Indonesian Rupiah"},ILS:{symbol:"₪",name:"Israeli New Shekel"},INR:{symbol:"₹",name:"Indian Rupee"},JMD:{symbol:"J$",name:"Jamaican Dollar"},KES:{symbol:"Ksh",name:"Kenyan Shilling"},KGS:{symbol:"Лв",name:"Kyrgystani Som"},KHR:{symbol:"៛",name:"Cambodian Riel"},KYD:{symbol:"CI$",name:"Cayman Islands Dollar"},KZT:{symbol:"₸",name:"Kazakhstani Tenge"},LAK:{symbol:"₭",name:"Laotian Kip"},LKR:{symbol:"රු",name:"Sri Lankan Rupee"},LRD:{symbol:"L$",name:"Liberian Dollar"},LSL:{symbol:"LSL",name:"Lesotho Loti"},MAD:{symbol:"د.م.",name:"Moroccan Dirham"},MDL:{symbol:"MDL",name:"Moldovan Leu"},MKD:{symbol:"ден",name:"Macedonian Denar"},MMK:{symbol:"MMK",name:"Myanmar Kyat"},MNT:{symbol:"₮",name:"Mongolian Tugrik"},MOP:{symbol:"MOP$",name:"Macanese Pataca"},MUR:{symbol:"₨",name:"Mauritian Rupee"},MVR:{symbol:"Rf",name:"Maldivian Rufiyaa"},MWK:{symbol:"MK",name:"Malawian Kwacha"},MXN:{symbol:"Mex$",name:"Mexican Peso"},MYR:{symbol:"RM",name:"Malaysian Ringgit"},NAD:{symbol:"N$",name:"Namibian Dollar"},NGN:{symbol:"₦",name:"Nigerian Naira"},NIO:{symbol:"NIO",name:"Nicaraguan Córdoba"},NOK:{symbol:"NOK",name:"Norwegian Krone"},NPR:{symbol:"रू",name:"Nepalese Rupee"},NZD:{symbol:"NZ$",name:"New Zealand Dollar"},PEN:{symbol:"S/",name:"Peruvian Nuevo Sol"},PGK:{symbol:"PGK",name:"Papua New Guinean Kina"},PHP:{symbol:"₱",name:"Philippine Peso"},PKR:{symbol:"₨",name:"Pakistani Rupee"},QAR:{symbol:"QR",name:"Qatari Riyal"},RUB:{symbol:"₽",name:"Russian Ruble"},SAR:{symbol:"SR",name:"Saudi Riyal"},SCR:{symbol:"SRe",name:"Seychellois Rupee"},SEK:{symbol:"SEK",name:"Swedish Krona"},SGD:{symbol:"S$",name:"Singapore Dollar"},SLL:{symbol:"Le",name:"Sierra Leonean Leone"},SOS:{symbol:"Sh.so.",name:"Somali Shilling"},SSP:{symbol:"SS£",name:"South Sudanese Pound"},SVC:{symbol:"₡",name:"Salvadoran Colón"},SZL:{symbol:"E",name:"Swazi Lilangeni"},THB:{symbol:"฿",name:"Thai Baht"},TTD:{symbol:"TT$",name:"Trinidad and Tobago Dollar"},TZS:{symbol:"Sh",name:"Tanzanian Shilling"},USD:{symbol:"$",name:"United States Dollar"},UYU:{symbol:"$U",name:"Uruguayan Peso"},UZS:{symbol:"so'm",name:"Uzbekistani Som"},YER:{symbol:"﷼",name:"Yemeni Rial"},ZAR:{symbol:"R",name:"South African Rand"},KWD:{symbol:"د.ك",name:"Kuwaiti Dinar"},BHD:{symbol:"د.ب.",name:"Bahraini Dinar"},OMR:{symbol:"ر.ع.",name:"Omani Rial"}};var i=e((()=>D));var l=e((x=>{var e;if(x in D)return null===(e=D[x])||void 0===e?void 0:e.symbol;throw new Error("Invalid currencyCode!")}));const m=["nan","infinity","percent","integer","group","decimal","fraction","plusSign","minusSign","percentSign","currency","code","symbol","name","compact","exponentInteger","exponentMinusSign","exponentSeparator","unit"];var d=e(((x,e={})=>{if(!Number(x)&&0!==Number(x))throw new Error("Parameter `amount` is not a number!");try{const a=Y(e).formatToParts(Number(x)),n={};return a.forEach((x=>{"group"===x.type?n.integer=(n.integer||"")+x.value:-1!=m.findIndex((e=>e===x.type))&&(n[x.type]=(n[x.type]||"")+x.value)})),Object.assign(Object.assign({},n),{isPrefixSymbol:"currency"===a[0].type,rawParts:a})}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}}));const c={IN:/^(?:(?:\+|0{0,2})91\s*[-]?\s*|[0]?)?[6789]\d{9}$/,MY:/^(\+?6?0)?(\d{1,3})[-.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+598|0)\s?(9\d{3}|2\d{2}|[4-9]\d{6}))$/,UZ:/^(?:\+?998)?\s?[3456789]\d{8}$/,YE:/^(?:\+?967)?(?:\d{7,8})$/,ZA:/^(?:(?:\+27)|0)(\d{9})$/,KW:/^(?:\+?965)[569]\d{7}$/,BH:/^(?:\+?973)?[356]\d{7}$/,TL:/^(?:(?:\+670)\s?)?[0-9]{3}\s?[0-9]{3,4}$/,VC:/^(?:(?:\+1)?784)?(?:\d{3})?\d{7}$/,VE:/^(?:(?:\+58)|0)?4\d{9}$/,VN:/^(?:(?:\+84)|0)?[1-9]\d{8}$/,ZM:/^(?:(?:\+260)|0)?[123456789]\d{8,9}$/,ZW:/^(?:(?:\+263)|0)?(?:\d{9,10})$/,LT:/^(?:(?:\+370)|8)\d{8}$/,LU:/^(?:(?:\+352)?(6|2(6|7|8|9))\d{6})$/,LV:/^(?:(?:\+371)?2\d{7})$/,ME:/^(?:(?:\+382)?[67]\d{7,20})$/,MG:/^(?:(?:\+261)?3[234568]\d{7})$/,MZ:/^(?:(?:\+258)|(?:258))?8[234567]\d{7,8}$/,NL:/^(?:(?:\+31)|0(6(?:\d{8})|[1-9](?:(?:\d{8})|(?:\s\d{3}\s\d{4}))|(?:\d{8})))$/,PA:/^(?:(?:\+507)\s?)?[46]\d{6,7}$/,PL:/^(?:(?:\+48)?(?:\s?\d{3}\s?\d{3}\s?\d{3}|(?:\d{2}\s?){4}\d{2}|\d{3}-\d{3}-\d{3}))$/,PR:/^(?:(?:\+1)?787|939)\d{7}$/,PS:/^(?:(?:\+970))(5[2349])\d{7}$/,PT:/^(?:(?:\+351)?9(1\d|2[1-9]|6[12345789]|7[12345789])\d{7})$/,PY:/^(?:(?:\+595|0)9[9876]\d{7})$/,RO:/^(?:(?:\+40|0))(?:7[2-8]\d{7}|21\d{8})$/,RS:/^(?:(?:\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/,RW:/^(?:(?:\+250)|(0))\d{9}$/,SI:/^(?:(?:\+386)|0)?[1-59]\d{7,8}$/,SK:/^(?:(?:\+421))?(0|9[0-8])\d{8}$/,SM:/^(?:(?:\+378)|(0549|6\d{4}))\d{5}$/,SN:/^(?:(?:\+221)|0)?[3679]\d{7}$/,SR:/^(?:(?:\+597))\d{7}$/,TG:/^(?:(?:\+228))\d{8}$/,TJ:/^(?:(?:\+992))(37|55|77)\d{7}$/,TN:/^(?:(?:\+216)|22|9[1-9])\d{7}$/,TR:/^(?:(?:\+90)|(0))\s?5\d{9}$/,TW:/^(?:(?:\+886)|0)?9\d{8}$/,UA:/^(?:(?:\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\d{7}$/,UG:/^(?:(?:\+256)|0)?[39]\d{8}$/},u={1:["US","AG","AI","AS","BB","BM","BS","CA","DM","DO","GD","GU","JM","KN","KY","LC","MP","MS","PR","SX","TC","TT","VC","VG","VI"],7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT","VA"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH","TA"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],380:["UA"],381:["RS"],382:["ME"],383:["XK"],385:["HR"],386:["SI"],387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],691:["FM"],692:["MH"],800:["001"],808:["001"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],870:["001"],878:["001"],880:["BD"],881:["001"],882:["001"],883:["001"],886:["TW"],888:["001"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],979:["001"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},S=x=>{if("+"===x.toString().charAt(0)){const e=x.toString().replace(/\D/g,""),a=[];for(const x in u)e.startsWith(x)&&a.push(...u[x]);return a.find((e=>{const a=c[e];if(a&&a.test(x.toString()))return e}))||""}for(const e in c){if(c[e].test(x.toString()))return e}return""},y=x=>{const e=x.replace(/[^0-9+]|(?!A)\+/g,"");return"+"===x[0]?`+${e}`:e};var $=e(((x,e)=>{const a=y(x.toString());if(e=e&&e in c?e:S(a),!x)return!1;if(e in c){return c[e].test(a)}return!1}));const b={IN:"xxxx xxxxxx",MY:"xx xxxxx xx",AE:"xx xxx xxxx",AL:"xxx xx xxxx",AM:"xx xx xx xx",AR:"xxxx-xxxx",AU:"xxx xxx xxx",AW:"xxx-xxxx",BB:"xxx-xxxx",BD:"xxxx-xxxxxx",BM:"xxx-xxxx",BN:"xxxx-xxxx",BO:"xxxx-xxxx",BS:"xxx-xxxx",BW:"xx xxxx xxxx",BZ:"xxx-xxxx",CA:"xxx-xxx-xxxx",CH:"xxx xxx xxx",CN:"xxxx-xxxxxxx",CO:"xxxx-xxxxxxx",CR:"xxxx-xxxx",CU:"xxxx-xxxx",CZ:"xxx xxx xxx",DK:"xx xx xx xx",DO:"xxx-xxxxxxx",DZ:"xxxx-xxxx-xxx",EG:"xx xxx xxxx",ET:"xx xxx xxxx",EU:"xxx xx xx xx",FJ:"xxxx xxxx",GB:"xxxx xxx xxx",GH:"xxx xxx xxxx",GI:"xxxx xxxx",GM:"xxxx-xxxx",GT:"xxxx-xxxx",GY:"xxx-xxxx",HK:"xxxx xxxx",HN:"xxxx-xxxx",HR:"xxx xxx xxxx",HT:"xxx-xxxx",HU:"xxx xxx xxxx",ID:"xxxx-xxxx-xxxx",IL:"xxxx-xxx-xxx",JM:"xxx-xxxx",KE:"xxx xxxxxx",KG:"xxx-xx-xx-xx",KH:"xxx-xxx-xxx",KY:"xxx-xxxx",KZ:"xxx-xxx-xx-xx",LA:"xxx xx xxxx",LK:"xx xxx xxxx",LR:"xxx-xxx-xxxx",LS:"xxx xx xxxx",LT:"xxx xxxxx",LU:"xxx xx xxx",LV:"xxxx xxxx",MA:"xxxx-xxxxxx",MD:"xx xxxxxx",ME:"xx xxxxxx",MG:"xx xx xx xx xx",MK:"xx xx xx xx",MM:"xx xxxxxx",MN:"xxx-xx-xxxx",MO:"xxxx xxxx",MU:"xx xxxx xxxx",MV:"xxxxxx",MW:"xx xxxx xxxx",MX:"xxx-xxx-xxxx",MZ:"xx xxxxxxx",NA:"xx xxxx xxxx",NG:"xxx xxx xxxx",NI:"xxxx-xxxx",NL:"xxx-xxxxxxx",NO:"xxxx xxxx",NP:"xxxx-xxxxxxx",NZ:"xxx-xxxxxxx",OM:"xxxx-xxxx",PA:"xxx-xxxx",PE:"xxx-xxx-xxx",PG:"xxx-xxxxxx",PH:"xxx-xxxx",PK:"xxx-xxxxxxx",PL:"xxx xxx xxx",PR:"xxx-xxx-xxxx",PS:"xxxx-xxxxxxx",PT:"xxx xxx xxx",PY:"xxx-xxxxxx",QA:"xxxx xxxx",RO:"xxx xxx xxxx",RS:"xxx xxxxx",RU:"xxx xxx-xx-xx",RW:"xxx xxxxxx",SA:"xxx-xxxxxxx",SC:"xx xxxxx",SE:"xxx-xxx xx xx",SG:"xxxx xxxx",SI:"xx xxxxxx",SK:"xxx xxx xxx",SL:"xxx-xxxxxx",SM:"xxxxx xxxxx",SN:"xx xxx xx xx",SO:"xxx xxxxxxx",SR:"xxx-xxxx",SS:"xxx xxxx xxx",SV:"xxxx-xxxx",SZ:"xxx xx xxxx",TG:"xx xx xx xx",TH:"xxx-xxxxxxx",TJ:"xxx xx xx xx",TL:"xxx-xxxxxxx",TN:"xx xxxxxx",TR:"xxx xxx xx xx",TT:"xxx-xxxx",TW:"xxxx-xxxxxx",TZ:"xxx xxx xxxx",UA:"xx xxx xx xx",UG:"xxx xxxxxxx",US:"xxx-xxx-xxxx",UY:"xxx-xxxxx",UZ:"xxx-xxx-xx-xx",VC:"xxx-xxxx",VE:"xxxx-xxx-xxxx",VN:"xxxx-xxxxxxx",YE:"xxxx-xxxx",ZA:"xxx-xxx-xxxx",ZM:"xxx-xxxxxxx",ZW:"xx xxx xxxx",KW:"xxx xx xxxx",BH:"xxxx xxxx"};var g=e(((x,e)=>{if(!x)throw new Error("Parameter `phoneNumber` is invalid!");x=x.toString(),x=y(x),e=e&&e in b?e:S(x);const a=b[e];if(!a)return x;let n=0;for(let x=0;x{if(!x)throw new Error("Parameter `phoneNumber` is invalid!");x=x.toString(),x=y(x);const a=e&&e in b?e:S(x),n=g(x,a),r=b[a];if(!r)return{countryCode:a||"",dialCode:"",formattedPhoneNumber:x,formatTemplate:""};let t=0;for(let x=0;x{const n=new Date(x);switch(a){case"days":n.setDate(n.getDate()+e);break;case"months":n.setMonth(n.getMonth()+e);break;case"years":n.setFullYear(n.getFullYear()+e)}return n}));var A=e(((x,e,a={})=>{e||(e=n.getState().locale||s());const r=x instanceof Date?x:new Date(x);let t;try{t=new Intl.DateTimeFormat(e,a)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return t.format(r)}));var E=e(((x,e,a={})=>{e||(e=n.getState().locale||s());const r=Object.assign(Object.assign({},a),{timeStyle:void 0});let t;try{t=A(x,e,r)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return t}));var K=e(((x,e,a={})=>{e||(e=n.getState().locale||s());const r=Object.assign(Object.assign({},a),{dateStyle:void 0});let t;try{t=A(x,e,r)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return t}));var w=e((x=>{let e;x||(x=n.getState().locale||s());try{const a=new Intl.DateTimeFormat(x,{weekday:"short"}),n=new Date(2e3,0,2);e=a.format(n)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return["su","mo","tu","we","th","fr","sa"].indexOf(e.slice(0,2).toLowerCase())}));var T=e((x=>Math.ceil((x.getMonth()+1)/3)));var R=e(((x,e=new Date,a,r)=>{a||(a=n.getState().locale||s());const t=(x.getTime()-e.getTime())/1e3,o=3600,Y=86400,M=7*Y,D=30*Y,i=365*Y;let l,m,d;Math.abs(t)<60?(l=t,m="second"):Math.abs(t){const e=new Date(x.getFullYear(),0,1),a=(x.getTime()-e.getTime())/864e5;return Math.ceil((a+e.getDay()+1)/7)}));var P=e((x=>{try{x||(x=n.getState().locale||s());const e=new Intl.DateTimeFormat(x,{weekday:"long"});return Array.from({length:7},((x,a)=>e.format(new Date(1970,0,4+a))))}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}}));var B=e(((x,e)=>(x instanceof Date?x:new Date(x))>(e instanceof Date?e:new Date(e))));var C=e(((x,e)=>(x instanceof Date?x:new Date(x))<(e instanceof Date?e:new Date(e))));var L=e((x=>x%4==0&&x%100!=0||x%400==0));var f=e(((x,e)=>x.getDate()===e.getDate()&&x.getMonth()===e.getMonth()&&x.getFullYear()===e.getFullYear()));var H=e((x=>x instanceof Date&&!isNaN(x.getTime())));const I={"ar-AE":"DD/MM/YYYY","sq-AL":"DD.MM.YYYY","hy-AM":"DD.MM.YYYY","es-AR":"DD/MM/YYYY","en-AU":"DD/MM/YYYY","nl-AW":"DD-MM-YYYY","en-BB":"MM/DD/YYYY","bn-BD":"DD/MM/YYYY","en-BM":"MM/DD/YYYY","ms-BN":"DD/MM/YYYY","es-BO":"DD/MM/YYYY","en-BS":"MM/DD/YYYY","en-BW":"DD/MM/YYYY","en-BZ":"MM/DD/YYYY","en-CA":"DD/MM/YYYY","de-CH":"DD.MM.YYYY","zh-CN":"YYYY/MM/DD","es-CO":"DD/MM/YYYY","es-CR":"DD/MM/YYYY","es-CU":"DD/MM/YYYY","cs-CZ":"DD.MM.YYYY","da-DK":"DD-MM-YYYY","es-DO":"DD/MM/YYYY","ar-DZ":"DD/MM/YYYY","ar-EG":"DD/MM/YYYY","am-ET":"DD/MM/YYYY","en-EU":"DD/MM/YYYY","en-FJ":"DD/MM/YYYY","en-GB":"DD/MM/YYYY","en-GH":"DD/MM/YYYY","en-GI":"DD/MM/YYYY","en-GM":"DD/MM/YYYY","es-GT":"DD/MM/YYYY","en-GY":"DD/MM/YYYY","en-HK":"DD/MM/YYYY","es-HN":"DD/MM/YYYY","hr-HR":"DD.MM.YYYY","ht-HT":"MM/DD/YYYY","hu-HU":"YYYY. MM. DD.","id-ID":"DD/MM/YYYY","he-IL":"DD/MM/YYYY","en-IN":"DD-MM-YYYY","en-JM":"MM/DD/YYYY","en-KE":"DD/MM/YYYY","ky-KG":"DD.MM.YYYY","km-KH":"DD/MM/YYYY","en-KY":"MM/DD/YYYY","kk-KZ":"DD.MM.YYYY","lo-LA":"DD/MM/YYYY","si-LK":"YYYY-MM-DD","en-LR":"MM/DD/YYYY","en-LS":"DD/MM/YYYY","ar-MA":"DD/MM/YYYY","ro-MD":"DD.MM.YYYY","mk-MK":"DD.MM.YYYY","my-MM":"DD/MM/YYYY","mn-MN":"YYYY.MM.DD","zh-MO":"DD/MM/YYYY","en-MU":"DD/MM/YYYY","dv-MV":"DD/MM/YYYY","en-MW":"DD/MM/YYYY","es-MX":"DD/MM/YYYY","ms-MY":"DD/MM/YYYY","en-NA":"DD/MM/YYYY","en-NG":"DD/MM/YYYY","es-NI":"DD/MM/YYYY","no-NO":"DD.MM.YYYY","ne-NP":"YYYY/MM/DD","en-NZ":"DD/MM/YYYY","es-PE":"DD/MM/YYYY","en-PG":"DD/MM/YYYY","en-PH":"MM/DD/YYYY","en-PK":"DD/MM/YYYY","ar-QA":"DD/MM/YYYY","ru-RU":"DD.MM.YYYY","ar-SA":"DD/MM/YYYY","en-SC":"DD/MM/YYYY","sv-SE":"YYYY-MM-DD","en-SG":"DD/MM/YYYY","en-SL":"DD/MM/YYYY","so-SO":"DD/MM/YYYY","en-SS":"DD/MM/YYYY","es-SV":"DD/MM/YYYY","en-SZ":"DD/MM/YYYY","th-TH":"DD/MM/YYYY","en-TT":"MM/DD/YYYY","sw-TZ":"DD/MM/YYYY","en-US":"MM/DD/YYYY","es-UY":"DD/MM/YYYY","uz-UZ":"DD/MM/YYYY","ar-YE":"DD/MM/YYYY","en-ZA":"YYYY/MM/DD","ar-KW":"DD/MM/YYYY","ar-BH":"DD/MM/YYYY","ar-OM":"DD/MM/YYYY"};var O=e(((x,e)=>{const a=e.includes("/")?"/":e.includes(".")?".":"-",n=e.split(a),r=x.split(a).map((x=>parseInt(x,10)));let t=0,o=0,s=0,Y=!1,M=!1,D=!1;if(r.length!==n.length)return null;if(n.forEach(((x,e)=>{if(isNaN(r[e]))return null;switch(x){case"DD":s=r[e],D=!0;break;case"MM":o=r[e]-1,M=!0;break;case"YYYY":t=r[e],Y=!0}})),Y&&M&&D){const x=new Date(t,o,s);if(x.getFullYear()===t&&x.getMonth()===o&&x.getDate()===s)return x}return null}));var U=e(((x,e)=>{e||(e=n.getState().locale||s());const a=I[e];if(!a)throw new Error(`No date format found for locale: ${e}`);return O(x,a)}));var v=e(((x,e,a)=>h(x,-e,a)));export{h as add,E as formatDate,A as formatDateTime,M as formatNumber,d as formatNumberByParts,g as formatPhoneNumber,K as formatTime,i as getCurrencyList,l as getCurrencySymbol,w as getFirstDayOfWeek,T as getQuarter,R as getRelativeTime,r as getState,G as getWeek,P as getWeekdays,B as isAfter,C as isBefore,L as isLeapYear,f as isSameDay,H as isValidDate,$ as isValidPhoneNumber,U as parseDate,N as parsePhoneNumber,o as resetState,t as setState,v as subtract}; +//# sourceMappingURL=index.min.js.map diff --git a/lib/esm/index.min.js.map b/lib/esm/index.min.js.map new file mode 100644 index 00000000..e53d3390 --- /dev/null +++ b/lib/esm/index.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.min.js","sources":["../../src/common/errorBoundary/index.ts","../../src/modules/.internal/state/index.ts","../../src/modules/.internal/utils/getDefaultState.ts","../../src/modules/core/getState.ts","../../src/modules/core/setState.ts","../../src/modules/core/resetState.ts","../../src/modules/.internal/utils/getLocale.ts","../../src/modules/.internal/utils/getIntlInstanceWithOptions.ts","../../src/modules/currency/formatNumber.ts","../../src/modules/currency/data/currencies.ts","../../src/modules/currency/getCurrencyList.ts","../../src/modules/currency/getCurrencySymbol.ts","../../src/modules/currency/constants.ts","../../src/modules/currency/formatNumberByParts.ts","../../src/modules/phoneNumber/data/phoneRegexMapper.ts","../../src/modules/phoneNumber/data/dialCodeMapper.ts","../../src/modules/phoneNumber/utils.ts","../../src/modules/phoneNumber/isValidPhoneNumber.ts","../../src/modules/phoneNumber/data/phoneFormatterMapper.ts","../../src/modules/phoneNumber/formatPhoneNumber.ts","../../src/modules/phoneNumber/parsePhoneNumber.ts","../../src/modules/dateTime/add.ts","../../src/modules/dateTime/formatDateTime.ts","../../src/modules/dateTime/formatDate.ts","../../src/modules/dateTime/formatTime.ts","../../src/modules/dateTime/getFirstDayOfWeek.ts","../../src/modules/dateTime/getQuarter.ts","../../src/modules/dateTime/getRelativeTime.ts","../../src/modules/dateTime/getWeek.ts","../../src/modules/dateTime/getWeekdays.ts","../../src/modules/dateTime/isAfter.ts","../../src/modules/dateTime/isBefore.ts","../../src/modules/dateTime/isLeapYear.ts","../../src/modules/dateTime/isSameDay.ts","../../src/modules/dateTime/isValidDate.ts","../../src/modules/dateTime/data/localeDateFormats.ts","../../src/modules/dateTime/parseDateWithFormat.ts","../../src/modules/dateTime/parseDate.ts","../../src/modules/dateTime/subtract.ts"],"sourcesContent":["// Custom Error class to extend properties to error object\nexport class I18nifyError extends Error {\n timestamp: Date;\n constructor(message: string | undefined) {\n super(message);\n this.name = 'i18nify Error';\n this.timestamp = new Date();\n // more params like type of error/severity can be added in future for better debugging.\n }\n}\n\n/**\n * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block.\n * It appends additional attributes and serves as a centralized error-handling service.\n * Usage =>\n * const wrappedUtilityFn = withErrorBoundary(utilityFn)\n *\n * @param fn utility that is wrapped in error boundary\n * @returns {Function} returns the function wrapped in try/catch block\n */\nexport const withErrorBoundary = any>(\n fn: T,\n): ((...args: Parameters) => ReturnType) => {\n return function (this: unknown, ...rest: Parameters): ReturnType {\n try {\n return fn.call(this, ...rest) as ReturnType;\n } catch (err) {\n console.warn('[I18N Error]: ', err);\n // Currently, we are throwing the error as it is to consumers.\n // In the future, this can be modified as per our requirement, like an error logging service.\n throw new I18nifyError(err as string | undefined);\n }\n };\n};\n","import { I18nState } from './types';\nimport { getDefaultState } from '../utils/getDefaultState';\n\nexport class I18nStateManager {\n private static instance: I18nStateManager | undefined;\n private state: I18nState;\n\n private constructor() {\n this.state = getDefaultState();\n }\n\n public static getInstance(): I18nStateManager {\n if (!I18nStateManager.instance) {\n I18nStateManager.instance = new I18nStateManager();\n }\n\n return I18nStateManager.instance;\n }\n\n public static resetInstance(): void {\n I18nStateManager.instance = undefined;\n }\n\n public getState(): I18nState {\n return { ...this.state };\n }\n\n public setState(newState: Partial): void {\n this.state = { ...this.state, ...newState };\n }\n\n public resetState(): void {\n this.state = getDefaultState();\n }\n}\n\nexport default I18nStateManager.getInstance();\n","import type { I18nState } from '../state/types';\n\nexport function getDefaultState(): I18nState {\n return {\n locale: '',\n direction: '',\n country: '',\n };\n}\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * function to return active i18n state\n *\n * ===== USAGE =====\n * import { getState } from '@razorpay/i18nify-js';\n *\n * console.log(getState())\n *\n * @returns i18n state\n */\nconst getState = (): I18nState => {\n return state.getState();\n};\n\nexport default withErrorBoundary(getState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * Function to set and override the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { setState } from \"@razorpay/i18nify-js\";\n * setState({locale: 'en-US'})\n *\n * @param newState data to set in i18nState instance\n */\nconst setState = (newState: Partial): void => {\n state.setState(newState);\n};\n\nexport default withErrorBoundary(setState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\n\n/**\n * Function to reset the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { resetState } from \"@razorpay/i18nify-js\";\n * resetState()\n *\n * @param newState data to set in i18nState instance\n */\nconst resetState = (): void => {\n state.resetState();\n};\n\nexport default withErrorBoundary(resetState);\n","export const getLocale = (): string => {\n // Check if running in a non-browser environment (e.g., Node.js or older browsers).\n if (typeof navigator === 'undefined') {\n return 'en-IN';\n }\n\n // Check if the browser supports the Intl object and user language preferences.\n if (\n window.Intl &&\n typeof window.Intl === 'object' &&\n (window.navigator.languages || window.navigator.language)\n ) {\n const userLocales = window.navigator.languages || [\n window.navigator.language,\n ];\n return userLocales[0];\n }\n\n // Fallback to a supported locale or the default locale.\n return 'en-IN';\n};\n","import { CURRENCIES } from '../../currency/data/currencies';\nimport state from '../state';\nimport { getLocale } from './getLocale';\n\nexport const getIntlInstanceWithOptions = (\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n) => {\n /** retrieve locale from below areas in order of preference\n * 1. options.locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n let locale = options?.locale || state.getState().locale;\n\n // If a specific locale is provided, use it; otherwise, use the browser's locale\n if (!locale) {\n locale = getLocale();\n }\n\n const intlOptions = options?.intlOptions ? { ...options.intlOptions } : {};\n\n if (options?.currency || intlOptions.currency) {\n intlOptions.style = 'currency';\n intlOptions.currency = (options.currency || intlOptions.currency) as string;\n }\n\n if (!locale) throw new Error('Pass valid locale !');\n\n return new Intl.NumberFormat(locale || undefined, intlOptions);\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\n\n// this function formats number based on different arguments passed\nconst formatNumber = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): string => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n let formattedAmount = '';\n\n try {\n formattedAmount = getIntlInstanceWithOptions(options).format(\n Number(amount),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedAmount;\n};\n\nexport default withErrorBoundary(formatNumber);\n","export const CURRENCIES: { [key: string]: { symbol: string; name: string } } = {\n AED: { symbol: 'د.إ', name: 'United Arab Emirates Dirham' },\n ALL: { symbol: 'Lek', name: 'Albanian Lek' },\n AMD: { symbol: '֏', name: 'Armenian Dram' },\n ARS: { symbol: 'ARS', name: 'Argentine Peso' },\n AUD: { symbol: 'A$', name: 'Australian Dollar' },\n AWG: { symbol: 'Afl.', name: 'Aruban Florin' },\n BBD: { symbol: '$', name: 'Barbadian Dollar' },\n BDT: { symbol: '৳', name: 'Bangladeshi Taka' },\n BMD: { symbol: '$', name: 'Bermudian Dollar' },\n BND: { symbol: 'BND', name: 'Brunei Dollar' },\n BOB: { symbol: 'Bs', name: 'Bolivian Boliviano' },\n BSD: { symbol: 'B$', name: 'Bahamian Dollar' },\n BWP: { symbol: 'P', name: 'Botswanan Pula' },\n BZD: { symbol: 'BZ$', name: 'Belize Dollar' },\n CAD: { symbol: 'C$', name: 'Canadian Dollar' },\n CHF: { symbol: 'CHf', name: 'Swiss Franc' },\n CNY: { symbol: '¥', name: 'Chinese Yuan' },\n COP: { symbol: 'COL$', name: 'Colombian Peso' },\n CRC: { symbol: '₡', name: 'Costa Rican Colón' },\n CUP: { symbol: '$MN', name: 'Cuban Peso' },\n CZK: { symbol: 'Kč', name: 'Czech Koruna' },\n DKK: { symbol: 'DKK', name: 'Danish Krone' },\n DOP: { symbol: 'RD$', name: 'Dominican Peso' },\n DZD: { symbol: 'د.ج', name: 'Algerian Dinar' },\n EGP: { symbol: 'E£', name: 'Egyptian Pound' },\n ETB: { symbol: 'ብር', name: 'Ethiopian Birr' },\n EUR: { symbol: '€', name: 'Euro' },\n FJD: { symbol: 'FJ$', name: 'Fijian Dollar' },\n GBP: { symbol: '£', name: 'British Pound' },\n GHS: { symbol: 'GH₵', name: 'Ghanaian Cedi' },\n GIP: { symbol: 'GIP', name: 'Gibraltar Pound' },\n GMD: { symbol: 'D', name: 'Gambian Dalasi' },\n GTQ: { symbol: 'Q', name: 'Guatemalan Quetzal' },\n GYD: { symbol: 'G$', name: 'Guyanese Dollar' },\n HKD: { symbol: 'HK$', name: 'Hong Kong Dollar' },\n HNL: { symbol: 'HNL', name: 'Honduran Lempira' },\n HRK: { symbol: 'kn', name: 'Croatian Kuna' },\n HTG: { symbol: 'G', name: 'Haitian Gourde' },\n HUF: { symbol: 'Ft', name: 'Hungarian Forint' },\n IDR: { symbol: 'Rp', name: 'Indonesian Rupiah' },\n ILS: { symbol: '₪', name: 'Israeli New Shekel' },\n INR: { symbol: '₹', name: 'Indian Rupee' },\n JMD: { symbol: 'J$', name: 'Jamaican Dollar' },\n KES: { symbol: 'Ksh', name: 'Kenyan Shilling' },\n KGS: { symbol: 'Лв', name: 'Kyrgystani Som' },\n KHR: { symbol: '៛', name: 'Cambodian Riel' },\n KYD: { symbol: 'CI$', name: 'Cayman Islands Dollar' },\n KZT: { symbol: '₸', name: 'Kazakhstani Tenge' },\n LAK: { symbol: '₭', name: 'Laotian Kip' },\n LKR: { symbol: 'රු', name: 'Sri Lankan Rupee' },\n LRD: { symbol: 'L$', name: 'Liberian Dollar' },\n LSL: { symbol: 'LSL', name: 'Lesotho Loti' },\n MAD: { symbol: 'د.م.', name: 'Moroccan Dirham' },\n MDL: { symbol: 'MDL', name: 'Moldovan Leu' },\n MKD: { symbol: 'ден', name: 'Macedonian Denar' },\n MMK: { symbol: 'MMK', name: 'Myanmar Kyat' },\n MNT: { symbol: '₮', name: 'Mongolian Tugrik' },\n MOP: { symbol: 'MOP$', name: 'Macanese Pataca' },\n MUR: { symbol: '₨', name: 'Mauritian Rupee' },\n MVR: { symbol: 'Rf', name: 'Maldivian Rufiyaa' },\n MWK: { symbol: 'MK', name: 'Malawian Kwacha' },\n MXN: { symbol: 'Mex$', name: 'Mexican Peso' },\n MYR: { symbol: 'RM', name: 'Malaysian Ringgit' },\n NAD: { symbol: 'N$', name: 'Namibian Dollar' },\n NGN: { symbol: '₦', name: 'Nigerian Naira' },\n NIO: { symbol: 'NIO', name: 'Nicaraguan Córdoba' },\n NOK: { symbol: 'NOK', name: 'Norwegian Krone' },\n NPR: { symbol: 'रू', name: 'Nepalese Rupee' },\n NZD: { symbol: 'NZ$', name: 'New Zealand Dollar' },\n PEN: { symbol: 'S/', name: 'Peruvian Nuevo Sol' },\n PGK: { symbol: 'PGK', name: 'Papua New Guinean Kina' },\n PHP: { symbol: '₱', name: 'Philippine Peso' },\n PKR: { symbol: '₨', name: 'Pakistani Rupee' },\n QAR: { symbol: 'QR', name: 'Qatari Riyal' },\n RUB: { symbol: '₽', name: 'Russian Ruble' },\n SAR: { symbol: 'SR', name: 'Saudi Riyal' },\n SCR: { symbol: 'SRe', name: 'Seychellois Rupee' },\n SEK: { symbol: 'SEK', name: 'Swedish Krona' },\n SGD: { symbol: 'S$', name: 'Singapore Dollar' },\n SLL: { symbol: 'Le', name: 'Sierra Leonean Leone' },\n SOS: { symbol: 'Sh.so.', name: 'Somali Shilling' },\n SSP: { symbol: 'SS£', name: 'South Sudanese Pound' },\n SVC: { symbol: '₡', name: 'Salvadoran Colón' },\n SZL: { symbol: 'E', name: 'Swazi Lilangeni' },\n THB: { symbol: '฿', name: 'Thai Baht' },\n TTD: { symbol: 'TT$', name: 'Trinidad and Tobago Dollar' },\n TZS: { symbol: 'Sh', name: 'Tanzanian Shilling' },\n USD: { symbol: '$', name: 'United States Dollar' },\n UYU: { symbol: '$U', name: 'Uruguayan Peso' },\n UZS: { symbol: \"so'm\", name: 'Uzbekistani Som' },\n YER: { symbol: '﷼', name: 'Yemeni Rial' },\n ZAR: { symbol: 'R', name: 'South African Rand' },\n KWD: { symbol: 'د.ك', name: 'Kuwaiti Dinar' },\n BHD: { symbol: 'د.ب.', name: 'Bahraini Dinar' },\n OMR: { symbol: 'ر.ع.', name: 'Omani Rial' },\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencyList = () => {\n return CURRENCIES;\n};\n\nexport default withErrorBoundary(getCurrencyList);\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencySymbol = (currencyCode: keyof typeof CURRENCIES): string => {\n if (currencyCode in CURRENCIES) return CURRENCIES[currencyCode]?.symbol;\n else throw new Error('Invalid currencyCode!');\n};\n\nexport default withErrorBoundary(getCurrencySymbol);\n","export const ALLOWED_FORMAT_PARTS_KEYS = [\n 'nan',\n 'infinity',\n 'percent',\n 'integer',\n 'group',\n 'decimal',\n 'fraction',\n 'plusSign',\n 'minusSign',\n 'percentSign',\n 'currency',\n 'code',\n 'symbol',\n 'name',\n 'compact',\n 'exponentInteger',\n 'exponentMinusSign',\n 'exponentSeparator',\n 'unit',\n] as const;\n","import { CURRENCIES } from './data/currencies';\nimport { ByParts, FormattedPartsObject } from './types';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\nimport { ALLOWED_FORMAT_PARTS_KEYS } from './constants';\n\nconst formatNumberByParts = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): ByParts => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n try {\n const formattedAmount = getIntlInstanceWithOptions(options).formatToParts(\n Number(amount),\n );\n\n const parts = formattedAmount;\n\n const formattedObj: FormattedPartsObject = {};\n\n parts.forEach((p) => {\n if (p.type === 'group') {\n formattedObj.integer = (formattedObj.integer || '') + p.value;\n } else if (\n ALLOWED_FORMAT_PARTS_KEYS.findIndex((item) => item === p.type) != -1\n ) {\n // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal' is skipped\n formattedObj[p.type] = (formattedObj[p.type] || '') + p.value;\n }\n });\n\n return {\n ...formattedObj,\n isPrefixSymbol: parts[0].type === 'currency',\n rawParts: parts,\n };\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(\n formatNumberByParts,\n);\n","export const PHONE_REGEX_MAPPER: { [key: string]: RegExp } = {\n IN: /^(?:(?:\\+|0{0,2})91\\s*[-]?\\s*|[0]?)?[6789]\\d{9}$/,\n MY: /^(\\+?6?0)?(\\d{1,3})[-. ]?(\\d{7,8})$/,\n AE: /^(?:\\+?971|0)?(?:2|3|4|6|7|9)\\d{8}$/,\n AL: /^(?:\\+?355)?(?:[4-9]\\d{7}|6\\d{8})$/,\n AM: /^(?:\\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/,\n AR: /^(?:(?:\\+|0{0,2})54)?(?:11|[2368]\\d)(?:(?=\\d{0,2}15)\\d{2})??\\d{8}$/,\n AU: /^(?:\\+?61|0)4\\d{8}$/,\n AW: /^(?:(?:\\+297)?(?!0)\\d{7})$/,\n BB: /^(?:(?:\\+1)?246)?(?:\\d{3})?\\d{7}$/,\n BD: /^(?:\\+?880|0)1[13456789]\\d{8}$/,\n BM: /^(?:(?:\\+1)?441)?(?:\\d{2})?\\d{7}$/,\n BN: /^(?:\\+?673)?(?:\\d{3})?\\d{4}$/,\n BO: /^(?:(?:\\+|0{0,2})591)?(?:(?:2|3|7|6)\\d{7})$/,\n BS: /^(?:(?:\\+1)?242)?(?:\\d{3})?\\d{7}$/,\n BW: /^(?:(?:\\+267)?\\s?)?[74]\\d{7}$/,\n BZ: /^(?:(?:\\+501)?\\s?)?[622]\\d{4}$/,\n CH: /^(?:(?:\\+41|0)(?:\\s*\\(?0\\)?\\s*))?(?:\\d{2}\\s*)?\\d{3}\\s*\\d{2}\\s*\\d{2}$/,\n CN: /^(?:(?:\\+|00)86)?1\\d{10}$/,\n CO: /^(?:(?:\\+57|0057)?)?[1-8]{1}\\d{6,7}$/,\n OM: /^(?:\\+?968)?(?:95|96|97|98)\\d{6}$/,\n CR: /^(?:(?:\\+506)?\\s*|0)?[1-9]\\d{7}$/,\n CU: /^(?:\\+?53)?(?:[5-8]\\d{7})$/,\n CZ: /^(?:\\+?420)?(?:\\d{9})$/,\n DK: /^(?:\\+?45)?(?:\\d{8})$/,\n DO: /^(?:(?:\\+1)?809|1-8(?:00|88|89))(?:\\d{7})$/,\n DZ: /^(?:\\+?213|0)([567]\\d{8})$/,\n EG: /^(?:(?:\\+20|20)?(\\d{10}))$/,\n ET: /^(?:\\+?251)?[1-59]\\d{8}$/,\n EU: /^(?:(?:\\+?3)?8)?\\s*(?:\\d{3}\\s*){3}\\d{2}$/,\n FJ: /^(?:(?:\\+?679)?\\s?\\d{3}\\s?\\d{4})?$/,\n GB: /^(?:(?:\\+44\\s?|0)7\\d{3}(\\s?\\d{4,})?)$/,\n GH: /^(?:(?:\\+233)|0)?(?:\\d{9})$/,\n GI: /^(?:\\+350)?\\d{5}$/,\n GM: /^(?:\\+220)?\\d{5,7}$/,\n GT: /^(?:\\+502)?[2468]\\d{7,8}$/,\n GY: /^(?:(?:\\+592)?(?:(?:\\s)?[2-9])(?:(?:\\s)?\\d))?(?:(?:\\s)?\\d{4})$/,\n HK: /^(?:\\+852\\s?)?[456789]\\d{3}\\s?\\d{4}$/,\n HN: /^(?:\\+504)?[89]\\d{7}$/,\n HR: /^(?:\\+?385)?\\d{8,9}$/,\n HT: /^(?:\\+?509)?\\d{8}$/,\n HU: /^(?:(?:\\+36))(\\s?\\d{2}\\s?\\d{3}\\s?\\d{4})$/,\n ID: /^(?:\\+?62|0[1-9])[\\s-]?\\d{2,4}[\\s-]?\\d{3,4}[\\s-]?\\d{3,4}$/,\n IL: /^(?:(?:\\+972|0)(?:-)?)[23489]\\d{7}$/,\n JM: /^(?:(?:\\+1876))\\d{7,10}$/,\n KE: /^(?:(?:\\+254)|(?:0))(?:\\d{6,7})$/,\n KG: /^(?:\\+996)?\\s?\\d{9}$/,\n KH: /^(?:(?:\\+855)|(?:0))(?:\\s?[1-9]\\d{7,8})$/,\n KY: /^(?:\\+?1\\s?(345))\\d{6}$/,\n KZ: /^(?:\\+?7|8)?7\\d{9}$/,\n LA: /^(?:(?:\\+?856)|0)(20\\d{7,9})$/,\n LK: /^(?:(?:\\+94)|0)(?:\\d{9})$/,\n LR: /^(?:\\+231)[ -\\d]{4}[ -\\d]{4}$/,\n LS: /^(?:(?:\\+?266)|0)?[56]\\d{7}$/,\n MA: /^(?:(?:\\+?212(\\s*[-|\\s*]?\\d{1,9})?)|(?:0))(?:\\d{9})$/,\n MD: /^(?:(?:\\+373)|(?:0))(?:\\d{7,8})$/,\n MK: /^(?:\\+389|0)(?:(?:2[0-4]|[3-9])\\s?)?\\d{6}$/,\n MM: /^(?:(?:\\+?95)|0)?[1-9]\\d{9}$/,\n MN: /^(?:\\+976|0)\\d{8}$/,\n MO: /^(?:(?:\\+?853)|[0-9])?\\d{8}$/,\n MU: /^(?:\\+230|0)?\\d{8}$/,\n MV: /^(?:(?:\\+?960)|0)?\\d{7}$/,\n MW: /^(?:\\+265)[1-9]\\d{6}$/,\n MX: /^(?:(?:\\+?52)?\\s?(?:1|01)?\\s?)?(?:\\d{3}\\s?\\d{3}\\s?\\d{4})$/,\n NA: /^(?:(?:\\+264)|0)?\\d{8}$/,\n NG: /^(?:(?:\\+234)|(?:0))(?:\\d{7,8})$/,\n NI: /^(?:(?:\\+505))?(?:\\d{8})$/,\n NO: /^(?:(?:\\+?47)|\\d{2}|\\d{3})\\s?\\d{2}\\s?\\d{3}$/,\n NP: /^(?:(?:\\+977))?(\\d{9,10})$/,\n NZ: /^(?:\\+?64|0)(\\d{2,5} \\d{4,8}|\\d{3,4} \\d{4})$/,\n PE: /^(?:(?:\\+51)|0)?(?:9\\d{8})$/,\n PG: /^(?:\\+?675)?(?:[7-9]\\d{7})$/,\n PH: /^(?:(?:\\+?63)|0)(?:\\d{10})$/,\n PK: /^(?:(?:\\+92)|0)?[345]\\d{9}$/,\n QA: /^(?:\\+?974)?-?33\\d{5}$/,\n RU: /^(?:\\+?7|8)?[ -]?\\(?9\\d{2}\\)?[ -]?\\d{3}[ -]?\\d{2}[ -]?\\d{2}$/,\n SA: /^(?:\\+?966)?\\s?1?[\\s-]?(?:[45]\\d{2}|5\\d{3})[\\s-]?\\d{4}$/,\n SC: /^(?:(?:\\+248)|\\d{4})\\d{5}$/,\n SE: /^(?:\\+?46|0)\\s?[1-57-9](?:[0-9]\\s?){8}$/,\n SG: /^(?:(?:\\+65)|(?:\\(\\+65\\))|(?:65))\\d{4}\\d{4}$/,\n SL: /^(?:(?:\\+232)|(?:0))?\\d{9}$/,\n SO: /^(?:\\+252|0)?[567]\\d{7}$/,\n SS: /^(?:\\+211|0)?[1-9]\\d{7,9}$/,\n SV: /^(?:(?:\\+?503)|(?:0))(?:\\d{8})$/,\n SZ: /^(?:\\+?268)?\\d{7,8}$/,\n TH: /^(?:(?:\\+66)|0)\\d{9}$/,\n TT: /^(?:(?:\\+?1-868)|\\(?868\\)?)(\\d{7})$/,\n TZ: /^(?:(?:\\+?255)|0)?[67]\\d{8}$/,\n US: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n CA: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n UY: /^(?:(?:\\+598|0)\\s?(9\\d{3}|2\\d{2}|[4-9]\\d{6}))$/,\n UZ: /^(?:\\+?998)?\\s?[3456789]\\d{8}$/,\n YE: /^(?:\\+?967)?(?:\\d{7,8})$/,\n ZA: /^(?:(?:\\+27)|0)(\\d{9})$/,\n KW: /^(?:\\+?965)[569]\\d{7}$/,\n BH: /^(?:\\+?973)?[356]\\d{7}$/,\n TL: /^(?:(?:\\+670)\\s?)?[0-9]{3}\\s?[0-9]{3,4}$/,\n VC: /^(?:(?:\\+1)?784)?(?:\\d{3})?\\d{7}$/,\n VE: /^(?:(?:\\+58)|0)?4\\d{9}$/,\n VN: /^(?:(?:\\+84)|0)?[1-9]\\d{8}$/,\n ZM: /^(?:(?:\\+260)|0)?[123456789]\\d{8,9}$/,\n ZW: /^(?:(?:\\+263)|0)?(?:\\d{9,10})$/,\n LT: /^(?:(?:\\+370)|8)\\d{8}$/,\n LU: /^(?:(?:\\+352)?(6|2(6|7|8|9))\\d{6})$/,\n LV: /^(?:(?:\\+371)?2\\d{7})$/,\n ME: /^(?:(?:\\+382)?[67]\\d{7,20})$/,\n MG: /^(?:(?:\\+261)?3[234568]\\d{7})$/,\n MZ: /^(?:(?:\\+258)|(?:258))?8[234567]\\d{7,8}$/,\n NL: /^(?:(?:\\+31)|0(6(?:\\d{8})|[1-9](?:(?:\\d{8})|(?:\\s\\d{3}\\s\\d{4}))|(?:\\d{8})))$/,\n PA: /^(?:(?:\\+507)\\s?)?[46]\\d{6,7}$/,\n PL: /^(?:(?:\\+48)?(?:\\s?\\d{3}\\s?\\d{3}\\s?\\d{3}|(?:\\d{2}\\s?){4}\\d{2}|\\d{3}-\\d{3}-\\d{3}))$/,\n PR: /^(?:(?:\\+1)?787|939)\\d{7}$/,\n PS: /^(?:(?:\\+970))(5[2349])\\d{7}$/,\n PT: /^(?:(?:\\+351)?9(1\\d|2[1-9]|6[12345789]|7[12345789])\\d{7})$/,\n PY: /^(?:(?:\\+595|0)9[9876]\\d{7})$/,\n RO: /^(?:(?:\\+40|0))(?:7[2-8]\\d{7}|21\\d{8})$/,\n RS: /^(?:(?:\\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/,\n RW: /^(?:(?:\\+250)|(0))\\d{9}$/,\n SI: /^(?:(?:\\+386)|0)?[1-59]\\d{7,8}$/,\n SK: /^(?:(?:\\+421))?(0|9[0-8])\\d{8}$/,\n SM: /^(?:(?:\\+378)|(0549|6\\d{4}))\\d{5}$/,\n SN: /^(?:(?:\\+221)|0)?[3679]\\d{7}$/,\n SR: /^(?:(?:\\+597))\\d{7}$/,\n TG: /^(?:(?:\\+228))\\d{8}$/,\n TJ: /^(?:(?:\\+992))(37|55|77)\\d{7}$/,\n TN: /^(?:(?:\\+216)|22|9[1-9])\\d{7}$/,\n TR: /^(?:(?:\\+90)|(0))\\s?5\\d{9}$/,\n TW: /^(?:(?:\\+886)|0)?9\\d{8}$/,\n UA: /^(?:(?:\\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\\d{7}$/,\n UG: /^(?:(?:\\+256)|0)?[39]\\d{8}$/,\n};\n","/* Source: Google LibPhoneNumber Metadata: https://github.com/google/libphonenumber/blob/master/javascript/i18n/phonenumbers/metadata.js */\n\nexport const DIAL_CODE_MAPPER: { [key: number]: string[] } = {\n 1: [\n 'US',\n 'AG',\n 'AI',\n 'AS',\n 'BB',\n 'BM',\n 'BS',\n 'CA',\n 'DM',\n 'DO',\n 'GD',\n 'GU',\n 'JM',\n 'KN',\n 'KY',\n 'LC',\n 'MP',\n 'MS',\n 'PR',\n 'SX',\n 'TC',\n 'TT',\n 'VC',\n 'VG',\n 'VI',\n ],\n 7: ['RU', 'KZ'],\n 20: ['EG'],\n 27: ['ZA'],\n 30: ['GR'],\n 31: ['NL'],\n 32: ['BE'],\n 33: ['FR'],\n 34: ['ES'],\n 36: ['HU'],\n 39: ['IT', 'VA'],\n 40: ['RO'],\n 41: ['CH'],\n 43: ['AT'],\n 44: ['GB', 'GG', 'IM', 'JE'],\n 45: ['DK'],\n 46: ['SE'],\n 47: ['NO', 'SJ'],\n 48: ['PL'],\n 49: ['DE'],\n 51: ['PE'],\n 52: ['MX'],\n 53: ['CU'],\n 54: ['AR'],\n 55: ['BR'],\n 56: ['CL'],\n 57: ['CO'],\n 58: ['VE'],\n 60: ['MY'],\n 61: ['AU', 'CC', 'CX'],\n 62: ['ID'],\n 63: ['PH'],\n 64: ['NZ'],\n 65: ['SG'],\n 66: ['TH'],\n 81: ['JP'],\n 82: ['KR'],\n 84: ['VN'],\n 86: ['CN'],\n 90: ['TR'],\n 91: ['IN'],\n 92: ['PK'],\n 93: ['AF'],\n 94: ['LK'],\n 95: ['MM'],\n 98: ['IR'],\n 211: ['SS'],\n 212: ['MA', 'EH'],\n 213: ['DZ'],\n 216: ['TN'],\n 218: ['LY'],\n 220: ['GM'],\n 221: ['SN'],\n 222: ['MR'],\n 223: ['ML'],\n 224: ['GN'],\n 225: ['CI'],\n 226: ['BF'],\n 227: ['NE'],\n 228: ['TG'],\n 229: ['BJ'],\n 230: ['MU'],\n 231: ['LR'],\n 232: ['SL'],\n 233: ['GH'],\n 234: ['NG'],\n 235: ['TD'],\n 236: ['CF'],\n 237: ['CM'],\n 238: ['CV'],\n 239: ['ST'],\n 240: ['GQ'],\n 241: ['GA'],\n 242: ['CG'],\n 243: ['CD'],\n 244: ['AO'],\n 245: ['GW'],\n 246: ['IO'],\n 247: ['AC'],\n 248: ['SC'],\n 249: ['SD'],\n 250: ['RW'],\n 251: ['ET'],\n 252: ['SO'],\n 253: ['DJ'],\n 254: ['KE'],\n 255: ['TZ'],\n 256: ['UG'],\n 257: ['BI'],\n 258: ['MZ'],\n 260: ['ZM'],\n 261: ['MG'],\n 262: ['RE', 'YT'],\n 263: ['ZW'],\n 264: ['NA'],\n 265: ['MW'],\n 266: ['LS'],\n 267: ['BW'],\n 268: ['SZ'],\n 269: ['KM'],\n 290: ['SH', 'TA'],\n 291: ['ER'],\n 297: ['AW'],\n 298: ['FO'],\n 299: ['GL'],\n 350: ['GI'],\n 351: ['PT'],\n 352: ['LU'],\n 353: ['IE'],\n 354: ['IS'],\n 355: ['AL'],\n 356: ['MT'],\n 357: ['CY'],\n 358: ['FI', 'AX'],\n 359: ['BG'],\n 370: ['LT'],\n 371: ['LV'],\n 372: ['EE'],\n 373: ['MD'],\n 374: ['AM'],\n 375: ['BY'],\n 376: ['AD'],\n 377: ['MC'],\n 378: ['SM'],\n 380: ['UA'],\n 381: ['RS'],\n 382: ['ME'],\n 383: ['XK'],\n 385: ['HR'],\n 386: ['SI'],\n 387: ['BA'],\n 389: ['MK'],\n 420: ['CZ'],\n 421: ['SK'],\n 423: ['LI'],\n 500: ['FK'],\n 501: ['BZ'],\n 502: ['GT'],\n 503: ['SV'],\n 504: ['HN'],\n 505: ['NI'],\n 506: ['CR'],\n 507: ['PA'],\n 508: ['PM'],\n 509: ['HT'],\n 590: ['GP', 'BL', 'MF'],\n 591: ['BO'],\n 592: ['GY'],\n 593: ['EC'],\n 594: ['GF'],\n 595: ['PY'],\n 596: ['MQ'],\n 597: ['SR'],\n 598: ['UY'],\n 599: ['CW', 'BQ'],\n 670: ['TL'],\n 672: ['NF'],\n 673: ['BN'],\n 674: ['NR'],\n 675: ['PG'],\n 676: ['TO'],\n 677: ['SB'],\n 678: ['VU'],\n 679: ['FJ'],\n 680: ['PW'],\n 681: ['WF'],\n 682: ['CK'],\n 683: ['NU'],\n 685: ['WS'],\n 686: ['KI'],\n 687: ['NC'],\n 688: ['TV'],\n 689: ['PF'],\n 690: ['TK'],\n 691: ['FM'],\n 692: ['MH'],\n 800: ['001'],\n 808: ['001'],\n 850: ['KP'],\n 852: ['HK'],\n 853: ['MO'],\n 855: ['KH'],\n 856: ['LA'],\n 870: ['001'],\n 878: ['001'],\n 880: ['BD'],\n 881: ['001'],\n 882: ['001'],\n 883: ['001'],\n 886: ['TW'],\n 888: ['001'],\n 960: ['MV'],\n 961: ['LB'],\n 962: ['JO'],\n 963: ['SY'],\n 964: ['IQ'],\n 965: ['KW'],\n 966: ['SA'],\n 967: ['YE'],\n 968: ['OM'],\n 970: ['PS'],\n 971: ['AE'],\n 972: ['IL'],\n 973: ['BH'],\n 974: ['QA'],\n 975: ['BT'],\n 976: ['MN'],\n 977: ['NP'],\n 979: ['001'],\n 992: ['TJ'],\n 993: ['TM'],\n 994: ['AZ'],\n 995: ['GE'],\n 996: ['KG'],\n 998: ['UZ'],\n};\n","import { DIAL_CODE_MAPPER } from './data/dialCodeMapper';\nimport { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\n\n/**\n * Determines the country code based on the provided phone number.\n * This function employs a multi-step approach to identify the country code:\n * - If the phone number starts with '+', it extracts the numeric characters\n * and matches the leading digits with known dial codes mapped to countries.\n * - For matched dial codes, it further filters based on country-specific regex patterns\n * to validate the phone number format for those countries.\n * - If the phone number doesn't start with '+', it directly matches the number\n * against regular expressions associated with various countries to identify the code.\n *\n * @param phoneNumber The input phone number (string or number).\n * @returns The detected country code or an empty string if not found.\n */\nexport const detectCountryCodeFromDialCode = (\n phoneNumber: string | number,\n): string => {\n // If the phone number starts with '+', extract numeric characters\n if (phoneNumber.toString().charAt(0) === '+') {\n const cleanedPhoneNumberWithoutPlusPrefix = phoneNumber\n .toString()\n .replace(/\\D/g, '');\n\n const matchingCountries: string[] = [];\n\n // Iterate through dial codes and check for matches with cleaned phone number\n for (const code in DIAL_CODE_MAPPER) {\n if (cleanedPhoneNumberWithoutPlusPrefix.startsWith(code)) {\n matchingCountries.push(...DIAL_CODE_MAPPER[code]);\n }\n }\n\n // Filter matching countries based on phone number validation regex\n const matchedCountryCode = matchingCountries.find((countryCode: string) => {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex && regex.test(phoneNumber.toString())) return countryCode;\n return undefined;\n });\n\n // Return the first matched country code, if any\n return matchedCountryCode || '';\n } else {\n // If phone number doesn't start with '+', directly match against country regexes\n for (const countryCode in PHONE_REGEX_MAPPER) {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex.test(phoneNumber.toString())) {\n return countryCode;\n }\n }\n }\n\n // Return empty string if no country code is detected\n return '';\n};\n\nexport const cleanPhoneNumber = (phoneNumber: string) => {\n // Regular expression to match all characters except numbers and + sign at the start\n const regex = /[^0-9+]|(?!A)\\+/g;\n // Replace matched characters with an empty string\n const cleanedPhoneNumber = phoneNumber.replace(regex, '');\n return phoneNumber[0] === '+' ? `+${cleanedPhoneNumber}` : cleanedPhoneNumber;\n};\n","import { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Validates whether a given phone number is valid based on the provided country code or auto-detects the country code and checks if the number matches the defined regex pattern for that country.\nconst isValidPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_REGEX_MAPPER,\n): boolean => {\n // Clean the provided phoneNumber by removing non-numeric characters\n const cleanedPhoneNumber = cleanPhoneNumber(phoneNumber.toString());\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_REGEX_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(cleanedPhoneNumber);\n\n // Return false if phoneNumber is empty\n if (!phoneNumber) return false;\n\n // Check if the countryCode exists in the PHONE_REGEX_MAPPER\n if (countryCode in PHONE_REGEX_MAPPER) {\n // Fetch the regex pattern for the countryCode\n const regex = PHONE_REGEX_MAPPER[countryCode];\n // Test if the cleanedPhoneNumber matches the regex pattern\n return regex.test(cleanedPhoneNumber as string);\n }\n\n // Return false if the countryCode is not supported\n return false;\n};\n\nexport default withErrorBoundary(isValidPhoneNumber);\n","export const PHONE_FORMATTER_MAPPER: { [key: string]: string } = {\n IN: 'xxxx xxxxxx',\n MY: 'xx xxxxx xx',\n AE: 'xx xxx xxxx',\n AL: 'xxx xx xxxx',\n AM: 'xx xx xx xx',\n AR: 'xxxx-xxxx',\n AU: 'xxx xxx xxx',\n AW: 'xxx-xxxx',\n BB: 'xxx-xxxx',\n BD: 'xxxx-xxxxxx',\n BM: 'xxx-xxxx',\n BN: 'xxxx-xxxx',\n BO: 'xxxx-xxxx',\n BS: 'xxx-xxxx',\n BW: 'xx xxxx xxxx',\n BZ: 'xxx-xxxx',\n CA: 'xxx-xxx-xxxx',\n CH: 'xxx xxx xxx',\n CN: 'xxxx-xxxxxxx',\n CO: 'xxxx-xxxxxxx',\n CR: 'xxxx-xxxx',\n CU: 'xxxx-xxxx',\n CZ: 'xxx xxx xxx',\n DK: 'xx xx xx xx',\n DO: 'xxx-xxxxxxx',\n DZ: 'xxxx-xxxx-xxx',\n EG: 'xx xxx xxxx',\n ET: 'xx xxx xxxx',\n EU: 'xxx xx xx xx',\n FJ: 'xxxx xxxx',\n GB: 'xxxx xxx xxx',\n GH: 'xxx xxx xxxx',\n GI: 'xxxx xxxx',\n GM: 'xxxx-xxxx',\n GT: 'xxxx-xxxx',\n GY: 'xxx-xxxx',\n HK: 'xxxx xxxx',\n HN: 'xxxx-xxxx',\n HR: 'xxx xxx xxxx',\n HT: 'xxx-xxxx',\n HU: 'xxx xxx xxxx',\n ID: 'xxxx-xxxx-xxxx',\n IL: 'xxxx-xxx-xxx',\n JM: 'xxx-xxxx',\n KE: 'xxx xxxxxx',\n KG: 'xxx-xx-xx-xx',\n KH: 'xxx-xxx-xxx',\n KY: 'xxx-xxxx',\n KZ: 'xxx-xxx-xx-xx',\n LA: 'xxx xx xxxx',\n LK: 'xx xxx xxxx',\n LR: 'xxx-xxx-xxxx',\n LS: 'xxx xx xxxx',\n LT: 'xxx xxxxx',\n LU: 'xxx xx xxx',\n LV: 'xxxx xxxx',\n MA: 'xxxx-xxxxxx',\n MD: 'xx xxxxxx',\n ME: 'xx xxxxxx',\n MG: 'xx xx xx xx xx',\n MK: 'xx xx xx xx',\n MM: 'xx xxxxxx',\n MN: 'xxx-xx-xxxx',\n MO: 'xxxx xxxx',\n MU: 'xx xxxx xxxx',\n MV: 'xxxxxx',\n MW: 'xx xxxx xxxx',\n MX: 'xxx-xxx-xxxx',\n MZ: 'xx xxxxxxx',\n NA: 'xx xxxx xxxx',\n NG: 'xxx xxx xxxx',\n NI: 'xxxx-xxxx',\n NL: 'xxx-xxxxxxx',\n NO: 'xxxx xxxx',\n NP: 'xxxx-xxxxxxx',\n NZ: 'xxx-xxxxxxx',\n OM: 'xxxx-xxxx',\n PA: 'xxx-xxxx',\n PE: 'xxx-xxx-xxx',\n PG: 'xxx-xxxxxx',\n PH: 'xxx-xxxx',\n PK: 'xxx-xxxxxxx',\n PL: 'xxx xxx xxx',\n PR: 'xxx-xxx-xxxx',\n PS: 'xxxx-xxxxxxx',\n PT: 'xxx xxx xxx',\n PY: 'xxx-xxxxxx',\n QA: 'xxxx xxxx',\n RO: 'xxx xxx xxxx',\n RS: 'xxx xxxxx',\n RU: 'xxx xxx-xx-xx',\n RW: 'xxx xxxxxx',\n SA: 'xxx-xxxxxxx',\n SC: 'xx xxxxx',\n SE: 'xxx-xxx xx xx',\n SG: 'xxxx xxxx',\n SI: 'xx xxxxxx',\n SK: 'xxx xxx xxx',\n SL: 'xxx-xxxxxx',\n SM: 'xxxxx xxxxx',\n SN: 'xx xxx xx xx',\n SO: 'xxx xxxxxxx',\n SR: 'xxx-xxxx',\n SS: 'xxx xxxx xxx',\n SV: 'xxxx-xxxx',\n SZ: 'xxx xx xxxx',\n TG: 'xx xx xx xx',\n TH: 'xxx-xxxxxxx',\n TJ: 'xxx xx xx xx',\n TL: 'xxx-xxxxxxx',\n TN: 'xx xxxxxx',\n TR: 'xxx xxx xx xx',\n TT: 'xxx-xxxx',\n TW: 'xxxx-xxxxxx',\n TZ: 'xxx xxx xxxx',\n UA: 'xx xxx xx xx',\n UG: 'xxx xxxxxxx',\n US: 'xxx-xxx-xxxx',\n UY: 'xxx-xxxxx',\n UZ: 'xxx-xxx-xx-xx',\n VC: 'xxx-xxxx',\n VE: 'xxxx-xxx-xxxx',\n VN: 'xxxx-xxxxxxx',\n YE: 'xxxx-xxxx',\n ZA: 'xxx-xxx-xxxx',\n ZM: 'xxx-xxxxxxx',\n ZW: 'xx xxx xxxx',\n KW: 'xxx xx xxxx',\n BH: 'xxxx xxxx',\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Formats a provided phone number according to the predefined format for a specific country code, or auto-detects the country code and formats the number accordingly.\nconst formatPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_FORMATTER_MAPPER,\n): string => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Convert phoneNumber to string and clean it by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_FORMATTER_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Fetch the pattern for the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern) return phoneNumber;\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n // Extract the phoneNumber without the prefix\n const phoneNumberWithoutPrefix = phoneNumber.slice(diff);\n const formattedNumber: string[] = [];\n let numberIndex = 0;\n\n // Loop through the pattern to format the phoneNumber\n for (let i = 0; i < pattern.length; i++) {\n const patternChar = pattern[i];\n if (patternChar === 'x') {\n // Insert phoneNumber digits at 'x' positions\n if (numberIndex < phoneNumberWithoutPrefix.length) {\n formattedNumber.push(phoneNumberWithoutPrefix[numberIndex]);\n numberIndex++;\n }\n } else {\n // Insert non-digit characters from the pattern\n formattedNumber.push(patternChar);\n }\n }\n\n // Join the formattedNumber array to create the formattedPhoneNumber without prefix\n const formattedPhoneNumberWithoutPrefix = formattedNumber.join('');\n // Combine the prefix and formattedPhoneNumberWithoutPrefix\n const formattedPhoneNumberWithPrefix =\n phoneNumber.slice(0, diff) + ' ' + formattedPhoneNumberWithoutPrefix;\n\n // Return the formattedPhoneNumber with prefix after trimming whitespace\n return formattedPhoneNumberWithPrefix.trim();\n};\n\nexport default withErrorBoundary(formatPhoneNumber);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport formatPhoneNumber from './formatPhoneNumber';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\ninterface PhoneInfo {\n countryCode: string;\n dialCode: string;\n formattedPhoneNumber: string;\n formatTemplate: string;\n}\n\n// Parses a given phone number, identifies its country code (if not provided), and returns an object with details including the country code, formatted phone number, dial code, and format template.\nconst parsePhoneNumber = (phoneNumber: string, country?: string): PhoneInfo => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Clean the phoneNumber by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n const countryCode =\n country && country in PHONE_FORMATTER_MAPPER\n ? country\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Format the phone number using the detected/validated country code\n const formattedPhoneNumber = formatPhoneNumber(phoneNumber, countryCode);\n\n // Fetch the pattern associated with the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern)\n return {\n countryCode: countryCode || '',\n dialCode: '',\n formattedPhoneNumber: phoneNumber,\n formatTemplate: '',\n };\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n\n // Extract the dialCode from the phoneNumber\n const dialCode = phoneNumber.slice(0, diff);\n\n // Obtain the format template associated with the countryCode\n const formatTemplate = PHONE_FORMATTER_MAPPER[countryCode];\n\n // Return the parsed phone number information\n return {\n countryCode,\n formattedPhoneNumber,\n dialCode,\n formatTemplate,\n };\n};\n\nexport default withErrorBoundary(parsePhoneNumber);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Adds a specified amount of time to a date.\n *\n * @param date The original date.\n * @param value The amount to add.\n * @param unit The unit of time to add (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time added.\n */\nconst add = (\n date: Date,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n const result = new Date(date);\n switch (unit) {\n case 'days':\n result.setDate(result.getDate() + value);\n break;\n case 'months':\n result.setMonth(result.getMonth() + value);\n break;\n case 'years':\n result.setFullYear(result.getFullYear() + value);\n break;\n }\n return result;\n};\n\nexport default withErrorBoundary(add);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale, DateTimeFormatOptions } from './types';\n\n/**\n * Formats date and time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional).\n * @returns {string} Formatted date and time string.\n */\nconst formatDateTime = (\n date: DateInput,\n locale: Locale,\n options: DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const dateObj: Date = date instanceof Date ? date : new Date(date);\n let formatter;\n\n try {\n formatter = new Intl.DateTimeFormat(locale, options);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formatter.format(dateObj);\n};\n\nexport default withErrorBoundary(formatDateTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n DateFormatOptions,\n} from './types';\n\n/**\n * Formats date based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional).\n * @returns {string} Formatted date string.\n */\nconst formatDate = (\n date: DateInput,\n locale: Locale,\n options: DateFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n timeStyle: undefined,\n };\n\n let formattedDate;\n\n try {\n formattedDate = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedDate;\n};\n\nexport default withErrorBoundary(formatDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n TimeFormatOptions,\n} from './types';\n\n/**\n * Formats time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional).\n * @returns {string} Formatted time string.\n */\nconst formatTime = (\n date: DateInput,\n locale: Locale,\n options: TimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n dateStyle: undefined,\n };\n\n let formattedTime;\n\n try {\n formattedTime = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedTime;\n};\n\nexport default withErrorBoundary(formatTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\n\n/**\n * Gets the first day of the week for a given locale.\n *\n * @param locale The locale to determine the first day of the week for.\n * @returns The first day of the week (0-6, where 0 is Sunday).\n */\nconst getFirstDayOfWeek = (locale: string): number => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n let formatted;\n\n try {\n const formatter = new Intl.DateTimeFormat(locale, { weekday: 'short' });\n const sampleDate = new Date(2000, 0, 2); // A Sunday\n formatted = formatter.format(sampleDate);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return ['su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'].indexOf(\n formatted.slice(0, 2).toLowerCase(),\n );\n};\n\nexport default withErrorBoundary(getFirstDayOfWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Determines the quarter of the year for a given date.\n *\n * @param date The date to determine the quarter for.\n * @returns The quarter of the year (1-4).\n */\nconst getQuarter = (date: Date): number => {\n return Math.ceil((date.getMonth() + 1) / 3);\n};\n\nexport default withErrorBoundary(getQuarter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Provides a relative time string (e.g., '3 hours ago', 'in 2 days').\n * This function calculates the difference between the given date and the base date,\n * then formats it in a locale-sensitive manner. It allows customization of the output\n * through Intl.RelativeTimeFormat options.\n *\n * @param date - The date to compare.\n * @param baseDate - The date to compare against (default: current date).\n * @param locale - The locale to use for formatting.\n * @param options - Options for the Intl.RelativeTimeFormat (optional).\n * @returns The relative time as a string.\n */\nconst getRelativeTime = (\n date: Date,\n baseDate: Date = new Date(),\n locale: Locale,\n options?: Intl.RelativeTimeFormatOptions,\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000;\n\n // Define time units in seconds\n const minute = 60;\n const hour = minute * 60;\n const day = hour * 24;\n const week = day * 7;\n const month = day * 30;\n const year = day * 365;\n\n let value: number;\n let unit: Intl.RelativeTimeFormatUnit;\n\n if (Math.abs(diffInSeconds) < minute) {\n value = diffInSeconds;\n unit = 'second';\n } else if (Math.abs(diffInSeconds) < hour) {\n value = diffInSeconds / minute;\n unit = 'minute';\n } else if (Math.abs(diffInSeconds) < day) {\n value = diffInSeconds / hour;\n unit = 'hour';\n } else if (Math.abs(diffInSeconds) < week) {\n value = diffInSeconds / day;\n unit = 'day';\n } else if (Math.abs(diffInSeconds) < month) {\n value = diffInSeconds / week;\n unit = 'week';\n } else if (Math.abs(diffInSeconds) < year) {\n value = diffInSeconds / month;\n unit = 'month';\n } else {\n value = diffInSeconds / year;\n unit = 'year';\n }\n\n let relativeTime;\n\n try {\n const rtf = new Intl.RelativeTimeFormat(locale, options);\n relativeTime = rtf.format(Math.round(value), unit);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return relativeTime;\n};\n\nexport default withErrorBoundary(getRelativeTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Calculates the week number of the year for a given date.\n *\n * @param date The date to calculate the week number for.\n * @returns The week number of the year.\n */\nconst getWeek = (date: Date): number => {\n const firstDayOfYear = new Date(date.getFullYear(), 0, 1);\n const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000;\n return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7);\n};\n\nexport default withErrorBoundary(getWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Returns an array of weekdays according to the specified locale.\n *\n * @param locale The locale to get weekdays for.\n * @returns An array of weekday names.\n */\nconst getWeekdays = (locale: Locale): string[] => {\n try {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n const formatter = new Intl.DateTimeFormat(locale, { weekday: 'long' });\n return Array.from({ length: 7 }, (_, i) =>\n formatter.format(new Date(1970, 0, 4 + i)),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(getWeekdays);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\n\n/**\n * Compares two dates to determine if the first is after the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is after date2.\n */\nconst isAfter = (date1: DateInput, date2: DateInput): boolean => {\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 > dateObj2;\n};\n\nexport default withErrorBoundary(isAfter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\n\n/**\n * Compares two dates to determine if the first is before the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is before date2.\n */\nconst isBefore = (date1: DateInput, date2: DateInput): boolean => {\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 < dateObj2;\n};\n\nexport default withErrorBoundary(isBefore);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given year is a leap year.\n *\n * @param year The year to check.\n * @returns True if the year is a leap year, false otherwise.\n */\nconst isLeapYear = (year: number): boolean => {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n};\n\nexport default withErrorBoundary(isLeapYear);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if two dates fall on the same day.\n *\n * @param date1 The first date.\n * @param date2 The second date.\n * @returns True if both dates are on the same day, false otherwise.\n */\nconst isSameDay = (date1: Date, date2: Date): boolean => {\n return (\n date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear()\n );\n};\n\nexport default withErrorBoundary(isSameDay);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given object is a valid Date object.\n *\n * @param date The object to check.\n * @returns True if the object is a valid Date, false otherwise.\n */\nconst isValidDate = (date: any): boolean => {\n return date instanceof Date && !isNaN(date.getTime());\n};\n\nexport default withErrorBoundary(isValidDate);\n","export const LOCALE_DATE_FORMATS: { [key: string]: string } = {\n 'ar-AE': 'DD/MM/YYYY', // Arabic (U.A.E.)\n 'sq-AL': 'DD.MM.YYYY', // Albanian (Albania)\n 'hy-AM': 'DD.MM.YYYY', // Armenian (Armenia)\n 'es-AR': 'DD/MM/YYYY', // Spanish (Argentina)\n 'en-AU': 'DD/MM/YYYY', // English (Australia)\n 'nl-AW': 'DD-MM-YYYY', // Dutch (Aruba)\n 'en-BB': 'MM/DD/YYYY', // English (Barbados)\n 'bn-BD': 'DD/MM/YYYY', // Bengali (Bangladesh)\n 'en-BM': 'MM/DD/YYYY', // English (Bermuda)\n 'ms-BN': 'DD/MM/YYYY', // Malay (Brunei)\n 'es-BO': 'DD/MM/YYYY', // Spanish (Bolivia)\n 'en-BS': 'MM/DD/YYYY', // English (Bahamas)\n 'en-BW': 'DD/MM/YYYY', // English (Botswana)\n 'en-BZ': 'MM/DD/YYYY', // English (Belize)\n 'en-CA': 'DD/MM/YYYY', // English (Canada)\n 'de-CH': 'DD.MM.YYYY', // German (Switzerland)\n 'zh-CN': 'YYYY/MM/DD', // Chinese (China)\n 'es-CO': 'DD/MM/YYYY', // Spanish (Colombia)\n 'es-CR': 'DD/MM/YYYY', // Spanish (Costa Rica)\n 'es-CU': 'DD/MM/YYYY', // Spanish (Cuba)\n 'cs-CZ': 'DD.MM.YYYY', // Czech (Czech Republic)\n 'da-DK': 'DD-MM-YYYY', // Danish (Denmark)\n 'es-DO': 'DD/MM/YYYY', // Spanish (Dominican Republic)\n 'ar-DZ': 'DD/MM/YYYY', // Arabic (Algeria)\n 'ar-EG': 'DD/MM/YYYY', // Arabic (Egypt)\n 'am-ET': 'DD/MM/YYYY', // Amharic (Ethiopia)\n 'en-EU': 'DD/MM/YYYY', // English (European Union)\n 'en-FJ': 'DD/MM/YYYY', // English (Fiji)\n 'en-GB': 'DD/MM/YYYY', // English (United Kingdom)\n 'en-GH': 'DD/MM/YYYY', // English (Ghana)\n 'en-GI': 'DD/MM/YYYY', // English (Gibraltar)\n 'en-GM': 'DD/MM/YYYY', // English (Gambia)\n 'es-GT': 'DD/MM/YYYY', // Spanish (Guatemala)\n 'en-GY': 'DD/MM/YYYY', // English (Guyana)\n 'en-HK': 'DD/MM/YYYY', // English (Hong Kong)\n 'es-HN': 'DD/MM/YYYY', // Spanish (Honduras)\n 'hr-HR': 'DD.MM.YYYY', // Croatian (Croatia)\n 'ht-HT': 'MM/DD/YYYY', // Haitian (Haiti)\n 'hu-HU': 'YYYY. MM. DD.', // Hungarian (Hungary)\n 'id-ID': 'DD/MM/YYYY', // Indonesian (Indonesia)\n 'he-IL': 'DD/MM/YYYY', // Hebrew (Israel)\n 'en-IN': 'DD-MM-YYYY', // English (India)\n 'en-JM': 'MM/DD/YYYY', // English (Jamaica)\n 'en-KE': 'DD/MM/YYYY', // English (Kenya)\n 'ky-KG': 'DD.MM.YYYY', // Kyrgyz (Kyrgyzstan)\n 'km-KH': 'DD/MM/YYYY', // Khmer (Cambodia)\n 'en-KY': 'MM/DD/YYYY', // English (Cayman Islands)\n 'kk-KZ': 'DD.MM.YYYY', // Kazakh (Kazakhstan)\n 'lo-LA': 'DD/MM/YYYY', // Lao (Laos)\n 'si-LK': 'YYYY-MM-DD', // Sinhala (Sri Lanka)\n 'en-LR': 'MM/DD/YYYY', // English (Liberia)\n 'en-LS': 'DD/MM/YYYY', // English (Lesotho)\n 'ar-MA': 'DD/MM/YYYY', // Arabic (Morocco)\n 'ro-MD': 'DD.MM.YYYY', // Romanian (Moldova)\n 'mk-MK': 'DD.MM.YYYY', // Macedonian (North Macedonia)\n 'my-MM': 'DD/MM/YYYY', // Burmese (Myanmar)\n 'mn-MN': 'YYYY.MM.DD', // Mongolian (Mongolia)\n 'zh-MO': 'DD/MM/YYYY', // Chinese (Macao)\n 'en-MU': 'DD/MM/YYYY', // English (Mauritius)\n 'dv-MV': 'DD/MM/YYYY', // Divehi (Maldives)\n 'en-MW': 'DD/MM/YYYY', // English (Malawi)\n 'es-MX': 'DD/MM/YYYY', // Spanish (Mexico)\n 'ms-MY': 'DD/MM/YYYY', // Malay (Malaysia)\n 'en-NA': 'DD/MM/YYYY', // English (Namibia)\n 'en-NG': 'DD/MM/YYYY', // English (Nigeria)\n 'es-NI': 'DD/MM/YYYY', // Spanish (Nicaragua)\n 'no-NO': 'DD.MM.YYYY', // Norwegian (Norway)\n 'ne-NP': 'YYYY/MM/DD', // Nepali (Nepal)\n 'en-NZ': 'DD/MM/YYYY', // English (New Zealand)\n 'es-PE': 'DD/MM/YYYY', // Spanish (Peru)\n 'en-PG': 'DD/MM/YYYY', // English (Papua New Guinea)\n 'en-PH': 'MM/DD/YYYY', // English (Philippines)\n 'en-PK': 'DD/MM/YYYY', // English (Pakistan)\n 'ar-QA': 'DD/MM/YYYY', // Arabic (Qatar)\n 'ru-RU': 'DD.MM.YYYY', // Russian (Russia)\n 'ar-SA': 'DD/MM/YYYY', // Arabic (Saudi Arabia)\n 'en-SC': 'DD/MM/YYYY', // English (Seychelles)\n 'sv-SE': 'YYYY-MM-DD', // Swedish (Sweden)\n 'en-SG': 'DD/MM/YYYY', // English (Singapore)\n 'en-SL': 'DD/MM/YYYY', // English (Sierra Leone)\n 'so-SO': 'DD/MM/YYYY', // Somali (Somalia)\n 'en-SS': 'DD/MM/YYYY', // English (South Sudan)\n 'es-SV': 'DD/MM/YYYY', // Spanish (El Salvador)\n 'en-SZ': 'DD/MM/YYYY', // English (Eswatini)\n 'th-TH': 'DD/MM/YYYY', // Thai (Thailand)\n 'en-TT': 'MM/DD/YYYY', // English (Trinidad and Tobago)\n 'sw-TZ': 'DD/MM/YYYY', // Swahili (Tanzania)\n 'en-US': 'MM/DD/YYYY', // English (United States)\n 'es-UY': 'DD/MM/YYYY', // Spanish (Uruguay)\n 'uz-UZ': 'DD/MM/YYYY', // Uzbek (Uzbekistan)\n 'ar-YE': 'DD/MM/YYYY', // Arabic (Yemen)\n 'en-ZA': 'YYYY/MM/DD', // English (South Africa)\n 'ar-KW': 'DD/MM/YYYY', // Arabic (Kuwait)\n 'ar-BH': 'DD/MM/YYYY', // Arabic (Bahrain)\n 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman)\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Parses a date string based on a specific format.\n *\n * @param dateString The date string to parse.\n * @param format The format to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDateWithFormat = (\n dateString: string,\n format: string,\n): Date | null => {\n // Determine the separator based on the format (supports '/', '.', or '-')\n const separator = format.includes('/')\n ? '/'\n : format.includes('.')\n ? '.'\n : '-';\n const formatParts = format.split(separator);\n const dateParts = dateString.split(separator).map((num) => parseInt(num, 10));\n\n let year: number = 0,\n month: number = 0,\n day: number = 0;\n let yearSet: boolean = false,\n monthSet: boolean = false,\n daySet: boolean = false;\n\n // Check for format and date string mismatch\n if (dateParts.length !== formatParts.length) {\n return null; // Mismatch between date string and format\n }\n\n formatParts.forEach((part, index) => {\n // Check for non-numeric values in date string\n if (isNaN(dateParts[index])) {\n return null; // Invalid date part\n }\n\n // Assign year, month, and day based on the format\n switch (part) {\n case 'DD':\n day = dateParts[index];\n daySet = true;\n break;\n case 'MM':\n month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date\n monthSet = true;\n break;\n case 'YYYY':\n year = dateParts[index];\n yearSet = true;\n break;\n }\n });\n\n // Validate and create the date only if all parts are set\n if (yearSet && monthSet && daySet) {\n const parsedDate = new Date(year, month, day);\n // Validate date to catch invalid dates like February 30th\n if (\n parsedDate.getFullYear() === year &&\n parsedDate.getMonth() === month &&\n parsedDate.getDate() === day\n ) {\n return parsedDate;\n }\n }\n return null; // Invalid date or incomplete date information\n};\n\nexport default withErrorBoundary(\n parseDateWithFormat,\n);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { LOCALE_DATE_FORMATS } from './data/localeDateFormats';\nimport parseDateWithFormat from './parseDateWithFormat';\nimport { Locale } from './types';\n\n/**\n * Attempts to parse a string into a date object based on locale.\n * Uses the localeDateFormats mapping for determining the date format.\n *\n * @param dateString - The date string to parse.\n * @param locale - The locale to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDate = (dateString: string, locale: Locale): Date | null => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const format = LOCALE_DATE_FORMATS[locale];\n if (!format) {\n throw new Error(`No date format found for locale: ${locale}`);\n }\n return parseDateWithFormat(dateString, format);\n};\n\nexport default withErrorBoundary(parseDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport add from './add';\n\n/**\n * Subtracts a specified amount of time from a date.\n *\n * @param date The original date.\n * @param value The amount to subtract.\n * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time subtracted.\n */\nconst subtract = (\n date: Date,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n return add(date, -value, unit); // Reuse the add function with negative value\n};\n\nexport default withErrorBoundary(subtract);\n"],"names":["I18nifyError","Error","constructor","message","super","this","name","timestamp","Date","withErrorBoundary","fn","rest","call","err","console","warn","I18nStateManager","state","locale","direction","country","getInstance","instance","resetInstance","undefined","getState","Object","assign","setState","newState","resetState","getState$1","setState$1","resetState$1","getLocale","navigator","window","Intl","languages","language","getIntlInstanceWithOptions","options","intlOptions","currency","style","NumberFormat","formatNumber$1","amount","Number","formattedAmount","format","CURRENCIES","AED","symbol","ALL","AMD","ARS","AUD","AWG","BBD","BDT","BMD","BND","BOB","BSD","BWP","BZD","CAD","CHF","CNY","COP","CRC","CUP","CZK","DKK","DOP","DZD","EGP","ETB","EUR","FJD","GBP","GHS","GIP","GMD","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","JMD","KES","KGS","KHR","KYD","KZT","LAK","LKR","LRD","LSL","MAD","MDL","MKD","MMK","MNT","MOP","MUR","MVR","MWK","MXN","MYR","NAD","NGN","NIO","NOK","NPR","NZD","PEN","PGK","PHP","PKR","QAR","RUB","SAR","SCR","SEK","SGD","SLL","SOS","SSP","SVC","SZL","THB","TTD","TZS","USD","UYU","UZS","YER","ZAR","KWD","BHD","OMR","getCurrencyList$1","getCurrencySymbol$1","currencyCode","_a","ALLOWED_FORMAT_PARTS_KEYS","formatNumberByParts$1","parts","formatToParts","formattedObj","forEach","p","type","integer","value","findIndex","item","isPrefixSymbol","rawParts","PHONE_REGEX_MAPPER","IN","MY","AE","AL","AM","AR","AU","AW","BB","BD","BM","BN","BO","BS","BW","BZ","CH","CN","CO","OM","CR","CU","CZ","DK","DO","DZ","EG","ET","EU","FJ","GB","GH","GI","GM","GT","GY","HK","HN","HR","HT","HU","ID","IL","JM","KE","KG","KH","KY","KZ","LA","LK","LR","LS","MA","MD","MK","MM","MN","MO","MU","MV","MW","MX","NA","NG","NI","NO","NP","NZ","PE","PG","PH","PK","QA","RU","SA","SC","SE","SG","SL","SO","SS","SV","SZ","TH","TT","TZ","US","CA","UY","UZ","YE","ZA","KW","BH","TL","VC","VE","VN","ZM","ZW","LT","LU","LV","ME","MG","MZ","NL","PA","PL","PR","PS","PT","PY","RO","RS","RW","SI","SK","SM","SN","SR","TG","TJ","TN","TR","TW","UA","UG","DIAL_CODE_MAPPER","detectCountryCodeFromDialCode","phoneNumber","toString","charAt","cleanedPhoneNumberWithoutPlusPrefix","replace","matchingCountries","code","startsWith","push","find","countryCode","regex","test","cleanPhoneNumber","cleanedPhoneNumber","isValidPhoneNumber$1","PHONE_FORMATTER_MAPPER","formatPhoneNumber$1","pattern","charCountInFormatterPattern","i","length","diff","phoneNumberWithoutPrefix","slice","formattedNumber","numberIndex","patternChar","formattedPhoneNumberWithoutPrefix","join","trim","parsePhoneNumber$1","formattedPhoneNumber","formatPhoneNumber","dialCode","formatTemplate","add$1","date","unit","result","setDate","getDate","setMonth","getMonth","setFullYear","getFullYear","formatDateTime$1","dateObj","formatter","DateTimeFormat","formatDate$1","fullOptions","timeStyle","formattedDate","formatDateTime","formatTime$1","dateStyle","formattedTime","getFirstDayOfWeek$1","formatted","weekday","sampleDate","indexOf","toLowerCase","getQuarter$1","Math","ceil","getRelativeTime$1","baseDate","diffInSeconds","getTime","hour","minute","day","week","month","year","relativeTime","abs","RelativeTimeFormat","round","getWeek$1","firstDayOfYear","pastDaysOfYear","getDay","getWeekdays$1","Array","from","_","isAfter$1","date1","date2","isBefore$1","isLeapYear$1","isSameDay$1","isValidDate$1","isNaN","LOCALE_DATE_FORMATS","parseDateWithFormat$1","dateString","separator","includes","formatParts","split","dateParts","map","num","parseInt","yearSet","monthSet","daySet","part","index","parsedDate","parseDate$1","parseDateWithFormat","subtract$1","add"],"mappings":"AACM,MAAOA,UAAqBC,MAEhC,WAAAC,CAAYC,GACVC,MAAMD,GACNE,KAAKC,KAAO,gBACZD,KAAKE,UAAY,IAAIC,IAEtB,EAYI,MAAMC,EACXC,GAEO,YAA4BC,GACjC,IACE,OAAOD,EAAGE,KAAKP,QAASM,EACzB,CAAC,MAAOE,GAIP,MAHAC,QAAQC,KAAK,iBAAkBF,GAGzB,IAAIb,EAAaa,EACxB,CACH,QC7BWG,EAIX,WAAAd,GACEG,KAAKY,MCLA,CACLC,OAAQ,GACRC,UAAW,GACXC,QAAS,GDGV,CAEM,kBAAOC,GAKZ,OAJKL,EAAiBM,WACpBN,EAAiBM,SAAW,IAAIN,GAG3BA,EAAiBM,QACzB,CAEM,oBAAOC,GACZP,EAAiBM,cAAWE,CAC7B,CAEM,QAAAC,GACL,OAAYC,OAAAC,OAAA,CAAA,EAAAtB,KAAKY,MAClB,CAEM,QAAAW,CAASC,GACdxB,KAAKY,MAAaS,OAAAC,OAAAD,OAAAC,OAAA,CAAA,EAAAtB,KAAKY,OAAUY,EAClC,CAEM,UAAAC,GACLzB,KAAKY,MC7BA,CACLC,OAAQ,GACRC,UAAW,GACXC,QAAS,GD2BV,EAGH,IAAeH,EAAAD,EAAiBK,cElBhC,IAAeU,EAAAtB,GAJE,IACRQ,EAAMQ,aCEf,IAAeO,EAAAvB,GAJGoB,IAChBZ,EAAMW,SAASC,EAAS,ICE1B,IAAeI,EAAAxB,GAJI,KACjBQ,EAAMa,YAAY,ICbb,MAAMI,EAAY,KAEvB,GAAyB,oBAAdC,UACT,MAAO,QAIT,GACEC,OAAOC,MACgB,iBAAhBD,OAAOC,OACbD,OAAOD,UAAUG,WAAaF,OAAOD,UAAUI,UAChD,CAIA,OAHoBH,OAAOD,UAAUG,WAAa,CAChDF,OA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,OAAO,KA2BT,GAxBAiF,EAAYnP,SAAQ,CAAC4P,EAAMC,KAEzB,GAAIhB,MAAMQ,EAAUQ,IAClB,OAAO,KAIT,OAAQD,GACN,IAAK,KACHtC,EAAM+B,EAAUQ,GAChBF,GAAS,EACT,MACF,IAAK,KACHnC,EAAQ6B,EAAUQ,GAAS,EAC3BH,GAAW,EACX,MACF,IAAK,OACHjC,EAAO4B,EAAUQ,GACjBJ,GAAU,EAEb,IAICA,GAAWC,GAAYC,EAAQ,CACjC,MAAMG,EAAa,IAAInZ,KAAK8W,EAAMD,EAAOF,GAEzC,GACEwC,EAAWpE,gBAAkB+B,GAC7BqC,EAAWtE,aAAegC,GAC1BsC,EAAWxE,YAAcgC,EAEzB,OAAOwC,CAEV,CACD,OAAO,IAAI,ICvCb,IAAeC,EAAAnZ,GAfG,CAACoY,EAAoB3X,KAMhCA,IAAQA,EAASD,EAAMQ,WAAWP,QAAUgB,KAEjD,MAAMgB,EAASyV,EAAoBzX,GACnC,IAAKgC,EACH,MAAM,IAAIjD,MAAM,oCAAoCiB,KAEtD,OAAO2Y,EAAoBhB,EAAY3V,EAAO,ICRhD,IAAe4W,EAAArZ,GARE,CACfsU,EACA9K,EACA+K,IAEO+E,EAAIhF,GAAO9K,EAAO+K"} \ No newline at end of file diff --git a/lib/esm/phoneNumber/index.d.ts b/lib/esm/phoneNumber/index.d.ts new file mode 100644 index 00000000..07f11fac --- /dev/null +++ b/lib/esm/phoneNumber/index.d.ts @@ -0,0 +1,13 @@ +declare const _default$2: (phoneNumber: string | number, countryCode?: string | number | undefined) => boolean; + +declare const _default$1: (phoneNumber: string | number, countryCode?: string | number | undefined) => string; + +interface PhoneInfo { + countryCode: string; + dialCode: string; + formattedPhoneNumber: string; + formatTemplate: string; +} +declare const _default: (phoneNumber: string, country?: string | undefined) => PhoneInfo; + +export { _default$1 as formatPhoneNumber, _default$2 as isValidPhoneNumber, _default as parsePhoneNumber }; diff --git a/lib/esm/phoneNumber/index.js b/lib/esm/phoneNumber/index.js new file mode 100644 index 00000000..f0eb1423 --- /dev/null +++ b/lib/esm/phoneNumber/index.js @@ -0,0 +1,723 @@ +const PHONE_REGEX_MAPPER = { + IN: /^(?:(?:\+|0{0,2})91\s*[-]?\s*|[0]?)?[6789]\d{9}$/, + MY: /^(\+?6?0)?(\d{1,3})[-. ]?(\d{7,8})$/, + AE: /^(?:\+?971|0)?(?:2|3|4|6|7|9)\d{8}$/, + AL: /^(?:\+?355)?(?:[4-9]\d{7}|6\d{8})$/, + AM: /^(?:\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/, + AR: /^(?:(?:\+|0{0,2})54)?(?:11|[2368]\d)(?:(?=\d{0,2}15)\d{2})??\d{8}$/, + AU: /^(?:\+?61|0)4\d{8}$/, + AW: /^(?:(?:\+297)?(?!0)\d{7})$/, + BB: /^(?:(?:\+1)?246)?(?:\d{3})?\d{7}$/, + BD: /^(?:\+?880|0)1[13456789]\d{8}$/, + BM: /^(?:(?:\+1)?441)?(?:\d{2})?\d{7}$/, + BN: /^(?:\+?673)?(?:\d{3})?\d{4}$/, + BO: /^(?:(?:\+|0{0,2})591)?(?:(?:2|3|7|6)\d{7})$/, + BS: /^(?:(?:\+1)?242)?(?:\d{3})?\d{7}$/, + BW: /^(?:(?:\+267)?\s?)?[74]\d{7}$/, + BZ: /^(?:(?:\+501)?\s?)?[622]\d{4}$/, + CH: /^(?:(?:\+41|0)(?:\s*\(?0\)?\s*))?(?:\d{2}\s*)?\d{3}\s*\d{2}\s*\d{2}$/, + CN: /^(?:(?:\+|00)86)?1\d{10}$/, + CO: /^(?:(?:\+57|0057)?)?[1-8]{1}\d{6,7}$/, + OM: /^(?:\+?968)?(?:95|96|97|98)\d{6}$/, + CR: /^(?:(?:\+506)?\s*|0)?[1-9]\d{7}$/, + CU: /^(?:\+?53)?(?:[5-8]\d{7})$/, + CZ: /^(?:\+?420)?(?:\d{9})$/, + DK: /^(?:\+?45)?(?:\d{8})$/, + DO: /^(?:(?:\+1)?809|1-8(?:00|88|89))(?:\d{7})$/, + DZ: /^(?:\+?213|0)([567]\d{8})$/, + EG: /^(?:(?:\+20|20)?(\d{10}))$/, + ET: /^(?:\+?251)?[1-59]\d{8}$/, + EU: /^(?:(?:\+?3)?8)?\s*(?:\d{3}\s*){3}\d{2}$/, + FJ: /^(?:(?:\+?679)?\s?\d{3}\s?\d{4})?$/, + GB: /^(?:(?:\+44\s?|0)7\d{3}(\s?\d{4,})?)$/, + GH: /^(?:(?:\+233)|0)?(?:\d{9})$/, + GI: /^(?:\+350)?\d{5}$/, + GM: /^(?:\+220)?\d{5,7}$/, + GT: /^(?:\+502)?[2468]\d{7,8}$/, + GY: /^(?:(?:\+592)?(?:(?:\s)?[2-9])(?:(?:\s)?\d))?(?:(?:\s)?\d{4})$/, + HK: /^(?:\+852\s?)?[456789]\d{3}\s?\d{4}$/, + HN: /^(?:\+504)?[89]\d{7}$/, + HR: /^(?:\+?385)?\d{8,9}$/, + HT: /^(?:\+?509)?\d{8}$/, + HU: /^(?:(?:\+36))(\s?\d{2}\s?\d{3}\s?\d{4})$/, + ID: /^(?:\+?62|0[1-9])[\s-]?\d{2,4}[\s-]?\d{3,4}[\s-]?\d{3,4}$/, + IL: /^(?:(?:\+972|0)(?:-)?)[23489]\d{7}$/, + JM: /^(?:(?:\+1876))\d{7,10}$/, + KE: /^(?:(?:\+254)|(?:0))(?:\d{6,7})$/, + KG: /^(?:\+996)?\s?\d{9}$/, + KH: /^(?:(?:\+855)|(?:0))(?:\s?[1-9]\d{7,8})$/, + KY: /^(?:\+?1\s?(345))\d{6}$/, + KZ: /^(?:\+?7|8)?7\d{9}$/, + LA: /^(?:(?:\+?856)|0)(20\d{7,9})$/, + LK: /^(?:(?:\+94)|0)(?:\d{9})$/, + LR: /^(?:\+231)[ -\d]{4}[ -\d]{4}$/, + LS: /^(?:(?:\+?266)|0)?[56]\d{7}$/, + MA: /^(?:(?:\+?212(\s*[-|\s*]?\d{1,9})?)|(?:0))(?:\d{9})$/, + MD: /^(?:(?:\+373)|(?:0))(?:\d{7,8})$/, + MK: /^(?:\+389|0)(?:(?:2[0-4]|[3-9])\s?)?\d{6}$/, + MM: /^(?:(?:\+?95)|0)?[1-9]\d{9}$/, + MN: /^(?:\+976|0)\d{8}$/, + MO: /^(?:(?:\+?853)|[0-9])?\d{8}$/, + MU: /^(?:\+230|0)?\d{8}$/, + MV: /^(?:(?:\+?960)|0)?\d{7}$/, + MW: /^(?:\+265)[1-9]\d{6}$/, + MX: /^(?:(?:\+?52)?\s?(?:1|01)?\s?)?(?:\d{3}\s?\d{3}\s?\d{4})$/, + NA: /^(?:(?:\+264)|0)?\d{8}$/, + NG: /^(?:(?:\+234)|(?:0))(?:\d{7,8})$/, + NI: /^(?:(?:\+505))?(?:\d{8})$/, + NO: /^(?:(?:\+?47)|\d{2}|\d{3})\s?\d{2}\s?\d{3}$/, + NP: /^(?:(?:\+977))?(\d{9,10})$/, + NZ: /^(?:\+?64|0)(\d{2,5} \d{4,8}|\d{3,4} \d{4})$/, + PE: /^(?:(?:\+51)|0)?(?:9\d{8})$/, + PG: /^(?:\+?675)?(?:[7-9]\d{7})$/, + PH: /^(?:(?:\+?63)|0)(?:\d{10})$/, + PK: /^(?:(?:\+92)|0)?[345]\d{9}$/, + QA: /^(?:\+?974)?-?33\d{5}$/, + RU: /^(?:\+?7|8)?[ -]?\(?9\d{2}\)?[ -]?\d{3}[ -]?\d{2}[ -]?\d{2}$/, + SA: /^(?:\+?966)?\s?1?[\s-]?(?:[45]\d{2}|5\d{3})[\s-]?\d{4}$/, + SC: /^(?:(?:\+248)|\d{4})\d{5}$/, + SE: /^(?:\+?46|0)\s?[1-57-9](?:[0-9]\s?){8}$/, + SG: /^(?:(?:\+65)|(?:\(\+65\))|(?:65))\d{4}\d{4}$/, + SL: /^(?:(?:\+232)|(?:0))?\d{9}$/, + SO: /^(?:\+252|0)?[567]\d{7}$/, + SS: /^(?:\+211|0)?[1-9]\d{7,9}$/, + SV: /^(?:(?:\+?503)|(?:0))(?:\d{8})$/, + SZ: /^(?:\+?268)?\d{7,8}$/, + TH: /^(?:(?:\+66)|0)\d{9}$/, + TT: /^(?:(?:\+?1-868)|\(?868\)?)(\d{7})$/, + TZ: /^(?:(?:\+?255)|0)?[67]\d{8}$/, + US: /^(\+\d{1,2}\s?)?([2-9]{1}\d{2}[2-9]{1}\d{6})$/, + CA: /^(\+\d{1,2}\s?)?([2-9]{1}\d{2}[2-9]{1}\d{6})$/, + UY: /^(?:(?:\+598|0)\s?(9\d{3}|2\d{2}|[4-9]\d{6}))$/, + UZ: /^(?:\+?998)?\s?[3456789]\d{8}$/, + YE: /^(?:\+?967)?(?:\d{7,8})$/, + ZA: /^(?:(?:\+27)|0)(\d{9})$/, + KW: /^(?:\+?965)[569]\d{7}$/, + BH: /^(?:\+?973)?[356]\d{7}$/, + TL: /^(?:(?:\+670)\s?)?[0-9]{3}\s?[0-9]{3,4}$/, + VC: /^(?:(?:\+1)?784)?(?:\d{3})?\d{7}$/, + VE: /^(?:(?:\+58)|0)?4\d{9}$/, + VN: /^(?:(?:\+84)|0)?[1-9]\d{8}$/, + ZM: /^(?:(?:\+260)|0)?[123456789]\d{8,9}$/, + ZW: /^(?:(?:\+263)|0)?(?:\d{9,10})$/, + LT: /^(?:(?:\+370)|8)\d{8}$/, + LU: /^(?:(?:\+352)?(6|2(6|7|8|9))\d{6})$/, + LV: /^(?:(?:\+371)?2\d{7})$/, + ME: /^(?:(?:\+382)?[67]\d{7,20})$/, + MG: /^(?:(?:\+261)?3[234568]\d{7})$/, + MZ: /^(?:(?:\+258)|(?:258))?8[234567]\d{7,8}$/, + NL: /^(?:(?:\+31)|0(6(?:\d{8})|[1-9](?:(?:\d{8})|(?:\s\d{3}\s\d{4}))|(?:\d{8})))$/, + PA: /^(?:(?:\+507)\s?)?[46]\d{6,7}$/, + PL: /^(?:(?:\+48)?(?:\s?\d{3}\s?\d{3}\s?\d{3}|(?:\d{2}\s?){4}\d{2}|\d{3}-\d{3}-\d{3}))$/, + PR: /^(?:(?:\+1)?787|939)\d{7}$/, + PS: /^(?:(?:\+970))(5[2349])\d{7}$/, + PT: /^(?:(?:\+351)?9(1\d|2[1-9]|6[12345789]|7[12345789])\d{7})$/, + PY: /^(?:(?:\+595|0)9[9876]\d{7})$/, + RO: /^(?:(?:\+40|0))(?:7[2-8]\d{7}|21\d{8})$/, + RS: /^(?:(?:\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/, + RW: /^(?:(?:\+250)|(0))\d{9}$/, + SI: /^(?:(?:\+386)|0)?[1-59]\d{7,8}$/, + SK: /^(?:(?:\+421))?(0|9[0-8])\d{8}$/, + SM: /^(?:(?:\+378)|(0549|6\d{4}))\d{5}$/, + SN: /^(?:(?:\+221)|0)?[3679]\d{7}$/, + SR: /^(?:(?:\+597))\d{7}$/, + TG: /^(?:(?:\+228))\d{8}$/, + TJ: /^(?:(?:\+992))(37|55|77)\d{7}$/, + TN: /^(?:(?:\+216)|22|9[1-9])\d{7}$/, + TR: /^(?:(?:\+90)|(0))\s?5\d{9}$/, + TW: /^(?:(?:\+886)|0)?9\d{8}$/, + UA: /^(?:(?:\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\d{7}$/, + UG: /^(?:(?:\+256)|0)?[39]\d{8}$/, +}; + +// Custom Error class to extend properties to error object +class I18nifyError extends Error { + constructor(message) { + super(message); + this.name = 'i18nify Error'; + this.timestamp = new Date(); + // more params like type of error/severity can be added in future for better debugging. + } +} +/** + * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block. + * It appends additional attributes and serves as a centralized error-handling service. + * Usage => + * const wrappedUtilityFn = withErrorBoundary(utilityFn) + * + * @param fn utility that is wrapped in error boundary + * @returns {Function} returns the function wrapped in try/catch block + */ +const withErrorBoundary = (fn) => { + return function (...rest) { + try { + return fn.call(this, ...rest); + } + catch (err) { + console.warn('[I18N Error]: ', err); + // Currently, we are throwing the error as it is to consumers. + // In the future, this can be modified as per our requirement, like an error logging service. + throw new I18nifyError(err); + } + }; +}; + +/* Source: Google LibPhoneNumber Metadata: https://github.com/google/libphonenumber/blob/master/javascript/i18n/phonenumbers/metadata.js */ +const DIAL_CODE_MAPPER = { + 1: [ + 'US', + 'AG', + 'AI', + 'AS', + 'BB', + 'BM', + 'BS', + 'CA', + 'DM', + 'DO', + 'GD', + 'GU', + 'JM', + 'KN', + 'KY', + 'LC', + 'MP', + 'MS', + 'PR', + 'SX', + 'TC', + 'TT', + 'VC', + 'VG', + 'VI', + ], + 7: ['RU', 'KZ'], + 20: ['EG'], + 27: ['ZA'], + 30: ['GR'], + 31: ['NL'], + 32: ['BE'], + 33: ['FR'], + 34: ['ES'], + 36: ['HU'], + 39: ['IT', 'VA'], + 40: ['RO'], + 41: ['CH'], + 43: ['AT'], + 44: ['GB', 'GG', 'IM', 'JE'], + 45: ['DK'], + 46: ['SE'], + 47: ['NO', 'SJ'], + 48: ['PL'], + 49: ['DE'], + 51: ['PE'], + 52: ['MX'], + 53: ['CU'], + 54: ['AR'], + 55: ['BR'], + 56: ['CL'], + 57: ['CO'], + 58: ['VE'], + 60: ['MY'], + 61: ['AU', 'CC', 'CX'], + 62: ['ID'], + 63: ['PH'], + 64: ['NZ'], + 65: ['SG'], + 66: ['TH'], + 81: ['JP'], + 82: ['KR'], + 84: ['VN'], + 86: ['CN'], + 90: ['TR'], + 91: ['IN'], + 92: ['PK'], + 93: ['AF'], + 94: ['LK'], + 95: ['MM'], + 98: ['IR'], + 211: ['SS'], + 212: ['MA', 'EH'], + 213: ['DZ'], + 216: ['TN'], + 218: ['LY'], + 220: ['GM'], + 221: ['SN'], + 222: ['MR'], + 223: ['ML'], + 224: ['GN'], + 225: ['CI'], + 226: ['BF'], + 227: ['NE'], + 228: ['TG'], + 229: ['BJ'], + 230: ['MU'], + 231: ['LR'], + 232: ['SL'], + 233: ['GH'], + 234: ['NG'], + 235: ['TD'], + 236: ['CF'], + 237: ['CM'], + 238: ['CV'], + 239: ['ST'], + 240: ['GQ'], + 241: ['GA'], + 242: ['CG'], + 243: ['CD'], + 244: ['AO'], + 245: ['GW'], + 246: ['IO'], + 247: ['AC'], + 248: ['SC'], + 249: ['SD'], + 250: ['RW'], + 251: ['ET'], + 252: ['SO'], + 253: ['DJ'], + 254: ['KE'], + 255: ['TZ'], + 256: ['UG'], + 257: ['BI'], + 258: ['MZ'], + 260: ['ZM'], + 261: ['MG'], + 262: ['RE', 'YT'], + 263: ['ZW'], + 264: ['NA'], + 265: ['MW'], + 266: ['LS'], + 267: ['BW'], + 268: ['SZ'], + 269: ['KM'], + 290: ['SH', 'TA'], + 291: ['ER'], + 297: ['AW'], + 298: ['FO'], + 299: ['GL'], + 350: ['GI'], + 351: ['PT'], + 352: ['LU'], + 353: ['IE'], + 354: ['IS'], + 355: ['AL'], + 356: ['MT'], + 357: ['CY'], + 358: ['FI', 'AX'], + 359: ['BG'], + 370: ['LT'], + 371: ['LV'], + 372: ['EE'], + 373: ['MD'], + 374: ['AM'], + 375: ['BY'], + 376: ['AD'], + 377: ['MC'], + 378: ['SM'], + 380: ['UA'], + 381: ['RS'], + 382: ['ME'], + 383: ['XK'], + 385: ['HR'], + 386: ['SI'], + 387: ['BA'], + 389: ['MK'], + 420: ['CZ'], + 421: ['SK'], + 423: ['LI'], + 500: ['FK'], + 501: ['BZ'], + 502: ['GT'], + 503: ['SV'], + 504: ['HN'], + 505: ['NI'], + 506: ['CR'], + 507: ['PA'], + 508: ['PM'], + 509: ['HT'], + 590: ['GP', 'BL', 'MF'], + 591: ['BO'], + 592: ['GY'], + 593: ['EC'], + 594: ['GF'], + 595: ['PY'], + 596: ['MQ'], + 597: ['SR'], + 598: ['UY'], + 599: ['CW', 'BQ'], + 670: ['TL'], + 672: ['NF'], + 673: ['BN'], + 674: ['NR'], + 675: ['PG'], + 676: ['TO'], + 677: ['SB'], + 678: ['VU'], + 679: ['FJ'], + 680: ['PW'], + 681: ['WF'], + 682: ['CK'], + 683: ['NU'], + 685: ['WS'], + 686: ['KI'], + 687: ['NC'], + 688: ['TV'], + 689: ['PF'], + 690: ['TK'], + 691: ['FM'], + 692: ['MH'], + 800: ['001'], + 808: ['001'], + 850: ['KP'], + 852: ['HK'], + 853: ['MO'], + 855: ['KH'], + 856: ['LA'], + 870: ['001'], + 878: ['001'], + 880: ['BD'], + 881: ['001'], + 882: ['001'], + 883: ['001'], + 886: ['TW'], + 888: ['001'], + 960: ['MV'], + 961: ['LB'], + 962: ['JO'], + 963: ['SY'], + 964: ['IQ'], + 965: ['KW'], + 966: ['SA'], + 967: ['YE'], + 968: ['OM'], + 970: ['PS'], + 971: ['AE'], + 972: ['IL'], + 973: ['BH'], + 974: ['QA'], + 975: ['BT'], + 976: ['MN'], + 977: ['NP'], + 979: ['001'], + 992: ['TJ'], + 993: ['TM'], + 994: ['AZ'], + 995: ['GE'], + 996: ['KG'], + 998: ['UZ'], +}; + +/** + * Determines the country code based on the provided phone number. + * This function employs a multi-step approach to identify the country code: + * - If the phone number starts with '+', it extracts the numeric characters + * and matches the leading digits with known dial codes mapped to countries. + * - For matched dial codes, it further filters based on country-specific regex patterns + * to validate the phone number format for those countries. + * - If the phone number doesn't start with '+', it directly matches the number + * against regular expressions associated with various countries to identify the code. + * + * @param phoneNumber The input phone number (string or number). + * @returns The detected country code or an empty string if not found. + */ +const detectCountryCodeFromDialCode = (phoneNumber) => { + // If the phone number starts with '+', extract numeric characters + if (phoneNumber.toString().charAt(0) === '+') { + const cleanedPhoneNumberWithoutPlusPrefix = phoneNumber + .toString() + .replace(/\D/g, ''); + const matchingCountries = []; + // Iterate through dial codes and check for matches with cleaned phone number + for (const code in DIAL_CODE_MAPPER) { + if (cleanedPhoneNumberWithoutPlusPrefix.startsWith(code)) { + matchingCountries.push(...DIAL_CODE_MAPPER[code]); + } + } + // Filter matching countries based on phone number validation regex + const matchedCountryCode = matchingCountries.find((countryCode) => { + const regex = PHONE_REGEX_MAPPER[countryCode]; + if (regex && regex.test(phoneNumber.toString())) + return countryCode; + return undefined; + }); + // Return the first matched country code, if any + return matchedCountryCode || ''; + } + else { + // If phone number doesn't start with '+', directly match against country regexes + for (const countryCode in PHONE_REGEX_MAPPER) { + const regex = PHONE_REGEX_MAPPER[countryCode]; + if (regex.test(phoneNumber.toString())) { + return countryCode; + } + } + } + // Return empty string if no country code is detected + return ''; +}; +const cleanPhoneNumber = (phoneNumber) => { + // Regular expression to match all characters except numbers and + sign at the start + const regex = /[^0-9+]|(?!A)\+/g; + // Replace matched characters with an empty string + const cleanedPhoneNumber = phoneNumber.replace(regex, ''); + return phoneNumber[0] === '+' ? `+${cleanedPhoneNumber}` : cleanedPhoneNumber; +}; + +// Validates whether a given phone number is valid based on the provided country code or auto-detects the country code and checks if the number matches the defined regex pattern for that country. +const isValidPhoneNumber = (phoneNumber, countryCode) => { + // Clean the provided phoneNumber by removing non-numeric characters + const cleanedPhoneNumber = cleanPhoneNumber(phoneNumber.toString()); + // Detect or validate the country code + countryCode = + countryCode && countryCode in PHONE_REGEX_MAPPER + ? countryCode + : detectCountryCodeFromDialCode(cleanedPhoneNumber); + // Return false if phoneNumber is empty + if (!phoneNumber) + return false; + // Check if the countryCode exists in the PHONE_REGEX_MAPPER + if (countryCode in PHONE_REGEX_MAPPER) { + // Fetch the regex pattern for the countryCode + const regex = PHONE_REGEX_MAPPER[countryCode]; + // Test if the cleanedPhoneNumber matches the regex pattern + return regex.test(cleanedPhoneNumber); + } + // Return false if the countryCode is not supported + return false; +}; +var isValidPhoneNumber$1 = withErrorBoundary(isValidPhoneNumber); + +const PHONE_FORMATTER_MAPPER = { + IN: 'xxxx xxxxxx', + MY: 'xx xxxxx xx', + AE: 'xx xxx xxxx', + AL: 'xxx xx xxxx', + AM: 'xx xx xx xx', + AR: 'xxxx-xxxx', + AU: 'xxx xxx xxx', + AW: 'xxx-xxxx', + BB: 'xxx-xxxx', + BD: 'xxxx-xxxxxx', + BM: 'xxx-xxxx', + BN: 'xxxx-xxxx', + BO: 'xxxx-xxxx', + BS: 'xxx-xxxx', + BW: 'xx xxxx xxxx', + BZ: 'xxx-xxxx', + CA: 'xxx-xxx-xxxx', + CH: 'xxx xxx xxx', + CN: 'xxxx-xxxxxxx', + CO: 'xxxx-xxxxxxx', + CR: 'xxxx-xxxx', + CU: 'xxxx-xxxx', + CZ: 'xxx xxx xxx', + DK: 'xx xx xx xx', + DO: 'xxx-xxxxxxx', + DZ: 'xxxx-xxxx-xxx', + EG: 'xx xxx xxxx', + ET: 'xx xxx xxxx', + EU: 'xxx xx xx xx', + FJ: 'xxxx xxxx', + GB: 'xxxx xxx xxx', + GH: 'xxx xxx xxxx', + GI: 'xxxx xxxx', + GM: 'xxxx-xxxx', + GT: 'xxxx-xxxx', + GY: 'xxx-xxxx', + HK: 'xxxx xxxx', + HN: 'xxxx-xxxx', + HR: 'xxx xxx xxxx', + HT: 'xxx-xxxx', + HU: 'xxx xxx xxxx', + ID: 'xxxx-xxxx-xxxx', + IL: 'xxxx-xxx-xxx', + JM: 'xxx-xxxx', + KE: 'xxx xxxxxx', + KG: 'xxx-xx-xx-xx', + KH: 'xxx-xxx-xxx', + KY: 'xxx-xxxx', + KZ: 'xxx-xxx-xx-xx', + LA: 'xxx xx xxxx', + LK: 'xx xxx xxxx', + LR: 'xxx-xxx-xxxx', + LS: 'xxx xx xxxx', + LT: 'xxx xxxxx', + LU: 'xxx xx xxx', + LV: 'xxxx xxxx', + MA: 'xxxx-xxxxxx', + MD: 'xx xxxxxx', + ME: 'xx xxxxxx', + MG: 'xx xx xx xx xx', + MK: 'xx xx xx xx', + MM: 'xx xxxxxx', + MN: 'xxx-xx-xxxx', + MO: 'xxxx xxxx', + MU: 'xx xxxx xxxx', + MV: 'xxxxxx', + MW: 'xx xxxx xxxx', + MX: 'xxx-xxx-xxxx', + MZ: 'xx xxxxxxx', + NA: 'xx xxxx xxxx', + NG: 'xxx xxx xxxx', + NI: 'xxxx-xxxx', + NL: 'xxx-xxxxxxx', + NO: 'xxxx xxxx', + NP: 'xxxx-xxxxxxx', + NZ: 'xxx-xxxxxxx', + OM: 'xxxx-xxxx', + PA: 'xxx-xxxx', + PE: 'xxx-xxx-xxx', + PG: 'xxx-xxxxxx', + PH: 'xxx-xxxx', + PK: 'xxx-xxxxxxx', + PL: 'xxx xxx xxx', + PR: 'xxx-xxx-xxxx', + PS: 'xxxx-xxxxxxx', + PT: 'xxx xxx xxx', + PY: 'xxx-xxxxxx', + QA: 'xxxx xxxx', + RO: 'xxx xxx xxxx', + RS: 'xxx xxxxx', + RU: 'xxx xxx-xx-xx', + RW: 'xxx xxxxxx', + SA: 'xxx-xxxxxxx', + SC: 'xx xxxxx', + SE: 'xxx-xxx xx xx', + SG: 'xxxx xxxx', + SI: 'xx xxxxxx', + SK: 'xxx xxx xxx', + SL: 'xxx-xxxxxx', + SM: 'xxxxx xxxxx', + SN: 'xx xxx xx xx', + SO: 'xxx xxxxxxx', + SR: 'xxx-xxxx', + SS: 'xxx xxxx xxx', + SV: 'xxxx-xxxx', + SZ: 'xxx xx xxxx', + TG: 'xx xx xx xx', + TH: 'xxx-xxxxxxx', + TJ: 'xxx xx xx xx', + TL: 'xxx-xxxxxxx', + TN: 'xx xxxxxx', + TR: 'xxx xxx xx xx', + TT: 'xxx-xxxx', + TW: 'xxxx-xxxxxx', + TZ: 'xxx xxx xxxx', + UA: 'xx xxx xx xx', + UG: 'xxx xxxxxxx', + US: 'xxx-xxx-xxxx', + UY: 'xxx-xxxxx', + UZ: 'xxx-xxx-xx-xx', + VC: 'xxx-xxxx', + VE: 'xxxx-xxx-xxxx', + VN: 'xxxx-xxxxxxx', + YE: 'xxxx-xxxx', + ZA: 'xxx-xxx-xxxx', + ZM: 'xxx-xxxxxxx', + ZW: 'xx xxx xxxx', + KW: 'xxx xx xxxx', + BH: 'xxxx xxxx', +}; + +// Formats a provided phone number according to the predefined format for a specific country code, or auto-detects the country code and formats the number accordingly. +const formatPhoneNumber = (phoneNumber, countryCode) => { + // Throw errors if phoneNumber is invalid + if (!phoneNumber) + throw new Error('Parameter `phoneNumber` is invalid!'); + // Convert phoneNumber to string and clean it by removing non-numeric characters + phoneNumber = phoneNumber.toString(); + phoneNumber = cleanPhoneNumber(phoneNumber); + // Detect or validate the country code + countryCode = + countryCode && countryCode in PHONE_FORMATTER_MAPPER + ? countryCode + : detectCountryCodeFromDialCode(phoneNumber); + // Fetch the pattern for the countryCode from the PHONE_FORMATTER_MAPPER + const pattern = PHONE_FORMATTER_MAPPER[countryCode]; + if (!pattern) + return phoneNumber; + // Count the number of 'x' characters in the format pattern + let charCountInFormatterPattern = 0; + for (let i = 0; i < pattern.length; i++) { + if (pattern[i] === 'x') { + charCountInFormatterPattern++; + } + } + // Calculate the difference between phoneNumber length and 'x' characters count in pattern + const diff = phoneNumber.length - charCountInFormatterPattern; + // Extract the phoneNumber without the prefix + const phoneNumberWithoutPrefix = phoneNumber.slice(diff); + const formattedNumber = []; + let numberIndex = 0; + // Loop through the pattern to format the phoneNumber + for (let i = 0; i < pattern.length; i++) { + const patternChar = pattern[i]; + if (patternChar === 'x') { + // Insert phoneNumber digits at 'x' positions + if (numberIndex < phoneNumberWithoutPrefix.length) { + formattedNumber.push(phoneNumberWithoutPrefix[numberIndex]); + numberIndex++; + } + } + else { + // Insert non-digit characters from the pattern + formattedNumber.push(patternChar); + } + } + // Join the formattedNumber array to create the formattedPhoneNumber without prefix + const formattedPhoneNumberWithoutPrefix = formattedNumber.join(''); + // Combine the prefix and formattedPhoneNumberWithoutPrefix + const formattedPhoneNumberWithPrefix = phoneNumber.slice(0, diff) + ' ' + formattedPhoneNumberWithoutPrefix; + // Return the formattedPhoneNumber with prefix after trimming whitespace + return formattedPhoneNumberWithPrefix.trim(); +}; +var formatPhoneNumber$1 = withErrorBoundary(formatPhoneNumber); + +// Parses a given phone number, identifies its country code (if not provided), and returns an object with details including the country code, formatted phone number, dial code, and format template. +const parsePhoneNumber = (phoneNumber, country) => { + // Throw errors if phoneNumber is invalid + if (!phoneNumber) + throw new Error('Parameter `phoneNumber` is invalid!'); + // Clean the phoneNumber by removing non-numeric characters + phoneNumber = phoneNumber.toString(); + phoneNumber = cleanPhoneNumber(phoneNumber); + // Detect or validate the country code + const countryCode = country && country in PHONE_FORMATTER_MAPPER + ? country + : detectCountryCodeFromDialCode(phoneNumber); + // Format the phone number using the detected/validated country code + const formattedPhoneNumber = formatPhoneNumber$1(phoneNumber, countryCode); + // Fetch the pattern associated with the countryCode from the PHONE_FORMATTER_MAPPER + const pattern = PHONE_FORMATTER_MAPPER[countryCode]; + if (!pattern) + return { + countryCode: countryCode || '', + dialCode: '', + formattedPhoneNumber: phoneNumber, + formatTemplate: '', + }; + // Count the number of 'x' characters in the format pattern + let charCountInFormatterPattern = 0; + for (let i = 0; i < pattern.length; i++) { + if (pattern[i] === 'x') { + charCountInFormatterPattern++; + } + } + // Calculate the difference between phoneNumber length and 'x' characters count in pattern + const diff = phoneNumber.length - charCountInFormatterPattern; + // Extract the dialCode from the phoneNumber + const dialCode = phoneNumber.slice(0, diff); + // Obtain the format template associated with the countryCode + const formatTemplate = PHONE_FORMATTER_MAPPER[countryCode]; + // Return the parsed phone number information + return { + countryCode, + formattedPhoneNumber, + dialCode, + formatTemplate, + }; +}; +var parsePhoneNumber$1 = withErrorBoundary(parsePhoneNumber); + +export { formatPhoneNumber$1 as formatPhoneNumber, isValidPhoneNumber$1 as isValidPhoneNumber, parsePhoneNumber$1 as parsePhoneNumber }; +//# sourceMappingURL=index.js.map diff --git a/lib/esm/phoneNumber/index.js.map b/lib/esm/phoneNumber/index.js.map new file mode 100644 index 00000000..2706ad49 --- /dev/null +++ b/lib/esm/phoneNumber/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["../../../src/modules/phoneNumber/data/phoneRegexMapper.ts","../../../src/common/errorBoundary/index.ts","../../../src/modules/phoneNumber/data/dialCodeMapper.ts","../../../src/modules/phoneNumber/utils.ts","../../../src/modules/phoneNumber/isValidPhoneNumber.ts","../../../src/modules/phoneNumber/data/phoneFormatterMapper.ts","../../../src/modules/phoneNumber/formatPhoneNumber.ts","../../../src/modules/phoneNumber/parsePhoneNumber.ts"],"sourcesContent":["export const PHONE_REGEX_MAPPER: { [key: string]: RegExp } = {\n IN: /^(?:(?:\\+|0{0,2})91\\s*[-]?\\s*|[0]?)?[6789]\\d{9}$/,\n MY: /^(\\+?6?0)?(\\d{1,3})[-. ]?(\\d{7,8})$/,\n AE: /^(?:\\+?971|0)?(?:2|3|4|6|7|9)\\d{8}$/,\n AL: /^(?:\\+?355)?(?:[4-9]\\d{7}|6\\d{8})$/,\n AM: /^(?:\\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/,\n AR: /^(?:(?:\\+|0{0,2})54)?(?:11|[2368]\\d)(?:(?=\\d{0,2}15)\\d{2})??\\d{8}$/,\n AU: /^(?:\\+?61|0)4\\d{8}$/,\n AW: /^(?:(?:\\+297)?(?!0)\\d{7})$/,\n BB: /^(?:(?:\\+1)?246)?(?:\\d{3})?\\d{7}$/,\n BD: /^(?:\\+?880|0)1[13456789]\\d{8}$/,\n BM: /^(?:(?:\\+1)?441)?(?:\\d{2})?\\d{7}$/,\n BN: /^(?:\\+?673)?(?:\\d{3})?\\d{4}$/,\n BO: /^(?:(?:\\+|0{0,2})591)?(?:(?:2|3|7|6)\\d{7})$/,\n BS: /^(?:(?:\\+1)?242)?(?:\\d{3})?\\d{7}$/,\n BW: /^(?:(?:\\+267)?\\s?)?[74]\\d{7}$/,\n BZ: /^(?:(?:\\+501)?\\s?)?[622]\\d{4}$/,\n CH: /^(?:(?:\\+41|0)(?:\\s*\\(?0\\)?\\s*))?(?:\\d{2}\\s*)?\\d{3}\\s*\\d{2}\\s*\\d{2}$/,\n CN: /^(?:(?:\\+|00)86)?1\\d{10}$/,\n CO: /^(?:(?:\\+57|0057)?)?[1-8]{1}\\d{6,7}$/,\n OM: /^(?:\\+?968)?(?:95|96|97|98)\\d{6}$/,\n CR: /^(?:(?:\\+506)?\\s*|0)?[1-9]\\d{7}$/,\n CU: /^(?:\\+?53)?(?:[5-8]\\d{7})$/,\n CZ: /^(?:\\+?420)?(?:\\d{9})$/,\n DK: /^(?:\\+?45)?(?:\\d{8})$/,\n DO: /^(?:(?:\\+1)?809|1-8(?:00|88|89))(?:\\d{7})$/,\n DZ: /^(?:\\+?213|0)([567]\\d{8})$/,\n EG: /^(?:(?:\\+20|20)?(\\d{10}))$/,\n ET: /^(?:\\+?251)?[1-59]\\d{8}$/,\n EU: /^(?:(?:\\+?3)?8)?\\s*(?:\\d{3}\\s*){3}\\d{2}$/,\n FJ: /^(?:(?:\\+?679)?\\s?\\d{3}\\s?\\d{4})?$/,\n GB: /^(?:(?:\\+44\\s?|0)7\\d{3}(\\s?\\d{4,})?)$/,\n GH: /^(?:(?:\\+233)|0)?(?:\\d{9})$/,\n GI: /^(?:\\+350)?\\d{5}$/,\n GM: /^(?:\\+220)?\\d{5,7}$/,\n GT: /^(?:\\+502)?[2468]\\d{7,8}$/,\n GY: /^(?:(?:\\+592)?(?:(?:\\s)?[2-9])(?:(?:\\s)?\\d))?(?:(?:\\s)?\\d{4})$/,\n HK: /^(?:\\+852\\s?)?[456789]\\d{3}\\s?\\d{4}$/,\n HN: /^(?:\\+504)?[89]\\d{7}$/,\n HR: /^(?:\\+?385)?\\d{8,9}$/,\n HT: /^(?:\\+?509)?\\d{8}$/,\n HU: /^(?:(?:\\+36))(\\s?\\d{2}\\s?\\d{3}\\s?\\d{4})$/,\n ID: /^(?:\\+?62|0[1-9])[\\s-]?\\d{2,4}[\\s-]?\\d{3,4}[\\s-]?\\d{3,4}$/,\n IL: /^(?:(?:\\+972|0)(?:-)?)[23489]\\d{7}$/,\n JM: /^(?:(?:\\+1876))\\d{7,10}$/,\n KE: /^(?:(?:\\+254)|(?:0))(?:\\d{6,7})$/,\n KG: /^(?:\\+996)?\\s?\\d{9}$/,\n KH: /^(?:(?:\\+855)|(?:0))(?:\\s?[1-9]\\d{7,8})$/,\n KY: /^(?:\\+?1\\s?(345))\\d{6}$/,\n KZ: /^(?:\\+?7|8)?7\\d{9}$/,\n LA: /^(?:(?:\\+?856)|0)(20\\d{7,9})$/,\n LK: /^(?:(?:\\+94)|0)(?:\\d{9})$/,\n LR: /^(?:\\+231)[ -\\d]{4}[ -\\d]{4}$/,\n LS: /^(?:(?:\\+?266)|0)?[56]\\d{7}$/,\n MA: /^(?:(?:\\+?212(\\s*[-|\\s*]?\\d{1,9})?)|(?:0))(?:\\d{9})$/,\n MD: /^(?:(?:\\+373)|(?:0))(?:\\d{7,8})$/,\n MK: /^(?:\\+389|0)(?:(?:2[0-4]|[3-9])\\s?)?\\d{6}$/,\n MM: /^(?:(?:\\+?95)|0)?[1-9]\\d{9}$/,\n MN: /^(?:\\+976|0)\\d{8}$/,\n MO: /^(?:(?:\\+?853)|[0-9])?\\d{8}$/,\n MU: /^(?:\\+230|0)?\\d{8}$/,\n MV: /^(?:(?:\\+?960)|0)?\\d{7}$/,\n MW: /^(?:\\+265)[1-9]\\d{6}$/,\n MX: /^(?:(?:\\+?52)?\\s?(?:1|01)?\\s?)?(?:\\d{3}\\s?\\d{3}\\s?\\d{4})$/,\n NA: /^(?:(?:\\+264)|0)?\\d{8}$/,\n NG: /^(?:(?:\\+234)|(?:0))(?:\\d{7,8})$/,\n NI: /^(?:(?:\\+505))?(?:\\d{8})$/,\n NO: /^(?:(?:\\+?47)|\\d{2}|\\d{3})\\s?\\d{2}\\s?\\d{3}$/,\n NP: /^(?:(?:\\+977))?(\\d{9,10})$/,\n NZ: /^(?:\\+?64|0)(\\d{2,5} \\d{4,8}|\\d{3,4} \\d{4})$/,\n PE: /^(?:(?:\\+51)|0)?(?:9\\d{8})$/,\n PG: /^(?:\\+?675)?(?:[7-9]\\d{7})$/,\n PH: /^(?:(?:\\+?63)|0)(?:\\d{10})$/,\n PK: /^(?:(?:\\+92)|0)?[345]\\d{9}$/,\n QA: /^(?:\\+?974)?-?33\\d{5}$/,\n RU: /^(?:\\+?7|8)?[ -]?\\(?9\\d{2}\\)?[ -]?\\d{3}[ -]?\\d{2}[ -]?\\d{2}$/,\n SA: /^(?:\\+?966)?\\s?1?[\\s-]?(?:[45]\\d{2}|5\\d{3})[\\s-]?\\d{4}$/,\n SC: /^(?:(?:\\+248)|\\d{4})\\d{5}$/,\n SE: /^(?:\\+?46|0)\\s?[1-57-9](?:[0-9]\\s?){8}$/,\n SG: /^(?:(?:\\+65)|(?:\\(\\+65\\))|(?:65))\\d{4}\\d{4}$/,\n SL: /^(?:(?:\\+232)|(?:0))?\\d{9}$/,\n SO: /^(?:\\+252|0)?[567]\\d{7}$/,\n SS: /^(?:\\+211|0)?[1-9]\\d{7,9}$/,\n SV: /^(?:(?:\\+?503)|(?:0))(?:\\d{8})$/,\n SZ: /^(?:\\+?268)?\\d{7,8}$/,\n TH: /^(?:(?:\\+66)|0)\\d{9}$/,\n TT: /^(?:(?:\\+?1-868)|\\(?868\\)?)(\\d{7})$/,\n TZ: /^(?:(?:\\+?255)|0)?[67]\\d{8}$/,\n US: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n CA: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n UY: /^(?:(?:\\+598|0)\\s?(9\\d{3}|2\\d{2}|[4-9]\\d{6}))$/,\n UZ: /^(?:\\+?998)?\\s?[3456789]\\d{8}$/,\n YE: /^(?:\\+?967)?(?:\\d{7,8})$/,\n ZA: /^(?:(?:\\+27)|0)(\\d{9})$/,\n KW: /^(?:\\+?965)[569]\\d{7}$/,\n BH: /^(?:\\+?973)?[356]\\d{7}$/,\n TL: /^(?:(?:\\+670)\\s?)?[0-9]{3}\\s?[0-9]{3,4}$/,\n VC: /^(?:(?:\\+1)?784)?(?:\\d{3})?\\d{7}$/,\n VE: /^(?:(?:\\+58)|0)?4\\d{9}$/,\n VN: /^(?:(?:\\+84)|0)?[1-9]\\d{8}$/,\n ZM: /^(?:(?:\\+260)|0)?[123456789]\\d{8,9}$/,\n ZW: /^(?:(?:\\+263)|0)?(?:\\d{9,10})$/,\n LT: /^(?:(?:\\+370)|8)\\d{8}$/,\n LU: /^(?:(?:\\+352)?(6|2(6|7|8|9))\\d{6})$/,\n LV: /^(?:(?:\\+371)?2\\d{7})$/,\n ME: /^(?:(?:\\+382)?[67]\\d{7,20})$/,\n MG: /^(?:(?:\\+261)?3[234568]\\d{7})$/,\n MZ: /^(?:(?:\\+258)|(?:258))?8[234567]\\d{7,8}$/,\n NL: /^(?:(?:\\+31)|0(6(?:\\d{8})|[1-9](?:(?:\\d{8})|(?:\\s\\d{3}\\s\\d{4}))|(?:\\d{8})))$/,\n PA: /^(?:(?:\\+507)\\s?)?[46]\\d{6,7}$/,\n PL: /^(?:(?:\\+48)?(?:\\s?\\d{3}\\s?\\d{3}\\s?\\d{3}|(?:\\d{2}\\s?){4}\\d{2}|\\d{3}-\\d{3}-\\d{3}))$/,\n PR: /^(?:(?:\\+1)?787|939)\\d{7}$/,\n PS: /^(?:(?:\\+970))(5[2349])\\d{7}$/,\n PT: /^(?:(?:\\+351)?9(1\\d|2[1-9]|6[12345789]|7[12345789])\\d{7})$/,\n PY: /^(?:(?:\\+595|0)9[9876]\\d{7})$/,\n RO: /^(?:(?:\\+40|0))(?:7[2-8]\\d{7}|21\\d{8})$/,\n RS: /^(?:(?:\\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/,\n RW: /^(?:(?:\\+250)|(0))\\d{9}$/,\n SI: /^(?:(?:\\+386)|0)?[1-59]\\d{7,8}$/,\n SK: /^(?:(?:\\+421))?(0|9[0-8])\\d{8}$/,\n SM: /^(?:(?:\\+378)|(0549|6\\d{4}))\\d{5}$/,\n SN: /^(?:(?:\\+221)|0)?[3679]\\d{7}$/,\n SR: /^(?:(?:\\+597))\\d{7}$/,\n TG: /^(?:(?:\\+228))\\d{8}$/,\n TJ: /^(?:(?:\\+992))(37|55|77)\\d{7}$/,\n TN: /^(?:(?:\\+216)|22|9[1-9])\\d{7}$/,\n TR: /^(?:(?:\\+90)|(0))\\s?5\\d{9}$/,\n TW: /^(?:(?:\\+886)|0)?9\\d{8}$/,\n UA: /^(?:(?:\\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\\d{7}$/,\n UG: /^(?:(?:\\+256)|0)?[39]\\d{8}$/,\n};\n","// Custom Error class to extend properties to error object\nexport class I18nifyError extends Error {\n timestamp: Date;\n constructor(message: string | undefined) {\n super(message);\n this.name = 'i18nify Error';\n this.timestamp = new Date();\n // more params like type of error/severity can be added in future for better debugging.\n }\n}\n\n/**\n * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block.\n * It appends additional attributes and serves as a centralized error-handling service.\n * Usage =>\n * const wrappedUtilityFn = withErrorBoundary(utilityFn)\n *\n * @param fn utility that is wrapped in error boundary\n * @returns {Function} returns the function wrapped in try/catch block\n */\nexport const withErrorBoundary = any>(\n fn: T,\n): ((...args: Parameters) => ReturnType) => {\n return function (this: unknown, ...rest: Parameters): ReturnType {\n try {\n return fn.call(this, ...rest) as ReturnType;\n } catch (err) {\n console.warn('[I18N Error]: ', err);\n // Currently, we are throwing the error as it is to consumers.\n // In the future, this can be modified as per our requirement, like an error logging service.\n throw new I18nifyError(err as string | undefined);\n }\n };\n};\n","/* Source: Google LibPhoneNumber Metadata: https://github.com/google/libphonenumber/blob/master/javascript/i18n/phonenumbers/metadata.js */\n\nexport const DIAL_CODE_MAPPER: { [key: number]: string[] } = {\n 1: [\n 'US',\n 'AG',\n 'AI',\n 'AS',\n 'BB',\n 'BM',\n 'BS',\n 'CA',\n 'DM',\n 'DO',\n 'GD',\n 'GU',\n 'JM',\n 'KN',\n 'KY',\n 'LC',\n 'MP',\n 'MS',\n 'PR',\n 'SX',\n 'TC',\n 'TT',\n 'VC',\n 'VG',\n 'VI',\n ],\n 7: ['RU', 'KZ'],\n 20: ['EG'],\n 27: ['ZA'],\n 30: ['GR'],\n 31: ['NL'],\n 32: ['BE'],\n 33: ['FR'],\n 34: ['ES'],\n 36: ['HU'],\n 39: ['IT', 'VA'],\n 40: ['RO'],\n 41: ['CH'],\n 43: ['AT'],\n 44: ['GB', 'GG', 'IM', 'JE'],\n 45: ['DK'],\n 46: ['SE'],\n 47: ['NO', 'SJ'],\n 48: ['PL'],\n 49: ['DE'],\n 51: ['PE'],\n 52: ['MX'],\n 53: ['CU'],\n 54: ['AR'],\n 55: ['BR'],\n 56: ['CL'],\n 57: ['CO'],\n 58: ['VE'],\n 60: ['MY'],\n 61: ['AU', 'CC', 'CX'],\n 62: ['ID'],\n 63: ['PH'],\n 64: ['NZ'],\n 65: ['SG'],\n 66: ['TH'],\n 81: ['JP'],\n 82: ['KR'],\n 84: ['VN'],\n 86: ['CN'],\n 90: ['TR'],\n 91: ['IN'],\n 92: ['PK'],\n 93: ['AF'],\n 94: ['LK'],\n 95: ['MM'],\n 98: ['IR'],\n 211: ['SS'],\n 212: ['MA', 'EH'],\n 213: ['DZ'],\n 216: ['TN'],\n 218: ['LY'],\n 220: ['GM'],\n 221: ['SN'],\n 222: ['MR'],\n 223: ['ML'],\n 224: ['GN'],\n 225: ['CI'],\n 226: ['BF'],\n 227: ['NE'],\n 228: ['TG'],\n 229: ['BJ'],\n 230: ['MU'],\n 231: ['LR'],\n 232: ['SL'],\n 233: ['GH'],\n 234: ['NG'],\n 235: ['TD'],\n 236: ['CF'],\n 237: ['CM'],\n 238: ['CV'],\n 239: ['ST'],\n 240: ['GQ'],\n 241: ['GA'],\n 242: ['CG'],\n 243: ['CD'],\n 244: ['AO'],\n 245: ['GW'],\n 246: ['IO'],\n 247: ['AC'],\n 248: ['SC'],\n 249: ['SD'],\n 250: ['RW'],\n 251: ['ET'],\n 252: ['SO'],\n 253: ['DJ'],\n 254: ['KE'],\n 255: ['TZ'],\n 256: ['UG'],\n 257: ['BI'],\n 258: ['MZ'],\n 260: ['ZM'],\n 261: ['MG'],\n 262: ['RE', 'YT'],\n 263: ['ZW'],\n 264: ['NA'],\n 265: ['MW'],\n 266: ['LS'],\n 267: ['BW'],\n 268: ['SZ'],\n 269: ['KM'],\n 290: ['SH', 'TA'],\n 291: ['ER'],\n 297: ['AW'],\n 298: ['FO'],\n 299: ['GL'],\n 350: ['GI'],\n 351: ['PT'],\n 352: ['LU'],\n 353: ['IE'],\n 354: ['IS'],\n 355: ['AL'],\n 356: ['MT'],\n 357: ['CY'],\n 358: ['FI', 'AX'],\n 359: ['BG'],\n 370: ['LT'],\n 371: ['LV'],\n 372: ['EE'],\n 373: ['MD'],\n 374: ['AM'],\n 375: ['BY'],\n 376: ['AD'],\n 377: ['MC'],\n 378: ['SM'],\n 380: ['UA'],\n 381: ['RS'],\n 382: ['ME'],\n 383: ['XK'],\n 385: ['HR'],\n 386: ['SI'],\n 387: ['BA'],\n 389: ['MK'],\n 420: ['CZ'],\n 421: ['SK'],\n 423: ['LI'],\n 500: ['FK'],\n 501: ['BZ'],\n 502: ['GT'],\n 503: ['SV'],\n 504: ['HN'],\n 505: ['NI'],\n 506: ['CR'],\n 507: ['PA'],\n 508: ['PM'],\n 509: ['HT'],\n 590: ['GP', 'BL', 'MF'],\n 591: ['BO'],\n 592: ['GY'],\n 593: ['EC'],\n 594: ['GF'],\n 595: ['PY'],\n 596: ['MQ'],\n 597: ['SR'],\n 598: ['UY'],\n 599: ['CW', 'BQ'],\n 670: ['TL'],\n 672: ['NF'],\n 673: ['BN'],\n 674: ['NR'],\n 675: ['PG'],\n 676: ['TO'],\n 677: ['SB'],\n 678: ['VU'],\n 679: ['FJ'],\n 680: ['PW'],\n 681: ['WF'],\n 682: ['CK'],\n 683: ['NU'],\n 685: ['WS'],\n 686: ['KI'],\n 687: ['NC'],\n 688: ['TV'],\n 689: ['PF'],\n 690: ['TK'],\n 691: ['FM'],\n 692: ['MH'],\n 800: ['001'],\n 808: ['001'],\n 850: ['KP'],\n 852: ['HK'],\n 853: ['MO'],\n 855: ['KH'],\n 856: ['LA'],\n 870: ['001'],\n 878: ['001'],\n 880: ['BD'],\n 881: ['001'],\n 882: ['001'],\n 883: ['001'],\n 886: ['TW'],\n 888: ['001'],\n 960: ['MV'],\n 961: ['LB'],\n 962: ['JO'],\n 963: ['SY'],\n 964: ['IQ'],\n 965: ['KW'],\n 966: ['SA'],\n 967: ['YE'],\n 968: ['OM'],\n 970: ['PS'],\n 971: ['AE'],\n 972: ['IL'],\n 973: ['BH'],\n 974: ['QA'],\n 975: ['BT'],\n 976: ['MN'],\n 977: ['NP'],\n 979: ['001'],\n 992: ['TJ'],\n 993: ['TM'],\n 994: ['AZ'],\n 995: ['GE'],\n 996: ['KG'],\n 998: ['UZ'],\n};\n","import { DIAL_CODE_MAPPER } from './data/dialCodeMapper';\nimport { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\n\n/**\n * Determines the country code based on the provided phone number.\n * This function employs a multi-step approach to identify the country code:\n * - If the phone number starts with '+', it extracts the numeric characters\n * and matches the leading digits with known dial codes mapped to countries.\n * - For matched dial codes, it further filters based on country-specific regex patterns\n * to validate the phone number format for those countries.\n * - If the phone number doesn't start with '+', it directly matches the number\n * against regular expressions associated with various countries to identify the code.\n *\n * @param phoneNumber The input phone number (string or number).\n * @returns The detected country code or an empty string if not found.\n */\nexport const detectCountryCodeFromDialCode = (\n phoneNumber: string | number,\n): string => {\n // If the phone number starts with '+', extract numeric characters\n if (phoneNumber.toString().charAt(0) === '+') {\n const cleanedPhoneNumberWithoutPlusPrefix = phoneNumber\n .toString()\n .replace(/\\D/g, '');\n\n const matchingCountries: string[] = [];\n\n // Iterate through dial codes and check for matches with cleaned phone number\n for (const code in DIAL_CODE_MAPPER) {\n if (cleanedPhoneNumberWithoutPlusPrefix.startsWith(code)) {\n matchingCountries.push(...DIAL_CODE_MAPPER[code]);\n }\n }\n\n // Filter matching countries based on phone number validation regex\n const matchedCountryCode = matchingCountries.find((countryCode: string) => {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex && regex.test(phoneNumber.toString())) return countryCode;\n return undefined;\n });\n\n // Return the first matched country code, if any\n return matchedCountryCode || '';\n } else {\n // If phone number doesn't start with '+', directly match against country regexes\n for (const countryCode in PHONE_REGEX_MAPPER) {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex.test(phoneNumber.toString())) {\n return countryCode;\n }\n }\n }\n\n // Return empty string if no country code is detected\n return '';\n};\n\nexport const cleanPhoneNumber = (phoneNumber: string) => {\n // Regular expression to match all characters except numbers and + sign at the start\n const regex = /[^0-9+]|(?!A)\\+/g;\n // Replace matched characters with an empty string\n const cleanedPhoneNumber = phoneNumber.replace(regex, '');\n return phoneNumber[0] === '+' ? `+${cleanedPhoneNumber}` : cleanedPhoneNumber;\n};\n","import { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Validates whether a given phone number is valid based on the provided country code or auto-detects the country code and checks if the number matches the defined regex pattern for that country.\nconst isValidPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_REGEX_MAPPER,\n): boolean => {\n // Clean the provided phoneNumber by removing non-numeric characters\n const cleanedPhoneNumber = cleanPhoneNumber(phoneNumber.toString());\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_REGEX_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(cleanedPhoneNumber);\n\n // Return false if phoneNumber is empty\n if (!phoneNumber) return false;\n\n // Check if the countryCode exists in the PHONE_REGEX_MAPPER\n if (countryCode in PHONE_REGEX_MAPPER) {\n // Fetch the regex pattern for the countryCode\n const regex = PHONE_REGEX_MAPPER[countryCode];\n // Test if the cleanedPhoneNumber matches the regex pattern\n return regex.test(cleanedPhoneNumber as string);\n }\n\n // Return false if the countryCode is not supported\n return false;\n};\n\nexport default withErrorBoundary(isValidPhoneNumber);\n","export const PHONE_FORMATTER_MAPPER: { [key: string]: string } = {\n IN: 'xxxx xxxxxx',\n MY: 'xx xxxxx xx',\n AE: 'xx xxx xxxx',\n AL: 'xxx xx xxxx',\n AM: 'xx xx xx xx',\n AR: 'xxxx-xxxx',\n AU: 'xxx xxx xxx',\n AW: 'xxx-xxxx',\n BB: 'xxx-xxxx',\n BD: 'xxxx-xxxxxx',\n BM: 'xxx-xxxx',\n BN: 'xxxx-xxxx',\n BO: 'xxxx-xxxx',\n BS: 'xxx-xxxx',\n BW: 'xx xxxx xxxx',\n BZ: 'xxx-xxxx',\n CA: 'xxx-xxx-xxxx',\n CH: 'xxx xxx xxx',\n CN: 'xxxx-xxxxxxx',\n CO: 'xxxx-xxxxxxx',\n CR: 'xxxx-xxxx',\n CU: 'xxxx-xxxx',\n CZ: 'xxx xxx xxx',\n DK: 'xx xx xx xx',\n DO: 'xxx-xxxxxxx',\n DZ: 'xxxx-xxxx-xxx',\n EG: 'xx xxx xxxx',\n ET: 'xx xxx xxxx',\n EU: 'xxx xx xx xx',\n FJ: 'xxxx xxxx',\n GB: 'xxxx xxx xxx',\n GH: 'xxx xxx xxxx',\n GI: 'xxxx xxxx',\n GM: 'xxxx-xxxx',\n GT: 'xxxx-xxxx',\n GY: 'xxx-xxxx',\n HK: 'xxxx xxxx',\n HN: 'xxxx-xxxx',\n HR: 'xxx xxx xxxx',\n HT: 'xxx-xxxx',\n HU: 'xxx xxx xxxx',\n ID: 'xxxx-xxxx-xxxx',\n IL: 'xxxx-xxx-xxx',\n JM: 'xxx-xxxx',\n KE: 'xxx xxxxxx',\n KG: 'xxx-xx-xx-xx',\n KH: 'xxx-xxx-xxx',\n KY: 'xxx-xxxx',\n KZ: 'xxx-xxx-xx-xx',\n LA: 'xxx xx xxxx',\n LK: 'xx xxx xxxx',\n LR: 'xxx-xxx-xxxx',\n LS: 'xxx xx xxxx',\n LT: 'xxx xxxxx',\n LU: 'xxx xx xxx',\n LV: 'xxxx xxxx',\n MA: 'xxxx-xxxxxx',\n MD: 'xx xxxxxx',\n ME: 'xx xxxxxx',\n MG: 'xx xx xx xx xx',\n MK: 'xx xx xx xx',\n MM: 'xx xxxxxx',\n MN: 'xxx-xx-xxxx',\n MO: 'xxxx xxxx',\n MU: 'xx xxxx xxxx',\n MV: 'xxxxxx',\n MW: 'xx xxxx xxxx',\n MX: 'xxx-xxx-xxxx',\n MZ: 'xx xxxxxxx',\n NA: 'xx xxxx xxxx',\n NG: 'xxx xxx xxxx',\n NI: 'xxxx-xxxx',\n NL: 'xxx-xxxxxxx',\n NO: 'xxxx xxxx',\n NP: 'xxxx-xxxxxxx',\n NZ: 'xxx-xxxxxxx',\n OM: 'xxxx-xxxx',\n PA: 'xxx-xxxx',\n PE: 'xxx-xxx-xxx',\n PG: 'xxx-xxxxxx',\n PH: 'xxx-xxxx',\n PK: 'xxx-xxxxxxx',\n PL: 'xxx xxx xxx',\n PR: 'xxx-xxx-xxxx',\n PS: 'xxxx-xxxxxxx',\n PT: 'xxx xxx xxx',\n PY: 'xxx-xxxxxx',\n QA: 'xxxx xxxx',\n RO: 'xxx xxx xxxx',\n RS: 'xxx xxxxx',\n RU: 'xxx xxx-xx-xx',\n RW: 'xxx xxxxxx',\n SA: 'xxx-xxxxxxx',\n SC: 'xx xxxxx',\n SE: 'xxx-xxx xx xx',\n SG: 'xxxx xxxx',\n SI: 'xx xxxxxx',\n SK: 'xxx xxx xxx',\n SL: 'xxx-xxxxxx',\n SM: 'xxxxx xxxxx',\n SN: 'xx xxx xx xx',\n SO: 'xxx xxxxxxx',\n SR: 'xxx-xxxx',\n SS: 'xxx xxxx xxx',\n SV: 'xxxx-xxxx',\n SZ: 'xxx xx xxxx',\n TG: 'xx xx xx xx',\n TH: 'xxx-xxxxxxx',\n TJ: 'xxx xx xx xx',\n TL: 'xxx-xxxxxxx',\n TN: 'xx xxxxxx',\n TR: 'xxx xxx xx xx',\n TT: 'xxx-xxxx',\n TW: 'xxxx-xxxxxx',\n TZ: 'xxx xxx xxxx',\n UA: 'xx xxx xx xx',\n UG: 'xxx xxxxxxx',\n US: 'xxx-xxx-xxxx',\n UY: 'xxx-xxxxx',\n UZ: 'xxx-xxx-xx-xx',\n VC: 'xxx-xxxx',\n VE: 'xxxx-xxx-xxxx',\n VN: 'xxxx-xxxxxxx',\n YE: 'xxxx-xxxx',\n ZA: 'xxx-xxx-xxxx',\n ZM: 'xxx-xxxxxxx',\n ZW: 'xx xxx xxxx',\n KW: 'xxx xx xxxx',\n BH: 'xxxx xxxx',\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Formats a provided phone number according to the predefined format for a specific country code, or auto-detects the country code and formats the number accordingly.\nconst formatPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_FORMATTER_MAPPER,\n): string => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Convert phoneNumber to string and clean it by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_FORMATTER_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Fetch the pattern for the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern) return phoneNumber;\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n // Extract the phoneNumber without the prefix\n const phoneNumberWithoutPrefix = phoneNumber.slice(diff);\n const formattedNumber: string[] = [];\n let numberIndex = 0;\n\n // Loop through the pattern to format the phoneNumber\n for (let i = 0; i < pattern.length; i++) {\n const patternChar = pattern[i];\n if (patternChar === 'x') {\n // Insert phoneNumber digits at 'x' positions\n if (numberIndex < phoneNumberWithoutPrefix.length) {\n formattedNumber.push(phoneNumberWithoutPrefix[numberIndex]);\n numberIndex++;\n }\n } else {\n // Insert non-digit characters from the pattern\n formattedNumber.push(patternChar);\n }\n }\n\n // Join the formattedNumber array to create the formattedPhoneNumber without prefix\n const formattedPhoneNumberWithoutPrefix = formattedNumber.join('');\n // Combine the prefix and formattedPhoneNumberWithoutPrefix\n const formattedPhoneNumberWithPrefix =\n phoneNumber.slice(0, diff) + ' ' + formattedPhoneNumberWithoutPrefix;\n\n // Return the formattedPhoneNumber with prefix after trimming whitespace\n return formattedPhoneNumberWithPrefix.trim();\n};\n\nexport default withErrorBoundary(formatPhoneNumber);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport formatPhoneNumber from './formatPhoneNumber';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\ninterface PhoneInfo {\n countryCode: string;\n dialCode: string;\n formattedPhoneNumber: string;\n formatTemplate: string;\n}\n\n// Parses a given phone number, identifies its country code (if not provided), and returns an object with details including the country code, formatted phone number, dial code, and format template.\nconst parsePhoneNumber = (phoneNumber: string, country?: string): PhoneInfo => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Clean the phoneNumber by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n const countryCode =\n country && country in PHONE_FORMATTER_MAPPER\n ? country\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Format the phone number using the detected/validated country code\n const formattedPhoneNumber = formatPhoneNumber(phoneNumber, countryCode);\n\n // Fetch the pattern associated with the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern)\n return {\n countryCode: countryCode || '',\n dialCode: '',\n formattedPhoneNumber: phoneNumber,\n formatTemplate: '',\n };\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n\n // Extract the dialCode from the phoneNumber\n const dialCode = phoneNumber.slice(0, diff);\n\n // Obtain the format template associated with the countryCode\n const formatTemplate = PHONE_FORMATTER_MAPPER[countryCode];\n\n // Return the parsed phone number information\n return {\n countryCode,\n formattedPhoneNumber,\n dialCode,\n formatTemplate,\n };\n};\n\nexport default withErrorBoundary(parsePhoneNumber);\n"],"names":["formatPhoneNumber"],"mappings":"AAAO,MAAM,kBAAkB,GAA8B;AAC3D,IAAA,EAAE,EAAE,kDAAkD;AACtD,IAAA,EAAE,EAAE,qCAAqC;AACzC,IAAA,EAAE,EAAE,qCAAqC;AACzC,IAAA,EAAE,EAAE,oCAAoC;AACxC,IAAA,EAAE,EAAE,4CAA4C;AAChD,IAAA,EAAE,EAAE,oEAAoE;AACxE,IAAA,EAAE,EAAE,qBAAqB;AACzB,IAAA,EAAE,EAAE,4BAA4B;AAChC,IAAA,EAAE,EAAE,mCAAmC;AACvC,IAAA,EAAE,EAAE,gCAAgC;AACpC,IAAA,EAAE,EAAE,mCAAmC;AACvC,IAAA,EAAE,EAAE,8BAA8B;AAClC,IAAA,EAAE,EAAE,6CAA6C;AACjD,IAAA,EAAE,EAAE,mCAAmC;AACvC,IAAA,EAAE,EAAE,+BAA+B;AACnC,IAAA,EAAE,EAAE,gCAAgC;AACpC,IAAA,EAAE,EAAE,sEAAsE;AAC1E,IAAA,EAAE,EAAE,2BAA2B;AAC/B,IAAA,EAAE,EAAE,sCAAsC;AAC1C,IAAA,EAAE,EAAE,mCAAmC;AACvC,IAAA,EAAE,EAAE,kCAAkC;AACtC,IAAA,EAAE,EAAE,4BAA4B;AAChC,IAAA,EAAE,EAAE,wBAAwB;AAC5B,IAAA,EAAE,EAAE,uB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IAAA,MAAM,IAAI,GAAG,WAAW,CAAC,MAAM,GAAG,2BAA2B,CAAC;;IAG9D,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;;AAG5C,IAAA,MAAM,cAAc,GAAG,sBAAsB,CAAC,WAAW,CAAC,CAAC;;IAG3D,OAAO;QACL,WAAW;QACX,oBAAoB;QACpB,QAAQ;QACR,cAAc;KACf,CAAC;AACJ,CAAC,CAAC;AAEF,yBAAe,iBAAiB,CAA0B,gBAAgB,CAAC;;;;"} \ No newline at end of file diff --git a/lib/types/index.d.ts b/lib/types/index.d.ts new file mode 100644 index 00000000..f0435e49 --- /dev/null +++ b/lib/types/index.d.ts @@ -0,0 +1,99 @@ +interface I18nState { + locale: string; + direction: 'ltr' | 'rtl' | string; + country: string; +} + +declare const _default$p: () => I18nState; + +declare const _default$o: (newState: Partial) => void; + +declare const _default$n: () => void; + +declare const _default$m: (amount: string | number, options?: { + currency?: string | number | undefined; + locale?: string | undefined; + intlOptions?: Intl.NumberFormatOptions | undefined; +} | undefined) => string; + +declare const _default$l: () => { + [key: string]: { + symbol: string; + name: string; + }; +}; + +declare const _default$k: (currencyCode: string | number) => string; + +declare const ALLOWED_FORMAT_PARTS_KEYS: readonly ["nan", "infinity", "percent", "integer", "group", "decimal", "fraction", "plusSign", "minusSign", "percentSign", "currency", "code", "symbol", "name", "compact", "exponentInteger", "exponentMinusSign", "exponentSeparator", "unit"]; + +type FormattedPartsObject = { + [key in (typeof ALLOWED_FORMAT_PARTS_KEYS)[number]]?: string | undefined; +}; +interface ByParts extends FormattedPartsObject { + isPrefixSymbol: boolean; + rawParts: Array<{ + type: string; + value: unknown; + }>; +} + +declare const _default$j: (amount: string | number, options?: { + currency?: string | number | undefined; + locale?: string | undefined; + intlOptions?: Intl.NumberFormatOptions | undefined; +} | undefined) => ByParts; + +declare const _default$i: (phoneNumber: string | number, countryCode?: string | number | undefined) => boolean; + +declare const _default$h: (phoneNumber: string | number, countryCode?: string | number | undefined) => string; + +interface PhoneInfo { + countryCode: string; + dialCode: string; + formattedPhoneNumber: string; + formatTemplate: string; +} +declare const _default$g: (phoneNumber: string, country?: string | undefined) => PhoneInfo; + +declare const _default$f: (date: Date, value: number, unit: "days" | "months" | "years") => Date; + +type DateInput = Date | string; +interface DateTimeFormatOptions extends Intl.DateTimeFormatOptions { +} +interface DateFormatOptions extends Omit { +} +interface TimeFormatOptions extends Omit { +} + +declare const _default$e: (date: DateInput, locale: string, options?: DateFormatOptions | undefined) => string; + +declare const _default$d: (date: DateInput, locale: string, options?: DateTimeFormatOptions | undefined) => string; + +declare const _default$c: (date: DateInput, locale: string, options?: TimeFormatOptions | undefined) => string; + +declare const _default$b: (locale: string) => number; + +declare const _default$a: (date: Date) => number; + +declare const _default$9: (date: Date, baseDate: Date | undefined, locale: string, options?: Intl.RelativeTimeFormatOptions | undefined) => string; + +declare const _default$8: (date: Date) => number; + +declare const _default$7: (locale: string) => string[]; + +declare const _default$6: (date1: DateInput, date2: DateInput) => boolean; + +declare const _default$5: (date1: DateInput, date2: DateInput) => boolean; + +declare const _default$4: (year: number) => boolean; + +declare const _default$3: (date1: Date, date2: Date) => boolean; + +declare const _default$2: (date: any) => boolean; + +declare const _default$1: (dateString: string, locale: string) => Date | null; + +declare const _default: (date: Date, value: number, unit: "days" | "months" | "years") => Date; + +export { _default$f as add, _default$e as formatDate, _default$d as formatDateTime, _default$m as formatNumber, _default$j as formatNumberByParts, _default$h as formatPhoneNumber, _default$c as formatTime, _default$l as getCurrencyList, _default$k as getCurrencySymbol, _default$b as getFirstDayOfWeek, _default$a as getQuarter, _default$9 as getRelativeTime, _default$p as getState, _default$8 as getWeek, _default$7 as getWeekdays, _default$6 as isAfter, _default$5 as isBefore, _default$4 as isLeapYear, _default$3 as isSameDay, _default$2 as isValidDate, _default$i as isValidPhoneNumber, _default$1 as parseDate, _default$g as parsePhoneNumber, _default$n as resetState, _default$o as setState, _default as subtract }; diff --git a/lib/umd/index.js b/lib/umd/index.js new file mode 100644 index 00000000..d8b2f137 --- /dev/null +++ b/lib/umd/index.js @@ -0,0 +1,1589 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.i18nify = {})); +})(this, (function (exports) { 'use strict'; + + // Custom Error class to extend properties to error object + class I18nifyError extends Error { + constructor(message) { + super(message); + this.name = 'i18nify Error'; + this.timestamp = new Date(); + // more params like type of error/severity can be added in future for better debugging. + } + } + /** + * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block. + * It appends additional attributes and serves as a centralized error-handling service. + * Usage => + * const wrappedUtilityFn = withErrorBoundary(utilityFn) + * + * @param fn utility that is wrapped in error boundary + * @returns {Function} returns the function wrapped in try/catch block + */ + const withErrorBoundary = (fn) => { + return function (...rest) { + try { + return fn.call(this, ...rest); + } + catch (err) { + console.warn('[I18N Error]: ', err); + // Currently, we are throwing the error as it is to consumers. + // In the future, this can be modified as per our requirement, like an error logging service. + throw new I18nifyError(err); + } + }; + }; + + function getDefaultState() { + return { + locale: '', + direction: '', + country: '', + }; + } + + class I18nStateManager { + constructor() { + this.state = getDefaultState(); + } + static getInstance() { + if (!I18nStateManager.instance) { + I18nStateManager.instance = new I18nStateManager(); + } + return I18nStateManager.instance; + } + static resetInstance() { + I18nStateManager.instance = undefined; + } + getState() { + return Object.assign({}, this.state); + } + setState(newState) { + this.state = Object.assign(Object.assign({}, this.state), newState); + } + resetState() { + this.state = getDefaultState(); + } + } + var state = I18nStateManager.getInstance(); + + /** + * function to return active i18n state + * + * ===== USAGE ===== + * import { getState } from '@razorpay/i18nify-js'; + * + * console.log(getState()) + * + * @returns i18n state + */ + const getState = () => { + return state.getState(); + }; + var getState$1 = withErrorBoundary(getState); + + /** + * Function to set and override the active state in i18nify SDK + * + * ===== USAGE ===== + * import { setState } from "@razorpay/i18nify-js"; + * setState({locale: 'en-US'}) + * + * @param newState data to set in i18nState instance + */ + const setState = (newState) => { + state.setState(newState); + }; + var setState$1 = withErrorBoundary(setState); + + /** + * Function to reset the active state in i18nify SDK + * + * ===== USAGE ===== + * import { resetState } from "@razorpay/i18nify-js"; + * resetState() + * + * @param newState data to set in i18nState instance + */ + const resetState = () => { + state.resetState(); + }; + var resetState$1 = withErrorBoundary(resetState); + + const getLocale = () => { + // Check if running in a non-browser environment (e.g., Node.js or older browsers). + if (typeof navigator === 'undefined') { + return 'en-IN'; + } + // Check if the browser supports the Intl object and user language preferences. + if (window.Intl && + typeof window.Intl === 'object' && + (window.navigator.languages || window.navigator.language)) { + const userLocales = window.navigator.languages || [ + window.navigator.language, + ]; + return userLocales[0]; + } + // Fallback to a supported locale or the default locale. + return 'en-IN'; + }; + + const getIntlInstanceWithOptions = (options = {}) => { + /** retrieve locale from below areas in order of preference + * 1. options.locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + let locale = (options === null || options === void 0 ? void 0 : options.locale) || state.getState().locale; + // If a specific locale is provided, use it; otherwise, use the browser's locale + if (!locale) { + locale = getLocale(); + } + const intlOptions = (options === null || options === void 0 ? void 0 : options.intlOptions) ? Object.assign({}, options.intlOptions) : {}; + if ((options === null || options === void 0 ? void 0 : options.currency) || intlOptions.currency) { + intlOptions.style = 'currency'; + intlOptions.currency = (options.currency || intlOptions.currency); + } + if (!locale) + throw new Error('Pass valid locale !'); + return new Intl.NumberFormat(locale || undefined, intlOptions); + }; + + // this function formats number based on different arguments passed + const formatNumber = (amount, options = {}) => { + if (!Number(amount) && Number(amount) !== 0) + throw new Error('Parameter `amount` is not a number!'); + let formattedAmount = ''; + try { + formattedAmount = getIntlInstanceWithOptions(options).format(Number(amount)); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + return formattedAmount; + }; + var formatNumber$1 = withErrorBoundary(formatNumber); + + const CURRENCIES = { + AED: { symbol: 'د.إ', name: 'United Arab Emirates Dirham' }, + ALL: { symbol: 'Lek', name: 'Albanian Lek' }, + AMD: { symbol: '֏', name: 'Armenian Dram' }, + ARS: { symbol: 'ARS', name: 'Argentine Peso' }, + AUD: { symbol: 'A$', name: 'Australian Dollar' }, + AWG: { symbol: 'Afl.', name: 'Aruban Florin' }, + BBD: { symbol: '$', name: 'Barbadian Dollar' }, + BDT: { symbol: '৳', name: 'Bangladeshi Taka' }, + BMD: { symbol: '$', name: 'Bermudian Dollar' }, + BND: { symbol: 'BND', name: 'Brunei Dollar' }, + BOB: { symbol: 'Bs', name: 'Bolivian Boliviano' }, + BSD: { symbol: 'B$', name: 'Bahamian Dollar' }, + BWP: { symbol: 'P', name: 'Botswanan Pula' }, + BZD: { symbol: 'BZ$', name: 'Belize Dollar' }, + CAD: { symbol: 'C$', name: 'Canadian Dollar' }, + CHF: { symbol: 'CHf', name: 'Swiss Franc' }, + CNY: { symbol: '¥', name: 'Chinese Yuan' }, + COP: { symbol: 'COL$', name: 'Colombian Peso' }, + CRC: { symbol: '₡', name: 'Costa Rican Colón' }, + CUP: { symbol: '$MN', name: 'Cuban Peso' }, + CZK: { symbol: 'Kč', name: 'Czech Koruna' }, + DKK: { symbol: 'DKK', name: 'Danish Krone' }, + DOP: { symbol: 'RD$', name: 'Dominican Peso' }, + DZD: { symbol: 'د.ج', name: 'Algerian Dinar' }, + EGP: { symbol: 'E£', name: 'Egyptian Pound' }, + ETB: { symbol: 'ብር', name: 'Ethiopian Birr' }, + EUR: { symbol: '€', name: 'Euro' }, + FJD: { symbol: 'FJ$', name: 'Fijian Dollar' }, + GBP: { symbol: '£', name: 'British Pound' }, + GHS: { symbol: 'GH₵', name: 'Ghanaian Cedi' }, + GIP: { symbol: 'GIP', name: 'Gibraltar Pound' }, + GMD: { symbol: 'D', name: 'Gambian Dalasi' }, + GTQ: { symbol: 'Q', name: 'Guatemalan Quetzal' }, + GYD: { symbol: 'G$', name: 'Guyanese Dollar' }, + HKD: { symbol: 'HK$', name: 'Hong Kong Dollar' }, + HNL: { symbol: 'HNL', name: 'Honduran Lempira' }, + HRK: { symbol: 'kn', name: 'Croatian Kuna' }, + HTG: { symbol: 'G', name: 'Haitian Gourde' }, + HUF: { symbol: 'Ft', name: 'Hungarian Forint' }, + IDR: { symbol: 'Rp', name: 'Indonesian Rupiah' }, + ILS: { symbol: '₪', name: 'Israeli New Shekel' }, + INR: { symbol: '₹', name: 'Indian Rupee' }, + JMD: { symbol: 'J$', name: 'Jamaican Dollar' }, + KES: { symbol: 'Ksh', name: 'Kenyan Shilling' }, + KGS: { symbol: 'Лв', name: 'Kyrgystani Som' }, + KHR: { symbol: '៛', name: 'Cambodian Riel' }, + KYD: { symbol: 'CI$', name: 'Cayman Islands Dollar' }, + KZT: { symbol: '₸', name: 'Kazakhstani Tenge' }, + LAK: { symbol: '₭', name: 'Laotian Kip' }, + LKR: { symbol: 'රු', name: 'Sri Lankan Rupee' }, + LRD: { symbol: 'L$', name: 'Liberian Dollar' }, + LSL: { symbol: 'LSL', name: 'Lesotho Loti' }, + MAD: { symbol: 'د.م.', name: 'Moroccan Dirham' }, + MDL: { symbol: 'MDL', name: 'Moldovan Leu' }, + MKD: { symbol: 'ден', name: 'Macedonian Denar' }, + MMK: { symbol: 'MMK', name: 'Myanmar Kyat' }, + MNT: { symbol: '₮', name: 'Mongolian Tugrik' }, + MOP: { symbol: 'MOP$', name: 'Macanese Pataca' }, + MUR: { symbol: '₨', name: 'Mauritian Rupee' }, + MVR: { symbol: 'Rf', name: 'Maldivian Rufiyaa' }, + MWK: { symbol: 'MK', name: 'Malawian Kwacha' }, + MXN: { symbol: 'Mex$', name: 'Mexican Peso' }, + MYR: { symbol: 'RM', name: 'Malaysian Ringgit' }, + NAD: { symbol: 'N$', name: 'Namibian Dollar' }, + NGN: { symbol: '₦', name: 'Nigerian Naira' }, + NIO: { symbol: 'NIO', name: 'Nicaraguan Córdoba' }, + NOK: { symbol: 'NOK', name: 'Norwegian Krone' }, + NPR: { symbol: 'रू', name: 'Nepalese Rupee' }, + NZD: { symbol: 'NZ$', name: 'New Zealand Dollar' }, + PEN: { symbol: 'S/', name: 'Peruvian Nuevo Sol' }, + PGK: { symbol: 'PGK', name: 'Papua New Guinean Kina' }, + PHP: { symbol: '₱', name: 'Philippine Peso' }, + PKR: { symbol: '₨', name: 'Pakistani Rupee' }, + QAR: { symbol: 'QR', name: 'Qatari Riyal' }, + RUB: { symbol: '₽', name: 'Russian Ruble' }, + SAR: { symbol: 'SR', name: 'Saudi Riyal' }, + SCR: { symbol: 'SRe', name: 'Seychellois Rupee' }, + SEK: { symbol: 'SEK', name: 'Swedish Krona' }, + SGD: { symbol: 'S$', name: 'Singapore Dollar' }, + SLL: { symbol: 'Le', name: 'Sierra Leonean Leone' }, + SOS: { symbol: 'Sh.so.', name: 'Somali Shilling' }, + SSP: { symbol: 'SS£', name: 'South Sudanese Pound' }, + SVC: { symbol: '₡', name: 'Salvadoran Colón' }, + SZL: { symbol: 'E', name: 'Swazi Lilangeni' }, + THB: { symbol: '฿', name: 'Thai Baht' }, + TTD: { symbol: 'TT$', name: 'Trinidad and Tobago Dollar' }, + TZS: { symbol: 'Sh', name: 'Tanzanian Shilling' }, + USD: { symbol: '$', name: 'United States Dollar' }, + UYU: { symbol: '$U', name: 'Uruguayan Peso' }, + UZS: { symbol: "so'm", name: 'Uzbekistani Som' }, + YER: { symbol: '﷼', name: 'Yemeni Rial' }, + ZAR: { symbol: 'R', name: 'South African Rand' }, + KWD: { symbol: 'د.ك', name: 'Kuwaiti Dinar' }, + BHD: { symbol: 'د.ب.', name: 'Bahraini Dinar' }, + OMR: { symbol: 'ر.ع.', name: 'Omani Rial' }, + }; + + const getCurrencyList = () => { + return CURRENCIES; + }; + var getCurrencyList$1 = withErrorBoundary(getCurrencyList); + + const getCurrencySymbol = (currencyCode) => { + var _a; + if (currencyCode in CURRENCIES) + return (_a = CURRENCIES[currencyCode]) === null || _a === void 0 ? void 0 : _a.symbol; + else + throw new Error('Invalid currencyCode!'); + }; + var getCurrencySymbol$1 = withErrorBoundary(getCurrencySymbol); + + const ALLOWED_FORMAT_PARTS_KEYS = [ + 'nan', + 'infinity', + 'percent', + 'integer', + 'group', + 'decimal', + 'fraction', + 'plusSign', + 'minusSign', + 'percentSign', + 'currency', + 'code', + 'symbol', + 'name', + 'compact', + 'exponentInteger', + 'exponentMinusSign', + 'exponentSeparator', + 'unit', + ]; + + const formatNumberByParts = (amount, options = {}) => { + if (!Number(amount) && Number(amount) !== 0) + throw new Error('Parameter `amount` is not a number!'); + try { + const formattedAmount = getIntlInstanceWithOptions(options).formatToParts(Number(amount)); + const parts = formattedAmount; + const formattedObj = {}; + parts.forEach((p) => { + if (p.type === 'group') { + formattedObj.integer = (formattedObj.integer || '') + p.value; + } + else if (ALLOWED_FORMAT_PARTS_KEYS.findIndex((item) => item === p.type) != -1) { + // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal' is skipped + formattedObj[p.type] = (formattedObj[p.type] || '') + p.value; + } + }); + return Object.assign(Object.assign({}, formattedObj), { isPrefixSymbol: parts[0].type === 'currency', rawParts: parts }); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + }; + var formatNumberByParts$1 = withErrorBoundary(formatNumberByParts); + + const PHONE_REGEX_MAPPER = { + IN: /^(?:(?:\+|0{0,2})91\s*[-]?\s*|[0]?)?[6789]\d{9}$/, + MY: /^(\+?6?0)?(\d{1,3})[-. ]?(\d{7,8})$/, + AE: /^(?:\+?971|0)?(?:2|3|4|6|7|9)\d{8}$/, + AL: /^(?:\+?355)?(?:[4-9]\d{7}|6\d{8})$/, + AM: /^(?:\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/, + AR: /^(?:(?:\+|0{0,2})54)?(?:11|[2368]\d)(?:(?=\d{0,2}15)\d{2})??\d{8}$/, + AU: /^(?:\+?61|0)4\d{8}$/, + AW: /^(?:(?:\+297)?(?!0)\d{7})$/, + BB: /^(?:(?:\+1)?246)?(?:\d{3})?\d{7}$/, + BD: /^(?:\+?880|0)1[13456789]\d{8}$/, + BM: /^(?:(?:\+1)?441)?(?:\d{2})?\d{7}$/, + BN: /^(?:\+?673)?(?:\d{3})?\d{4}$/, + BO: /^(?:(?:\+|0{0,2})591)?(?:(?:2|3|7|6)\d{7})$/, + BS: /^(?:(?:\+1)?242)?(?:\d{3})?\d{7}$/, + BW: /^(?:(?:\+267)?\s?)?[74]\d{7}$/, + BZ: /^(?:(?:\+501)?\s?)?[622]\d{4}$/, + CH: /^(?:(?:\+41|0)(?:\s*\(?0\)?\s*))?(?:\d{2}\s*)?\d{3}\s*\d{2}\s*\d{2}$/, + CN: /^(?:(?:\+|00)86)?1\d{10}$/, + CO: /^(?:(?:\+57|0057)?)?[1-8]{1}\d{6,7}$/, + OM: /^(?:\+?968)?(?:95|96|97|98)\d{6}$/, + CR: /^(?:(?:\+506)?\s*|0)?[1-9]\d{7}$/, + CU: /^(?:\+?53)?(?:[5-8]\d{7})$/, + CZ: /^(?:\+?420)?(?:\d{9})$/, + DK: /^(?:\+?45)?(?:\d{8})$/, + DO: /^(?:(?:\+1)?809|1-8(?:00|88|89))(?:\d{7})$/, + DZ: /^(?:\+?213|0)([567]\d{8})$/, + EG: /^(?:(?:\+20|20)?(\d{10}))$/, + ET: /^(?:\+?251)?[1-59]\d{8}$/, + EU: /^(?:(?:\+?3)?8)?\s*(?:\d{3}\s*){3}\d{2}$/, + FJ: /^(?:(?:\+?679)?\s?\d{3}\s?\d{4})?$/, + GB: /^(?:(?:\+44\s?|0)7\d{3}(\s?\d{4,})?)$/, + GH: /^(?:(?:\+233)|0)?(?:\d{9})$/, + GI: /^(?:\+350)?\d{5}$/, + GM: /^(?:\+220)?\d{5,7}$/, + GT: /^(?:\+502)?[2468]\d{7,8}$/, + GY: /^(?:(?:\+592)?(?:(?:\s)?[2-9])(?:(?:\s)?\d))?(?:(?:\s)?\d{4})$/, + HK: /^(?:\+852\s?)?[456789]\d{3}\s?\d{4}$/, + HN: /^(?:\+504)?[89]\d{7}$/, + HR: /^(?:\+?385)?\d{8,9}$/, + HT: /^(?:\+?509)?\d{8}$/, + HU: /^(?:(?:\+36))(\s?\d{2}\s?\d{3}\s?\d{4})$/, + ID: /^(?:\+?62|0[1-9])[\s-]?\d{2,4}[\s-]?\d{3,4}[\s-]?\d{3,4}$/, + IL: /^(?:(?:\+972|0)(?:-)?)[23489]\d{7}$/, + JM: /^(?:(?:\+1876))\d{7,10}$/, + KE: /^(?:(?:\+254)|(?:0))(?:\d{6,7})$/, + KG: /^(?:\+996)?\s?\d{9}$/, + KH: /^(?:(?:\+855)|(?:0))(?:\s?[1-9]\d{7,8})$/, + KY: /^(?:\+?1\s?(345))\d{6}$/, + KZ: /^(?:\+?7|8)?7\d{9}$/, + LA: /^(?:(?:\+?856)|0)(20\d{7,9})$/, + LK: /^(?:(?:\+94)|0)(?:\d{9})$/, + LR: /^(?:\+231)[ -\d]{4}[ -\d]{4}$/, + LS: /^(?:(?:\+?266)|0)?[56]\d{7}$/, + MA: /^(?:(?:\+?212(\s*[-|\s*]?\d{1,9})?)|(?:0))(?:\d{9})$/, + MD: /^(?:(?:\+373)|(?:0))(?:\d{7,8})$/, + MK: /^(?:\+389|0)(?:(?:2[0-4]|[3-9])\s?)?\d{6}$/, + MM: /^(?:(?:\+?95)|0)?[1-9]\d{9}$/, + MN: /^(?:\+976|0)\d{8}$/, + MO: /^(?:(?:\+?853)|[0-9])?\d{8}$/, + MU: /^(?:\+230|0)?\d{8}$/, + MV: /^(?:(?:\+?960)|0)?\d{7}$/, + MW: /^(?:\+265)[1-9]\d{6}$/, + MX: /^(?:(?:\+?52)?\s?(?:1|01)?\s?)?(?:\d{3}\s?\d{3}\s?\d{4})$/, + NA: /^(?:(?:\+264)|0)?\d{8}$/, + NG: /^(?:(?:\+234)|(?:0))(?:\d{7,8})$/, + NI: /^(?:(?:\+505))?(?:\d{8})$/, + NO: /^(?:(?:\+?47)|\d{2}|\d{3})\s?\d{2}\s?\d{3}$/, + NP: /^(?:(?:\+977))?(\d{9,10})$/, + NZ: /^(?:\+?64|0)(\d{2,5} \d{4,8}|\d{3,4} \d{4})$/, + PE: /^(?:(?:\+51)|0)?(?:9\d{8})$/, + PG: /^(?:\+?675)?(?:[7-9]\d{7})$/, + PH: /^(?:(?:\+?63)|0)(?:\d{10})$/, + PK: /^(?:(?:\+92)|0)?[345]\d{9}$/, + QA: /^(?:\+?974)?-?33\d{5}$/, + RU: /^(?:\+?7|8)?[ -]?\(?9\d{2}\)?[ -]?\d{3}[ -]?\d{2}[ -]?\d{2}$/, + SA: /^(?:\+?966)?\s?1?[\s-]?(?:[45]\d{2}|5\d{3})[\s-]?\d{4}$/, + SC: /^(?:(?:\+248)|\d{4})\d{5}$/, + SE: /^(?:\+?46|0)\s?[1-57-9](?:[0-9]\s?){8}$/, + SG: /^(?:(?:\+65)|(?:\(\+65\))|(?:65))\d{4}\d{4}$/, + SL: /^(?:(?:\+232)|(?:0))?\d{9}$/, + SO: /^(?:\+252|0)?[567]\d{7}$/, + SS: /^(?:\+211|0)?[1-9]\d{7,9}$/, + SV: /^(?:(?:\+?503)|(?:0))(?:\d{8})$/, + SZ: /^(?:\+?268)?\d{7,8}$/, + TH: /^(?:(?:\+66)|0)\d{9}$/, + TT: /^(?:(?:\+?1-868)|\(?868\)?)(\d{7})$/, + TZ: /^(?:(?:\+?255)|0)?[67]\d{8}$/, + US: /^(\+\d{1,2}\s?)?([2-9]{1}\d{2}[2-9]{1}\d{6})$/, + CA: /^(\+\d{1,2}\s?)?([2-9]{1}\d{2}[2-9]{1}\d{6})$/, + UY: /^(?:(?:\+598|0)\s?(9\d{3}|2\d{2}|[4-9]\d{6}))$/, + UZ: /^(?:\+?998)?\s?[3456789]\d{8}$/, + YE: /^(?:\+?967)?(?:\d{7,8})$/, + ZA: /^(?:(?:\+27)|0)(\d{9})$/, + KW: /^(?:\+?965)[569]\d{7}$/, + BH: /^(?:\+?973)?[356]\d{7}$/, + TL: /^(?:(?:\+670)\s?)?[0-9]{3}\s?[0-9]{3,4}$/, + VC: /^(?:(?:\+1)?784)?(?:\d{3})?\d{7}$/, + VE: /^(?:(?:\+58)|0)?4\d{9}$/, + VN: /^(?:(?:\+84)|0)?[1-9]\d{8}$/, + ZM: /^(?:(?:\+260)|0)?[123456789]\d{8,9}$/, + ZW: /^(?:(?:\+263)|0)?(?:\d{9,10})$/, + LT: /^(?:(?:\+370)|8)\d{8}$/, + LU: /^(?:(?:\+352)?(6|2(6|7|8|9))\d{6})$/, + LV: /^(?:(?:\+371)?2\d{7})$/, + ME: /^(?:(?:\+382)?[67]\d{7,20})$/, + MG: /^(?:(?:\+261)?3[234568]\d{7})$/, + MZ: /^(?:(?:\+258)|(?:258))?8[234567]\d{7,8}$/, + NL: /^(?:(?:\+31)|0(6(?:\d{8})|[1-9](?:(?:\d{8})|(?:\s\d{3}\s\d{4}))|(?:\d{8})))$/, + PA: /^(?:(?:\+507)\s?)?[46]\d{6,7}$/, + PL: /^(?:(?:\+48)?(?:\s?\d{3}\s?\d{3}\s?\d{3}|(?:\d{2}\s?){4}\d{2}|\d{3}-\d{3}-\d{3}))$/, + PR: /^(?:(?:\+1)?787|939)\d{7}$/, + PS: /^(?:(?:\+970))(5[2349])\d{7}$/, + PT: /^(?:(?:\+351)?9(1\d|2[1-9]|6[12345789]|7[12345789])\d{7})$/, + PY: /^(?:(?:\+595|0)9[9876]\d{7})$/, + RO: /^(?:(?:\+40|0))(?:7[2-8]\d{7}|21\d{8})$/, + RS: /^(?:(?:\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/, + RW: /^(?:(?:\+250)|(0))\d{9}$/, + SI: /^(?:(?:\+386)|0)?[1-59]\d{7,8}$/, + SK: /^(?:(?:\+421))?(0|9[0-8])\d{8}$/, + SM: /^(?:(?:\+378)|(0549|6\d{4}))\d{5}$/, + SN: /^(?:(?:\+221)|0)?[3679]\d{7}$/, + SR: /^(?:(?:\+597))\d{7}$/, + TG: /^(?:(?:\+228))\d{8}$/, + TJ: /^(?:(?:\+992))(37|55|77)\d{7}$/, + TN: /^(?:(?:\+216)|22|9[1-9])\d{7}$/, + TR: /^(?:(?:\+90)|(0))\s?5\d{9}$/, + TW: /^(?:(?:\+886)|0)?9\d{8}$/, + UA: /^(?:(?:\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\d{7}$/, + UG: /^(?:(?:\+256)|0)?[39]\d{8}$/, + }; + + /* Source: Google LibPhoneNumber Metadata: https://github.com/google/libphonenumber/blob/master/javascript/i18n/phonenumbers/metadata.js */ + const DIAL_CODE_MAPPER = { + 1: [ + 'US', + 'AG', + 'AI', + 'AS', + 'BB', + 'BM', + 'BS', + 'CA', + 'DM', + 'DO', + 'GD', + 'GU', + 'JM', + 'KN', + 'KY', + 'LC', + 'MP', + 'MS', + 'PR', + 'SX', + 'TC', + 'TT', + 'VC', + 'VG', + 'VI', + ], + 7: ['RU', 'KZ'], + 20: ['EG'], + 27: ['ZA'], + 30: ['GR'], + 31: ['NL'], + 32: ['BE'], + 33: ['FR'], + 34: ['ES'], + 36: ['HU'], + 39: ['IT', 'VA'], + 40: ['RO'], + 41: ['CH'], + 43: ['AT'], + 44: ['GB', 'GG', 'IM', 'JE'], + 45: ['DK'], + 46: ['SE'], + 47: ['NO', 'SJ'], + 48: ['PL'], + 49: ['DE'], + 51: ['PE'], + 52: ['MX'], + 53: ['CU'], + 54: ['AR'], + 55: ['BR'], + 56: ['CL'], + 57: ['CO'], + 58: ['VE'], + 60: ['MY'], + 61: ['AU', 'CC', 'CX'], + 62: ['ID'], + 63: ['PH'], + 64: ['NZ'], + 65: ['SG'], + 66: ['TH'], + 81: ['JP'], + 82: ['KR'], + 84: ['VN'], + 86: ['CN'], + 90: ['TR'], + 91: ['IN'], + 92: ['PK'], + 93: ['AF'], + 94: ['LK'], + 95: ['MM'], + 98: ['IR'], + 211: ['SS'], + 212: ['MA', 'EH'], + 213: ['DZ'], + 216: ['TN'], + 218: ['LY'], + 220: ['GM'], + 221: ['SN'], + 222: ['MR'], + 223: ['ML'], + 224: ['GN'], + 225: ['CI'], + 226: ['BF'], + 227: ['NE'], + 228: ['TG'], + 229: ['BJ'], + 230: ['MU'], + 231: ['LR'], + 232: ['SL'], + 233: ['GH'], + 234: ['NG'], + 235: ['TD'], + 236: ['CF'], + 237: ['CM'], + 238: ['CV'], + 239: ['ST'], + 240: ['GQ'], + 241: ['GA'], + 242: ['CG'], + 243: ['CD'], + 244: ['AO'], + 245: ['GW'], + 246: ['IO'], + 247: ['AC'], + 248: ['SC'], + 249: ['SD'], + 250: ['RW'], + 251: ['ET'], + 252: ['SO'], + 253: ['DJ'], + 254: ['KE'], + 255: ['TZ'], + 256: ['UG'], + 257: ['BI'], + 258: ['MZ'], + 260: ['ZM'], + 261: ['MG'], + 262: ['RE', 'YT'], + 263: ['ZW'], + 264: ['NA'], + 265: ['MW'], + 266: ['LS'], + 267: ['BW'], + 268: ['SZ'], + 269: ['KM'], + 290: ['SH', 'TA'], + 291: ['ER'], + 297: ['AW'], + 298: ['FO'], + 299: ['GL'], + 350: ['GI'], + 351: ['PT'], + 352: ['LU'], + 353: ['IE'], + 354: ['IS'], + 355: ['AL'], + 356: ['MT'], + 357: ['CY'], + 358: ['FI', 'AX'], + 359: ['BG'], + 370: ['LT'], + 371: ['LV'], + 372: ['EE'], + 373: ['MD'], + 374: ['AM'], + 375: ['BY'], + 376: ['AD'], + 377: ['MC'], + 378: ['SM'], + 380: ['UA'], + 381: ['RS'], + 382: ['ME'], + 383: ['XK'], + 385: ['HR'], + 386: ['SI'], + 387: ['BA'], + 389: ['MK'], + 420: ['CZ'], + 421: ['SK'], + 423: ['LI'], + 500: ['FK'], + 501: ['BZ'], + 502: ['GT'], + 503: ['SV'], + 504: ['HN'], + 505: ['NI'], + 506: ['CR'], + 507: ['PA'], + 508: ['PM'], + 509: ['HT'], + 590: ['GP', 'BL', 'MF'], + 591: ['BO'], + 592: ['GY'], + 593: ['EC'], + 594: ['GF'], + 595: ['PY'], + 596: ['MQ'], + 597: ['SR'], + 598: ['UY'], + 599: ['CW', 'BQ'], + 670: ['TL'], + 672: ['NF'], + 673: ['BN'], + 674: ['NR'], + 675: ['PG'], + 676: ['TO'], + 677: ['SB'], + 678: ['VU'], + 679: ['FJ'], + 680: ['PW'], + 681: ['WF'], + 682: ['CK'], + 683: ['NU'], + 685: ['WS'], + 686: ['KI'], + 687: ['NC'], + 688: ['TV'], + 689: ['PF'], + 690: ['TK'], + 691: ['FM'], + 692: ['MH'], + 800: ['001'], + 808: ['001'], + 850: ['KP'], + 852: ['HK'], + 853: ['MO'], + 855: ['KH'], + 856: ['LA'], + 870: ['001'], + 878: ['001'], + 880: ['BD'], + 881: ['001'], + 882: ['001'], + 883: ['001'], + 886: ['TW'], + 888: ['001'], + 960: ['MV'], + 961: ['LB'], + 962: ['JO'], + 963: ['SY'], + 964: ['IQ'], + 965: ['KW'], + 966: ['SA'], + 967: ['YE'], + 968: ['OM'], + 970: ['PS'], + 971: ['AE'], + 972: ['IL'], + 973: ['BH'], + 974: ['QA'], + 975: ['BT'], + 976: ['MN'], + 977: ['NP'], + 979: ['001'], + 992: ['TJ'], + 993: ['TM'], + 994: ['AZ'], + 995: ['GE'], + 996: ['KG'], + 998: ['UZ'], + }; + + /** + * Determines the country code based on the provided phone number. + * This function employs a multi-step approach to identify the country code: + * - If the phone number starts with '+', it extracts the numeric characters + * and matches the leading digits with known dial codes mapped to countries. + * - For matched dial codes, it further filters based on country-specific regex patterns + * to validate the phone number format for those countries. + * - If the phone number doesn't start with '+', it directly matches the number + * against regular expressions associated with various countries to identify the code. + * + * @param phoneNumber The input phone number (string or number). + * @returns The detected country code or an empty string if not found. + */ + const detectCountryCodeFromDialCode = (phoneNumber) => { + // If the phone number starts with '+', extract numeric characters + if (phoneNumber.toString().charAt(0) === '+') { + const cleanedPhoneNumberWithoutPlusPrefix = phoneNumber + .toString() + .replace(/\D/g, ''); + const matchingCountries = []; + // Iterate through dial codes and check for matches with cleaned phone number + for (const code in DIAL_CODE_MAPPER) { + if (cleanedPhoneNumberWithoutPlusPrefix.startsWith(code)) { + matchingCountries.push(...DIAL_CODE_MAPPER[code]); + } + } + // Filter matching countries based on phone number validation regex + const matchedCountryCode = matchingCountries.find((countryCode) => { + const regex = PHONE_REGEX_MAPPER[countryCode]; + if (regex && regex.test(phoneNumber.toString())) + return countryCode; + return undefined; + }); + // Return the first matched country code, if any + return matchedCountryCode || ''; + } + else { + // If phone number doesn't start with '+', directly match against country regexes + for (const countryCode in PHONE_REGEX_MAPPER) { + const regex = PHONE_REGEX_MAPPER[countryCode]; + if (regex.test(phoneNumber.toString())) { + return countryCode; + } + } + } + // Return empty string if no country code is detected + return ''; + }; + const cleanPhoneNumber = (phoneNumber) => { + // Regular expression to match all characters except numbers and + sign at the start + const regex = /[^0-9+]|(?!A)\+/g; + // Replace matched characters with an empty string + const cleanedPhoneNumber = phoneNumber.replace(regex, ''); + return phoneNumber[0] === '+' ? `+${cleanedPhoneNumber}` : cleanedPhoneNumber; + }; + + // Validates whether a given phone number is valid based on the provided country code or auto-detects the country code and checks if the number matches the defined regex pattern for that country. + const isValidPhoneNumber = (phoneNumber, countryCode) => { + // Clean the provided phoneNumber by removing non-numeric characters + const cleanedPhoneNumber = cleanPhoneNumber(phoneNumber.toString()); + // Detect or validate the country code + countryCode = + countryCode && countryCode in PHONE_REGEX_MAPPER + ? countryCode + : detectCountryCodeFromDialCode(cleanedPhoneNumber); + // Return false if phoneNumber is empty + if (!phoneNumber) + return false; + // Check if the countryCode exists in the PHONE_REGEX_MAPPER + if (countryCode in PHONE_REGEX_MAPPER) { + // Fetch the regex pattern for the countryCode + const regex = PHONE_REGEX_MAPPER[countryCode]; + // Test if the cleanedPhoneNumber matches the regex pattern + return regex.test(cleanedPhoneNumber); + } + // Return false if the countryCode is not supported + return false; + }; + var isValidPhoneNumber$1 = withErrorBoundary(isValidPhoneNumber); + + const PHONE_FORMATTER_MAPPER = { + IN: 'xxxx xxxxxx', + MY: 'xx xxxxx xx', + AE: 'xx xxx xxxx', + AL: 'xxx xx xxxx', + AM: 'xx xx xx xx', + AR: 'xxxx-xxxx', + AU: 'xxx xxx xxx', + AW: 'xxx-xxxx', + BB: 'xxx-xxxx', + BD: 'xxxx-xxxxxx', + BM: 'xxx-xxxx', + BN: 'xxxx-xxxx', + BO: 'xxxx-xxxx', + BS: 'xxx-xxxx', + BW: 'xx xxxx xxxx', + BZ: 'xxx-xxxx', + CA: 'xxx-xxx-xxxx', + CH: 'xxx xxx xxx', + CN: 'xxxx-xxxxxxx', + CO: 'xxxx-xxxxxxx', + CR: 'xxxx-xxxx', + CU: 'xxxx-xxxx', + CZ: 'xxx xxx xxx', + DK: 'xx xx xx xx', + DO: 'xxx-xxxxxxx', + DZ: 'xxxx-xxxx-xxx', + EG: 'xx xxx xxxx', + ET: 'xx xxx xxxx', + EU: 'xxx xx xx xx', + FJ: 'xxxx xxxx', + GB: 'xxxx xxx xxx', + GH: 'xxx xxx xxxx', + GI: 'xxxx xxxx', + GM: 'xxxx-xxxx', + GT: 'xxxx-xxxx', + GY: 'xxx-xxxx', + HK: 'xxxx xxxx', + HN: 'xxxx-xxxx', + HR: 'xxx xxx xxxx', + HT: 'xxx-xxxx', + HU: 'xxx xxx xxxx', + ID: 'xxxx-xxxx-xxxx', + IL: 'xxxx-xxx-xxx', + JM: 'xxx-xxxx', + KE: 'xxx xxxxxx', + KG: 'xxx-xx-xx-xx', + KH: 'xxx-xxx-xxx', + KY: 'xxx-xxxx', + KZ: 'xxx-xxx-xx-xx', + LA: 'xxx xx xxxx', + LK: 'xx xxx xxxx', + LR: 'xxx-xxx-xxxx', + LS: 'xxx xx xxxx', + LT: 'xxx xxxxx', + LU: 'xxx xx xxx', + LV: 'xxxx xxxx', + MA: 'xxxx-xxxxxx', + MD: 'xx xxxxxx', + ME: 'xx xxxxxx', + MG: 'xx xx xx xx xx', + MK: 'xx xx xx xx', + MM: 'xx xxxxxx', + MN: 'xxx-xx-xxxx', + MO: 'xxxx xxxx', + MU: 'xx xxxx xxxx', + MV: 'xxxxxx', + MW: 'xx xxxx xxxx', + MX: 'xxx-xxx-xxxx', + MZ: 'xx xxxxxxx', + NA: 'xx xxxx xxxx', + NG: 'xxx xxx xxxx', + NI: 'xxxx-xxxx', + NL: 'xxx-xxxxxxx', + NO: 'xxxx xxxx', + NP: 'xxxx-xxxxxxx', + NZ: 'xxx-xxxxxxx', + OM: 'xxxx-xxxx', + PA: 'xxx-xxxx', + PE: 'xxx-xxx-xxx', + PG: 'xxx-xxxxxx', + PH: 'xxx-xxxx', + PK: 'xxx-xxxxxxx', + PL: 'xxx xxx xxx', + PR: 'xxx-xxx-xxxx', + PS: 'xxxx-xxxxxxx', + PT: 'xxx xxx xxx', + PY: 'xxx-xxxxxx', + QA: 'xxxx xxxx', + RO: 'xxx xxx xxxx', + RS: 'xxx xxxxx', + RU: 'xxx xxx-xx-xx', + RW: 'xxx xxxxxx', + SA: 'xxx-xxxxxxx', + SC: 'xx xxxxx', + SE: 'xxx-xxx xx xx', + SG: 'xxxx xxxx', + SI: 'xx xxxxxx', + SK: 'xxx xxx xxx', + SL: 'xxx-xxxxxx', + SM: 'xxxxx xxxxx', + SN: 'xx xxx xx xx', + SO: 'xxx xxxxxxx', + SR: 'xxx-xxxx', + SS: 'xxx xxxx xxx', + SV: 'xxxx-xxxx', + SZ: 'xxx xx xxxx', + TG: 'xx xx xx xx', + TH: 'xxx-xxxxxxx', + TJ: 'xxx xx xx xx', + TL: 'xxx-xxxxxxx', + TN: 'xx xxxxxx', + TR: 'xxx xxx xx xx', + TT: 'xxx-xxxx', + TW: 'xxxx-xxxxxx', + TZ: 'xxx xxx xxxx', + UA: 'xx xxx xx xx', + UG: 'xxx xxxxxxx', + US: 'xxx-xxx-xxxx', + UY: 'xxx-xxxxx', + UZ: 'xxx-xxx-xx-xx', + VC: 'xxx-xxxx', + VE: 'xxxx-xxx-xxxx', + VN: 'xxxx-xxxxxxx', + YE: 'xxxx-xxxx', + ZA: 'xxx-xxx-xxxx', + ZM: 'xxx-xxxxxxx', + ZW: 'xx xxx xxxx', + KW: 'xxx xx xxxx', + BH: 'xxxx xxxx', + }; + + // Formats a provided phone number according to the predefined format for a specific country code, or auto-detects the country code and formats the number accordingly. + const formatPhoneNumber = (phoneNumber, countryCode) => { + // Throw errors if phoneNumber is invalid + if (!phoneNumber) + throw new Error('Parameter `phoneNumber` is invalid!'); + // Convert phoneNumber to string and clean it by removing non-numeric characters + phoneNumber = phoneNumber.toString(); + phoneNumber = cleanPhoneNumber(phoneNumber); + // Detect or validate the country code + countryCode = + countryCode && countryCode in PHONE_FORMATTER_MAPPER + ? countryCode + : detectCountryCodeFromDialCode(phoneNumber); + // Fetch the pattern for the countryCode from the PHONE_FORMATTER_MAPPER + const pattern = PHONE_FORMATTER_MAPPER[countryCode]; + if (!pattern) + return phoneNumber; + // Count the number of 'x' characters in the format pattern + let charCountInFormatterPattern = 0; + for (let i = 0; i < pattern.length; i++) { + if (pattern[i] === 'x') { + charCountInFormatterPattern++; + } + } + // Calculate the difference between phoneNumber length and 'x' characters count in pattern + const diff = phoneNumber.length - charCountInFormatterPattern; + // Extract the phoneNumber without the prefix + const phoneNumberWithoutPrefix = phoneNumber.slice(diff); + const formattedNumber = []; + let numberIndex = 0; + // Loop through the pattern to format the phoneNumber + for (let i = 0; i < pattern.length; i++) { + const patternChar = pattern[i]; + if (patternChar === 'x') { + // Insert phoneNumber digits at 'x' positions + if (numberIndex < phoneNumberWithoutPrefix.length) { + formattedNumber.push(phoneNumberWithoutPrefix[numberIndex]); + numberIndex++; + } + } + else { + // Insert non-digit characters from the pattern + formattedNumber.push(patternChar); + } + } + // Join the formattedNumber array to create the formattedPhoneNumber without prefix + const formattedPhoneNumberWithoutPrefix = formattedNumber.join(''); + // Combine the prefix and formattedPhoneNumberWithoutPrefix + const formattedPhoneNumberWithPrefix = phoneNumber.slice(0, diff) + ' ' + formattedPhoneNumberWithoutPrefix; + // Return the formattedPhoneNumber with prefix after trimming whitespace + return formattedPhoneNumberWithPrefix.trim(); + }; + var formatPhoneNumber$1 = withErrorBoundary(formatPhoneNumber); + + // Parses a given phone number, identifies its country code (if not provided), and returns an object with details including the country code, formatted phone number, dial code, and format template. + const parsePhoneNumber = (phoneNumber, country) => { + // Throw errors if phoneNumber is invalid + if (!phoneNumber) + throw new Error('Parameter `phoneNumber` is invalid!'); + // Clean the phoneNumber by removing non-numeric characters + phoneNumber = phoneNumber.toString(); + phoneNumber = cleanPhoneNumber(phoneNumber); + // Detect or validate the country code + const countryCode = country && country in PHONE_FORMATTER_MAPPER + ? country + : detectCountryCodeFromDialCode(phoneNumber); + // Format the phone number using the detected/validated country code + const formattedPhoneNumber = formatPhoneNumber$1(phoneNumber, countryCode); + // Fetch the pattern associated with the countryCode from the PHONE_FORMATTER_MAPPER + const pattern = PHONE_FORMATTER_MAPPER[countryCode]; + if (!pattern) + return { + countryCode: countryCode || '', + dialCode: '', + formattedPhoneNumber: phoneNumber, + formatTemplate: '', + }; + // Count the number of 'x' characters in the format pattern + let charCountInFormatterPattern = 0; + for (let i = 0; i < pattern.length; i++) { + if (pattern[i] === 'x') { + charCountInFormatterPattern++; + } + } + // Calculate the difference between phoneNumber length and 'x' characters count in pattern + const diff = phoneNumber.length - charCountInFormatterPattern; + // Extract the dialCode from the phoneNumber + const dialCode = phoneNumber.slice(0, diff); + // Obtain the format template associated with the countryCode + const formatTemplate = PHONE_FORMATTER_MAPPER[countryCode]; + // Return the parsed phone number information + return { + countryCode, + formattedPhoneNumber, + dialCode, + formatTemplate, + }; + }; + var parsePhoneNumber$1 = withErrorBoundary(parsePhoneNumber); + + /** + * Adds a specified amount of time to a date. + * + * @param date The original date. + * @param value The amount to add. + * @param unit The unit of time to add (e.g., 'days', 'months', 'years'). + * @returns A new Date object with the time added. + */ + const add = (date, value, unit) => { + const result = new Date(date); + switch (unit) { + case 'days': + result.setDate(result.getDate() + value); + break; + case 'months': + result.setMonth(result.getMonth() + value); + break; + case 'years': + result.setFullYear(result.getFullYear() + value); + break; + } + return result; + }; + var add$1 = withErrorBoundary(add); + + /** + * Formats date and time based on the locale. + * @param {DateInput} date - Date object or date string. + * @param {Locale} locale - Locale string. + * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional). + * @returns {string} Formatted date and time string. + */ + const formatDateTime = (date, locale, options = {}) => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) + locale = state.getState().locale || getLocale(); + const dateObj = date instanceof Date ? date : new Date(date); + let formatter; + try { + formatter = new Intl.DateTimeFormat(locale, options); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + return formatter.format(dateObj); + }; + var formatDateTime$1 = withErrorBoundary(formatDateTime); + + /** + * Formats date based on the locale. + * @param {DateInput} date - Date object or date string. + * @param {Locale} locale - Locale string. + * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional). + * @returns {string} Formatted date string. + */ + const formatDate = (date, locale, options = {}) => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) + locale = state.getState().locale || getLocale(); + const fullOptions = Object.assign(Object.assign({}, options), { timeStyle: undefined }); + let formattedDate; + try { + formattedDate = formatDateTime$1(date, locale, fullOptions); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + return formattedDate; + }; + var formatDate$1 = withErrorBoundary(formatDate); + + /** + * Formats time based on the locale. + * @param {DateInput} date - Date object or date string. + * @param {Locale} locale - Locale string. + * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional). + * @returns {string} Formatted time string. + */ + const formatTime = (date, locale, options = {}) => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) + locale = state.getState().locale || getLocale(); + const fullOptions = Object.assign(Object.assign({}, options), { dateStyle: undefined }); + let formattedTime; + try { + formattedTime = formatDateTime$1(date, locale, fullOptions); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + return formattedTime; + }; + var formatTime$1 = withErrorBoundary(formatTime); + + /** + * Gets the first day of the week for a given locale. + * + * @param locale The locale to determine the first day of the week for. + * @returns The first day of the week (0-6, where 0 is Sunday). + */ + const getFirstDayOfWeek = (locale) => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) + locale = state.getState().locale || getLocale(); + let formatted; + try { + const formatter = new Intl.DateTimeFormat(locale, { weekday: 'short' }); + const sampleDate = new Date(2000, 0, 2); // A Sunday + formatted = formatter.format(sampleDate); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + return ['su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'].indexOf(formatted.slice(0, 2).toLowerCase()); + }; + var getFirstDayOfWeek$1 = withErrorBoundary(getFirstDayOfWeek); + + /** + * Determines the quarter of the year for a given date. + * + * @param date The date to determine the quarter for. + * @returns The quarter of the year (1-4). + */ + const getQuarter = (date) => { + return Math.ceil((date.getMonth() + 1) / 3); + }; + var getQuarter$1 = withErrorBoundary(getQuarter); + + /** + * Provides a relative time string (e.g., '3 hours ago', 'in 2 days'). + * This function calculates the difference between the given date and the base date, + * then formats it in a locale-sensitive manner. It allows customization of the output + * through Intl.RelativeTimeFormat options. + * + * @param date - The date to compare. + * @param baseDate - The date to compare against (default: current date). + * @param locale - The locale to use for formatting. + * @param options - Options for the Intl.RelativeTimeFormat (optional). + * @returns The relative time as a string. + */ + const getRelativeTime = (date, baseDate = new Date(), locale, options) => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) + locale = state.getState().locale || getLocale(); + const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000; + // Define time units in seconds + const minute = 60; + const hour = minute * 60; + const day = hour * 24; + const week = day * 7; + const month = day * 30; + const year = day * 365; + let value; + let unit; + if (Math.abs(diffInSeconds) < minute) { + value = diffInSeconds; + unit = 'second'; + } + else if (Math.abs(diffInSeconds) < hour) { + value = diffInSeconds / minute; + unit = 'minute'; + } + else if (Math.abs(diffInSeconds) < day) { + value = diffInSeconds / hour; + unit = 'hour'; + } + else if (Math.abs(diffInSeconds) < week) { + value = diffInSeconds / day; + unit = 'day'; + } + else if (Math.abs(diffInSeconds) < month) { + value = diffInSeconds / week; + unit = 'week'; + } + else if (Math.abs(diffInSeconds) < year) { + value = diffInSeconds / month; + unit = 'month'; + } + else { + value = diffInSeconds / year; + unit = 'year'; + } + let relativeTime; + try { + const rtf = new Intl.RelativeTimeFormat(locale, options); + relativeTime = rtf.format(Math.round(value), unit); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + return relativeTime; + }; + var getRelativeTime$1 = withErrorBoundary(getRelativeTime); + + /** + * Calculates the week number of the year for a given date. + * + * @param date The date to calculate the week number for. + * @returns The week number of the year. + */ + const getWeek = (date) => { + const firstDayOfYear = new Date(date.getFullYear(), 0, 1); + const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000; + return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7); + }; + var getWeek$1 = withErrorBoundary(getWeek); + + /** + * Returns an array of weekdays according to the specified locale. + * + * @param locale The locale to get weekdays for. + * @returns An array of weekday names. + */ + const getWeekdays = (locale) => { + try { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) + locale = state.getState().locale || getLocale(); + const formatter = new Intl.DateTimeFormat(locale, { weekday: 'long' }); + return Array.from({ length: 7 }, (_, i) => formatter.format(new Date(1970, 0, 4 + i))); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + }; + var getWeekdays$1 = withErrorBoundary(getWeekdays); + + /** + * Compares two dates to determine if the first is after the second. + * @param {DateInput} date1 - First date object or date string. + * @param {DateInput} date2 - Second date object or date string. + * @returns {boolean} True if date1 is after date2. + */ + const isAfter = (date1, date2) => { + const dateObj1 = date1 instanceof Date ? date1 : new Date(date1); + const dateObj2 = date2 instanceof Date ? date2 : new Date(date2); + return dateObj1 > dateObj2; + }; + var isAfter$1 = withErrorBoundary(isAfter); + + /** + * Compares two dates to determine if the first is before the second. + * @param {DateInput} date1 - First date object or date string. + * @param {DateInput} date2 - Second date object or date string. + * @returns {boolean} True if date1 is before date2. + */ + const isBefore = (date1, date2) => { + const dateObj1 = date1 instanceof Date ? date1 : new Date(date1); + const dateObj2 = date2 instanceof Date ? date2 : new Date(date2); + return dateObj1 < dateObj2; + }; + var isBefore$1 = withErrorBoundary(isBefore); + + /** + * Checks if a given year is a leap year. + * + * @param year The year to check. + * @returns True if the year is a leap year, false otherwise. + */ + const isLeapYear = (year) => { + return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; + }; + var isLeapYear$1 = withErrorBoundary(isLeapYear); + + /** + * Checks if two dates fall on the same day. + * + * @param date1 The first date. + * @param date2 The second date. + * @returns True if both dates are on the same day, false otherwise. + */ + const isSameDay = (date1, date2) => { + return (date1.getDate() === date2.getDate() && + date1.getMonth() === date2.getMonth() && + date1.getFullYear() === date2.getFullYear()); + }; + var isSameDay$1 = withErrorBoundary(isSameDay); + + /** + * Checks if a given object is a valid Date object. + * + * @param date The object to check. + * @returns True if the object is a valid Date, false otherwise. + */ + const isValidDate = (date) => { + return date instanceof Date && !isNaN(date.getTime()); + }; + var isValidDate$1 = withErrorBoundary(isValidDate); + + const LOCALE_DATE_FORMATS = { + 'ar-AE': 'DD/MM/YYYY', + 'sq-AL': 'DD.MM.YYYY', + 'hy-AM': 'DD.MM.YYYY', + 'es-AR': 'DD/MM/YYYY', + 'en-AU': 'DD/MM/YYYY', + 'nl-AW': 'DD-MM-YYYY', + 'en-BB': 'MM/DD/YYYY', + 'bn-BD': 'DD/MM/YYYY', + 'en-BM': 'MM/DD/YYYY', + 'ms-BN': 'DD/MM/YYYY', + 'es-BO': 'DD/MM/YYYY', + 'en-BS': 'MM/DD/YYYY', + 'en-BW': 'DD/MM/YYYY', + 'en-BZ': 'MM/DD/YYYY', + 'en-CA': 'DD/MM/YYYY', + 'de-CH': 'DD.MM.YYYY', + 'zh-CN': 'YYYY/MM/DD', + 'es-CO': 'DD/MM/YYYY', + 'es-CR': 'DD/MM/YYYY', + 'es-CU': 'DD/MM/YYYY', + 'cs-CZ': 'DD.MM.YYYY', + 'da-DK': 'DD-MM-YYYY', + 'es-DO': 'DD/MM/YYYY', + 'ar-DZ': 'DD/MM/YYYY', + 'ar-EG': 'DD/MM/YYYY', + 'am-ET': 'DD/MM/YYYY', + 'en-EU': 'DD/MM/YYYY', + 'en-FJ': 'DD/MM/YYYY', + 'en-GB': 'DD/MM/YYYY', + 'en-GH': 'DD/MM/YYYY', + 'en-GI': 'DD/MM/YYYY', + 'en-GM': 'DD/MM/YYYY', + 'es-GT': 'DD/MM/YYYY', + 'en-GY': 'DD/MM/YYYY', + 'en-HK': 'DD/MM/YYYY', + 'es-HN': 'DD/MM/YYYY', + 'hr-HR': 'DD.MM.YYYY', + 'ht-HT': 'MM/DD/YYYY', + 'hu-HU': 'YYYY. MM. DD.', + 'id-ID': 'DD/MM/YYYY', + 'he-IL': 'DD/MM/YYYY', + 'en-IN': 'DD-MM-YYYY', + 'en-JM': 'MM/DD/YYYY', + 'en-KE': 'DD/MM/YYYY', + 'ky-KG': 'DD.MM.YYYY', + 'km-KH': 'DD/MM/YYYY', + 'en-KY': 'MM/DD/YYYY', + 'kk-KZ': 'DD.MM.YYYY', + 'lo-LA': 'DD/MM/YYYY', + 'si-LK': 'YYYY-MM-DD', + 'en-LR': 'MM/DD/YYYY', + 'en-LS': 'DD/MM/YYYY', + 'ar-MA': 'DD/MM/YYYY', + 'ro-MD': 'DD.MM.YYYY', + 'mk-MK': 'DD.MM.YYYY', + 'my-MM': 'DD/MM/YYYY', + 'mn-MN': 'YYYY.MM.DD', + 'zh-MO': 'DD/MM/YYYY', + 'en-MU': 'DD/MM/YYYY', + 'dv-MV': 'DD/MM/YYYY', + 'en-MW': 'DD/MM/YYYY', + 'es-MX': 'DD/MM/YYYY', + 'ms-MY': 'DD/MM/YYYY', + 'en-NA': 'DD/MM/YYYY', + 'en-NG': 'DD/MM/YYYY', + 'es-NI': 'DD/MM/YYYY', + 'no-NO': 'DD.MM.YYYY', + 'ne-NP': 'YYYY/MM/DD', + 'en-NZ': 'DD/MM/YYYY', + 'es-PE': 'DD/MM/YYYY', + 'en-PG': 'DD/MM/YYYY', + 'en-PH': 'MM/DD/YYYY', + 'en-PK': 'DD/MM/YYYY', + 'ar-QA': 'DD/MM/YYYY', + 'ru-RU': 'DD.MM.YYYY', + 'ar-SA': 'DD/MM/YYYY', + 'en-SC': 'DD/MM/YYYY', + 'sv-SE': 'YYYY-MM-DD', + 'en-SG': 'DD/MM/YYYY', + 'en-SL': 'DD/MM/YYYY', + 'so-SO': 'DD/MM/YYYY', + 'en-SS': 'DD/MM/YYYY', + 'es-SV': 'DD/MM/YYYY', + 'en-SZ': 'DD/MM/YYYY', + 'th-TH': 'DD/MM/YYYY', + 'en-TT': 'MM/DD/YYYY', + 'sw-TZ': 'DD/MM/YYYY', + 'en-US': 'MM/DD/YYYY', + 'es-UY': 'DD/MM/YYYY', + 'uz-UZ': 'DD/MM/YYYY', + 'ar-YE': 'DD/MM/YYYY', + 'en-ZA': 'YYYY/MM/DD', + 'ar-KW': 'DD/MM/YYYY', + 'ar-BH': 'DD/MM/YYYY', + 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman) + }; + + /** + * Parses a date string based on a specific format. + * + * @param dateString The date string to parse. + * @param format The format to use for parsing. + * @returns The parsed Date object or null if parsing fails. + */ + const parseDateWithFormat = (dateString, format) => { + // Determine the separator based on the format (supports '/', '.', or '-') + const separator = format.includes('/') + ? '/' + : format.includes('.') + ? '.' + : '-'; + const formatParts = format.split(separator); + const dateParts = dateString.split(separator).map((num) => parseInt(num, 10)); + let year = 0, month = 0, day = 0; + let yearSet = false, monthSet = false, daySet = false; + // Check for format and date string mismatch + if (dateParts.length !== formatParts.length) { + return null; // Mismatch between date string and format + } + formatParts.forEach((part, index) => { + // Check for non-numeric values in date string + if (isNaN(dateParts[index])) { + return null; // Invalid date part + } + // Assign year, month, and day based on the format + switch (part) { + case 'DD': + day = dateParts[index]; + daySet = true; + break; + case 'MM': + month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date + monthSet = true; + break; + case 'YYYY': + year = dateParts[index]; + yearSet = true; + break; + } + }); + // Validate and create the date only if all parts are set + if (yearSet && monthSet && daySet) { + const parsedDate = new Date(year, month, day); + // Validate date to catch invalid dates like February 30th + if (parsedDate.getFullYear() === year && + parsedDate.getMonth() === month && + parsedDate.getDate() === day) { + return parsedDate; + } + } + return null; // Invalid date or incomplete date information + }; + var parseDateWithFormat$1 = withErrorBoundary(parseDateWithFormat); + + /** + * Attempts to parse a string into a date object based on locale. + * Uses the localeDateFormats mapping for determining the date format. + * + * @param dateString - The date string to parse. + * @param locale - The locale to use for parsing. + * @returns The parsed Date object or null if parsing fails. + */ + const parseDate = (dateString, locale) => { + /** retrieve locale from below areas in order of preference + * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) + * 2. i18nState.locale (uses locale set globally) + * 3. navigator (in case locale is not passed or set, use it from browser's navigator) + * */ + if (!locale) + locale = state.getState().locale || getLocale(); + const format = LOCALE_DATE_FORMATS[locale]; + if (!format) { + throw new Error(`No date format found for locale: ${locale}`); + } + return parseDateWithFormat$1(dateString, format); + }; + var parseDate$1 = withErrorBoundary(parseDate); + + /** + * Subtracts a specified amount of time from a date. + * + * @param date The original date. + * @param value The amount to subtract. + * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years'). + * @returns A new Date object with the time subtracted. + */ + const subtract = (date, value, unit) => { + return add$1(date, -value, unit); // Reuse the add function with negative value + }; + var subtract$1 = withErrorBoundary(subtract); + + exports.add = add$1; + exports.formatDate = formatDate$1; + exports.formatDateTime = formatDateTime$1; + exports.formatNumber = formatNumber$1; + exports.formatNumberByParts = formatNumberByParts$1; + exports.formatPhoneNumber = formatPhoneNumber$1; + exports.formatTime = formatTime$1; + exports.getCurrencyList = getCurrencyList$1; + exports.getCurrencySymbol = getCurrencySymbol$1; + exports.getFirstDayOfWeek = getFirstDayOfWeek$1; + exports.getQuarter = getQuarter$1; + exports.getRelativeTime = getRelativeTime$1; + exports.getState = getState$1; + exports.getWeek = getWeek$1; + exports.getWeekdays = getWeekdays$1; + exports.isAfter = isAfter$1; + exports.isBefore = isBefore$1; + exports.isLeapYear = isLeapYear$1; + exports.isSameDay = isSameDay$1; + exports.isValidDate = isValidDate$1; + exports.isValidPhoneNumber = isValidPhoneNumber$1; + exports.parseDate = parseDate$1; + exports.parsePhoneNumber = parsePhoneNumber$1; + exports.resetState = resetState$1; + exports.setState = setState$1; + exports.subtract = subtract$1; + +})); +//# sourceMappingURL=index.js.map diff --git a/lib/umd/index.js.map b/lib/umd/index.js.map new file mode 100644 index 00000000..210ecff8 --- /dev/null +++ b/lib/umd/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["../../src/common/errorBoundary/index.ts","../../src/modules/.internal/utils/getDefaultState.ts","../../src/modules/.internal/state/index.ts","../../src/modules/core/getState.ts","../../src/modules/core/setState.ts","../../src/modules/core/resetState.ts","../../src/modules/.internal/utils/getLocale.ts","../../src/modules/.internal/utils/getIntlInstanceWithOptions.ts","../../src/modules/currency/formatNumber.ts","../../src/modules/currency/data/currencies.ts","../../src/modules/currency/getCurrencyList.ts","../../src/modules/currency/getCurrencySymbol.ts","../../src/modules/currency/constants.ts","../../src/modules/currency/formatNumberByParts.ts","../../src/modules/phoneNumber/data/phoneRegexMapper.ts","../../src/modules/phoneNumber/data/dialCodeMapper.ts","../../src/modules/phoneNumber/utils.ts","../../src/modules/phoneNumber/isValidPhoneNumber.ts","../../src/modules/phoneNumber/data/phoneFormatterMapper.ts","../../src/modules/phoneNumber/formatPhoneNumber.ts","../../src/modules/phoneNumber/parsePhoneNumber.ts","../../src/modules/dateTime/add.ts","../../src/modules/dateTime/formatDateTime.ts","../../src/modules/dateTime/formatDate.ts","../../src/modules/dateTime/formatTime.ts","../../src/modules/dateTime/getFirstDayOfWeek.ts","../../src/modules/dateTime/getQuarter.ts","../../src/modules/dateTime/getRelativeTime.ts","../../src/modules/dateTime/getWeek.ts","../../src/modules/dateTime/getWeekdays.ts","../../src/modules/dateTime/isAfter.ts","../../src/modules/dateTime/isBefore.ts","../../src/modules/dateTime/isLeapYear.ts","../../src/modules/dateTime/isSameDay.ts","../../src/modules/dateTime/isValidDate.ts","../../src/modules/dateTime/data/localeDateFormats.ts","../../src/modules/dateTime/parseDateWithFormat.ts","../../src/modules/dateTime/parseDate.ts","../../src/modules/dateTime/subtract.ts"],"sourcesContent":["// Custom Error class to extend properties to error object\nexport class I18nifyError extends Error {\n timestamp: Date;\n constructor(message: string | undefined) {\n super(message);\n this.name = 'i18nify Error';\n this.timestamp = new Date();\n // more params like type of error/severity can be added in future for better debugging.\n }\n}\n\n/**\n * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block.\n * It appends additional attributes and serves as a centralized error-handling service.\n * Usage =>\n * const wrappedUtilityFn = withErrorBoundary(utilityFn)\n *\n * @param fn utility that is wrapped in error boundary\n * @returns {Function} returns the function wrapped in try/catch block\n */\nexport const withErrorBoundary = any>(\n fn: T,\n): ((...args: Parameters) => ReturnType) => {\n return function (this: unknown, ...rest: Parameters): ReturnType {\n try {\n return fn.call(this, ...rest) as ReturnType;\n } catch (err) {\n console.warn('[I18N Error]: ', err);\n // Currently, we are throwing the error as it is to consumers.\n // In the future, this can be modified as per our requirement, like an error logging service.\n throw new I18nifyError(err as string | undefined);\n }\n };\n};\n","import type { I18nState } from '../state/types';\n\nexport function getDefaultState(): I18nState {\n return {\n locale: '',\n direction: '',\n country: '',\n };\n}\n","import { I18nState } from './types';\nimport { getDefaultState } from '../utils/getDefaultState';\n\nexport class I18nStateManager {\n private static instance: I18nStateManager | undefined;\n private state: I18nState;\n\n private constructor() {\n this.state = getDefaultState();\n }\n\n public static getInstance(): I18nStateManager {\n if (!I18nStateManager.instance) {\n I18nStateManager.instance = new I18nStateManager();\n }\n\n return I18nStateManager.instance;\n }\n\n public static resetInstance(): void {\n I18nStateManager.instance = undefined;\n }\n\n public getState(): I18nState {\n return { ...this.state };\n }\n\n public setState(newState: Partial): void {\n this.state = { ...this.state, ...newState };\n }\n\n public resetState(): void {\n this.state = getDefaultState();\n }\n}\n\nexport default I18nStateManager.getInstance();\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * function to return active i18n state\n *\n * ===== USAGE =====\n * import { getState } from '@razorpay/i18nify-js';\n *\n * console.log(getState())\n *\n * @returns i18n state\n */\nconst getState = (): I18nState => {\n return state.getState();\n};\n\nexport default withErrorBoundary(getState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * Function to set and override the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { setState } from \"@razorpay/i18nify-js\";\n * setState({locale: 'en-US'})\n *\n * @param newState data to set in i18nState instance\n */\nconst setState = (newState: Partial): void => {\n state.setState(newState);\n};\n\nexport default withErrorBoundary(setState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\n\n/**\n * Function to reset the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { resetState } from \"@razorpay/i18nify-js\";\n * resetState()\n *\n * @param newState data to set in i18nState instance\n */\nconst resetState = (): void => {\n state.resetState();\n};\n\nexport default withErrorBoundary(resetState);\n","export const getLocale = (): string => {\n // Check if running in a non-browser environment (e.g., Node.js or older browsers).\n if (typeof navigator === 'undefined') {\n return 'en-IN';\n }\n\n // Check if the browser supports the Intl object and user language preferences.\n if (\n window.Intl &&\n typeof window.Intl === 'object' &&\n (window.navigator.languages || window.navigator.language)\n ) {\n const userLocales = window.navigator.languages || [\n window.navigator.language,\n ];\n return userLocales[0];\n }\n\n // Fallback to a supported locale or the default locale.\n return 'en-IN';\n};\n","import { CURRENCIES } from '../../currency/data/currencies';\nimport state from '../state';\nimport { getLocale } from './getLocale';\n\nexport const getIntlInstanceWithOptions = (\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n) => {\n /** retrieve locale from below areas in order of preference\n * 1. options.locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n let locale = options?.locale || state.getState().locale;\n\n // If a specific locale is provided, use it; otherwise, use the browser's locale\n if (!locale) {\n locale = getLocale();\n }\n\n const intlOptions = options?.intlOptions ? { ...options.intlOptions } : {};\n\n if (options?.currency || intlOptions.currency) {\n intlOptions.style = 'currency';\n intlOptions.currency = (options.currency || intlOptions.currency) as string;\n }\n\n if (!locale) throw new Error('Pass valid locale !');\n\n return new Intl.NumberFormat(locale || undefined, intlOptions);\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\n\n// this function formats number based on different arguments passed\nconst formatNumber = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): string => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n let formattedAmount = '';\n\n try {\n formattedAmount = getIntlInstanceWithOptions(options).format(\n Number(amount),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedAmount;\n};\n\nexport default withErrorBoundary(formatNumber);\n","export const CURRENCIES: { [key: string]: { symbol: string; name: string } } = {\n AED: { symbol: 'د.إ', name: 'United Arab Emirates Dirham' },\n ALL: { symbol: 'Lek', name: 'Albanian Lek' },\n AMD: { symbol: '֏', name: 'Armenian Dram' },\n ARS: { symbol: 'ARS', name: 'Argentine Peso' },\n AUD: { symbol: 'A$', name: 'Australian Dollar' },\n AWG: { symbol: 'Afl.', name: 'Aruban Florin' },\n BBD: { symbol: '$', name: 'Barbadian Dollar' },\n BDT: { symbol: '৳', name: 'Bangladeshi Taka' },\n BMD: { symbol: '$', name: 'Bermudian Dollar' },\n BND: { symbol: 'BND', name: 'Brunei Dollar' },\n BOB: { symbol: 'Bs', name: 'Bolivian Boliviano' },\n BSD: { symbol: 'B$', name: 'Bahamian Dollar' },\n BWP: { symbol: 'P', name: 'Botswanan Pula' },\n BZD: { symbol: 'BZ$', name: 'Belize Dollar' },\n CAD: { symbol: 'C$', name: 'Canadian Dollar' },\n CHF: { symbol: 'CHf', name: 'Swiss Franc' },\n CNY: { symbol: '¥', name: 'Chinese Yuan' },\n COP: { symbol: 'COL$', name: 'Colombian Peso' },\n CRC: { symbol: '₡', name: 'Costa Rican Colón' },\n CUP: { symbol: '$MN', name: 'Cuban Peso' },\n CZK: { symbol: 'Kč', name: 'Czech Koruna' },\n DKK: { symbol: 'DKK', name: 'Danish Krone' },\n DOP: { symbol: 'RD$', name: 'Dominican Peso' },\n DZD: { symbol: 'د.ج', name: 'Algerian Dinar' },\n EGP: { symbol: 'E£', name: 'Egyptian Pound' },\n ETB: { symbol: 'ብር', name: 'Ethiopian Birr' },\n EUR: { symbol: '€', name: 'Euro' },\n FJD: { symbol: 'FJ$', name: 'Fijian Dollar' },\n GBP: { symbol: '£', name: 'British Pound' },\n GHS: { symbol: 'GH₵', name: 'Ghanaian Cedi' },\n GIP: { symbol: 'GIP', name: 'Gibraltar Pound' },\n GMD: { symbol: 'D', name: 'Gambian Dalasi' },\n GTQ: { symbol: 'Q', name: 'Guatemalan Quetzal' },\n GYD: { symbol: 'G$', name: 'Guyanese Dollar' },\n HKD: { symbol: 'HK$', name: 'Hong Kong Dollar' },\n HNL: { symbol: 'HNL', name: 'Honduran Lempira' },\n HRK: { symbol: 'kn', name: 'Croatian Kuna' },\n HTG: { symbol: 'G', name: 'Haitian Gourde' },\n HUF: { symbol: 'Ft', name: 'Hungarian Forint' },\n IDR: { symbol: 'Rp', name: 'Indonesian Rupiah' },\n ILS: { symbol: '₪', name: 'Israeli New Shekel' },\n INR: { symbol: '₹', name: 'Indian Rupee' },\n JMD: { symbol: 'J$', name: 'Jamaican Dollar' },\n KES: { symbol: 'Ksh', name: 'Kenyan Shilling' },\n KGS: { symbol: 'Лв', name: 'Kyrgystani Som' },\n KHR: { symbol: '៛', name: 'Cambodian Riel' },\n KYD: { symbol: 'CI$', name: 'Cayman Islands Dollar' },\n KZT: { symbol: '₸', name: 'Kazakhstani Tenge' },\n LAK: { symbol: '₭', name: 'Laotian Kip' },\n LKR: { symbol: 'රු', name: 'Sri Lankan Rupee' },\n LRD: { symbol: 'L$', name: 'Liberian Dollar' },\n LSL: { symbol: 'LSL', name: 'Lesotho Loti' },\n MAD: { symbol: 'د.م.', name: 'Moroccan Dirham' },\n MDL: { symbol: 'MDL', name: 'Moldovan Leu' },\n MKD: { symbol: 'ден', name: 'Macedonian Denar' },\n MMK: { symbol: 'MMK', name: 'Myanmar Kyat' },\n MNT: { symbol: '₮', name: 'Mongolian Tugrik' },\n MOP: { symbol: 'MOP$', name: 'Macanese Pataca' },\n MUR: { symbol: '₨', name: 'Mauritian Rupee' },\n MVR: { symbol: 'Rf', name: 'Maldivian Rufiyaa' },\n MWK: { symbol: 'MK', name: 'Malawian Kwacha' },\n MXN: { symbol: 'Mex$', name: 'Mexican Peso' },\n MYR: { symbol: 'RM', name: 'Malaysian Ringgit' },\n NAD: { symbol: 'N$', name: 'Namibian Dollar' },\n NGN: { symbol: '₦', name: 'Nigerian Naira' },\n NIO: { symbol: 'NIO', name: 'Nicaraguan Córdoba' },\n NOK: { symbol: 'NOK', name: 'Norwegian Krone' },\n NPR: { symbol: 'रू', name: 'Nepalese Rupee' },\n NZD: { symbol: 'NZ$', name: 'New Zealand Dollar' },\n PEN: { symbol: 'S/', name: 'Peruvian Nuevo Sol' },\n PGK: { symbol: 'PGK', name: 'Papua New Guinean Kina' },\n PHP: { symbol: '₱', name: 'Philippine Peso' },\n PKR: { symbol: '₨', name: 'Pakistani Rupee' },\n QAR: { symbol: 'QR', name: 'Qatari Riyal' },\n RUB: { symbol: '₽', name: 'Russian Ruble' },\n SAR: { symbol: 'SR', name: 'Saudi Riyal' },\n SCR: { symbol: 'SRe', name: 'Seychellois Rupee' },\n SEK: { symbol: 'SEK', name: 'Swedish Krona' },\n SGD: { symbol: 'S$', name: 'Singapore Dollar' },\n SLL: { symbol: 'Le', name: 'Sierra Leonean Leone' },\n SOS: { symbol: 'Sh.so.', name: 'Somali Shilling' },\n SSP: { symbol: 'SS£', name: 'South Sudanese Pound' },\n SVC: { symbol: '₡', name: 'Salvadoran Colón' },\n SZL: { symbol: 'E', name: 'Swazi Lilangeni' },\n THB: { symbol: '฿', name: 'Thai Baht' },\n TTD: { symbol: 'TT$', name: 'Trinidad and Tobago Dollar' },\n TZS: { symbol: 'Sh', name: 'Tanzanian Shilling' },\n USD: { symbol: '$', name: 'United States Dollar' },\n UYU: { symbol: '$U', name: 'Uruguayan Peso' },\n UZS: { symbol: \"so'm\", name: 'Uzbekistani Som' },\n YER: { symbol: '﷼', name: 'Yemeni Rial' },\n ZAR: { symbol: 'R', name: 'South African Rand' },\n KWD: { symbol: 'د.ك', name: 'Kuwaiti Dinar' },\n BHD: { symbol: 'د.ب.', name: 'Bahraini Dinar' },\n OMR: { symbol: 'ر.ع.', name: 'Omani Rial' },\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencyList = () => {\n return CURRENCIES;\n};\n\nexport default withErrorBoundary(getCurrencyList);\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencySymbol = (currencyCode: keyof typeof CURRENCIES): string => {\n if (currencyCode in CURRENCIES) return CURRENCIES[currencyCode]?.symbol;\n else throw new Error('Invalid currencyCode!');\n};\n\nexport default withErrorBoundary(getCurrencySymbol);\n","export const ALLOWED_FORMAT_PARTS_KEYS = [\n 'nan',\n 'infinity',\n 'percent',\n 'integer',\n 'group',\n 'decimal',\n 'fraction',\n 'plusSign',\n 'minusSign',\n 'percentSign',\n 'currency',\n 'code',\n 'symbol',\n 'name',\n 'compact',\n 'exponentInteger',\n 'exponentMinusSign',\n 'exponentSeparator',\n 'unit',\n] as const;\n","import { CURRENCIES } from './data/currencies';\nimport { ByParts, FormattedPartsObject } from './types';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\nimport { ALLOWED_FORMAT_PARTS_KEYS } from './constants';\n\nconst formatNumberByParts = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): ByParts => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n try {\n const formattedAmount = getIntlInstanceWithOptions(options).formatToParts(\n Number(amount),\n );\n\n const parts = formattedAmount;\n\n const formattedObj: FormattedPartsObject = {};\n\n parts.forEach((p) => {\n if (p.type === 'group') {\n formattedObj.integer = (formattedObj.integer || '') + p.value;\n } else if (\n ALLOWED_FORMAT_PARTS_KEYS.findIndex((item) => item === p.type) != -1\n ) {\n // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal' is skipped\n formattedObj[p.type] = (formattedObj[p.type] || '') + p.value;\n }\n });\n\n return {\n ...formattedObj,\n isPrefixSymbol: parts[0].type === 'currency',\n rawParts: parts,\n };\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(\n formatNumberByParts,\n);\n","export const PHONE_REGEX_MAPPER: { [key: string]: RegExp } = {\n IN: /^(?:(?:\\+|0{0,2})91\\s*[-]?\\s*|[0]?)?[6789]\\d{9}$/,\n MY: /^(\\+?6?0)?(\\d{1,3})[-. ]?(\\d{7,8})$/,\n AE: /^(?:\\+?971|0)?(?:2|3|4|6|7|9)\\d{8}$/,\n AL: /^(?:\\+?355)?(?:[4-9]\\d{7}|6\\d{8})$/,\n AM: /^(?:\\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/,\n AR: /^(?:(?:\\+|0{0,2})54)?(?:11|[2368]\\d)(?:(?=\\d{0,2}15)\\d{2})??\\d{8}$/,\n AU: /^(?:\\+?61|0)4\\d{8}$/,\n AW: /^(?:(?:\\+297)?(?!0)\\d{7})$/,\n BB: /^(?:(?:\\+1)?246)?(?:\\d{3})?\\d{7}$/,\n BD: /^(?:\\+?880|0)1[13456789]\\d{8}$/,\n BM: /^(?:(?:\\+1)?441)?(?:\\d{2})?\\d{7}$/,\n BN: /^(?:\\+?673)?(?:\\d{3})?\\d{4}$/,\n BO: /^(?:(?:\\+|0{0,2})591)?(?:(?:2|3|7|6)\\d{7})$/,\n BS: /^(?:(?:\\+1)?242)?(?:\\d{3})?\\d{7}$/,\n BW: /^(?:(?:\\+267)?\\s?)?[74]\\d{7}$/,\n BZ: /^(?:(?:\\+501)?\\s?)?[622]\\d{4}$/,\n CH: /^(?:(?:\\+41|0)(?:\\s*\\(?0\\)?\\s*))?(?:\\d{2}\\s*)?\\d{3}\\s*\\d{2}\\s*\\d{2}$/,\n CN: /^(?:(?:\\+|00)86)?1\\d{10}$/,\n CO: /^(?:(?:\\+57|0057)?)?[1-8]{1}\\d{6,7}$/,\n OM: /^(?:\\+?968)?(?:95|96|97|98)\\d{6}$/,\n CR: /^(?:(?:\\+506)?\\s*|0)?[1-9]\\d{7}$/,\n CU: /^(?:\\+?53)?(?:[5-8]\\d{7})$/,\n CZ: /^(?:\\+?420)?(?:\\d{9})$/,\n DK: /^(?:\\+?45)?(?:\\d{8})$/,\n DO: /^(?:(?:\\+1)?809|1-8(?:00|88|89))(?:\\d{7})$/,\n DZ: /^(?:\\+?213|0)([567]\\d{8})$/,\n EG: /^(?:(?:\\+20|20)?(\\d{10}))$/,\n ET: /^(?:\\+?251)?[1-59]\\d{8}$/,\n EU: /^(?:(?:\\+?3)?8)?\\s*(?:\\d{3}\\s*){3}\\d{2}$/,\n FJ: /^(?:(?:\\+?679)?\\s?\\d{3}\\s?\\d{4})?$/,\n GB: /^(?:(?:\\+44\\s?|0)7\\d{3}(\\s?\\d{4,})?)$/,\n GH: /^(?:(?:\\+233)|0)?(?:\\d{9})$/,\n GI: /^(?:\\+350)?\\d{5}$/,\n GM: /^(?:\\+220)?\\d{5,7}$/,\n GT: /^(?:\\+502)?[2468]\\d{7,8}$/,\n GY: /^(?:(?:\\+592)?(?:(?:\\s)?[2-9])(?:(?:\\s)?\\d))?(?:(?:\\s)?\\d{4})$/,\n HK: /^(?:\\+852\\s?)?[456789]\\d{3}\\s?\\d{4}$/,\n HN: /^(?:\\+504)?[89]\\d{7}$/,\n HR: /^(?:\\+?385)?\\d{8,9}$/,\n HT: /^(?:\\+?509)?\\d{8}$/,\n HU: /^(?:(?:\\+36))(\\s?\\d{2}\\s?\\d{3}\\s?\\d{4})$/,\n ID: /^(?:\\+?62|0[1-9])[\\s-]?\\d{2,4}[\\s-]?\\d{3,4}[\\s-]?\\d{3,4}$/,\n IL: /^(?:(?:\\+972|0)(?:-)?)[23489]\\d{7}$/,\n JM: /^(?:(?:\\+1876))\\d{7,10}$/,\n KE: /^(?:(?:\\+254)|(?:0))(?:\\d{6,7})$/,\n KG: /^(?:\\+996)?\\s?\\d{9}$/,\n KH: /^(?:(?:\\+855)|(?:0))(?:\\s?[1-9]\\d{7,8})$/,\n KY: /^(?:\\+?1\\s?(345))\\d{6}$/,\n KZ: /^(?:\\+?7|8)?7\\d{9}$/,\n LA: /^(?:(?:\\+?856)|0)(20\\d{7,9})$/,\n LK: /^(?:(?:\\+94)|0)(?:\\d{9})$/,\n LR: /^(?:\\+231)[ -\\d]{4}[ -\\d]{4}$/,\n LS: /^(?:(?:\\+?266)|0)?[56]\\d{7}$/,\n MA: /^(?:(?:\\+?212(\\s*[-|\\s*]?\\d{1,9})?)|(?:0))(?:\\d{9})$/,\n MD: /^(?:(?:\\+373)|(?:0))(?:\\d{7,8})$/,\n MK: /^(?:\\+389|0)(?:(?:2[0-4]|[3-9])\\s?)?\\d{6}$/,\n MM: /^(?:(?:\\+?95)|0)?[1-9]\\d{9}$/,\n MN: /^(?:\\+976|0)\\d{8}$/,\n MO: /^(?:(?:\\+?853)|[0-9])?\\d{8}$/,\n MU: /^(?:\\+230|0)?\\d{8}$/,\n MV: /^(?:(?:\\+?960)|0)?\\d{7}$/,\n MW: /^(?:\\+265)[1-9]\\d{6}$/,\n MX: /^(?:(?:\\+?52)?\\s?(?:1|01)?\\s?)?(?:\\d{3}\\s?\\d{3}\\s?\\d{4})$/,\n NA: /^(?:(?:\\+264)|0)?\\d{8}$/,\n NG: /^(?:(?:\\+234)|(?:0))(?:\\d{7,8})$/,\n NI: /^(?:(?:\\+505))?(?:\\d{8})$/,\n NO: /^(?:(?:\\+?47)|\\d{2}|\\d{3})\\s?\\d{2}\\s?\\d{3}$/,\n NP: /^(?:(?:\\+977))?(\\d{9,10})$/,\n NZ: /^(?:\\+?64|0)(\\d{2,5} \\d{4,8}|\\d{3,4} \\d{4})$/,\n PE: /^(?:(?:\\+51)|0)?(?:9\\d{8})$/,\n PG: /^(?:\\+?675)?(?:[7-9]\\d{7})$/,\n PH: /^(?:(?:\\+?63)|0)(?:\\d{10})$/,\n PK: /^(?:(?:\\+92)|0)?[345]\\d{9}$/,\n QA: /^(?:\\+?974)?-?33\\d{5}$/,\n RU: /^(?:\\+?7|8)?[ -]?\\(?9\\d{2}\\)?[ -]?\\d{3}[ -]?\\d{2}[ -]?\\d{2}$/,\n SA: /^(?:\\+?966)?\\s?1?[\\s-]?(?:[45]\\d{2}|5\\d{3})[\\s-]?\\d{4}$/,\n SC: /^(?:(?:\\+248)|\\d{4})\\d{5}$/,\n SE: /^(?:\\+?46|0)\\s?[1-57-9](?:[0-9]\\s?){8}$/,\n SG: /^(?:(?:\\+65)|(?:\\(\\+65\\))|(?:65))\\d{4}\\d{4}$/,\n SL: /^(?:(?:\\+232)|(?:0))?\\d{9}$/,\n SO: /^(?:\\+252|0)?[567]\\d{7}$/,\n SS: /^(?:\\+211|0)?[1-9]\\d{7,9}$/,\n SV: /^(?:(?:\\+?503)|(?:0))(?:\\d{8})$/,\n SZ: /^(?:\\+?268)?\\d{7,8}$/,\n TH: /^(?:(?:\\+66)|0)\\d{9}$/,\n TT: /^(?:(?:\\+?1-868)|\\(?868\\)?)(\\d{7})$/,\n TZ: /^(?:(?:\\+?255)|0)?[67]\\d{8}$/,\n US: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n CA: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n UY: /^(?:(?:\\+598|0)\\s?(9\\d{3}|2\\d{2}|[4-9]\\d{6}))$/,\n UZ: /^(?:\\+?998)?\\s?[3456789]\\d{8}$/,\n YE: /^(?:\\+?967)?(?:\\d{7,8})$/,\n ZA: /^(?:(?:\\+27)|0)(\\d{9})$/,\n KW: /^(?:\\+?965)[569]\\d{7}$/,\n BH: /^(?:\\+?973)?[356]\\d{7}$/,\n TL: /^(?:(?:\\+670)\\s?)?[0-9]{3}\\s?[0-9]{3,4}$/,\n VC: /^(?:(?:\\+1)?784)?(?:\\d{3})?\\d{7}$/,\n VE: /^(?:(?:\\+58)|0)?4\\d{9}$/,\n VN: /^(?:(?:\\+84)|0)?[1-9]\\d{8}$/,\n ZM: /^(?:(?:\\+260)|0)?[123456789]\\d{8,9}$/,\n ZW: /^(?:(?:\\+263)|0)?(?:\\d{9,10})$/,\n LT: /^(?:(?:\\+370)|8)\\d{8}$/,\n LU: /^(?:(?:\\+352)?(6|2(6|7|8|9))\\d{6})$/,\n LV: /^(?:(?:\\+371)?2\\d{7})$/,\n ME: /^(?:(?:\\+382)?[67]\\d{7,20})$/,\n MG: /^(?:(?:\\+261)?3[234568]\\d{7})$/,\n MZ: /^(?:(?:\\+258)|(?:258))?8[234567]\\d{7,8}$/,\n NL: /^(?:(?:\\+31)|0(6(?:\\d{8})|[1-9](?:(?:\\d{8})|(?:\\s\\d{3}\\s\\d{4}))|(?:\\d{8})))$/,\n PA: /^(?:(?:\\+507)\\s?)?[46]\\d{6,7}$/,\n PL: /^(?:(?:\\+48)?(?:\\s?\\d{3}\\s?\\d{3}\\s?\\d{3}|(?:\\d{2}\\s?){4}\\d{2}|\\d{3}-\\d{3}-\\d{3}))$/,\n PR: /^(?:(?:\\+1)?787|939)\\d{7}$/,\n PS: /^(?:(?:\\+970))(5[2349])\\d{7}$/,\n PT: /^(?:(?:\\+351)?9(1\\d|2[1-9]|6[12345789]|7[12345789])\\d{7})$/,\n PY: /^(?:(?:\\+595|0)9[9876]\\d{7})$/,\n RO: /^(?:(?:\\+40|0))(?:7[2-8]\\d{7}|21\\d{8})$/,\n RS: /^(?:(?:\\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/,\n RW: /^(?:(?:\\+250)|(0))\\d{9}$/,\n SI: /^(?:(?:\\+386)|0)?[1-59]\\d{7,8}$/,\n SK: /^(?:(?:\\+421))?(0|9[0-8])\\d{8}$/,\n SM: /^(?:(?:\\+378)|(0549|6\\d{4}))\\d{5}$/,\n SN: /^(?:(?:\\+221)|0)?[3679]\\d{7}$/,\n SR: /^(?:(?:\\+597))\\d{7}$/,\n TG: /^(?:(?:\\+228))\\d{8}$/,\n TJ: /^(?:(?:\\+992))(37|55|77)\\d{7}$/,\n TN: /^(?:(?:\\+216)|22|9[1-9])\\d{7}$/,\n TR: /^(?:(?:\\+90)|(0))\\s?5\\d{9}$/,\n TW: /^(?:(?:\\+886)|0)?9\\d{8}$/,\n UA: /^(?:(?:\\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\\d{7}$/,\n UG: /^(?:(?:\\+256)|0)?[39]\\d{8}$/,\n};\n","/* Source: Google LibPhoneNumber Metadata: https://github.com/google/libphonenumber/blob/master/javascript/i18n/phonenumbers/metadata.js */\n\nexport const DIAL_CODE_MAPPER: { [key: number]: string[] } = {\n 1: [\n 'US',\n 'AG',\n 'AI',\n 'AS',\n 'BB',\n 'BM',\n 'BS',\n 'CA',\n 'DM',\n 'DO',\n 'GD',\n 'GU',\n 'JM',\n 'KN',\n 'KY',\n 'LC',\n 'MP',\n 'MS',\n 'PR',\n 'SX',\n 'TC',\n 'TT',\n 'VC',\n 'VG',\n 'VI',\n ],\n 7: ['RU', 'KZ'],\n 20: ['EG'],\n 27: ['ZA'],\n 30: ['GR'],\n 31: ['NL'],\n 32: ['BE'],\n 33: ['FR'],\n 34: ['ES'],\n 36: ['HU'],\n 39: ['IT', 'VA'],\n 40: ['RO'],\n 41: ['CH'],\n 43: ['AT'],\n 44: ['GB', 'GG', 'IM', 'JE'],\n 45: ['DK'],\n 46: ['SE'],\n 47: ['NO', 'SJ'],\n 48: ['PL'],\n 49: ['DE'],\n 51: ['PE'],\n 52: ['MX'],\n 53: ['CU'],\n 54: ['AR'],\n 55: ['BR'],\n 56: ['CL'],\n 57: ['CO'],\n 58: ['VE'],\n 60: ['MY'],\n 61: ['AU', 'CC', 'CX'],\n 62: ['ID'],\n 63: ['PH'],\n 64: ['NZ'],\n 65: ['SG'],\n 66: ['TH'],\n 81: ['JP'],\n 82: ['KR'],\n 84: ['VN'],\n 86: ['CN'],\n 90: ['TR'],\n 91: ['IN'],\n 92: ['PK'],\n 93: ['AF'],\n 94: ['LK'],\n 95: ['MM'],\n 98: ['IR'],\n 211: ['SS'],\n 212: ['MA', 'EH'],\n 213: ['DZ'],\n 216: ['TN'],\n 218: ['LY'],\n 220: ['GM'],\n 221: ['SN'],\n 222: ['MR'],\n 223: ['ML'],\n 224: ['GN'],\n 225: ['CI'],\n 226: ['BF'],\n 227: ['NE'],\n 228: ['TG'],\n 229: ['BJ'],\n 230: ['MU'],\n 231: ['LR'],\n 232: ['SL'],\n 233: ['GH'],\n 234: ['NG'],\n 235: ['TD'],\n 236: ['CF'],\n 237: ['CM'],\n 238: ['CV'],\n 239: ['ST'],\n 240: ['GQ'],\n 241: ['GA'],\n 242: ['CG'],\n 243: ['CD'],\n 244: ['AO'],\n 245: ['GW'],\n 246: ['IO'],\n 247: ['AC'],\n 248: ['SC'],\n 249: ['SD'],\n 250: ['RW'],\n 251: ['ET'],\n 252: ['SO'],\n 253: ['DJ'],\n 254: ['KE'],\n 255: ['TZ'],\n 256: ['UG'],\n 257: ['BI'],\n 258: ['MZ'],\n 260: ['ZM'],\n 261: ['MG'],\n 262: ['RE', 'YT'],\n 263: ['ZW'],\n 264: ['NA'],\n 265: ['MW'],\n 266: ['LS'],\n 267: ['BW'],\n 268: ['SZ'],\n 269: ['KM'],\n 290: ['SH', 'TA'],\n 291: ['ER'],\n 297: ['AW'],\n 298: ['FO'],\n 299: ['GL'],\n 350: ['GI'],\n 351: ['PT'],\n 352: ['LU'],\n 353: ['IE'],\n 354: ['IS'],\n 355: ['AL'],\n 356: ['MT'],\n 357: ['CY'],\n 358: ['FI', 'AX'],\n 359: ['BG'],\n 370: ['LT'],\n 371: ['LV'],\n 372: ['EE'],\n 373: ['MD'],\n 374: ['AM'],\n 375: ['BY'],\n 376: ['AD'],\n 377: ['MC'],\n 378: ['SM'],\n 380: ['UA'],\n 381: ['RS'],\n 382: ['ME'],\n 383: ['XK'],\n 385: ['HR'],\n 386: ['SI'],\n 387: ['BA'],\n 389: ['MK'],\n 420: ['CZ'],\n 421: ['SK'],\n 423: ['LI'],\n 500: ['FK'],\n 501: ['BZ'],\n 502: ['GT'],\n 503: ['SV'],\n 504: ['HN'],\n 505: ['NI'],\n 506: ['CR'],\n 507: ['PA'],\n 508: ['PM'],\n 509: ['HT'],\n 590: ['GP', 'BL', 'MF'],\n 591: ['BO'],\n 592: ['GY'],\n 593: ['EC'],\n 594: ['GF'],\n 595: ['PY'],\n 596: ['MQ'],\n 597: ['SR'],\n 598: ['UY'],\n 599: ['CW', 'BQ'],\n 670: ['TL'],\n 672: ['NF'],\n 673: ['BN'],\n 674: ['NR'],\n 675: ['PG'],\n 676: ['TO'],\n 677: ['SB'],\n 678: ['VU'],\n 679: ['FJ'],\n 680: ['PW'],\n 681: ['WF'],\n 682: ['CK'],\n 683: ['NU'],\n 685: ['WS'],\n 686: ['KI'],\n 687: ['NC'],\n 688: ['TV'],\n 689: ['PF'],\n 690: ['TK'],\n 691: ['FM'],\n 692: ['MH'],\n 800: ['001'],\n 808: ['001'],\n 850: ['KP'],\n 852: ['HK'],\n 853: ['MO'],\n 855: ['KH'],\n 856: ['LA'],\n 870: ['001'],\n 878: ['001'],\n 880: ['BD'],\n 881: ['001'],\n 882: ['001'],\n 883: ['001'],\n 886: ['TW'],\n 888: ['001'],\n 960: ['MV'],\n 961: ['LB'],\n 962: ['JO'],\n 963: ['SY'],\n 964: ['IQ'],\n 965: ['KW'],\n 966: ['SA'],\n 967: ['YE'],\n 968: ['OM'],\n 970: ['PS'],\n 971: ['AE'],\n 972: ['IL'],\n 973: ['BH'],\n 974: ['QA'],\n 975: ['BT'],\n 976: ['MN'],\n 977: ['NP'],\n 979: ['001'],\n 992: ['TJ'],\n 993: ['TM'],\n 994: ['AZ'],\n 995: ['GE'],\n 996: ['KG'],\n 998: ['UZ'],\n};\n","import { DIAL_CODE_MAPPER } from './data/dialCodeMapper';\nimport { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\n\n/**\n * Determines the country code based on the provided phone number.\n * This function employs a multi-step approach to identify the country code:\n * - If the phone number starts with '+', it extracts the numeric characters\n * and matches the leading digits with known dial codes mapped to countries.\n * - For matched dial codes, it further filters based on country-specific regex patterns\n * to validate the phone number format for those countries.\n * - If the phone number doesn't start with '+', it directly matches the number\n * against regular expressions associated with various countries to identify the code.\n *\n * @param phoneNumber The input phone number (string or number).\n * @returns The detected country code or an empty string if not found.\n */\nexport const detectCountryCodeFromDialCode = (\n phoneNumber: string | number,\n): string => {\n // If the phone number starts with '+', extract numeric characters\n if (phoneNumber.toString().charAt(0) === '+') {\n const cleanedPhoneNumberWithoutPlusPrefix = phoneNumber\n .toString()\n .replace(/\\D/g, '');\n\n const matchingCountries: string[] = [];\n\n // Iterate through dial codes and check for matches with cleaned phone number\n for (const code in DIAL_CODE_MAPPER) {\n if (cleanedPhoneNumberWithoutPlusPrefix.startsWith(code)) {\n matchingCountries.push(...DIAL_CODE_MAPPER[code]);\n }\n }\n\n // Filter matching countries based on phone number validation regex\n const matchedCountryCode = matchingCountries.find((countryCode: string) => {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex && regex.test(phoneNumber.toString())) return countryCode;\n return undefined;\n });\n\n // Return the first matched country code, if any\n return matchedCountryCode || '';\n } else {\n // If phone number doesn't start with '+', directly match against country regexes\n for (const countryCode in PHONE_REGEX_MAPPER) {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex.test(phoneNumber.toString())) {\n return countryCode;\n }\n }\n }\n\n // Return empty string if no country code is detected\n return '';\n};\n\nexport const cleanPhoneNumber = (phoneNumber: string) => {\n // Regular expression to match all characters except numbers and + sign at the start\n const regex = /[^0-9+]|(?!A)\\+/g;\n // Replace matched characters with an empty string\n const cleanedPhoneNumber = phoneNumber.replace(regex, '');\n return phoneNumber[0] === '+' ? `+${cleanedPhoneNumber}` : cleanedPhoneNumber;\n};\n","import { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Validates whether a given phone number is valid based on the provided country code or auto-detects the country code and checks if the number matches the defined regex pattern for that country.\nconst isValidPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_REGEX_MAPPER,\n): boolean => {\n // Clean the provided phoneNumber by removing non-numeric characters\n const cleanedPhoneNumber = cleanPhoneNumber(phoneNumber.toString());\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_REGEX_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(cleanedPhoneNumber);\n\n // Return false if phoneNumber is empty\n if (!phoneNumber) return false;\n\n // Check if the countryCode exists in the PHONE_REGEX_MAPPER\n if (countryCode in PHONE_REGEX_MAPPER) {\n // Fetch the regex pattern for the countryCode\n const regex = PHONE_REGEX_MAPPER[countryCode];\n // Test if the cleanedPhoneNumber matches the regex pattern\n return regex.test(cleanedPhoneNumber as string);\n }\n\n // Return false if the countryCode is not supported\n return false;\n};\n\nexport default withErrorBoundary(isValidPhoneNumber);\n","export const PHONE_FORMATTER_MAPPER: { [key: string]: string } = {\n IN: 'xxxx xxxxxx',\n MY: 'xx xxxxx xx',\n AE: 'xx xxx xxxx',\n AL: 'xxx xx xxxx',\n AM: 'xx xx xx xx',\n AR: 'xxxx-xxxx',\n AU: 'xxx xxx xxx',\n AW: 'xxx-xxxx',\n BB: 'xxx-xxxx',\n BD: 'xxxx-xxxxxx',\n BM: 'xxx-xxxx',\n BN: 'xxxx-xxxx',\n BO: 'xxxx-xxxx',\n BS: 'xxx-xxxx',\n BW: 'xx xxxx xxxx',\n BZ: 'xxx-xxxx',\n CA: 'xxx-xxx-xxxx',\n CH: 'xxx xxx xxx',\n CN: 'xxxx-xxxxxxx',\n CO: 'xxxx-xxxxxxx',\n CR: 'xxxx-xxxx',\n CU: 'xxxx-xxxx',\n CZ: 'xxx xxx xxx',\n DK: 'xx xx xx xx',\n DO: 'xxx-xxxxxxx',\n DZ: 'xxxx-xxxx-xxx',\n EG: 'xx xxx xxxx',\n ET: 'xx xxx xxxx',\n EU: 'xxx xx xx xx',\n FJ: 'xxxx xxxx',\n GB: 'xxxx xxx xxx',\n GH: 'xxx xxx xxxx',\n GI: 'xxxx xxxx',\n GM: 'xxxx-xxxx',\n GT: 'xxxx-xxxx',\n GY: 'xxx-xxxx',\n HK: 'xxxx xxxx',\n HN: 'xxxx-xxxx',\n HR: 'xxx xxx xxxx',\n HT: 'xxx-xxxx',\n HU: 'xxx xxx xxxx',\n ID: 'xxxx-xxxx-xxxx',\n IL: 'xxxx-xxx-xxx',\n JM: 'xxx-xxxx',\n KE: 'xxx xxxxxx',\n KG: 'xxx-xx-xx-xx',\n KH: 'xxx-xxx-xxx',\n KY: 'xxx-xxxx',\n KZ: 'xxx-xxx-xx-xx',\n LA: 'xxx xx xxxx',\n LK: 'xx xxx xxxx',\n LR: 'xxx-xxx-xxxx',\n LS: 'xxx xx xxxx',\n LT: 'xxx xxxxx',\n LU: 'xxx xx xxx',\n LV: 'xxxx xxxx',\n MA: 'xxxx-xxxxxx',\n MD: 'xx xxxxxx',\n ME: 'xx xxxxxx',\n MG: 'xx xx xx xx xx',\n MK: 'xx xx xx xx',\n MM: 'xx xxxxxx',\n MN: 'xxx-xx-xxxx',\n MO: 'xxxx xxxx',\n MU: 'xx xxxx xxxx',\n MV: 'xxxxxx',\n MW: 'xx xxxx xxxx',\n MX: 'xxx-xxx-xxxx',\n MZ: 'xx xxxxxxx',\n NA: 'xx xxxx xxxx',\n NG: 'xxx xxx xxxx',\n NI: 'xxxx-xxxx',\n NL: 'xxx-xxxxxxx',\n NO: 'xxxx xxxx',\n NP: 'xxxx-xxxxxxx',\n NZ: 'xxx-xxxxxxx',\n OM: 'xxxx-xxxx',\n PA: 'xxx-xxxx',\n PE: 'xxx-xxx-xxx',\n PG: 'xxx-xxxxxx',\n PH: 'xxx-xxxx',\n PK: 'xxx-xxxxxxx',\n PL: 'xxx xxx xxx',\n PR: 'xxx-xxx-xxxx',\n PS: 'xxxx-xxxxxxx',\n PT: 'xxx xxx xxx',\n PY: 'xxx-xxxxxx',\n QA: 'xxxx xxxx',\n RO: 'xxx xxx xxxx',\n RS: 'xxx xxxxx',\n RU: 'xxx xxx-xx-xx',\n RW: 'xxx xxxxxx',\n SA: 'xxx-xxxxxxx',\n SC: 'xx xxxxx',\n SE: 'xxx-xxx xx xx',\n SG: 'xxxx xxxx',\n SI: 'xx xxxxxx',\n SK: 'xxx xxx xxx',\n SL: 'xxx-xxxxxx',\n SM: 'xxxxx xxxxx',\n SN: 'xx xxx xx xx',\n SO: 'xxx xxxxxxx',\n SR: 'xxx-xxxx',\n SS: 'xxx xxxx xxx',\n SV: 'xxxx-xxxx',\n SZ: 'xxx xx xxxx',\n TG: 'xx xx xx xx',\n TH: 'xxx-xxxxxxx',\n TJ: 'xxx xx xx xx',\n TL: 'xxx-xxxxxxx',\n TN: 'xx xxxxxx',\n TR: 'xxx xxx xx xx',\n TT: 'xxx-xxxx',\n TW: 'xxxx-xxxxxx',\n TZ: 'xxx xxx xxxx',\n UA: 'xx xxx xx xx',\n UG: 'xxx xxxxxxx',\n US: 'xxx-xxx-xxxx',\n UY: 'xxx-xxxxx',\n UZ: 'xxx-xxx-xx-xx',\n VC: 'xxx-xxxx',\n VE: 'xxxx-xxx-xxxx',\n VN: 'xxxx-xxxxxxx',\n YE: 'xxxx-xxxx',\n ZA: 'xxx-xxx-xxxx',\n ZM: 'xxx-xxxxxxx',\n ZW: 'xx xxx xxxx',\n KW: 'xxx xx xxxx',\n BH: 'xxxx xxxx',\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Formats a provided phone number according to the predefined format for a specific country code, or auto-detects the country code and formats the number accordingly.\nconst formatPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_FORMATTER_MAPPER,\n): string => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Convert phoneNumber to string and clean it by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_FORMATTER_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Fetch the pattern for the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern) return phoneNumber;\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n // Extract the phoneNumber without the prefix\n const phoneNumberWithoutPrefix = phoneNumber.slice(diff);\n const formattedNumber: string[] = [];\n let numberIndex = 0;\n\n // Loop through the pattern to format the phoneNumber\n for (let i = 0; i < pattern.length; i++) {\n const patternChar = pattern[i];\n if (patternChar === 'x') {\n // Insert phoneNumber digits at 'x' positions\n if (numberIndex < phoneNumberWithoutPrefix.length) {\n formattedNumber.push(phoneNumberWithoutPrefix[numberIndex]);\n numberIndex++;\n }\n } else {\n // Insert non-digit characters from the pattern\n formattedNumber.push(patternChar);\n }\n }\n\n // Join the formattedNumber array to create the formattedPhoneNumber without prefix\n const formattedPhoneNumberWithoutPrefix = formattedNumber.join('');\n // Combine the prefix and formattedPhoneNumberWithoutPrefix\n const formattedPhoneNumberWithPrefix =\n phoneNumber.slice(0, diff) + ' ' + formattedPhoneNumberWithoutPrefix;\n\n // Return the formattedPhoneNumber with prefix after trimming whitespace\n return formattedPhoneNumberWithPrefix.trim();\n};\n\nexport default withErrorBoundary(formatPhoneNumber);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport formatPhoneNumber from './formatPhoneNumber';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\ninterface PhoneInfo {\n countryCode: string;\n dialCode: string;\n formattedPhoneNumber: string;\n formatTemplate: string;\n}\n\n// Parses a given phone number, identifies its country code (if not provided), and returns an object with details including the country code, formatted phone number, dial code, and format template.\nconst parsePhoneNumber = (phoneNumber: string, country?: string): PhoneInfo => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Clean the phoneNumber by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n const countryCode =\n country && country in PHONE_FORMATTER_MAPPER\n ? country\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Format the phone number using the detected/validated country code\n const formattedPhoneNumber = formatPhoneNumber(phoneNumber, countryCode);\n\n // Fetch the pattern associated with the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern)\n return {\n countryCode: countryCode || '',\n dialCode: '',\n formattedPhoneNumber: phoneNumber,\n formatTemplate: '',\n };\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n\n // Extract the dialCode from the phoneNumber\n const dialCode = phoneNumber.slice(0, diff);\n\n // Obtain the format template associated with the countryCode\n const formatTemplate = PHONE_FORMATTER_MAPPER[countryCode];\n\n // Return the parsed phone number information\n return {\n countryCode,\n formattedPhoneNumber,\n dialCode,\n formatTemplate,\n };\n};\n\nexport default withErrorBoundary(parsePhoneNumber);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Adds a specified amount of time to a date.\n *\n * @param date The original date.\n * @param value The amount to add.\n * @param unit The unit of time to add (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time added.\n */\nconst add = (\n date: Date,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n const result = new Date(date);\n switch (unit) {\n case 'days':\n result.setDate(result.getDate() + value);\n break;\n case 'months':\n result.setMonth(result.getMonth() + value);\n break;\n case 'years':\n result.setFullYear(result.getFullYear() + value);\n break;\n }\n return result;\n};\n\nexport default withErrorBoundary(add);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale, DateTimeFormatOptions } from './types';\n\n/**\n * Formats date and time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional).\n * @returns {string} Formatted date and time string.\n */\nconst formatDateTime = (\n date: DateInput,\n locale: Locale,\n options: DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const dateObj: Date = date instanceof Date ? date : new Date(date);\n let formatter;\n\n try {\n formatter = new Intl.DateTimeFormat(locale, options);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formatter.format(dateObj);\n};\n\nexport default withErrorBoundary(formatDateTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n DateFormatOptions,\n} from './types';\n\n/**\n * Formats date based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional).\n * @returns {string} Formatted date string.\n */\nconst formatDate = (\n date: DateInput,\n locale: Locale,\n options: DateFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n timeStyle: undefined,\n };\n\n let formattedDate;\n\n try {\n formattedDate = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedDate;\n};\n\nexport default withErrorBoundary(formatDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n TimeFormatOptions,\n} from './types';\n\n/**\n * Formats time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional).\n * @returns {string} Formatted time string.\n */\nconst formatTime = (\n date: DateInput,\n locale: Locale,\n options: TimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n dateStyle: undefined,\n };\n\n let formattedTime;\n\n try {\n formattedTime = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedTime;\n};\n\nexport default withErrorBoundary(formatTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\n\n/**\n * Gets the first day of the week for a given locale.\n *\n * @param locale The locale to determine the first day of the week for.\n * @returns The first day of the week (0-6, where 0 is Sunday).\n */\nconst getFirstDayOfWeek = (locale: string): number => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n let formatted;\n\n try {\n const formatter = new Intl.DateTimeFormat(locale, { weekday: 'short' });\n const sampleDate = new Date(2000, 0, 2); // A Sunday\n formatted = formatter.format(sampleDate);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return ['su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'].indexOf(\n formatted.slice(0, 2).toLowerCase(),\n );\n};\n\nexport default withErrorBoundary(getFirstDayOfWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Determines the quarter of the year for a given date.\n *\n * @param date The date to determine the quarter for.\n * @returns The quarter of the year (1-4).\n */\nconst getQuarter = (date: Date): number => {\n return Math.ceil((date.getMonth() + 1) / 3);\n};\n\nexport default withErrorBoundary(getQuarter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Provides a relative time string (e.g., '3 hours ago', 'in 2 days').\n * This function calculates the difference between the given date and the base date,\n * then formats it in a locale-sensitive manner. It allows customization of the output\n * through Intl.RelativeTimeFormat options.\n *\n * @param date - The date to compare.\n * @param baseDate - The date to compare against (default: current date).\n * @param locale - The locale to use for formatting.\n * @param options - Options for the Intl.RelativeTimeFormat (optional).\n * @returns The relative time as a string.\n */\nconst getRelativeTime = (\n date: Date,\n baseDate: Date = new Date(),\n locale: Locale,\n options?: Intl.RelativeTimeFormatOptions,\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000;\n\n // Define time units in seconds\n const minute = 60;\n const hour = minute * 60;\n const day = hour * 24;\n const week = day * 7;\n const month = day * 30;\n const year = day * 365;\n\n let value: number;\n let unit: Intl.RelativeTimeFormatUnit;\n\n if (Math.abs(diffInSeconds) < minute) {\n value = diffInSeconds;\n unit = 'second';\n } else if (Math.abs(diffInSeconds) < hour) {\n value = diffInSeconds / minute;\n unit = 'minute';\n } else if (Math.abs(diffInSeconds) < day) {\n value = diffInSeconds / hour;\n unit = 'hour';\n } else if (Math.abs(diffInSeconds) < week) {\n value = diffInSeconds / day;\n unit = 'day';\n } else if (Math.abs(diffInSeconds) < month) {\n value = diffInSeconds / week;\n unit = 'week';\n } else if (Math.abs(diffInSeconds) < year) {\n value = diffInSeconds / month;\n unit = 'month';\n } else {\n value = diffInSeconds / year;\n unit = 'year';\n }\n\n let relativeTime;\n\n try {\n const rtf = new Intl.RelativeTimeFormat(locale, options);\n relativeTime = rtf.format(Math.round(value), unit);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return relativeTime;\n};\n\nexport default withErrorBoundary(getRelativeTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Calculates the week number of the year for a given date.\n *\n * @param date The date to calculate the week number for.\n * @returns The week number of the year.\n */\nconst getWeek = (date: Date): number => {\n const firstDayOfYear = new Date(date.getFullYear(), 0, 1);\n const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000;\n return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7);\n};\n\nexport default withErrorBoundary(getWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Returns an array of weekdays according to the specified locale.\n *\n * @param locale The locale to get weekdays for.\n * @returns An array of weekday names.\n */\nconst getWeekdays = (locale: Locale): string[] => {\n try {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n const formatter = new Intl.DateTimeFormat(locale, { weekday: 'long' });\n return Array.from({ length: 7 }, (_, i) =>\n formatter.format(new Date(1970, 0, 4 + i)),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(getWeekdays);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\n\n/**\n * Compares two dates to determine if the first is after the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is after date2.\n */\nconst isAfter = (date1: DateInput, date2: DateInput): boolean => {\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 > dateObj2;\n};\n\nexport default withErrorBoundary(isAfter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\n\n/**\n * Compares two dates to determine if the first is before the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is before date2.\n */\nconst isBefore = (date1: DateInput, date2: DateInput): boolean => {\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 < dateObj2;\n};\n\nexport default withErrorBoundary(isBefore);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given year is a leap year.\n *\n * @param year The year to check.\n * @returns True if the year is a leap year, false otherwise.\n */\nconst isLeapYear = (year: number): boolean => {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n};\n\nexport default withErrorBoundary(isLeapYear);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if two dates fall on the same day.\n *\n * @param date1 The first date.\n * @param date2 The second date.\n * @returns True if both dates are on the same day, false otherwise.\n */\nconst isSameDay = (date1: Date, date2: Date): boolean => {\n return (\n date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear()\n );\n};\n\nexport default withErrorBoundary(isSameDay);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given object is a valid Date object.\n *\n * @param date The object to check.\n * @returns True if the object is a valid Date, false otherwise.\n */\nconst isValidDate = (date: any): boolean => {\n return date instanceof Date && !isNaN(date.getTime());\n};\n\nexport default withErrorBoundary(isValidDate);\n","export const LOCALE_DATE_FORMATS: { [key: string]: string } = {\n 'ar-AE': 'DD/MM/YYYY', // Arabic (U.A.E.)\n 'sq-AL': 'DD.MM.YYYY', // Albanian (Albania)\n 'hy-AM': 'DD.MM.YYYY', // Armenian (Armenia)\n 'es-AR': 'DD/MM/YYYY', // Spanish (Argentina)\n 'en-AU': 'DD/MM/YYYY', // English (Australia)\n 'nl-AW': 'DD-MM-YYYY', // Dutch (Aruba)\n 'en-BB': 'MM/DD/YYYY', // English (Barbados)\n 'bn-BD': 'DD/MM/YYYY', // Bengali (Bangladesh)\n 'en-BM': 'MM/DD/YYYY', // English (Bermuda)\n 'ms-BN': 'DD/MM/YYYY', // Malay (Brunei)\n 'es-BO': 'DD/MM/YYYY', // Spanish (Bolivia)\n 'en-BS': 'MM/DD/YYYY', // English (Bahamas)\n 'en-BW': 'DD/MM/YYYY', // English (Botswana)\n 'en-BZ': 'MM/DD/YYYY', // English (Belize)\n 'en-CA': 'DD/MM/YYYY', // English (Canada)\n 'de-CH': 'DD.MM.YYYY', // German (Switzerland)\n 'zh-CN': 'YYYY/MM/DD', // Chinese (China)\n 'es-CO': 'DD/MM/YYYY', // Spanish (Colombia)\n 'es-CR': 'DD/MM/YYYY', // Spanish (Costa Rica)\n 'es-CU': 'DD/MM/YYYY', // Spanish (Cuba)\n 'cs-CZ': 'DD.MM.YYYY', // Czech (Czech Republic)\n 'da-DK': 'DD-MM-YYYY', // Danish (Denmark)\n 'es-DO': 'DD/MM/YYYY', // Spanish (Dominican Republic)\n 'ar-DZ': 'DD/MM/YYYY', // Arabic (Algeria)\n 'ar-EG': 'DD/MM/YYYY', // Arabic (Egypt)\n 'am-ET': 'DD/MM/YYYY', // Amharic (Ethiopia)\n 'en-EU': 'DD/MM/YYYY', // English (European Union)\n 'en-FJ': 'DD/MM/YYYY', // English (Fiji)\n 'en-GB': 'DD/MM/YYYY', // English (United Kingdom)\n 'en-GH': 'DD/MM/YYYY', // English (Ghana)\n 'en-GI': 'DD/MM/YYYY', // English (Gibraltar)\n 'en-GM': 'DD/MM/YYYY', // English (Gambia)\n 'es-GT': 'DD/MM/YYYY', // Spanish (Guatemala)\n 'en-GY': 'DD/MM/YYYY', // English (Guyana)\n 'en-HK': 'DD/MM/YYYY', // English (Hong Kong)\n 'es-HN': 'DD/MM/YYYY', // Spanish (Honduras)\n 'hr-HR': 'DD.MM.YYYY', // Croatian (Croatia)\n 'ht-HT': 'MM/DD/YYYY', // Haitian (Haiti)\n 'hu-HU': 'YYYY. MM. DD.', // Hungarian (Hungary)\n 'id-ID': 'DD/MM/YYYY', // Indonesian (Indonesia)\n 'he-IL': 'DD/MM/YYYY', // Hebrew (Israel)\n 'en-IN': 'DD-MM-YYYY', // English (India)\n 'en-JM': 'MM/DD/YYYY', // English (Jamaica)\n 'en-KE': 'DD/MM/YYYY', // English (Kenya)\n 'ky-KG': 'DD.MM.YYYY', // Kyrgyz (Kyrgyzstan)\n 'km-KH': 'DD/MM/YYYY', // Khmer (Cambodia)\n 'en-KY': 'MM/DD/YYYY', // English (Cayman Islands)\n 'kk-KZ': 'DD.MM.YYYY', // Kazakh (Kazakhstan)\n 'lo-LA': 'DD/MM/YYYY', // Lao (Laos)\n 'si-LK': 'YYYY-MM-DD', // Sinhala (Sri Lanka)\n 'en-LR': 'MM/DD/YYYY', // English (Liberia)\n 'en-LS': 'DD/MM/YYYY', // English (Lesotho)\n 'ar-MA': 'DD/MM/YYYY', // Arabic (Morocco)\n 'ro-MD': 'DD.MM.YYYY', // Romanian (Moldova)\n 'mk-MK': 'DD.MM.YYYY', // Macedonian (North Macedonia)\n 'my-MM': 'DD/MM/YYYY', // Burmese (Myanmar)\n 'mn-MN': 'YYYY.MM.DD', // Mongolian (Mongolia)\n 'zh-MO': 'DD/MM/YYYY', // Chinese (Macao)\n 'en-MU': 'DD/MM/YYYY', // English (Mauritius)\n 'dv-MV': 'DD/MM/YYYY', // Divehi (Maldives)\n 'en-MW': 'DD/MM/YYYY', // English (Malawi)\n 'es-MX': 'DD/MM/YYYY', // Spanish (Mexico)\n 'ms-MY': 'DD/MM/YYYY', // Malay (Malaysia)\n 'en-NA': 'DD/MM/YYYY', // English (Namibia)\n 'en-NG': 'DD/MM/YYYY', // English (Nigeria)\n 'es-NI': 'DD/MM/YYYY', // Spanish (Nicaragua)\n 'no-NO': 'DD.MM.YYYY', // Norwegian (Norway)\n 'ne-NP': 'YYYY/MM/DD', // Nepali (Nepal)\n 'en-NZ': 'DD/MM/YYYY', // English (New Zealand)\n 'es-PE': 'DD/MM/YYYY', // Spanish (Peru)\n 'en-PG': 'DD/MM/YYYY', // English (Papua New Guinea)\n 'en-PH': 'MM/DD/YYYY', // English (Philippines)\n 'en-PK': 'DD/MM/YYYY', // English (Pakistan)\n 'ar-QA': 'DD/MM/YYYY', // Arabic (Qatar)\n 'ru-RU': 'DD.MM.YYYY', // Russian (Russia)\n 'ar-SA': 'DD/MM/YYYY', // Arabic (Saudi Arabia)\n 'en-SC': 'DD/MM/YYYY', // English (Seychelles)\n 'sv-SE': 'YYYY-MM-DD', // Swedish (Sweden)\n 'en-SG': 'DD/MM/YYYY', // English (Singapore)\n 'en-SL': 'DD/MM/YYYY', // English (Sierra Leone)\n 'so-SO': 'DD/MM/YYYY', // Somali (Somalia)\n 'en-SS': 'DD/MM/YYYY', // English (South Sudan)\n 'es-SV': 'DD/MM/YYYY', // Spanish (El Salvador)\n 'en-SZ': 'DD/MM/YYYY', // English (Eswatini)\n 'th-TH': 'DD/MM/YYYY', // Thai (Thailand)\n 'en-TT': 'MM/DD/YYYY', // English (Trinidad and Tobago)\n 'sw-TZ': 'DD/MM/YYYY', // Swahili (Tanzania)\n 'en-US': 'MM/DD/YYYY', // English (United States)\n 'es-UY': 'DD/MM/YYYY', // Spanish (Uruguay)\n 'uz-UZ': 'DD/MM/YYYY', // Uzbek (Uzbekistan)\n 'ar-YE': 'DD/MM/YYYY', // Arabic (Yemen)\n 'en-ZA': 'YYYY/MM/DD', // English (South Africa)\n 'ar-KW': 'DD/MM/YYYY', // Arabic (Kuwait)\n 'ar-BH': 'DD/MM/YYYY', // Arabic (Bahrain)\n 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman)\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Parses a date string based on a specific format.\n *\n * @param dateString The date string to parse.\n * @param format The format to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDateWithFormat = (\n dateString: string,\n format: string,\n): Date | null => {\n // Determine the separator based on the format (supports '/', '.', or '-')\n const separator = format.includes('/')\n ? '/'\n : format.includes('.')\n ? '.'\n : '-';\n const formatParts = format.split(separator);\n const dateParts = dateString.split(separator).map((num) => parseInt(num, 10));\n\n let year: number = 0,\n month: number = 0,\n day: number = 0;\n let yearSet: boolean = false,\n monthSet: boolean = false,\n daySet: boolean = false;\n\n // Check for format and date string mismatch\n if (dateParts.length !== formatParts.length) {\n return null; // Mismatch between date string and format\n }\n\n formatParts.forEach((part, index) => {\n // Check for non-numeric values in date string\n if (isNaN(dateParts[index])) {\n return null; // Invalid date part\n }\n\n // Assign year, month, and day based on the format\n switch (part) {\n case 'DD':\n day = dateParts[index];\n daySet = true;\n break;\n case 'MM':\n month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date\n monthSet = true;\n break;\n case 'YYYY':\n year = dateParts[index];\n yearSet = true;\n break;\n }\n });\n\n // Validate and create the date only if all parts are set\n if (yearSet && monthSet && daySet) {\n const parsedDate = new Date(year, month, day);\n // Validate date to catch invalid dates like February 30th\n if (\n parsedDate.getFullYear() === year &&\n parsedDate.getMonth() === month &&\n parsedDate.getDate() === day\n ) {\n return parsedDate;\n }\n }\n return null; // Invalid date or incomplete date information\n};\n\nexport default withErrorBoundary(\n parseDateWithFormat,\n);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { LOCALE_DATE_FORMATS } from './data/localeDateFormats';\nimport parseDateWithFormat from './parseDateWithFormat';\nimport { Locale } from './types';\n\n/**\n * Attempts to parse a string into a date object based on locale.\n * Uses the localeDateFormats mapping for determining the date format.\n *\n * @param dateString - The date string to parse.\n * @param locale - The locale to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDate = (dateString: string, locale: Locale): Date | null => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const format = LOCALE_DATE_FORMATS[locale];\n if (!format) {\n throw new Error(`No date format found for locale: ${locale}`);\n }\n return parseDateWithFormat(dateString, format);\n};\n\nexport default withErrorBoundary(parseDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport add from './add';\n\n/**\n * Subtracts a specified amount of time from a date.\n *\n * @param date The original date.\n * @param value The amount to subtract.\n * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time subtracted.\n */\nconst subtract = (\n date: Date,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n return add(date, -value, unit); // Reuse the add function with negative value\n};\n\nexport default withErrorBoundary(subtract);\n"],"names":["formatPhoneNumber","formatDateTime","parseDateWithFormat","add"],"mappings":";;;;;;IAAA;IACM,MAAO,YAAa,SAAQ,KAAK,CAAA;IAErC,IAAA,WAAA,CAAY,OAA2B,EAAA;YACrC,KAAK,CAAC,OAAO,CAAC,CAAC;IACf,QAAA,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC5B,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;;SAE7B;IACF,CAAA;IAED;;;;;;;;IAQG;IACI,MAAM,iBAAiB,GAAG,CAC/B,EAAK,KAC0C;QAC/C,OAAO,UAAyB,GAAG,IAAmB,EAAA;YACpD,IAAI;gBACF,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAkB,CAAC;IAChD,SAAA;IAAC,QAAA,OAAO,GAAG,EAAE;IACZ,YAAA,OAAO,CAAC,IAAI,CAAC,gBAAgB,E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ACb,IAAiC,KACzB;QACR,OAAOC,KAAG,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC,CAAC;AAEF,qBAAe,iBAAiB,CAAkB,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/lib/umd/index.min.js b/lib/umd/index.min.js new file mode 100644 index 00000000..d7a095a6 --- /dev/null +++ b/lib/umd/index.min.js @@ -0,0 +1,2 @@ +!function(x,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((x="undefined"!=typeof globalThis?globalThis:x||self).i18nify={})}(this,(function(x){"use strict";class e extends Error{constructor(x){super(x),this.name="i18nify Error",this.timestamp=new Date}}const n=x=>function(...n){try{return x.call(this,...n)}catch(x){throw console.warn("[I18N Error]: ",x),new e(x)}};class a{constructor(){this.state={locale:"",direction:"",country:""}}static getInstance(){return a.instance||(a.instance=new a),a.instance}static resetInstance(){a.instance=void 0}getState(){return Object.assign({},this.state)}setState(x){this.state=Object.assign(Object.assign({},this.state),x)}resetState(){this.state={locale:"",direction:"",country:""}}}var r=a.getInstance();var t=n((()=>r.getState()));var o=n((x=>{r.setState(x)}));var Y=n((()=>{r.resetState()}));const s=()=>{if("undefined"==typeof navigator)return"en-IN";if(window.Intl&&"object"==typeof window.Intl&&(window.navigator.languages||window.navigator.language)){return(window.navigator.languages||[window.navigator.language])[0]}return"en-IN"},M=(x={})=>{let e=(null==x?void 0:x.locale)||r.getState().locale;e||(e=s());const n=(null==x?void 0:x.intlOptions)?Object.assign({},x.intlOptions):{};if(((null==x?void 0:x.currency)||n.currency)&&(n.style="currency",n.currency=x.currency||n.currency),!e)throw new Error("Pass valid locale !");return new Intl.NumberFormat(e||void 0,n)};var i=n(((x,e={})=>{if(!Number(x)&&0!==Number(x))throw new Error("Parameter `amount` is not a number!");let n="";try{n=M(e).format(Number(x))}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return n}));const D={AED:{symbol:"د.إ",name:"United Arab Emirates Dirham"},ALL:{symbol:"Lek",name:"Albanian Lek"},AMD:{symbol:"֏",name:"Armenian Dram"},ARS:{symbol:"ARS",name:"Argentine Peso"},AUD:{symbol:"A$",name:"Australian Dollar"},AWG:{symbol:"Afl.",name:"Aruban Florin"},BBD:{symbol:"$",name:"Barbadian Dollar"},BDT:{symbol:"৳",name:"Bangladeshi Taka"},BMD:{symbol:"$",name:"Bermudian Dollar"},BND:{symbol:"BND",name:"Brunei Dollar"},BOB:{symbol:"Bs",name:"Bolivian Boliviano"},BSD:{symbol:"B$",name:"Bahamian Dollar"},BWP:{symbol:"P",name:"Botswanan Pula"},BZD:{symbol:"BZ$",name:"Belize Dollar"},CAD:{symbol:"C$",name:"Canadian Dollar"},CHF:{symbol:"CHf",name:"Swiss Franc"},CNY:{symbol:"¥",name:"Chinese Yuan"},COP:{symbol:"COL$",name:"Colombian Peso"},CRC:{symbol:"₡",name:"Costa Rican Colón"},CUP:{symbol:"$MN",name:"Cuban Peso"},CZK:{symbol:"Kč",name:"Czech Koruna"},DKK:{symbol:"DKK",name:"Danish Krone"},DOP:{symbol:"RD$",name:"Dominican Peso"},DZD:{symbol:"د.ج",name:"Algerian Dinar"},EGP:{symbol:"E£",name:"Egyptian Pound"},ETB:{symbol:"ብር",name:"Ethiopian Birr"},EUR:{symbol:"€",name:"Euro"},FJD:{symbol:"FJ$",name:"Fijian Dollar"},GBP:{symbol:"£",name:"British Pound"},GHS:{symbol:"GH₵",name:"Ghanaian Cedi"},GIP:{symbol:"GIP",name:"Gibraltar Pound"},GMD:{symbol:"D",name:"Gambian Dalasi"},GTQ:{symbol:"Q",name:"Guatemalan Quetzal"},GYD:{symbol:"G$",name:"Guyanese Dollar"},HKD:{symbol:"HK$",name:"Hong Kong Dollar"},HNL:{symbol:"HNL",name:"Honduran Lempira"},HRK:{symbol:"kn",name:"Croatian Kuna"},HTG:{symbol:"G",name:"Haitian Gourde"},HUF:{symbol:"Ft",name:"Hungarian Forint"},IDR:{symbol:"Rp",name:"Indonesian Rupiah"},ILS:{symbol:"₪",name:"Israeli New Shekel"},INR:{symbol:"₹",name:"Indian Rupee"},JMD:{symbol:"J$",name:"Jamaican Dollar"},KES:{symbol:"Ksh",name:"Kenyan Shilling"},KGS:{symbol:"Лв",name:"Kyrgystani Som"},KHR:{symbol:"៛",name:"Cambodian Riel"},KYD:{symbol:"CI$",name:"Cayman Islands Dollar"},KZT:{symbol:"₸",name:"Kazakhstani Tenge"},LAK:{symbol:"₭",name:"Laotian Kip"},LKR:{symbol:"රු",name:"Sri Lankan Rupee"},LRD:{symbol:"L$",name:"Liberian Dollar"},LSL:{symbol:"LSL",name:"Lesotho Loti"},MAD:{symbol:"د.م.",name:"Moroccan Dirham"},MDL:{symbol:"MDL",name:"Moldovan Leu"},MKD:{symbol:"ден",name:"Macedonian Denar"},MMK:{symbol:"MMK",name:"Myanmar Kyat"},MNT:{symbol:"₮",name:"Mongolian Tugrik"},MOP:{symbol:"MOP$",name:"Macanese Pataca"},MUR:{symbol:"₨",name:"Mauritian Rupee"},MVR:{symbol:"Rf",name:"Maldivian Rufiyaa"},MWK:{symbol:"MK",name:"Malawian Kwacha"},MXN:{symbol:"Mex$",name:"Mexican Peso"},MYR:{symbol:"RM",name:"Malaysian Ringgit"},NAD:{symbol:"N$",name:"Namibian Dollar"},NGN:{symbol:"₦",name:"Nigerian Naira"},NIO:{symbol:"NIO",name:"Nicaraguan Córdoba"},NOK:{symbol:"NOK",name:"Norwegian Krone"},NPR:{symbol:"रू",name:"Nepalese Rupee"},NZD:{symbol:"NZ$",name:"New Zealand Dollar"},PEN:{symbol:"S/",name:"Peruvian Nuevo Sol"},PGK:{symbol:"PGK",name:"Papua New Guinean Kina"},PHP:{symbol:"₱",name:"Philippine Peso"},PKR:{symbol:"₨",name:"Pakistani Rupee"},QAR:{symbol:"QR",name:"Qatari Riyal"},RUB:{symbol:"₽",name:"Russian Ruble"},SAR:{symbol:"SR",name:"Saudi Riyal"},SCR:{symbol:"SRe",name:"Seychellois Rupee"},SEK:{symbol:"SEK",name:"Swedish Krona"},SGD:{symbol:"S$",name:"Singapore Dollar"},SLL:{symbol:"Le",name:"Sierra Leonean Leone"},SOS:{symbol:"Sh.so.",name:"Somali Shilling"},SSP:{symbol:"SS£",name:"South Sudanese Pound"},SVC:{symbol:"₡",name:"Salvadoran Colón"},SZL:{symbol:"E",name:"Swazi Lilangeni"},THB:{symbol:"฿",name:"Thai Baht"},TTD:{symbol:"TT$",name:"Trinidad and Tobago Dollar"},TZS:{symbol:"Sh",name:"Tanzanian Shilling"},USD:{symbol:"$",name:"United States Dollar"},UYU:{symbol:"$U",name:"Uruguayan Peso"},UZS:{symbol:"so'm",name:"Uzbekistani Som"},YER:{symbol:"﷼",name:"Yemeni Rial"},ZAR:{symbol:"R",name:"South African Rand"},KWD:{symbol:"د.ك",name:"Kuwaiti Dinar"},BHD:{symbol:"د.ب.",name:"Bahraini Dinar"},OMR:{symbol:"ر.ع.",name:"Omani Rial"}};var l=n((()=>D));var m=n((x=>{var e;if(x in D)return null===(e=D[x])||void 0===e?void 0:e.symbol;throw new Error("Invalid currencyCode!")}));const d=["nan","infinity","percent","integer","group","decimal","fraction","plusSign","minusSign","percentSign","currency","code","symbol","name","compact","exponentInteger","exponentMinusSign","exponentSeparator","unit"];var c=n(((x,e={})=>{if(!Number(x)&&0!==Number(x))throw new Error("Parameter `amount` is not a number!");try{const n=M(e).formatToParts(Number(x)),a={};return n.forEach((x=>{"group"===x.type?a.integer=(a.integer||"")+x.value:-1!=d.findIndex((e=>e===x.type))&&(a[x.type]=(a[x.type]||"")+x.value)})),Object.assign(Object.assign({},a),{isPrefixSymbol:"currency"===n[0].type,rawParts:n})}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}}));const u={IN:/^(?:(?:\+|0{0,2})91\s*[-]?\s*|[0]?)?[6789]\d{9}$/,MY:/^(\+?6?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/,UY:/^(?:(?:\+598|0)\s?(9\d{3}|2\d{2}|[4-9]\d{6}))$/,UZ:/^(?:\+?998)?\s?[3456789]\d{8}$/,YE:/^(?:\+?967)?(?:\d{7,8})$/,ZA:/^(?:(?:\+27)|0)(\d{9})$/,KW:/^(?:\+?965)[569]\d{7}$/,BH:/^(?:\+?973)?[356]\d{7}$/,TL:/^(?:(?:\+670)\s?)?[0-9]{3}\s?[0-9]{3,4}$/,VC:/^(?:(?:\+1)?784)?(?:\d{3})?\d{7}$/,VE:/^(?:(?:\+58)|0)?4\d{9}$/,VN:/^(?:(?:\+84)|0)?[1-9]\d{8}$/,ZM:/^(?:(?:\+260)|0)?[123456789]\d{8,9}$/,ZW:/^(?:(?:\+263)|0)?(?:\d{9,10})$/,LT:/^(?:(?:\+370)|8)\d{8}$/,LU:/^(?:(?:\+352)?(6|2(6|7|8|9))\d{6})$/,LV:/^(?:(?:\+371)?2\d{7})$/,ME:/^(?:(?:\+382)?[67]\d{7,20})$/,MG:/^(?:(?:\+261)?3[234568]\d{7})$/,MZ:/^(?:(?:\+258)|(?:258))?8[234567]\d{7,8}$/,NL:/^(?:(?:\+31)|0(6(?:\d{8})|[1-9](?:(?:\d{8})|(?:\s\d{3}\s\d{4}))|(?:\d{8})))$/,PA:/^(?:(?:\+507)\s?)?[46]\d{6,7}$/,PL:/^(?:(?:\+48)?(?:\s?\d{3}\s?\d{3}\s?\d{3}|(?:\d{2}\s?){4}\d{2}|\d{3}-\d{3}-\d{3}))$/,PR:/^(?:(?:\+1)?787|939)\d{7}$/,PS:/^(?:(?:\+970))(5[2349])\d{7}$/,PT:/^(?:(?:\+351)?9(1\d|2[1-9]|6[12345789]|7[12345789])\d{7})$/,PY:/^(?:(?:\+595|0)9[9876]\d{7})$/,RO:/^(?:(?:\+40|0))(?:7[2-8]\d{7}|21\d{8})$/,RS:/^(?:(?:\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/,RW:/^(?:(?:\+250)|(0))\d{9}$/,SI:/^(?:(?:\+386)|0)?[1-59]\d{7,8}$/,SK:/^(?:(?:\+421))?(0|9[0-8])\d{8}$/,SM:/^(?:(?:\+378)|(0549|6\d{4}))\d{5}$/,SN:/^(?:(?:\+221)|0)?[3679]\d{7}$/,SR:/^(?:(?:\+597))\d{7}$/,TG:/^(?:(?:\+228))\d{8}$/,TJ:/^(?:(?:\+992))(37|55|77)\d{7}$/,TN:/^(?:(?:\+216)|22|9[1-9])\d{7}$/,TR:/^(?:(?:\+90)|(0))\s?5\d{9}$/,TW:/^(?:(?:\+886)|0)?9\d{8}$/,UA:/^(?:(?:\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\d{7}$/,UG:/^(?:(?:\+256)|0)?[39]\d{8}$/},S={1:["US","AG","AI","AS","BB","BM","BS","CA","DM","DO","GD","GU","JM","KN","KY","LC","MP","MS","PR","SX","TC","TT","VC","VG","VI"],7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT","VA"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH","TA"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],380:["UA"],381:["RS"],382:["ME"],383:["XK"],385:["HR"],386:["SI"],387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],691:["FM"],692:["MH"],800:["001"],808:["001"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],870:["001"],878:["001"],880:["BD"],881:["001"],882:["001"],883:["001"],886:["TW"],888:["001"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],979:["001"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},y=x=>{if("+"===x.toString().charAt(0)){const e=x.toString().replace(/\D/g,""),n=[];for(const x in S)e.startsWith(x)&&n.push(...S[x]);return n.find((e=>{const n=u[e];if(n&&n.test(x.toString()))return e}))||""}for(const e in u){if(u[e].test(x.toString()))return e}return""},$=x=>{const e=x.replace(/[^0-9+]|(?!A)\+/g,"");return"+"===x[0]?`+${e}`:e};var b=n(((x,e)=>{const n=$(x.toString());if(e=e&&e in u?e:y(n),!x)return!1;if(e in u){return u[e].test(n)}return!1}));const g={IN:"xxxx xxxxxx",MY:"xx xxxxx xx",AE:"xx xxx xxxx",AL:"xxx xx xxxx",AM:"xx xx xx xx",AR:"xxxx-xxxx",AU:"xxx xxx xxx",AW:"xxx-xxxx",BB:"xxx-xxxx",BD:"xxxx-xxxxxx",BM:"xxx-xxxx",BN:"xxxx-xxxx",BO:"xxxx-xxxx",BS:"xxx-xxxx",BW:"xx xxxx xxxx",BZ:"xxx-xxxx",CA:"xxx-xxx-xxxx",CH:"xxx xxx xxx",CN:"xxxx-xxxxxxx",CO:"xxxx-xxxxxxx",CR:"xxxx-xxxx",CU:"xxxx-xxxx",CZ:"xxx xxx xxx",DK:"xx xx xx xx",DO:"xxx-xxxxxxx",DZ:"xxxx-xxxx-xxx",EG:"xx xxx xxxx",ET:"xx xxx xxxx",EU:"xxx xx xx xx",FJ:"xxxx xxxx",GB:"xxxx xxx xxx",GH:"xxx xxx xxxx",GI:"xxxx xxxx",GM:"xxxx-xxxx",GT:"xxxx-xxxx",GY:"xxx-xxxx",HK:"xxxx xxxx",HN:"xxxx-xxxx",HR:"xxx xxx xxxx",HT:"xxx-xxxx",HU:"xxx xxx xxxx",ID:"xxxx-xxxx-xxxx",IL:"xxxx-xxx-xxx",JM:"xxx-xxxx",KE:"xxx xxxxxx",KG:"xxx-xx-xx-xx",KH:"xxx-xxx-xxx",KY:"xxx-xxxx",KZ:"xxx-xxx-xx-xx",LA:"xxx xx xxxx",LK:"xx xxx xxxx",LR:"xxx-xxx-xxxx",LS:"xxx xx xxxx",LT:"xxx xxxxx",LU:"xxx xx xxx",LV:"xxxx xxxx",MA:"xxxx-xxxxxx",MD:"xx xxxxxx",ME:"xx xxxxxx",MG:"xx xx xx xx xx",MK:"xx xx xx xx",MM:"xx xxxxxx",MN:"xxx-xx-xxxx",MO:"xxxx xxxx",MU:"xx xxxx xxxx",MV:"xxxxxx",MW:"xx xxxx xxxx",MX:"xxx-xxx-xxxx",MZ:"xx xxxxxxx",NA:"xx xxxx xxxx",NG:"xxx xxx xxxx",NI:"xxxx-xxxx",NL:"xxx-xxxxxxx",NO:"xxxx xxxx",NP:"xxxx-xxxxxxx",NZ:"xxx-xxxxxxx",OM:"xxxx-xxxx",PA:"xxx-xxxx",PE:"xxx-xxx-xxx",PG:"xxx-xxxxxx",PH:"xxx-xxxx",PK:"xxx-xxxxxxx",PL:"xxx xxx xxx",PR:"xxx-xxx-xxxx",PS:"xxxx-xxxxxxx",PT:"xxx xxx xxx",PY:"xxx-xxxxxx",QA:"xxxx xxxx",RO:"xxx xxx xxxx",RS:"xxx xxxxx",RU:"xxx xxx-xx-xx",RW:"xxx xxxxxx",SA:"xxx-xxxxxxx",SC:"xx xxxxx",SE:"xxx-xxx xx xx",SG:"xxxx xxxx",SI:"xx xxxxxx",SK:"xxx xxx xxx",SL:"xxx-xxxxxx",SM:"xxxxx xxxxx",SN:"xx xxx xx xx",SO:"xxx xxxxxxx",SR:"xxx-xxxx",SS:"xxx xxxx xxx",SV:"xxxx-xxxx",SZ:"xxx xx xxxx",TG:"xx xx xx xx",TH:"xxx-xxxxxxx",TJ:"xxx xx xx xx",TL:"xxx-xxxxxxx",TN:"xx xxxxxx",TR:"xxx xxx xx xx",TT:"xxx-xxxx",TW:"xxxx-xxxxxx",TZ:"xxx xxx xxxx",UA:"xx xxx xx xx",UG:"xxx xxxxxxx",US:"xxx-xxx-xxxx",UY:"xxx-xxxxx",UZ:"xxx-xxx-xx-xx",VC:"xxx-xxxx",VE:"xxxx-xxx-xxxx",VN:"xxxx-xxxxxxx",YE:"xxxx-xxxx",ZA:"xxx-xxx-xxxx",ZM:"xxx-xxxxxxx",ZW:"xx xxx xxxx",KW:"xxx xx xxxx",BH:"xxxx xxxx"};var h=n(((x,e)=>{if(!x)throw new Error("Parameter `phoneNumber` is invalid!");x=x.toString(),x=$(x),e=e&&e in g?e:y(x);const n=g[e];if(!n)return x;let a=0;for(let x=0;x{if(!x)throw new Error("Parameter `phoneNumber` is invalid!");x=x.toString(),x=$(x);const n=e&&e in g?e:y(x),a=h(x,n),r=g[n];if(!r)return{countryCode:n||"",dialCode:"",formattedPhoneNumber:x,formatTemplate:""};let t=0;for(let x=0;x{const a=new Date(x);switch(n){case"days":a.setDate(a.getDate()+e);break;case"months":a.setMonth(a.getMonth()+e);break;case"years":a.setFullYear(a.getFullYear()+e)}return a}));var E=n(((x,e,n={})=>{e||(e=r.getState().locale||s());const a=x instanceof Date?x:new Date(x);let t;try{t=new Intl.DateTimeFormat(e,n)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return t.format(a)}));var T=n(((x,e,n={})=>{e||(e=r.getState().locale||s());const a=Object.assign(Object.assign({},n),{timeStyle:void 0});let t;try{t=E(x,e,a)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return t}));var K=n(((x,e,n={})=>{e||(e=r.getState().locale||s());const a=Object.assign(Object.assign({},n),{dateStyle:void 0});let t;try{t=E(x,e,a)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return t}));var w=n((x=>{let e;x||(x=r.getState().locale||s());try{const n=new Intl.DateTimeFormat(x,{weekday:"short"}),a=new Date(2e3,0,2);e=n.format(a)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return["su","mo","tu","we","th","fr","sa"].indexOf(e.slice(0,2).toLowerCase())}));var R=n((x=>Math.ceil((x.getMonth()+1)/3)));var f=n(((x,e=new Date,n,a)=>{n||(n=r.getState().locale||s());const t=(x.getTime()-e.getTime())/1e3,o=3600,Y=86400,M=7*Y,i=30*Y,D=365*Y;let l,m,d;Math.abs(t)<60?(l=t,m="second"):Math.abs(t){const e=new Date(x.getFullYear(),0,1),n=(x.getTime()-e.getTime())/864e5;return Math.ceil((n+e.getDay()+1)/7)}));var P=n((x=>{try{x||(x=r.getState().locale||s());const e=new Intl.DateTimeFormat(x,{weekday:"long"});return Array.from({length:7},((x,n)=>e.format(new Date(1970,0,4+n))))}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}}));var B=n(((x,e)=>(x instanceof Date?x:new Date(x))>(e instanceof Date?e:new Date(e))));var C=n(((x,e)=>(x instanceof Date?x:new Date(x))<(e instanceof Date?e:new Date(e))));var L=n((x=>x%4==0&&x%100!=0||x%400==0));var H=n(((x,e)=>x.getDate()===e.getDate()&&x.getMonth()===e.getMonth()&&x.getFullYear()===e.getFullYear()));var I=n((x=>x instanceof Date&&!isNaN(x.getTime())));const O={"ar-AE":"DD/MM/YYYY","sq-AL":"DD.MM.YYYY","hy-AM":"DD.MM.YYYY","es-AR":"DD/MM/YYYY","en-AU":"DD/MM/YYYY","nl-AW":"DD-MM-YYYY","en-BB":"MM/DD/YYYY","bn-BD":"DD/MM/YYYY","en-BM":"MM/DD/YYYY","ms-BN":"DD/MM/YYYY","es-BO":"DD/MM/YYYY","en-BS":"MM/DD/YYYY","en-BW":"DD/MM/YYYY","en-BZ":"MM/DD/YYYY","en-CA":"DD/MM/YYYY","de-CH":"DD.MM.YYYY","zh-CN":"YYYY/MM/DD","es-CO":"DD/MM/YYYY","es-CR":"DD/MM/YYYY","es-CU":"DD/MM/YYYY","cs-CZ":"DD.MM.YYYY","da-DK":"DD-MM-YYYY","es-DO":"DD/MM/YYYY","ar-DZ":"DD/MM/YYYY","ar-EG":"DD/MM/YYYY","am-ET":"DD/MM/YYYY","en-EU":"DD/MM/YYYY","en-FJ":"DD/MM/YYYY","en-GB":"DD/MM/YYYY","en-GH":"DD/MM/YYYY","en-GI":"DD/MM/YYYY","en-GM":"DD/MM/YYYY","es-GT":"DD/MM/YYYY","en-GY":"DD/MM/YYYY","en-HK":"DD/MM/YYYY","es-HN":"DD/MM/YYYY","hr-HR":"DD.MM.YYYY","ht-HT":"MM/DD/YYYY","hu-HU":"YYYY. MM. DD.","id-ID":"DD/MM/YYYY","he-IL":"DD/MM/YYYY","en-IN":"DD-MM-YYYY","en-JM":"MM/DD/YYYY","en-KE":"DD/MM/YYYY","ky-KG":"DD.MM.YYYY","km-KH":"DD/MM/YYYY","en-KY":"MM/DD/YYYY","kk-KZ":"DD.MM.YYYY","lo-LA":"DD/MM/YYYY","si-LK":"YYYY-MM-DD","en-LR":"MM/DD/YYYY","en-LS":"DD/MM/YYYY","ar-MA":"DD/MM/YYYY","ro-MD":"DD.MM.YYYY","mk-MK":"DD.MM.YYYY","my-MM":"DD/MM/YYYY","mn-MN":"YYYY.MM.DD","zh-MO":"DD/MM/YYYY","en-MU":"DD/MM/YYYY","dv-MV":"DD/MM/YYYY","en-MW":"DD/MM/YYYY","es-MX":"DD/MM/YYYY","ms-MY":"DD/MM/YYYY","en-NA":"DD/MM/YYYY","en-NG":"DD/MM/YYYY","es-NI":"DD/MM/YYYY","no-NO":"DD.MM.YYYY","ne-NP":"YYYY/MM/DD","en-NZ":"DD/MM/YYYY","es-PE":"DD/MM/YYYY","en-PG":"DD/MM/YYYY","en-PH":"MM/DD/YYYY","en-PK":"DD/MM/YYYY","ar-QA":"DD/MM/YYYY","ru-RU":"DD.MM.YYYY","ar-SA":"DD/MM/YYYY","en-SC":"DD/MM/YYYY","sv-SE":"YYYY-MM-DD","en-SG":"DD/MM/YYYY","en-SL":"DD/MM/YYYY","so-SO":"DD/MM/YYYY","en-SS":"DD/MM/YYYY","es-SV":"DD/MM/YYYY","en-SZ":"DD/MM/YYYY","th-TH":"DD/MM/YYYY","en-TT":"MM/DD/YYYY","sw-TZ":"DD/MM/YYYY","en-US":"MM/DD/YYYY","es-UY":"DD/MM/YYYY","uz-UZ":"DD/MM/YYYY","ar-YE":"DD/MM/YYYY","en-ZA":"YYYY/MM/DD","ar-KW":"DD/MM/YYYY","ar-BH":"DD/MM/YYYY","ar-OM":"DD/MM/YYYY"};var U=n(((x,e)=>{const n=e.includes("/")?"/":e.includes(".")?".":"-",a=e.split(n),r=x.split(n).map((x=>parseInt(x,10)));let t=0,o=0,Y=0,s=!1,M=!1,i=!1;if(r.length!==a.length)return null;if(a.forEach(((x,e)=>{if(isNaN(r[e]))return null;switch(x){case"DD":Y=r[e],i=!0;break;case"MM":o=r[e]-1,M=!0;break;case"YYYY":t=r[e],s=!0}})),s&&M&&i){const x=new Date(t,o,Y);if(x.getFullYear()===t&&x.getMonth()===o&&x.getDate()===Y)return x}return null}));var p=n(((x,e)=>{e||(e=r.getState().locale||s());const n=O[e];if(!n)throw new Error(`No date format found for locale: ${e}`);return U(x,n)}));var v=n(((x,e,n)=>A(x,-e,n)));x.add=A,x.formatDate=T,x.formatDateTime=E,x.formatNumber=i,x.formatNumberByParts=c,x.formatPhoneNumber=h,x.formatTime=K,x.getCurrencyList=l,x.getCurrencySymbol=m,x.getFirstDayOfWeek=w,x.getQuarter=R,x.getRelativeTime=f,x.getState=t,x.getWeek=G,x.getWeekdays=P,x.isAfter=B,x.isBefore=C,x.isLeapYear=L,x.isSameDay=H,x.isValidDate=I,x.isValidPhoneNumber=b,x.parseDate=p,x.parsePhoneNumber=N,x.resetState=Y,x.setState=o,x.subtract=v})); +//# sourceMappingURL=index.min.js.map diff --git a/lib/umd/index.min.js.map b/lib/umd/index.min.js.map new file mode 100644 index 00000000..d04e1655 --- /dev/null +++ b/lib/umd/index.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.min.js","sources":["../../src/common/errorBoundary/index.ts","../../src/modules/.internal/state/index.ts","../../src/modules/.internal/utils/getDefaultState.ts","../../src/modules/core/getState.ts","../../src/modules/core/setState.ts","../../src/modules/core/resetState.ts","../../src/modules/.internal/utils/getLocale.ts","../../src/modules/.internal/utils/getIntlInstanceWithOptions.ts","../../src/modules/currency/formatNumber.ts","../../src/modules/currency/data/currencies.ts","../../src/modules/currency/getCurrencyList.ts","../../src/modules/currency/getCurrencySymbol.ts","../../src/modules/currency/constants.ts","../../src/modules/currency/formatNumberByParts.ts","../../src/modules/phoneNumber/data/phoneRegexMapper.ts","../../src/modules/phoneNumber/data/dialCodeMapper.ts","../../src/modules/phoneNumber/utils.ts","../../src/modules/phoneNumber/isValidPhoneNumber.ts","../../src/modules/phoneNumber/data/phoneFormatterMapper.ts","../../src/modules/phoneNumber/formatPhoneNumber.ts","../../src/modules/phoneNumber/parsePhoneNumber.ts","../../src/modules/dateTime/add.ts","../../src/modules/dateTime/formatDateTime.ts","../../src/modules/dateTime/formatDate.ts","../../src/modules/dateTime/formatTime.ts","../../src/modules/dateTime/getFirstDayOfWeek.ts","../../src/modules/dateTime/getQuarter.ts","../../src/modules/dateTime/getRelativeTime.ts","../../src/modules/dateTime/getWeek.ts","../../src/modules/dateTime/getWeekdays.ts","../../src/modules/dateTime/isAfter.ts","../../src/modules/dateTime/isBefore.ts","../../src/modules/dateTime/isLeapYear.ts","../../src/modules/dateTime/isSameDay.ts","../../src/modules/dateTime/isValidDate.ts","../../src/modules/dateTime/data/localeDateFormats.ts","../../src/modules/dateTime/parseDateWithFormat.ts","../../src/modules/dateTime/parseDate.ts","../../src/modules/dateTime/subtract.ts"],"sourcesContent":["// Custom Error class to extend properties to error object\nexport class I18nifyError extends Error {\n timestamp: Date;\n constructor(message: string | undefined) {\n super(message);\n this.name = 'i18nify Error';\n this.timestamp = new Date();\n // more params like type of error/severity can be added in future for better debugging.\n }\n}\n\n/**\n * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block.\n * It appends additional attributes and serves as a centralized error-handling service.\n * Usage =>\n * const wrappedUtilityFn = withErrorBoundary(utilityFn)\n *\n * @param fn utility that is wrapped in error boundary\n * @returns {Function} returns the function wrapped in try/catch block\n */\nexport const withErrorBoundary = any>(\n fn: T,\n): ((...args: Parameters) => ReturnType) => {\n return function (this: unknown, ...rest: Parameters): ReturnType {\n try {\n return fn.call(this, ...rest) as ReturnType;\n } catch (err) {\n console.warn('[I18N Error]: ', err);\n // Currently, we are throwing the error as it is to consumers.\n // In the future, this can be modified as per our requirement, like an error logging service.\n throw new I18nifyError(err as string | undefined);\n }\n };\n};\n","import { I18nState } from './types';\nimport { getDefaultState } from '../utils/getDefaultState';\n\nexport class I18nStateManager {\n private static instance: I18nStateManager | undefined;\n private state: I18nState;\n\n private constructor() {\n this.state = getDefaultState();\n }\n\n public static getInstance(): I18nStateManager {\n if (!I18nStateManager.instance) {\n I18nStateManager.instance = new I18nStateManager();\n }\n\n return I18nStateManager.instance;\n }\n\n public static resetInstance(): void {\n I18nStateManager.instance = undefined;\n }\n\n public getState(): I18nState {\n return { ...this.state };\n }\n\n public setState(newState: Partial): void {\n this.state = { ...this.state, ...newState };\n }\n\n public resetState(): void {\n this.state = getDefaultState();\n }\n}\n\nexport default I18nStateManager.getInstance();\n","import type { I18nState } from '../state/types';\n\nexport function getDefaultState(): I18nState {\n return {\n locale: '',\n direction: '',\n country: '',\n };\n}\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * function to return active i18n state\n *\n * ===== USAGE =====\n * import { getState } from '@razorpay/i18nify-js';\n *\n * console.log(getState())\n *\n * @returns i18n state\n */\nconst getState = (): I18nState => {\n return state.getState();\n};\n\nexport default withErrorBoundary(getState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * Function to set and override the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { setState } from \"@razorpay/i18nify-js\";\n * setState({locale: 'en-US'})\n *\n * @param newState data to set in i18nState instance\n */\nconst setState = (newState: Partial): void => {\n state.setState(newState);\n};\n\nexport default withErrorBoundary(setState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\n\n/**\n * Function to reset the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { resetState } from \"@razorpay/i18nify-js\";\n * resetState()\n *\n * @param newState data to set in i18nState instance\n */\nconst resetState = (): void => {\n state.resetState();\n};\n\nexport default withErrorBoundary(resetState);\n","export const getLocale = (): string => {\n // Check if running in a non-browser environment (e.g., Node.js or older browsers).\n if (typeof navigator === 'undefined') {\n return 'en-IN';\n }\n\n // Check if the browser supports the Intl object and user language preferences.\n if (\n window.Intl &&\n typeof window.Intl === 'object' &&\n (window.navigator.languages || window.navigator.language)\n ) {\n const userLocales = window.navigator.languages || [\n window.navigator.language,\n ];\n return userLocales[0];\n }\n\n // Fallback to a supported locale or the default locale.\n return 'en-IN';\n};\n","import { CURRENCIES } from '../../currency/data/currencies';\nimport state from '../state';\nimport { getLocale } from './getLocale';\n\nexport const getIntlInstanceWithOptions = (\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n) => {\n /** retrieve locale from below areas in order of preference\n * 1. options.locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n let locale = options?.locale || state.getState().locale;\n\n // If a specific locale is provided, use it; otherwise, use the browser's locale\n if (!locale) {\n locale = getLocale();\n }\n\n const intlOptions = options?.intlOptions ? { ...options.intlOptions } : {};\n\n if (options?.currency || intlOptions.currency) {\n intlOptions.style = 'currency';\n intlOptions.currency = (options.currency || intlOptions.currency) as string;\n }\n\n if (!locale) throw new Error('Pass valid locale !');\n\n return new Intl.NumberFormat(locale || undefined, intlOptions);\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\n\n// this function formats number based on different arguments passed\nconst formatNumber = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): string => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n let formattedAmount = '';\n\n try {\n formattedAmount = getIntlInstanceWithOptions(options).format(\n Number(amount),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedAmount;\n};\n\nexport default withErrorBoundary(formatNumber);\n","export const CURRENCIES: { [key: string]: { symbol: string; name: string } } = {\n AED: { symbol: 'د.إ', name: 'United Arab Emirates Dirham' },\n ALL: { symbol: 'Lek', name: 'Albanian Lek' },\n AMD: { symbol: '֏', name: 'Armenian Dram' },\n ARS: { symbol: 'ARS', name: 'Argentine Peso' },\n AUD: { symbol: 'A$', name: 'Australian Dollar' },\n AWG: { symbol: 'Afl.', name: 'Aruban Florin' },\n BBD: { symbol: '$', name: 'Barbadian Dollar' },\n BDT: { symbol: '৳', name: 'Bangladeshi Taka' },\n BMD: { symbol: '$', name: 'Bermudian Dollar' },\n BND: { symbol: 'BND', name: 'Brunei Dollar' },\n BOB: { symbol: 'Bs', name: 'Bolivian Boliviano' },\n BSD: { symbol: 'B$', name: 'Bahamian Dollar' },\n BWP: { symbol: 'P', name: 'Botswanan Pula' },\n BZD: { symbol: 'BZ$', name: 'Belize Dollar' },\n CAD: { symbol: 'C$', name: 'Canadian Dollar' },\n CHF: { symbol: 'CHf', name: 'Swiss Franc' },\n CNY: { symbol: '¥', name: 'Chinese Yuan' },\n COP: { symbol: 'COL$', name: 'Colombian Peso' },\n CRC: { symbol: '₡', name: 'Costa Rican Colón' },\n CUP: { symbol: '$MN', name: 'Cuban Peso' },\n CZK: { symbol: 'Kč', name: 'Czech Koruna' },\n DKK: { symbol: 'DKK', name: 'Danish Krone' },\n DOP: { symbol: 'RD$', name: 'Dominican Peso' },\n DZD: { symbol: 'د.ج', name: 'Algerian Dinar' },\n EGP: { symbol: 'E£', name: 'Egyptian Pound' },\n ETB: { symbol: 'ብር', name: 'Ethiopian Birr' },\n EUR: { symbol: '€', name: 'Euro' },\n FJD: { symbol: 'FJ$', name: 'Fijian Dollar' },\n GBP: { symbol: '£', name: 'British Pound' },\n GHS: { symbol: 'GH₵', name: 'Ghanaian Cedi' },\n GIP: { symbol: 'GIP', name: 'Gibraltar Pound' },\n GMD: { symbol: 'D', name: 'Gambian Dalasi' },\n GTQ: { symbol: 'Q', name: 'Guatemalan Quetzal' },\n GYD: { symbol: 'G$', name: 'Guyanese Dollar' },\n HKD: { symbol: 'HK$', name: 'Hong Kong Dollar' },\n HNL: { symbol: 'HNL', name: 'Honduran Lempira' },\n HRK: { symbol: 'kn', name: 'Croatian Kuna' },\n HTG: { symbol: 'G', name: 'Haitian Gourde' },\n HUF: { symbol: 'Ft', name: 'Hungarian Forint' },\n IDR: { symbol: 'Rp', name: 'Indonesian Rupiah' },\n ILS: { symbol: '₪', name: 'Israeli New Shekel' },\n INR: { symbol: '₹', name: 'Indian Rupee' },\n JMD: { symbol: 'J$', name: 'Jamaican Dollar' },\n KES: { symbol: 'Ksh', name: 'Kenyan Shilling' },\n KGS: { symbol: 'Лв', name: 'Kyrgystani Som' },\n KHR: { symbol: '៛', name: 'Cambodian Riel' },\n KYD: { symbol: 'CI$', name: 'Cayman Islands Dollar' },\n KZT: { symbol: '₸', name: 'Kazakhstani Tenge' },\n LAK: { symbol: '₭', name: 'Laotian Kip' },\n LKR: { symbol: 'රු', name: 'Sri Lankan Rupee' },\n LRD: { symbol: 'L$', name: 'Liberian Dollar' },\n LSL: { symbol: 'LSL', name: 'Lesotho Loti' },\n MAD: { symbol: 'د.م.', name: 'Moroccan Dirham' },\n MDL: { symbol: 'MDL', name: 'Moldovan Leu' },\n MKD: { symbol: 'ден', name: 'Macedonian Denar' },\n MMK: { symbol: 'MMK', name: 'Myanmar Kyat' },\n MNT: { symbol: '₮', name: 'Mongolian Tugrik' },\n MOP: { symbol: 'MOP$', name: 'Macanese Pataca' },\n MUR: { symbol: '₨', name: 'Mauritian Rupee' },\n MVR: { symbol: 'Rf', name: 'Maldivian Rufiyaa' },\n MWK: { symbol: 'MK', name: 'Malawian Kwacha' },\n MXN: { symbol: 'Mex$', name: 'Mexican Peso' },\n MYR: { symbol: 'RM', name: 'Malaysian Ringgit' },\n NAD: { symbol: 'N$', name: 'Namibian Dollar' },\n NGN: { symbol: '₦', name: 'Nigerian Naira' },\n NIO: { symbol: 'NIO', name: 'Nicaraguan Córdoba' },\n NOK: { symbol: 'NOK', name: 'Norwegian Krone' },\n NPR: { symbol: 'रू', name: 'Nepalese Rupee' },\n NZD: { symbol: 'NZ$', name: 'New Zealand Dollar' },\n PEN: { symbol: 'S/', name: 'Peruvian Nuevo Sol' },\n PGK: { symbol: 'PGK', name: 'Papua New Guinean Kina' },\n PHP: { symbol: '₱', name: 'Philippine Peso' },\n PKR: { symbol: '₨', name: 'Pakistani Rupee' },\n QAR: { symbol: 'QR', name: 'Qatari Riyal' },\n RUB: { symbol: '₽', name: 'Russian Ruble' },\n SAR: { symbol: 'SR', name: 'Saudi Riyal' },\n SCR: { symbol: 'SRe', name: 'Seychellois Rupee' },\n SEK: { symbol: 'SEK', name: 'Swedish Krona' },\n SGD: { symbol: 'S$', name: 'Singapore Dollar' },\n SLL: { symbol: 'Le', name: 'Sierra Leonean Leone' },\n SOS: { symbol: 'Sh.so.', name: 'Somali Shilling' },\n SSP: { symbol: 'SS£', name: 'South Sudanese Pound' },\n SVC: { symbol: '₡', name: 'Salvadoran Colón' },\n SZL: { symbol: 'E', name: 'Swazi Lilangeni' },\n THB: { symbol: '฿', name: 'Thai Baht' },\n TTD: { symbol: 'TT$', name: 'Trinidad and Tobago Dollar' },\n TZS: { symbol: 'Sh', name: 'Tanzanian Shilling' },\n USD: { symbol: '$', name: 'United States Dollar' },\n UYU: { symbol: '$U', name: 'Uruguayan Peso' },\n UZS: { symbol: \"so'm\", name: 'Uzbekistani Som' },\n YER: { symbol: '﷼', name: 'Yemeni Rial' },\n ZAR: { symbol: 'R', name: 'South African Rand' },\n KWD: { symbol: 'د.ك', name: 'Kuwaiti Dinar' },\n BHD: { symbol: 'د.ب.', name: 'Bahraini Dinar' },\n OMR: { symbol: 'ر.ع.', name: 'Omani Rial' },\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencyList = () => {\n return CURRENCIES;\n};\n\nexport default withErrorBoundary(getCurrencyList);\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencySymbol = (currencyCode: keyof typeof CURRENCIES): string => {\n if (currencyCode in CURRENCIES) return CURRENCIES[currencyCode]?.symbol;\n else throw new Error('Invalid currencyCode!');\n};\n\nexport default withErrorBoundary(getCurrencySymbol);\n","export const ALLOWED_FORMAT_PARTS_KEYS = [\n 'nan',\n 'infinity',\n 'percent',\n 'integer',\n 'group',\n 'decimal',\n 'fraction',\n 'plusSign',\n 'minusSign',\n 'percentSign',\n 'currency',\n 'code',\n 'symbol',\n 'name',\n 'compact',\n 'exponentInteger',\n 'exponentMinusSign',\n 'exponentSeparator',\n 'unit',\n] as const;\n","import { CURRENCIES } from './data/currencies';\nimport { ByParts, FormattedPartsObject } from './types';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\nimport { ALLOWED_FORMAT_PARTS_KEYS } from './constants';\n\nconst formatNumberByParts = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): ByParts => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n try {\n const formattedAmount = getIntlInstanceWithOptions(options).formatToParts(\n Number(amount),\n );\n\n const parts = formattedAmount;\n\n const formattedObj: FormattedPartsObject = {};\n\n parts.forEach((p) => {\n if (p.type === 'group') {\n formattedObj.integer = (formattedObj.integer || '') + p.value;\n } else if (\n ALLOWED_FORMAT_PARTS_KEYS.findIndex((item) => item === p.type) != -1\n ) {\n // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal' is skipped\n formattedObj[p.type] = (formattedObj[p.type] || '') + p.value;\n }\n });\n\n return {\n ...formattedObj,\n isPrefixSymbol: parts[0].type === 'currency',\n rawParts: parts,\n };\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(\n formatNumberByParts,\n);\n","export const PHONE_REGEX_MAPPER: { [key: string]: RegExp } = {\n IN: /^(?:(?:\\+|0{0,2})91\\s*[-]?\\s*|[0]?)?[6789]\\d{9}$/,\n MY: /^(\\+?6?0)?(\\d{1,3})[-. ]?(\\d{7,8})$/,\n AE: /^(?:\\+?971|0)?(?:2|3|4|6|7|9)\\d{8}$/,\n AL: /^(?:\\+?355)?(?:[4-9]\\d{7}|6\\d{8})$/,\n AM: /^(?:\\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/,\n AR: /^(?:(?:\\+|0{0,2})54)?(?:11|[2368]\\d)(?:(?=\\d{0,2}15)\\d{2})??\\d{8}$/,\n AU: /^(?:\\+?61|0)4\\d{8}$/,\n AW: /^(?:(?:\\+297)?(?!0)\\d{7})$/,\n BB: /^(?:(?:\\+1)?246)?(?:\\d{3})?\\d{7}$/,\n BD: /^(?:\\+?880|0)1[13456789]\\d{8}$/,\n BM: /^(?:(?:\\+1)?441)?(?:\\d{2})?\\d{7}$/,\n BN: /^(?:\\+?673)?(?:\\d{3})?\\d{4}$/,\n BO: /^(?:(?:\\+|0{0,2})591)?(?:(?:2|3|7|6)\\d{7})$/,\n BS: /^(?:(?:\\+1)?242)?(?:\\d{3})?\\d{7}$/,\n BW: /^(?:(?:\\+267)?\\s?)?[74]\\d{7}$/,\n BZ: /^(?:(?:\\+501)?\\s?)?[622]\\d{4}$/,\n CH: /^(?:(?:\\+41|0)(?:\\s*\\(?0\\)?\\s*))?(?:\\d{2}\\s*)?\\d{3}\\s*\\d{2}\\s*\\d{2}$/,\n CN: /^(?:(?:\\+|00)86)?1\\d{10}$/,\n CO: /^(?:(?:\\+57|0057)?)?[1-8]{1}\\d{6,7}$/,\n OM: /^(?:\\+?968)?(?:95|96|97|98)\\d{6}$/,\n CR: /^(?:(?:\\+506)?\\s*|0)?[1-9]\\d{7}$/,\n CU: /^(?:\\+?53)?(?:[5-8]\\d{7})$/,\n CZ: /^(?:\\+?420)?(?:\\d{9})$/,\n DK: /^(?:\\+?45)?(?:\\d{8})$/,\n DO: /^(?:(?:\\+1)?809|1-8(?:00|88|89))(?:\\d{7})$/,\n DZ: /^(?:\\+?213|0)([567]\\d{8})$/,\n EG: /^(?:(?:\\+20|20)?(\\d{10}))$/,\n ET: /^(?:\\+?251)?[1-59]\\d{8}$/,\n EU: /^(?:(?:\\+?3)?8)?\\s*(?:\\d{3}\\s*){3}\\d{2}$/,\n FJ: /^(?:(?:\\+?679)?\\s?\\d{3}\\s?\\d{4})?$/,\n GB: /^(?:(?:\\+44\\s?|0)7\\d{3}(\\s?\\d{4,})?)$/,\n GH: /^(?:(?:\\+233)|0)?(?:\\d{9})$/,\n GI: /^(?:\\+350)?\\d{5}$/,\n GM: /^(?:\\+220)?\\d{5,7}$/,\n GT: /^(?:\\+502)?[2468]\\d{7,8}$/,\n GY: /^(?:(?:\\+592)?(?:(?:\\s)?[2-9])(?:(?:\\s)?\\d))?(?:(?:\\s)?\\d{4})$/,\n HK: /^(?:\\+852\\s?)?[456789]\\d{3}\\s?\\d{4}$/,\n HN: /^(?:\\+504)?[89]\\d{7}$/,\n HR: /^(?:\\+?385)?\\d{8,9}$/,\n HT: /^(?:\\+?509)?\\d{8}$/,\n HU: /^(?:(?:\\+36))(\\s?\\d{2}\\s?\\d{3}\\s?\\d{4})$/,\n ID: /^(?:\\+?62|0[1-9])[\\s-]?\\d{2,4}[\\s-]?\\d{3,4}[\\s-]?\\d{3,4}$/,\n IL: /^(?:(?:\\+972|0)(?:-)?)[23489]\\d{7}$/,\n JM: /^(?:(?:\\+1876))\\d{7,10}$/,\n KE: /^(?:(?:\\+254)|(?:0))(?:\\d{6,7})$/,\n KG: /^(?:\\+996)?\\s?\\d{9}$/,\n KH: /^(?:(?:\\+855)|(?:0))(?:\\s?[1-9]\\d{7,8})$/,\n KY: /^(?:\\+?1\\s?(345))\\d{6}$/,\n KZ: /^(?:\\+?7|8)?7\\d{9}$/,\n LA: /^(?:(?:\\+?856)|0)(20\\d{7,9})$/,\n LK: /^(?:(?:\\+94)|0)(?:\\d{9})$/,\n LR: /^(?:\\+231)[ -\\d]{4}[ -\\d]{4}$/,\n LS: /^(?:(?:\\+?266)|0)?[56]\\d{7}$/,\n MA: /^(?:(?:\\+?212(\\s*[-|\\s*]?\\d{1,9})?)|(?:0))(?:\\d{9})$/,\n MD: /^(?:(?:\\+373)|(?:0))(?:\\d{7,8})$/,\n MK: /^(?:\\+389|0)(?:(?:2[0-4]|[3-9])\\s?)?\\d{6}$/,\n MM: /^(?:(?:\\+?95)|0)?[1-9]\\d{9}$/,\n MN: /^(?:\\+976|0)\\d{8}$/,\n MO: /^(?:(?:\\+?853)|[0-9])?\\d{8}$/,\n MU: /^(?:\\+230|0)?\\d{8}$/,\n MV: /^(?:(?:\\+?960)|0)?\\d{7}$/,\n MW: /^(?:\\+265)[1-9]\\d{6}$/,\n MX: /^(?:(?:\\+?52)?\\s?(?:1|01)?\\s?)?(?:\\d{3}\\s?\\d{3}\\s?\\d{4})$/,\n NA: /^(?:(?:\\+264)|0)?\\d{8}$/,\n NG: /^(?:(?:\\+234)|(?:0))(?:\\d{7,8})$/,\n NI: /^(?:(?:\\+505))?(?:\\d{8})$/,\n NO: /^(?:(?:\\+?47)|\\d{2}|\\d{3})\\s?\\d{2}\\s?\\d{3}$/,\n NP: /^(?:(?:\\+977))?(\\d{9,10})$/,\n NZ: /^(?:\\+?64|0)(\\d{2,5} \\d{4,8}|\\d{3,4} \\d{4})$/,\n PE: /^(?:(?:\\+51)|0)?(?:9\\d{8})$/,\n PG: /^(?:\\+?675)?(?:[7-9]\\d{7})$/,\n PH: /^(?:(?:\\+?63)|0)(?:\\d{10})$/,\n PK: /^(?:(?:\\+92)|0)?[345]\\d{9}$/,\n QA: /^(?:\\+?974)?-?33\\d{5}$/,\n RU: /^(?:\\+?7|8)?[ -]?\\(?9\\d{2}\\)?[ -]?\\d{3}[ -]?\\d{2}[ -]?\\d{2}$/,\n SA: /^(?:\\+?966)?\\s?1?[\\s-]?(?:[45]\\d{2}|5\\d{3})[\\s-]?\\d{4}$/,\n SC: /^(?:(?:\\+248)|\\d{4})\\d{5}$/,\n SE: /^(?:\\+?46|0)\\s?[1-57-9](?:[0-9]\\s?){8}$/,\n SG: /^(?:(?:\\+65)|(?:\\(\\+65\\))|(?:65))\\d{4}\\d{4}$/,\n SL: /^(?:(?:\\+232)|(?:0))?\\d{9}$/,\n SO: /^(?:\\+252|0)?[567]\\d{7}$/,\n SS: /^(?:\\+211|0)?[1-9]\\d{7,9}$/,\n SV: /^(?:(?:\\+?503)|(?:0))(?:\\d{8})$/,\n SZ: /^(?:\\+?268)?\\d{7,8}$/,\n TH: /^(?:(?:\\+66)|0)\\d{9}$/,\n TT: /^(?:(?:\\+?1-868)|\\(?868\\)?)(\\d{7})$/,\n TZ: /^(?:(?:\\+?255)|0)?[67]\\d{8}$/,\n US: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n CA: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n UY: /^(?:(?:\\+598|0)\\s?(9\\d{3}|2\\d{2}|[4-9]\\d{6}))$/,\n UZ: /^(?:\\+?998)?\\s?[3456789]\\d{8}$/,\n YE: /^(?:\\+?967)?(?:\\d{7,8})$/,\n ZA: /^(?:(?:\\+27)|0)(\\d{9})$/,\n KW: /^(?:\\+?965)[569]\\d{7}$/,\n BH: /^(?:\\+?973)?[356]\\d{7}$/,\n TL: /^(?:(?:\\+670)\\s?)?[0-9]{3}\\s?[0-9]{3,4}$/,\n VC: /^(?:(?:\\+1)?784)?(?:\\d{3})?\\d{7}$/,\n VE: /^(?:(?:\\+58)|0)?4\\d{9}$/,\n VN: /^(?:(?:\\+84)|0)?[1-9]\\d{8}$/,\n ZM: /^(?:(?:\\+260)|0)?[123456789]\\d{8,9}$/,\n ZW: /^(?:(?:\\+263)|0)?(?:\\d{9,10})$/,\n LT: /^(?:(?:\\+370)|8)\\d{8}$/,\n LU: /^(?:(?:\\+352)?(6|2(6|7|8|9))\\d{6})$/,\n LV: /^(?:(?:\\+371)?2\\d{7})$/,\n ME: /^(?:(?:\\+382)?[67]\\d{7,20})$/,\n MG: /^(?:(?:\\+261)?3[234568]\\d{7})$/,\n MZ: /^(?:(?:\\+258)|(?:258))?8[234567]\\d{7,8}$/,\n NL: /^(?:(?:\\+31)|0(6(?:\\d{8})|[1-9](?:(?:\\d{8})|(?:\\s\\d{3}\\s\\d{4}))|(?:\\d{8})))$/,\n PA: /^(?:(?:\\+507)\\s?)?[46]\\d{6,7}$/,\n PL: /^(?:(?:\\+48)?(?:\\s?\\d{3}\\s?\\d{3}\\s?\\d{3}|(?:\\d{2}\\s?){4}\\d{2}|\\d{3}-\\d{3}-\\d{3}))$/,\n PR: /^(?:(?:\\+1)?787|939)\\d{7}$/,\n PS: /^(?:(?:\\+970))(5[2349])\\d{7}$/,\n PT: /^(?:(?:\\+351)?9(1\\d|2[1-9]|6[12345789]|7[12345789])\\d{7})$/,\n PY: /^(?:(?:\\+595|0)9[9876]\\d{7})$/,\n RO: /^(?:(?:\\+40|0))(?:7[2-8]\\d{7}|21\\d{8})$/,\n RS: /^(?:(?:\\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/,\n RW: /^(?:(?:\\+250)|(0))\\d{9}$/,\n SI: /^(?:(?:\\+386)|0)?[1-59]\\d{7,8}$/,\n SK: /^(?:(?:\\+421))?(0|9[0-8])\\d{8}$/,\n SM: /^(?:(?:\\+378)|(0549|6\\d{4}))\\d{5}$/,\n SN: /^(?:(?:\\+221)|0)?[3679]\\d{7}$/,\n SR: /^(?:(?:\\+597))\\d{7}$/,\n TG: /^(?:(?:\\+228))\\d{8}$/,\n TJ: /^(?:(?:\\+992))(37|55|77)\\d{7}$/,\n TN: /^(?:(?:\\+216)|22|9[1-9])\\d{7}$/,\n TR: /^(?:(?:\\+90)|(0))\\s?5\\d{9}$/,\n TW: /^(?:(?:\\+886)|0)?9\\d{8}$/,\n UA: /^(?:(?:\\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\\d{7}$/,\n UG: /^(?:(?:\\+256)|0)?[39]\\d{8}$/,\n};\n","/* Source: Google LibPhoneNumber Metadata: https://github.com/google/libphonenumber/blob/master/javascript/i18n/phonenumbers/metadata.js */\n\nexport const DIAL_CODE_MAPPER: { [key: number]: string[] } = {\n 1: [\n 'US',\n 'AG',\n 'AI',\n 'AS',\n 'BB',\n 'BM',\n 'BS',\n 'CA',\n 'DM',\n 'DO',\n 'GD',\n 'GU',\n 'JM',\n 'KN',\n 'KY',\n 'LC',\n 'MP',\n 'MS',\n 'PR',\n 'SX',\n 'TC',\n 'TT',\n 'VC',\n 'VG',\n 'VI',\n ],\n 7: ['RU', 'KZ'],\n 20: ['EG'],\n 27: ['ZA'],\n 30: ['GR'],\n 31: ['NL'],\n 32: ['BE'],\n 33: ['FR'],\n 34: ['ES'],\n 36: ['HU'],\n 39: ['IT', 'VA'],\n 40: ['RO'],\n 41: ['CH'],\n 43: ['AT'],\n 44: ['GB', 'GG', 'IM', 'JE'],\n 45: ['DK'],\n 46: ['SE'],\n 47: ['NO', 'SJ'],\n 48: ['PL'],\n 49: ['DE'],\n 51: ['PE'],\n 52: ['MX'],\n 53: ['CU'],\n 54: ['AR'],\n 55: ['BR'],\n 56: ['CL'],\n 57: ['CO'],\n 58: ['VE'],\n 60: ['MY'],\n 61: ['AU', 'CC', 'CX'],\n 62: ['ID'],\n 63: ['PH'],\n 64: ['NZ'],\n 65: ['SG'],\n 66: ['TH'],\n 81: ['JP'],\n 82: ['KR'],\n 84: ['VN'],\n 86: ['CN'],\n 90: ['TR'],\n 91: ['IN'],\n 92: ['PK'],\n 93: ['AF'],\n 94: ['LK'],\n 95: ['MM'],\n 98: ['IR'],\n 211: ['SS'],\n 212: ['MA', 'EH'],\n 213: ['DZ'],\n 216: ['TN'],\n 218: ['LY'],\n 220: ['GM'],\n 221: ['SN'],\n 222: ['MR'],\n 223: ['ML'],\n 224: ['GN'],\n 225: ['CI'],\n 226: ['BF'],\n 227: ['NE'],\n 228: ['TG'],\n 229: ['BJ'],\n 230: ['MU'],\n 231: ['LR'],\n 232: ['SL'],\n 233: ['GH'],\n 234: ['NG'],\n 235: ['TD'],\n 236: ['CF'],\n 237: ['CM'],\n 238: ['CV'],\n 239: ['ST'],\n 240: ['GQ'],\n 241: ['GA'],\n 242: ['CG'],\n 243: ['CD'],\n 244: ['AO'],\n 245: ['GW'],\n 246: ['IO'],\n 247: ['AC'],\n 248: ['SC'],\n 249: ['SD'],\n 250: ['RW'],\n 251: ['ET'],\n 252: ['SO'],\n 253: ['DJ'],\n 254: ['KE'],\n 255: ['TZ'],\n 256: ['UG'],\n 257: ['BI'],\n 258: ['MZ'],\n 260: ['ZM'],\n 261: ['MG'],\n 262: ['RE', 'YT'],\n 263: ['ZW'],\n 264: ['NA'],\n 265: ['MW'],\n 266: ['LS'],\n 267: ['BW'],\n 268: ['SZ'],\n 269: ['KM'],\n 290: ['SH', 'TA'],\n 291: ['ER'],\n 297: ['AW'],\n 298: ['FO'],\n 299: ['GL'],\n 350: ['GI'],\n 351: ['PT'],\n 352: ['LU'],\n 353: ['IE'],\n 354: ['IS'],\n 355: ['AL'],\n 356: ['MT'],\n 357: ['CY'],\n 358: ['FI', 'AX'],\n 359: ['BG'],\n 370: ['LT'],\n 371: ['LV'],\n 372: ['EE'],\n 373: ['MD'],\n 374: ['AM'],\n 375: ['BY'],\n 376: ['AD'],\n 377: ['MC'],\n 378: ['SM'],\n 380: ['UA'],\n 381: ['RS'],\n 382: ['ME'],\n 383: ['XK'],\n 385: ['HR'],\n 386: ['SI'],\n 387: ['BA'],\n 389: ['MK'],\n 420: ['CZ'],\n 421: ['SK'],\n 423: ['LI'],\n 500: ['FK'],\n 501: ['BZ'],\n 502: ['GT'],\n 503: ['SV'],\n 504: ['HN'],\n 505: ['NI'],\n 506: ['CR'],\n 507: ['PA'],\n 508: ['PM'],\n 509: ['HT'],\n 590: ['GP', 'BL', 'MF'],\n 591: ['BO'],\n 592: ['GY'],\n 593: ['EC'],\n 594: ['GF'],\n 595: ['PY'],\n 596: ['MQ'],\n 597: ['SR'],\n 598: ['UY'],\n 599: ['CW', 'BQ'],\n 670: ['TL'],\n 672: ['NF'],\n 673: ['BN'],\n 674: ['NR'],\n 675: ['PG'],\n 676: ['TO'],\n 677: ['SB'],\n 678: ['VU'],\n 679: ['FJ'],\n 680: ['PW'],\n 681: ['WF'],\n 682: ['CK'],\n 683: ['NU'],\n 685: ['WS'],\n 686: ['KI'],\n 687: ['NC'],\n 688: ['TV'],\n 689: ['PF'],\n 690: ['TK'],\n 691: ['FM'],\n 692: ['MH'],\n 800: ['001'],\n 808: ['001'],\n 850: ['KP'],\n 852: ['HK'],\n 853: ['MO'],\n 855: ['KH'],\n 856: ['LA'],\n 870: ['001'],\n 878: ['001'],\n 880: ['BD'],\n 881: ['001'],\n 882: ['001'],\n 883: ['001'],\n 886: ['TW'],\n 888: ['001'],\n 960: ['MV'],\n 961: ['LB'],\n 962: ['JO'],\n 963: ['SY'],\n 964: ['IQ'],\n 965: ['KW'],\n 966: ['SA'],\n 967: ['YE'],\n 968: ['OM'],\n 970: ['PS'],\n 971: ['AE'],\n 972: ['IL'],\n 973: ['BH'],\n 974: ['QA'],\n 975: ['BT'],\n 976: ['MN'],\n 977: ['NP'],\n 979: ['001'],\n 992: ['TJ'],\n 993: ['TM'],\n 994: ['AZ'],\n 995: ['GE'],\n 996: ['KG'],\n 998: ['UZ'],\n};\n","import { DIAL_CODE_MAPPER } from './data/dialCodeMapper';\nimport { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\n\n/**\n * Determines the country code based on the provided phone number.\n * This function employs a multi-step approach to identify the country code:\n * - If the phone number starts with '+', it extracts the numeric characters\n * and matches the leading digits with known dial codes mapped to countries.\n * - For matched dial codes, it further filters based on country-specific regex patterns\n * to validate the phone number format for those countries.\n * - If the phone number doesn't start with '+', it directly matches the number\n * against regular expressions associated with various countries to identify the code.\n *\n * @param phoneNumber The input phone number (string or number).\n * @returns The detected country code or an empty string if not found.\n */\nexport const detectCountryCodeFromDialCode = (\n phoneNumber: string | number,\n): string => {\n // If the phone number starts with '+', extract numeric characters\n if (phoneNumber.toString().charAt(0) === '+') {\n const cleanedPhoneNumberWithoutPlusPrefix = phoneNumber\n .toString()\n .replace(/\\D/g, '');\n\n const matchingCountries: string[] = [];\n\n // Iterate through dial codes and check for matches with cleaned phone number\n for (const code in DIAL_CODE_MAPPER) {\n if (cleanedPhoneNumberWithoutPlusPrefix.startsWith(code)) {\n matchingCountries.push(...DIAL_CODE_MAPPER[code]);\n }\n }\n\n // Filter matching countries based on phone number validation regex\n const matchedCountryCode = matchingCountries.find((countryCode: string) => {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex && regex.test(phoneNumber.toString())) return countryCode;\n return undefined;\n });\n\n // Return the first matched country code, if any\n return matchedCountryCode || '';\n } else {\n // If phone number doesn't start with '+', directly match against country regexes\n for (const countryCode in PHONE_REGEX_MAPPER) {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex.test(phoneNumber.toString())) {\n return countryCode;\n }\n }\n }\n\n // Return empty string if no country code is detected\n return '';\n};\n\nexport const cleanPhoneNumber = (phoneNumber: string) => {\n // Regular expression to match all characters except numbers and + sign at the start\n const regex = /[^0-9+]|(?!A)\\+/g;\n // Replace matched characters with an empty string\n const cleanedPhoneNumber = phoneNumber.replace(regex, '');\n return phoneNumber[0] === '+' ? `+${cleanedPhoneNumber}` : cleanedPhoneNumber;\n};\n","import { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Validates whether a given phone number is valid based on the provided country code or auto-detects the country code and checks if the number matches the defined regex pattern for that country.\nconst isValidPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_REGEX_MAPPER,\n): boolean => {\n // Clean the provided phoneNumber by removing non-numeric characters\n const cleanedPhoneNumber = cleanPhoneNumber(phoneNumber.toString());\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_REGEX_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(cleanedPhoneNumber);\n\n // Return false if phoneNumber is empty\n if (!phoneNumber) return false;\n\n // Check if the countryCode exists in the PHONE_REGEX_MAPPER\n if (countryCode in PHONE_REGEX_MAPPER) {\n // Fetch the regex pattern for the countryCode\n const regex = PHONE_REGEX_MAPPER[countryCode];\n // Test if the cleanedPhoneNumber matches the regex pattern\n return regex.test(cleanedPhoneNumber as string);\n }\n\n // Return false if the countryCode is not supported\n return false;\n};\n\nexport default withErrorBoundary(isValidPhoneNumber);\n","export const PHONE_FORMATTER_MAPPER: { [key: string]: string } = {\n IN: 'xxxx xxxxxx',\n MY: 'xx xxxxx xx',\n AE: 'xx xxx xxxx',\n AL: 'xxx xx xxxx',\n AM: 'xx xx xx xx',\n AR: 'xxxx-xxxx',\n AU: 'xxx xxx xxx',\n AW: 'xxx-xxxx',\n BB: 'xxx-xxxx',\n BD: 'xxxx-xxxxxx',\n BM: 'xxx-xxxx',\n BN: 'xxxx-xxxx',\n BO: 'xxxx-xxxx',\n BS: 'xxx-xxxx',\n BW: 'xx xxxx xxxx',\n BZ: 'xxx-xxxx',\n CA: 'xxx-xxx-xxxx',\n CH: 'xxx xxx xxx',\n CN: 'xxxx-xxxxxxx',\n CO: 'xxxx-xxxxxxx',\n CR: 'xxxx-xxxx',\n CU: 'xxxx-xxxx',\n CZ: 'xxx xxx xxx',\n DK: 'xx xx xx xx',\n DO: 'xxx-xxxxxxx',\n DZ: 'xxxx-xxxx-xxx',\n EG: 'xx xxx xxxx',\n ET: 'xx xxx xxxx',\n EU: 'xxx xx xx xx',\n FJ: 'xxxx xxxx',\n GB: 'xxxx xxx xxx',\n GH: 'xxx xxx xxxx',\n GI: 'xxxx xxxx',\n GM: 'xxxx-xxxx',\n GT: 'xxxx-xxxx',\n GY: 'xxx-xxxx',\n HK: 'xxxx xxxx',\n HN: 'xxxx-xxxx',\n HR: 'xxx xxx xxxx',\n HT: 'xxx-xxxx',\n HU: 'xxx xxx xxxx',\n ID: 'xxxx-xxxx-xxxx',\n IL: 'xxxx-xxx-xxx',\n JM: 'xxx-xxxx',\n KE: 'xxx xxxxxx',\n KG: 'xxx-xx-xx-xx',\n KH: 'xxx-xxx-xxx',\n KY: 'xxx-xxxx',\n KZ: 'xxx-xxx-xx-xx',\n LA: 'xxx xx xxxx',\n LK: 'xx xxx xxxx',\n LR: 'xxx-xxx-xxxx',\n LS: 'xxx xx xxxx',\n LT: 'xxx xxxxx',\n LU: 'xxx xx xxx',\n LV: 'xxxx xxxx',\n MA: 'xxxx-xxxxxx',\n MD: 'xx xxxxxx',\n ME: 'xx xxxxxx',\n MG: 'xx xx xx xx xx',\n MK: 'xx xx xx xx',\n MM: 'xx xxxxxx',\n MN: 'xxx-xx-xxxx',\n MO: 'xxxx xxxx',\n MU: 'xx xxxx xxxx',\n MV: 'xxxxxx',\n MW: 'xx xxxx xxxx',\n MX: 'xxx-xxx-xxxx',\n MZ: 'xx xxxxxxx',\n NA: 'xx xxxx xxxx',\n NG: 'xxx xxx xxxx',\n NI: 'xxxx-xxxx',\n NL: 'xxx-xxxxxxx',\n NO: 'xxxx xxxx',\n NP: 'xxxx-xxxxxxx',\n NZ: 'xxx-xxxxxxx',\n OM: 'xxxx-xxxx',\n PA: 'xxx-xxxx',\n PE: 'xxx-xxx-xxx',\n PG: 'xxx-xxxxxx',\n PH: 'xxx-xxxx',\n PK: 'xxx-xxxxxxx',\n PL: 'xxx xxx xxx',\n PR: 'xxx-xxx-xxxx',\n PS: 'xxxx-xxxxxxx',\n PT: 'xxx xxx xxx',\n PY: 'xxx-xxxxxx',\n QA: 'xxxx xxxx',\n RO: 'xxx xxx xxxx',\n RS: 'xxx xxxxx',\n RU: 'xxx xxx-xx-xx',\n RW: 'xxx xxxxxx',\n SA: 'xxx-xxxxxxx',\n SC: 'xx xxxxx',\n SE: 'xxx-xxx xx xx',\n SG: 'xxxx xxxx',\n SI: 'xx xxxxxx',\n SK: 'xxx xxx xxx',\n SL: 'xxx-xxxxxx',\n SM: 'xxxxx xxxxx',\n SN: 'xx xxx xx xx',\n SO: 'xxx xxxxxxx',\n SR: 'xxx-xxxx',\n SS: 'xxx xxxx xxx',\n SV: 'xxxx-xxxx',\n SZ: 'xxx xx xxxx',\n TG: 'xx xx xx xx',\n TH: 'xxx-xxxxxxx',\n TJ: 'xxx xx xx xx',\n TL: 'xxx-xxxxxxx',\n TN: 'xx xxxxxx',\n TR: 'xxx xxx xx xx',\n TT: 'xxx-xxxx',\n TW: 'xxxx-xxxxxx',\n TZ: 'xxx xxx xxxx',\n UA: 'xx xxx xx xx',\n UG: 'xxx xxxxxxx',\n US: 'xxx-xxx-xxxx',\n UY: 'xxx-xxxxx',\n UZ: 'xxx-xxx-xx-xx',\n VC: 'xxx-xxxx',\n VE: 'xxxx-xxx-xxxx',\n VN: 'xxxx-xxxxxxx',\n YE: 'xxxx-xxxx',\n ZA: 'xxx-xxx-xxxx',\n ZM: 'xxx-xxxxxxx',\n ZW: 'xx xxx xxxx',\n KW: 'xxx xx xxxx',\n BH: 'xxxx xxxx',\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Formats a provided phone number according to the predefined format for a specific country code, or auto-detects the country code and formats the number accordingly.\nconst formatPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_FORMATTER_MAPPER,\n): string => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Convert phoneNumber to string and clean it by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_FORMATTER_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Fetch the pattern for the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern) return phoneNumber;\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n // Extract the phoneNumber without the prefix\n const phoneNumberWithoutPrefix = phoneNumber.slice(diff);\n const formattedNumber: string[] = [];\n let numberIndex = 0;\n\n // Loop through the pattern to format the phoneNumber\n for (let i = 0; i < pattern.length; i++) {\n const patternChar = pattern[i];\n if (patternChar === 'x') {\n // Insert phoneNumber digits at 'x' positions\n if (numberIndex < phoneNumberWithoutPrefix.length) {\n formattedNumber.push(phoneNumberWithoutPrefix[numberIndex]);\n numberIndex++;\n }\n } else {\n // Insert non-digit characters from the pattern\n formattedNumber.push(patternChar);\n }\n }\n\n // Join the formattedNumber array to create the formattedPhoneNumber without prefix\n const formattedPhoneNumberWithoutPrefix = formattedNumber.join('');\n // Combine the prefix and formattedPhoneNumberWithoutPrefix\n const formattedPhoneNumberWithPrefix =\n phoneNumber.slice(0, diff) + ' ' + formattedPhoneNumberWithoutPrefix;\n\n // Return the formattedPhoneNumber with prefix after trimming whitespace\n return formattedPhoneNumberWithPrefix.trim();\n};\n\nexport default withErrorBoundary(formatPhoneNumber);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport formatPhoneNumber from './formatPhoneNumber';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\ninterface PhoneInfo {\n countryCode: string;\n dialCode: string;\n formattedPhoneNumber: string;\n formatTemplate: string;\n}\n\n// Parses a given phone number, identifies its country code (if not provided), and returns an object with details including the country code, formatted phone number, dial code, and format template.\nconst parsePhoneNumber = (phoneNumber: string, country?: string): PhoneInfo => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Clean the phoneNumber by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n const countryCode =\n country && country in PHONE_FORMATTER_MAPPER\n ? country\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Format the phone number using the detected/validated country code\n const formattedPhoneNumber = formatPhoneNumber(phoneNumber, countryCode);\n\n // Fetch the pattern associated with the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern)\n return {\n countryCode: countryCode || '',\n dialCode: '',\n formattedPhoneNumber: phoneNumber,\n formatTemplate: '',\n };\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n\n // Extract the dialCode from the phoneNumber\n const dialCode = phoneNumber.slice(0, diff);\n\n // Obtain the format template associated with the countryCode\n const formatTemplate = PHONE_FORMATTER_MAPPER[countryCode];\n\n // Return the parsed phone number information\n return {\n countryCode,\n formattedPhoneNumber,\n dialCode,\n formatTemplate,\n };\n};\n\nexport default withErrorBoundary(parsePhoneNumber);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Adds a specified amount of time to a date.\n *\n * @param date The original date.\n * @param value The amount to add.\n * @param unit The unit of time to add (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time added.\n */\nconst add = (\n date: Date,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n const result = new Date(date);\n switch (unit) {\n case 'days':\n result.setDate(result.getDate() + value);\n break;\n case 'months':\n result.setMonth(result.getMonth() + value);\n break;\n case 'years':\n result.setFullYear(result.getFullYear() + value);\n break;\n }\n return result;\n};\n\nexport default withErrorBoundary(add);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale, DateTimeFormatOptions } from './types';\n\n/**\n * Formats date and time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional).\n * @returns {string} Formatted date and time string.\n */\nconst formatDateTime = (\n date: DateInput,\n locale: Locale,\n options: DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const dateObj: Date = date instanceof Date ? date : new Date(date);\n let formatter;\n\n try {\n formatter = new Intl.DateTimeFormat(locale, options);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formatter.format(dateObj);\n};\n\nexport default withErrorBoundary(formatDateTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n DateFormatOptions,\n} from './types';\n\n/**\n * Formats date based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional).\n * @returns {string} Formatted date string.\n */\nconst formatDate = (\n date: DateInput,\n locale: Locale,\n options: DateFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n timeStyle: undefined,\n };\n\n let formattedDate;\n\n try {\n formattedDate = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedDate;\n};\n\nexport default withErrorBoundary(formatDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n TimeFormatOptions,\n} from './types';\n\n/**\n * Formats time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional).\n * @returns {string} Formatted time string.\n */\nconst formatTime = (\n date: DateInput,\n locale: Locale,\n options: TimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n dateStyle: undefined,\n };\n\n let formattedTime;\n\n try {\n formattedTime = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedTime;\n};\n\nexport default withErrorBoundary(formatTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\n\n/**\n * Gets the first day of the week for a given locale.\n *\n * @param locale The locale to determine the first day of the week for.\n * @returns The first day of the week (0-6, where 0 is Sunday).\n */\nconst getFirstDayOfWeek = (locale: string): number => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n let formatted;\n\n try {\n const formatter = new Intl.DateTimeFormat(locale, { weekday: 'short' });\n const sampleDate = new Date(2000, 0, 2); // A Sunday\n formatted = formatter.format(sampleDate);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return ['su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'].indexOf(\n formatted.slice(0, 2).toLowerCase(),\n );\n};\n\nexport default withErrorBoundary(getFirstDayOfWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Determines the quarter of the year for a given date.\n *\n * @param date The date to determine the quarter for.\n * @returns The quarter of the year (1-4).\n */\nconst getQuarter = (date: Date): number => {\n return Math.ceil((date.getMonth() + 1) / 3);\n};\n\nexport default withErrorBoundary(getQuarter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Provides a relative time string (e.g., '3 hours ago', 'in 2 days').\n * This function calculates the difference between the given date and the base date,\n * then formats it in a locale-sensitive manner. It allows customization of the output\n * through Intl.RelativeTimeFormat options.\n *\n * @param date - The date to compare.\n * @param baseDate - The date to compare against (default: current date).\n * @param locale - The locale to use for formatting.\n * @param options - Options for the Intl.RelativeTimeFormat (optional).\n * @returns The relative time as a string.\n */\nconst getRelativeTime = (\n date: Date,\n baseDate: Date = new Date(),\n locale: Locale,\n options?: Intl.RelativeTimeFormatOptions,\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000;\n\n // Define time units in seconds\n const minute = 60;\n const hour = minute * 60;\n const day = hour * 24;\n const week = day * 7;\n const month = day * 30;\n const year = day * 365;\n\n let value: number;\n let unit: Intl.RelativeTimeFormatUnit;\n\n if (Math.abs(diffInSeconds) < minute) {\n value = diffInSeconds;\n unit = 'second';\n } else if (Math.abs(diffInSeconds) < hour) {\n value = diffInSeconds / minute;\n unit = 'minute';\n } else if (Math.abs(diffInSeconds) < day) {\n value = diffInSeconds / hour;\n unit = 'hour';\n } else if (Math.abs(diffInSeconds) < week) {\n value = diffInSeconds / day;\n unit = 'day';\n } else if (Math.abs(diffInSeconds) < month) {\n value = diffInSeconds / week;\n unit = 'week';\n } else if (Math.abs(diffInSeconds) < year) {\n value = diffInSeconds / month;\n unit = 'month';\n } else {\n value = diffInSeconds / year;\n unit = 'year';\n }\n\n let relativeTime;\n\n try {\n const rtf = new Intl.RelativeTimeFormat(locale, options);\n relativeTime = rtf.format(Math.round(value), unit);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return relativeTime;\n};\n\nexport default withErrorBoundary(getRelativeTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Calculates the week number of the year for a given date.\n *\n * @param date The date to calculate the week number for.\n * @returns The week number of the year.\n */\nconst getWeek = (date: Date): number => {\n const firstDayOfYear = new Date(date.getFullYear(), 0, 1);\n const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000;\n return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7);\n};\n\nexport default withErrorBoundary(getWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Returns an array of weekdays according to the specified locale.\n *\n * @param locale The locale to get weekdays for.\n * @returns An array of weekday names.\n */\nconst getWeekdays = (locale: Locale): string[] => {\n try {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n const formatter = new Intl.DateTimeFormat(locale, { weekday: 'long' });\n return Array.from({ length: 7 }, (_, i) =>\n formatter.format(new Date(1970, 0, 4 + i)),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(getWeekdays);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\n\n/**\n * Compares two dates to determine if the first is after the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is after date2.\n */\nconst isAfter = (date1: DateInput, date2: DateInput): boolean => {\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 > dateObj2;\n};\n\nexport default withErrorBoundary(isAfter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\n\n/**\n * Compares two dates to determine if the first is before the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is before date2.\n */\nconst isBefore = (date1: DateInput, date2: DateInput): boolean => {\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 < dateObj2;\n};\n\nexport default withErrorBoundary(isBefore);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given year is a leap year.\n *\n * @param year The year to check.\n * @returns True if the year is a leap year, false otherwise.\n */\nconst isLeapYear = (year: number): boolean => {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n};\n\nexport default withErrorBoundary(isLeapYear);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if two dates fall on the same day.\n *\n * @param date1 The first date.\n * @param date2 The second date.\n * @returns True if both dates are on the same day, false otherwise.\n */\nconst isSameDay = (date1: Date, date2: Date): boolean => {\n return (\n date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear()\n );\n};\n\nexport default withErrorBoundary(isSameDay);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given object is a valid Date object.\n *\n * @param date The object to check.\n * @returns True if the object is a valid Date, false otherwise.\n */\nconst isValidDate = (date: any): boolean => {\n return date instanceof Date && !isNaN(date.getTime());\n};\n\nexport default withErrorBoundary(isValidDate);\n","export const LOCALE_DATE_FORMATS: { [key: string]: string } = {\n 'ar-AE': 'DD/MM/YYYY', // Arabic (U.A.E.)\n 'sq-AL': 'DD.MM.YYYY', // Albanian (Albania)\n 'hy-AM': 'DD.MM.YYYY', // Armenian (Armenia)\n 'es-AR': 'DD/MM/YYYY', // Spanish (Argentina)\n 'en-AU': 'DD/MM/YYYY', // English (Australia)\n 'nl-AW': 'DD-MM-YYYY', // Dutch (Aruba)\n 'en-BB': 'MM/DD/YYYY', // English (Barbados)\n 'bn-BD': 'DD/MM/YYYY', // Bengali (Bangladesh)\n 'en-BM': 'MM/DD/YYYY', // English (Bermuda)\n 'ms-BN': 'DD/MM/YYYY', // Malay (Brunei)\n 'es-BO': 'DD/MM/YYYY', // Spanish (Bolivia)\n 'en-BS': 'MM/DD/YYYY', // English (Bahamas)\n 'en-BW': 'DD/MM/YYYY', // English (Botswana)\n 'en-BZ': 'MM/DD/YYYY', // English (Belize)\n 'en-CA': 'DD/MM/YYYY', // English (Canada)\n 'de-CH': 'DD.MM.YYYY', // German (Switzerland)\n 'zh-CN': 'YYYY/MM/DD', // Chinese (China)\n 'es-CO': 'DD/MM/YYYY', // Spanish (Colombia)\n 'es-CR': 'DD/MM/YYYY', // Spanish (Costa Rica)\n 'es-CU': 'DD/MM/YYYY', // Spanish (Cuba)\n 'cs-CZ': 'DD.MM.YYYY', // Czech (Czech Republic)\n 'da-DK': 'DD-MM-YYYY', // Danish (Denmark)\n 'es-DO': 'DD/MM/YYYY', // Spanish (Dominican Republic)\n 'ar-DZ': 'DD/MM/YYYY', // Arabic (Algeria)\n 'ar-EG': 'DD/MM/YYYY', // Arabic (Egypt)\n 'am-ET': 'DD/MM/YYYY', // Amharic (Ethiopia)\n 'en-EU': 'DD/MM/YYYY', // English (European Union)\n 'en-FJ': 'DD/MM/YYYY', // English (Fiji)\n 'en-GB': 'DD/MM/YYYY', // English (United Kingdom)\n 'en-GH': 'DD/MM/YYYY', // English (Ghana)\n 'en-GI': 'DD/MM/YYYY', // English (Gibraltar)\n 'en-GM': 'DD/MM/YYYY', // English (Gambia)\n 'es-GT': 'DD/MM/YYYY', // Spanish (Guatemala)\n 'en-GY': 'DD/MM/YYYY', // English (Guyana)\n 'en-HK': 'DD/MM/YYYY', // English (Hong Kong)\n 'es-HN': 'DD/MM/YYYY', // Spanish (Honduras)\n 'hr-HR': 'DD.MM.YYYY', // Croatian (Croatia)\n 'ht-HT': 'MM/DD/YYYY', // Haitian (Haiti)\n 'hu-HU': 'YYYY. MM. DD.', // Hungarian (Hungary)\n 'id-ID': 'DD/MM/YYYY', // Indonesian (Indonesia)\n 'he-IL': 'DD/MM/YYYY', // Hebrew (Israel)\n 'en-IN': 'DD-MM-YYYY', // English (India)\n 'en-JM': 'MM/DD/YYYY', // English (Jamaica)\n 'en-KE': 'DD/MM/YYYY', // English (Kenya)\n 'ky-KG': 'DD.MM.YYYY', // Kyrgyz (Kyrgyzstan)\n 'km-KH': 'DD/MM/YYYY', // Khmer (Cambodia)\n 'en-KY': 'MM/DD/YYYY', // English (Cayman Islands)\n 'kk-KZ': 'DD.MM.YYYY', // Kazakh (Kazakhstan)\n 'lo-LA': 'DD/MM/YYYY', // Lao (Laos)\n 'si-LK': 'YYYY-MM-DD', // Sinhala (Sri Lanka)\n 'en-LR': 'MM/DD/YYYY', // English (Liberia)\n 'en-LS': 'DD/MM/YYYY', // English (Lesotho)\n 'ar-MA': 'DD/MM/YYYY', // Arabic (Morocco)\n 'ro-MD': 'DD.MM.YYYY', // Romanian (Moldova)\n 'mk-MK': 'DD.MM.YYYY', // Macedonian (North Macedonia)\n 'my-MM': 'DD/MM/YYYY', // Burmese (Myanmar)\n 'mn-MN': 'YYYY.MM.DD', // Mongolian (Mongolia)\n 'zh-MO': 'DD/MM/YYYY', // Chinese (Macao)\n 'en-MU': 'DD/MM/YYYY', // English (Mauritius)\n 'dv-MV': 'DD/MM/YYYY', // Divehi (Maldives)\n 'en-MW': 'DD/MM/YYYY', // English (Malawi)\n 'es-MX': 'DD/MM/YYYY', // Spanish (Mexico)\n 'ms-MY': 'DD/MM/YYYY', // Malay (Malaysia)\n 'en-NA': 'DD/MM/YYYY', // English (Namibia)\n 'en-NG': 'DD/MM/YYYY', // English (Nigeria)\n 'es-NI': 'DD/MM/YYYY', // Spanish (Nicaragua)\n 'no-NO': 'DD.MM.YYYY', // Norwegian (Norway)\n 'ne-NP': 'YYYY/MM/DD', // Nepali (Nepal)\n 'en-NZ': 'DD/MM/YYYY', // English (New Zealand)\n 'es-PE': 'DD/MM/YYYY', // Spanish (Peru)\n 'en-PG': 'DD/MM/YYYY', // English (Papua New Guinea)\n 'en-PH': 'MM/DD/YYYY', // English (Philippines)\n 'en-PK': 'DD/MM/YYYY', // English (Pakistan)\n 'ar-QA': 'DD/MM/YYYY', // Arabic (Qatar)\n 'ru-RU': 'DD.MM.YYYY', // Russian (Russia)\n 'ar-SA': 'DD/MM/YYYY', // Arabic (Saudi Arabia)\n 'en-SC': 'DD/MM/YYYY', // English (Seychelles)\n 'sv-SE': 'YYYY-MM-DD', // Swedish (Sweden)\n 'en-SG': 'DD/MM/YYYY', // English (Singapore)\n 'en-SL': 'DD/MM/YYYY', // English (Sierra Leone)\n 'so-SO': 'DD/MM/YYYY', // Somali (Somalia)\n 'en-SS': 'DD/MM/YYYY', // English (South Sudan)\n 'es-SV': 'DD/MM/YYYY', // Spanish (El Salvador)\n 'en-SZ': 'DD/MM/YYYY', // English (Eswatini)\n 'th-TH': 'DD/MM/YYYY', // Thai (Thailand)\n 'en-TT': 'MM/DD/YYYY', // English (Trinidad and Tobago)\n 'sw-TZ': 'DD/MM/YYYY', // Swahili (Tanzania)\n 'en-US': 'MM/DD/YYYY', // English (United States)\n 'es-UY': 'DD/MM/YYYY', // Spanish (Uruguay)\n 'uz-UZ': 'DD/MM/YYYY', // Uzbek (Uzbekistan)\n 'ar-YE': 'DD/MM/YYYY', // Arabic (Yemen)\n 'en-ZA': 'YYYY/MM/DD', // English (South Africa)\n 'ar-KW': 'DD/MM/YYYY', // Arabic (Kuwait)\n 'ar-BH': 'DD/MM/YYYY', // Arabic (Bahrain)\n 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman)\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Parses a date string based on a specific format.\n *\n * @param dateString The date string to parse.\n * @param format The format to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDateWithFormat = (\n dateString: string,\n format: string,\n): Date | null => {\n // Determine the separator based on the format (supports '/', '.', or '-')\n const separator = format.includes('/')\n ? '/'\n : format.includes('.')\n ? '.'\n : '-';\n const formatParts = format.split(separator);\n const dateParts = dateString.split(separator).map((num) => parseInt(num, 10));\n\n let year: number = 0,\n month: number = 0,\n day: number = 0;\n let yearSet: boolean = false,\n monthSet: boolean = false,\n daySet: boolean = false;\n\n // Check for format and date string mismatch\n if (dateParts.length !== formatParts.length) {\n return null; // Mismatch between date string and format\n }\n\n formatParts.forEach((part, index) => {\n // Check for non-numeric values in date string\n if (isNaN(dateParts[index])) {\n return null; // Invalid date part\n }\n\n // Assign year, month, and day based on the format\n switch (part) {\n case 'DD':\n day = dateParts[index];\n daySet = true;\n break;\n case 'MM':\n month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date\n monthSet = true;\n break;\n case 'YYYY':\n year = dateParts[index];\n yearSet = true;\n break;\n }\n });\n\n // Validate and create the date only if all parts are set\n if (yearSet && monthSet && daySet) {\n const parsedDate = new Date(year, month, day);\n // Validate date to catch invalid dates like February 30th\n if (\n parsedDate.getFullYear() === year &&\n parsedDate.getMonth() === month &&\n parsedDate.getDate() === day\n ) {\n return parsedDate;\n }\n }\n return null; // Invalid date or incomplete date information\n};\n\nexport default withErrorBoundary(\n parseDateWithFormat,\n);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { LOCALE_DATE_FORMATS } from './data/localeDateFormats';\nimport parseDateWithFormat from './parseDateWithFormat';\nimport { Locale } from './types';\n\n/**\n * Attempts to parse a string into a date object based on locale.\n * Uses the localeDateFormats mapping for determining the date format.\n *\n * @param dateString - The date string to parse.\n * @param locale - The locale to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDate = (dateString: string, locale: Locale): Date | null => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const format = LOCALE_DATE_FORMATS[locale];\n if (!format) {\n throw new Error(`No date format found for locale: ${locale}`);\n }\n return parseDateWithFormat(dateString, format);\n};\n\nexport default withErrorBoundary(parseDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport add from './add';\n\n/**\n * Subtracts a specified amount of time from a date.\n *\n * @param date The original date.\n * @param value The amount to subtract.\n * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time subtracted.\n */\nconst subtract = (\n date: Date,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n return add(date, -value, unit); // Reuse the add function with negative value\n};\n\nexport default withErrorBoundary(subtract);\n"],"names":["I18nifyError","Error","constructor","message","super","this","name","timestamp","Date","withErrorBoundary","fn","rest","call","err","console","warn","I18nStateManager","state","locale","direction","country","getInstance","instance","resetInstance","undefined","getState","Object","assign","setState","newState","resetState","getState$1","setState$1","resetState$1","getLocale","navigator","window","Intl","languages","language","getIntlInstanceWithOptions","options","intlOptions","currency","style","NumberFormat","formatNumber$1","amount","Number","formattedAmount","format","CURRENCIES","AED","symbol","ALL","AMD","ARS","AUD","AWG","BBD","BDT","BMD","BND","BOB","BSD","BWP","BZD","CAD","CHF","CNY","COP","CRC","CUP","CZK","DKK","DOP","DZD","EGP","ETB","EUR","FJD","GBP","GHS","GIP","GMD","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","JMD","KES","KGS","KHR","KYD","KZT","LAK","LKR","LRD","LSL","MAD","MDL","MKD","MMK","MNT","MOP","MUR","MVR","MWK","MXN","MYR","NAD","NGN","NIO","NOK","NPR","NZD","PEN","PGK","PHP","PKR","QAR","RUB","SAR","SCR","SEK","SGD","SLL","SOS","SSP","SVC","SZL","THB","TTD","TZS","USD","UYU","UZS","YER","ZAR","KWD","BHD","OMR","getCurrencyList$1","getCurrencySymbol$1","currencyCode","_a","ALLOWED_FORMAT_PARTS_KEYS","formatNumberByParts$1","parts","formatToParts","formattedObj","forEach","p","type","integer","value","findIndex","item","isPrefixSymbol","rawParts","PHONE_REGEX_MAPPER","IN","MY","AE","AL","AM","AR","AU","AW","BB","BD","BM","BN","BO","BS","BW","BZ","CH","CN","CO","OM","CR","CU","CZ","DK","DO","DZ","EG","ET","EU","FJ","GB","GH","GI","GM","GT","GY","HK","HN","HR","HT","HU","ID","IL","JM","KE","KG","KH","KY","KZ","LA","LK","LR","LS","MA","MD","MK","MM","MN","MO","MU","MV","MW","MX","NA","NG","NI","NO","NP","NZ","PE","PG","PH","PK","QA","RU","SA","SC","SE","SG","SL","SO","SS","SV","SZ","TH","TT","TZ","US","CA","UY","UZ","YE","ZA","KW","BH","TL","VC","VE","VN","ZM","ZW","LT","LU","LV","ME","MG","MZ","NL","PA","PL","PR","PS","PT","PY","RO","RS","RW","SI","SK","SM","SN","SR","TG","TJ","TN","TR","TW","UA","UG","DIAL_CODE_MAPPER","detectCountryCodeFromDialCode","phoneNumber","toString","charAt","cleanedPhoneNumberWithoutPlusPrefix","replace","matchingCountries","code","startsWith","push","find","countryCode","regex","test","cleanPhoneNumber","cleanedPhoneNumber","isValidPhoneNumber$1","PHONE_FORMATTER_MAPPER","formatPhoneNumber$1","pattern","charCountInFormatterPattern","i","length","diff","phoneNumberWithoutPrefix","slice","formattedNumber","numberIndex","patternChar","formattedPhoneNumberWithoutPrefix","join","trim","parsePhoneNumber$1","formattedPhoneNumber","formatPhoneNumber","dialCode","formatTemplate","add$1","date","unit","result","setDate","getDate","setMonth","getMonth","setFullYear","getFullYear","formatDateTime$1","dateObj","formatter","DateTimeFormat","formatDate$1","fullOptions","timeStyle","formattedDate","formatDateTime","formatTime$1","dateStyle","formattedTime","getFirstDayOfWeek$1","formatted","weekday","sampleDate","indexOf","toLowerCase","getQuarter$1","Math","ceil","getRelativeTime$1","baseDate","diffInSeconds","getTime","hour","minute","day","week","month","year","relativeTime","abs","RelativeTimeFormat","round","getWeek$1","firstDayOfYear","pastDaysOfYear","getDay","getWeekdays$1","Array","from","_","isAfter$1","date1","date2","isBefore$1","isLeapYear$1","isSameDay$1","isValidDate$1","isNaN","LOCALE_DATE_FORMATS","parseDateWithFormat$1","dateString","separator","includes","formatParts","split","dateParts","map","num","parseInt","yearSet","monthSet","daySet","part","index","parsedDate","parseDate$1","parseDateWithFormat","subtract$1","add"],"mappings":"+OACM,MAAOA,UAAqBC,MAEhC,WAAAC,CAAYC,GACVC,MAAMD,GACNE,KAAKC,KAAO,gBACZD,KAAKE,UAAY,IAAIC,IAEtB,EAYI,MAAMC,EACXC,GAEO,YAA4BC,GACjC,IACE,OAAOD,EAAGE,KAAKP,QAASM,EACzB,CAAC,MAAOE,GAIP,MAHAC,QAAQC,KAAK,iBAAkBF,GAGzB,IAAIb,EAAaa,EACxB,CACH,QC7BWG,EAIX,WAAAd,GACEG,KAAKY,MCLA,CACLC,OAAQ,GACRC,UAAW,GACXC,QAAS,GDGV,CAEM,kBAAOC,GAKZ,OAJKL,EAAiBM,WACpBN,EAAiBM,SAAW,IAAIN,GAG3BA,EAAiBM,QACzB,CAEM,oBAAOC,GACZP,EAAiBM,cAAWE,CAC7B,CAEM,QAAAC,GACL,OAAYC,OAAAC,OAAA,CAAA,EAAAtB,KAAKY,MAClB,CAEM,QAAAW,CAASC,GACdxB,KAAKY,MAAaS,OAAAC,OAAAD,OAAAC,OAAA,CAAA,EAAAtB,KAAKY,OAAUY,EAClC,CAEM,UAAAC,GACLzB,KAAKY,MC7BA,CACLC,OAAQ,GACRC,UAAW,GACXC,QAAS,GD2BV,EAGY,IAAAH,EAAAD,EAAiBK,cElBjB,IAAAU,EAAAtB,GAJE,IACRQ,EAAMQ,aCEA,IAAAO,EAAAvB,GAJGoB,IAChBZ,EAAMW,SAASC,EAAS,ICEX,IAAAI,EAAAxB,GAJI,KACjBQ,EAAMa,YAAY,ICbb,MAAMI,EAAY,KAEvB,GAAyB,oBAAdC,UACT,MAAO,QAIT,GACEC,OAAOC,MACgB,iBAAhBD,OAAOC,OACbD,OAAOD,U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mC,GAAmB,EACrBC,GAAoB,EACpBC,GAAkB,EAGpB,GAAIN,EAAUnF,SAAWiF,EAAYjF,OACnC,OAAO,KA2BT,GAxBAiF,EAAYnP,SAAQ,CAAC4P,EAAMC,KAEzB,GAAIhB,MAAMQ,EAAUQ,IAClB,OAAO,KAIT,OAAQD,GACN,IAAK,KACHtC,EAAM+B,EAAUQ,GAChBF,GAAS,EACT,MACF,IAAK,KACHnC,EAAQ6B,EAAUQ,GAAS,EAC3BH,GAAW,EACX,MACF,IAAK,OACHjC,EAAO4B,EAAUQ,GACjBJ,GAAU,EAEb,IAICA,GAAWC,GAAYC,EAAQ,CACjC,MAAMG,EAAa,IAAInZ,KAAK8W,EAAMD,EAAOF,GAEzC,GACEwC,EAAWpE,gBAAkB+B,GAC7BqC,EAAWtE,aAAegC,GAC1BsC,EAAWxE,YAAcgC,EAEzB,OAAOwC,CAEV,CACD,OAAO,IAAI,ICvCE,IAAAC,EAAAnZ,GAfG,CAACoY,EAAoB3X,KAMhCA,IAAQA,EAASD,EAAMQ,WAAWP,QAAUgB,KAEjD,MAAMgB,EAASyV,EAAoBzX,GACnC,IAAKgC,EACH,MAAM,IAAIjD,MAAM,oCAAoCiB,KAEtD,OAAO2Y,EAAoBhB,EAAY3V,EAAO,ICRjC,IAAA4W,EAAArZ,GARE,CACfsU,EACA9K,EACA+K,IAEO+E,EAAIhF,GAAO9K,EAAO+K"} \ No newline at end of file From 2559974a4c1a566649b057702798fdf9d19c9cd8 Mon Sep 17 00:00:00 2001 From: RgnDunes Date: Thu, 18 Jan 2024 16:21:33 +0530 Subject: [PATCH 14/28] update build --- .gitignore | 2 +- lib/cjs/index.js | 212 ++++++++++++++++++++-- lib/esm/dateTime/index.d.ts | 20 +- lib/esm/dateTime/index.js | 212 ++++++++++++++++++++-- lib/esm/dateTime/index.js.map | 2 +- lib/esm/index.js | 212 ++++++++++++++++++++-- lib/esm/index.js.map | 2 +- lib/esm/index.min.js | 2 +- lib/esm/index.min.js.map | 2 +- lib/types/index.d.ts | 20 +- lib/umd/index.js | 212 ++++++++++++++++++++-- lib/umd/index.js.map | 2 +- lib/umd/index.min.js | 2 +- lib/umd/index.min.js.map | 2 +- src/modules/dateTime/add.ts | 16 +- src/modules/dateTime/formatDateTime.ts | 10 +- src/modules/dateTime/getFirstDayOfWeek.ts | 33 +++- src/modules/dateTime/getQuarter.ts | 6 +- src/modules/dateTime/getRelativeTime.ts | 14 +- src/modules/dateTime/getWeek.ts | 6 +- src/modules/dateTime/getWeekdays.ts | 17 +- src/modules/dateTime/isAfter.ts | 6 + src/modules/dateTime/isBefore.ts | 6 + src/modules/dateTime/isSameDay.ts | 6 + src/modules/dateTime/isValidDate.ts | 12 ++ src/modules/dateTime/subtract.ts | 7 +- src/modules/dateTime/utils.ts | 125 +++++++++++++ 27 files changed, 1059 insertions(+), 109 deletions(-) create mode 100644 src/modules/dateTime/utils.ts diff --git a/.gitignore b/.gitignore index e7b05377..5fa318a0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ node_modules -# lib +lib .DS_Store coverage /test-results/ diff --git a/lib/cjs/index.js b/lib/cjs/index.js index 61a6ef8d..0676c76c 100644 --- a/lib/cjs/index.js +++ b/lib/cjs/index.js @@ -1019,6 +1019,128 @@ const parsePhoneNumber = (phoneNumber, country) => { }; var parsePhoneNumber$1 = withErrorBoundary(parsePhoneNumber); +const stringToDate = (dateString) => { + const supportedDateFormats = [ + // Date formats + { + regex: /^(\d{4})\/(\d{2})\/(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, + { + regex: /^(\d{2})\/(\d{2})\/(\d{4})$/, + yearIndex: 3, + monthIndex: 2, + dayIndex: 1, + }, + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, + // Timestamp formats + { + regex: /^(\d{4})\/(\d{2})\/(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, + { + regex: /^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 3, + monthIndex: 2, + dayIndex: 1, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, + { + regex: /^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, + { + regex: /^(\d{2})-(\d{2})-(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 3, + monthIndex: 2, + dayIndex: 1, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, + { + regex: /^(\d{4})\.(\d{2})\.(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, + { + regex: /^(\d{2})\.(\d{2})\.(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 3, + monthIndex: 2, + dayIndex: 1, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, // DD.MM.YYYY HH:MM:SS + ]; + for (const format of supportedDateFormats) { + const match = dateString.match(format.regex); + if (match) { + const year = match[format.yearIndex]; + const month = match[format.monthIndex]; + const day = match[format.dayIndex]; + const hour = format.hourIndex ? match[format.hourIndex] : '00'; + const minute = format.minuteIndex ? match[format.minuteIndex] : '00'; + const second = format.secondIndex ? match[format.secondIndex] : '00'; + return new Date(`${year}-${month}-${day}T${hour}:${minute}:${second}`); + } + } + throw new Error('Date format not recognized'); +}; + /** * Adds a specified amount of time to a date. * @@ -1028,19 +1150,20 @@ var parsePhoneNumber$1 = withErrorBoundary(parsePhoneNumber); * @returns A new Date object with the time added. */ const add = (date, value, unit) => { - const result = new Date(date); + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); switch (unit) { case 'days': - result.setDate(result.getDate() + value); + date.setDate(date.getDate() + value); break; case 'months': - result.setMonth(result.getMonth() + value); + date.setMonth(date.getMonth() + value); break; case 'years': - result.setFullYear(result.getFullYear() + value); + date.setFullYear(date.getFullYear() + value); break; } - return result; + return date; }; var add$1 = withErrorBoundary(add); @@ -1051,7 +1174,7 @@ var add$1 = withErrorBoundary(add); * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional). * @returns {string} Formatted date and time string. */ -const formatDateTime = (date, locale, options = {}) => { +const formatDateTime = (date, locale, intlOptions = {}) => { /** retrieve locale from below areas in order of preference * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) * 2. i18nState.locale (uses locale set globally) @@ -1059,10 +1182,12 @@ const formatDateTime = (date, locale, options = {}) => { * */ if (!locale) locale = state.getState().locale || getLocale(); + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); const dateObj = date instanceof Date ? date : new Date(date); let formatter; try { - formatter = new Intl.DateTimeFormat(locale, options); + formatter = new Intl.DateTimeFormat(locale, intlOptions); } catch (err) { if (err instanceof Error) { @@ -1144,9 +1269,10 @@ var formatTime$1 = withErrorBoundary(formatTime); * Gets the first day of the week for a given locale. * * @param locale The locale to determine the first day of the week for. + * @param intlOptions Optional Intl.DateTimeFormatOptions for customization. * @returns The first day of the week (0-6, where 0 is Sunday). */ -const getFirstDayOfWeek = (locale) => { +const getFirstDayOfWeek = (locale, intlOptions = {}) => { /** retrieve locale from below areas in order of preference * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) * 2. i18nState.locale (uses locale set globally) @@ -1155,10 +1281,17 @@ const getFirstDayOfWeek = (locale) => { if (!locale) locale = state.getState().locale || getLocale(); let formatted; + if (!intlOptions.weekday) + intlOptions.weekday = 'long'; try { - const formatter = new Intl.DateTimeFormat(locale, { weekday: 'short' }); - const sampleDate = new Date(2000, 0, 2); // A Sunday - formatted = formatter.format(sampleDate); + const formatter = new Intl.DateTimeFormat(locale, intlOptions); + /** + * This date was chosen because January 2, 2000, is a Sunday. + * In the Gregorian calendar, Sunday is considered the start of the week in some cultures (like in the United States), while in others, it's Monday (like in much of Europe). + * By using a date that is known to be a Sunday, the function can accurately determine what day of the week is considered the start in the specified locale. + */ + const sundayDate = new Date(2000, 0, 2); // A known Sunday + formatted = formatter.format(sundayDate); } catch (err) { if (err instanceof Error) { @@ -1168,7 +1301,13 @@ const getFirstDayOfWeek = (locale) => { throw new Error(`An unknown error occurred = ${err}`); } } - return ['su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'].indexOf(formatted.slice(0, 2).toLowerCase()); + // Generate localized weekdays array starting from Sunday + const weekdays = Array.from({ length: 7 }, (_, i) => new Intl.DateTimeFormat(locale, intlOptions).format(new Date(2000, 0, 2 + i))); + const firstDayIndex = weekdays.indexOf(formatted); + if (firstDayIndex === -1) { + throw new Error('Unable to determine the first day of the week'); + } + return weekdays[(firstDayIndex + 1) % 7]; // Adjusting since our reference date is a Sunday }; var getFirstDayOfWeek$1 = withErrorBoundary(getFirstDayOfWeek); @@ -1179,6 +1318,8 @@ var getFirstDayOfWeek$1 = withErrorBoundary(getFirstDayOfWeek); * @returns The quarter of the year (1-4). */ const getQuarter = (date) => { + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); return Math.ceil((date.getMonth() + 1) / 3); }; var getQuarter$1 = withErrorBoundary(getQuarter); @@ -1196,6 +1337,12 @@ var getQuarter$1 = withErrorBoundary(getQuarter); * @returns The relative time as a string. */ const getRelativeTime = (date, baseDate = new Date(), locale, options) => { + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); + baseDate = + typeof baseDate === 'string' + ? new Date(stringToDate(baseDate)) + : new Date(baseDate); /** retrieve locale from below areas in order of preference * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) * 2. i18nState.locale (uses locale set globally) @@ -1265,6 +1412,8 @@ var getRelativeTime$1 = withErrorBoundary(getRelativeTime); * @returns The week number of the year. */ const getWeek = (date) => { + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); const firstDayOfYear = new Date(date.getFullYear(), 0, 1); const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000; return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7); @@ -1275,9 +1424,10 @@ var getWeek$1 = withErrorBoundary(getWeek); * Returns an array of weekdays according to the specified locale. * * @param locale The locale to get weekdays for. + * @param intlOptions Optional Intl.DateTimeFormatOptions for customization. * @returns An array of weekday names. */ -const getWeekdays = (locale) => { +const getWeekdays = (locale, intlOptions = {}) => { try { /** retrieve locale from below areas in order of preference * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) @@ -1286,7 +1436,15 @@ const getWeekdays = (locale) => { * */ if (!locale) locale = state.getState().locale || getLocale(); - const formatter = new Intl.DateTimeFormat(locale, { weekday: 'long' }); + if (!intlOptions.weekday) + intlOptions.weekday = 'long'; + const formatter = new Intl.DateTimeFormat(locale, intlOptions); + /** The date January 1, 1970, is a well-known reference point in computing known as the Unix epoch. + * It's the date at which time is measured for Unix systems, making it a consistent and reliable choice for date calculations. + * The choice of the date January 4, 1970, as the starting point is significant. + * January 4, 1970, was a Sunday. + * Since weeks typically start on Sunday or Monday in most locales, starting from a known Sunday allows the function to cycle through a complete week, capturing all weekdays in the order they appear for the given locale. + * */ return Array.from({ length: 7 }, (_, i) => formatter.format(new Date(1970, 0, 4 + i))); } catch (err) { @@ -1307,6 +1465,10 @@ var getWeekdays$1 = withErrorBoundary(getWeekdays); * @returns {boolean} True if date1 is after date2. */ const isAfter = (date1, date2) => { + date1 = + typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1); + date2 = + typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2); const dateObj1 = date1 instanceof Date ? date1 : new Date(date1); const dateObj2 = date2 instanceof Date ? date2 : new Date(date2); return dateObj1 > dateObj2; @@ -1320,6 +1482,10 @@ var isAfter$1 = withErrorBoundary(isAfter); * @returns {boolean} True if date1 is before date2. */ const isBefore = (date1, date2) => { + date1 = + typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1); + date2 = + typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2); const dateObj1 = date1 instanceof Date ? date1 : new Date(date1); const dateObj2 = date2 instanceof Date ? date2 : new Date(date2); return dateObj1 < dateObj2; @@ -1345,6 +1511,10 @@ var isLeapYear$1 = withErrorBoundary(isLeapYear); * @returns True if both dates are on the same day, false otherwise. */ const isSameDay = (date1, date2) => { + date1 = + typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1); + date2 = + typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2); return (date1.getDate() === date2.getDate() && date1.getMonth() === date2.getMonth() && date1.getFullYear() === date2.getFullYear()); @@ -1358,6 +1528,18 @@ var isSameDay$1 = withErrorBoundary(isSameDay); * @returns True if the object is a valid Date, false otherwise. */ const isValidDate = (date) => { + try { + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } return date instanceof Date && !isNaN(date.getTime()); }; var isValidDate$1 = withErrorBoundary(isValidDate); @@ -1550,6 +1732,8 @@ var parseDate$1 = withErrorBoundary(parseDate); * @returns A new Date object with the time subtracted. */ const subtract = (date, value, unit) => { + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); return add$1(date, -value, unit); // Reuse the add function with negative value }; var subtract$1 = withErrorBoundary(subtract); diff --git a/lib/esm/dateTime/index.d.ts b/lib/esm/dateTime/index.d.ts index 0066db40..b6d677a7 100644 --- a/lib/esm/dateTime/index.d.ts +++ b/lib/esm/dateTime/index.d.ts @@ -1,28 +1,26 @@ -declare const _default$f: (date: Date, value: number, unit: "days" | "months" | "years") => Date; - type DateInput = Date | string; -interface DateTimeFormatOptions extends Intl.DateTimeFormatOptions { -} interface DateFormatOptions extends Omit { } interface TimeFormatOptions extends Omit { } +declare const _default$f: (date: DateInput, value: number, unit: "days" | "months" | "years") => Date; + declare const _default$e: (date: DateInput, locale: string, options?: DateFormatOptions | undefined) => string; -declare const _default$d: (date: DateInput, locale: string, options?: DateTimeFormatOptions | undefined) => string; +declare const _default$d: (date: DateInput, locale: string, intlOptions?: Intl.DateTimeFormatOptions | undefined) => string; declare const _default$c: (date: DateInput, locale: string, options?: TimeFormatOptions | undefined) => string; -declare const _default$b: (locale: string) => number; +declare const _default$b: (locale: string, intlOptions?: Intl.DateTimeFormatOptions | undefined) => string; -declare const _default$a: (date: Date) => number; +declare const _default$a: (date: DateInput) => number; -declare const _default$9: (date: Date, baseDate: Date | undefined, locale: string, options?: Intl.RelativeTimeFormatOptions | undefined) => string; +declare const _default$9: (date: DateInput, baseDate: DateInput | undefined, locale: string, options?: Intl.RelativeTimeFormatOptions | undefined) => string; -declare const _default$8: (date: Date) => number; +declare const _default$8: (date: DateInput) => number; -declare const _default$7: (locale: string) => string[]; +declare const _default$7: (locale: string, intlOptions?: Intl.DateTimeFormatOptions | undefined) => string[]; declare const _default$6: (date1: DateInput, date2: DateInput) => boolean; @@ -36,6 +34,6 @@ declare const _default$2: (date: any) => boolean; declare const _default$1: (dateString: string, locale: string) => Date | null; -declare const _default: (date: Date, value: number, unit: "days" | "months" | "years") => Date; +declare const _default: (date: DateInput, value: number, unit: "days" | "months" | "years") => Date; export { _default$f as add, _default$e as formatDate, _default$d as formatDateTime, _default$c as formatTime, _default$b as getFirstDayOfWeek, _default$a as getQuarter, _default$9 as getRelativeTime, _default$8 as getWeek, _default$7 as getWeekdays, _default$6 as isAfter, _default$5 as isBefore, _default$4 as isLeapYear, _default$3 as isSameDay, _default$2 as isValidDate, _default$1 as parseDate, _default as subtract }; diff --git a/lib/esm/dateTime/index.js b/lib/esm/dateTime/index.js index 4d73eb43..bb72a67d 100644 --- a/lib/esm/dateTime/index.js +++ b/lib/esm/dateTime/index.js @@ -30,6 +30,128 @@ const withErrorBoundary = (fn) => { }; }; +const stringToDate = (dateString) => { + const supportedDateFormats = [ + // Date formats + { + regex: /^(\d{4})\/(\d{2})\/(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, + { + regex: /^(\d{2})\/(\d{2})\/(\d{4})$/, + yearIndex: 3, + monthIndex: 2, + dayIndex: 1, + }, + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, + // Timestamp formats + { + regex: /^(\d{4})\/(\d{2})\/(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, + { + regex: /^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 3, + monthIndex: 2, + dayIndex: 1, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, + { + regex: /^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, + { + regex: /^(\d{2})-(\d{2})-(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 3, + monthIndex: 2, + dayIndex: 1, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, + { + regex: /^(\d{4})\.(\d{2})\.(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, + { + regex: /^(\d{2})\.(\d{2})\.(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 3, + monthIndex: 2, + dayIndex: 1, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, // DD.MM.YYYY HH:MM:SS + ]; + for (const format of supportedDateFormats) { + const match = dateString.match(format.regex); + if (match) { + const year = match[format.yearIndex]; + const month = match[format.monthIndex]; + const day = match[format.dayIndex]; + const hour = format.hourIndex ? match[format.hourIndex] : '00'; + const minute = format.minuteIndex ? match[format.minuteIndex] : '00'; + const second = format.secondIndex ? match[format.secondIndex] : '00'; + return new Date(`${year}-${month}-${day}T${hour}:${minute}:${second}`); + } + } + throw new Error('Date format not recognized'); +}; + /** * Adds a specified amount of time to a date. * @@ -39,19 +161,20 @@ const withErrorBoundary = (fn) => { * @returns A new Date object with the time added. */ const add = (date, value, unit) => { - const result = new Date(date); + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); switch (unit) { case 'days': - result.setDate(result.getDate() + value); + date.setDate(date.getDate() + value); break; case 'months': - result.setMonth(result.getMonth() + value); + date.setMonth(date.getMonth() + value); break; case 'years': - result.setFullYear(result.getFullYear() + value); + date.setFullYear(date.getFullYear() + value); break; } - return result; + return date; }; var add$1 = withErrorBoundary(add); @@ -113,7 +236,7 @@ const getLocale = () => { * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional). * @returns {string} Formatted date and time string. */ -const formatDateTime = (date, locale, options = {}) => { +const formatDateTime = (date, locale, intlOptions = {}) => { /** retrieve locale from below areas in order of preference * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) * 2. i18nState.locale (uses locale set globally) @@ -121,10 +244,12 @@ const formatDateTime = (date, locale, options = {}) => { * */ if (!locale) locale = state.getState().locale || getLocale(); + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); const dateObj = date instanceof Date ? date : new Date(date); let formatter; try { - formatter = new Intl.DateTimeFormat(locale, options); + formatter = new Intl.DateTimeFormat(locale, intlOptions); } catch (err) { if (err instanceof Error) { @@ -206,9 +331,10 @@ var formatTime$1 = withErrorBoundary(formatTime); * Gets the first day of the week for a given locale. * * @param locale The locale to determine the first day of the week for. + * @param intlOptions Optional Intl.DateTimeFormatOptions for customization. * @returns The first day of the week (0-6, where 0 is Sunday). */ -const getFirstDayOfWeek = (locale) => { +const getFirstDayOfWeek = (locale, intlOptions = {}) => { /** retrieve locale from below areas in order of preference * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) * 2. i18nState.locale (uses locale set globally) @@ -217,10 +343,17 @@ const getFirstDayOfWeek = (locale) => { if (!locale) locale = state.getState().locale || getLocale(); let formatted; + if (!intlOptions.weekday) + intlOptions.weekday = 'long'; try { - const formatter = new Intl.DateTimeFormat(locale, { weekday: 'short' }); - const sampleDate = new Date(2000, 0, 2); // A Sunday - formatted = formatter.format(sampleDate); + const formatter = new Intl.DateTimeFormat(locale, intlOptions); + /** + * This date was chosen because January 2, 2000, is a Sunday. + * In the Gregorian calendar, Sunday is considered the start of the week in some cultures (like in the United States), while in others, it's Monday (like in much of Europe). + * By using a date that is known to be a Sunday, the function can accurately determine what day of the week is considered the start in the specified locale. + */ + const sundayDate = new Date(2000, 0, 2); // A known Sunday + formatted = formatter.format(sundayDate); } catch (err) { if (err instanceof Error) { @@ -230,7 +363,13 @@ const getFirstDayOfWeek = (locale) => { throw new Error(`An unknown error occurred = ${err}`); } } - return ['su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'].indexOf(formatted.slice(0, 2).toLowerCase()); + // Generate localized weekdays array starting from Sunday + const weekdays = Array.from({ length: 7 }, (_, i) => new Intl.DateTimeFormat(locale, intlOptions).format(new Date(2000, 0, 2 + i))); + const firstDayIndex = weekdays.indexOf(formatted); + if (firstDayIndex === -1) { + throw new Error('Unable to determine the first day of the week'); + } + return weekdays[(firstDayIndex + 1) % 7]; // Adjusting since our reference date is a Sunday }; var getFirstDayOfWeek$1 = withErrorBoundary(getFirstDayOfWeek); @@ -241,6 +380,8 @@ var getFirstDayOfWeek$1 = withErrorBoundary(getFirstDayOfWeek); * @returns The quarter of the year (1-4). */ const getQuarter = (date) => { + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); return Math.ceil((date.getMonth() + 1) / 3); }; var getQuarter$1 = withErrorBoundary(getQuarter); @@ -258,6 +399,12 @@ var getQuarter$1 = withErrorBoundary(getQuarter); * @returns The relative time as a string. */ const getRelativeTime = (date, baseDate = new Date(), locale, options) => { + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); + baseDate = + typeof baseDate === 'string' + ? new Date(stringToDate(baseDate)) + : new Date(baseDate); /** retrieve locale from below areas in order of preference * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) * 2. i18nState.locale (uses locale set globally) @@ -327,6 +474,8 @@ var getRelativeTime$1 = withErrorBoundary(getRelativeTime); * @returns The week number of the year. */ const getWeek = (date) => { + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); const firstDayOfYear = new Date(date.getFullYear(), 0, 1); const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000; return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7); @@ -337,9 +486,10 @@ var getWeek$1 = withErrorBoundary(getWeek); * Returns an array of weekdays according to the specified locale. * * @param locale The locale to get weekdays for. + * @param intlOptions Optional Intl.DateTimeFormatOptions for customization. * @returns An array of weekday names. */ -const getWeekdays = (locale) => { +const getWeekdays = (locale, intlOptions = {}) => { try { /** retrieve locale from below areas in order of preference * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) @@ -348,7 +498,15 @@ const getWeekdays = (locale) => { * */ if (!locale) locale = state.getState().locale || getLocale(); - const formatter = new Intl.DateTimeFormat(locale, { weekday: 'long' }); + if (!intlOptions.weekday) + intlOptions.weekday = 'long'; + const formatter = new Intl.DateTimeFormat(locale, intlOptions); + /** The date January 1, 1970, is a well-known reference point in computing known as the Unix epoch. + * It's the date at which time is measured for Unix systems, making it a consistent and reliable choice for date calculations. + * The choice of the date January 4, 1970, as the starting point is significant. + * January 4, 1970, was a Sunday. + * Since weeks typically start on Sunday or Monday in most locales, starting from a known Sunday allows the function to cycle through a complete week, capturing all weekdays in the order they appear for the given locale. + * */ return Array.from({ length: 7 }, (_, i) => formatter.format(new Date(1970, 0, 4 + i))); } catch (err) { @@ -369,6 +527,10 @@ var getWeekdays$1 = withErrorBoundary(getWeekdays); * @returns {boolean} True if date1 is after date2. */ const isAfter = (date1, date2) => { + date1 = + typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1); + date2 = + typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2); const dateObj1 = date1 instanceof Date ? date1 : new Date(date1); const dateObj2 = date2 instanceof Date ? date2 : new Date(date2); return dateObj1 > dateObj2; @@ -382,6 +544,10 @@ var isAfter$1 = withErrorBoundary(isAfter); * @returns {boolean} True if date1 is before date2. */ const isBefore = (date1, date2) => { + date1 = + typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1); + date2 = + typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2); const dateObj1 = date1 instanceof Date ? date1 : new Date(date1); const dateObj2 = date2 instanceof Date ? date2 : new Date(date2); return dateObj1 < dateObj2; @@ -407,6 +573,10 @@ var isLeapYear$1 = withErrorBoundary(isLeapYear); * @returns True if both dates are on the same day, false otherwise. */ const isSameDay = (date1, date2) => { + date1 = + typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1); + date2 = + typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2); return (date1.getDate() === date2.getDate() && date1.getMonth() === date2.getMonth() && date1.getFullYear() === date2.getFullYear()); @@ -420,6 +590,18 @@ var isSameDay$1 = withErrorBoundary(isSameDay); * @returns True if the object is a valid Date, false otherwise. */ const isValidDate = (date) => { + try { + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } return date instanceof Date && !isNaN(date.getTime()); }; var isValidDate$1 = withErrorBoundary(isValidDate); @@ -612,6 +794,8 @@ var parseDate$1 = withErrorBoundary(parseDate); * @returns A new Date object with the time subtracted. */ const subtract = (date, value, unit) => { + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); return add$1(date, -value, unit); // Reuse the add function with negative value }; var subtract$1 = withErrorBoundary(subtract); diff --git a/lib/esm/dateTime/index.js.map b/lib/esm/dateTime/index.js.map index 97389a95..318dde23 100644 --- a/lib/esm/dateTime/index.js.map +++ b/lib/esm/dateTime/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sources":["../../../src/common/errorBoundary/index.ts","../../../src/modules/dateTime/add.ts","../../../src/modules/.internal/utils/getDefaultState.ts","../../../src/modules/.internal/state/index.ts","../../../src/modules/.internal/utils/getLocale.ts","../../../src/modules/dateTime/formatDateTime.ts","../../../src/modules/dateTime/formatDate.ts","../../../src/modules/dateTime/formatTime.ts","../../../src/modules/dateTime/getFirstDayOfWeek.ts","../../../src/modules/dateTime/getQuarter.ts","../../../src/modules/dateTime/getRelativeTime.ts","../../../src/modules/dateTime/getWeek.ts","../../../src/modules/dateTime/getWeekdays.ts","../../../src/modules/dateTime/isAfter.ts","../../../src/modules/dateTime/isBefore.ts","../../../src/modules/dateTime/isLeapYear.ts","../../../src/modules/dateTime/isSameDay.ts","../../../src/modules/dateTime/isValidDate.ts","../../../src/modules/dateTime/data/localeDateFormats.ts","../../../src/modules/dateTime/parseDateWithFormat.ts","../../../src/modules/dateTime/parseDate.ts","../../../src/modules/dateTime/subtract.ts"],"sourcesContent":["// Custom Error class to extend properties to error object\nexport class I18nifyError extends Error {\n timestamp: Date;\n constructor(message: string | undefined) {\n super(message);\n this.name = 'i18nify Error';\n this.timestamp = new Date();\n // more params like type of error/severity can be added in future for better debugging.\n }\n}\n\n/**\n * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block.\n * It appends additional attributes and serves as a centralized error-handling service.\n * Usage =>\n * const wrappedUtilityFn = withErrorBoundary(utilityFn)\n *\n * @param fn utility that is wrapped in error boundary\n * @returns {Function} returns the function wrapped in try/catch block\n */\nexport const withErrorBoundary = any>(\n fn: T,\n): ((...args: Parameters) => ReturnType) => {\n return function (this: unknown, ...rest: Parameters): ReturnType {\n try {\n return fn.call(this, ...rest) as ReturnType;\n } catch (err) {\n console.warn('[I18N Error]: ', err);\n // Currently, we are throwing the error as it is to consumers.\n // In the future, this can be modified as per our requirement, like an error logging service.\n throw new I18nifyError(err as string | undefined);\n }\n };\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Adds a specified amount of time to a date.\n *\n * @param date The original date.\n * @param value The amount to add.\n * @param unit The unit of time to add (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time added.\n */\nconst add = (\n date: Date,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n const result = new Date(date);\n switch (unit) {\n case 'days':\n result.setDate(result.getDate() + value);\n break;\n case 'months':\n result.setMonth(result.getMonth() + value);\n break;\n case 'years':\n result.setFullYear(result.getFullYear() + value);\n break;\n }\n return result;\n};\n\nexport default withErrorBoundary(add);\n","import type { I18nState } from '../state/types';\n\nexport function getDefaultState(): I18nState {\n return {\n locale: '',\n direction: '',\n country: '',\n };\n}\n","import { I18nState } from './types';\nimport { getDefaultState } from '../utils/getDefaultState';\n\nexport class I18nStateManager {\n private static instance: I18nStateManager | undefined;\n private state: I18nState;\n\n private constructor() {\n this.state = getDefaultState();\n }\n\n public static getInstance(): I18nStateManager {\n if (!I18nStateManager.instance) {\n I18nStateManager.instance = new I18nStateManager();\n }\n\n return I18nStateManager.instance;\n }\n\n public static resetInstance(): void {\n I18nStateManager.instance = undefined;\n }\n\n public getState(): I18nState {\n return { ...this.state };\n }\n\n public setState(newState: Partial): void {\n this.state = { ...this.state, ...newState };\n }\n\n public resetState(): void {\n this.state = getDefaultState();\n }\n}\n\nexport default I18nStateManager.getInstance();\n","export const getLocale = (): string => {\n // Check if running in a non-browser environment (e.g., Node.js or older browsers).\n if (typeof navigator === 'undefined') {\n return 'en-IN';\n }\n\n // Check if the browser supports the Intl object and user language preferences.\n if (\n window.Intl &&\n typeof window.Intl === 'object' &&\n (window.navigator.languages || window.navigator.language)\n ) {\n const userLocales = window.navigator.languages || [\n window.navigator.language,\n ];\n return userLocales[0];\n }\n\n // Fallback to a supported locale or the default locale.\n return 'en-IN';\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale, DateTimeFormatOptions } from './types';\n\n/**\n * Formats date and time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional).\n * @returns {string} Formatted date and time string.\n */\nconst formatDateTime = (\n date: DateInput,\n locale: Locale,\n options: DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const dateObj: Date = date instanceof Date ? date : new Date(date);\n let formatter;\n\n try {\n formatter = new Intl.DateTimeFormat(locale, options);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formatter.format(dateObj);\n};\n\nexport default withErrorBoundary(formatDateTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n DateFormatOptions,\n} from './types';\n\n/**\n * Formats date based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional).\n * @returns {string} Formatted date string.\n */\nconst formatDate = (\n date: DateInput,\n locale: Locale,\n options: DateFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n timeStyle: undefined,\n };\n\n let formattedDate;\n\n try {\n formattedDate = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedDate;\n};\n\nexport default withErrorBoundary(formatDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n TimeFormatOptions,\n} from './types';\n\n/**\n * Formats time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional).\n * @returns {string} Formatted time string.\n */\nconst formatTime = (\n date: DateInput,\n locale: Locale,\n options: TimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n dateStyle: undefined,\n };\n\n let formattedTime;\n\n try {\n formattedTime = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedTime;\n};\n\nexport default withErrorBoundary(formatTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\n\n/**\n * Gets the first day of the week for a given locale.\n *\n * @param locale The locale to determine the first day of the week for.\n * @returns The first day of the week (0-6, where 0 is Sunday).\n */\nconst getFirstDayOfWeek = (locale: string): number => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n let formatted;\n\n try {\n const formatter = new Intl.DateTimeFormat(locale, { weekday: 'short' });\n const sampleDate = new Date(2000, 0, 2); // A Sunday\n formatted = formatter.format(sampleDate);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return ['su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'].indexOf(\n formatted.slice(0, 2).toLowerCase(),\n );\n};\n\nexport default withErrorBoundary(getFirstDayOfWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Determines the quarter of the year for a given date.\n *\n * @param date The date to determine the quarter for.\n * @returns The quarter of the year (1-4).\n */\nconst getQuarter = (date: Date): number => {\n return Math.ceil((date.getMonth() + 1) / 3);\n};\n\nexport default withErrorBoundary(getQuarter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Provides a relative time string (e.g., '3 hours ago', 'in 2 days').\n * This function calculates the difference between the given date and the base date,\n * then formats it in a locale-sensitive manner. It allows customization of the output\n * through Intl.RelativeTimeFormat options.\n *\n * @param date - The date to compare.\n * @param baseDate - The date to compare against (default: current date).\n * @param locale - The locale to use for formatting.\n * @param options - Options for the Intl.RelativeTimeFormat (optional).\n * @returns The relative time as a string.\n */\nconst getRelativeTime = (\n date: Date,\n baseDate: Date = new Date(),\n locale: Locale,\n options?: Intl.RelativeTimeFormatOptions,\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000;\n\n // Define time units in seconds\n const minute = 60;\n const hour = minute * 60;\n const day = hour * 24;\n const week = day * 7;\n const month = day * 30;\n const year = day * 365;\n\n let value: number;\n let unit: Intl.RelativeTimeFormatUnit;\n\n if (Math.abs(diffInSeconds) < minute) {\n value = diffInSeconds;\n unit = 'second';\n } else if (Math.abs(diffInSeconds) < hour) {\n value = diffInSeconds / minute;\n unit = 'minute';\n } else if (Math.abs(diffInSeconds) < day) {\n value = diffInSeconds / hour;\n unit = 'hour';\n } else if (Math.abs(diffInSeconds) < week) {\n value = diffInSeconds / day;\n unit = 'day';\n } else if (Math.abs(diffInSeconds) < month) {\n value = diffInSeconds / week;\n unit = 'week';\n } else if (Math.abs(diffInSeconds) < year) {\n value = diffInSeconds / month;\n unit = 'month';\n } else {\n value = diffInSeconds / year;\n unit = 'year';\n }\n\n let relativeTime;\n\n try {\n const rtf = new Intl.RelativeTimeFormat(locale, options);\n relativeTime = rtf.format(Math.round(value), unit);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return relativeTime;\n};\n\nexport default withErrorBoundary(getRelativeTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Calculates the week number of the year for a given date.\n *\n * @param date The date to calculate the week number for.\n * @returns The week number of the year.\n */\nconst getWeek = (date: Date): number => {\n const firstDayOfYear = new Date(date.getFullYear(), 0, 1);\n const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000;\n return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7);\n};\n\nexport default withErrorBoundary(getWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Returns an array of weekdays according to the specified locale.\n *\n * @param locale The locale to get weekdays for.\n * @returns An array of weekday names.\n */\nconst getWeekdays = (locale: Locale): string[] => {\n try {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n const formatter = new Intl.DateTimeFormat(locale, { weekday: 'long' });\n return Array.from({ length: 7 }, (_, i) =>\n formatter.format(new Date(1970, 0, 4 + i)),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(getWeekdays);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\n\n/**\n * Compares two dates to determine if the first is after the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is after date2.\n */\nconst isAfter = (date1: DateInput, date2: DateInput): boolean => {\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 > dateObj2;\n};\n\nexport default withErrorBoundary(isAfter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\n\n/**\n * Compares two dates to determine if the first is before the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is before date2.\n */\nconst isBefore = (date1: DateInput, date2: DateInput): boolean => {\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 < dateObj2;\n};\n\nexport default withErrorBoundary(isBefore);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given year is a leap year.\n *\n * @param year The year to check.\n * @returns True if the year is a leap year, false otherwise.\n */\nconst isLeapYear = (year: number): boolean => {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n};\n\nexport default withErrorBoundary(isLeapYear);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if two dates fall on the same day.\n *\n * @param date1 The first date.\n * @param date2 The second date.\n * @returns True if both dates are on the same day, false otherwise.\n */\nconst isSameDay = (date1: Date, date2: Date): boolean => {\n return (\n date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear()\n );\n};\n\nexport default withErrorBoundary(isSameDay);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given object is a valid Date object.\n *\n * @param date The object to check.\n * @returns True if the object is a valid Date, false otherwise.\n */\nconst isValidDate = (date: any): boolean => {\n return date instanceof Date && !isNaN(date.getTime());\n};\n\nexport default withErrorBoundary(isValidDate);\n","export const LOCALE_DATE_FORMATS: { [key: string]: string } = {\n 'ar-AE': 'DD/MM/YYYY', // Arabic (U.A.E.)\n 'sq-AL': 'DD.MM.YYYY', // Albanian (Albania)\n 'hy-AM': 'DD.MM.YYYY', // Armenian (Armenia)\n 'es-AR': 'DD/MM/YYYY', // Spanish (Argentina)\n 'en-AU': 'DD/MM/YYYY', // English (Australia)\n 'nl-AW': 'DD-MM-YYYY', // Dutch (Aruba)\n 'en-BB': 'MM/DD/YYYY', // English (Barbados)\n 'bn-BD': 'DD/MM/YYYY', // Bengali (Bangladesh)\n 'en-BM': 'MM/DD/YYYY', // English (Bermuda)\n 'ms-BN': 'DD/MM/YYYY', // Malay (Brunei)\n 'es-BO': 'DD/MM/YYYY', // Spanish (Bolivia)\n 'en-BS': 'MM/DD/YYYY', // English (Bahamas)\n 'en-BW': 'DD/MM/YYYY', // English (Botswana)\n 'en-BZ': 'MM/DD/YYYY', // English (Belize)\n 'en-CA': 'DD/MM/YYYY', // English (Canada)\n 'de-CH': 'DD.MM.YYYY', // German (Switzerland)\n 'zh-CN': 'YYYY/MM/DD', // Chinese (China)\n 'es-CO': 'DD/MM/YYYY', // Spanish (Colombia)\n 'es-CR': 'DD/MM/YYYY', // Spanish (Costa Rica)\n 'es-CU': 'DD/MM/YYYY', // Spanish (Cuba)\n 'cs-CZ': 'DD.MM.YYYY', // Czech (Czech Republic)\n 'da-DK': 'DD-MM-YYYY', // Danish (Denmark)\n 'es-DO': 'DD/MM/YYYY', // Spanish (Dominican Republic)\n 'ar-DZ': 'DD/MM/YYYY', // Arabic (Algeria)\n 'ar-EG': 'DD/MM/YYYY', // Arabic (Egypt)\n 'am-ET': 'DD/MM/YYYY', // Amharic (Ethiopia)\n 'en-EU': 'DD/MM/YYYY', // English (European Union)\n 'en-FJ': 'DD/MM/YYYY', // English (Fiji)\n 'en-GB': 'DD/MM/YYYY', // English (United Kingdom)\n 'en-GH': 'DD/MM/YYYY', // English (Ghana)\n 'en-GI': 'DD/MM/YYYY', // English (Gibraltar)\n 'en-GM': 'DD/MM/YYYY', // English (Gambia)\n 'es-GT': 'DD/MM/YYYY', // Spanish (Guatemala)\n 'en-GY': 'DD/MM/YYYY', // English (Guyana)\n 'en-HK': 'DD/MM/YYYY', // English (Hong Kong)\n 'es-HN': 'DD/MM/YYYY', // Spanish (Honduras)\n 'hr-HR': 'DD.MM.YYYY', // Croatian (Croatia)\n 'ht-HT': 'MM/DD/YYYY', // Haitian (Haiti)\n 'hu-HU': 'YYYY. MM. DD.', // Hungarian (Hungary)\n 'id-ID': 'DD/MM/YYYY', // Indonesian (Indonesia)\n 'he-IL': 'DD/MM/YYYY', // Hebrew (Israel)\n 'en-IN': 'DD-MM-YYYY', // English (India)\n 'en-JM': 'MM/DD/YYYY', // English (Jamaica)\n 'en-KE': 'DD/MM/YYYY', // English (Kenya)\n 'ky-KG': 'DD.MM.YYYY', // Kyrgyz (Kyrgyzstan)\n 'km-KH': 'DD/MM/YYYY', // Khmer (Cambodia)\n 'en-KY': 'MM/DD/YYYY', // English (Cayman Islands)\n 'kk-KZ': 'DD.MM.YYYY', // Kazakh (Kazakhstan)\n 'lo-LA': 'DD/MM/YYYY', // Lao (Laos)\n 'si-LK': 'YYYY-MM-DD', // Sinhala (Sri Lanka)\n 'en-LR': 'MM/DD/YYYY', // English (Liberia)\n 'en-LS': 'DD/MM/YYYY', // English (Lesotho)\n 'ar-MA': 'DD/MM/YYYY', // Arabic (Morocco)\n 'ro-MD': 'DD.MM.YYYY', // Romanian (Moldova)\n 'mk-MK': 'DD.MM.YYYY', // Macedonian (North Macedonia)\n 'my-MM': 'DD/MM/YYYY', // Burmese (Myanmar)\n 'mn-MN': 'YYYY.MM.DD', // Mongolian (Mongolia)\n 'zh-MO': 'DD/MM/YYYY', // Chinese (Macao)\n 'en-MU': 'DD/MM/YYYY', // English (Mauritius)\n 'dv-MV': 'DD/MM/YYYY', // Divehi (Maldives)\n 'en-MW': 'DD/MM/YYYY', // English (Malawi)\n 'es-MX': 'DD/MM/YYYY', // Spanish (Mexico)\n 'ms-MY': 'DD/MM/YYYY', // Malay (Malaysia)\n 'en-NA': 'DD/MM/YYYY', // English (Namibia)\n 'en-NG': 'DD/MM/YYYY', // English (Nigeria)\n 'es-NI': 'DD/MM/YYYY', // Spanish (Nicaragua)\n 'no-NO': 'DD.MM.YYYY', // Norwegian (Norway)\n 'ne-NP': 'YYYY/MM/DD', // Nepali (Nepal)\n 'en-NZ': 'DD/MM/YYYY', // English (New Zealand)\n 'es-PE': 'DD/MM/YYYY', // Spanish (Peru)\n 'en-PG': 'DD/MM/YYYY', // English (Papua New Guinea)\n 'en-PH': 'MM/DD/YYYY', // English (Philippines)\n 'en-PK': 'DD/MM/YYYY', // English (Pakistan)\n 'ar-QA': 'DD/MM/YYYY', // Arabic (Qatar)\n 'ru-RU': 'DD.MM.YYYY', // Russian (Russia)\n 'ar-SA': 'DD/MM/YYYY', // Arabic (Saudi Arabia)\n 'en-SC': 'DD/MM/YYYY', // English (Seychelles)\n 'sv-SE': 'YYYY-MM-DD', // Swedish (Sweden)\n 'en-SG': 'DD/MM/YYYY', // English (Singapore)\n 'en-SL': 'DD/MM/YYYY', // English (Sierra Leone)\n 'so-SO': 'DD/MM/YYYY', // Somali (Somalia)\n 'en-SS': 'DD/MM/YYYY', // English (South Sudan)\n 'es-SV': 'DD/MM/YYYY', // Spanish (El Salvador)\n 'en-SZ': 'DD/MM/YYYY', // English (Eswatini)\n 'th-TH': 'DD/MM/YYYY', // Thai (Thailand)\n 'en-TT': 'MM/DD/YYYY', // English (Trinidad and Tobago)\n 'sw-TZ': 'DD/MM/YYYY', // Swahili (Tanzania)\n 'en-US': 'MM/DD/YYYY', // English (United States)\n 'es-UY': 'DD/MM/YYYY', // Spanish (Uruguay)\n 'uz-UZ': 'DD/MM/YYYY', // Uzbek (Uzbekistan)\n 'ar-YE': 'DD/MM/YYYY', // Arabic (Yemen)\n 'en-ZA': 'YYYY/MM/DD', // English (South Africa)\n 'ar-KW': 'DD/MM/YYYY', // Arabic (Kuwait)\n 'ar-BH': 'DD/MM/YYYY', // Arabic (Bahrain)\n 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman)\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Parses a date string based on a specific format.\n *\n * @param dateString The date string to parse.\n * @param format The format to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDateWithFormat = (\n dateString: string,\n format: string,\n): Date | null => {\n // Determine the separator based on the format (supports '/', '.', or '-')\n const separator = format.includes('/')\n ? '/'\n : format.includes('.')\n ? '.'\n : '-';\n const formatParts = format.split(separator);\n const dateParts = dateString.split(separator).map((num) => parseInt(num, 10));\n\n let year: number = 0,\n month: number = 0,\n day: number = 0;\n let yearSet: boolean = false,\n monthSet: boolean = false,\n daySet: boolean = false;\n\n // Check for format and date string mismatch\n if (dateParts.length !== formatParts.length) {\n return null; // Mismatch between date string and format\n }\n\n formatParts.forEach((part, index) => {\n // Check for non-numeric values in date string\n if (isNaN(dateParts[index])) {\n return null; // Invalid date part\n }\n\n // Assign year, month, and day based on the format\n switch (part) {\n case 'DD':\n day = dateParts[index];\n daySet = true;\n break;\n case 'MM':\n month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date\n monthSet = true;\n break;\n case 'YYYY':\n year = dateParts[index];\n yearSet = true;\n break;\n }\n });\n\n // Validate and create the date only if all parts are set\n if (yearSet && monthSet && daySet) {\n const parsedDate = new Date(year, month, day);\n // Validate date to catch invalid dates like February 30th\n if (\n parsedDate.getFullYear() === year &&\n parsedDate.getMonth() === month &&\n parsedDate.getDate() === day\n ) {\n return parsedDate;\n }\n }\n return null; // Invalid date or incomplete date information\n};\n\nexport default withErrorBoundary(\n parseDateWithFormat,\n);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { LOCALE_DATE_FORMATS } from './data/localeDateFormats';\nimport parseDateWithFormat from './parseDateWithFormat';\nimport { Locale } from './types';\n\n/**\n * Attempts to parse a string into a date object based on locale.\n * Uses the localeDateFormats mapping for determining the date format.\n *\n * @param dateString - The date string to parse.\n * @param locale - The locale to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDate = (dateString: string, locale: Locale): Date | null => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const format = LOCALE_DATE_FORMATS[locale];\n if (!format) {\n throw new Error(`No date format found for locale: ${locale}`);\n }\n return parseDateWithFormat(dateString, format);\n};\n\nexport default withErrorBoundary(parseDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport add from './add';\n\n/**\n * Subtracts a specified amount of time from a date.\n *\n * @param date The original date.\n * @param value The amount to subtract.\n * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time subtracted.\n */\nconst subtract = (\n date: Date,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n return add(date, -value, unit); // Reuse the add function with negative value\n};\n\nexport default withErrorBoundary(subtract);\n"],"names":["formatDateTime","parseDateWithFormat","add"],"mappings":"AAAA;AACM,MAAO,YAAa,SAAQ,KAAK,CAAA;AAErC,IAAA,WAAA,CAAY,OAA2B,EAAA;QACrC,KAAK,CAAC,OAAO,CAAC,CAAC;AACf,QAAA,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;AAC5B,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;;KAE7B;AACF,CAAA;AAED;;;;;;;;AAQG;AACI,MAAM,iBAAiB,GAAG,CAC/B,EAAK,KAC0C;IAC/C,OAAO,UAAyB,GAAG,IAAmB,EAAA;QACpD,IAAI;YACF,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,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AAC;AAE7D,IAAA,MAAM,MAAM,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC3C,IAAI,CAAC,MAAM,EAAE;AACX,QAAA,MAAM,IAAI,KAAK,CAAC,oCAAoC,MAAM,CAAA,CAAE,CAAC,CAAC;AAC/D,KAAA;AACD,IAAA,OAAOC,qBAAmB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC,CAAC;AAEF,kBAAe,iBAAiB,CAAmB,SAAS,CAAC;;AC3B7D;;;;;;;AAOG;AACH,MAAM,QAAQ,GAAG,CACf,IAAU,EACV,KAAa,EACb,IAAiC,KACzB;IACR,OAAOC,KAAG,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACjC,CAAC,CAAC;AAEF,iBAAe,iBAAiB,CAAkB,QAAQ,CAAC;;;;"} \ No newline at end of file +{"version":3,"file":"index.js","sources":["../../../src/common/errorBoundary/index.ts","../../../src/modules/dateTime/utils.ts","../../../src/modules/dateTime/add.ts","../../../src/modules/.internal/utils/getDefaultState.ts","../../../src/modules/.internal/state/index.ts","../../../src/modules/.internal/utils/getLocale.ts","../../../src/modules/dateTime/formatDateTime.ts","../../../src/modules/dateTime/formatDate.ts","../../../src/modules/dateTime/formatTime.ts","../../../src/modules/dateTime/getFirstDayOfWeek.ts","../../../src/modules/dateTime/getQuarter.ts","../../../src/modules/dateTime/getRelativeTime.ts","../../../src/modules/dateTime/getWeek.ts","../../../src/modules/dateTime/getWeekdays.ts","../../../src/modules/dateTime/isAfter.ts","../../../src/modules/dateTime/isBefore.ts","../../../src/modules/dateTime/isLeapYear.ts","../../../src/modules/dateTime/isSameDay.ts","../../../src/modules/dateTime/isValidDate.ts","../../../src/modules/dateTime/data/localeDateFormats.ts","../../../src/modules/dateTime/parseDateWithFormat.ts","../../../src/modules/dateTime/parseDate.ts","../../../src/modules/dateTime/subtract.ts"],"sourcesContent":["// Custom Error class to extend properties to error object\nexport class I18nifyError extends Error {\n timestamp: Date;\n constructor(message: string | undefined) {\n super(message);\n this.name = 'i18nify Error';\n this.timestamp = new Date();\n // more params like type of error/severity can be added in future for better debugging.\n }\n}\n\n/**\n * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block.\n * It appends additional attributes and serves as a centralized error-handling service.\n * Usage =>\n * const wrappedUtilityFn = withErrorBoundary(utilityFn)\n *\n * @param fn utility that is wrapped in error boundary\n * @returns {Function} returns the function wrapped in try/catch block\n */\nexport const withErrorBoundary = any>(\n fn: T,\n): ((...args: Parameters) => ReturnType) => {\n return function (this: unknown, ...rest: Parameters): ReturnType {\n try {\n return fn.call(this, ...rest) as ReturnType;\n } catch (err) {\n console.warn('[I18N Error]: ', err);\n // Currently, we are throwing the error as it is to consumers.\n // In the future, this can be modified as per our requirement, like an error logging service.\n throw new I18nifyError(err as string | undefined);\n }\n };\n};\n","export const stringToDate = (dateString: string): Date => {\n const supportedDateFormats = [\n // Date formats\n {\n regex: /^(\\d{4})\\/(\\d{2})\\/(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY/MM/DD\n {\n regex: /^(\\d{2})\\/(\\d{2})\\/(\\d{4})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n }, // DD/MM/YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY.MM.DD\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // DD-MM-YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // MM/DD/YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY-MM-DD\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY. MM. DD.\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // DD.MM.YYYY\n\n // Timestamp formats\n {\n regex: /^(\\d{4})\\/(\\d{2})\\/(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY/MM/DD HH:MM:SS\n {\n regex: /^(\\d{2})\\/(\\d{2})\\/(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD/MM/YYYY HH:MM:SS\n {\n regex: /^(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY-MM-DD HH:MM:SS\n {\n regex: /^(\\d{2})-(\\d{2})-(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD-MM-YYYY HH:MM:SS\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY.MM.DD HH:MM:SS\n {\n regex: /^(\\d{2})\\.(\\d{2})\\.(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD.MM.YYYY HH:MM:SS\n ];\n\n for (const format of supportedDateFormats) {\n const match = dateString.match(format.regex);\n if (match) {\n const year = match[format.yearIndex];\n const month = match[format.monthIndex];\n const day = match[format.dayIndex];\n const hour = format.hourIndex ? match[format.hourIndex] : '00';\n const minute = format.minuteIndex ? match[format.minuteIndex] : '00';\n const second = format.secondIndex ? match[format.secondIndex] : '00';\n\n return new Date(`${year}-${month}-${day}T${hour}:${minute}:${second}`);\n }\n }\n\n throw new Error('Date format not recognized');\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Adds a specified amount of time to a date.\n *\n * @param date The original date.\n * @param value The amount to add.\n * @param unit The unit of time to add (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time added.\n */\nconst add = (\n date: DateInput,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n switch (unit) {\n case 'days':\n date.setDate(date.getDate() + value);\n break;\n case 'months':\n date.setMonth(date.getMonth() + value);\n break;\n case 'years':\n date.setFullYear(date.getFullYear() + value);\n break;\n }\n return date;\n};\n\nexport default withErrorBoundary(add);\n","import type { I18nState } from '../state/types';\n\nexport function getDefaultState(): I18nState {\n return {\n locale: '',\n direction: '',\n country: '',\n };\n}\n","import { I18nState } from './types';\nimport { getDefaultState } from '../utils/getDefaultState';\n\nexport class I18nStateManager {\n private static instance: I18nStateManager | undefined;\n private state: I18nState;\n\n private constructor() {\n this.state = getDefaultState();\n }\n\n public static getInstance(): I18nStateManager {\n if (!I18nStateManager.instance) {\n I18nStateManager.instance = new I18nStateManager();\n }\n\n return I18nStateManager.instance;\n }\n\n public static resetInstance(): void {\n I18nStateManager.instance = undefined;\n }\n\n public getState(): I18nState {\n return { ...this.state };\n }\n\n public setState(newState: Partial): void {\n this.state = { ...this.state, ...newState };\n }\n\n public resetState(): void {\n this.state = getDefaultState();\n }\n}\n\nexport default I18nStateManager.getInstance();\n","export const getLocale = (): string => {\n // Check if running in a non-browser environment (e.g., Node.js or older browsers).\n if (typeof navigator === 'undefined') {\n return 'en-IN';\n }\n\n // Check if the browser supports the Intl object and user language preferences.\n if (\n window.Intl &&\n typeof window.Intl === 'object' &&\n (window.navigator.languages || window.navigator.language)\n ) {\n const userLocales = window.navigator.languages || [\n window.navigator.language,\n ];\n return userLocales[0];\n }\n\n // Fallback to a supported locale or the default locale.\n return 'en-IN';\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Formats date and time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional).\n * @returns {string} Formatted date and time string.\n */\nconst formatDateTime = (\n date: DateInput,\n locale: Locale,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n const dateObj: Date = date instanceof Date ? date : new Date(date);\n let formatter;\n\n try {\n formatter = new Intl.DateTimeFormat(locale, intlOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formatter.format(dateObj);\n};\n\nexport default withErrorBoundary(formatDateTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n DateFormatOptions,\n} from './types';\n\n/**\n * Formats date based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional).\n * @returns {string} Formatted date string.\n */\nconst formatDate = (\n date: DateInput,\n locale: Locale,\n options: DateFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n timeStyle: undefined,\n };\n\n let formattedDate;\n\n try {\n formattedDate = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedDate;\n};\n\nexport default withErrorBoundary(formatDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n TimeFormatOptions,\n} from './types';\n\n/**\n * Formats time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional).\n * @returns {string} Formatted time string.\n */\nconst formatTime = (\n date: DateInput,\n locale: Locale,\n options: TimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n dateStyle: undefined,\n };\n\n let formattedTime;\n\n try {\n formattedTime = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedTime;\n};\n\nexport default withErrorBoundary(formatTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\n\n/**\n * Gets the first day of the week for a given locale.\n *\n * @param locale The locale to determine the first day of the week for.\n * @param intlOptions Optional Intl.DateTimeFormatOptions for customization.\n * @returns The first day of the week (0-6, where 0 is Sunday).\n */\nconst getFirstDayOfWeek = (\n locale: string,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n let formatted;\n\n if (!intlOptions.weekday) intlOptions.weekday = 'long';\n\n try {\n const formatter = new Intl.DateTimeFormat(locale, intlOptions);\n /**\n * This date was chosen because January 2, 2000, is a Sunday.\n * In the Gregorian calendar, Sunday is considered the start of the week in some cultures (like in the United States), while in others, it's Monday (like in much of Europe).\n * By using a date that is known to be a Sunday, the function can accurately determine what day of the week is considered the start in the specified locale.\n */\n const sundayDate = new Date(2000, 0, 2); // A known Sunday\n formatted = formatter.format(sundayDate);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n // Generate localized weekdays array starting from Sunday\n const weekdays = Array.from({ length: 7 }, (_, i) =>\n new Intl.DateTimeFormat(locale, intlOptions).format(\n new Date(2000, 0, 2 + i),\n ),\n );\n\n const firstDayIndex = weekdays.indexOf(formatted);\n if (firstDayIndex === -1) {\n throw new Error('Unable to determine the first day of the week');\n }\n\n return weekdays[(firstDayIndex + 1) % 7]; // Adjusting since our reference date is a Sunday\n};\n\nexport default withErrorBoundary(getFirstDayOfWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Determines the quarter of the year for a given date.\n *\n * @param date The date to determine the quarter for.\n * @returns The quarter of the year (1-4).\n */\nconst getQuarter = (date: DateInput): number => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n return Math.ceil((date.getMonth() + 1) / 3);\n};\n\nexport default withErrorBoundary(getQuarter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Provides a relative time string (e.g., '3 hours ago', 'in 2 days').\n * This function calculates the difference between the given date and the base date,\n * then formats it in a locale-sensitive manner. It allows customization of the output\n * through Intl.RelativeTimeFormat options.\n *\n * @param date - The date to compare.\n * @param baseDate - The date to compare against (default: current date).\n * @param locale - The locale to use for formatting.\n * @param options - Options for the Intl.RelativeTimeFormat (optional).\n * @returns The relative time as a string.\n */\nconst getRelativeTime = (\n date: DateInput,\n baseDate: DateInput = new Date(),\n locale: Locale,\n options?: Intl.RelativeTimeFormatOptions,\n): string => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n baseDate =\n typeof baseDate === 'string'\n ? new Date(stringToDate(baseDate))\n : new Date(baseDate);\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000;\n\n // Define time units in seconds\n const minute = 60;\n const hour = minute * 60;\n const day = hour * 24;\n const week = day * 7;\n const month = day * 30;\n const year = day * 365;\n\n let value: number;\n let unit: Intl.RelativeTimeFormatUnit;\n\n if (Math.abs(diffInSeconds) < minute) {\n value = diffInSeconds;\n unit = 'second';\n } else if (Math.abs(diffInSeconds) < hour) {\n value = diffInSeconds / minute;\n unit = 'minute';\n } else if (Math.abs(diffInSeconds) < day) {\n value = diffInSeconds / hour;\n unit = 'hour';\n } else if (Math.abs(diffInSeconds) < week) {\n value = diffInSeconds / day;\n unit = 'day';\n } else if (Math.abs(diffInSeconds) < month) {\n value = diffInSeconds / week;\n unit = 'week';\n } else if (Math.abs(diffInSeconds) < year) {\n value = diffInSeconds / month;\n unit = 'month';\n } else {\n value = diffInSeconds / year;\n unit = 'year';\n }\n\n let relativeTime;\n\n try {\n const rtf = new Intl.RelativeTimeFormat(locale, options);\n relativeTime = rtf.format(Math.round(value), unit);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return relativeTime;\n};\n\nexport default withErrorBoundary(getRelativeTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Calculates the week number of the year for a given date.\n *\n * @param date The date to calculate the week number for.\n * @returns The week number of the year.\n */\nconst getWeek = (date: DateInput): number => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n const firstDayOfYear = new Date(date.getFullYear(), 0, 1);\n const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000;\n return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7);\n};\n\nexport default withErrorBoundary(getWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Returns an array of weekdays according to the specified locale.\n *\n * @param locale The locale to get weekdays for.\n * @param intlOptions Optional Intl.DateTimeFormatOptions for customization.\n * @returns An array of weekday names.\n */\nconst getWeekdays = (\n locale: Locale,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string[] => {\n try {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n if (!intlOptions.weekday) intlOptions.weekday = 'long';\n\n const formatter = new Intl.DateTimeFormat(locale, intlOptions);\n\n /** The date January 1, 1970, is a well-known reference point in computing known as the Unix epoch.\n * It's the date at which time is measured for Unix systems, making it a consistent and reliable choice for date calculations.\n * The choice of the date January 4, 1970, as the starting point is significant.\n * January 4, 1970, was a Sunday.\n * Since weeks typically start on Sunday or Monday in most locales, starting from a known Sunday allows the function to cycle through a complete week, capturing all weekdays in the order they appear for the given locale.\n * */\n return Array.from({ length: 7 }, (_, i) =>\n formatter.format(new Date(1970, 0, 4 + i)),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(getWeekdays);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Compares two dates to determine if the first is after the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is after date2.\n */\nconst isAfter = (date1: DateInput, date2: DateInput): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 > dateObj2;\n};\n\nexport default withErrorBoundary(isAfter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Compares two dates to determine if the first is before the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is before date2.\n */\nconst isBefore = (date1: DateInput, date2: DateInput): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 < dateObj2;\n};\n\nexport default withErrorBoundary(isBefore);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given year is a leap year.\n *\n * @param year The year to check.\n * @returns True if the year is a leap year, false otherwise.\n */\nconst isLeapYear = (year: number): boolean => {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n};\n\nexport default withErrorBoundary(isLeapYear);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { stringToDate } from './utils';\n\n/**\n * Checks if two dates fall on the same day.\n *\n * @param date1 The first date.\n * @param date2 The second date.\n * @returns True if both dates are on the same day, false otherwise.\n */\nconst isSameDay = (date1: Date, date2: Date): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n return (\n date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear()\n );\n};\n\nexport default withErrorBoundary(isSameDay);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { stringToDate } from './utils';\n\n/**\n * Checks if a given object is a valid Date object.\n *\n * @param date The object to check.\n * @returns True if the object is a valid Date, false otherwise.\n */\nconst isValidDate = (date: any): boolean => {\n try {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return date instanceof Date && !isNaN(date.getTime());\n};\n\nexport default withErrorBoundary(isValidDate);\n","export const LOCALE_DATE_FORMATS: { [key: string]: string } = {\n 'ar-AE': 'DD/MM/YYYY', // Arabic (U.A.E.)\n 'sq-AL': 'DD.MM.YYYY', // Albanian (Albania)\n 'hy-AM': 'DD.MM.YYYY', // Armenian (Armenia)\n 'es-AR': 'DD/MM/YYYY', // Spanish (Argentina)\n 'en-AU': 'DD/MM/YYYY', // English (Australia)\n 'nl-AW': 'DD-MM-YYYY', // Dutch (Aruba)\n 'en-BB': 'MM/DD/YYYY', // English (Barbados)\n 'bn-BD': 'DD/MM/YYYY', // Bengali (Bangladesh)\n 'en-BM': 'MM/DD/YYYY', // English (Bermuda)\n 'ms-BN': 'DD/MM/YYYY', // Malay (Brunei)\n 'es-BO': 'DD/MM/YYYY', // Spanish (Bolivia)\n 'en-BS': 'MM/DD/YYYY', // English (Bahamas)\n 'en-BW': 'DD/MM/YYYY', // English (Botswana)\n 'en-BZ': 'MM/DD/YYYY', // English (Belize)\n 'en-CA': 'DD/MM/YYYY', // English (Canada)\n 'de-CH': 'DD.MM.YYYY', // German (Switzerland)\n 'zh-CN': 'YYYY/MM/DD', // Chinese (China)\n 'es-CO': 'DD/MM/YYYY', // Spanish (Colombia)\n 'es-CR': 'DD/MM/YYYY', // Spanish (Costa Rica)\n 'es-CU': 'DD/MM/YYYY', // Spanish (Cuba)\n 'cs-CZ': 'DD.MM.YYYY', // Czech (Czech Republic)\n 'da-DK': 'DD-MM-YYYY', // Danish (Denmark)\n 'es-DO': 'DD/MM/YYYY', // Spanish (Dominican Republic)\n 'ar-DZ': 'DD/MM/YYYY', // Arabic (Algeria)\n 'ar-EG': 'DD/MM/YYYY', // Arabic (Egypt)\n 'am-ET': 'DD/MM/YYYY', // Amharic (Ethiopia)\n 'en-EU': 'DD/MM/YYYY', // English (European Union)\n 'en-FJ': 'DD/MM/YYYY', // English (Fiji)\n 'en-GB': 'DD/MM/YYYY', // English (United Kingdom)\n 'en-GH': 'DD/MM/YYYY', // English (Ghana)\n 'en-GI': 'DD/MM/YYYY', // English (Gibraltar)\n 'en-GM': 'DD/MM/YYYY', // English (Gambia)\n 'es-GT': 'DD/MM/YYYY', // Spanish (Guatemala)\n 'en-GY': 'DD/MM/YYYY', // English (Guyana)\n 'en-HK': 'DD/MM/YYYY', // English (Hong Kong)\n 'es-HN': 'DD/MM/YYYY', // Spanish (Honduras)\n 'hr-HR': 'DD.MM.YYYY', // Croatian (Croatia)\n 'ht-HT': 'MM/DD/YYYY', // Haitian (Haiti)\n 'hu-HU': 'YYYY. MM. DD.', // Hungarian (Hungary)\n 'id-ID': 'DD/MM/YYYY', // Indonesian (Indonesia)\n 'he-IL': 'DD/MM/YYYY', // Hebrew (Israel)\n 'en-IN': 'DD-MM-YYYY', // English (India)\n 'en-JM': 'MM/DD/YYYY', // English (Jamaica)\n 'en-KE': 'DD/MM/YYYY', // English (Kenya)\n 'ky-KG': 'DD.MM.YYYY', // Kyrgyz (Kyrgyzstan)\n 'km-KH': 'DD/MM/YYYY', // Khmer (Cambodia)\n 'en-KY': 'MM/DD/YYYY', // English (Cayman Islands)\n 'kk-KZ': 'DD.MM.YYYY', // Kazakh (Kazakhstan)\n 'lo-LA': 'DD/MM/YYYY', // Lao (Laos)\n 'si-LK': 'YYYY-MM-DD', // Sinhala (Sri Lanka)\n 'en-LR': 'MM/DD/YYYY', // English (Liberia)\n 'en-LS': 'DD/MM/YYYY', // English (Lesotho)\n 'ar-MA': 'DD/MM/YYYY', // Arabic (Morocco)\n 'ro-MD': 'DD.MM.YYYY', // Romanian (Moldova)\n 'mk-MK': 'DD.MM.YYYY', // Macedonian (North Macedonia)\n 'my-MM': 'DD/MM/YYYY', // Burmese (Myanmar)\n 'mn-MN': 'YYYY.MM.DD', // Mongolian (Mongolia)\n 'zh-MO': 'DD/MM/YYYY', // Chinese (Macao)\n 'en-MU': 'DD/MM/YYYY', // English (Mauritius)\n 'dv-MV': 'DD/MM/YYYY', // Divehi (Maldives)\n 'en-MW': 'DD/MM/YYYY', // English (Malawi)\n 'es-MX': 'DD/MM/YYYY', // Spanish (Mexico)\n 'ms-MY': 'DD/MM/YYYY', // Malay (Malaysia)\n 'en-NA': 'DD/MM/YYYY', // English (Namibia)\n 'en-NG': 'DD/MM/YYYY', // English (Nigeria)\n 'es-NI': 'DD/MM/YYYY', // Spanish (Nicaragua)\n 'no-NO': 'DD.MM.YYYY', // Norwegian (Norway)\n 'ne-NP': 'YYYY/MM/DD', // Nepali (Nepal)\n 'en-NZ': 'DD/MM/YYYY', // English (New Zealand)\n 'es-PE': 'DD/MM/YYYY', // Spanish (Peru)\n 'en-PG': 'DD/MM/YYYY', // English (Papua New Guinea)\n 'en-PH': 'MM/DD/YYYY', // English (Philippines)\n 'en-PK': 'DD/MM/YYYY', // English (Pakistan)\n 'ar-QA': 'DD/MM/YYYY', // Arabic (Qatar)\n 'ru-RU': 'DD.MM.YYYY', // Russian (Russia)\n 'ar-SA': 'DD/MM/YYYY', // Arabic (Saudi Arabia)\n 'en-SC': 'DD/MM/YYYY', // English (Seychelles)\n 'sv-SE': 'YYYY-MM-DD', // Swedish (Sweden)\n 'en-SG': 'DD/MM/YYYY', // English (Singapore)\n 'en-SL': 'DD/MM/YYYY', // English (Sierra Leone)\n 'so-SO': 'DD/MM/YYYY', // Somali (Somalia)\n 'en-SS': 'DD/MM/YYYY', // English (South Sudan)\n 'es-SV': 'DD/MM/YYYY', // Spanish (El Salvador)\n 'en-SZ': 'DD/MM/YYYY', // English (Eswatini)\n 'th-TH': 'DD/MM/YYYY', // Thai (Thailand)\n 'en-TT': 'MM/DD/YYYY', // English (Trinidad and Tobago)\n 'sw-TZ': 'DD/MM/YYYY', // Swahili (Tanzania)\n 'en-US': 'MM/DD/YYYY', // English (United States)\n 'es-UY': 'DD/MM/YYYY', // Spanish (Uruguay)\n 'uz-UZ': 'DD/MM/YYYY', // Uzbek (Uzbekistan)\n 'ar-YE': 'DD/MM/YYYY', // Arabic (Yemen)\n 'en-ZA': 'YYYY/MM/DD', // English (South Africa)\n 'ar-KW': 'DD/MM/YYYY', // Arabic (Kuwait)\n 'ar-BH': 'DD/MM/YYYY', // Arabic (Bahrain)\n 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman)\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Parses a date string based on a specific format.\n *\n * @param dateString The date string to parse.\n * @param format The format to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDateWithFormat = (\n dateString: string,\n format: string,\n): Date | null => {\n // Determine the separator based on the format (supports '/', '.', or '-')\n const separator = format.includes('/')\n ? '/'\n : format.includes('.')\n ? '.'\n : '-';\n const formatParts = format.split(separator);\n const dateParts = dateString.split(separator).map((num) => parseInt(num, 10));\n\n let year: number = 0,\n month: number = 0,\n day: number = 0;\n let yearSet: boolean = false,\n monthSet: boolean = false,\n daySet: boolean = false;\n\n // Check for format and date string mismatch\n if (dateParts.length !== formatParts.length) {\n return null; // Mismatch between date string and format\n }\n\n formatParts.forEach((part, index) => {\n // Check for non-numeric values in date string\n if (isNaN(dateParts[index])) {\n return null; // Invalid date part\n }\n\n // Assign year, month, and day based on the format\n switch (part) {\n case 'DD':\n day = dateParts[index];\n daySet = true;\n break;\n case 'MM':\n month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date\n monthSet = true;\n break;\n case 'YYYY':\n year = dateParts[index];\n yearSet = true;\n break;\n }\n });\n\n // Validate and create the date only if all parts are set\n if (yearSet && monthSet && daySet) {\n const parsedDate = new Date(year, month, day);\n // Validate date to catch invalid dates like February 30th\n if (\n parsedDate.getFullYear() === year &&\n parsedDate.getMonth() === month &&\n parsedDate.getDate() === day\n ) {\n return parsedDate;\n }\n }\n return null; // Invalid date or incomplete date information\n};\n\nexport default withErrorBoundary(\n parseDateWithFormat,\n);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { LOCALE_DATE_FORMATS } from './data/localeDateFormats';\nimport parseDateWithFormat from './parseDateWithFormat';\nimport { Locale } from './types';\n\n/**\n * Attempts to parse a string into a date object based on locale.\n * Uses the localeDateFormats mapping for determining the date format.\n *\n * @param dateString - The date string to parse.\n * @param locale - The locale to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDate = (dateString: string, locale: Locale): Date | null => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const format = LOCALE_DATE_FORMATS[locale];\n if (!format) {\n throw new Error(`No date format found for locale: ${locale}`);\n }\n return parseDateWithFormat(dateString, format);\n};\n\nexport default withErrorBoundary(parseDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport add from './add';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Subtracts a specified amount of time from a date.\n *\n * @param date The original date.\n * @param value The amount to subtract.\n * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time subtracted.\n */\nconst subtract = (\n date: DateInput,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n return add(date, -value, unit); // Reuse the add function with negative value\n};\n\nexport default withErrorBoundary(subtract);\n"],"names":["formatDateTime","parseDateWithFormat","add"],"mappings":"AAAA;AACM,MAAO,YAAa,SAAQ,KAAK,CAAA;AAErC,IAAA,WAAA,CAAY,OAA2B,EAAA;QACrC,KAAK,CAAC,OAAO,CAAC,CAAC;AACf,QAAA,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;AAC5B,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;;KAE7B;AACF,CAAA;AAED;;;;;;;;AAQG;AACI,MAAM,iBAAiB,GAAG,CAC/B,EAAK,KAC0C;IAC/C,OAAO,UAAyB,GAAG,IAAm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AAE,MAAM,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC,MAAM,IAAI,SAAS,EAAE,CAAC;AAE7D,IAAA,MAAM,MAAM,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC3C,IAAI,CAAC,MAAM,EAAE;AACX,QAAA,MAAM,IAAI,KAAK,CAAC,oCAAoC,MAAM,CAAA,CAAE,CAAC,CAAC;AAC/D,KAAA;AACD,IAAA,OAAOC,qBAAmB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC,CAAC;AAEF,kBAAe,iBAAiB,CAAmB,SAAS,CAAC;;ACzB7D;;;;;;;AAOG;AACH,MAAM,QAAQ,GAAG,CACf,IAAe,EACf,KAAa,EACb,IAAiC,KACzB;IACR,IAAI;QACF,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;IAE3E,OAAOC,KAAG,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACjC,CAAC,CAAC;AAEF,iBAAe,iBAAiB,CAAkB,QAAQ,CAAC;;;;"} \ No newline at end of file diff --git a/lib/esm/index.js b/lib/esm/index.js index 30bf12f0..5307d378 100644 --- a/lib/esm/index.js +++ b/lib/esm/index.js @@ -1017,6 +1017,128 @@ const parsePhoneNumber = (phoneNumber, country) => { }; var parsePhoneNumber$1 = withErrorBoundary(parsePhoneNumber); +const stringToDate = (dateString) => { + const supportedDateFormats = [ + // Date formats + { + regex: /^(\d{4})\/(\d{2})\/(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, + { + regex: /^(\d{2})\/(\d{2})\/(\d{4})$/, + yearIndex: 3, + monthIndex: 2, + dayIndex: 1, + }, + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, + // Timestamp formats + { + regex: /^(\d{4})\/(\d{2})\/(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, + { + regex: /^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 3, + monthIndex: 2, + dayIndex: 1, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, + { + regex: /^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, + { + regex: /^(\d{2})-(\d{2})-(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 3, + monthIndex: 2, + dayIndex: 1, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, + { + regex: /^(\d{4})\.(\d{2})\.(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, + { + regex: /^(\d{2})\.(\d{2})\.(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 3, + monthIndex: 2, + dayIndex: 1, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, // DD.MM.YYYY HH:MM:SS + ]; + for (const format of supportedDateFormats) { + const match = dateString.match(format.regex); + if (match) { + const year = match[format.yearIndex]; + const month = match[format.monthIndex]; + const day = match[format.dayIndex]; + const hour = format.hourIndex ? match[format.hourIndex] : '00'; + const minute = format.minuteIndex ? match[format.minuteIndex] : '00'; + const second = format.secondIndex ? match[format.secondIndex] : '00'; + return new Date(`${year}-${month}-${day}T${hour}:${minute}:${second}`); + } + } + throw new Error('Date format not recognized'); +}; + /** * Adds a specified amount of time to a date. * @@ -1026,19 +1148,20 @@ var parsePhoneNumber$1 = withErrorBoundary(parsePhoneNumber); * @returns A new Date object with the time added. */ const add = (date, value, unit) => { - const result = new Date(date); + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); switch (unit) { case 'days': - result.setDate(result.getDate() + value); + date.setDate(date.getDate() + value); break; case 'months': - result.setMonth(result.getMonth() + value); + date.setMonth(date.getMonth() + value); break; case 'years': - result.setFullYear(result.getFullYear() + value); + date.setFullYear(date.getFullYear() + value); break; } - return result; + return date; }; var add$1 = withErrorBoundary(add); @@ -1049,7 +1172,7 @@ var add$1 = withErrorBoundary(add); * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional). * @returns {string} Formatted date and time string. */ -const formatDateTime = (date, locale, options = {}) => { +const formatDateTime = (date, locale, intlOptions = {}) => { /** retrieve locale from below areas in order of preference * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) * 2. i18nState.locale (uses locale set globally) @@ -1057,10 +1180,12 @@ const formatDateTime = (date, locale, options = {}) => { * */ if (!locale) locale = state.getState().locale || getLocale(); + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); const dateObj = date instanceof Date ? date : new Date(date); let formatter; try { - formatter = new Intl.DateTimeFormat(locale, options); + formatter = new Intl.DateTimeFormat(locale, intlOptions); } catch (err) { if (err instanceof Error) { @@ -1142,9 +1267,10 @@ var formatTime$1 = withErrorBoundary(formatTime); * Gets the first day of the week for a given locale. * * @param locale The locale to determine the first day of the week for. + * @param intlOptions Optional Intl.DateTimeFormatOptions for customization. * @returns The first day of the week (0-6, where 0 is Sunday). */ -const getFirstDayOfWeek = (locale) => { +const getFirstDayOfWeek = (locale, intlOptions = {}) => { /** retrieve locale from below areas in order of preference * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) * 2. i18nState.locale (uses locale set globally) @@ -1153,10 +1279,17 @@ const getFirstDayOfWeek = (locale) => { if (!locale) locale = state.getState().locale || getLocale(); let formatted; + if (!intlOptions.weekday) + intlOptions.weekday = 'long'; try { - const formatter = new Intl.DateTimeFormat(locale, { weekday: 'short' }); - const sampleDate = new Date(2000, 0, 2); // A Sunday - formatted = formatter.format(sampleDate); + const formatter = new Intl.DateTimeFormat(locale, intlOptions); + /** + * This date was chosen because January 2, 2000, is a Sunday. + * In the Gregorian calendar, Sunday is considered the start of the week in some cultures (like in the United States), while in others, it's Monday (like in much of Europe). + * By using a date that is known to be a Sunday, the function can accurately determine what day of the week is considered the start in the specified locale. + */ + const sundayDate = new Date(2000, 0, 2); // A known Sunday + formatted = formatter.format(sundayDate); } catch (err) { if (err instanceof Error) { @@ -1166,7 +1299,13 @@ const getFirstDayOfWeek = (locale) => { throw new Error(`An unknown error occurred = ${err}`); } } - return ['su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'].indexOf(formatted.slice(0, 2).toLowerCase()); + // Generate localized weekdays array starting from Sunday + const weekdays = Array.from({ length: 7 }, (_, i) => new Intl.DateTimeFormat(locale, intlOptions).format(new Date(2000, 0, 2 + i))); + const firstDayIndex = weekdays.indexOf(formatted); + if (firstDayIndex === -1) { + throw new Error('Unable to determine the first day of the week'); + } + return weekdays[(firstDayIndex + 1) % 7]; // Adjusting since our reference date is a Sunday }; var getFirstDayOfWeek$1 = withErrorBoundary(getFirstDayOfWeek); @@ -1177,6 +1316,8 @@ var getFirstDayOfWeek$1 = withErrorBoundary(getFirstDayOfWeek); * @returns The quarter of the year (1-4). */ const getQuarter = (date) => { + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); return Math.ceil((date.getMonth() + 1) / 3); }; var getQuarter$1 = withErrorBoundary(getQuarter); @@ -1194,6 +1335,12 @@ var getQuarter$1 = withErrorBoundary(getQuarter); * @returns The relative time as a string. */ const getRelativeTime = (date, baseDate = new Date(), locale, options) => { + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); + baseDate = + typeof baseDate === 'string' + ? new Date(stringToDate(baseDate)) + : new Date(baseDate); /** retrieve locale from below areas in order of preference * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) * 2. i18nState.locale (uses locale set globally) @@ -1263,6 +1410,8 @@ var getRelativeTime$1 = withErrorBoundary(getRelativeTime); * @returns The week number of the year. */ const getWeek = (date) => { + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); const firstDayOfYear = new Date(date.getFullYear(), 0, 1); const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000; return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7); @@ -1273,9 +1422,10 @@ var getWeek$1 = withErrorBoundary(getWeek); * Returns an array of weekdays according to the specified locale. * * @param locale The locale to get weekdays for. + * @param intlOptions Optional Intl.DateTimeFormatOptions for customization. * @returns An array of weekday names. */ -const getWeekdays = (locale) => { +const getWeekdays = (locale, intlOptions = {}) => { try { /** retrieve locale from below areas in order of preference * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) @@ -1284,7 +1434,15 @@ const getWeekdays = (locale) => { * */ if (!locale) locale = state.getState().locale || getLocale(); - const formatter = new Intl.DateTimeFormat(locale, { weekday: 'long' }); + if (!intlOptions.weekday) + intlOptions.weekday = 'long'; + const formatter = new Intl.DateTimeFormat(locale, intlOptions); + /** The date January 1, 1970, is a well-known reference point in computing known as the Unix epoch. + * It's the date at which time is measured for Unix systems, making it a consistent and reliable choice for date calculations. + * The choice of the date January 4, 1970, as the starting point is significant. + * January 4, 1970, was a Sunday. + * Since weeks typically start on Sunday or Monday in most locales, starting from a known Sunday allows the function to cycle through a complete week, capturing all weekdays in the order they appear for the given locale. + * */ return Array.from({ length: 7 }, (_, i) => formatter.format(new Date(1970, 0, 4 + i))); } catch (err) { @@ -1305,6 +1463,10 @@ var getWeekdays$1 = withErrorBoundary(getWeekdays); * @returns {boolean} True if date1 is after date2. */ const isAfter = (date1, date2) => { + date1 = + typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1); + date2 = + typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2); const dateObj1 = date1 instanceof Date ? date1 : new Date(date1); const dateObj2 = date2 instanceof Date ? date2 : new Date(date2); return dateObj1 > dateObj2; @@ -1318,6 +1480,10 @@ var isAfter$1 = withErrorBoundary(isAfter); * @returns {boolean} True if date1 is before date2. */ const isBefore = (date1, date2) => { + date1 = + typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1); + date2 = + typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2); const dateObj1 = date1 instanceof Date ? date1 : new Date(date1); const dateObj2 = date2 instanceof Date ? date2 : new Date(date2); return dateObj1 < dateObj2; @@ -1343,6 +1509,10 @@ var isLeapYear$1 = withErrorBoundary(isLeapYear); * @returns True if both dates are on the same day, false otherwise. */ const isSameDay = (date1, date2) => { + date1 = + typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1); + date2 = + typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2); return (date1.getDate() === date2.getDate() && date1.getMonth() === date2.getMonth() && date1.getFullYear() === date2.getFullYear()); @@ -1356,6 +1526,18 @@ var isSameDay$1 = withErrorBoundary(isSameDay); * @returns True if the object is a valid Date, false otherwise. */ const isValidDate = (date) => { + try { + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } return date instanceof Date && !isNaN(date.getTime()); }; var isValidDate$1 = withErrorBoundary(isValidDate); @@ -1548,6 +1730,8 @@ var parseDate$1 = withErrorBoundary(parseDate); * @returns A new Date object with the time subtracted. */ const subtract = (date, value, unit) => { + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); return add$1(date, -value, unit); // Reuse the add function with negative value }; var subtract$1 = withErrorBoundary(subtract); diff --git a/lib/esm/index.js.map b/lib/esm/index.js.map index 84bb68f9..1d363bef 100644 --- a/lib/esm/index.js.map +++ b/lib/esm/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sources":["../../src/common/errorBoundary/index.ts","../../src/modules/.internal/utils/getDefaultState.ts","../../src/modules/.internal/state/index.ts","../../src/modules/core/getState.ts","../../src/modules/core/setState.ts","../../src/modules/core/resetState.ts","../../src/modules/.internal/utils/getLocale.ts","../../src/modules/.internal/utils/getIntlInstanceWithOptions.ts","../../src/modules/currency/formatNumber.ts","../../src/modules/currency/data/currencies.ts","../../src/modules/currency/getCurrencyList.ts","../../src/modules/currency/getCurrencySymbol.ts","../../src/modules/currency/constants.ts","../../src/modules/currency/formatNumberByParts.ts","../../src/modules/phoneNumber/data/phoneRegexMapper.ts","../../src/modules/phoneNumber/data/dialCodeMapper.ts","../../src/modules/phoneNumber/utils.ts","../../src/modules/phoneNumber/isValidPhoneNumber.ts","../../src/modules/phoneNumber/data/phoneFormatterMapper.ts","../../src/modules/phoneNumber/formatPhoneNumber.ts","../../src/modules/phoneNumber/parsePhoneNumber.ts","../../src/modules/dateTime/add.ts","../../src/modules/dateTime/formatDateTime.ts","../../src/modules/dateTime/formatDate.ts","../../src/modules/dateTime/formatTime.ts","../../src/modules/dateTime/getFirstDayOfWeek.ts","../../src/modules/dateTime/getQuarter.ts","../../src/modules/dateTime/getRelativeTime.ts","../../src/modules/dateTime/getWeek.ts","../../src/modules/dateTime/getWeekdays.ts","../../src/modules/dateTime/isAfter.ts","../../src/modules/dateTime/isBefore.ts","../../src/modules/dateTime/isLeapYear.ts","../../src/modules/dateTime/isSameDay.ts","../../src/modules/dateTime/isValidDate.ts","../../src/modules/dateTime/data/localeDateFormats.ts","../../src/modules/dateTime/parseDateWithFormat.ts","../../src/modules/dateTime/parseDate.ts","../../src/modules/dateTime/subtract.ts"],"sourcesContent":["// Custom Error class to extend properties to error object\nexport class I18nifyError extends Error {\n timestamp: Date;\n constructor(message: string | undefined) {\n super(message);\n this.name = 'i18nify Error';\n this.timestamp = new Date();\n // more params like type of error/severity can be added in future for better debugging.\n }\n}\n\n/**\n * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block.\n * It appends additional attributes and serves as a centralized error-handling service.\n * Usage =>\n * const wrappedUtilityFn = withErrorBoundary(utilityFn)\n *\n * @param fn utility that is wrapped in error boundary\n * @returns {Function} returns the function wrapped in try/catch block\n */\nexport const withErrorBoundary = any>(\n fn: T,\n): ((...args: Parameters) => ReturnType) => {\n return function (this: unknown, ...rest: Parameters): ReturnType {\n try {\n return fn.call(this, ...rest) as ReturnType;\n } catch (err) {\n console.warn('[I18N Error]: ', err);\n // Currently, we are throwing the error as it is to consumers.\n // In the future, this can be modified as per our requirement, like an error logging service.\n throw new I18nifyError(err as string | undefined);\n }\n };\n};\n","import type { I18nState } from '../state/types';\n\nexport function getDefaultState(): I18nState {\n return {\n locale: '',\n direction: '',\n country: '',\n };\n}\n","import { I18nState } from './types';\nimport { getDefaultState } from '../utils/getDefaultState';\n\nexport class I18nStateManager {\n private static instance: I18nStateManager | undefined;\n private state: I18nState;\n\n private constructor() {\n this.state = getDefaultState();\n }\n\n public static getInstance(): I18nStateManager {\n if (!I18nStateManager.instance) {\n I18nStateManager.instance = new I18nStateManager();\n }\n\n return I18nStateManager.instance;\n }\n\n public static resetInstance(): void {\n I18nStateManager.instance = undefined;\n }\n\n public getState(): I18nState {\n return { ...this.state };\n }\n\n public setState(newState: Partial): void {\n this.state = { ...this.state, ...newState };\n }\n\n public resetState(): void {\n this.state = getDefaultState();\n }\n}\n\nexport default I18nStateManager.getInstance();\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * function to return active i18n state\n *\n * ===== USAGE =====\n * import { getState } from '@razorpay/i18nify-js';\n *\n * console.log(getState())\n *\n * @returns i18n state\n */\nconst getState = (): I18nState => {\n return state.getState();\n};\n\nexport default withErrorBoundary(getState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * Function to set and override the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { setState } from \"@razorpay/i18nify-js\";\n * setState({locale: 'en-US'})\n *\n * @param newState data to set in i18nState instance\n */\nconst setState = (newState: Partial): void => {\n state.setState(newState);\n};\n\nexport default withErrorBoundary(setState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\n\n/**\n * Function to reset the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { resetState } from \"@razorpay/i18nify-js\";\n * resetState()\n *\n * @param newState data to set in i18nState instance\n */\nconst resetState = (): void => {\n state.resetState();\n};\n\nexport default withErrorBoundary(resetState);\n","export const getLocale = (): string => {\n // Check if running in a non-browser environment (e.g., Node.js or older browsers).\n if (typeof navigator === 'undefined') {\n return 'en-IN';\n }\n\n // Check if the browser supports the Intl object and user language preferences.\n if (\n window.Intl &&\n typeof window.Intl === 'object' &&\n (window.navigator.languages || window.navigator.language)\n ) {\n const userLocales = window.navigator.languages || [\n window.navigator.language,\n ];\n return userLocales[0];\n }\n\n // Fallback to a supported locale or the default locale.\n return 'en-IN';\n};\n","import { CURRENCIES } from '../../currency/data/currencies';\nimport state from '../state';\nimport { getLocale } from './getLocale';\n\nexport const getIntlInstanceWithOptions = (\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n) => {\n /** retrieve locale from below areas in order of preference\n * 1. options.locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n let locale = options?.locale || state.getState().locale;\n\n // If a specific locale is provided, use it; otherwise, use the browser's locale\n if (!locale) {\n locale = getLocale();\n }\n\n const intlOptions = options?.intlOptions ? { ...options.intlOptions } : {};\n\n if (options?.currency || intlOptions.currency) {\n intlOptions.style = 'currency';\n intlOptions.currency = (options.currency || intlOptions.currency) as string;\n }\n\n if (!locale) throw new Error('Pass valid locale !');\n\n return new Intl.NumberFormat(locale || undefined, intlOptions);\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\n\n// this function formats number based on different arguments passed\nconst formatNumber = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): string => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n let formattedAmount = '';\n\n try {\n formattedAmount = getIntlInstanceWithOptions(options).format(\n Number(amount),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedAmount;\n};\n\nexport default withErrorBoundary(formatNumber);\n","export const CURRENCIES: { [key: string]: { symbol: string; name: string } } = {\n AED: { symbol: 'د.إ', name: 'United Arab Emirates Dirham' },\n ALL: { symbol: 'Lek', name: 'Albanian Lek' },\n AMD: { symbol: '֏', name: 'Armenian Dram' },\n ARS: { symbol: 'ARS', name: 'Argentine Peso' },\n AUD: { symbol: 'A$', name: 'Australian Dollar' },\n AWG: { symbol: 'Afl.', name: 'Aruban Florin' },\n BBD: { symbol: '$', name: 'Barbadian Dollar' },\n BDT: { symbol: '৳', name: 'Bangladeshi Taka' },\n BMD: { symbol: '$', name: 'Bermudian Dollar' },\n BND: { symbol: 'BND', name: 'Brunei Dollar' },\n BOB: { symbol: 'Bs', name: 'Bolivian Boliviano' },\n BSD: { symbol: 'B$', name: 'Bahamian Dollar' },\n BWP: { symbol: 'P', name: 'Botswanan Pula' },\n BZD: { symbol: 'BZ$', name: 'Belize Dollar' },\n CAD: { symbol: 'C$', name: 'Canadian Dollar' },\n CHF: { symbol: 'CHf', name: 'Swiss Franc' },\n CNY: { symbol: '¥', name: 'Chinese Yuan' },\n COP: { symbol: 'COL$', name: 'Colombian Peso' },\n CRC: { symbol: '₡', name: 'Costa Rican Colón' },\n CUP: { symbol: '$MN', name: 'Cuban Peso' },\n CZK: { symbol: 'Kč', name: 'Czech Koruna' },\n DKK: { symbol: 'DKK', name: 'Danish Krone' },\n DOP: { symbol: 'RD$', name: 'Dominican Peso' },\n DZD: { symbol: 'د.ج', name: 'Algerian Dinar' },\n EGP: { symbol: 'E£', name: 'Egyptian Pound' },\n ETB: { symbol: 'ብር', name: 'Ethiopian Birr' },\n EUR: { symbol: '€', name: 'Euro' },\n FJD: { symbol: 'FJ$', name: 'Fijian Dollar' },\n GBP: { symbol: '£', name: 'British Pound' },\n GHS: { symbol: 'GH₵', name: 'Ghanaian Cedi' },\n GIP: { symbol: 'GIP', name: 'Gibraltar Pound' },\n GMD: { symbol: 'D', name: 'Gambian Dalasi' },\n GTQ: { symbol: 'Q', name: 'Guatemalan Quetzal' },\n GYD: { symbol: 'G$', name: 'Guyanese Dollar' },\n HKD: { symbol: 'HK$', name: 'Hong Kong Dollar' },\n HNL: { symbol: 'HNL', name: 'Honduran Lempira' },\n HRK: { symbol: 'kn', name: 'Croatian Kuna' },\n HTG: { symbol: 'G', name: 'Haitian Gourde' },\n HUF: { symbol: 'Ft', name: 'Hungarian Forint' },\n IDR: { symbol: 'Rp', name: 'Indonesian Rupiah' },\n ILS: { symbol: '₪', name: 'Israeli New Shekel' },\n INR: { symbol: '₹', name: 'Indian Rupee' },\n JMD: { symbol: 'J$', name: 'Jamaican Dollar' },\n KES: { symbol: 'Ksh', name: 'Kenyan Shilling' },\n KGS: { symbol: 'Лв', name: 'Kyrgystani Som' },\n KHR: { symbol: '៛', name: 'Cambodian Riel' },\n KYD: { symbol: 'CI$', name: 'Cayman Islands Dollar' },\n KZT: { symbol: '₸', name: 'Kazakhstani Tenge' },\n LAK: { symbol: '₭', name: 'Laotian Kip' },\n LKR: { symbol: 'රු', name: 'Sri Lankan Rupee' },\n LRD: { symbol: 'L$', name: 'Liberian Dollar' },\n LSL: { symbol: 'LSL', name: 'Lesotho Loti' },\n MAD: { symbol: 'د.م.', name: 'Moroccan Dirham' },\n MDL: { symbol: 'MDL', name: 'Moldovan Leu' },\n MKD: { symbol: 'ден', name: 'Macedonian Denar' },\n MMK: { symbol: 'MMK', name: 'Myanmar Kyat' },\n MNT: { symbol: '₮', name: 'Mongolian Tugrik' },\n MOP: { symbol: 'MOP$', name: 'Macanese Pataca' },\n MUR: { symbol: '₨', name: 'Mauritian Rupee' },\n MVR: { symbol: 'Rf', name: 'Maldivian Rufiyaa' },\n MWK: { symbol: 'MK', name: 'Malawian Kwacha' },\n MXN: { symbol: 'Mex$', name: 'Mexican Peso' },\n MYR: { symbol: 'RM', name: 'Malaysian Ringgit' },\n NAD: { symbol: 'N$', name: 'Namibian Dollar' },\n NGN: { symbol: '₦', name: 'Nigerian Naira' },\n NIO: { symbol: 'NIO', name: 'Nicaraguan Córdoba' },\n NOK: { symbol: 'NOK', name: 'Norwegian Krone' },\n NPR: { symbol: 'रू', name: 'Nepalese Rupee' },\n NZD: { symbol: 'NZ$', name: 'New Zealand Dollar' },\n PEN: { symbol: 'S/', name: 'Peruvian Nuevo Sol' },\n PGK: { symbol: 'PGK', name: 'Papua New Guinean Kina' },\n PHP: { symbol: '₱', name: 'Philippine Peso' },\n PKR: { symbol: '₨', name: 'Pakistani Rupee' },\n QAR: { symbol: 'QR', name: 'Qatari Riyal' },\n RUB: { symbol: '₽', name: 'Russian Ruble' },\n SAR: { symbol: 'SR', name: 'Saudi Riyal' },\n SCR: { symbol: 'SRe', name: 'Seychellois Rupee' },\n SEK: { symbol: 'SEK', name: 'Swedish Krona' },\n SGD: { symbol: 'S$', name: 'Singapore Dollar' },\n SLL: { symbol: 'Le', name: 'Sierra Leonean Leone' },\n SOS: { symbol: 'Sh.so.', name: 'Somali Shilling' },\n SSP: { symbol: 'SS£', name: 'South Sudanese Pound' },\n SVC: { symbol: '₡', name: 'Salvadoran Colón' },\n SZL: { symbol: 'E', name: 'Swazi Lilangeni' },\n THB: { symbol: '฿', name: 'Thai Baht' },\n TTD: { symbol: 'TT$', name: 'Trinidad and Tobago Dollar' },\n TZS: { symbol: 'Sh', name: 'Tanzanian Shilling' },\n USD: { symbol: '$', name: 'United States Dollar' },\n UYU: { symbol: '$U', name: 'Uruguayan Peso' },\n UZS: { symbol: \"so'm\", name: 'Uzbekistani Som' },\n YER: { symbol: '﷼', name: 'Yemeni Rial' },\n ZAR: { symbol: 'R', name: 'South African Rand' },\n KWD: { symbol: 'د.ك', name: 'Kuwaiti Dinar' },\n BHD: { symbol: 'د.ب.', name: 'Bahraini Dinar' },\n OMR: { symbol: 'ر.ع.', name: 'Omani Rial' },\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencyList = () => {\n return CURRENCIES;\n};\n\nexport default withErrorBoundary(getCurrencyList);\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencySymbol = (currencyCode: keyof typeof CURRENCIES): string => {\n if (currencyCode in CURRENCIES) return CURRENCIES[currencyCode]?.symbol;\n else throw new Error('Invalid currencyCode!');\n};\n\nexport default withErrorBoundary(getCurrencySymbol);\n","export const ALLOWED_FORMAT_PARTS_KEYS = [\n 'nan',\n 'infinity',\n 'percent',\n 'integer',\n 'group',\n 'decimal',\n 'fraction',\n 'plusSign',\n 'minusSign',\n 'percentSign',\n 'currency',\n 'code',\n 'symbol',\n 'name',\n 'compact',\n 'exponentInteger',\n 'exponentMinusSign',\n 'exponentSeparator',\n 'unit',\n] as const;\n","import { CURRENCIES } from './data/currencies';\nimport { ByParts, FormattedPartsObject } from './types';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\nimport { ALLOWED_FORMAT_PARTS_KEYS } from './constants';\n\nconst formatNumberByParts = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): ByParts => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n try {\n const formattedAmount = getIntlInstanceWithOptions(options).formatToParts(\n Number(amount),\n );\n\n const parts = formattedAmount;\n\n const formattedObj: FormattedPartsObject = {};\n\n parts.forEach((p) => {\n if (p.type === 'group') {\n formattedObj.integer = (formattedObj.integer || '') + p.value;\n } else if (\n ALLOWED_FORMAT_PARTS_KEYS.findIndex((item) => item === p.type) != -1\n ) {\n // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal' is skipped\n formattedObj[p.type] = (formattedObj[p.type] || '') + p.value;\n }\n });\n\n return {\n ...formattedObj,\n isPrefixSymbol: parts[0].type === 'currency',\n rawParts: parts,\n };\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(\n formatNumberByParts,\n);\n","export const PHONE_REGEX_MAPPER: { [key: string]: RegExp } = {\n IN: /^(?:(?:\\+|0{0,2})91\\s*[-]?\\s*|[0]?)?[6789]\\d{9}$/,\n MY: /^(\\+?6?0)?(\\d{1,3})[-. ]?(\\d{7,8})$/,\n AE: /^(?:\\+?971|0)?(?:2|3|4|6|7|9)\\d{8}$/,\n AL: /^(?:\\+?355)?(?:[4-9]\\d{7}|6\\d{8})$/,\n AM: /^(?:\\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/,\n AR: /^(?:(?:\\+|0{0,2})54)?(?:11|[2368]\\d)(?:(?=\\d{0,2}15)\\d{2})??\\d{8}$/,\n AU: /^(?:\\+?61|0)4\\d{8}$/,\n AW: /^(?:(?:\\+297)?(?!0)\\d{7})$/,\n BB: /^(?:(?:\\+1)?246)?(?:\\d{3})?\\d{7}$/,\n BD: /^(?:\\+?880|0)1[13456789]\\d{8}$/,\n BM: /^(?:(?:\\+1)?441)?(?:\\d{2})?\\d{7}$/,\n BN: /^(?:\\+?673)?(?:\\d{3})?\\d{4}$/,\n BO: /^(?:(?:\\+|0{0,2})591)?(?:(?:2|3|7|6)\\d{7})$/,\n BS: /^(?:(?:\\+1)?242)?(?:\\d{3})?\\d{7}$/,\n BW: /^(?:(?:\\+267)?\\s?)?[74]\\d{7}$/,\n BZ: /^(?:(?:\\+501)?\\s?)?[622]\\d{4}$/,\n CH: /^(?:(?:\\+41|0)(?:\\s*\\(?0\\)?\\s*))?(?:\\d{2}\\s*)?\\d{3}\\s*\\d{2}\\s*\\d{2}$/,\n CN: /^(?:(?:\\+|00)86)?1\\d{10}$/,\n CO: /^(?:(?:\\+57|0057)?)?[1-8]{1}\\d{6,7}$/,\n OM: /^(?:\\+?968)?(?:95|96|97|98)\\d{6}$/,\n CR: /^(?:(?:\\+506)?\\s*|0)?[1-9]\\d{7}$/,\n CU: /^(?:\\+?53)?(?:[5-8]\\d{7})$/,\n CZ: /^(?:\\+?420)?(?:\\d{9})$/,\n DK: /^(?:\\+?45)?(?:\\d{8})$/,\n DO: /^(?:(?:\\+1)?809|1-8(?:00|88|89))(?:\\d{7})$/,\n DZ: /^(?:\\+?213|0)([567]\\d{8})$/,\n EG: /^(?:(?:\\+20|20)?(\\d{10}))$/,\n ET: /^(?:\\+?251)?[1-59]\\d{8}$/,\n EU: /^(?:(?:\\+?3)?8)?\\s*(?:\\d{3}\\s*){3}\\d{2}$/,\n FJ: /^(?:(?:\\+?679)?\\s?\\d{3}\\s?\\d{4})?$/,\n GB: /^(?:(?:\\+44\\s?|0)7\\d{3}(\\s?\\d{4,})?)$/,\n GH: /^(?:(?:\\+233)|0)?(?:\\d{9})$/,\n GI: /^(?:\\+350)?\\d{5}$/,\n GM: /^(?:\\+220)?\\d{5,7}$/,\n GT: /^(?:\\+502)?[2468]\\d{7,8}$/,\n GY: /^(?:(?:\\+592)?(?:(?:\\s)?[2-9])(?:(?:\\s)?\\d))?(?:(?:\\s)?\\d{4})$/,\n HK: /^(?:\\+852\\s?)?[456789]\\d{3}\\s?\\d{4}$/,\n HN: /^(?:\\+504)?[89]\\d{7}$/,\n HR: /^(?:\\+?385)?\\d{8,9}$/,\n HT: /^(?:\\+?509)?\\d{8}$/,\n HU: /^(?:(?:\\+36))(\\s?\\d{2}\\s?\\d{3}\\s?\\d{4})$/,\n ID: /^(?:\\+?62|0[1-9])[\\s-]?\\d{2,4}[\\s-]?\\d{3,4}[\\s-]?\\d{3,4}$/,\n IL: /^(?:(?:\\+972|0)(?:-)?)[23489]\\d{7}$/,\n JM: /^(?:(?:\\+1876))\\d{7,10}$/,\n KE: /^(?:(?:\\+254)|(?:0))(?:\\d{6,7})$/,\n KG: /^(?:\\+996)?\\s?\\d{9}$/,\n KH: /^(?:(?:\\+855)|(?:0))(?:\\s?[1-9]\\d{7,8})$/,\n KY: /^(?:\\+?1\\s?(345))\\d{6}$/,\n KZ: /^(?:\\+?7|8)?7\\d{9}$/,\n LA: /^(?:(?:\\+?856)|0)(20\\d{7,9})$/,\n LK: /^(?:(?:\\+94)|0)(?:\\d{9})$/,\n LR: /^(?:\\+231)[ -\\d]{4}[ -\\d]{4}$/,\n LS: /^(?:(?:\\+?266)|0)?[56]\\d{7}$/,\n MA: /^(?:(?:\\+?212(\\s*[-|\\s*]?\\d{1,9})?)|(?:0))(?:\\d{9})$/,\n MD: /^(?:(?:\\+373)|(?:0))(?:\\d{7,8})$/,\n MK: /^(?:\\+389|0)(?:(?:2[0-4]|[3-9])\\s?)?\\d{6}$/,\n MM: /^(?:(?:\\+?95)|0)?[1-9]\\d{9}$/,\n MN: /^(?:\\+976|0)\\d{8}$/,\n MO: /^(?:(?:\\+?853)|[0-9])?\\d{8}$/,\n MU: /^(?:\\+230|0)?\\d{8}$/,\n MV: /^(?:(?:\\+?960)|0)?\\d{7}$/,\n MW: /^(?:\\+265)[1-9]\\d{6}$/,\n MX: /^(?:(?:\\+?52)?\\s?(?:1|01)?\\s?)?(?:\\d{3}\\s?\\d{3}\\s?\\d{4})$/,\n NA: /^(?:(?:\\+264)|0)?\\d{8}$/,\n NG: /^(?:(?:\\+234)|(?:0))(?:\\d{7,8})$/,\n NI: /^(?:(?:\\+505))?(?:\\d{8})$/,\n NO: /^(?:(?:\\+?47)|\\d{2}|\\d{3})\\s?\\d{2}\\s?\\d{3}$/,\n NP: /^(?:(?:\\+977))?(\\d{9,10})$/,\n NZ: /^(?:\\+?64|0)(\\d{2,5} \\d{4,8}|\\d{3,4} \\d{4})$/,\n PE: /^(?:(?:\\+51)|0)?(?:9\\d{8})$/,\n PG: /^(?:\\+?675)?(?:[7-9]\\d{7})$/,\n PH: /^(?:(?:\\+?63)|0)(?:\\d{10})$/,\n PK: /^(?:(?:\\+92)|0)?[345]\\d{9}$/,\n QA: /^(?:\\+?974)?-?33\\d{5}$/,\n RU: /^(?:\\+?7|8)?[ -]?\\(?9\\d{2}\\)?[ -]?\\d{3}[ -]?\\d{2}[ -]?\\d{2}$/,\n SA: /^(?:\\+?966)?\\s?1?[\\s-]?(?:[45]\\d{2}|5\\d{3})[\\s-]?\\d{4}$/,\n SC: /^(?:(?:\\+248)|\\d{4})\\d{5}$/,\n SE: /^(?:\\+?46|0)\\s?[1-57-9](?:[0-9]\\s?){8}$/,\n SG: /^(?:(?:\\+65)|(?:\\(\\+65\\))|(?:65))\\d{4}\\d{4}$/,\n SL: /^(?:(?:\\+232)|(?:0))?\\d{9}$/,\n SO: /^(?:\\+252|0)?[567]\\d{7}$/,\n SS: /^(?:\\+211|0)?[1-9]\\d{7,9}$/,\n SV: /^(?:(?:\\+?503)|(?:0))(?:\\d{8})$/,\n SZ: /^(?:\\+?268)?\\d{7,8}$/,\n TH: /^(?:(?:\\+66)|0)\\d{9}$/,\n TT: /^(?:(?:\\+?1-868)|\\(?868\\)?)(\\d{7})$/,\n TZ: /^(?:(?:\\+?255)|0)?[67]\\d{8}$/,\n US: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n CA: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n UY: /^(?:(?:\\+598|0)\\s?(9\\d{3}|2\\d{2}|[4-9]\\d{6}))$/,\n UZ: /^(?:\\+?998)?\\s?[3456789]\\d{8}$/,\n YE: /^(?:\\+?967)?(?:\\d{7,8})$/,\n ZA: /^(?:(?:\\+27)|0)(\\d{9})$/,\n KW: /^(?:\\+?965)[569]\\d{7}$/,\n BH: /^(?:\\+?973)?[356]\\d{7}$/,\n TL: /^(?:(?:\\+670)\\s?)?[0-9]{3}\\s?[0-9]{3,4}$/,\n VC: /^(?:(?:\\+1)?784)?(?:\\d{3})?\\d{7}$/,\n VE: /^(?:(?:\\+58)|0)?4\\d{9}$/,\n VN: /^(?:(?:\\+84)|0)?[1-9]\\d{8}$/,\n ZM: /^(?:(?:\\+260)|0)?[123456789]\\d{8,9}$/,\n ZW: /^(?:(?:\\+263)|0)?(?:\\d{9,10})$/,\n LT: /^(?:(?:\\+370)|8)\\d{8}$/,\n LU: /^(?:(?:\\+352)?(6|2(6|7|8|9))\\d{6})$/,\n LV: /^(?:(?:\\+371)?2\\d{7})$/,\n ME: /^(?:(?:\\+382)?[67]\\d{7,20})$/,\n MG: /^(?:(?:\\+261)?3[234568]\\d{7})$/,\n MZ: /^(?:(?:\\+258)|(?:258))?8[234567]\\d{7,8}$/,\n NL: /^(?:(?:\\+31)|0(6(?:\\d{8})|[1-9](?:(?:\\d{8})|(?:\\s\\d{3}\\s\\d{4}))|(?:\\d{8})))$/,\n PA: /^(?:(?:\\+507)\\s?)?[46]\\d{6,7}$/,\n PL: /^(?:(?:\\+48)?(?:\\s?\\d{3}\\s?\\d{3}\\s?\\d{3}|(?:\\d{2}\\s?){4}\\d{2}|\\d{3}-\\d{3}-\\d{3}))$/,\n PR: /^(?:(?:\\+1)?787|939)\\d{7}$/,\n PS: /^(?:(?:\\+970))(5[2349])\\d{7}$/,\n PT: /^(?:(?:\\+351)?9(1\\d|2[1-9]|6[12345789]|7[12345789])\\d{7})$/,\n PY: /^(?:(?:\\+595|0)9[9876]\\d{7})$/,\n RO: /^(?:(?:\\+40|0))(?:7[2-8]\\d{7}|21\\d{8})$/,\n RS: /^(?:(?:\\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/,\n RW: /^(?:(?:\\+250)|(0))\\d{9}$/,\n SI: /^(?:(?:\\+386)|0)?[1-59]\\d{7,8}$/,\n SK: /^(?:(?:\\+421))?(0|9[0-8])\\d{8}$/,\n SM: /^(?:(?:\\+378)|(0549|6\\d{4}))\\d{5}$/,\n SN: /^(?:(?:\\+221)|0)?[3679]\\d{7}$/,\n SR: /^(?:(?:\\+597))\\d{7}$/,\n TG: /^(?:(?:\\+228))\\d{8}$/,\n TJ: /^(?:(?:\\+992))(37|55|77)\\d{7}$/,\n TN: /^(?:(?:\\+216)|22|9[1-9])\\d{7}$/,\n TR: /^(?:(?:\\+90)|(0))\\s?5\\d{9}$/,\n TW: /^(?:(?:\\+886)|0)?9\\d{8}$/,\n UA: /^(?:(?:\\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\\d{7}$/,\n UG: /^(?:(?:\\+256)|0)?[39]\\d{8}$/,\n};\n","/* Source: Google LibPhoneNumber Metadata: https://github.com/google/libphonenumber/blob/master/javascript/i18n/phonenumbers/metadata.js */\n\nexport const DIAL_CODE_MAPPER: { [key: number]: string[] } = {\n 1: [\n 'US',\n 'AG',\n 'AI',\n 'AS',\n 'BB',\n 'BM',\n 'BS',\n 'CA',\n 'DM',\n 'DO',\n 'GD',\n 'GU',\n 'JM',\n 'KN',\n 'KY',\n 'LC',\n 'MP',\n 'MS',\n 'PR',\n 'SX',\n 'TC',\n 'TT',\n 'VC',\n 'VG',\n 'VI',\n ],\n 7: ['RU', 'KZ'],\n 20: ['EG'],\n 27: ['ZA'],\n 30: ['GR'],\n 31: ['NL'],\n 32: ['BE'],\n 33: ['FR'],\n 34: ['ES'],\n 36: ['HU'],\n 39: ['IT', 'VA'],\n 40: ['RO'],\n 41: ['CH'],\n 43: ['AT'],\n 44: ['GB', 'GG', 'IM', 'JE'],\n 45: ['DK'],\n 46: ['SE'],\n 47: ['NO', 'SJ'],\n 48: ['PL'],\n 49: ['DE'],\n 51: ['PE'],\n 52: ['MX'],\n 53: ['CU'],\n 54: ['AR'],\n 55: ['BR'],\n 56: ['CL'],\n 57: ['CO'],\n 58: ['VE'],\n 60: ['MY'],\n 61: ['AU', 'CC', 'CX'],\n 62: ['ID'],\n 63: ['PH'],\n 64: ['NZ'],\n 65: ['SG'],\n 66: ['TH'],\n 81: ['JP'],\n 82: ['KR'],\n 84: ['VN'],\n 86: ['CN'],\n 90: ['TR'],\n 91: ['IN'],\n 92: ['PK'],\n 93: ['AF'],\n 94: ['LK'],\n 95: ['MM'],\n 98: ['IR'],\n 211: ['SS'],\n 212: ['MA', 'EH'],\n 213: ['DZ'],\n 216: ['TN'],\n 218: ['LY'],\n 220: ['GM'],\n 221: ['SN'],\n 222: ['MR'],\n 223: ['ML'],\n 224: ['GN'],\n 225: ['CI'],\n 226: ['BF'],\n 227: ['NE'],\n 228: ['TG'],\n 229: ['BJ'],\n 230: ['MU'],\n 231: ['LR'],\n 232: ['SL'],\n 233: ['GH'],\n 234: ['NG'],\n 235: ['TD'],\n 236: ['CF'],\n 237: ['CM'],\n 238: ['CV'],\n 239: ['ST'],\n 240: ['GQ'],\n 241: ['GA'],\n 242: ['CG'],\n 243: ['CD'],\n 244: ['AO'],\n 245: ['GW'],\n 246: ['IO'],\n 247: ['AC'],\n 248: ['SC'],\n 249: ['SD'],\n 250: ['RW'],\n 251: ['ET'],\n 252: ['SO'],\n 253: ['DJ'],\n 254: ['KE'],\n 255: ['TZ'],\n 256: ['UG'],\n 257: ['BI'],\n 258: ['MZ'],\n 260: ['ZM'],\n 261: ['MG'],\n 262: ['RE', 'YT'],\n 263: ['ZW'],\n 264: ['NA'],\n 265: ['MW'],\n 266: ['LS'],\n 267: ['BW'],\n 268: ['SZ'],\n 269: ['KM'],\n 290: ['SH', 'TA'],\n 291: ['ER'],\n 297: ['AW'],\n 298: ['FO'],\n 299: ['GL'],\n 350: ['GI'],\n 351: ['PT'],\n 352: ['LU'],\n 353: ['IE'],\n 354: ['IS'],\n 355: ['AL'],\n 356: ['MT'],\n 357: ['CY'],\n 358: ['FI', 'AX'],\n 359: ['BG'],\n 370: ['LT'],\n 371: ['LV'],\n 372: ['EE'],\n 373: ['MD'],\n 374: ['AM'],\n 375: ['BY'],\n 376: ['AD'],\n 377: ['MC'],\n 378: ['SM'],\n 380: ['UA'],\n 381: ['RS'],\n 382: ['ME'],\n 383: ['XK'],\n 385: ['HR'],\n 386: ['SI'],\n 387: ['BA'],\n 389: ['MK'],\n 420: ['CZ'],\n 421: ['SK'],\n 423: ['LI'],\n 500: ['FK'],\n 501: ['BZ'],\n 502: ['GT'],\n 503: ['SV'],\n 504: ['HN'],\n 505: ['NI'],\n 506: ['CR'],\n 507: ['PA'],\n 508: ['PM'],\n 509: ['HT'],\n 590: ['GP', 'BL', 'MF'],\n 591: ['BO'],\n 592: ['GY'],\n 593: ['EC'],\n 594: ['GF'],\n 595: ['PY'],\n 596: ['MQ'],\n 597: ['SR'],\n 598: ['UY'],\n 599: ['CW', 'BQ'],\n 670: ['TL'],\n 672: ['NF'],\n 673: ['BN'],\n 674: ['NR'],\n 675: ['PG'],\n 676: ['TO'],\n 677: ['SB'],\n 678: ['VU'],\n 679: ['FJ'],\n 680: ['PW'],\n 681: ['WF'],\n 682: ['CK'],\n 683: ['NU'],\n 685: ['WS'],\n 686: ['KI'],\n 687: ['NC'],\n 688: ['TV'],\n 689: ['PF'],\n 690: ['TK'],\n 691: ['FM'],\n 692: ['MH'],\n 800: ['001'],\n 808: ['001'],\n 850: ['KP'],\n 852: ['HK'],\n 853: ['MO'],\n 855: ['KH'],\n 856: ['LA'],\n 870: ['001'],\n 878: ['001'],\n 880: ['BD'],\n 881: ['001'],\n 882: ['001'],\n 883: ['001'],\n 886: ['TW'],\n 888: ['001'],\n 960: ['MV'],\n 961: ['LB'],\n 962: ['JO'],\n 963: ['SY'],\n 964: ['IQ'],\n 965: ['KW'],\n 966: ['SA'],\n 967: ['YE'],\n 968: ['OM'],\n 970: ['PS'],\n 971: ['AE'],\n 972: ['IL'],\n 973: ['BH'],\n 974: ['QA'],\n 975: ['BT'],\n 976: ['MN'],\n 977: ['NP'],\n 979: ['001'],\n 992: ['TJ'],\n 993: ['TM'],\n 994: ['AZ'],\n 995: ['GE'],\n 996: ['KG'],\n 998: ['UZ'],\n};\n","import { DIAL_CODE_MAPPER } from './data/dialCodeMapper';\nimport { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\n\n/**\n * Determines the country code based on the provided phone number.\n * This function employs a multi-step approach to identify the country code:\n * - If the phone number starts with '+', it extracts the numeric characters\n * and matches the leading digits with known dial codes mapped to countries.\n * - For matched dial codes, it further filters based on country-specific regex patterns\n * to validate the phone number format for those countries.\n * - If the phone number doesn't start with '+', it directly matches the number\n * against regular expressions associated with various countries to identify the code.\n *\n * @param phoneNumber The input phone number (string or number).\n * @returns The detected country code or an empty string if not found.\n */\nexport const detectCountryCodeFromDialCode = (\n phoneNumber: string | number,\n): string => {\n // If the phone number starts with '+', extract numeric characters\n if (phoneNumber.toString().charAt(0) === '+') {\n const cleanedPhoneNumberWithoutPlusPrefix = phoneNumber\n .toString()\n .replace(/\\D/g, '');\n\n const matchingCountries: string[] = [];\n\n // Iterate through dial codes and check for matches with cleaned phone number\n for (const code in DIAL_CODE_MAPPER) {\n if (cleanedPhoneNumberWithoutPlusPrefix.startsWith(code)) {\n matchingCountries.push(...DIAL_CODE_MAPPER[code]);\n }\n }\n\n // Filter matching countries based on phone number validation regex\n const matchedCountryCode = matchingCountries.find((countryCode: string) => {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex && regex.test(phoneNumber.toString())) return countryCode;\n return undefined;\n });\n\n // Return the first matched country code, if any\n return matchedCountryCode || '';\n } else {\n // If phone number doesn't start with '+', directly match against country regexes\n for (const countryCode in PHONE_REGEX_MAPPER) {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex.test(phoneNumber.toString())) {\n return countryCode;\n }\n }\n }\n\n // Return empty string if no country code is detected\n return '';\n};\n\nexport const cleanPhoneNumber = (phoneNumber: string) => {\n // Regular expression to match all characters except numbers and + sign at the start\n const regex = /[^0-9+]|(?!A)\\+/g;\n // Replace matched characters with an empty string\n const cleanedPhoneNumber = phoneNumber.replace(regex, '');\n return phoneNumber[0] === '+' ? `+${cleanedPhoneNumber}` : cleanedPhoneNumber;\n};\n","import { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Validates whether a given phone number is valid based on the provided country code or auto-detects the country code and checks if the number matches the defined regex pattern for that country.\nconst isValidPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_REGEX_MAPPER,\n): boolean => {\n // Clean the provided phoneNumber by removing non-numeric characters\n const cleanedPhoneNumber = cleanPhoneNumber(phoneNumber.toString());\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_REGEX_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(cleanedPhoneNumber);\n\n // Return false if phoneNumber is empty\n if (!phoneNumber) return false;\n\n // Check if the countryCode exists in the PHONE_REGEX_MAPPER\n if (countryCode in PHONE_REGEX_MAPPER) {\n // Fetch the regex pattern for the countryCode\n const regex = PHONE_REGEX_MAPPER[countryCode];\n // Test if the cleanedPhoneNumber matches the regex pattern\n return regex.test(cleanedPhoneNumber as string);\n }\n\n // Return false if the countryCode is not supported\n return false;\n};\n\nexport default withErrorBoundary(isValidPhoneNumber);\n","export const PHONE_FORMATTER_MAPPER: { [key: string]: string } = {\n IN: 'xxxx xxxxxx',\n MY: 'xx xxxxx xx',\n AE: 'xx xxx xxxx',\n AL: 'xxx xx xxxx',\n AM: 'xx xx xx xx',\n AR: 'xxxx-xxxx',\n AU: 'xxx xxx xxx',\n AW: 'xxx-xxxx',\n BB: 'xxx-xxxx',\n BD: 'xxxx-xxxxxx',\n BM: 'xxx-xxxx',\n BN: 'xxxx-xxxx',\n BO: 'xxxx-xxxx',\n BS: 'xxx-xxxx',\n BW: 'xx xxxx xxxx',\n BZ: 'xxx-xxxx',\n CA: 'xxx-xxx-xxxx',\n CH: 'xxx xxx xxx',\n CN: 'xxxx-xxxxxxx',\n CO: 'xxxx-xxxxxxx',\n CR: 'xxxx-xxxx',\n CU: 'xxxx-xxxx',\n CZ: 'xxx xxx xxx',\n DK: 'xx xx xx xx',\n DO: 'xxx-xxxxxxx',\n DZ: 'xxxx-xxxx-xxx',\n EG: 'xx xxx xxxx',\n ET: 'xx xxx xxxx',\n EU: 'xxx xx xx xx',\n FJ: 'xxxx xxxx',\n GB: 'xxxx xxx xxx',\n GH: 'xxx xxx xxxx',\n GI: 'xxxx xxxx',\n GM: 'xxxx-xxxx',\n GT: 'xxxx-xxxx',\n GY: 'xxx-xxxx',\n HK: 'xxxx xxxx',\n HN: 'xxxx-xxxx',\n HR: 'xxx xxx xxxx',\n HT: 'xxx-xxxx',\n HU: 'xxx xxx xxxx',\n ID: 'xxxx-xxxx-xxxx',\n IL: 'xxxx-xxx-xxx',\n JM: 'xxx-xxxx',\n KE: 'xxx xxxxxx',\n KG: 'xxx-xx-xx-xx',\n KH: 'xxx-xxx-xxx',\n KY: 'xxx-xxxx',\n KZ: 'xxx-xxx-xx-xx',\n LA: 'xxx xx xxxx',\n LK: 'xx xxx xxxx',\n LR: 'xxx-xxx-xxxx',\n LS: 'xxx xx xxxx',\n LT: 'xxx xxxxx',\n LU: 'xxx xx xxx',\n LV: 'xxxx xxxx',\n MA: 'xxxx-xxxxxx',\n MD: 'xx xxxxxx',\n ME: 'xx xxxxxx',\n MG: 'xx xx xx xx xx',\n MK: 'xx xx xx xx',\n MM: 'xx xxxxxx',\n MN: 'xxx-xx-xxxx',\n MO: 'xxxx xxxx',\n MU: 'xx xxxx xxxx',\n MV: 'xxxxxx',\n MW: 'xx xxxx xxxx',\n MX: 'xxx-xxx-xxxx',\n MZ: 'xx xxxxxxx',\n NA: 'xx xxxx xxxx',\n NG: 'xxx xxx xxxx',\n NI: 'xxxx-xxxx',\n NL: 'xxx-xxxxxxx',\n NO: 'xxxx xxxx',\n NP: 'xxxx-xxxxxxx',\n NZ: 'xxx-xxxxxxx',\n OM: 'xxxx-xxxx',\n PA: 'xxx-xxxx',\n PE: 'xxx-xxx-xxx',\n PG: 'xxx-xxxxxx',\n PH: 'xxx-xxxx',\n PK: 'xxx-xxxxxxx',\n PL: 'xxx xxx xxx',\n PR: 'xxx-xxx-xxxx',\n PS: 'xxxx-xxxxxxx',\n PT: 'xxx xxx xxx',\n PY: 'xxx-xxxxxx',\n QA: 'xxxx xxxx',\n RO: 'xxx xxx xxxx',\n RS: 'xxx xxxxx',\n RU: 'xxx xxx-xx-xx',\n RW: 'xxx xxxxxx',\n SA: 'xxx-xxxxxxx',\n SC: 'xx xxxxx',\n SE: 'xxx-xxx xx xx',\n SG: 'xxxx xxxx',\n SI: 'xx xxxxxx',\n SK: 'xxx xxx xxx',\n SL: 'xxx-xxxxxx',\n SM: 'xxxxx xxxxx',\n SN: 'xx xxx xx xx',\n SO: 'xxx xxxxxxx',\n SR: 'xxx-xxxx',\n SS: 'xxx xxxx xxx',\n SV: 'xxxx-xxxx',\n SZ: 'xxx xx xxxx',\n TG: 'xx xx xx xx',\n TH: 'xxx-xxxxxxx',\n TJ: 'xxx xx xx xx',\n TL: 'xxx-xxxxxxx',\n TN: 'xx xxxxxx',\n TR: 'xxx xxx xx xx',\n TT: 'xxx-xxxx',\n TW: 'xxxx-xxxxxx',\n TZ: 'xxx xxx xxxx',\n UA: 'xx xxx xx xx',\n UG: 'xxx xxxxxxx',\n US: 'xxx-xxx-xxxx',\n UY: 'xxx-xxxxx',\n UZ: 'xxx-xxx-xx-xx',\n VC: 'xxx-xxxx',\n VE: 'xxxx-xxx-xxxx',\n VN: 'xxxx-xxxxxxx',\n YE: 'xxxx-xxxx',\n ZA: 'xxx-xxx-xxxx',\n ZM: 'xxx-xxxxxxx',\n ZW: 'xx xxx xxxx',\n KW: 'xxx xx xxxx',\n BH: 'xxxx xxxx',\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Formats a provided phone number according to the predefined format for a specific country code, or auto-detects the country code and formats the number accordingly.\nconst formatPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_FORMATTER_MAPPER,\n): string => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Convert phoneNumber to string and clean it by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_FORMATTER_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Fetch the pattern for the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern) return phoneNumber;\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n // Extract the phoneNumber without the prefix\n const phoneNumberWithoutPrefix = phoneNumber.slice(diff);\n const formattedNumber: string[] = [];\n let numberIndex = 0;\n\n // Loop through the pattern to format the phoneNumber\n for (let i = 0; i < pattern.length; i++) {\n const patternChar = pattern[i];\n if (patternChar === 'x') {\n // Insert phoneNumber digits at 'x' positions\n if (numberIndex < phoneNumberWithoutPrefix.length) {\n formattedNumber.push(phoneNumberWithoutPrefix[numberIndex]);\n numberIndex++;\n }\n } else {\n // Insert non-digit characters from the pattern\n formattedNumber.push(patternChar);\n }\n }\n\n // Join the formattedNumber array to create the formattedPhoneNumber without prefix\n const formattedPhoneNumberWithoutPrefix = formattedNumber.join('');\n // Combine the prefix and formattedPhoneNumberWithoutPrefix\n const formattedPhoneNumberWithPrefix =\n phoneNumber.slice(0, diff) + ' ' + formattedPhoneNumberWithoutPrefix;\n\n // Return the formattedPhoneNumber with prefix after trimming whitespace\n return formattedPhoneNumberWithPrefix.trim();\n};\n\nexport default withErrorBoundary(formatPhoneNumber);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport formatPhoneNumber from './formatPhoneNumber';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\ninterface PhoneInfo {\n countryCode: string;\n dialCode: string;\n formattedPhoneNumber: string;\n formatTemplate: string;\n}\n\n// Parses a given phone number, identifies its country code (if not provided), and returns an object with details including the country code, formatted phone number, dial code, and format template.\nconst parsePhoneNumber = (phoneNumber: string, country?: string): PhoneInfo => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Clean the phoneNumber by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n const countryCode =\n country && country in PHONE_FORMATTER_MAPPER\n ? country\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Format the phone number using the detected/validated country code\n const formattedPhoneNumber = formatPhoneNumber(phoneNumber, countryCode);\n\n // Fetch the pattern associated with the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern)\n return {\n countryCode: countryCode || '',\n dialCode: '',\n formattedPhoneNumber: phoneNumber,\n formatTemplate: '',\n };\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n\n // Extract the dialCode from the phoneNumber\n const dialCode = phoneNumber.slice(0, diff);\n\n // Obtain the format template associated with the countryCode\n const formatTemplate = PHONE_FORMATTER_MAPPER[countryCode];\n\n // Return the parsed phone number information\n return {\n countryCode,\n formattedPhoneNumber,\n dialCode,\n formatTemplate,\n };\n};\n\nexport default withErrorBoundary(parsePhoneNumber);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Adds a specified amount of time to a date.\n *\n * @param date The original date.\n * @param value The amount to add.\n * @param unit The unit of time to add (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time added.\n */\nconst add = (\n date: Date,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n const result = new Date(date);\n switch (unit) {\n case 'days':\n result.setDate(result.getDate() + value);\n break;\n case 'months':\n result.setMonth(result.getMonth() + value);\n break;\n case 'years':\n result.setFullYear(result.getFullYear() + value);\n break;\n }\n return result;\n};\n\nexport default withErrorBoundary(add);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale, DateTimeFormatOptions } from './types';\n\n/**\n * Formats date and time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional).\n * @returns {string} Formatted date and time string.\n */\nconst formatDateTime = (\n date: DateInput,\n locale: Locale,\n options: DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const dateObj: Date = date instanceof Date ? date : new Date(date);\n let formatter;\n\n try {\n formatter = new Intl.DateTimeFormat(locale, options);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formatter.format(dateObj);\n};\n\nexport default withErrorBoundary(formatDateTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n DateFormatOptions,\n} from './types';\n\n/**\n * Formats date based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional).\n * @returns {string} Formatted date string.\n */\nconst formatDate = (\n date: DateInput,\n locale: Locale,\n options: DateFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n timeStyle: undefined,\n };\n\n let formattedDate;\n\n try {\n formattedDate = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedDate;\n};\n\nexport default withErrorBoundary(formatDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n TimeFormatOptions,\n} from './types';\n\n/**\n * Formats time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional).\n * @returns {string} Formatted time string.\n */\nconst formatTime = (\n date: DateInput,\n locale: Locale,\n options: TimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n dateStyle: undefined,\n };\n\n let formattedTime;\n\n try {\n formattedTime = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedTime;\n};\n\nexport default withErrorBoundary(formatTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\n\n/**\n * Gets the first day of the week for a given locale.\n *\n * @param locale The locale to determine the first day of the week for.\n * @returns The first day of the week (0-6, where 0 is Sunday).\n */\nconst getFirstDayOfWeek = (locale: string): number => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n let formatted;\n\n try {\n const formatter = new Intl.DateTimeFormat(locale, { weekday: 'short' });\n const sampleDate = new Date(2000, 0, 2); // A Sunday\n formatted = formatter.format(sampleDate);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return ['su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'].indexOf(\n formatted.slice(0, 2).toLowerCase(),\n );\n};\n\nexport default withErrorBoundary(getFirstDayOfWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Determines the quarter of the year for a given date.\n *\n * @param date The date to determine the quarter for.\n * @returns The quarter of the year (1-4).\n */\nconst getQuarter = (date: Date): number => {\n return Math.ceil((date.getMonth() + 1) / 3);\n};\n\nexport default withErrorBoundary(getQuarter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Provides a relative time string (e.g., '3 hours ago', 'in 2 days').\n * This function calculates the difference between the given date and the base date,\n * then formats it in a locale-sensitive manner. It allows customization of the output\n * through Intl.RelativeTimeFormat options.\n *\n * @param date - The date to compare.\n * @param baseDate - The date to compare against (default: current date).\n * @param locale - The locale to use for formatting.\n * @param options - Options for the Intl.RelativeTimeFormat (optional).\n * @returns The relative time as a string.\n */\nconst getRelativeTime = (\n date: Date,\n baseDate: Date = new Date(),\n locale: Locale,\n options?: Intl.RelativeTimeFormatOptions,\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000;\n\n // Define time units in seconds\n const minute = 60;\n const hour = minute * 60;\n const day = hour * 24;\n const week = day * 7;\n const month = day * 30;\n const year = day * 365;\n\n let value: number;\n let unit: Intl.RelativeTimeFormatUnit;\n\n if (Math.abs(diffInSeconds) < minute) {\n value = diffInSeconds;\n unit = 'second';\n } else if (Math.abs(diffInSeconds) < hour) {\n value = diffInSeconds / minute;\n unit = 'minute';\n } else if (Math.abs(diffInSeconds) < day) {\n value = diffInSeconds / hour;\n unit = 'hour';\n } else if (Math.abs(diffInSeconds) < week) {\n value = diffInSeconds / day;\n unit = 'day';\n } else if (Math.abs(diffInSeconds) < month) {\n value = diffInSeconds / week;\n unit = 'week';\n } else if (Math.abs(diffInSeconds) < year) {\n value = diffInSeconds / month;\n unit = 'month';\n } else {\n value = diffInSeconds / year;\n unit = 'year';\n }\n\n let relativeTime;\n\n try {\n const rtf = new Intl.RelativeTimeFormat(locale, options);\n relativeTime = rtf.format(Math.round(value), unit);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return relativeTime;\n};\n\nexport default withErrorBoundary(getRelativeTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Calculates the week number of the year for a given date.\n *\n * @param date The date to calculate the week number for.\n * @returns The week number of the year.\n */\nconst getWeek = (date: Date): number => {\n const firstDayOfYear = new Date(date.getFullYear(), 0, 1);\n const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000;\n return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7);\n};\n\nexport default withErrorBoundary(getWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Returns an array of weekdays according to the specified locale.\n *\n * @param locale The locale to get weekdays for.\n * @returns An array of weekday names.\n */\nconst getWeekdays = (locale: Locale): string[] => {\n try {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n const formatter = new Intl.DateTimeFormat(locale, { weekday: 'long' });\n return Array.from({ length: 7 }, (_, i) =>\n formatter.format(new Date(1970, 0, 4 + i)),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(getWeekdays);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\n\n/**\n * Compares two dates to determine if the first is after the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is after date2.\n */\nconst isAfter = (date1: DateInput, date2: DateInput): boolean => {\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 > dateObj2;\n};\n\nexport default withErrorBoundary(isAfter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\n\n/**\n * Compares two dates to determine if the first is before the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is before date2.\n */\nconst isBefore = (date1: DateInput, date2: DateInput): boolean => {\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 < dateObj2;\n};\n\nexport default withErrorBoundary(isBefore);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given year is a leap year.\n *\n * @param year The year to check.\n * @returns True if the year is a leap year, false otherwise.\n */\nconst isLeapYear = (year: number): boolean => {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n};\n\nexport default withErrorBoundary(isLeapYear);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if two dates fall on the same day.\n *\n * @param date1 The first date.\n * @param date2 The second date.\n * @returns True if both dates are on the same day, false otherwise.\n */\nconst isSameDay = (date1: Date, date2: Date): boolean => {\n return (\n date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear()\n );\n};\n\nexport default withErrorBoundary(isSameDay);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given object is a valid Date object.\n *\n * @param date The object to check.\n * @returns True if the object is a valid Date, false otherwise.\n */\nconst isValidDate = (date: any): boolean => {\n return date instanceof Date && !isNaN(date.getTime());\n};\n\nexport default withErrorBoundary(isValidDate);\n","export const LOCALE_DATE_FORMATS: { [key: string]: string } = {\n 'ar-AE': 'DD/MM/YYYY', // Arabic (U.A.E.)\n 'sq-AL': 'DD.MM.YYYY', // Albanian (Albania)\n 'hy-AM': 'DD.MM.YYYY', // Armenian (Armenia)\n 'es-AR': 'DD/MM/YYYY', // Spanish (Argentina)\n 'en-AU': 'DD/MM/YYYY', // English (Australia)\n 'nl-AW': 'DD-MM-YYYY', // Dutch (Aruba)\n 'en-BB': 'MM/DD/YYYY', // English (Barbados)\n 'bn-BD': 'DD/MM/YYYY', // Bengali (Bangladesh)\n 'en-BM': 'MM/DD/YYYY', // English (Bermuda)\n 'ms-BN': 'DD/MM/YYYY', // Malay (Brunei)\n 'es-BO': 'DD/MM/YYYY', // Spanish (Bolivia)\n 'en-BS': 'MM/DD/YYYY', // English (Bahamas)\n 'en-BW': 'DD/MM/YYYY', // English (Botswana)\n 'en-BZ': 'MM/DD/YYYY', // English (Belize)\n 'en-CA': 'DD/MM/YYYY', // English (Canada)\n 'de-CH': 'DD.MM.YYYY', // German (Switzerland)\n 'zh-CN': 'YYYY/MM/DD', // Chinese (China)\n 'es-CO': 'DD/MM/YYYY', // Spanish (Colombia)\n 'es-CR': 'DD/MM/YYYY', // Spanish (Costa Rica)\n 'es-CU': 'DD/MM/YYYY', // Spanish (Cuba)\n 'cs-CZ': 'DD.MM.YYYY', // Czech (Czech Republic)\n 'da-DK': 'DD-MM-YYYY', // Danish (Denmark)\n 'es-DO': 'DD/MM/YYYY', // Spanish (Dominican Republic)\n 'ar-DZ': 'DD/MM/YYYY', // Arabic (Algeria)\n 'ar-EG': 'DD/MM/YYYY', // Arabic (Egypt)\n 'am-ET': 'DD/MM/YYYY', // Amharic (Ethiopia)\n 'en-EU': 'DD/MM/YYYY', // English (European Union)\n 'en-FJ': 'DD/MM/YYYY', // English (Fiji)\n 'en-GB': 'DD/MM/YYYY', // English (United Kingdom)\n 'en-GH': 'DD/MM/YYYY', // English (Ghana)\n 'en-GI': 'DD/MM/YYYY', // English (Gibraltar)\n 'en-GM': 'DD/MM/YYYY', // English (Gambia)\n 'es-GT': 'DD/MM/YYYY', // Spanish (Guatemala)\n 'en-GY': 'DD/MM/YYYY', // English (Guyana)\n 'en-HK': 'DD/MM/YYYY', // English (Hong Kong)\n 'es-HN': 'DD/MM/YYYY', // Spanish (Honduras)\n 'hr-HR': 'DD.MM.YYYY', // Croatian (Croatia)\n 'ht-HT': 'MM/DD/YYYY', // Haitian (Haiti)\n 'hu-HU': 'YYYY. MM. DD.', // Hungarian (Hungary)\n 'id-ID': 'DD/MM/YYYY', // Indonesian (Indonesia)\n 'he-IL': 'DD/MM/YYYY', // Hebrew (Israel)\n 'en-IN': 'DD-MM-YYYY', // English (India)\n 'en-JM': 'MM/DD/YYYY', // English (Jamaica)\n 'en-KE': 'DD/MM/YYYY', // English (Kenya)\n 'ky-KG': 'DD.MM.YYYY', // Kyrgyz (Kyrgyzstan)\n 'km-KH': 'DD/MM/YYYY', // Khmer (Cambodia)\n 'en-KY': 'MM/DD/YYYY', // English (Cayman Islands)\n 'kk-KZ': 'DD.MM.YYYY', // Kazakh (Kazakhstan)\n 'lo-LA': 'DD/MM/YYYY', // Lao (Laos)\n 'si-LK': 'YYYY-MM-DD', // Sinhala (Sri Lanka)\n 'en-LR': 'MM/DD/YYYY', // English (Liberia)\n 'en-LS': 'DD/MM/YYYY', // English (Lesotho)\n 'ar-MA': 'DD/MM/YYYY', // Arabic (Morocco)\n 'ro-MD': 'DD.MM.YYYY', // Romanian (Moldova)\n 'mk-MK': 'DD.MM.YYYY', // Macedonian (North Macedonia)\n 'my-MM': 'DD/MM/YYYY', // Burmese (Myanmar)\n 'mn-MN': 'YYYY.MM.DD', // Mongolian (Mongolia)\n 'zh-MO': 'DD/MM/YYYY', // Chinese (Macao)\n 'en-MU': 'DD/MM/YYYY', // English (Mauritius)\n 'dv-MV': 'DD/MM/YYYY', // Divehi (Maldives)\n 'en-MW': 'DD/MM/YYYY', // English (Malawi)\n 'es-MX': 'DD/MM/YYYY', // Spanish (Mexico)\n 'ms-MY': 'DD/MM/YYYY', // Malay (Malaysia)\n 'en-NA': 'DD/MM/YYYY', // English (Namibia)\n 'en-NG': 'DD/MM/YYYY', // English (Nigeria)\n 'es-NI': 'DD/MM/YYYY', // Spanish (Nicaragua)\n 'no-NO': 'DD.MM.YYYY', // Norwegian (Norway)\n 'ne-NP': 'YYYY/MM/DD', // Nepali (Nepal)\n 'en-NZ': 'DD/MM/YYYY', // English (New Zealand)\n 'es-PE': 'DD/MM/YYYY', // Spanish (Peru)\n 'en-PG': 'DD/MM/YYYY', // English (Papua New Guinea)\n 'en-PH': 'MM/DD/YYYY', // English (Philippines)\n 'en-PK': 'DD/MM/YYYY', // English (Pakistan)\n 'ar-QA': 'DD/MM/YYYY', // Arabic (Qatar)\n 'ru-RU': 'DD.MM.YYYY', // Russian (Russia)\n 'ar-SA': 'DD/MM/YYYY', // Arabic (Saudi Arabia)\n 'en-SC': 'DD/MM/YYYY', // English (Seychelles)\n 'sv-SE': 'YYYY-MM-DD', // Swedish (Sweden)\n 'en-SG': 'DD/MM/YYYY', // English (Singapore)\n 'en-SL': 'DD/MM/YYYY', // English (Sierra Leone)\n 'so-SO': 'DD/MM/YYYY', // Somali (Somalia)\n 'en-SS': 'DD/MM/YYYY', // English (South Sudan)\n 'es-SV': 'DD/MM/YYYY', // Spanish (El Salvador)\n 'en-SZ': 'DD/MM/YYYY', // English (Eswatini)\n 'th-TH': 'DD/MM/YYYY', // Thai (Thailand)\n 'en-TT': 'MM/DD/YYYY', // English (Trinidad and Tobago)\n 'sw-TZ': 'DD/MM/YYYY', // Swahili (Tanzania)\n 'en-US': 'MM/DD/YYYY', // English (United States)\n 'es-UY': 'DD/MM/YYYY', // Spanish (Uruguay)\n 'uz-UZ': 'DD/MM/YYYY', // Uzbek (Uzbekistan)\n 'ar-YE': 'DD/MM/YYYY', // Arabic (Yemen)\n 'en-ZA': 'YYYY/MM/DD', // English (South Africa)\n 'ar-KW': 'DD/MM/YYYY', // Arabic (Kuwait)\n 'ar-BH': 'DD/MM/YYYY', // Arabic (Bahrain)\n 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman)\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Parses a date string based on a specific format.\n *\n * @param dateString The date string to parse.\n * @param format The format to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDateWithFormat = (\n dateString: string,\n format: string,\n): Date | null => {\n // Determine the separator based on the format (supports '/', '.', or '-')\n const separator = format.includes('/')\n ? '/'\n : format.includes('.')\n ? '.'\n : '-';\n const formatParts = format.split(separator);\n const dateParts = dateString.split(separator).map((num) => parseInt(num, 10));\n\n let year: number = 0,\n month: number = 0,\n day: number = 0;\n let yearSet: boolean = false,\n monthSet: boolean = false,\n daySet: boolean = false;\n\n // Check for format and date string mismatch\n if (dateParts.length !== formatParts.length) {\n return null; // Mismatch between date string and format\n }\n\n formatParts.forEach((part, index) => {\n // Check for non-numeric values in date string\n if (isNaN(dateParts[index])) {\n return null; // Invalid date part\n }\n\n // Assign year, month, and day based on the format\n switch (part) {\n case 'DD':\n day = dateParts[index];\n daySet = true;\n break;\n case 'MM':\n month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date\n monthSet = true;\n break;\n case 'YYYY':\n year = dateParts[index];\n yearSet = true;\n break;\n }\n });\n\n // Validate and create the date only if all parts are set\n if (yearSet && monthSet && daySet) {\n const parsedDate = new Date(year, month, day);\n // Validate date to catch invalid dates like February 30th\n if (\n parsedDate.getFullYear() === year &&\n parsedDate.getMonth() === month &&\n parsedDate.getDate() === day\n ) {\n return parsedDate;\n }\n }\n return null; // Invalid date or incomplete date information\n};\n\nexport default withErrorBoundary(\n parseDateWithFormat,\n);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { LOCALE_DATE_FORMATS } from './data/localeDateFormats';\nimport parseDateWithFormat from './parseDateWithFormat';\nimport { Locale } from './types';\n\n/**\n * Attempts to parse a string into a date object based on locale.\n * Uses the localeDateFormats mapping for determining the date format.\n *\n * @param dateString - The date string to parse.\n * @param locale - The locale to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDate = (dateString: string, locale: Locale): Date | null => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const format = LOCALE_DATE_FORMATS[locale];\n if (!format) {\n throw new Error(`No date format found for locale: ${locale}`);\n }\n return parseDateWithFormat(dateString, format);\n};\n\nexport default withErrorBoundary(parseDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport add from './add';\n\n/**\n * Subtracts a specified amount of time from a date.\n *\n * @param date The original date.\n * @param value The amount to subtract.\n * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time subtracted.\n */\nconst subtract = (\n date: Date,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n return add(date, -value, unit); // Reuse the add function with negative value\n};\n\nexport default withErrorBoundary(subtract);\n"],"names":["formatPhoneNumber","formatDateTime","parseDateWithFormat","add"],"mappings":"AAAA;AACM,MAAO,YAAa,SAAQ,KAAK,CAAA;AAErC,IAAA,WAAA,CAAY,OAA2B,EAAA;QACrC,KAAK,CAAC,OAAO,CAAC,CAAC;AACf,QAAA,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;AAC5B,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;;KAE7B;AACF,CAAA;AAED;;;;;;;;AAQG;AACI,MAAM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,CAAA,CAAE,CAAC,CAAC;AAC/D,KAAA;AACD,IAAA,OAAOC,qBAAmB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC,CAAC;AAEF,kBAAe,iBAAiB,CAAmB,SAAS,CAAC;;AC3B7D;;;;;;;AAOG;AACH,MAAM,QAAQ,GAAG,CACf,IAAU,EACV,KAAa,EACb,IAAiC,KACzB;IACR,OAAOC,KAAG,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACjC,CAAC,CAAC;AAEF,iBAAe,iBAAiB,CAAkB,QAAQ,CAAC;;;;"} \ No newline at end of file +{"version":3,"file":"index.js","sources":["../../src/common/errorBoundary/index.ts","../../src/modules/.internal/utils/getDefaultState.ts","../../src/modules/.internal/state/index.ts","../../src/modules/core/getState.ts","../../src/modules/core/setState.ts","../../src/modules/core/resetState.ts","../../src/modules/.internal/utils/getLocale.ts","../../src/modules/.internal/utils/getIntlInstanceWithOptions.ts","../../src/modules/currency/formatNumber.ts","../../src/modules/currency/data/currencies.ts","../../src/modules/currency/getCurrencyList.ts","../../src/modules/currency/getCurrencySymbol.ts","../../src/modules/currency/constants.ts","../../src/modules/currency/formatNumberByParts.ts","../../src/modules/phoneNumber/data/phoneRegexMapper.ts","../../src/modules/phoneNumber/data/dialCodeMapper.ts","../../src/modules/phoneNumber/utils.ts","../../src/modules/phoneNumber/isValidPhoneNumber.ts","../../src/modules/phoneNumber/data/phoneFormatterMapper.ts","../../src/modules/phoneNumber/formatPhoneNumber.ts","../../src/modules/phoneNumber/parsePhoneNumber.ts","../../src/modules/dateTime/utils.ts","../../src/modules/dateTime/add.ts","../../src/modules/dateTime/formatDateTime.ts","../../src/modules/dateTime/formatDate.ts","../../src/modules/dateTime/formatTime.ts","../../src/modules/dateTime/getFirstDayOfWeek.ts","../../src/modules/dateTime/getQuarter.ts","../../src/modules/dateTime/getRelativeTime.ts","../../src/modules/dateTime/getWeek.ts","../../src/modules/dateTime/getWeekdays.ts","../../src/modules/dateTime/isAfter.ts","../../src/modules/dateTime/isBefore.ts","../../src/modules/dateTime/isLeapYear.ts","../../src/modules/dateTime/isSameDay.ts","../../src/modules/dateTime/isValidDate.ts","../../src/modules/dateTime/data/localeDateFormats.ts","../../src/modules/dateTime/parseDateWithFormat.ts","../../src/modules/dateTime/parseDate.ts","../../src/modules/dateTime/subtract.ts"],"sourcesContent":["// Custom Error class to extend properties to error object\nexport class I18nifyError extends Error {\n timestamp: Date;\n constructor(message: string | undefined) {\n super(message);\n this.name = 'i18nify Error';\n this.timestamp = new Date();\n // more params like type of error/severity can be added in future for better debugging.\n }\n}\n\n/**\n * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block.\n * It appends additional attributes and serves as a centralized error-handling service.\n * Usage =>\n * const wrappedUtilityFn = withErrorBoundary(utilityFn)\n *\n * @param fn utility that is wrapped in error boundary\n * @returns {Function} returns the function wrapped in try/catch block\n */\nexport const withErrorBoundary = any>(\n fn: T,\n): ((...args: Parameters) => ReturnType) => {\n return function (this: unknown, ...rest: Parameters): ReturnType {\n try {\n return fn.call(this, ...rest) as ReturnType;\n } catch (err) {\n console.warn('[I18N Error]: ', err);\n // Currently, we are throwing the error as it is to consumers.\n // In the future, this can be modified as per our requirement, like an error logging service.\n throw new I18nifyError(err as string | undefined);\n }\n };\n};\n","import type { I18nState } from '../state/types';\n\nexport function getDefaultState(): I18nState {\n return {\n locale: '',\n direction: '',\n country: '',\n };\n}\n","import { I18nState } from './types';\nimport { getDefaultState } from '../utils/getDefaultState';\n\nexport class I18nStateManager {\n private static instance: I18nStateManager | undefined;\n private state: I18nState;\n\n private constructor() {\n this.state = getDefaultState();\n }\n\n public static getInstance(): I18nStateManager {\n if (!I18nStateManager.instance) {\n I18nStateManager.instance = new I18nStateManager();\n }\n\n return I18nStateManager.instance;\n }\n\n public static resetInstance(): void {\n I18nStateManager.instance = undefined;\n }\n\n public getState(): I18nState {\n return { ...this.state };\n }\n\n public setState(newState: Partial): void {\n this.state = { ...this.state, ...newState };\n }\n\n public resetState(): void {\n this.state = getDefaultState();\n }\n}\n\nexport default I18nStateManager.getInstance();\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * function to return active i18n state\n *\n * ===== USAGE =====\n * import { getState } from '@razorpay/i18nify-js';\n *\n * console.log(getState())\n *\n * @returns i18n state\n */\nconst getState = (): I18nState => {\n return state.getState();\n};\n\nexport default withErrorBoundary(getState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * Function to set and override the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { setState } from \"@razorpay/i18nify-js\";\n * setState({locale: 'en-US'})\n *\n * @param newState data to set in i18nState instance\n */\nconst setState = (newState: Partial): void => {\n state.setState(newState);\n};\n\nexport default withErrorBoundary(setState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\n\n/**\n * Function to reset the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { resetState } from \"@razorpay/i18nify-js\";\n * resetState()\n *\n * @param newState data to set in i18nState instance\n */\nconst resetState = (): void => {\n state.resetState();\n};\n\nexport default withErrorBoundary(resetState);\n","export const getLocale = (): string => {\n // Check if running in a non-browser environment (e.g., Node.js or older browsers).\n if (typeof navigator === 'undefined') {\n return 'en-IN';\n }\n\n // Check if the browser supports the Intl object and user language preferences.\n if (\n window.Intl &&\n typeof window.Intl === 'object' &&\n (window.navigator.languages || window.navigator.language)\n ) {\n const userLocales = window.navigator.languages || [\n window.navigator.language,\n ];\n return userLocales[0];\n }\n\n // Fallback to a supported locale or the default locale.\n return 'en-IN';\n};\n","import { CURRENCIES } from '../../currency/data/currencies';\nimport state from '../state';\nimport { getLocale } from './getLocale';\n\nexport const getIntlInstanceWithOptions = (\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n) => {\n /** retrieve locale from below areas in order of preference\n * 1. options.locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n let locale = options?.locale || state.getState().locale;\n\n // If a specific locale is provided, use it; otherwise, use the browser's locale\n if (!locale) {\n locale = getLocale();\n }\n\n const intlOptions = options?.intlOptions ? { ...options.intlOptions } : {};\n\n if (options?.currency || intlOptions.currency) {\n intlOptions.style = 'currency';\n intlOptions.currency = (options.currency || intlOptions.currency) as string;\n }\n\n if (!locale) throw new Error('Pass valid locale !');\n\n return new Intl.NumberFormat(locale || undefined, intlOptions);\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\n\n// this function formats number based on different arguments passed\nconst formatNumber = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): string => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n let formattedAmount = '';\n\n try {\n formattedAmount = getIntlInstanceWithOptions(options).format(\n Number(amount),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedAmount;\n};\n\nexport default withErrorBoundary(formatNumber);\n","export const CURRENCIES: { [key: string]: { symbol: string; name: string } } = {\n AED: { symbol: 'د.إ', name: 'United Arab Emirates Dirham' },\n ALL: { symbol: 'Lek', name: 'Albanian Lek' },\n AMD: { symbol: '֏', name: 'Armenian Dram' },\n ARS: { symbol: 'ARS', name: 'Argentine Peso' },\n AUD: { symbol: 'A$', name: 'Australian Dollar' },\n AWG: { symbol: 'Afl.', name: 'Aruban Florin' },\n BBD: { symbol: '$', name: 'Barbadian Dollar' },\n BDT: { symbol: '৳', name: 'Bangladeshi Taka' },\n BMD: { symbol: '$', name: 'Bermudian Dollar' },\n BND: { symbol: 'BND', name: 'Brunei Dollar' },\n BOB: { symbol: 'Bs', name: 'Bolivian Boliviano' },\n BSD: { symbol: 'B$', name: 'Bahamian Dollar' },\n BWP: { symbol: 'P', name: 'Botswanan Pula' },\n BZD: { symbol: 'BZ$', name: 'Belize Dollar' },\n CAD: { symbol: 'C$', name: 'Canadian Dollar' },\n CHF: { symbol: 'CHf', name: 'Swiss Franc' },\n CNY: { symbol: '¥', name: 'Chinese Yuan' },\n COP: { symbol: 'COL$', name: 'Colombian Peso' },\n CRC: { symbol: '₡', name: 'Costa Rican Colón' },\n CUP: { symbol: '$MN', name: 'Cuban Peso' },\n CZK: { symbol: 'Kč', name: 'Czech Koruna' },\n DKK: { symbol: 'DKK', name: 'Danish Krone' },\n DOP: { symbol: 'RD$', name: 'Dominican Peso' },\n DZD: { symbol: 'د.ج', name: 'Algerian Dinar' },\n EGP: { symbol: 'E£', name: 'Egyptian Pound' },\n ETB: { symbol: 'ብር', name: 'Ethiopian Birr' },\n EUR: { symbol: '€', name: 'Euro' },\n FJD: { symbol: 'FJ$', name: 'Fijian Dollar' },\n GBP: { symbol: '£', name: 'British Pound' },\n GHS: { symbol: 'GH₵', name: 'Ghanaian Cedi' },\n GIP: { symbol: 'GIP', name: 'Gibraltar Pound' },\n GMD: { symbol: 'D', name: 'Gambian Dalasi' },\n GTQ: { symbol: 'Q', name: 'Guatemalan Quetzal' },\n GYD: { symbol: 'G$', name: 'Guyanese Dollar' },\n HKD: { symbol: 'HK$', name: 'Hong Kong Dollar' },\n HNL: { symbol: 'HNL', name: 'Honduran Lempira' },\n HRK: { symbol: 'kn', name: 'Croatian Kuna' },\n HTG: { symbol: 'G', name: 'Haitian Gourde' },\n HUF: { symbol: 'Ft', name: 'Hungarian Forint' },\n IDR: { symbol: 'Rp', name: 'Indonesian Rupiah' },\n ILS: { symbol: '₪', name: 'Israeli New Shekel' },\n INR: { symbol: '₹', name: 'Indian Rupee' },\n JMD: { symbol: 'J$', name: 'Jamaican Dollar' },\n KES: { symbol: 'Ksh', name: 'Kenyan Shilling' },\n KGS: { symbol: 'Лв', name: 'Kyrgystani Som' },\n KHR: { symbol: '៛', name: 'Cambodian Riel' },\n KYD: { symbol: 'CI$', name: 'Cayman Islands Dollar' },\n KZT: { symbol: '₸', name: 'Kazakhstani Tenge' },\n LAK: { symbol: '₭', name: 'Laotian Kip' },\n LKR: { symbol: 'රු', name: 'Sri Lankan Rupee' },\n LRD: { symbol: 'L$', name: 'Liberian Dollar' },\n LSL: { symbol: 'LSL', name: 'Lesotho Loti' },\n MAD: { symbol: 'د.م.', name: 'Moroccan Dirham' },\n MDL: { symbol: 'MDL', name: 'Moldovan Leu' },\n MKD: { symbol: 'ден', name: 'Macedonian Denar' },\n MMK: { symbol: 'MMK', name: 'Myanmar Kyat' },\n MNT: { symbol: '₮', name: 'Mongolian Tugrik' },\n MOP: { symbol: 'MOP$', name: 'Macanese Pataca' },\n MUR: { symbol: '₨', name: 'Mauritian Rupee' },\n MVR: { symbol: 'Rf', name: 'Maldivian Rufiyaa' },\n MWK: { symbol: 'MK', name: 'Malawian Kwacha' },\n MXN: { symbol: 'Mex$', name: 'Mexican Peso' },\n MYR: { symbol: 'RM', name: 'Malaysian Ringgit' },\n NAD: { symbol: 'N$', name: 'Namibian Dollar' },\n NGN: { symbol: '₦', name: 'Nigerian Naira' },\n NIO: { symbol: 'NIO', name: 'Nicaraguan Córdoba' },\n NOK: { symbol: 'NOK', name: 'Norwegian Krone' },\n NPR: { symbol: 'रू', name: 'Nepalese Rupee' },\n NZD: { symbol: 'NZ$', name: 'New Zealand Dollar' },\n PEN: { symbol: 'S/', name: 'Peruvian Nuevo Sol' },\n PGK: { symbol: 'PGK', name: 'Papua New Guinean Kina' },\n PHP: { symbol: '₱', name: 'Philippine Peso' },\n PKR: { symbol: '₨', name: 'Pakistani Rupee' },\n QAR: { symbol: 'QR', name: 'Qatari Riyal' },\n RUB: { symbol: '₽', name: 'Russian Ruble' },\n SAR: { symbol: 'SR', name: 'Saudi Riyal' },\n SCR: { symbol: 'SRe', name: 'Seychellois Rupee' },\n SEK: { symbol: 'SEK', name: 'Swedish Krona' },\n SGD: { symbol: 'S$', name: 'Singapore Dollar' },\n SLL: { symbol: 'Le', name: 'Sierra Leonean Leone' },\n SOS: { symbol: 'Sh.so.', name: 'Somali Shilling' },\n SSP: { symbol: 'SS£', name: 'South Sudanese Pound' },\n SVC: { symbol: '₡', name: 'Salvadoran Colón' },\n SZL: { symbol: 'E', name: 'Swazi Lilangeni' },\n THB: { symbol: '฿', name: 'Thai Baht' },\n TTD: { symbol: 'TT$', name: 'Trinidad and Tobago Dollar' },\n TZS: { symbol: 'Sh', name: 'Tanzanian Shilling' },\n USD: { symbol: '$', name: 'United States Dollar' },\n UYU: { symbol: '$U', name: 'Uruguayan Peso' },\n UZS: { symbol: \"so'm\", name: 'Uzbekistani Som' },\n YER: { symbol: '﷼', name: 'Yemeni Rial' },\n ZAR: { symbol: 'R', name: 'South African Rand' },\n KWD: { symbol: 'د.ك', name: 'Kuwaiti Dinar' },\n BHD: { symbol: 'د.ب.', name: 'Bahraini Dinar' },\n OMR: { symbol: 'ر.ع.', name: 'Omani Rial' },\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencyList = () => {\n return CURRENCIES;\n};\n\nexport default withErrorBoundary(getCurrencyList);\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencySymbol = (currencyCode: keyof typeof CURRENCIES): string => {\n if (currencyCode in CURRENCIES) return CURRENCIES[currencyCode]?.symbol;\n else throw new Error('Invalid currencyCode!');\n};\n\nexport default withErrorBoundary(getCurrencySymbol);\n","export const ALLOWED_FORMAT_PARTS_KEYS = [\n 'nan',\n 'infinity',\n 'percent',\n 'integer',\n 'group',\n 'decimal',\n 'fraction',\n 'plusSign',\n 'minusSign',\n 'percentSign',\n 'currency',\n 'code',\n 'symbol',\n 'name',\n 'compact',\n 'exponentInteger',\n 'exponentMinusSign',\n 'exponentSeparator',\n 'unit',\n] as const;\n","import { CURRENCIES } from './data/currencies';\nimport { ByParts, FormattedPartsObject } from './types';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\nimport { ALLOWED_FORMAT_PARTS_KEYS } from './constants';\n\nconst formatNumberByParts = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): ByParts => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n try {\n const formattedAmount = getIntlInstanceWithOptions(options).formatToParts(\n Number(amount),\n );\n\n const parts = formattedAmount;\n\n const formattedObj: FormattedPartsObject = {};\n\n parts.forEach((p) => {\n if (p.type === 'group') {\n formattedObj.integer = (formattedObj.integer || '') + p.value;\n } else if (\n ALLOWED_FORMAT_PARTS_KEYS.findIndex((item) => item === p.type) != -1\n ) {\n // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal' is skipped\n formattedObj[p.type] = (formattedObj[p.type] || '') + p.value;\n }\n });\n\n return {\n ...formattedObj,\n isPrefixSymbol: parts[0].type === 'currency',\n rawParts: parts,\n };\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(\n formatNumberByParts,\n);\n","export const PHONE_REGEX_MAPPER: { [key: string]: RegExp } = {\n IN: /^(?:(?:\\+|0{0,2})91\\s*[-]?\\s*|[0]?)?[6789]\\d{9}$/,\n MY: /^(\\+?6?0)?(\\d{1,3})[-. ]?(\\d{7,8})$/,\n AE: /^(?:\\+?971|0)?(?:2|3|4|6|7|9)\\d{8}$/,\n AL: /^(?:\\+?355)?(?:[4-9]\\d{7}|6\\d{8})$/,\n AM: /^(?:\\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/,\n AR: /^(?:(?:\\+|0{0,2})54)?(?:11|[2368]\\d)(?:(?=\\d{0,2}15)\\d{2})??\\d{8}$/,\n AU: /^(?:\\+?61|0)4\\d{8}$/,\n AW: /^(?:(?:\\+297)?(?!0)\\d{7})$/,\n BB: /^(?:(?:\\+1)?246)?(?:\\d{3})?\\d{7}$/,\n BD: /^(?:\\+?880|0)1[13456789]\\d{8}$/,\n BM: /^(?:(?:\\+1)?441)?(?:\\d{2})?\\d{7}$/,\n BN: /^(?:\\+?673)?(?:\\d{3})?\\d{4}$/,\n BO: /^(?:(?:\\+|0{0,2})591)?(?:(?:2|3|7|6)\\d{7})$/,\n BS: /^(?:(?:\\+1)?242)?(?:\\d{3})?\\d{7}$/,\n BW: /^(?:(?:\\+267)?\\s?)?[74]\\d{7}$/,\n BZ: /^(?:(?:\\+501)?\\s?)?[622]\\d{4}$/,\n CH: /^(?:(?:\\+41|0)(?:\\s*\\(?0\\)?\\s*))?(?:\\d{2}\\s*)?\\d{3}\\s*\\d{2}\\s*\\d{2}$/,\n CN: /^(?:(?:\\+|00)86)?1\\d{10}$/,\n CO: /^(?:(?:\\+57|0057)?)?[1-8]{1}\\d{6,7}$/,\n OM: /^(?:\\+?968)?(?:95|96|97|98)\\d{6}$/,\n CR: /^(?:(?:\\+506)?\\s*|0)?[1-9]\\d{7}$/,\n CU: /^(?:\\+?53)?(?:[5-8]\\d{7})$/,\n CZ: /^(?:\\+?420)?(?:\\d{9})$/,\n DK: /^(?:\\+?45)?(?:\\d{8})$/,\n DO: /^(?:(?:\\+1)?809|1-8(?:00|88|89))(?:\\d{7})$/,\n DZ: /^(?:\\+?213|0)([567]\\d{8})$/,\n EG: /^(?:(?:\\+20|20)?(\\d{10}))$/,\n ET: /^(?:\\+?251)?[1-59]\\d{8}$/,\n EU: /^(?:(?:\\+?3)?8)?\\s*(?:\\d{3}\\s*){3}\\d{2}$/,\n FJ: /^(?:(?:\\+?679)?\\s?\\d{3}\\s?\\d{4})?$/,\n GB: /^(?:(?:\\+44\\s?|0)7\\d{3}(\\s?\\d{4,})?)$/,\n GH: /^(?:(?:\\+233)|0)?(?:\\d{9})$/,\n GI: /^(?:\\+350)?\\d{5}$/,\n GM: /^(?:\\+220)?\\d{5,7}$/,\n GT: /^(?:\\+502)?[2468]\\d{7,8}$/,\n GY: /^(?:(?:\\+592)?(?:(?:\\s)?[2-9])(?:(?:\\s)?\\d))?(?:(?:\\s)?\\d{4})$/,\n HK: /^(?:\\+852\\s?)?[456789]\\d{3}\\s?\\d{4}$/,\n HN: /^(?:\\+504)?[89]\\d{7}$/,\n HR: /^(?:\\+?385)?\\d{8,9}$/,\n HT: /^(?:\\+?509)?\\d{8}$/,\n HU: /^(?:(?:\\+36))(\\s?\\d{2}\\s?\\d{3}\\s?\\d{4})$/,\n ID: /^(?:\\+?62|0[1-9])[\\s-]?\\d{2,4}[\\s-]?\\d{3,4}[\\s-]?\\d{3,4}$/,\n IL: /^(?:(?:\\+972|0)(?:-)?)[23489]\\d{7}$/,\n JM: /^(?:(?:\\+1876))\\d{7,10}$/,\n KE: /^(?:(?:\\+254)|(?:0))(?:\\d{6,7})$/,\n KG: /^(?:\\+996)?\\s?\\d{9}$/,\n KH: /^(?:(?:\\+855)|(?:0))(?:\\s?[1-9]\\d{7,8})$/,\n KY: /^(?:\\+?1\\s?(345))\\d{6}$/,\n KZ: /^(?:\\+?7|8)?7\\d{9}$/,\n LA: /^(?:(?:\\+?856)|0)(20\\d{7,9})$/,\n LK: /^(?:(?:\\+94)|0)(?:\\d{9})$/,\n LR: /^(?:\\+231)[ -\\d]{4}[ -\\d]{4}$/,\n LS: /^(?:(?:\\+?266)|0)?[56]\\d{7}$/,\n MA: /^(?:(?:\\+?212(\\s*[-|\\s*]?\\d{1,9})?)|(?:0))(?:\\d{9})$/,\n MD: /^(?:(?:\\+373)|(?:0))(?:\\d{7,8})$/,\n MK: /^(?:\\+389|0)(?:(?:2[0-4]|[3-9])\\s?)?\\d{6}$/,\n MM: /^(?:(?:\\+?95)|0)?[1-9]\\d{9}$/,\n MN: /^(?:\\+976|0)\\d{8}$/,\n MO: /^(?:(?:\\+?853)|[0-9])?\\d{8}$/,\n MU: /^(?:\\+230|0)?\\d{8}$/,\n MV: /^(?:(?:\\+?960)|0)?\\d{7}$/,\n MW: /^(?:\\+265)[1-9]\\d{6}$/,\n MX: /^(?:(?:\\+?52)?\\s?(?:1|01)?\\s?)?(?:\\d{3}\\s?\\d{3}\\s?\\d{4})$/,\n NA: /^(?:(?:\\+264)|0)?\\d{8}$/,\n NG: /^(?:(?:\\+234)|(?:0))(?:\\d{7,8})$/,\n NI: /^(?:(?:\\+505))?(?:\\d{8})$/,\n NO: /^(?:(?:\\+?47)|\\d{2}|\\d{3})\\s?\\d{2}\\s?\\d{3}$/,\n NP: /^(?:(?:\\+977))?(\\d{9,10})$/,\n NZ: /^(?:\\+?64|0)(\\d{2,5} \\d{4,8}|\\d{3,4} \\d{4})$/,\n PE: /^(?:(?:\\+51)|0)?(?:9\\d{8})$/,\n PG: /^(?:\\+?675)?(?:[7-9]\\d{7})$/,\n PH: /^(?:(?:\\+?63)|0)(?:\\d{10})$/,\n PK: /^(?:(?:\\+92)|0)?[345]\\d{9}$/,\n QA: /^(?:\\+?974)?-?33\\d{5}$/,\n RU: /^(?:\\+?7|8)?[ -]?\\(?9\\d{2}\\)?[ -]?\\d{3}[ -]?\\d{2}[ -]?\\d{2}$/,\n SA: /^(?:\\+?966)?\\s?1?[\\s-]?(?:[45]\\d{2}|5\\d{3})[\\s-]?\\d{4}$/,\n SC: /^(?:(?:\\+248)|\\d{4})\\d{5}$/,\n SE: /^(?:\\+?46|0)\\s?[1-57-9](?:[0-9]\\s?){8}$/,\n SG: /^(?:(?:\\+65)|(?:\\(\\+65\\))|(?:65))\\d{4}\\d{4}$/,\n SL: /^(?:(?:\\+232)|(?:0))?\\d{9}$/,\n SO: /^(?:\\+252|0)?[567]\\d{7}$/,\n SS: /^(?:\\+211|0)?[1-9]\\d{7,9}$/,\n SV: /^(?:(?:\\+?503)|(?:0))(?:\\d{8})$/,\n SZ: /^(?:\\+?268)?\\d{7,8}$/,\n TH: /^(?:(?:\\+66)|0)\\d{9}$/,\n TT: /^(?:(?:\\+?1-868)|\\(?868\\)?)(\\d{7})$/,\n TZ: /^(?:(?:\\+?255)|0)?[67]\\d{8}$/,\n US: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n CA: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n UY: /^(?:(?:\\+598|0)\\s?(9\\d{3}|2\\d{2}|[4-9]\\d{6}))$/,\n UZ: /^(?:\\+?998)?\\s?[3456789]\\d{8}$/,\n YE: /^(?:\\+?967)?(?:\\d{7,8})$/,\n ZA: /^(?:(?:\\+27)|0)(\\d{9})$/,\n KW: /^(?:\\+?965)[569]\\d{7}$/,\n BH: /^(?:\\+?973)?[356]\\d{7}$/,\n TL: /^(?:(?:\\+670)\\s?)?[0-9]{3}\\s?[0-9]{3,4}$/,\n VC: /^(?:(?:\\+1)?784)?(?:\\d{3})?\\d{7}$/,\n VE: /^(?:(?:\\+58)|0)?4\\d{9}$/,\n VN: /^(?:(?:\\+84)|0)?[1-9]\\d{8}$/,\n ZM: /^(?:(?:\\+260)|0)?[123456789]\\d{8,9}$/,\n ZW: /^(?:(?:\\+263)|0)?(?:\\d{9,10})$/,\n LT: /^(?:(?:\\+370)|8)\\d{8}$/,\n LU: /^(?:(?:\\+352)?(6|2(6|7|8|9))\\d{6})$/,\n LV: /^(?:(?:\\+371)?2\\d{7})$/,\n ME: /^(?:(?:\\+382)?[67]\\d{7,20})$/,\n MG: /^(?:(?:\\+261)?3[234568]\\d{7})$/,\n MZ: /^(?:(?:\\+258)|(?:258))?8[234567]\\d{7,8}$/,\n NL: /^(?:(?:\\+31)|0(6(?:\\d{8})|[1-9](?:(?:\\d{8})|(?:\\s\\d{3}\\s\\d{4}))|(?:\\d{8})))$/,\n PA: /^(?:(?:\\+507)\\s?)?[46]\\d{6,7}$/,\n PL: /^(?:(?:\\+48)?(?:\\s?\\d{3}\\s?\\d{3}\\s?\\d{3}|(?:\\d{2}\\s?){4}\\d{2}|\\d{3}-\\d{3}-\\d{3}))$/,\n PR: /^(?:(?:\\+1)?787|939)\\d{7}$/,\n PS: /^(?:(?:\\+970))(5[2349])\\d{7}$/,\n PT: /^(?:(?:\\+351)?9(1\\d|2[1-9]|6[12345789]|7[12345789])\\d{7})$/,\n PY: /^(?:(?:\\+595|0)9[9876]\\d{7})$/,\n RO: /^(?:(?:\\+40|0))(?:7[2-8]\\d{7}|21\\d{8})$/,\n RS: /^(?:(?:\\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/,\n RW: /^(?:(?:\\+250)|(0))\\d{9}$/,\n SI: /^(?:(?:\\+386)|0)?[1-59]\\d{7,8}$/,\n SK: /^(?:(?:\\+421))?(0|9[0-8])\\d{8}$/,\n SM: /^(?:(?:\\+378)|(0549|6\\d{4}))\\d{5}$/,\n SN: /^(?:(?:\\+221)|0)?[3679]\\d{7}$/,\n SR: /^(?:(?:\\+597))\\d{7}$/,\n TG: /^(?:(?:\\+228))\\d{8}$/,\n TJ: /^(?:(?:\\+992))(37|55|77)\\d{7}$/,\n TN: /^(?:(?:\\+216)|22|9[1-9])\\d{7}$/,\n TR: /^(?:(?:\\+90)|(0))\\s?5\\d{9}$/,\n TW: /^(?:(?:\\+886)|0)?9\\d{8}$/,\n UA: /^(?:(?:\\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\\d{7}$/,\n UG: /^(?:(?:\\+256)|0)?[39]\\d{8}$/,\n};\n","/* Source: Google LibPhoneNumber Metadata: https://github.com/google/libphonenumber/blob/master/javascript/i18n/phonenumbers/metadata.js */\n\nexport const DIAL_CODE_MAPPER: { [key: number]: string[] } = {\n 1: [\n 'US',\n 'AG',\n 'AI',\n 'AS',\n 'BB',\n 'BM',\n 'BS',\n 'CA',\n 'DM',\n 'DO',\n 'GD',\n 'GU',\n 'JM',\n 'KN',\n 'KY',\n 'LC',\n 'MP',\n 'MS',\n 'PR',\n 'SX',\n 'TC',\n 'TT',\n 'VC',\n 'VG',\n 'VI',\n ],\n 7: ['RU', 'KZ'],\n 20: ['EG'],\n 27: ['ZA'],\n 30: ['GR'],\n 31: ['NL'],\n 32: ['BE'],\n 33: ['FR'],\n 34: ['ES'],\n 36: ['HU'],\n 39: ['IT', 'VA'],\n 40: ['RO'],\n 41: ['CH'],\n 43: ['AT'],\n 44: ['GB', 'GG', 'IM', 'JE'],\n 45: ['DK'],\n 46: ['SE'],\n 47: ['NO', 'SJ'],\n 48: ['PL'],\n 49: ['DE'],\n 51: ['PE'],\n 52: ['MX'],\n 53: ['CU'],\n 54: ['AR'],\n 55: ['BR'],\n 56: ['CL'],\n 57: ['CO'],\n 58: ['VE'],\n 60: ['MY'],\n 61: ['AU', 'CC', 'CX'],\n 62: ['ID'],\n 63: ['PH'],\n 64: ['NZ'],\n 65: ['SG'],\n 66: ['TH'],\n 81: ['JP'],\n 82: ['KR'],\n 84: ['VN'],\n 86: ['CN'],\n 90: ['TR'],\n 91: ['IN'],\n 92: ['PK'],\n 93: ['AF'],\n 94: ['LK'],\n 95: ['MM'],\n 98: ['IR'],\n 211: ['SS'],\n 212: ['MA', 'EH'],\n 213: ['DZ'],\n 216: ['TN'],\n 218: ['LY'],\n 220: ['GM'],\n 221: ['SN'],\n 222: ['MR'],\n 223: ['ML'],\n 224: ['GN'],\n 225: ['CI'],\n 226: ['BF'],\n 227: ['NE'],\n 228: ['TG'],\n 229: ['BJ'],\n 230: ['MU'],\n 231: ['LR'],\n 232: ['SL'],\n 233: ['GH'],\n 234: ['NG'],\n 235: ['TD'],\n 236: ['CF'],\n 237: ['CM'],\n 238: ['CV'],\n 239: ['ST'],\n 240: ['GQ'],\n 241: ['GA'],\n 242: ['CG'],\n 243: ['CD'],\n 244: ['AO'],\n 245: ['GW'],\n 246: ['IO'],\n 247: ['AC'],\n 248: ['SC'],\n 249: ['SD'],\n 250: ['RW'],\n 251: ['ET'],\n 252: ['SO'],\n 253: ['DJ'],\n 254: ['KE'],\n 255: ['TZ'],\n 256: ['UG'],\n 257: ['BI'],\n 258: ['MZ'],\n 260: ['ZM'],\n 261: ['MG'],\n 262: ['RE', 'YT'],\n 263: ['ZW'],\n 264: ['NA'],\n 265: ['MW'],\n 266: ['LS'],\n 267: ['BW'],\n 268: ['SZ'],\n 269: ['KM'],\n 290: ['SH', 'TA'],\n 291: ['ER'],\n 297: ['AW'],\n 298: ['FO'],\n 299: ['GL'],\n 350: ['GI'],\n 351: ['PT'],\n 352: ['LU'],\n 353: ['IE'],\n 354: ['IS'],\n 355: ['AL'],\n 356: ['MT'],\n 357: ['CY'],\n 358: ['FI', 'AX'],\n 359: ['BG'],\n 370: ['LT'],\n 371: ['LV'],\n 372: ['EE'],\n 373: ['MD'],\n 374: ['AM'],\n 375: ['BY'],\n 376: ['AD'],\n 377: ['MC'],\n 378: ['SM'],\n 380: ['UA'],\n 381: ['RS'],\n 382: ['ME'],\n 383: ['XK'],\n 385: ['HR'],\n 386: ['SI'],\n 387: ['BA'],\n 389: ['MK'],\n 420: ['CZ'],\n 421: ['SK'],\n 423: ['LI'],\n 500: ['FK'],\n 501: ['BZ'],\n 502: ['GT'],\n 503: ['SV'],\n 504: ['HN'],\n 505: ['NI'],\n 506: ['CR'],\n 507: ['PA'],\n 508: ['PM'],\n 509: ['HT'],\n 590: ['GP', 'BL', 'MF'],\n 591: ['BO'],\n 592: ['GY'],\n 593: ['EC'],\n 594: ['GF'],\n 595: ['PY'],\n 596: ['MQ'],\n 597: ['SR'],\n 598: ['UY'],\n 599: ['CW', 'BQ'],\n 670: ['TL'],\n 672: ['NF'],\n 673: ['BN'],\n 674: ['NR'],\n 675: ['PG'],\n 676: ['TO'],\n 677: ['SB'],\n 678: ['VU'],\n 679: ['FJ'],\n 680: ['PW'],\n 681: ['WF'],\n 682: ['CK'],\n 683: ['NU'],\n 685: ['WS'],\n 686: ['KI'],\n 687: ['NC'],\n 688: ['TV'],\n 689: ['PF'],\n 690: ['TK'],\n 691: ['FM'],\n 692: ['MH'],\n 800: ['001'],\n 808: ['001'],\n 850: ['KP'],\n 852: ['HK'],\n 853: ['MO'],\n 855: ['KH'],\n 856: ['LA'],\n 870: ['001'],\n 878: ['001'],\n 880: ['BD'],\n 881: ['001'],\n 882: ['001'],\n 883: ['001'],\n 886: ['TW'],\n 888: ['001'],\n 960: ['MV'],\n 961: ['LB'],\n 962: ['JO'],\n 963: ['SY'],\n 964: ['IQ'],\n 965: ['KW'],\n 966: ['SA'],\n 967: ['YE'],\n 968: ['OM'],\n 970: ['PS'],\n 971: ['AE'],\n 972: ['IL'],\n 973: ['BH'],\n 974: ['QA'],\n 975: ['BT'],\n 976: ['MN'],\n 977: ['NP'],\n 979: ['001'],\n 992: ['TJ'],\n 993: ['TM'],\n 994: ['AZ'],\n 995: ['GE'],\n 996: ['KG'],\n 998: ['UZ'],\n};\n","import { DIAL_CODE_MAPPER } from './data/dialCodeMapper';\nimport { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\n\n/**\n * Determines the country code based on the provided phone number.\n * This function employs a multi-step approach to identify the country code:\n * - If the phone number starts with '+', it extracts the numeric characters\n * and matches the leading digits with known dial codes mapped to countries.\n * - For matched dial codes, it further filters based on country-specific regex patterns\n * to validate the phone number format for those countries.\n * - If the phone number doesn't start with '+', it directly matches the number\n * against regular expressions associated with various countries to identify the code.\n *\n * @param phoneNumber The input phone number (string or number).\n * @returns The detected country code or an empty string if not found.\n */\nexport const detectCountryCodeFromDialCode = (\n phoneNumber: string | number,\n): string => {\n // If the phone number starts with '+', extract numeric characters\n if (phoneNumber.toString().charAt(0) === '+') {\n const cleanedPhoneNumberWithoutPlusPrefix = phoneNumber\n .toString()\n .replace(/\\D/g, '');\n\n const matchingCountries: string[] = [];\n\n // Iterate through dial codes and check for matches with cleaned phone number\n for (const code in DIAL_CODE_MAPPER) {\n if (cleanedPhoneNumberWithoutPlusPrefix.startsWith(code)) {\n matchingCountries.push(...DIAL_CODE_MAPPER[code]);\n }\n }\n\n // Filter matching countries based on phone number validation regex\n const matchedCountryCode = matchingCountries.find((countryCode: string) => {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex && regex.test(phoneNumber.toString())) return countryCode;\n return undefined;\n });\n\n // Return the first matched country code, if any\n return matchedCountryCode || '';\n } else {\n // If phone number doesn't start with '+', directly match against country regexes\n for (const countryCode in PHONE_REGEX_MAPPER) {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex.test(phoneNumber.toString())) {\n return countryCode;\n }\n }\n }\n\n // Return empty string if no country code is detected\n return '';\n};\n\nexport const cleanPhoneNumber = (phoneNumber: string) => {\n // Regular expression to match all characters except numbers and + sign at the start\n const regex = /[^0-9+]|(?!A)\\+/g;\n // Replace matched characters with an empty string\n const cleanedPhoneNumber = phoneNumber.replace(regex, '');\n return phoneNumber[0] === '+' ? `+${cleanedPhoneNumber}` : cleanedPhoneNumber;\n};\n","import { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Validates whether a given phone number is valid based on the provided country code or auto-detects the country code and checks if the number matches the defined regex pattern for that country.\nconst isValidPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_REGEX_MAPPER,\n): boolean => {\n // Clean the provided phoneNumber by removing non-numeric characters\n const cleanedPhoneNumber = cleanPhoneNumber(phoneNumber.toString());\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_REGEX_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(cleanedPhoneNumber);\n\n // Return false if phoneNumber is empty\n if (!phoneNumber) return false;\n\n // Check if the countryCode exists in the PHONE_REGEX_MAPPER\n if (countryCode in PHONE_REGEX_MAPPER) {\n // Fetch the regex pattern for the countryCode\n const regex = PHONE_REGEX_MAPPER[countryCode];\n // Test if the cleanedPhoneNumber matches the regex pattern\n return regex.test(cleanedPhoneNumber as string);\n }\n\n // Return false if the countryCode is not supported\n return false;\n};\n\nexport default withErrorBoundary(isValidPhoneNumber);\n","export const PHONE_FORMATTER_MAPPER: { [key: string]: string } = {\n IN: 'xxxx xxxxxx',\n MY: 'xx xxxxx xx',\n AE: 'xx xxx xxxx',\n AL: 'xxx xx xxxx',\n AM: 'xx xx xx xx',\n AR: 'xxxx-xxxx',\n AU: 'xxx xxx xxx',\n AW: 'xxx-xxxx',\n BB: 'xxx-xxxx',\n BD: 'xxxx-xxxxxx',\n BM: 'xxx-xxxx',\n BN: 'xxxx-xxxx',\n BO: 'xxxx-xxxx',\n BS: 'xxx-xxxx',\n BW: 'xx xxxx xxxx',\n BZ: 'xxx-xxxx',\n CA: 'xxx-xxx-xxxx',\n CH: 'xxx xxx xxx',\n CN: 'xxxx-xxxxxxx',\n CO: 'xxxx-xxxxxxx',\n CR: 'xxxx-xxxx',\n CU: 'xxxx-xxxx',\n CZ: 'xxx xxx xxx',\n DK: 'xx xx xx xx',\n DO: 'xxx-xxxxxxx',\n DZ: 'xxxx-xxxx-xxx',\n EG: 'xx xxx xxxx',\n ET: 'xx xxx xxxx',\n EU: 'xxx xx xx xx',\n FJ: 'xxxx xxxx',\n GB: 'xxxx xxx xxx',\n GH: 'xxx xxx xxxx',\n GI: 'xxxx xxxx',\n GM: 'xxxx-xxxx',\n GT: 'xxxx-xxxx',\n GY: 'xxx-xxxx',\n HK: 'xxxx xxxx',\n HN: 'xxxx-xxxx',\n HR: 'xxx xxx xxxx',\n HT: 'xxx-xxxx',\n HU: 'xxx xxx xxxx',\n ID: 'xxxx-xxxx-xxxx',\n IL: 'xxxx-xxx-xxx',\n JM: 'xxx-xxxx',\n KE: 'xxx xxxxxx',\n KG: 'xxx-xx-xx-xx',\n KH: 'xxx-xxx-xxx',\n KY: 'xxx-xxxx',\n KZ: 'xxx-xxx-xx-xx',\n LA: 'xxx xx xxxx',\n LK: 'xx xxx xxxx',\n LR: 'xxx-xxx-xxxx',\n LS: 'xxx xx xxxx',\n LT: 'xxx xxxxx',\n LU: 'xxx xx xxx',\n LV: 'xxxx xxxx',\n MA: 'xxxx-xxxxxx',\n MD: 'xx xxxxxx',\n ME: 'xx xxxxxx',\n MG: 'xx xx xx xx xx',\n MK: 'xx xx xx xx',\n MM: 'xx xxxxxx',\n MN: 'xxx-xx-xxxx',\n MO: 'xxxx xxxx',\n MU: 'xx xxxx xxxx',\n MV: 'xxxxxx',\n MW: 'xx xxxx xxxx',\n MX: 'xxx-xxx-xxxx',\n MZ: 'xx xxxxxxx',\n NA: 'xx xxxx xxxx',\n NG: 'xxx xxx xxxx',\n NI: 'xxxx-xxxx',\n NL: 'xxx-xxxxxxx',\n NO: 'xxxx xxxx',\n NP: 'xxxx-xxxxxxx',\n NZ: 'xxx-xxxxxxx',\n OM: 'xxxx-xxxx',\n PA: 'xxx-xxxx',\n PE: 'xxx-xxx-xxx',\n PG: 'xxx-xxxxxx',\n PH: 'xxx-xxxx',\n PK: 'xxx-xxxxxxx',\n PL: 'xxx xxx xxx',\n PR: 'xxx-xxx-xxxx',\n PS: 'xxxx-xxxxxxx',\n PT: 'xxx xxx xxx',\n PY: 'xxx-xxxxxx',\n QA: 'xxxx xxxx',\n RO: 'xxx xxx xxxx',\n RS: 'xxx xxxxx',\n RU: 'xxx xxx-xx-xx',\n RW: 'xxx xxxxxx',\n SA: 'xxx-xxxxxxx',\n SC: 'xx xxxxx',\n SE: 'xxx-xxx xx xx',\n SG: 'xxxx xxxx',\n SI: 'xx xxxxxx',\n SK: 'xxx xxx xxx',\n SL: 'xxx-xxxxxx',\n SM: 'xxxxx xxxxx',\n SN: 'xx xxx xx xx',\n SO: 'xxx xxxxxxx',\n SR: 'xxx-xxxx',\n SS: 'xxx xxxx xxx',\n SV: 'xxxx-xxxx',\n SZ: 'xxx xx xxxx',\n TG: 'xx xx xx xx',\n TH: 'xxx-xxxxxxx',\n TJ: 'xxx xx xx xx',\n TL: 'xxx-xxxxxxx',\n TN: 'xx xxxxxx',\n TR: 'xxx xxx xx xx',\n TT: 'xxx-xxxx',\n TW: 'xxxx-xxxxxx',\n TZ: 'xxx xxx xxxx',\n UA: 'xx xxx xx xx',\n UG: 'xxx xxxxxxx',\n US: 'xxx-xxx-xxxx',\n UY: 'xxx-xxxxx',\n UZ: 'xxx-xxx-xx-xx',\n VC: 'xxx-xxxx',\n VE: 'xxxx-xxx-xxxx',\n VN: 'xxxx-xxxxxxx',\n YE: 'xxxx-xxxx',\n ZA: 'xxx-xxx-xxxx',\n ZM: 'xxx-xxxxxxx',\n ZW: 'xx xxx xxxx',\n KW: 'xxx xx xxxx',\n BH: 'xxxx xxxx',\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Formats a provided phone number according to the predefined format for a specific country code, or auto-detects the country code and formats the number accordingly.\nconst formatPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_FORMATTER_MAPPER,\n): string => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Convert phoneNumber to string and clean it by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_FORMATTER_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Fetch the pattern for the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern) return phoneNumber;\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n // Extract the phoneNumber without the prefix\n const phoneNumberWithoutPrefix = phoneNumber.slice(diff);\n const formattedNumber: string[] = [];\n let numberIndex = 0;\n\n // Loop through the pattern to format the phoneNumber\n for (let i = 0; i < pattern.length; i++) {\n const patternChar = pattern[i];\n if (patternChar === 'x') {\n // Insert phoneNumber digits at 'x' positions\n if (numberIndex < phoneNumberWithoutPrefix.length) {\n formattedNumber.push(phoneNumberWithoutPrefix[numberIndex]);\n numberIndex++;\n }\n } else {\n // Insert non-digit characters from the pattern\n formattedNumber.push(patternChar);\n }\n }\n\n // Join the formattedNumber array to create the formattedPhoneNumber without prefix\n const formattedPhoneNumberWithoutPrefix = formattedNumber.join('');\n // Combine the prefix and formattedPhoneNumberWithoutPrefix\n const formattedPhoneNumberWithPrefix =\n phoneNumber.slice(0, diff) + ' ' + formattedPhoneNumberWithoutPrefix;\n\n // Return the formattedPhoneNumber with prefix after trimming whitespace\n return formattedPhoneNumberWithPrefix.trim();\n};\n\nexport default withErrorBoundary(formatPhoneNumber);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport formatPhoneNumber from './formatPhoneNumber';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\ninterface PhoneInfo {\n countryCode: string;\n dialCode: string;\n formattedPhoneNumber: string;\n formatTemplate: string;\n}\n\n// Parses a given phone number, identifies its country code (if not provided), and returns an object with details including the country code, formatted phone number, dial code, and format template.\nconst parsePhoneNumber = (phoneNumber: string, country?: string): PhoneInfo => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Clean the phoneNumber by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n const countryCode =\n country && country in PHONE_FORMATTER_MAPPER\n ? country\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Format the phone number using the detected/validated country code\n const formattedPhoneNumber = formatPhoneNumber(phoneNumber, countryCode);\n\n // Fetch the pattern associated with the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern)\n return {\n countryCode: countryCode || '',\n dialCode: '',\n formattedPhoneNumber: phoneNumber,\n formatTemplate: '',\n };\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n\n // Extract the dialCode from the phoneNumber\n const dialCode = phoneNumber.slice(0, diff);\n\n // Obtain the format template associated with the countryCode\n const formatTemplate = PHONE_FORMATTER_MAPPER[countryCode];\n\n // Return the parsed phone number information\n return {\n countryCode,\n formattedPhoneNumber,\n dialCode,\n formatTemplate,\n };\n};\n\nexport default withErrorBoundary(parsePhoneNumber);\n","export const stringToDate = (dateString: string): Date => {\n const supportedDateFormats = [\n // Date formats\n {\n regex: /^(\\d{4})\\/(\\d{2})\\/(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY/MM/DD\n {\n regex: /^(\\d{2})\\/(\\d{2})\\/(\\d{4})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n }, // DD/MM/YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY.MM.DD\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // DD-MM-YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // MM/DD/YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY-MM-DD\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY. MM. DD.\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // DD.MM.YYYY\n\n // Timestamp formats\n {\n regex: /^(\\d{4})\\/(\\d{2})\\/(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY/MM/DD HH:MM:SS\n {\n regex: /^(\\d{2})\\/(\\d{2})\\/(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD/MM/YYYY HH:MM:SS\n {\n regex: /^(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY-MM-DD HH:MM:SS\n {\n regex: /^(\\d{2})-(\\d{2})-(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD-MM-YYYY HH:MM:SS\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY.MM.DD HH:MM:SS\n {\n regex: /^(\\d{2})\\.(\\d{2})\\.(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD.MM.YYYY HH:MM:SS\n ];\n\n for (const format of supportedDateFormats) {\n const match = dateString.match(format.regex);\n if (match) {\n const year = match[format.yearIndex];\n const month = match[format.monthIndex];\n const day = match[format.dayIndex];\n const hour = format.hourIndex ? match[format.hourIndex] : '00';\n const minute = format.minuteIndex ? match[format.minuteIndex] : '00';\n const second = format.secondIndex ? match[format.secondIndex] : '00';\n\n return new Date(`${year}-${month}-${day}T${hour}:${minute}:${second}`);\n }\n }\n\n throw new Error('Date format not recognized');\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Adds a specified amount of time to a date.\n *\n * @param date The original date.\n * @param value The amount to add.\n * @param unit The unit of time to add (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time added.\n */\nconst add = (\n date: DateInput,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n switch (unit) {\n case 'days':\n date.setDate(date.getDate() + value);\n break;\n case 'months':\n date.setMonth(date.getMonth() + value);\n break;\n case 'years':\n date.setFullYear(date.getFullYear() + value);\n break;\n }\n return date;\n};\n\nexport default withErrorBoundary(add);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Formats date and time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional).\n * @returns {string} Formatted date and time string.\n */\nconst formatDateTime = (\n date: DateInput,\n locale: Locale,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n const dateObj: Date = date instanceof Date ? date : new Date(date);\n let formatter;\n\n try {\n formatter = new Intl.DateTimeFormat(locale, intlOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formatter.format(dateObj);\n};\n\nexport default withErrorBoundary(formatDateTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n DateFormatOptions,\n} from './types';\n\n/**\n * Formats date based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional).\n * @returns {string} Formatted date string.\n */\nconst formatDate = (\n date: DateInput,\n locale: Locale,\n options: DateFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n timeStyle: undefined,\n };\n\n let formattedDate;\n\n try {\n formattedDate = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedDate;\n};\n\nexport default withErrorBoundary(formatDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n TimeFormatOptions,\n} from './types';\n\n/**\n * Formats time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional).\n * @returns {string} Formatted time string.\n */\nconst formatTime = (\n date: DateInput,\n locale: Locale,\n options: TimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n dateStyle: undefined,\n };\n\n let formattedTime;\n\n try {\n formattedTime = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedTime;\n};\n\nexport default withErrorBoundary(formatTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\n\n/**\n * Gets the first day of the week for a given locale.\n *\n * @param locale The locale to determine the first day of the week for.\n * @param intlOptions Optional Intl.DateTimeFormatOptions for customization.\n * @returns The first day of the week (0-6, where 0 is Sunday).\n */\nconst getFirstDayOfWeek = (\n locale: string,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n let formatted;\n\n if (!intlOptions.weekday) intlOptions.weekday = 'long';\n\n try {\n const formatter = new Intl.DateTimeFormat(locale, intlOptions);\n /**\n * This date was chosen because January 2, 2000, is a Sunday.\n * In the Gregorian calendar, Sunday is considered the start of the week in some cultures (like in the United States), while in others, it's Monday (like in much of Europe).\n * By using a date that is known to be a Sunday, the function can accurately determine what day of the week is considered the start in the specified locale.\n */\n const sundayDate = new Date(2000, 0, 2); // A known Sunday\n formatted = formatter.format(sundayDate);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n // Generate localized weekdays array starting from Sunday\n const weekdays = Array.from({ length: 7 }, (_, i) =>\n new Intl.DateTimeFormat(locale, intlOptions).format(\n new Date(2000, 0, 2 + i),\n ),\n );\n\n const firstDayIndex = weekdays.indexOf(formatted);\n if (firstDayIndex === -1) {\n throw new Error('Unable to determine the first day of the week');\n }\n\n return weekdays[(firstDayIndex + 1) % 7]; // Adjusting since our reference date is a Sunday\n};\n\nexport default withErrorBoundary(getFirstDayOfWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Determines the quarter of the year for a given date.\n *\n * @param date The date to determine the quarter for.\n * @returns The quarter of the year (1-4).\n */\nconst getQuarter = (date: DateInput): number => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n return Math.ceil((date.getMonth() + 1) / 3);\n};\n\nexport default withErrorBoundary(getQuarter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Provides a relative time string (e.g., '3 hours ago', 'in 2 days').\n * This function calculates the difference between the given date and the base date,\n * then formats it in a locale-sensitive manner. It allows customization of the output\n * through Intl.RelativeTimeFormat options.\n *\n * @param date - The date to compare.\n * @param baseDate - The date to compare against (default: current date).\n * @param locale - The locale to use for formatting.\n * @param options - Options for the Intl.RelativeTimeFormat (optional).\n * @returns The relative time as a string.\n */\nconst getRelativeTime = (\n date: DateInput,\n baseDate: DateInput = new Date(),\n locale: Locale,\n options?: Intl.RelativeTimeFormatOptions,\n): string => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n baseDate =\n typeof baseDate === 'string'\n ? new Date(stringToDate(baseDate))\n : new Date(baseDate);\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000;\n\n // Define time units in seconds\n const minute = 60;\n const hour = minute * 60;\n const day = hour * 24;\n const week = day * 7;\n const month = day * 30;\n const year = day * 365;\n\n let value: number;\n let unit: Intl.RelativeTimeFormatUnit;\n\n if (Math.abs(diffInSeconds) < minute) {\n value = diffInSeconds;\n unit = 'second';\n } else if (Math.abs(diffInSeconds) < hour) {\n value = diffInSeconds / minute;\n unit = 'minute';\n } else if (Math.abs(diffInSeconds) < day) {\n value = diffInSeconds / hour;\n unit = 'hour';\n } else if (Math.abs(diffInSeconds) < week) {\n value = diffInSeconds / day;\n unit = 'day';\n } else if (Math.abs(diffInSeconds) < month) {\n value = diffInSeconds / week;\n unit = 'week';\n } else if (Math.abs(diffInSeconds) < year) {\n value = diffInSeconds / month;\n unit = 'month';\n } else {\n value = diffInSeconds / year;\n unit = 'year';\n }\n\n let relativeTime;\n\n try {\n const rtf = new Intl.RelativeTimeFormat(locale, options);\n relativeTime = rtf.format(Math.round(value), unit);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return relativeTime;\n};\n\nexport default withErrorBoundary(getRelativeTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Calculates the week number of the year for a given date.\n *\n * @param date The date to calculate the week number for.\n * @returns The week number of the year.\n */\nconst getWeek = (date: DateInput): number => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n const firstDayOfYear = new Date(date.getFullYear(), 0, 1);\n const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000;\n return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7);\n};\n\nexport default withErrorBoundary(getWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Returns an array of weekdays according to the specified locale.\n *\n * @param locale The locale to get weekdays for.\n * @param intlOptions Optional Intl.DateTimeFormatOptions for customization.\n * @returns An array of weekday names.\n */\nconst getWeekdays = (\n locale: Locale,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string[] => {\n try {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n if (!intlOptions.weekday) intlOptions.weekday = 'long';\n\n const formatter = new Intl.DateTimeFormat(locale, intlOptions);\n\n /** The date January 1, 1970, is a well-known reference point in computing known as the Unix epoch.\n * It's the date at which time is measured for Unix systems, making it a consistent and reliable choice for date calculations.\n * The choice of the date January 4, 1970, as the starting point is significant.\n * January 4, 1970, was a Sunday.\n * Since weeks typically start on Sunday or Monday in most locales, starting from a known Sunday allows the function to cycle through a complete week, capturing all weekdays in the order they appear for the given locale.\n * */\n return Array.from({ length: 7 }, (_, i) =>\n formatter.format(new Date(1970, 0, 4 + i)),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(getWeekdays);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Compares two dates to determine if the first is after the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is after date2.\n */\nconst isAfter = (date1: DateInput, date2: DateInput): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 > dateObj2;\n};\n\nexport default withErrorBoundary(isAfter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Compares two dates to determine if the first is before the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is before date2.\n */\nconst isBefore = (date1: DateInput, date2: DateInput): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 < dateObj2;\n};\n\nexport default withErrorBoundary(isBefore);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given year is a leap year.\n *\n * @param year The year to check.\n * @returns True if the year is a leap year, false otherwise.\n */\nconst isLeapYear = (year: number): boolean => {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n};\n\nexport default withErrorBoundary(isLeapYear);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { stringToDate } from './utils';\n\n/**\n * Checks if two dates fall on the same day.\n *\n * @param date1 The first date.\n * @param date2 The second date.\n * @returns True if both dates are on the same day, false otherwise.\n */\nconst isSameDay = (date1: Date, date2: Date): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n return (\n date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear()\n );\n};\n\nexport default withErrorBoundary(isSameDay);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { stringToDate } from './utils';\n\n/**\n * Checks if a given object is a valid Date object.\n *\n * @param date The object to check.\n * @returns True if the object is a valid Date, false otherwise.\n */\nconst isValidDate = (date: any): boolean => {\n try {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return date instanceof Date && !isNaN(date.getTime());\n};\n\nexport default withErrorBoundary(isValidDate);\n","export const LOCALE_DATE_FORMATS: { [key: string]: string } = {\n 'ar-AE': 'DD/MM/YYYY', // Arabic (U.A.E.)\n 'sq-AL': 'DD.MM.YYYY', // Albanian (Albania)\n 'hy-AM': 'DD.MM.YYYY', // Armenian (Armenia)\n 'es-AR': 'DD/MM/YYYY', // Spanish (Argentina)\n 'en-AU': 'DD/MM/YYYY', // English (Australia)\n 'nl-AW': 'DD-MM-YYYY', // Dutch (Aruba)\n 'en-BB': 'MM/DD/YYYY', // English (Barbados)\n 'bn-BD': 'DD/MM/YYYY', // Bengali (Bangladesh)\n 'en-BM': 'MM/DD/YYYY', // English (Bermuda)\n 'ms-BN': 'DD/MM/YYYY', // Malay (Brunei)\n 'es-BO': 'DD/MM/YYYY', // Spanish (Bolivia)\n 'en-BS': 'MM/DD/YYYY', // English (Bahamas)\n 'en-BW': 'DD/MM/YYYY', // English (Botswana)\n 'en-BZ': 'MM/DD/YYYY', // English (Belize)\n 'en-CA': 'DD/MM/YYYY', // English (Canada)\n 'de-CH': 'DD.MM.YYYY', // German (Switzerland)\n 'zh-CN': 'YYYY/MM/DD', // Chinese (China)\n 'es-CO': 'DD/MM/YYYY', // Spanish (Colombia)\n 'es-CR': 'DD/MM/YYYY', // Spanish (Costa Rica)\n 'es-CU': 'DD/MM/YYYY', // Spanish (Cuba)\n 'cs-CZ': 'DD.MM.YYYY', // Czech (Czech Republic)\n 'da-DK': 'DD-MM-YYYY', // Danish (Denmark)\n 'es-DO': 'DD/MM/YYYY', // Spanish (Dominican Republic)\n 'ar-DZ': 'DD/MM/YYYY', // Arabic (Algeria)\n 'ar-EG': 'DD/MM/YYYY', // Arabic (Egypt)\n 'am-ET': 'DD/MM/YYYY', // Amharic (Ethiopia)\n 'en-EU': 'DD/MM/YYYY', // English (European Union)\n 'en-FJ': 'DD/MM/YYYY', // English (Fiji)\n 'en-GB': 'DD/MM/YYYY', // English (United Kingdom)\n 'en-GH': 'DD/MM/YYYY', // English (Ghana)\n 'en-GI': 'DD/MM/YYYY', // English (Gibraltar)\n 'en-GM': 'DD/MM/YYYY', // English (Gambia)\n 'es-GT': 'DD/MM/YYYY', // Spanish (Guatemala)\n 'en-GY': 'DD/MM/YYYY', // English (Guyana)\n 'en-HK': 'DD/MM/YYYY', // English (Hong Kong)\n 'es-HN': 'DD/MM/YYYY', // Spanish (Honduras)\n 'hr-HR': 'DD.MM.YYYY', // Croatian (Croatia)\n 'ht-HT': 'MM/DD/YYYY', // Haitian (Haiti)\n 'hu-HU': 'YYYY. MM. DD.', // Hungarian (Hungary)\n 'id-ID': 'DD/MM/YYYY', // Indonesian (Indonesia)\n 'he-IL': 'DD/MM/YYYY', // Hebrew (Israel)\n 'en-IN': 'DD-MM-YYYY', // English (India)\n 'en-JM': 'MM/DD/YYYY', // English (Jamaica)\n 'en-KE': 'DD/MM/YYYY', // English (Kenya)\n 'ky-KG': 'DD.MM.YYYY', // Kyrgyz (Kyrgyzstan)\n 'km-KH': 'DD/MM/YYYY', // Khmer (Cambodia)\n 'en-KY': 'MM/DD/YYYY', // English (Cayman Islands)\n 'kk-KZ': 'DD.MM.YYYY', // Kazakh (Kazakhstan)\n 'lo-LA': 'DD/MM/YYYY', // Lao (Laos)\n 'si-LK': 'YYYY-MM-DD', // Sinhala (Sri Lanka)\n 'en-LR': 'MM/DD/YYYY', // English (Liberia)\n 'en-LS': 'DD/MM/YYYY', // English (Lesotho)\n 'ar-MA': 'DD/MM/YYYY', // Arabic (Morocco)\n 'ro-MD': 'DD.MM.YYYY', // Romanian (Moldova)\n 'mk-MK': 'DD.MM.YYYY', // Macedonian (North Macedonia)\n 'my-MM': 'DD/MM/YYYY', // Burmese (Myanmar)\n 'mn-MN': 'YYYY.MM.DD', // Mongolian (Mongolia)\n 'zh-MO': 'DD/MM/YYYY', // Chinese (Macao)\n 'en-MU': 'DD/MM/YYYY', // English (Mauritius)\n 'dv-MV': 'DD/MM/YYYY', // Divehi (Maldives)\n 'en-MW': 'DD/MM/YYYY', // English (Malawi)\n 'es-MX': 'DD/MM/YYYY', // Spanish (Mexico)\n 'ms-MY': 'DD/MM/YYYY', // Malay (Malaysia)\n 'en-NA': 'DD/MM/YYYY', // English (Namibia)\n 'en-NG': 'DD/MM/YYYY', // English (Nigeria)\n 'es-NI': 'DD/MM/YYYY', // Spanish (Nicaragua)\n 'no-NO': 'DD.MM.YYYY', // Norwegian (Norway)\n 'ne-NP': 'YYYY/MM/DD', // Nepali (Nepal)\n 'en-NZ': 'DD/MM/YYYY', // English (New Zealand)\n 'es-PE': 'DD/MM/YYYY', // Spanish (Peru)\n 'en-PG': 'DD/MM/YYYY', // English (Papua New Guinea)\n 'en-PH': 'MM/DD/YYYY', // English (Philippines)\n 'en-PK': 'DD/MM/YYYY', // English (Pakistan)\n 'ar-QA': 'DD/MM/YYYY', // Arabic (Qatar)\n 'ru-RU': 'DD.MM.YYYY', // Russian (Russia)\n 'ar-SA': 'DD/MM/YYYY', // Arabic (Saudi Arabia)\n 'en-SC': 'DD/MM/YYYY', // English (Seychelles)\n 'sv-SE': 'YYYY-MM-DD', // Swedish (Sweden)\n 'en-SG': 'DD/MM/YYYY', // English (Singapore)\n 'en-SL': 'DD/MM/YYYY', // English (Sierra Leone)\n 'so-SO': 'DD/MM/YYYY', // Somali (Somalia)\n 'en-SS': 'DD/MM/YYYY', // English (South Sudan)\n 'es-SV': 'DD/MM/YYYY', // Spanish (El Salvador)\n 'en-SZ': 'DD/MM/YYYY', // English (Eswatini)\n 'th-TH': 'DD/MM/YYYY', // Thai (Thailand)\n 'en-TT': 'MM/DD/YYYY', // English (Trinidad and Tobago)\n 'sw-TZ': 'DD/MM/YYYY', // Swahili (Tanzania)\n 'en-US': 'MM/DD/YYYY', // English (United States)\n 'es-UY': 'DD/MM/YYYY', // Spanish (Uruguay)\n 'uz-UZ': 'DD/MM/YYYY', // Uzbek (Uzbekistan)\n 'ar-YE': 'DD/MM/YYYY', // Arabic (Yemen)\n 'en-ZA': 'YYYY/MM/DD', // English (South Africa)\n 'ar-KW': 'DD/MM/YYYY', // Arabic (Kuwait)\n 'ar-BH': 'DD/MM/YYYY', // Arabic (Bahrain)\n 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman)\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Parses a date string based on a specific format.\n *\n * @param dateString The date string to parse.\n * @param format The format to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDateWithFormat = (\n dateString: string,\n format: string,\n): Date | null => {\n // Determine the separator based on the format (supports '/', '.', or '-')\n const separator = format.includes('/')\n ? '/'\n : format.includes('.')\n ? '.'\n : '-';\n const formatParts = format.split(separator);\n const dateParts = dateString.split(separator).map((num) => parseInt(num, 10));\n\n let year: number = 0,\n month: number = 0,\n day: number = 0;\n let yearSet: boolean = false,\n monthSet: boolean = false,\n daySet: boolean = false;\n\n // Check for format and date string mismatch\n if (dateParts.length !== formatParts.length) {\n return null; // Mismatch between date string and format\n }\n\n formatParts.forEach((part, index) => {\n // Check for non-numeric values in date string\n if (isNaN(dateParts[index])) {\n return null; // Invalid date part\n }\n\n // Assign year, month, and day based on the format\n switch (part) {\n case 'DD':\n day = dateParts[index];\n daySet = true;\n break;\n case 'MM':\n month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date\n monthSet = true;\n break;\n case 'YYYY':\n year = dateParts[index];\n yearSet = true;\n break;\n }\n });\n\n // Validate and create the date only if all parts are set\n if (yearSet && monthSet && daySet) {\n const parsedDate = new Date(year, month, day);\n // Validate date to catch invalid dates like February 30th\n if (\n parsedDate.getFullYear() === year &&\n parsedDate.getMonth() === month &&\n parsedDate.getDate() === day\n ) {\n return parsedDate;\n }\n }\n return null; // Invalid date or incomplete date information\n};\n\nexport default withErrorBoundary(\n parseDateWithFormat,\n);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { LOCALE_DATE_FORMATS } from './data/localeDateFormats';\nimport parseDateWithFormat from './parseDateWithFormat';\nimport { Locale } from './types';\n\n/**\n * Attempts to parse a string into a date object based on locale.\n * Uses the localeDateFormats mapping for determining the date format.\n *\n * @param dateString - The date string to parse.\n * @param locale - The locale to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDate = (dateString: string, locale: Locale): Date | null => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const format = LOCALE_DATE_FORMATS[locale];\n if (!format) {\n throw new Error(`No date format found for locale: ${locale}`);\n }\n return parseDateWithFormat(dateString, format);\n};\n\nexport default withErrorBoundary(parseDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport add from './add';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Subtracts a specified amount of time from a date.\n *\n * @param date The original date.\n * @param value The amount to subtract.\n * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time subtracted.\n */\nconst subtract = (\n date: DateInput,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n return add(date, -value, unit); // Reuse the add function with negative value\n};\n\nexport default withErrorBoundary(subtract);\n"],"names":["formatPhoneNumber","formatDateTime","parseDateWithFormat","add"],"mappings":"AAAA;AACM,MAAO,YAAa,SAAQ,KAAK,CAAA;AAErC,IAAA,WAAA,CAAY,OAA2B,EAAA;QACrC,KAAK,CAAC,OAAO,CAAC,CAAC;AACf,QAAA,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;AAC5B,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;;KAE7B;AACF,CAAA;AAED;;;;;;;;AAQG;AACI,MAAM,iBAAiB,GAAG,CAC/B,EAAK,KAC0C;IAC/C,OAAO,UAAyB,GAAG,IAAmB,EAAA;QACpD,IAAI;YACF,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAkB,CAAC;AAChD,SAAA;AAAC,QAAA,OAAO,GAAG,EAAE;AACZ,YAAA,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC;;;AAGpC,YAAA,MAAM,IAAI,YAAY,CAAC,GAAyB,CAAC,CAAC;AACnD,SAAA;AACH,KAAC,CAAC;AACJ,CAAC;;SC/Be,eAAe,GAAA;IAC7B,OAAO;AACL,QAAA,MAAM,EAAE,EAAE;AACV,QAAA,SAAS,EAAE,EAAE;AACb,QAAA,OAAO,EAAE,EAAE;KACZ,CAAC;AACJ;;MCLa,gBAAgB,CAAA;AAI3B,IAAA,WAAA,GAAA;AACE,QAAA,IAAI,CAAC,KAAK,GAAG,eAAe,EAAE,CAAC;KAChC;AAEM,IAAA,OAAO,WAAW,GAAA;AACvB,QAAA,IAAI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CAAC,QAAQ,EAAE,KAAK,KAAK;AAC/B,YAAA,UAAU,CAAC,OAAO,EAAE,KAAK,GAAG,EAC5B;AACA,YAAA,OAAO,UAAU,CAAC;AACnB,SAAA;AACF,KAAA;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,4BAAe,iBAAiB,CAC9B,mBAAmB,CACpB;;ACnED;;;;;;;AAOG;AACH,MAAM,SAAS,GAAG,CAAC,UAAkB,EAAE,MAAc,KAAiB;AACpE;;;;AAIK;AACL,IAAA,IAAI,CAAC,MAAM;QAAE,MAAM,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC,MAAM,IAAI,SAAS,EAAE,CAAC;AAE7D,IAAA,MAAM,MAAM,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC3C,IAAI,CAAC,MAAM,EAAE;AACX,QAAA,MAAM,IAAI,KAAK,CAAC,oCAAoC,MAAM,CAAA,CAAE,CAAC,CAAC;AAC/D,KAAA;AACD,IAAA,OAAOC,qBAAmB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC,CAAC;AAEF,kBAAe,iBAAiB,CAAmB,SAAS,CAAC;;ACzB7D;;;;;;;AAOG;AACH,MAAM,QAAQ,GAAG,CACf,IAAe,EACf,KAAa,EACb,IAAiC,KACzB;IACR,IAAI;QACF,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;IAE3E,OAAOC,KAAG,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACjC,CAAC,CAAC;AAEF,iBAAe,iBAAiB,CAAkB,QAAQ,CAAC;;;;"} \ No newline at end of file diff --git a/lib/esm/index.min.js b/lib/esm/index.min.js index e5d64819..7edbe68c 100644 --- a/lib/esm/index.min.js +++ b/lib/esm/index.min.js @@ -1,2 +1,2 @@ -class x extends Error{constructor(x){super(x),this.name="i18nify Error",this.timestamp=new Date}}const e=e=>function(...a){try{return e.call(this,...a)}catch(e){throw console.warn("[I18N Error]: ",e),new x(e)}};class a{constructor(){this.state={locale:"",direction:"",country:""}}static getInstance(){return a.instance||(a.instance=new a),a.instance}static resetInstance(){a.instance=void 0}getState(){return Object.assign({},this.state)}setState(x){this.state=Object.assign(Object.assign({},this.state),x)}resetState(){this.state={locale:"",direction:"",country:""}}}var n=a.getInstance();var r=e((()=>n.getState()));var t=e((x=>{n.setState(x)}));var o=e((()=>{n.resetState()}));const s=()=>{if("undefined"==typeof navigator)return"en-IN";if(window.Intl&&"object"==typeof window.Intl&&(window.navigator.languages||window.navigator.language)){return(window.navigator.languages||[window.navigator.language])[0]}return"en-IN"},Y=(x={})=>{let e=(null==x?void 0:x.locale)||n.getState().locale;e||(e=s());const a=(null==x?void 0:x.intlOptions)?Object.assign({},x.intlOptions):{};if(((null==x?void 0:x.currency)||a.currency)&&(a.style="currency",a.currency=x.currency||a.currency),!e)throw new Error("Pass valid locale !");return new Intl.NumberFormat(e||void 0,a)};var M=e(((x,e={})=>{if(!Number(x)&&0!==Number(x))throw new Error("Parameter `amount` is not a number!");let a="";try{a=Y(e).format(Number(x))}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return a}));const D={AED:{symbol:"د.إ",name:"United Arab Emirates Dirham"},ALL:{symbol:"Lek",name:"Albanian Lek"},AMD:{symbol:"֏",name:"Armenian Dram"},ARS:{symbol:"ARS",name:"Argentine Peso"},AUD:{symbol:"A$",name:"Australian Dollar"},AWG:{symbol:"Afl.",name:"Aruban Florin"},BBD:{symbol:"$",name:"Barbadian Dollar"},BDT:{symbol:"৳",name:"Bangladeshi Taka"},BMD:{symbol:"$",name:"Bermudian Dollar"},BND:{symbol:"BND",name:"Brunei Dollar"},BOB:{symbol:"Bs",name:"Bolivian Boliviano"},BSD:{symbol:"B$",name:"Bahamian Dollar"},BWP:{symbol:"P",name:"Botswanan Pula"},BZD:{symbol:"BZ$",name:"Belize Dollar"},CAD:{symbol:"C$",name:"Canadian Dollar"},CHF:{symbol:"CHf",name:"Swiss Franc"},CNY:{symbol:"¥",name:"Chinese Yuan"},COP:{symbol:"COL$",name:"Colombian Peso"},CRC:{symbol:"₡",name:"Costa Rican Colón"},CUP:{symbol:"$MN",name:"Cuban Peso"},CZK:{symbol:"Kč",name:"Czech Koruna"},DKK:{symbol:"DKK",name:"Danish Krone"},DOP:{symbol:"RD$",name:"Dominican Peso"},DZD:{symbol:"د.ج",name:"Algerian Dinar"},EGP:{symbol:"E£",name:"Egyptian Pound"},ETB:{symbol:"ብር",name:"Ethiopian Birr"},EUR:{symbol:"€",name:"Euro"},FJD:{symbol:"FJ$",name:"Fijian Dollar"},GBP:{symbol:"£",name:"British Pound"},GHS:{symbol:"GH₵",name:"Ghanaian Cedi"},GIP:{symbol:"GIP",name:"Gibraltar Pound"},GMD:{symbol:"D",name:"Gambian Dalasi"},GTQ:{symbol:"Q",name:"Guatemalan Quetzal"},GYD:{symbol:"G$",name:"Guyanese Dollar"},HKD:{symbol:"HK$",name:"Hong Kong Dollar"},HNL:{symbol:"HNL",name:"Honduran Lempira"},HRK:{symbol:"kn",name:"Croatian Kuna"},HTG:{symbol:"G",name:"Haitian Gourde"},HUF:{symbol:"Ft",name:"Hungarian Forint"},IDR:{symbol:"Rp",name:"Indonesian Rupiah"},ILS:{symbol:"₪",name:"Israeli New Shekel"},INR:{symbol:"₹",name:"Indian Rupee"},JMD:{symbol:"J$",name:"Jamaican Dollar"},KES:{symbol:"Ksh",name:"Kenyan Shilling"},KGS:{symbol:"Лв",name:"Kyrgystani Som"},KHR:{symbol:"៛",name:"Cambodian Riel"},KYD:{symbol:"CI$",name:"Cayman Islands Dollar"},KZT:{symbol:"₸",name:"Kazakhstani Tenge"},LAK:{symbol:"₭",name:"Laotian Kip"},LKR:{symbol:"රු",name:"Sri Lankan Rupee"},LRD:{symbol:"L$",name:"Liberian Dollar"},LSL:{symbol:"LSL",name:"Lesotho Loti"},MAD:{symbol:"د.م.",name:"Moroccan Dirham"},MDL:{symbol:"MDL",name:"Moldovan Leu"},MKD:{symbol:"ден",name:"Macedonian Denar"},MMK:{symbol:"MMK",name:"Myanmar Kyat"},MNT:{symbol:"₮",name:"Mongolian Tugrik"},MOP:{symbol:"MOP$",name:"Macanese Pataca"},MUR:{symbol:"₨",name:"Mauritian Rupee"},MVR:{symbol:"Rf",name:"Maldivian Rufiyaa"},MWK:{symbol:"MK",name:"Malawian Kwacha"},MXN:{symbol:"Mex$",name:"Mexican Peso"},MYR:{symbol:"RM",name:"Malaysian Ringgit"},NAD:{symbol:"N$",name:"Namibian Dollar"},NGN:{symbol:"₦",name:"Nigerian Naira"},NIO:{symbol:"NIO",name:"Nicaraguan Córdoba"},NOK:{symbol:"NOK",name:"Norwegian Krone"},NPR:{symbol:"रू",name:"Nepalese Rupee"},NZD:{symbol:"NZ$",name:"New Zealand Dollar"},PEN:{symbol:"S/",name:"Peruvian Nuevo Sol"},PGK:{symbol:"PGK",name:"Papua New Guinean Kina"},PHP:{symbol:"₱",name:"Philippine Peso"},PKR:{symbol:"₨",name:"Pakistani Rupee"},QAR:{symbol:"QR",name:"Qatari Riyal"},RUB:{symbol:"₽",name:"Russian Ruble"},SAR:{symbol:"SR",name:"Saudi Riyal"},SCR:{symbol:"SRe",name:"Seychellois Rupee"},SEK:{symbol:"SEK",name:"Swedish Krona"},SGD:{symbol:"S$",name:"Singapore Dollar"},SLL:{symbol:"Le",name:"Sierra Leonean Leone"},SOS:{symbol:"Sh.so.",name:"Somali Shilling"},SSP:{symbol:"SS£",name:"South Sudanese Pound"},SVC:{symbol:"₡",name:"Salvadoran Colón"},SZL:{symbol:"E",name:"Swazi Lilangeni"},THB:{symbol:"฿",name:"Thai Baht"},TTD:{symbol:"TT$",name:"Trinidad and Tobago Dollar"},TZS:{symbol:"Sh",name:"Tanzanian Shilling"},USD:{symbol:"$",name:"United States Dollar"},UYU:{symbol:"$U",name:"Uruguayan Peso"},UZS:{symbol:"so'm",name:"Uzbekistani Som"},YER:{symbol:"﷼",name:"Yemeni Rial"},ZAR:{symbol:"R",name:"South African Rand"},KWD:{symbol:"د.ك",name:"Kuwaiti Dinar"},BHD:{symbol:"د.ب.",name:"Bahraini Dinar"},OMR:{symbol:"ر.ع.",name:"Omani Rial"}};var i=e((()=>D));var l=e((x=>{var e;if(x in D)return null===(e=D[x])||void 0===e?void 0:e.symbol;throw new Error("Invalid currencyCode!")}));const m=["nan","infinity","percent","integer","group","decimal","fraction","plusSign","minusSign","percentSign","currency","code","symbol","name","compact","exponentInteger","exponentMinusSign","exponentSeparator","unit"];var d=e(((x,e={})=>{if(!Number(x)&&0!==Number(x))throw new Error("Parameter `amount` is not a number!");try{const a=Y(e).formatToParts(Number(x)),n={};return a.forEach((x=>{"group"===x.type?n.integer=(n.integer||"")+x.value:-1!=m.findIndex((e=>e===x.type))&&(n[x.type]=(n[x.type]||"")+x.value)})),Object.assign(Object.assign({},n),{isPrefixSymbol:"currency"===a[0].type,rawParts:a})}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}}));const c={IN:/^(?:(?:\+|0{0,2})91\s*[-]?\s*|[0]?)?[6789]\d{9}$/,MY:/^(\+?6?0)?(\d{1,3})[-. ]?(\d{7,8})$/,AE:/^(?:\+?971|0)?(?:2|3|4|6|7|9)\d{8}$/,AL:/^(?:\+?355)?(?:[4-9]\d{7}|6\d{8})$/,AM:/^(?:\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/,AR:/^(?:(?:\+|0{0,2})54)?(?:11|[2368]\d)(?:(?=\d{0,2}15)\d{2})??\d{8}$/,AU:/^(?:\+?61|0)4\d{8}$/,AW:/^(?:(?:\+297)?(?!0)\d{7})$/,BB:/^(?:(?:\+1)?246)?(?:\d{3})?\d{7}$/,BD:/^(?:\+?880|0)1[13456789]\d{8}$/,BM:/^(?:(?:\+1)?441)?(?:\d{2})?\d{7}$/,BN:/^(?:\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)|0)?(?:\d{9,10})$/,LT:/^(?:(?:\+370)|8)\d{8}$/,LU:/^(?:(?:\+352)?(6|2(6|7|8|9))\d{6})$/,LV:/^(?:(?:\+371)?2\d{7})$/,ME:/^(?:(?:\+382)?[67]\d{7,20})$/,MG:/^(?:(?:\+261)?3[234568]\d{7})$/,MZ:/^(?:(?:\+258)|(?:258))?8[234567]\d{7,8}$/,NL:/^(?:(?:\+31)|0(6(?:\d{8})|[1-9](?:(?:\d{8})|(?:\s\d{3}\s\d{4}))|(?:\d{8})))$/,PA:/^(?:(?:\+507)\s?)?[46]\d{6,7}$/,PL:/^(?:(?:\+48)?(?:\s?\d{3}\s?\d{3}\s?\d{3}|(?:\d{2}\s?){4}\d{2}|\d{3}-\d{3}-\d{3}))$/,PR:/^(?:(?:\+1)?787|939)\d{7}$/,PS:/^(?:(?:\+970))(5[2349])\d{7}$/,PT:/^(?:(?:\+351)?9(1\d|2[1-9]|6[12345789]|7[12345789])\d{7})$/,PY:/^(?:(?:\+595|0)9[9876]\d{7})$/,RO:/^(?:(?:\+40|0))(?:7[2-8]\d{7}|21\d{8})$/,RS:/^(?:(?:\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/,RW:/^(?:(?:\+250)|(0))\d{9}$/,SI:/^(?:(?:\+386)|0)?[1-59]\d{7,8}$/,SK:/^(?:(?:\+421))?(0|9[0-8])\d{8}$/,SM:/^(?:(?:\+378)|(0549|6\d{4}))\d{5}$/,SN:/^(?:(?:\+221)|0)?[3679]\d{7}$/,SR:/^(?:(?:\+597))\d{7}$/,TG:/^(?:(?:\+228))\d{8}$/,TJ:/^(?:(?:\+992))(37|55|77)\d{7}$/,TN:/^(?:(?:\+216)|22|9[1-9])\d{7}$/,TR:/^(?:(?:\+90)|(0))\s?5\d{9}$/,TW:/^(?:(?:\+886)|0)?9\d{8}$/,UA:/^(?:(?:\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\d{7}$/,UG:/^(?:(?:\+256)|0)?[39]\d{8}$/},u={1:["US","AG","AI","AS","BB","BM","BS","CA","DM","DO","GD","GU","JM","KN","KY","LC","MP","MS","PR","SX","TC","TT","VC","VG","VI"],7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT","VA"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH","TA"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],380:["UA"],381:["RS"],382:["ME"],383:["XK"],385:["HR"],386:["SI"],387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],691:["FM"],692:["MH"],800:["001"],808:["001"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],870:["001"],878:["001"],880:["BD"],881:["001"],882:["001"],883:["001"],886:["TW"],888:["001"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],979:["001"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},S=x=>{if("+"===x.toString().charAt(0)){const e=x.toString().replace(/\D/g,""),a=[];for(const x in u)e.startsWith(x)&&a.push(...u[x]);return a.find((e=>{const a=c[e];if(a&&a.test(x.toString()))return e}))||""}for(const e in c){if(c[e].test(x.toString()))return e}return""},y=x=>{const e=x.replace(/[^0-9+]|(?!A)\+/g,"");return"+"===x[0]?`+${e}`:e};var $=e(((x,e)=>{const a=y(x.toString());if(e=e&&e in c?e:S(a),!x)return!1;if(e in c){return c[e].test(a)}return!1}));const b={IN:"xxxx xxxxxx",MY:"xx xxxxx xx",AE:"xx xxx xxxx",AL:"xxx xx xxxx",AM:"xx xx xx xx",AR:"xxxx-xxxx",AU:"xxx xxx xxx",AW:"xxx-xxxx",BB:"xxx-xxxx",BD:"xxxx-xxxxxx",BM:"xxx-xxxx",BN:"xxxx-xxxx",BO:"xxxx-xxxx",BS:"xxx-xxxx",BW:"xx xxxx xxxx",BZ:"xxx-xxxx",CA:"xxx-xxx-xxxx",CH:"xxx xxx xxx",CN:"xxxx-xxxxxxx",CO:"xxxx-xxxxxxx",CR:"xxxx-xxxx",CU:"xxxx-xxxx",CZ:"xxx xxx xxx",DK:"xx xx xx xx",DO:"xxx-xxxxxxx",DZ:"xxxx-xxxx-xxx",EG:"xx xxx xxxx",ET:"xx xxx xxxx",EU:"xxx xx xx xx",FJ:"xxxx xxxx",GB:"xxxx xxx xxx",GH:"xxx xxx xxxx",GI:"xxxx xxxx",GM:"xxxx-xxxx",GT:"xxxx-xxxx",GY:"xxx-xxxx",HK:"xxxx xxxx",HN:"xxxx-xxxx",HR:"xxx xxx xxxx",HT:"xxx-xxxx",HU:"xxx xxx xxxx",ID:"xxxx-xxxx-xxxx",IL:"xxxx-xxx-xxx",JM:"xxx-xxxx",KE:"xxx xxxxxx",KG:"xxx-xx-xx-xx",KH:"xxx-xxx-xxx",KY:"xxx-xxxx",KZ:"xxx-xxx-xx-xx",LA:"xxx xx xxxx",LK:"xx xxx xxxx",LR:"xxx-xxx-xxxx",LS:"xxx xx xxxx",LT:"xxx xxxxx",LU:"xxx xx xxx",LV:"xxxx xxxx",MA:"xxxx-xxxxxx",MD:"xx xxxxxx",ME:"xx xxxxxx",MG:"xx xx xx xx xx",MK:"xx xx xx xx",MM:"xx xxxxxx",MN:"xxx-xx-xxxx",MO:"xxxx xxxx",MU:"xx xxxx xxxx",MV:"xxxxxx",MW:"xx xxxx xxxx",MX:"xxx-xxx-xxxx",MZ:"xx xxxxxxx",NA:"xx xxxx xxxx",NG:"xxx xxx xxxx",NI:"xxxx-xxxx",NL:"xxx-xxxxxxx",NO:"xxxx xxxx",NP:"xxxx-xxxxxxx",NZ:"xxx-xxxxxxx",OM:"xxxx-xxxx",PA:"xxx-xxxx",PE:"xxx-xxx-xxx",PG:"xxx-xxxxxx",PH:"xxx-xxxx",PK:"xxx-xxxxxxx",PL:"xxx xxx xxx",PR:"xxx-xxx-xxxx",PS:"xxxx-xxxxxxx",PT:"xxx xxx xxx",PY:"xxx-xxxxxx",QA:"xxxx xxxx",RO:"xxx xxx xxxx",RS:"xxx xxxxx",RU:"xxx xxx-xx-xx",RW:"xxx xxxxxx",SA:"xxx-xxxxxxx",SC:"xx xxxxx",SE:"xxx-xxx xx xx",SG:"xxxx xxxx",SI:"xx xxxxxx",SK:"xxx xxx xxx",SL:"xxx-xxxxxx",SM:"xxxxx xxxxx",SN:"xx xxx xx xx",SO:"xxx xxxxxxx",SR:"xxx-xxxx",SS:"xxx xxxx xxx",SV:"xxxx-xxxx",SZ:"xxx xx xxxx",TG:"xx xx xx xx",TH:"xxx-xxxxxxx",TJ:"xxx xx xx xx",TL:"xxx-xxxxxxx",TN:"xx xxxxxx",TR:"xxx xxx xx xx",TT:"xxx-xxxx",TW:"xxxx-xxxxxx",TZ:"xxx xxx xxxx",UA:"xx xxx xx xx",UG:"xxx xxxxxxx",US:"xxx-xxx-xxxx",UY:"xxx-xxxxx",UZ:"xxx-xxx-xx-xx",VC:"xxx-xxxx",VE:"xxxx-xxx-xxxx",VN:"xxxx-xxxxxxx",YE:"xxxx-xxxx",ZA:"xxx-xxx-xxxx",ZM:"xxx-xxxxxxx",ZW:"xx xxx xxxx",KW:"xxx xx xxxx",BH:"xxxx xxxx"};var g=e(((x,e)=>{if(!x)throw new Error("Parameter `phoneNumber` is invalid!");x=x.toString(),x=y(x),e=e&&e in b?e:S(x);const a=b[e];if(!a)return x;let n=0;for(let x=0;x{if(!x)throw new Error("Parameter `phoneNumber` is invalid!");x=x.toString(),x=y(x);const a=e&&e in b?e:S(x),n=g(x,a),r=b[a];if(!r)return{countryCode:a||"",dialCode:"",formattedPhoneNumber:x,formatTemplate:""};let t=0;for(let x=0;x{const n=new Date(x);switch(a){case"days":n.setDate(n.getDate()+e);break;case"months":n.setMonth(n.getMonth()+e);break;case"years":n.setFullYear(n.getFullYear()+e)}return n}));var A=e(((x,e,a={})=>{e||(e=n.getState().locale||s());const r=x instanceof Date?x:new Date(x);let t;try{t=new Intl.DateTimeFormat(e,a)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return t.format(r)}));var E=e(((x,e,a={})=>{e||(e=n.getState().locale||s());const r=Object.assign(Object.assign({},a),{timeStyle:void 0});let t;try{t=A(x,e,r)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return t}));var K=e(((x,e,a={})=>{e||(e=n.getState().locale||s());const r=Object.assign(Object.assign({},a),{dateStyle:void 0});let t;try{t=A(x,e,r)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return t}));var w=e((x=>{let e;x||(x=n.getState().locale||s());try{const a=new Intl.DateTimeFormat(x,{weekday:"short"}),n=new Date(2e3,0,2);e=a.format(n)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return["su","mo","tu","we","th","fr","sa"].indexOf(e.slice(0,2).toLowerCase())}));var T=e((x=>Math.ceil((x.getMonth()+1)/3)));var R=e(((x,e=new Date,a,r)=>{a||(a=n.getState().locale||s());const t=(x.getTime()-e.getTime())/1e3,o=3600,Y=86400,M=7*Y,D=30*Y,i=365*Y;let l,m,d;Math.abs(t)<60?(l=t,m="second"):Math.abs(t){const e=new Date(x.getFullYear(),0,1),a=(x.getTime()-e.getTime())/864e5;return Math.ceil((a+e.getDay()+1)/7)}));var P=e((x=>{try{x||(x=n.getState().locale||s());const e=new Intl.DateTimeFormat(x,{weekday:"long"});return Array.from({length:7},((x,a)=>e.format(new Date(1970,0,4+a))))}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}}));var B=e(((x,e)=>(x instanceof Date?x:new Date(x))>(e instanceof Date?e:new Date(e))));var C=e(((x,e)=>(x instanceof Date?x:new Date(x))<(e instanceof Date?e:new Date(e))));var L=e((x=>x%4==0&&x%100!=0||x%400==0));var f=e(((x,e)=>x.getDate()===e.getDate()&&x.getMonth()===e.getMonth()&&x.getFullYear()===e.getFullYear()));var H=e((x=>x instanceof Date&&!isNaN(x.getTime())));const I={"ar-AE":"DD/MM/YYYY","sq-AL":"DD.MM.YYYY","hy-AM":"DD.MM.YYYY","es-AR":"DD/MM/YYYY","en-AU":"DD/MM/YYYY","nl-AW":"DD-MM-YYYY","en-BB":"MM/DD/YYYY","bn-BD":"DD/MM/YYYY","en-BM":"MM/DD/YYYY","ms-BN":"DD/MM/YYYY","es-BO":"DD/MM/YYYY","en-BS":"MM/DD/YYYY","en-BW":"DD/MM/YYYY","en-BZ":"MM/DD/YYYY","en-CA":"DD/MM/YYYY","de-CH":"DD.MM.YYYY","zh-CN":"YYYY/MM/DD","es-CO":"DD/MM/YYYY","es-CR":"DD/MM/YYYY","es-CU":"DD/MM/YYYY","cs-CZ":"DD.MM.YYYY","da-DK":"DD-MM-YYYY","es-DO":"DD/MM/YYYY","ar-DZ":"DD/MM/YYYY","ar-EG":"DD/MM/YYYY","am-ET":"DD/MM/YYYY","en-EU":"DD/MM/YYYY","en-FJ":"DD/MM/YYYY","en-GB":"DD/MM/YYYY","en-GH":"DD/MM/YYYY","en-GI":"DD/MM/YYYY","en-GM":"DD/MM/YYYY","es-GT":"DD/MM/YYYY","en-GY":"DD/MM/YYYY","en-HK":"DD/MM/YYYY","es-HN":"DD/MM/YYYY","hr-HR":"DD.MM.YYYY","ht-HT":"MM/DD/YYYY","hu-HU":"YYYY. MM. DD.","id-ID":"DD/MM/YYYY","he-IL":"DD/MM/YYYY","en-IN":"DD-MM-YYYY","en-JM":"MM/DD/YYYY","en-KE":"DD/MM/YYYY","ky-KG":"DD.MM.YYYY","km-KH":"DD/MM/YYYY","en-KY":"MM/DD/YYYY","kk-KZ":"DD.MM.YYYY","lo-LA":"DD/MM/YYYY","si-LK":"YYYY-MM-DD","en-LR":"MM/DD/YYYY","en-LS":"DD/MM/YYYY","ar-MA":"DD/MM/YYYY","ro-MD":"DD.MM.YYYY","mk-MK":"DD.MM.YYYY","my-MM":"DD/MM/YYYY","mn-MN":"YYYY.MM.DD","zh-MO":"DD/MM/YYYY","en-MU":"DD/MM/YYYY","dv-MV":"DD/MM/YYYY","en-MW":"DD/MM/YYYY","es-MX":"DD/MM/YYYY","ms-MY":"DD/MM/YYYY","en-NA":"DD/MM/YYYY","en-NG":"DD/MM/YYYY","es-NI":"DD/MM/YYYY","no-NO":"DD.MM.YYYY","ne-NP":"YYYY/MM/DD","en-NZ":"DD/MM/YYYY","es-PE":"DD/MM/YYYY","en-PG":"DD/MM/YYYY","en-PH":"MM/DD/YYYY","en-PK":"DD/MM/YYYY","ar-QA":"DD/MM/YYYY","ru-RU":"DD.MM.YYYY","ar-SA":"DD/MM/YYYY","en-SC":"DD/MM/YYYY","sv-SE":"YYYY-MM-DD","en-SG":"DD/MM/YYYY","en-SL":"DD/MM/YYYY","so-SO":"DD/MM/YYYY","en-SS":"DD/MM/YYYY","es-SV":"DD/MM/YYYY","en-SZ":"DD/MM/YYYY","th-TH":"DD/MM/YYYY","en-TT":"MM/DD/YYYY","sw-TZ":"DD/MM/YYYY","en-US":"MM/DD/YYYY","es-UY":"DD/MM/YYYY","uz-UZ":"DD/MM/YYYY","ar-YE":"DD/MM/YYYY","en-ZA":"YYYY/MM/DD","ar-KW":"DD/MM/YYYY","ar-BH":"DD/MM/YYYY","ar-OM":"DD/MM/YYYY"};var O=e(((x,e)=>{const a=e.includes("/")?"/":e.includes(".")?".":"-",n=e.split(a),r=x.split(a).map((x=>parseInt(x,10)));let t=0,o=0,s=0,Y=!1,M=!1,D=!1;if(r.length!==n.length)return null;if(n.forEach(((x,e)=>{if(isNaN(r[e]))return null;switch(x){case"DD":s=r[e],D=!0;break;case"MM":o=r[e]-1,M=!0;break;case"YYYY":t=r[e],Y=!0}})),Y&&M&&D){const x=new Date(t,o,s);if(x.getFullYear()===t&&x.getMonth()===o&&x.getDate()===s)return x}return null}));var U=e(((x,e)=>{e||(e=n.getState().locale||s());const a=I[e];if(!a)throw new Error(`No date format found for locale: ${e}`);return O(x,a)}));var v=e(((x,e,a)=>h(x,-e,a)));export{h as add,E as formatDate,A as formatDateTime,M as formatNumber,d as formatNumberByParts,g as formatPhoneNumber,K as formatTime,i as getCurrencyList,l as getCurrencySymbol,w as getFirstDayOfWeek,T as getQuarter,R as getRelativeTime,r as getState,G as getWeek,P as getWeekdays,B as isAfter,C as isBefore,L as isLeapYear,f as isSameDay,H as isValidDate,$ as isValidPhoneNumber,U as parseDate,N as parsePhoneNumber,o as resetState,t as setState,v as subtract}; +class x extends Error{constructor(x){super(x),this.name="i18nify Error",this.timestamp=new Date}}const e=e=>function(...n){try{return e.call(this,...n)}catch(e){throw console.warn("[I18N Error]: ",e),new x(e)}};class n{constructor(){this.state={locale:"",direction:"",country:""}}static getInstance(){return n.instance||(n.instance=new n),n.instance}static resetInstance(){n.instance=void 0}getState(){return Object.assign({},this.state)}setState(x){this.state=Object.assign(Object.assign({},this.state),x)}resetState(){this.state={locale:"",direction:"",country:""}}}var a=n.getInstance();var r=e((()=>a.getState()));var t=e((x=>{a.setState(x)}));var o=e((()=>{a.resetState()}));const s=()=>{if("undefined"==typeof navigator)return"en-IN";if(window.Intl&&"object"==typeof window.Intl&&(window.navigator.languages||window.navigator.language)){return(window.navigator.languages||[window.navigator.language])[0]}return"en-IN"},d=(x={})=>{let e=(null==x?void 0:x.locale)||a.getState().locale;e||(e=s());const n=(null==x?void 0:x.intlOptions)?Object.assign({},x.intlOptions):{};if(((null==x?void 0:x.currency)||n.currency)&&(n.style="currency",n.currency=x.currency||n.currency),!e)throw new Error("Pass valid locale !");return new Intl.NumberFormat(e||void 0,n)};var Y=e(((x,e={})=>{if(!Number(x)&&0!==Number(x))throw new Error("Parameter `amount` is not a number!");let n="";try{n=d(e).format(Number(x))}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return n}));const D={AED:{symbol:"د.إ",name:"United Arab Emirates Dirham"},ALL:{symbol:"Lek",name:"Albanian Lek"},AMD:{symbol:"֏",name:"Armenian Dram"},ARS:{symbol:"ARS",name:"Argentine Peso"},AUD:{symbol:"A$",name:"Australian Dollar"},AWG:{symbol:"Afl.",name:"Aruban Florin"},BBD:{symbol:"$",name:"Barbadian Dollar"},BDT:{symbol:"৳",name:"Bangladeshi Taka"},BMD:{symbol:"$",name:"Bermudian Dollar"},BND:{symbol:"BND",name:"Brunei Dollar"},BOB:{symbol:"Bs",name:"Bolivian Boliviano"},BSD:{symbol:"B$",name:"Bahamian Dollar"},BWP:{symbol:"P",name:"Botswanan Pula"},BZD:{symbol:"BZ$",name:"Belize Dollar"},CAD:{symbol:"C$",name:"Canadian Dollar"},CHF:{symbol:"CHf",name:"Swiss Franc"},CNY:{symbol:"¥",name:"Chinese Yuan"},COP:{symbol:"COL$",name:"Colombian Peso"},CRC:{symbol:"₡",name:"Costa Rican Colón"},CUP:{symbol:"$MN",name:"Cuban Peso"},CZK:{symbol:"Kč",name:"Czech Koruna"},DKK:{symbol:"DKK",name:"Danish Krone"},DOP:{symbol:"RD$",name:"Dominican Peso"},DZD:{symbol:"د.ج",name:"Algerian Dinar"},EGP:{symbol:"E£",name:"Egyptian Pound"},ETB:{symbol:"ብር",name:"Ethiopian Birr"},EUR:{symbol:"€",name:"Euro"},FJD:{symbol:"FJ$",name:"Fijian Dollar"},GBP:{symbol:"£",name:"British Pound"},GHS:{symbol:"GH₵",name:"Ghanaian Cedi"},GIP:{symbol:"GIP",name:"Gibraltar Pound"},GMD:{symbol:"D",name:"Gambian Dalasi"},GTQ:{symbol:"Q",name:"Guatemalan Quetzal"},GYD:{symbol:"G$",name:"Guyanese Dollar"},HKD:{symbol:"HK$",name:"Hong Kong Dollar"},HNL:{symbol:"HNL",name:"Honduran Lempira"},HRK:{symbol:"kn",name:"Croatian Kuna"},HTG:{symbol:"G",name:"Haitian Gourde"},HUF:{symbol:"Ft",name:"Hungarian Forint"},IDR:{symbol:"Rp",name:"Indonesian Rupiah"},ILS:{symbol:"₪",name:"Israeli New Shekel"},INR:{symbol:"₹",name:"Indian Rupee"},JMD:{symbol:"J$",name:"Jamaican Dollar"},KES:{symbol:"Ksh",name:"Kenyan Shilling"},KGS:{symbol:"Лв",name:"Kyrgystani Som"},KHR:{symbol:"៛",name:"Cambodian Riel"},KYD:{symbol:"CI$",name:"Cayman Islands Dollar"},KZT:{symbol:"₸",name:"Kazakhstani Tenge"},LAK:{symbol:"₭",name:"Laotian Kip"},LKR:{symbol:"රු",name:"Sri Lankan Rupee"},LRD:{symbol:"L$",name:"Liberian Dollar"},LSL:{symbol:"LSL",name:"Lesotho Loti"},MAD:{symbol:"د.م.",name:"Moroccan Dirham"},MDL:{symbol:"MDL",name:"Moldovan Leu"},MKD:{symbol:"ден",name:"Macedonian Denar"},MMK:{symbol:"MMK",name:"Myanmar Kyat"},MNT:{symbol:"₮",name:"Mongolian Tugrik"},MOP:{symbol:"MOP$",name:"Macanese Pataca"},MUR:{symbol:"₨",name:"Mauritian Rupee"},MVR:{symbol:"Rf",name:"Maldivian Rufiyaa"},MWK:{symbol:"MK",name:"Malawian Kwacha"},MXN:{symbol:"Mex$",name:"Mexican Peso"},MYR:{symbol:"RM",name:"Malaysian Ringgit"},NAD:{symbol:"N$",name:"Namibian Dollar"},NGN:{symbol:"₦",name:"Nigerian Naira"},NIO:{symbol:"NIO",name:"Nicaraguan Córdoba"},NOK:{symbol:"NOK",name:"Norwegian Krone"},NPR:{symbol:"रू",name:"Nepalese Rupee"},NZD:{symbol:"NZ$",name:"New Zealand Dollar"},PEN:{symbol:"S/",name:"Peruvian Nuevo Sol"},PGK:{symbol:"PGK",name:"Papua New Guinean Kina"},PHP:{symbol:"₱",name:"Philippine Peso"},PKR:{symbol:"₨",name:"Pakistani Rupee"},QAR:{symbol:"QR",name:"Qatari Riyal"},RUB:{symbol:"₽",name:"Russian Ruble"},SAR:{symbol:"SR",name:"Saudi Riyal"},SCR:{symbol:"SRe",name:"Seychellois Rupee"},SEK:{symbol:"SEK",name:"Swedish Krona"},SGD:{symbol:"S$",name:"Singapore Dollar"},SLL:{symbol:"Le",name:"Sierra Leonean Leone"},SOS:{symbol:"Sh.so.",name:"Somali Shilling"},SSP:{symbol:"SS£",name:"South Sudanese Pound"},SVC:{symbol:"₡",name:"Salvadoran Colón"},SZL:{symbol:"E",name:"Swazi Lilangeni"},THB:{symbol:"฿",name:"Thai Baht"},TTD:{symbol:"TT$",name:"Trinidad and Tobago Dollar"},TZS:{symbol:"Sh",name:"Tanzanian Shilling"},USD:{symbol:"$",name:"United States Dollar"},UYU:{symbol:"$U",name:"Uruguayan Peso"},UZS:{symbol:"so'm",name:"Uzbekistani Som"},YER:{symbol:"﷼",name:"Yemeni Rial"},ZAR:{symbol:"R",name:"South African Rand"},KWD:{symbol:"د.ك",name:"Kuwaiti Dinar"},BHD:{symbol:"د.ب.",name:"Bahraini Dinar"},OMR:{symbol:"ر.ع.",name:"Omani Rial"}};var M=e((()=>D));var i=e((x=>{var e;if(x in D)return null===(e=D[x])||void 0===e?void 0:e.symbol;throw new Error("Invalid currencyCode!")}));const m=["nan","infinity","percent","integer","group","decimal","fraction","plusSign","minusSign","percentSign","currency","code","symbol","name","compact","exponentInteger","exponentMinusSign","exponentSeparator","unit"];var l=e(((x,e={})=>{if(!Number(x)&&0!==Number(x))throw new Error("Parameter `amount` is not a number!");try{const n=d(e).formatToParts(Number(x)),a={};return n.forEach((x=>{"group"===x.type?a.integer=(a.integer||"")+x.value:-1!=m.findIndex((e=>e===x.type))&&(a[x.type]=(a[x.type]||"")+x.value)})),Object.assign(Object.assign({},a),{isPrefixSymbol:"currency"===n[0].type,rawParts:n})}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}}));const c={IN:/^(?:(?:\+|0{0,2})91\s*[-]?\s*|[0]?)?[6789]\d{9}$/,MY:/^(\+?6?0)?(\d{1,3})[-. ]?(\d{7,8})$/,AE:/^(?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}|[4-9]\d{6}))$/,UZ:/^(?:\+?998)?\s?[3456789]\d{8}$/,YE:/^(?:\+?967)?(?:\d{7,8})$/,ZA:/^(?:(?:\+27)|0)(\d{9})$/,KW:/^(?:\+?965)[569]\d{7}$/,BH:/^(?:\+?973)?[356]\d{7}$/,TL:/^(?:(?:\+670)\s?)?[0-9]{3}\s?[0-9]{3,4}$/,VC:/^(?:(?:\+1)?784)?(?:\d{3})?\d{7}$/,VE:/^(?:(?:\+58)|0)?4\d{9}$/,VN:/^(?:(?:\+84)|0)?[1-9]\d{8}$/,ZM:/^(?:(?:\+260)|0)?[123456789]\d{8,9}$/,ZW:/^(?:(?:\+263)|0)?(?:\d{9,10})$/,LT:/^(?:(?:\+370)|8)\d{8}$/,LU:/^(?:(?:\+352)?(6|2(6|7|8|9))\d{6})$/,LV:/^(?:(?:\+371)?2\d{7})$/,ME:/^(?:(?:\+382)?[67]\d{7,20})$/,MG:/^(?:(?:\+261)?3[234568]\d{7})$/,MZ:/^(?:(?:\+258)|(?:258))?8[234567]\d{7,8}$/,NL:/^(?:(?:\+31)|0(6(?:\d{8})|[1-9](?:(?:\d{8})|(?:\s\d{3}\s\d{4}))|(?:\d{8})))$/,PA:/^(?:(?:\+507)\s?)?[46]\d{6,7}$/,PL:/^(?:(?:\+48)?(?:\s?\d{3}\s?\d{3}\s?\d{3}|(?:\d{2}\s?){4}\d{2}|\d{3}-\d{3}-\d{3}))$/,PR:/^(?:(?:\+1)?787|939)\d{7}$/,PS:/^(?:(?:\+970))(5[2349])\d{7}$/,PT:/^(?:(?:\+351)?9(1\d|2[1-9]|6[12345789]|7[12345789])\d{7})$/,PY:/^(?:(?:\+595|0)9[9876]\d{7})$/,RO:/^(?:(?:\+40|0))(?:7[2-8]\d{7}|21\d{8})$/,RS:/^(?:(?:\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/,RW:/^(?:(?:\+250)|(0))\d{9}$/,SI:/^(?:(?:\+386)|0)?[1-59]\d{7,8}$/,SK:/^(?:(?:\+421))?(0|9[0-8])\d{8}$/,SM:/^(?:(?:\+378)|(0549|6\d{4}))\d{5}$/,SN:/^(?:(?:\+221)|0)?[3679]\d{7}$/,SR:/^(?:(?:\+597))\d{7}$/,TG:/^(?:(?:\+228))\d{8}$/,TJ:/^(?:(?:\+992))(37|55|77)\d{7}$/,TN:/^(?:(?:\+216)|22|9[1-9])\d{7}$/,TR:/^(?:(?:\+90)|(0))\s?5\d{9}$/,TW:/^(?:(?:\+886)|0)?9\d{8}$/,UA:/^(?:(?:\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\d{7}$/,UG:/^(?:(?:\+256)|0)?[39]\d{8}$/},y={1:["US","AG","AI","AS","BB","BM","BS","CA","DM","DO","GD","GU","JM","KN","KY","LC","MP","MS","PR","SX","TC","TT","VC","VG","VI"],7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT","VA"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH","TA"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],380:["UA"],381:["RS"],382:["ME"],383:["XK"],385:["HR"],386:["SI"],387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],691:["FM"],692:["MH"],800:["001"],808:["001"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],870:["001"],878:["001"],880:["BD"],881:["001"],882:["001"],883:["001"],886:["TW"],888:["001"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],979:["001"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},u=x=>{if("+"===x.toString().charAt(0)){const e=x.toString().replace(/\D/g,""),n=[];for(const x in y)e.startsWith(x)&&n.push(...y[x]);return n.find((e=>{const n=c[e];if(n&&n.test(x.toString()))return e}))||""}for(const e in c){if(c[e].test(x.toString()))return e}return""},$=x=>{const e=x.replace(/[^0-9+]|(?!A)\+/g,"");return"+"===x[0]?`+${e}`:e};var S=e(((x,e)=>{const n=$(x.toString());if(e=e&&e in c?e:u(n),!x)return!1;if(e in c){return c[e].test(n)}return!1}));const b={IN:"xxxx xxxxxx",MY:"xx xxxxx xx",AE:"xx xxx xxxx",AL:"xxx xx xxxx",AM:"xx xx xx xx",AR:"xxxx-xxxx",AU:"xxx xxx xxx",AW:"xxx-xxxx",BB:"xxx-xxxx",BD:"xxxx-xxxxxx",BM:"xxx-xxxx",BN:"xxxx-xxxx",BO:"xxxx-xxxx",BS:"xxx-xxxx",BW:"xx xxxx xxxx",BZ:"xxx-xxxx",CA:"xxx-xxx-xxxx",CH:"xxx xxx xxx",CN:"xxxx-xxxxxxx",CO:"xxxx-xxxxxxx",CR:"xxxx-xxxx",CU:"xxxx-xxxx",CZ:"xxx xxx xxx",DK:"xx xx xx xx",DO:"xxx-xxxxxxx",DZ:"xxxx-xxxx-xxx",EG:"xx xxx xxxx",ET:"xx xxx xxxx",EU:"xxx xx xx xx",FJ:"xxxx xxxx",GB:"xxxx xxx xxx",GH:"xxx xxx xxxx",GI:"xxxx xxxx",GM:"xxxx-xxxx",GT:"xxxx-xxxx",GY:"xxx-xxxx",HK:"xxxx xxxx",HN:"xxxx-xxxx",HR:"xxx xxx xxxx",HT:"xxx-xxxx",HU:"xxx xxx xxxx",ID:"xxxx-xxxx-xxxx",IL:"xxxx-xxx-xxx",JM:"xxx-xxxx",KE:"xxx xxxxxx",KG:"xxx-xx-xx-xx",KH:"xxx-xxx-xxx",KY:"xxx-xxxx",KZ:"xxx-xxx-xx-xx",LA:"xxx xx xxxx",LK:"xx xxx xxxx",LR:"xxx-xxx-xxxx",LS:"xxx xx xxxx",LT:"xxx xxxxx",LU:"xxx xx xxx",LV:"xxxx xxxx",MA:"xxxx-xxxxxx",MD:"xx xxxxxx",ME:"xx xxxxxx",MG:"xx xx xx xx xx",MK:"xx xx xx xx",MM:"xx xxxxxx",MN:"xxx-xx-xxxx",MO:"xxxx xxxx",MU:"xx xxxx xxxx",MV:"xxxxxx",MW:"xx xxxx xxxx",MX:"xxx-xxx-xxxx",MZ:"xx xxxxxxx",NA:"xx xxxx xxxx",NG:"xxx xxx xxxx",NI:"xxxx-xxxx",NL:"xxx-xxxxxxx",NO:"xxxx xxxx",NP:"xxxx-xxxxxxx",NZ:"xxx-xxxxxxx",OM:"xxxx-xxxx",PA:"xxx-xxxx",PE:"xxx-xxx-xxx",PG:"xxx-xxxxxx",PH:"xxx-xxxx",PK:"xxx-xxxxxxx",PL:"xxx xxx xxx",PR:"xxx-xxx-xxxx",PS:"xxxx-xxxxxxx",PT:"xxx xxx xxx",PY:"xxx-xxxxxx",QA:"xxxx xxxx",RO:"xxx xxx xxxx",RS:"xxx xxxxx",RU:"xxx xxx-xx-xx",RW:"xxx xxxxxx",SA:"xxx-xxxxxxx",SC:"xx xxxxx",SE:"xxx-xxx xx xx",SG:"xxxx xxxx",SI:"xx xxxxxx",SK:"xxx xxx xxx",SL:"xxx-xxxxxx",SM:"xxxxx xxxxx",SN:"xx xxx xx xx",SO:"xxx xxxxxxx",SR:"xxx-xxxx",SS:"xxx xxxx xxx",SV:"xxxx-xxxx",SZ:"xxx xx xxxx",TG:"xx xx xx xx",TH:"xxx-xxxxxxx",TJ:"xxx xx xx xx",TL:"xxx-xxxxxxx",TN:"xx xxxxxx",TR:"xxx xxx xx xx",TT:"xxx-xxxx",TW:"xxxx-xxxxxx",TZ:"xxx xxx xxxx",UA:"xx xxx xx xx",UG:"xxx xxxxxxx",US:"xxx-xxx-xxxx",UY:"xxx-xxxxx",UZ:"xxx-xxx-xx-xx",VC:"xxx-xxxx",VE:"xxxx-xxx-xxxx",VN:"xxxx-xxxxxxx",YE:"xxxx-xxxx",ZA:"xxx-xxx-xxxx",ZM:"xxx-xxxxxxx",ZW:"xx xxx xxxx",KW:"xxx xx xxxx",BH:"xxxx xxxx"};var g=e(((x,e)=>{if(!x)throw new Error("Parameter `phoneNumber` is invalid!");x=x.toString(),x=$(x),e=e&&e in b?e:u(x);const n=b[e];if(!n)return x;let a=0;for(let x=0;x{if(!x)throw new Error("Parameter `phoneNumber` is invalid!");x=x.toString(),x=$(x);const n=e&&e in b?e:u(x),a=g(x,n),r=b[n];if(!r)return{countryCode:n||"",dialCode:"",formattedPhoneNumber:x,formatTemplate:""};let t=0;for(let x=0;x{const e=[{regex:/^(\d{4})\/(\d{2})\/(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3},{regex:/^(\d{2})\/(\d{2})\/(\d{4})$/,yearIndex:3,monthIndex:2,dayIndex:1},{regex:/^(\d{4})\.(\d{2})\.(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3},{regex:/^(\d{4})\.(\d{2})\.(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3},{regex:/^(\d{4})\.(\d{2})\.(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3},{regex:/^(\d{4})\.(\d{2})\.(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3},{regex:/^(\d{4})\.(\d{2})\.(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3},{regex:/^(\d{4})\.(\d{2})\.(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3},{regex:/^(\d{4})\/(\d{2})\/(\d{2}) (\d{2}):(\d{2}):(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3,hourIndex:4,minuteIndex:5,secondIndex:6},{regex:/^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2}):(\d{2})$/,yearIndex:3,monthIndex:2,dayIndex:1,hourIndex:4,minuteIndex:5,secondIndex:6},{regex:/^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3,hourIndex:4,minuteIndex:5,secondIndex:6},{regex:/^(\d{2})-(\d{2})-(\d{4}) (\d{2}):(\d{2}):(\d{2})$/,yearIndex:3,monthIndex:2,dayIndex:1,hourIndex:4,minuteIndex:5,secondIndex:6},{regex:/^(\d{4})\.(\d{2})\.(\d{2}) (\d{2}):(\d{2}):(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3,hourIndex:4,minuteIndex:5,secondIndex:6},{regex:/^(\d{2})\.(\d{2})\.(\d{4}) (\d{2}):(\d{2}):(\d{2})$/,yearIndex:3,monthIndex:2,dayIndex:1,hourIndex:4,minuteIndex:5,secondIndex:6}];for(const n of e){const e=x.match(n.regex);if(e){const x=e[n.yearIndex],a=e[n.monthIndex],r=e[n.dayIndex],t=n.hourIndex?e[n.hourIndex]:"00",o=n.minuteIndex?e[n.minuteIndex]:"00",s=n.secondIndex?e[n.secondIndex]:"00";return new Date(`${x}-${a}-${r}T${t}:${o}:${s}`)}}throw new Error("Date format not recognized")};var I=e(((x,e,n)=>{switch(x="string"==typeof x?new Date(w(x)):new Date(x),n){case"days":x.setDate(x.getDate()+e);break;case"months":x.setMonth(x.getMonth()+e);break;case"years":x.setFullYear(x.getFullYear()+e)}return x}));var N=e(((x,e,n={})=>{e||(e=a.getState().locale||s());const r=(x="string"==typeof x?new Date(w(x)):new Date(x))instanceof Date?x:new Date(x);let t;try{t=new Intl.DateTimeFormat(e,n)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return t.format(r)}));var A=e(((x,e,n={})=>{e||(e=a.getState().locale||s());const r=Object.assign(Object.assign({},n),{timeStyle:void 0});let t;try{t=N(x,e,r)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return t}));var E=e(((x,e,n={})=>{e||(e=a.getState().locale||s());const r=Object.assign(Object.assign({},n),{dateStyle:void 0});let t;try{t=N(x,e,r)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return t}));var f=e(((x,e={})=>{let n;x||(x=a.getState().locale||s()),e.weekday||(e.weekday="long");try{const a=new Intl.DateTimeFormat(x,e),r=new Date(2e3,0,2);n=a.format(r)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}const r=Array.from({length:7},((n,a)=>new Intl.DateTimeFormat(x,e).format(new Date(2e3,0,2+a)))),t=r.indexOf(n);if(-1===t)throw new Error("Unable to determine the first day of the week");return r[(t+1)%7]}));var T=e((x=>(x="string"==typeof x?new Date(w(x)):new Date(x),Math.ceil((x.getMonth()+1)/3))));var K=e(((x,e=new Date,n,r)=>{x="string"==typeof x?new Date(w(x)):new Date(x),e="string"==typeof e?new Date(w(e)):new Date(e),n||(n=a.getState().locale||s());const t=(x.getTime()-e.getTime())/1e3,o=3600,d=86400,Y=7*d,D=30*d,M=365*d;let i,m,l;Math.abs(t)<60?(i=t,m="second"):Math.abs(t){x="string"==typeof x?new Date(w(x)):new Date(x);const e=new Date(x.getFullYear(),0,1),n=(x.getTime()-e.getTime())/864e5;return Math.ceil((n+e.getDay()+1)/7)}));var G=e(((x,e={})=>{try{x||(x=a.getState().locale||s()),e.weekday||(e.weekday="long");const n=new Intl.DateTimeFormat(x,e);return Array.from({length:7},((x,e)=>n.format(new Date(1970,0,4+e))))}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}}));var P=e(((x,e)=>{x="string"==typeof x?new Date(w(x)):new Date(x),e="string"==typeof e?new Date(w(e)):new Date(e);return(x instanceof Date?x:new Date(x))>(e instanceof Date?e:new Date(e))}));var B=e(((x,e)=>{x="string"==typeof x?new Date(w(x)):new Date(x),e="string"==typeof e?new Date(w(e)):new Date(e);return(x instanceof Date?x:new Date(x))<(e instanceof Date?e:new Date(e))}));var C=e((x=>x%4==0&&x%100!=0||x%400==0));var L=e(((x,e)=>(x="string"==typeof x?new Date(w(x)):new Date(x),e="string"==typeof e?new Date(w(e)):new Date(e),x.getDate()===e.getDate()&&x.getMonth()===e.getMonth()&&x.getFullYear()===e.getFullYear())));var p=e((x=>{try{x="string"==typeof x?new Date(w(x)):new Date(x)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return x instanceof Date&&!isNaN(x.getTime())}));const H={"ar-AE":"DD/MM/YYYY","sq-AL":"DD.MM.YYYY","hy-AM":"DD.MM.YYYY","es-AR":"DD/MM/YYYY","en-AU":"DD/MM/YYYY","nl-AW":"DD-MM-YYYY","en-BB":"MM/DD/YYYY","bn-BD":"DD/MM/YYYY","en-BM":"MM/DD/YYYY","ms-BN":"DD/MM/YYYY","es-BO":"DD/MM/YYYY","en-BS":"MM/DD/YYYY","en-BW":"DD/MM/YYYY","en-BZ":"MM/DD/YYYY","en-CA":"DD/MM/YYYY","de-CH":"DD.MM.YYYY","zh-CN":"YYYY/MM/DD","es-CO":"DD/MM/YYYY","es-CR":"DD/MM/YYYY","es-CU":"DD/MM/YYYY","cs-CZ":"DD.MM.YYYY","da-DK":"DD-MM-YYYY","es-DO":"DD/MM/YYYY","ar-DZ":"DD/MM/YYYY","ar-EG":"DD/MM/YYYY","am-ET":"DD/MM/YYYY","en-EU":"DD/MM/YYYY","en-FJ":"DD/MM/YYYY","en-GB":"DD/MM/YYYY","en-GH":"DD/MM/YYYY","en-GI":"DD/MM/YYYY","en-GM":"DD/MM/YYYY","es-GT":"DD/MM/YYYY","en-GY":"DD/MM/YYYY","en-HK":"DD/MM/YYYY","es-HN":"DD/MM/YYYY","hr-HR":"DD.MM.YYYY","ht-HT":"MM/DD/YYYY","hu-HU":"YYYY. MM. DD.","id-ID":"DD/MM/YYYY","he-IL":"DD/MM/YYYY","en-IN":"DD-MM-YYYY","en-JM":"MM/DD/YYYY","en-KE":"DD/MM/YYYY","ky-KG":"DD.MM.YYYY","km-KH":"DD/MM/YYYY","en-KY":"MM/DD/YYYY","kk-KZ":"DD.MM.YYYY","lo-LA":"DD/MM/YYYY","si-LK":"YYYY-MM-DD","en-LR":"MM/DD/YYYY","en-LS":"DD/MM/YYYY","ar-MA":"DD/MM/YYYY","ro-MD":"DD.MM.YYYY","mk-MK":"DD.MM.YYYY","my-MM":"DD/MM/YYYY","mn-MN":"YYYY.MM.DD","zh-MO":"DD/MM/YYYY","en-MU":"DD/MM/YYYY","dv-MV":"DD/MM/YYYY","en-MW":"DD/MM/YYYY","es-MX":"DD/MM/YYYY","ms-MY":"DD/MM/YYYY","en-NA":"DD/MM/YYYY","en-NG":"DD/MM/YYYY","es-NI":"DD/MM/YYYY","no-NO":"DD.MM.YYYY","ne-NP":"YYYY/MM/DD","en-NZ":"DD/MM/YYYY","es-PE":"DD/MM/YYYY","en-PG":"DD/MM/YYYY","en-PH":"MM/DD/YYYY","en-PK":"DD/MM/YYYY","ar-QA":"DD/MM/YYYY","ru-RU":"DD.MM.YYYY","ar-SA":"DD/MM/YYYY","en-SC":"DD/MM/YYYY","sv-SE":"YYYY-MM-DD","en-SG":"DD/MM/YYYY","en-SL":"DD/MM/YYYY","so-SO":"DD/MM/YYYY","en-SS":"DD/MM/YYYY","es-SV":"DD/MM/YYYY","en-SZ":"DD/MM/YYYY","th-TH":"DD/MM/YYYY","en-TT":"MM/DD/YYYY","sw-TZ":"DD/MM/YYYY","en-US":"MM/DD/YYYY","es-UY":"DD/MM/YYYY","uz-UZ":"DD/MM/YYYY","ar-YE":"DD/MM/YYYY","en-ZA":"YYYY/MM/DD","ar-KW":"DD/MM/YYYY","ar-BH":"DD/MM/YYYY","ar-OM":"DD/MM/YYYY"};var O=e(((x,e)=>{const n=e.includes("/")?"/":e.includes(".")?".":"-",a=e.split(n),r=x.split(n).map((x=>parseInt(x,10)));let t=0,o=0,s=0,d=!1,Y=!1,D=!1;if(r.length!==a.length)return null;if(a.forEach(((x,e)=>{if(isNaN(r[e]))return null;switch(x){case"DD":s=r[e],D=!0;break;case"MM":o=r[e]-1,Y=!0;break;case"YYYY":t=r[e],d=!0}})),d&&Y&&D){const x=new Date(t,o,s);if(x.getFullYear()===t&&x.getMonth()===o&&x.getDate()===s)return x}return null}));var U=e(((x,e)=>{e||(e=a.getState().locale||s());const n=H[e];if(!n)throw new Error(`No date format found for locale: ${e}`);return O(x,n)}));var v=e(((x,e,n)=>(x="string"==typeof x?new Date(w(x)):new Date(x),I(x,-e,n))));export{I as add,A as formatDate,N as formatDateTime,Y as formatNumber,l as formatNumberByParts,g as formatPhoneNumber,E as formatTime,M as getCurrencyList,i as getCurrencySymbol,f as getFirstDayOfWeek,T as getQuarter,K as getRelativeTime,r as getState,R as getWeek,G as getWeekdays,P as isAfter,B as isBefore,C as isLeapYear,L as isSameDay,p as isValidDate,S as isValidPhoneNumber,U as parseDate,h as parsePhoneNumber,o as resetState,t as setState,v as subtract}; //# sourceMappingURL=index.min.js.map diff --git a/lib/esm/index.min.js.map b/lib/esm/index.min.js.map index e53d3390..9d011e82 100644 --- a/lib/esm/index.min.js.map +++ b/lib/esm/index.min.js.map @@ -1 +1 @@ -{"version":3,"file":"index.min.js","sources":["../../src/common/errorBoundary/index.ts","../../src/modules/.internal/state/index.ts","../../src/modules/.internal/utils/getDefaultState.ts","../../src/modules/core/getState.ts","../../src/modules/core/setState.ts","../../src/modules/core/resetState.ts","../../src/modules/.internal/utils/getLocale.ts","../../src/modules/.internal/utils/getIntlInstanceWithOptions.ts","../../src/modules/currency/formatNumber.ts","../../src/modules/currency/data/currencies.ts","../../src/modules/currency/getCurrencyList.ts","../../src/modules/currency/getCurrencySymbol.ts","../../src/modules/currency/constants.ts","../../src/modules/currency/formatNumberByParts.ts","../../src/modules/phoneNumber/data/phoneRegexMapper.ts","../../src/modules/phoneNumber/data/dialCodeMapper.ts","../../src/modules/phoneNumber/utils.ts","../../src/modules/phoneNumber/isValidPhoneNumber.ts","../../src/modules/phoneNumber/data/phoneFormatterMapper.ts","../../src/modules/phoneNumber/formatPhoneNumber.ts","../../src/modules/phoneNumber/parsePhoneNumber.ts","../../src/modules/dateTime/add.ts","../../src/modules/dateTime/formatDateTime.ts","../../src/modules/dateTime/formatDate.ts","../../src/modules/dateTime/formatTime.ts","../../src/modules/dateTime/getFirstDayOfWeek.ts","../../src/modules/dateTime/getQuarter.ts","../../src/modules/dateTime/getRelativeTime.ts","../../src/modules/dateTime/getWeek.ts","../../src/modules/dateTime/getWeekdays.ts","../../src/modules/dateTime/isAfter.ts","../../src/modules/dateTime/isBefore.ts","../../src/modules/dateTime/isLeapYear.ts","../../src/modules/dateTime/isSameDay.ts","../../src/modules/dateTime/isValidDate.ts","../../src/modules/dateTime/data/localeDateFormats.ts","../../src/modules/dateTime/parseDateWithFormat.ts","../../src/modules/dateTime/parseDate.ts","../../src/modules/dateTime/subtract.ts"],"sourcesContent":["// Custom Error class to extend properties to error object\nexport class I18nifyError extends Error {\n timestamp: Date;\n constructor(message: string | undefined) {\n super(message);\n this.name = 'i18nify Error';\n this.timestamp = new Date();\n // more params like type of error/severity can be added in future for better debugging.\n }\n}\n\n/**\n * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block.\n * It appends additional attributes and serves as a centralized error-handling service.\n * Usage =>\n * const wrappedUtilityFn = withErrorBoundary(utilityFn)\n *\n * @param fn utility that is wrapped in error boundary\n * @returns {Function} returns the function wrapped in try/catch block\n */\nexport const withErrorBoundary = any>(\n fn: T,\n): ((...args: Parameters) => ReturnType) => {\n return function (this: unknown, ...rest: Parameters): ReturnType {\n try {\n return fn.call(this, ...rest) as ReturnType;\n } catch (err) {\n console.warn('[I18N Error]: ', err);\n // Currently, we are throwing the error as it is to consumers.\n // In the future, this can be modified as per our requirement, like an error logging service.\n throw new I18nifyError(err as string | undefined);\n }\n };\n};\n","import { I18nState } from './types';\nimport { getDefaultState } from '../utils/getDefaultState';\n\nexport class I18nStateManager {\n private static instance: I18nStateManager | undefined;\n private state: I18nState;\n\n private constructor() {\n this.state = getDefaultState();\n }\n\n public static getInstance(): I18nStateManager {\n if (!I18nStateManager.instance) {\n I18nStateManager.instance = new I18nStateManager();\n }\n\n return I18nStateManager.instance;\n }\n\n public static resetInstance(): void {\n I18nStateManager.instance = undefined;\n }\n\n public getState(): I18nState {\n return { ...this.state };\n }\n\n public setState(newState: Partial): void {\n this.state = { ...this.state, ...newState };\n }\n\n public resetState(): void {\n this.state = getDefaultState();\n }\n}\n\nexport default I18nStateManager.getInstance();\n","import type { I18nState } from '../state/types';\n\nexport function getDefaultState(): I18nState {\n return {\n locale: '',\n direction: '',\n country: '',\n };\n}\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * function to return active i18n state\n *\n * ===== USAGE =====\n * import { getState } from '@razorpay/i18nify-js';\n *\n * console.log(getState())\n *\n * @returns i18n state\n */\nconst getState = (): I18nState => {\n return state.getState();\n};\n\nexport default withErrorBoundary(getState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * Function to set and override the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { setState } from \"@razorpay/i18nify-js\";\n * setState({locale: 'en-US'})\n *\n * @param newState data to set in i18nState instance\n */\nconst setState = (newState: Partial): void => {\n state.setState(newState);\n};\n\nexport default withErrorBoundary(setState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\n\n/**\n * Function to reset the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { resetState } from \"@razorpay/i18nify-js\";\n * resetState()\n *\n * @param newState data to set in i18nState instance\n */\nconst resetState = (): void => {\n state.resetState();\n};\n\nexport default withErrorBoundary(resetState);\n","export const getLocale = (): string => {\n // Check if running in a non-browser environment (e.g., Node.js or older browsers).\n if (typeof navigator === 'undefined') {\n return 'en-IN';\n }\n\n // Check if the browser supports the Intl object and user language preferences.\n if (\n window.Intl &&\n typeof window.Intl === 'object' &&\n (window.navigator.languages || window.navigator.language)\n ) {\n const userLocales = window.navigator.languages || [\n window.navigator.language,\n ];\n return userLocales[0];\n }\n\n // Fallback to a supported locale or the default locale.\n return 'en-IN';\n};\n","import { CURRENCIES } from '../../currency/data/currencies';\nimport state from '../state';\nimport { getLocale } from './getLocale';\n\nexport const getIntlInstanceWithOptions = (\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n) => {\n /** retrieve locale from below areas in order of preference\n * 1. options.locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n let locale = options?.locale || state.getState().locale;\n\n // If a specific locale is provided, use it; otherwise, use the browser's locale\n if (!locale) {\n locale = getLocale();\n }\n\n const intlOptions = options?.intlOptions ? { ...options.intlOptions } : {};\n\n if (options?.currency || intlOptions.currency) {\n intlOptions.style = 'currency';\n intlOptions.currency = (options.currency || intlOptions.currency) as string;\n }\n\n if (!locale) throw new Error('Pass valid locale !');\n\n return new Intl.NumberFormat(locale || undefined, intlOptions);\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\n\n// this function formats number based on different arguments passed\nconst formatNumber = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): string => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n let formattedAmount = '';\n\n try {\n formattedAmount = getIntlInstanceWithOptions(options).format(\n Number(amount),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedAmount;\n};\n\nexport default withErrorBoundary(formatNumber);\n","export const CURRENCIES: { [key: string]: { symbol: string; name: string } } = {\n AED: { symbol: 'د.إ', name: 'United Arab Emirates Dirham' },\n ALL: { symbol: 'Lek', name: 'Albanian Lek' },\n AMD: { symbol: '֏', name: 'Armenian Dram' },\n ARS: { symbol: 'ARS', name: 'Argentine Peso' },\n AUD: { symbol: 'A$', name: 'Australian Dollar' },\n AWG: { symbol: 'Afl.', name: 'Aruban Florin' },\n BBD: { symbol: '$', name: 'Barbadian Dollar' },\n BDT: { symbol: '৳', name: 'Bangladeshi Taka' },\n BMD: { symbol: '$', name: 'Bermudian Dollar' },\n BND: { symbol: 'BND', name: 'Brunei Dollar' },\n BOB: { symbol: 'Bs', name: 'Bolivian Boliviano' },\n BSD: { symbol: 'B$', name: 'Bahamian Dollar' },\n BWP: { symbol: 'P', name: 'Botswanan Pula' },\n BZD: { symbol: 'BZ$', name: 'Belize Dollar' },\n CAD: { symbol: 'C$', name: 'Canadian Dollar' },\n CHF: { symbol: 'CHf', name: 'Swiss Franc' },\n CNY: { symbol: '¥', name: 'Chinese Yuan' },\n COP: { symbol: 'COL$', name: 'Colombian Peso' },\n CRC: { symbol: '₡', name: 'Costa Rican Colón' },\n CUP: { symbol: '$MN', name: 'Cuban Peso' },\n CZK: { symbol: 'Kč', name: 'Czech Koruna' },\n DKK: { symbol: 'DKK', name: 'Danish Krone' },\n DOP: { symbol: 'RD$', name: 'Dominican Peso' },\n DZD: { symbol: 'د.ج', name: 'Algerian Dinar' },\n EGP: { symbol: 'E£', name: 'Egyptian Pound' },\n ETB: { symbol: 'ብር', name: 'Ethiopian Birr' },\n EUR: { symbol: '€', name: 'Euro' },\n FJD: { symbol: 'FJ$', name: 'Fijian Dollar' },\n GBP: { symbol: '£', name: 'British Pound' },\n GHS: { symbol: 'GH₵', name: 'Ghanaian Cedi' },\n GIP: { symbol: 'GIP', name: 'Gibraltar Pound' },\n GMD: { symbol: 'D', name: 'Gambian Dalasi' },\n GTQ: { symbol: 'Q', name: 'Guatemalan Quetzal' },\n GYD: { symbol: 'G$', name: 'Guyanese Dollar' },\n HKD: { symbol: 'HK$', name: 'Hong Kong Dollar' },\n HNL: { symbol: 'HNL', name: 'Honduran Lempira' },\n HRK: { symbol: 'kn', name: 'Croatian Kuna' },\n HTG: { symbol: 'G', name: 'Haitian Gourde' },\n HUF: { symbol: 'Ft', name: 'Hungarian Forint' },\n IDR: { symbol: 'Rp', name: 'Indonesian Rupiah' },\n ILS: { symbol: '₪', name: 'Israeli New Shekel' },\n INR: { symbol: '₹', name: 'Indian Rupee' },\n JMD: { symbol: 'J$', name: 'Jamaican Dollar' },\n KES: { symbol: 'Ksh', name: 'Kenyan Shilling' },\n KGS: { symbol: 'Лв', name: 'Kyrgystani Som' },\n KHR: { symbol: '៛', name: 'Cambodian Riel' },\n KYD: { symbol: 'CI$', name: 'Cayman Islands Dollar' },\n KZT: { symbol: '₸', name: 'Kazakhstani Tenge' },\n LAK: { symbol: '₭', name: 'Laotian Kip' },\n LKR: { symbol: 'රු', name: 'Sri Lankan Rupee' },\n LRD: { symbol: 'L$', name: 'Liberian Dollar' },\n LSL: { symbol: 'LSL', name: 'Lesotho Loti' },\n MAD: { symbol: 'د.م.', name: 'Moroccan Dirham' },\n MDL: { symbol: 'MDL', name: 'Moldovan Leu' },\n MKD: { symbol: 'ден', name: 'Macedonian Denar' },\n MMK: { symbol: 'MMK', name: 'Myanmar Kyat' },\n MNT: { symbol: '₮', name: 'Mongolian Tugrik' },\n MOP: { symbol: 'MOP$', name: 'Macanese Pataca' },\n MUR: { symbol: '₨', name: 'Mauritian Rupee' },\n MVR: { symbol: 'Rf', name: 'Maldivian Rufiyaa' },\n MWK: { symbol: 'MK', name: 'Malawian Kwacha' },\n MXN: { symbol: 'Mex$', name: 'Mexican Peso' },\n MYR: { symbol: 'RM', name: 'Malaysian Ringgit' },\n NAD: { symbol: 'N$', name: 'Namibian Dollar' },\n NGN: { symbol: '₦', name: 'Nigerian Naira' },\n NIO: { symbol: 'NIO', name: 'Nicaraguan Córdoba' },\n NOK: { symbol: 'NOK', name: 'Norwegian Krone' },\n NPR: { symbol: 'रू', name: 'Nepalese Rupee' },\n NZD: { symbol: 'NZ$', name: 'New Zealand Dollar' },\n PEN: { symbol: 'S/', name: 'Peruvian Nuevo Sol' },\n PGK: { symbol: 'PGK', name: 'Papua New Guinean Kina' },\n PHP: { symbol: '₱', name: 'Philippine Peso' },\n PKR: { symbol: '₨', name: 'Pakistani Rupee' },\n QAR: { symbol: 'QR', name: 'Qatari Riyal' },\n RUB: { symbol: '₽', name: 'Russian Ruble' },\n SAR: { symbol: 'SR', name: 'Saudi Riyal' },\n SCR: { symbol: 'SRe', name: 'Seychellois Rupee' },\n SEK: { symbol: 'SEK', name: 'Swedish Krona' },\n SGD: { symbol: 'S$', name: 'Singapore Dollar' },\n SLL: { symbol: 'Le', name: 'Sierra Leonean Leone' },\n SOS: { symbol: 'Sh.so.', name: 'Somali Shilling' },\n SSP: { symbol: 'SS£', name: 'South Sudanese Pound' },\n SVC: { symbol: '₡', name: 'Salvadoran Colón' },\n SZL: { symbol: 'E', name: 'Swazi Lilangeni' },\n THB: { symbol: '฿', name: 'Thai Baht' },\n TTD: { symbol: 'TT$', name: 'Trinidad and Tobago Dollar' },\n TZS: { symbol: 'Sh', name: 'Tanzanian Shilling' },\n USD: { symbol: '$', name: 'United States Dollar' },\n UYU: { symbol: '$U', name: 'Uruguayan Peso' },\n UZS: { symbol: \"so'm\", name: 'Uzbekistani Som' },\n YER: { symbol: '﷼', name: 'Yemeni Rial' },\n ZAR: { symbol: 'R', name: 'South African Rand' },\n KWD: { symbol: 'د.ك', name: 'Kuwaiti Dinar' },\n BHD: { symbol: 'د.ب.', name: 'Bahraini Dinar' },\n OMR: { symbol: 'ر.ع.', name: 'Omani Rial' },\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencyList = () => {\n return CURRENCIES;\n};\n\nexport default withErrorBoundary(getCurrencyList);\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencySymbol = (currencyCode: keyof typeof CURRENCIES): string => {\n if (currencyCode in CURRENCIES) return CURRENCIES[currencyCode]?.symbol;\n else throw new Error('Invalid currencyCode!');\n};\n\nexport default withErrorBoundary(getCurrencySymbol);\n","export const ALLOWED_FORMAT_PARTS_KEYS = [\n 'nan',\n 'infinity',\n 'percent',\n 'integer',\n 'group',\n 'decimal',\n 'fraction',\n 'plusSign',\n 'minusSign',\n 'percentSign',\n 'currency',\n 'code',\n 'symbol',\n 'name',\n 'compact',\n 'exponentInteger',\n 'exponentMinusSign',\n 'exponentSeparator',\n 'unit',\n] as const;\n","import { CURRENCIES } from './data/currencies';\nimport { ByParts, FormattedPartsObject } from './types';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\nimport { ALLOWED_FORMAT_PARTS_KEYS } from './constants';\n\nconst formatNumberByParts = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): ByParts => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n try {\n const formattedAmount = getIntlInstanceWithOptions(options).formatToParts(\n Number(amount),\n );\n\n const parts = formattedAmount;\n\n const formattedObj: FormattedPartsObject = {};\n\n parts.forEach((p) => {\n if (p.type === 'group') {\n formattedObj.integer = (formattedObj.integer || '') + p.value;\n } else if (\n ALLOWED_FORMAT_PARTS_KEYS.findIndex((item) => item === p.type) != -1\n ) {\n // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal' is skipped\n formattedObj[p.type] = (formattedObj[p.type] || '') + p.value;\n }\n });\n\n return {\n ...formattedObj,\n isPrefixSymbol: parts[0].type === 'currency',\n rawParts: parts,\n };\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(\n formatNumberByParts,\n);\n","export const PHONE_REGEX_MAPPER: { [key: string]: RegExp } = {\n IN: /^(?:(?:\\+|0{0,2})91\\s*[-]?\\s*|[0]?)?[6789]\\d{9}$/,\n MY: /^(\\+?6?0)?(\\d{1,3})[-. ]?(\\d{7,8})$/,\n AE: /^(?:\\+?971|0)?(?:2|3|4|6|7|9)\\d{8}$/,\n AL: /^(?:\\+?355)?(?:[4-9]\\d{7}|6\\d{8})$/,\n AM: /^(?:\\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/,\n AR: /^(?:(?:\\+|0{0,2})54)?(?:11|[2368]\\d)(?:(?=\\d{0,2}15)\\d{2})??\\d{8}$/,\n AU: /^(?:\\+?61|0)4\\d{8}$/,\n AW: /^(?:(?:\\+297)?(?!0)\\d{7})$/,\n BB: /^(?:(?:\\+1)?246)?(?:\\d{3})?\\d{7}$/,\n BD: /^(?:\\+?880|0)1[13456789]\\d{8}$/,\n BM: /^(?:(?:\\+1)?441)?(?:\\d{2})?\\d{7}$/,\n BN: /^(?:\\+?673)?(?:\\d{3})?\\d{4}$/,\n BO: /^(?:(?:\\+|0{0,2})591)?(?:(?:2|3|7|6)\\d{7})$/,\n BS: /^(?:(?:\\+1)?242)?(?:\\d{3})?\\d{7}$/,\n BW: /^(?:(?:\\+267)?\\s?)?[74]\\d{7}$/,\n BZ: /^(?:(?:\\+501)?\\s?)?[622]\\d{4}$/,\n CH: /^(?:(?:\\+41|0)(?:\\s*\\(?0\\)?\\s*))?(?:\\d{2}\\s*)?\\d{3}\\s*\\d{2}\\s*\\d{2}$/,\n CN: /^(?:(?:\\+|00)86)?1\\d{10}$/,\n CO: /^(?:(?:\\+57|0057)?)?[1-8]{1}\\d{6,7}$/,\n OM: /^(?:\\+?968)?(?:95|96|97|98)\\d{6}$/,\n CR: /^(?:(?:\\+506)?\\s*|0)?[1-9]\\d{7}$/,\n CU: /^(?:\\+?53)?(?:[5-8]\\d{7})$/,\n CZ: /^(?:\\+?420)?(?:\\d{9})$/,\n DK: /^(?:\\+?45)?(?:\\d{8})$/,\n DO: /^(?:(?:\\+1)?809|1-8(?:00|88|89))(?:\\d{7})$/,\n DZ: /^(?:\\+?213|0)([567]\\d{8})$/,\n EG: /^(?:(?:\\+20|20)?(\\d{10}))$/,\n ET: /^(?:\\+?251)?[1-59]\\d{8}$/,\n EU: /^(?:(?:\\+?3)?8)?\\s*(?:\\d{3}\\s*){3}\\d{2}$/,\n FJ: /^(?:(?:\\+?679)?\\s?\\d{3}\\s?\\d{4})?$/,\n GB: /^(?:(?:\\+44\\s?|0)7\\d{3}(\\s?\\d{4,})?)$/,\n GH: /^(?:(?:\\+233)|0)?(?:\\d{9})$/,\n GI: /^(?:\\+350)?\\d{5}$/,\n GM: /^(?:\\+220)?\\d{5,7}$/,\n GT: /^(?:\\+502)?[2468]\\d{7,8}$/,\n GY: /^(?:(?:\\+592)?(?:(?:\\s)?[2-9])(?:(?:\\s)?\\d))?(?:(?:\\s)?\\d{4})$/,\n HK: /^(?:\\+852\\s?)?[456789]\\d{3}\\s?\\d{4}$/,\n HN: /^(?:\\+504)?[89]\\d{7}$/,\n HR: /^(?:\\+?385)?\\d{8,9}$/,\n HT: /^(?:\\+?509)?\\d{8}$/,\n HU: /^(?:(?:\\+36))(\\s?\\d{2}\\s?\\d{3}\\s?\\d{4})$/,\n ID: /^(?:\\+?62|0[1-9])[\\s-]?\\d{2,4}[\\s-]?\\d{3,4}[\\s-]?\\d{3,4}$/,\n IL: /^(?:(?:\\+972|0)(?:-)?)[23489]\\d{7}$/,\n JM: /^(?:(?:\\+1876))\\d{7,10}$/,\n KE: /^(?:(?:\\+254)|(?:0))(?:\\d{6,7})$/,\n KG: /^(?:\\+996)?\\s?\\d{9}$/,\n KH: /^(?:(?:\\+855)|(?:0))(?:\\s?[1-9]\\d{7,8})$/,\n KY: /^(?:\\+?1\\s?(345))\\d{6}$/,\n KZ: /^(?:\\+?7|8)?7\\d{9}$/,\n LA: /^(?:(?:\\+?856)|0)(20\\d{7,9})$/,\n LK: /^(?:(?:\\+94)|0)(?:\\d{9})$/,\n LR: /^(?:\\+231)[ -\\d]{4}[ -\\d]{4}$/,\n LS: /^(?:(?:\\+?266)|0)?[56]\\d{7}$/,\n MA: /^(?:(?:\\+?212(\\s*[-|\\s*]?\\d{1,9})?)|(?:0))(?:\\d{9})$/,\n MD: /^(?:(?:\\+373)|(?:0))(?:\\d{7,8})$/,\n MK: /^(?:\\+389|0)(?:(?:2[0-4]|[3-9])\\s?)?\\d{6}$/,\n MM: /^(?:(?:\\+?95)|0)?[1-9]\\d{9}$/,\n MN: /^(?:\\+976|0)\\d{8}$/,\n MO: /^(?:(?:\\+?853)|[0-9])?\\d{8}$/,\n MU: /^(?:\\+230|0)?\\d{8}$/,\n MV: /^(?:(?:\\+?960)|0)?\\d{7}$/,\n MW: /^(?:\\+265)[1-9]\\d{6}$/,\n MX: /^(?:(?:\\+?52)?\\s?(?:1|01)?\\s?)?(?:\\d{3}\\s?\\d{3}\\s?\\d{4})$/,\n NA: /^(?:(?:\\+264)|0)?\\d{8}$/,\n NG: /^(?:(?:\\+234)|(?:0))(?:\\d{7,8})$/,\n NI: /^(?:(?:\\+505))?(?:\\d{8})$/,\n NO: /^(?:(?:\\+?47)|\\d{2}|\\d{3})\\s?\\d{2}\\s?\\d{3}$/,\n NP: /^(?:(?:\\+977))?(\\d{9,10})$/,\n NZ: /^(?:\\+?64|0)(\\d{2,5} \\d{4,8}|\\d{3,4} \\d{4})$/,\n PE: /^(?:(?:\\+51)|0)?(?:9\\d{8})$/,\n PG: /^(?:\\+?675)?(?:[7-9]\\d{7})$/,\n PH: /^(?:(?:\\+?63)|0)(?:\\d{10})$/,\n PK: /^(?:(?:\\+92)|0)?[345]\\d{9}$/,\n QA: /^(?:\\+?974)?-?33\\d{5}$/,\n RU: /^(?:\\+?7|8)?[ -]?\\(?9\\d{2}\\)?[ -]?\\d{3}[ -]?\\d{2}[ -]?\\d{2}$/,\n SA: /^(?:\\+?966)?\\s?1?[\\s-]?(?:[45]\\d{2}|5\\d{3})[\\s-]?\\d{4}$/,\n SC: /^(?:(?:\\+248)|\\d{4})\\d{5}$/,\n SE: /^(?:\\+?46|0)\\s?[1-57-9](?:[0-9]\\s?){8}$/,\n SG: /^(?:(?:\\+65)|(?:\\(\\+65\\))|(?:65))\\d{4}\\d{4}$/,\n SL: /^(?:(?:\\+232)|(?:0))?\\d{9}$/,\n SO: /^(?:\\+252|0)?[567]\\d{7}$/,\n SS: /^(?:\\+211|0)?[1-9]\\d{7,9}$/,\n SV: /^(?:(?:\\+?503)|(?:0))(?:\\d{8})$/,\n SZ: /^(?:\\+?268)?\\d{7,8}$/,\n TH: /^(?:(?:\\+66)|0)\\d{9}$/,\n TT: /^(?:(?:\\+?1-868)|\\(?868\\)?)(\\d{7})$/,\n TZ: /^(?:(?:\\+?255)|0)?[67]\\d{8}$/,\n US: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n CA: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n UY: /^(?:(?:\\+598|0)\\s?(9\\d{3}|2\\d{2}|[4-9]\\d{6}))$/,\n UZ: /^(?:\\+?998)?\\s?[3456789]\\d{8}$/,\n YE: /^(?:\\+?967)?(?:\\d{7,8})$/,\n ZA: /^(?:(?:\\+27)|0)(\\d{9})$/,\n KW: /^(?:\\+?965)[569]\\d{7}$/,\n BH: /^(?:\\+?973)?[356]\\d{7}$/,\n TL: /^(?:(?:\\+670)\\s?)?[0-9]{3}\\s?[0-9]{3,4}$/,\n VC: /^(?:(?:\\+1)?784)?(?:\\d{3})?\\d{7}$/,\n VE: /^(?:(?:\\+58)|0)?4\\d{9}$/,\n VN: /^(?:(?:\\+84)|0)?[1-9]\\d{8}$/,\n ZM: /^(?:(?:\\+260)|0)?[123456789]\\d{8,9}$/,\n ZW: /^(?:(?:\\+263)|0)?(?:\\d{9,10})$/,\n LT: /^(?:(?:\\+370)|8)\\d{8}$/,\n LU: /^(?:(?:\\+352)?(6|2(6|7|8|9))\\d{6})$/,\n LV: /^(?:(?:\\+371)?2\\d{7})$/,\n ME: /^(?:(?:\\+382)?[67]\\d{7,20})$/,\n MG: /^(?:(?:\\+261)?3[234568]\\d{7})$/,\n MZ: /^(?:(?:\\+258)|(?:258))?8[234567]\\d{7,8}$/,\n NL: /^(?:(?:\\+31)|0(6(?:\\d{8})|[1-9](?:(?:\\d{8})|(?:\\s\\d{3}\\s\\d{4}))|(?:\\d{8})))$/,\n PA: /^(?:(?:\\+507)\\s?)?[46]\\d{6,7}$/,\n PL: /^(?:(?:\\+48)?(?:\\s?\\d{3}\\s?\\d{3}\\s?\\d{3}|(?:\\d{2}\\s?){4}\\d{2}|\\d{3}-\\d{3}-\\d{3}))$/,\n PR: /^(?:(?:\\+1)?787|939)\\d{7}$/,\n PS: /^(?:(?:\\+970))(5[2349])\\d{7}$/,\n PT: /^(?:(?:\\+351)?9(1\\d|2[1-9]|6[12345789]|7[12345789])\\d{7})$/,\n PY: /^(?:(?:\\+595|0)9[9876]\\d{7})$/,\n RO: /^(?:(?:\\+40|0))(?:7[2-8]\\d{7}|21\\d{8})$/,\n RS: /^(?:(?:\\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/,\n RW: /^(?:(?:\\+250)|(0))\\d{9}$/,\n SI: /^(?:(?:\\+386)|0)?[1-59]\\d{7,8}$/,\n SK: /^(?:(?:\\+421))?(0|9[0-8])\\d{8}$/,\n SM: /^(?:(?:\\+378)|(0549|6\\d{4}))\\d{5}$/,\n SN: /^(?:(?:\\+221)|0)?[3679]\\d{7}$/,\n SR: /^(?:(?:\\+597))\\d{7}$/,\n TG: /^(?:(?:\\+228))\\d{8}$/,\n TJ: /^(?:(?:\\+992))(37|55|77)\\d{7}$/,\n TN: /^(?:(?:\\+216)|22|9[1-9])\\d{7}$/,\n TR: /^(?:(?:\\+90)|(0))\\s?5\\d{9}$/,\n TW: /^(?:(?:\\+886)|0)?9\\d{8}$/,\n UA: /^(?:(?:\\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\\d{7}$/,\n UG: /^(?:(?:\\+256)|0)?[39]\\d{8}$/,\n};\n","/* Source: Google LibPhoneNumber Metadata: https://github.com/google/libphonenumber/blob/master/javascript/i18n/phonenumbers/metadata.js */\n\nexport const DIAL_CODE_MAPPER: { [key: number]: string[] } = {\n 1: [\n 'US',\n 'AG',\n 'AI',\n 'AS',\n 'BB',\n 'BM',\n 'BS',\n 'CA',\n 'DM',\n 'DO',\n 'GD',\n 'GU',\n 'JM',\n 'KN',\n 'KY',\n 'LC',\n 'MP',\n 'MS',\n 'PR',\n 'SX',\n 'TC',\n 'TT',\n 'VC',\n 'VG',\n 'VI',\n ],\n 7: ['RU', 'KZ'],\n 20: ['EG'],\n 27: ['ZA'],\n 30: ['GR'],\n 31: ['NL'],\n 32: ['BE'],\n 33: ['FR'],\n 34: ['ES'],\n 36: ['HU'],\n 39: ['IT', 'VA'],\n 40: ['RO'],\n 41: ['CH'],\n 43: ['AT'],\n 44: ['GB', 'GG', 'IM', 'JE'],\n 45: ['DK'],\n 46: ['SE'],\n 47: ['NO', 'SJ'],\n 48: ['PL'],\n 49: ['DE'],\n 51: ['PE'],\n 52: ['MX'],\n 53: ['CU'],\n 54: ['AR'],\n 55: ['BR'],\n 56: ['CL'],\n 57: ['CO'],\n 58: ['VE'],\n 60: ['MY'],\n 61: ['AU', 'CC', 'CX'],\n 62: ['ID'],\n 63: ['PH'],\n 64: ['NZ'],\n 65: ['SG'],\n 66: ['TH'],\n 81: ['JP'],\n 82: ['KR'],\n 84: ['VN'],\n 86: ['CN'],\n 90: ['TR'],\n 91: ['IN'],\n 92: ['PK'],\n 93: ['AF'],\n 94: ['LK'],\n 95: ['MM'],\n 98: ['IR'],\n 211: ['SS'],\n 212: ['MA', 'EH'],\n 213: ['DZ'],\n 216: ['TN'],\n 218: ['LY'],\n 220: ['GM'],\n 221: ['SN'],\n 222: ['MR'],\n 223: ['ML'],\n 224: ['GN'],\n 225: ['CI'],\n 226: ['BF'],\n 227: ['NE'],\n 228: ['TG'],\n 229: ['BJ'],\n 230: ['MU'],\n 231: ['LR'],\n 232: ['SL'],\n 233: ['GH'],\n 234: ['NG'],\n 235: ['TD'],\n 236: ['CF'],\n 237: ['CM'],\n 238: ['CV'],\n 239: ['ST'],\n 240: ['GQ'],\n 241: ['GA'],\n 242: ['CG'],\n 243: ['CD'],\n 244: ['AO'],\n 245: ['GW'],\n 246: ['IO'],\n 247: ['AC'],\n 248: ['SC'],\n 249: ['SD'],\n 250: ['RW'],\n 251: ['ET'],\n 252: ['SO'],\n 253: ['DJ'],\n 254: ['KE'],\n 255: ['TZ'],\n 256: ['UG'],\n 257: ['BI'],\n 258: ['MZ'],\n 260: ['ZM'],\n 261: ['MG'],\n 262: ['RE', 'YT'],\n 263: ['ZW'],\n 264: ['NA'],\n 265: ['MW'],\n 266: ['LS'],\n 267: ['BW'],\n 268: ['SZ'],\n 269: ['KM'],\n 290: ['SH', 'TA'],\n 291: ['ER'],\n 297: ['AW'],\n 298: ['FO'],\n 299: ['GL'],\n 350: ['GI'],\n 351: ['PT'],\n 352: ['LU'],\n 353: ['IE'],\n 354: ['IS'],\n 355: ['AL'],\n 356: ['MT'],\n 357: ['CY'],\n 358: ['FI', 'AX'],\n 359: ['BG'],\n 370: ['LT'],\n 371: ['LV'],\n 372: ['EE'],\n 373: ['MD'],\n 374: ['AM'],\n 375: ['BY'],\n 376: ['AD'],\n 377: ['MC'],\n 378: ['SM'],\n 380: ['UA'],\n 381: ['RS'],\n 382: ['ME'],\n 383: ['XK'],\n 385: ['HR'],\n 386: ['SI'],\n 387: ['BA'],\n 389: ['MK'],\n 420: ['CZ'],\n 421: ['SK'],\n 423: ['LI'],\n 500: ['FK'],\n 501: ['BZ'],\n 502: ['GT'],\n 503: ['SV'],\n 504: ['HN'],\n 505: ['NI'],\n 506: ['CR'],\n 507: ['PA'],\n 508: ['PM'],\n 509: ['HT'],\n 590: ['GP', 'BL', 'MF'],\n 591: ['BO'],\n 592: ['GY'],\n 593: ['EC'],\n 594: ['GF'],\n 595: ['PY'],\n 596: ['MQ'],\n 597: ['SR'],\n 598: ['UY'],\n 599: ['CW', 'BQ'],\n 670: ['TL'],\n 672: ['NF'],\n 673: ['BN'],\n 674: ['NR'],\n 675: ['PG'],\n 676: ['TO'],\n 677: ['SB'],\n 678: ['VU'],\n 679: ['FJ'],\n 680: ['PW'],\n 681: ['WF'],\n 682: ['CK'],\n 683: ['NU'],\n 685: ['WS'],\n 686: ['KI'],\n 687: ['NC'],\n 688: ['TV'],\n 689: ['PF'],\n 690: ['TK'],\n 691: ['FM'],\n 692: ['MH'],\n 800: ['001'],\n 808: ['001'],\n 850: ['KP'],\n 852: ['HK'],\n 853: ['MO'],\n 855: ['KH'],\n 856: ['LA'],\n 870: ['001'],\n 878: ['001'],\n 880: ['BD'],\n 881: ['001'],\n 882: ['001'],\n 883: ['001'],\n 886: ['TW'],\n 888: ['001'],\n 960: ['MV'],\n 961: ['LB'],\n 962: ['JO'],\n 963: ['SY'],\n 964: ['IQ'],\n 965: ['KW'],\n 966: ['SA'],\n 967: ['YE'],\n 968: ['OM'],\n 970: ['PS'],\n 971: ['AE'],\n 972: ['IL'],\n 973: ['BH'],\n 974: ['QA'],\n 975: ['BT'],\n 976: ['MN'],\n 977: ['NP'],\n 979: ['001'],\n 992: ['TJ'],\n 993: ['TM'],\n 994: ['AZ'],\n 995: ['GE'],\n 996: ['KG'],\n 998: ['UZ'],\n};\n","import { DIAL_CODE_MAPPER } from './data/dialCodeMapper';\nimport { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\n\n/**\n * Determines the country code based on the provided phone number.\n * This function employs a multi-step approach to identify the country code:\n * - If the phone number starts with '+', it extracts the numeric characters\n * and matches the leading digits with known dial codes mapped to countries.\n * - For matched dial codes, it further filters based on country-specific regex patterns\n * to validate the phone number format for those countries.\n * - If the phone number doesn't start with '+', it directly matches the number\n * against regular expressions associated with various countries to identify the code.\n *\n * @param phoneNumber The input phone number (string or number).\n * @returns The detected country code or an empty string if not found.\n */\nexport const detectCountryCodeFromDialCode = (\n phoneNumber: string | number,\n): string => {\n // If the phone number starts with '+', extract numeric characters\n if (phoneNumber.toString().charAt(0) === '+') {\n const cleanedPhoneNumberWithoutPlusPrefix = phoneNumber\n .toString()\n .replace(/\\D/g, '');\n\n const matchingCountries: string[] = [];\n\n // Iterate through dial codes and check for matches with cleaned phone number\n for (const code in DIAL_CODE_MAPPER) {\n if (cleanedPhoneNumberWithoutPlusPrefix.startsWith(code)) {\n matchingCountries.push(...DIAL_CODE_MAPPER[code]);\n }\n }\n\n // Filter matching countries based on phone number validation regex\n const matchedCountryCode = matchingCountries.find((countryCode: string) => {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex && regex.test(phoneNumber.toString())) return countryCode;\n return undefined;\n });\n\n // Return the first matched country code, if any\n return matchedCountryCode || '';\n } else {\n // If phone number doesn't start with '+', directly match against country regexes\n for (const countryCode in PHONE_REGEX_MAPPER) {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex.test(phoneNumber.toString())) {\n return countryCode;\n }\n }\n }\n\n // Return empty string if no country code is detected\n return '';\n};\n\nexport const cleanPhoneNumber = (phoneNumber: string) => {\n // Regular expression to match all characters except numbers and + sign at the start\n const regex = /[^0-9+]|(?!A)\\+/g;\n // Replace matched characters with an empty string\n const cleanedPhoneNumber = phoneNumber.replace(regex, '');\n return phoneNumber[0] === '+' ? `+${cleanedPhoneNumber}` : cleanedPhoneNumber;\n};\n","import { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Validates whether a given phone number is valid based on the provided country code or auto-detects the country code and checks if the number matches the defined regex pattern for that country.\nconst isValidPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_REGEX_MAPPER,\n): boolean => {\n // Clean the provided phoneNumber by removing non-numeric characters\n const cleanedPhoneNumber = cleanPhoneNumber(phoneNumber.toString());\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_REGEX_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(cleanedPhoneNumber);\n\n // Return false if phoneNumber is empty\n if (!phoneNumber) return false;\n\n // Check if the countryCode exists in the PHONE_REGEX_MAPPER\n if (countryCode in PHONE_REGEX_MAPPER) {\n // Fetch the regex pattern for the countryCode\n const regex = PHONE_REGEX_MAPPER[countryCode];\n // Test if the cleanedPhoneNumber matches the regex pattern\n return regex.test(cleanedPhoneNumber as string);\n }\n\n // Return false if the countryCode is not supported\n return false;\n};\n\nexport default withErrorBoundary(isValidPhoneNumber);\n","export const PHONE_FORMATTER_MAPPER: { [key: string]: string } = {\n IN: 'xxxx xxxxxx',\n MY: 'xx xxxxx xx',\n AE: 'xx xxx xxxx',\n AL: 'xxx xx xxxx',\n AM: 'xx xx xx xx',\n AR: 'xxxx-xxxx',\n AU: 'xxx xxx xxx',\n AW: 'xxx-xxxx',\n BB: 'xxx-xxxx',\n BD: 'xxxx-xxxxxx',\n BM: 'xxx-xxxx',\n BN: 'xxxx-xxxx',\n BO: 'xxxx-xxxx',\n BS: 'xxx-xxxx',\n BW: 'xx xxxx xxxx',\n BZ: 'xxx-xxxx',\n CA: 'xxx-xxx-xxxx',\n CH: 'xxx xxx xxx',\n CN: 'xxxx-xxxxxxx',\n CO: 'xxxx-xxxxxxx',\n CR: 'xxxx-xxxx',\n CU: 'xxxx-xxxx',\n CZ: 'xxx xxx xxx',\n DK: 'xx xx xx xx',\n DO: 'xxx-xxxxxxx',\n DZ: 'xxxx-xxxx-xxx',\n EG: 'xx xxx xxxx',\n ET: 'xx xxx xxxx',\n EU: 'xxx xx xx xx',\n FJ: 'xxxx xxxx',\n GB: 'xxxx xxx xxx',\n GH: 'xxx xxx xxxx',\n GI: 'xxxx xxxx',\n GM: 'xxxx-xxxx',\n GT: 'xxxx-xxxx',\n GY: 'xxx-xxxx',\n HK: 'xxxx xxxx',\n HN: 'xxxx-xxxx',\n HR: 'xxx xxx xxxx',\n HT: 'xxx-xxxx',\n HU: 'xxx xxx xxxx',\n ID: 'xxxx-xxxx-xxxx',\n IL: 'xxxx-xxx-xxx',\n JM: 'xxx-xxxx',\n KE: 'xxx xxxxxx',\n KG: 'xxx-xx-xx-xx',\n KH: 'xxx-xxx-xxx',\n KY: 'xxx-xxxx',\n KZ: 'xxx-xxx-xx-xx',\n LA: 'xxx xx xxxx',\n LK: 'xx xxx xxxx',\n LR: 'xxx-xxx-xxxx',\n LS: 'xxx xx xxxx',\n LT: 'xxx xxxxx',\n LU: 'xxx xx xxx',\n LV: 'xxxx xxxx',\n MA: 'xxxx-xxxxxx',\n MD: 'xx xxxxxx',\n ME: 'xx xxxxxx',\n MG: 'xx xx xx xx xx',\n MK: 'xx xx xx xx',\n MM: 'xx xxxxxx',\n MN: 'xxx-xx-xxxx',\n MO: 'xxxx xxxx',\n MU: 'xx xxxx xxxx',\n MV: 'xxxxxx',\n MW: 'xx xxxx xxxx',\n MX: 'xxx-xxx-xxxx',\n MZ: 'xx xxxxxxx',\n NA: 'xx xxxx xxxx',\n NG: 'xxx xxx xxxx',\n NI: 'xxxx-xxxx',\n NL: 'xxx-xxxxxxx',\n NO: 'xxxx xxxx',\n NP: 'xxxx-xxxxxxx',\n NZ: 'xxx-xxxxxxx',\n OM: 'xxxx-xxxx',\n PA: 'xxx-xxxx',\n PE: 'xxx-xxx-xxx',\n PG: 'xxx-xxxxxx',\n PH: 'xxx-xxxx',\n PK: 'xxx-xxxxxxx',\n PL: 'xxx xxx xxx',\n PR: 'xxx-xxx-xxxx',\n PS: 'xxxx-xxxxxxx',\n PT: 'xxx xxx xxx',\n PY: 'xxx-xxxxxx',\n QA: 'xxxx xxxx',\n RO: 'xxx xxx xxxx',\n RS: 'xxx xxxxx',\n RU: 'xxx xxx-xx-xx',\n RW: 'xxx xxxxxx',\n SA: 'xxx-xxxxxxx',\n SC: 'xx xxxxx',\n SE: 'xxx-xxx xx xx',\n SG: 'xxxx xxxx',\n SI: 'xx xxxxxx',\n SK: 'xxx xxx xxx',\n SL: 'xxx-xxxxxx',\n SM: 'xxxxx xxxxx',\n SN: 'xx xxx xx xx',\n SO: 'xxx xxxxxxx',\n SR: 'xxx-xxxx',\n SS: 'xxx xxxx xxx',\n SV: 'xxxx-xxxx',\n SZ: 'xxx xx xxxx',\n TG: 'xx xx xx xx',\n TH: 'xxx-xxxxxxx',\n TJ: 'xxx xx xx xx',\n TL: 'xxx-xxxxxxx',\n TN: 'xx xxxxxx',\n TR: 'xxx xxx xx xx',\n TT: 'xxx-xxxx',\n TW: 'xxxx-xxxxxx',\n TZ: 'xxx xxx xxxx',\n UA: 'xx xxx xx xx',\n UG: 'xxx xxxxxxx',\n US: 'xxx-xxx-xxxx',\n UY: 'xxx-xxxxx',\n UZ: 'xxx-xxx-xx-xx',\n VC: 'xxx-xxxx',\n VE: 'xxxx-xxx-xxxx',\n VN: 'xxxx-xxxxxxx',\n YE: 'xxxx-xxxx',\n ZA: 'xxx-xxx-xxxx',\n ZM: 'xxx-xxxxxxx',\n ZW: 'xx xxx xxxx',\n KW: 'xxx xx xxxx',\n BH: 'xxxx xxxx',\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Formats a provided phone number according to the predefined format for a specific country code, or auto-detects the country code and formats the number accordingly.\nconst formatPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_FORMATTER_MAPPER,\n): string => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Convert phoneNumber to string and clean it by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_FORMATTER_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Fetch the pattern for the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern) return phoneNumber;\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n // Extract the phoneNumber without the prefix\n const phoneNumberWithoutPrefix = phoneNumber.slice(diff);\n const formattedNumber: string[] = [];\n let numberIndex = 0;\n\n // Loop through the pattern to format the phoneNumber\n for (let i = 0; i < pattern.length; i++) {\n const patternChar = pattern[i];\n if (patternChar === 'x') {\n // Insert phoneNumber digits at 'x' positions\n if (numberIndex < phoneNumberWithoutPrefix.length) {\n formattedNumber.push(phoneNumberWithoutPrefix[numberIndex]);\n numberIndex++;\n }\n } else {\n // Insert non-digit characters from the pattern\n formattedNumber.push(patternChar);\n }\n }\n\n // Join the formattedNumber array to create the formattedPhoneNumber without prefix\n const formattedPhoneNumberWithoutPrefix = formattedNumber.join('');\n // Combine the prefix and formattedPhoneNumberWithoutPrefix\n const formattedPhoneNumberWithPrefix =\n phoneNumber.slice(0, diff) + ' ' + formattedPhoneNumberWithoutPrefix;\n\n // Return the formattedPhoneNumber with prefix after trimming whitespace\n return formattedPhoneNumberWithPrefix.trim();\n};\n\nexport default withErrorBoundary(formatPhoneNumber);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport formatPhoneNumber from './formatPhoneNumber';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\ninterface PhoneInfo {\n countryCode: string;\n dialCode: string;\n formattedPhoneNumber: string;\n formatTemplate: string;\n}\n\n// Parses a given phone number, identifies its country code (if not provided), and returns an object with details including the country code, formatted phone number, dial code, and format template.\nconst parsePhoneNumber = (phoneNumber: string, country?: string): PhoneInfo => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Clean the phoneNumber by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n const countryCode =\n country && country in PHONE_FORMATTER_MAPPER\n ? country\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Format the phone number using the detected/validated country code\n const formattedPhoneNumber = formatPhoneNumber(phoneNumber, countryCode);\n\n // Fetch the pattern associated with the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern)\n return {\n countryCode: countryCode || '',\n dialCode: '',\n formattedPhoneNumber: phoneNumber,\n formatTemplate: '',\n };\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n\n // Extract the dialCode from the phoneNumber\n const dialCode = phoneNumber.slice(0, diff);\n\n // Obtain the format template associated with the countryCode\n const formatTemplate = PHONE_FORMATTER_MAPPER[countryCode];\n\n // Return the parsed phone number information\n return {\n countryCode,\n formattedPhoneNumber,\n dialCode,\n formatTemplate,\n };\n};\n\nexport default withErrorBoundary(parsePhoneNumber);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Adds a specified amount of time to a date.\n *\n * @param date The original date.\n * @param value The amount to add.\n * @param unit The unit of time to add (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time added.\n */\nconst add = (\n date: Date,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n const result = new Date(date);\n switch (unit) {\n case 'days':\n result.setDate(result.getDate() + value);\n break;\n case 'months':\n result.setMonth(result.getMonth() + value);\n break;\n case 'years':\n result.setFullYear(result.getFullYear() + value);\n break;\n }\n return result;\n};\n\nexport default withErrorBoundary(add);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale, DateTimeFormatOptions } from './types';\n\n/**\n * Formats date and time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional).\n * @returns {string} Formatted date and time string.\n */\nconst formatDateTime = (\n date: DateInput,\n locale: Locale,\n options: DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const dateObj: Date = date instanceof Date ? date : new Date(date);\n let formatter;\n\n try {\n formatter = new Intl.DateTimeFormat(locale, options);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formatter.format(dateObj);\n};\n\nexport default withErrorBoundary(formatDateTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n DateFormatOptions,\n} from './types';\n\n/**\n * Formats date based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional).\n * @returns {string} Formatted date string.\n */\nconst formatDate = (\n date: DateInput,\n locale: Locale,\n options: DateFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n timeStyle: undefined,\n };\n\n let formattedDate;\n\n try {\n formattedDate = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedDate;\n};\n\nexport default withErrorBoundary(formatDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n TimeFormatOptions,\n} from './types';\n\n/**\n * Formats time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional).\n * @returns {string} Formatted time string.\n */\nconst formatTime = (\n date: DateInput,\n locale: Locale,\n options: TimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n dateStyle: undefined,\n };\n\n let formattedTime;\n\n try {\n formattedTime = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedTime;\n};\n\nexport default withErrorBoundary(formatTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\n\n/**\n * Gets the first day of the week for a given locale.\n *\n * @param locale The locale to determine the first day of the week for.\n * @returns The first day of the week (0-6, where 0 is Sunday).\n */\nconst getFirstDayOfWeek = (locale: string): number => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n let formatted;\n\n try {\n const formatter = new Intl.DateTimeFormat(locale, { weekday: 'short' });\n const sampleDate = new Date(2000, 0, 2); // A Sunday\n formatted = formatter.format(sampleDate);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return ['su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'].indexOf(\n formatted.slice(0, 2).toLowerCase(),\n );\n};\n\nexport default withErrorBoundary(getFirstDayOfWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Determines the quarter of the year for a given date.\n *\n * @param date The date to determine the quarter for.\n * @returns The quarter of the year (1-4).\n */\nconst getQuarter = (date: Date): number => {\n return Math.ceil((date.getMonth() + 1) / 3);\n};\n\nexport default withErrorBoundary(getQuarter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Provides a relative time string (e.g., '3 hours ago', 'in 2 days').\n * This function calculates the difference between the given date and the base date,\n * then formats it in a locale-sensitive manner. It allows customization of the output\n * through Intl.RelativeTimeFormat options.\n *\n * @param date - The date to compare.\n * @param baseDate - The date to compare against (default: current date).\n * @param locale - The locale to use for formatting.\n * @param options - Options for the Intl.RelativeTimeFormat (optional).\n * @returns The relative time as a string.\n */\nconst getRelativeTime = (\n date: Date,\n baseDate: Date = new Date(),\n locale: Locale,\n options?: Intl.RelativeTimeFormatOptions,\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000;\n\n // Define time units in seconds\n const minute = 60;\n const hour = minute * 60;\n const day = hour * 24;\n const week = day * 7;\n const month = day * 30;\n const year = day * 365;\n\n let value: number;\n let unit: Intl.RelativeTimeFormatUnit;\n\n if (Math.abs(diffInSeconds) < minute) {\n value = diffInSeconds;\n unit = 'second';\n } else if (Math.abs(diffInSeconds) < hour) {\n value = diffInSeconds / minute;\n unit = 'minute';\n } else if (Math.abs(diffInSeconds) < day) {\n value = diffInSeconds / hour;\n unit = 'hour';\n } else if (Math.abs(diffInSeconds) < week) {\n value = diffInSeconds / day;\n unit = 'day';\n } else if (Math.abs(diffInSeconds) < month) {\n value = diffInSeconds / week;\n unit = 'week';\n } else if (Math.abs(diffInSeconds) < year) {\n value = diffInSeconds / month;\n unit = 'month';\n } else {\n value = diffInSeconds / year;\n unit = 'year';\n }\n\n let relativeTime;\n\n try {\n const rtf = new Intl.RelativeTimeFormat(locale, options);\n relativeTime = rtf.format(Math.round(value), unit);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return relativeTime;\n};\n\nexport default withErrorBoundary(getRelativeTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Calculates the week number of the year for a given date.\n *\n * @param date The date to calculate the week number for.\n * @returns The week number of the year.\n */\nconst getWeek = (date: Date): number => {\n const firstDayOfYear = new Date(date.getFullYear(), 0, 1);\n const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000;\n return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7);\n};\n\nexport default withErrorBoundary(getWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Returns an array of weekdays according to the specified locale.\n *\n * @param locale The locale to get weekdays for.\n * @returns An array of weekday names.\n */\nconst getWeekdays = (locale: Locale): string[] => {\n try {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n const formatter = new Intl.DateTimeFormat(locale, { weekday: 'long' });\n return Array.from({ length: 7 }, (_, i) =>\n formatter.format(new Date(1970, 0, 4 + i)),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(getWeekdays);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\n\n/**\n * Compares two dates to determine if the first is after the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is after date2.\n */\nconst isAfter = (date1: DateInput, date2: DateInput): boolean => {\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 > dateObj2;\n};\n\nexport default withErrorBoundary(isAfter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\n\n/**\n * Compares two dates to determine if the first is before the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is before date2.\n */\nconst isBefore = (date1: DateInput, date2: DateInput): boolean => {\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 < dateObj2;\n};\n\nexport default withErrorBoundary(isBefore);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given year is a leap year.\n *\n * @param year The year to check.\n * @returns True if the year is a leap year, false otherwise.\n */\nconst isLeapYear = (year: number): boolean => {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n};\n\nexport default withErrorBoundary(isLeapYear);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if two dates fall on the same day.\n *\n * @param date1 The first date.\n * @param date2 The second date.\n * @returns True if both dates are on the same day, false otherwise.\n */\nconst isSameDay = (date1: Date, date2: Date): boolean => {\n return (\n date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear()\n );\n};\n\nexport default withErrorBoundary(isSameDay);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given object is a valid Date object.\n *\n * @param date The object to check.\n * @returns True if the object is a valid Date, false otherwise.\n */\nconst isValidDate = (date: any): boolean => {\n return date instanceof Date && !isNaN(date.getTime());\n};\n\nexport default withErrorBoundary(isValidDate);\n","export const LOCALE_DATE_FORMATS: { [key: string]: string } = {\n 'ar-AE': 'DD/MM/YYYY', // Arabic (U.A.E.)\n 'sq-AL': 'DD.MM.YYYY', // Albanian (Albania)\n 'hy-AM': 'DD.MM.YYYY', // Armenian (Armenia)\n 'es-AR': 'DD/MM/YYYY', // Spanish (Argentina)\n 'en-AU': 'DD/MM/YYYY', // English (Australia)\n 'nl-AW': 'DD-MM-YYYY', // Dutch (Aruba)\n 'en-BB': 'MM/DD/YYYY', // English (Barbados)\n 'bn-BD': 'DD/MM/YYYY', // Bengali (Bangladesh)\n 'en-BM': 'MM/DD/YYYY', // English (Bermuda)\n 'ms-BN': 'DD/MM/YYYY', // Malay (Brunei)\n 'es-BO': 'DD/MM/YYYY', // Spanish (Bolivia)\n 'en-BS': 'MM/DD/YYYY', // English (Bahamas)\n 'en-BW': 'DD/MM/YYYY', // English (Botswana)\n 'en-BZ': 'MM/DD/YYYY', // English (Belize)\n 'en-CA': 'DD/MM/YYYY', // English (Canada)\n 'de-CH': 'DD.MM.YYYY', // German (Switzerland)\n 'zh-CN': 'YYYY/MM/DD', // Chinese (China)\n 'es-CO': 'DD/MM/YYYY', // Spanish (Colombia)\n 'es-CR': 'DD/MM/YYYY', // Spanish (Costa Rica)\n 'es-CU': 'DD/MM/YYYY', // Spanish (Cuba)\n 'cs-CZ': 'DD.MM.YYYY', // Czech (Czech Republic)\n 'da-DK': 'DD-MM-YYYY', // Danish (Denmark)\n 'es-DO': 'DD/MM/YYYY', // Spanish (Dominican Republic)\n 'ar-DZ': 'DD/MM/YYYY', // Arabic (Algeria)\n 'ar-EG': 'DD/MM/YYYY', // Arabic (Egypt)\n 'am-ET': 'DD/MM/YYYY', // Amharic (Ethiopia)\n 'en-EU': 'DD/MM/YYYY', // English (European Union)\n 'en-FJ': 'DD/MM/YYYY', // English (Fiji)\n 'en-GB': 'DD/MM/YYYY', // English (United Kingdom)\n 'en-GH': 'DD/MM/YYYY', // English (Ghana)\n 'en-GI': 'DD/MM/YYYY', // English (Gibraltar)\n 'en-GM': 'DD/MM/YYYY', // English (Gambia)\n 'es-GT': 'DD/MM/YYYY', // Spanish (Guatemala)\n 'en-GY': 'DD/MM/YYYY', // English (Guyana)\n 'en-HK': 'DD/MM/YYYY', // English (Hong Kong)\n 'es-HN': 'DD/MM/YYYY', // Spanish (Honduras)\n 'hr-HR': 'DD.MM.YYYY', // Croatian (Croatia)\n 'ht-HT': 'MM/DD/YYYY', // Haitian (Haiti)\n 'hu-HU': 'YYYY. MM. DD.', // Hungarian (Hungary)\n 'id-ID': 'DD/MM/YYYY', // Indonesian (Indonesia)\n 'he-IL': 'DD/MM/YYYY', // Hebrew (Israel)\n 'en-IN': 'DD-MM-YYYY', // English (India)\n 'en-JM': 'MM/DD/YYYY', // English (Jamaica)\n 'en-KE': 'DD/MM/YYYY', // English (Kenya)\n 'ky-KG': 'DD.MM.YYYY', // Kyrgyz (Kyrgyzstan)\n 'km-KH': 'DD/MM/YYYY', // Khmer (Cambodia)\n 'en-KY': 'MM/DD/YYYY', // English (Cayman Islands)\n 'kk-KZ': 'DD.MM.YYYY', // Kazakh (Kazakhstan)\n 'lo-LA': 'DD/MM/YYYY', // Lao (Laos)\n 'si-LK': 'YYYY-MM-DD', // Sinhala (Sri Lanka)\n 'en-LR': 'MM/DD/YYYY', // English (Liberia)\n 'en-LS': 'DD/MM/YYYY', // English (Lesotho)\n 'ar-MA': 'DD/MM/YYYY', // Arabic (Morocco)\n 'ro-MD': 'DD.MM.YYYY', // Romanian (Moldova)\n 'mk-MK': 'DD.MM.YYYY', // Macedonian (North Macedonia)\n 'my-MM': 'DD/MM/YYYY', // Burmese (Myanmar)\n 'mn-MN': 'YYYY.MM.DD', // Mongolian (Mongolia)\n 'zh-MO': 'DD/MM/YYYY', // Chinese (Macao)\n 'en-MU': 'DD/MM/YYYY', // English (Mauritius)\n 'dv-MV': 'DD/MM/YYYY', // Divehi (Maldives)\n 'en-MW': 'DD/MM/YYYY', // English (Malawi)\n 'es-MX': 'DD/MM/YYYY', // Spanish (Mexico)\n 'ms-MY': 'DD/MM/YYYY', // Malay (Malaysia)\n 'en-NA': 'DD/MM/YYYY', // English (Namibia)\n 'en-NG': 'DD/MM/YYYY', // English (Nigeria)\n 'es-NI': 'DD/MM/YYYY', // Spanish (Nicaragua)\n 'no-NO': 'DD.MM.YYYY', // Norwegian (Norway)\n 'ne-NP': 'YYYY/MM/DD', // Nepali (Nepal)\n 'en-NZ': 'DD/MM/YYYY', // English (New Zealand)\n 'es-PE': 'DD/MM/YYYY', // Spanish (Peru)\n 'en-PG': 'DD/MM/YYYY', // English (Papua New Guinea)\n 'en-PH': 'MM/DD/YYYY', // English (Philippines)\n 'en-PK': 'DD/MM/YYYY', // English (Pakistan)\n 'ar-QA': 'DD/MM/YYYY', // Arabic (Qatar)\n 'ru-RU': 'DD.MM.YYYY', // Russian (Russia)\n 'ar-SA': 'DD/MM/YYYY', // Arabic (Saudi Arabia)\n 'en-SC': 'DD/MM/YYYY', // English (Seychelles)\n 'sv-SE': 'YYYY-MM-DD', // Swedish (Sweden)\n 'en-SG': 'DD/MM/YYYY', // English (Singapore)\n 'en-SL': 'DD/MM/YYYY', // English (Sierra Leone)\n 'so-SO': 'DD/MM/YYYY', // Somali (Somalia)\n 'en-SS': 'DD/MM/YYYY', // English (South Sudan)\n 'es-SV': 'DD/MM/YYYY', // Spanish (El Salvador)\n 'en-SZ': 'DD/MM/YYYY', // English (Eswatini)\n 'th-TH': 'DD/MM/YYYY', // Thai (Thailand)\n 'en-TT': 'MM/DD/YYYY', // English (Trinidad and Tobago)\n 'sw-TZ': 'DD/MM/YYYY', // Swahili (Tanzania)\n 'en-US': 'MM/DD/YYYY', // English (United States)\n 'es-UY': 'DD/MM/YYYY', // Spanish (Uruguay)\n 'uz-UZ': 'DD/MM/YYYY', // Uzbek (Uzbekistan)\n 'ar-YE': 'DD/MM/YYYY', // Arabic (Yemen)\n 'en-ZA': 'YYYY/MM/DD', // English (South Africa)\n 'ar-KW': 'DD/MM/YYYY', // Arabic (Kuwait)\n 'ar-BH': 'DD/MM/YYYY', // Arabic (Bahrain)\n 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman)\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Parses a date string based on a specific format.\n *\n * @param dateString The date string to parse.\n * @param format The format to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDateWithFormat = (\n dateString: string,\n format: string,\n): Date | null => {\n // Determine the separator based on the format (supports '/', '.', or '-')\n const separator = format.includes('/')\n ? '/'\n : format.includes('.')\n ? '.'\n : '-';\n const formatParts = format.split(separator);\n const dateParts = dateString.split(separator).map((num) => parseInt(num, 10));\n\n let year: number = 0,\n month: number = 0,\n day: number = 0;\n let yearSet: boolean = false,\n monthSet: boolean = false,\n daySet: boolean = false;\n\n // Check for format and date string mismatch\n if (dateParts.length !== formatParts.length) {\n return null; // Mismatch between date string and format\n }\n\n formatParts.forEach((part, index) => {\n // Check for non-numeric values in date string\n if (isNaN(dateParts[index])) {\n return null; // Invalid date part\n }\n\n // Assign year, month, and day based on the format\n switch (part) {\n case 'DD':\n day = dateParts[index];\n daySet = true;\n break;\n case 'MM':\n month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date\n monthSet = true;\n break;\n case 'YYYY':\n year = dateParts[index];\n yearSet = true;\n break;\n }\n });\n\n // Validate and create the date only if all parts are set\n if (yearSet && monthSet && daySet) {\n const parsedDate = new Date(year, month, day);\n // Validate date to catch invalid dates like February 30th\n if (\n parsedDate.getFullYear() === year &&\n parsedDate.getMonth() === month &&\n parsedDate.getDate() === day\n ) {\n return parsedDate;\n }\n }\n return null; // Invalid date or incomplete date information\n};\n\nexport default withErrorBoundary(\n parseDateWithFormat,\n);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { LOCALE_DATE_FORMATS } from './data/localeDateFormats';\nimport parseDateWithFormat from './parseDateWithFormat';\nimport { Locale } from './types';\n\n/**\n * Attempts to parse a string into a date object based on locale.\n * Uses the localeDateFormats mapping for determining the date format.\n *\n * @param dateString - The date string to parse.\n * @param locale - The locale to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDate = (dateString: string, locale: Locale): Date | null => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const format = LOCALE_DATE_FORMATS[locale];\n if (!format) {\n throw new Error(`No date format found for locale: ${locale}`);\n }\n return parseDateWithFormat(dateString, format);\n};\n\nexport default withErrorBoundary(parseDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport add from './add';\n\n/**\n * Subtracts a specified amount of time from a date.\n *\n * @param date The original date.\n * @param value The amount to subtract.\n * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time subtracted.\n */\nconst subtract = (\n date: Date,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n return add(date, -value, unit); // Reuse the add function with negative value\n};\n\nexport default withErrorBoundary(subtract);\n"],"names":["I18nifyError","Error","constructor","message","super","this","name","timestamp","Date","withErrorBoundary","fn","rest","call","err","console","warn","I18nStateManager","state","locale","direction","country","getInstance","instance","resetInstance","undefined","getState","Object","assign","setState","newState","resetState","getState$1","setState$1","resetState$1","getLocale","navigator","window","Intl","languages","language","getIntlInstanceWithOptions","options","intlOptions","currency","style","NumberFormat","formatNumber$1","amount","Number","formattedAmount","format","CURRENCIES","AED","symbol","ALL","AMD","ARS","AUD","AWG","BBD","BDT","BMD","BND","BOB","BSD","BWP","BZD","CAD","CHF","CNY","COP","CRC","CUP","CZK","DKK","DOP","DZD","EGP","ETB","EUR","FJD","GBP","GHS","GIP","GMD","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","JMD","KES","KGS","KHR","KYD","KZT","LAK","LKR","LRD","LSL","MAD","MDL","MKD","MMK","MNT","MOP","MUR","MVR","MWK","MXN","MYR","NAD","NGN","NIO","NOK","NPR","NZD","PEN","PGK","PHP","PKR","QAR","RUB","SAR","SCR","SEK","SGD","SLL","SOS","SSP","SVC","SZL","THB","TTD","TZS","USD","UYU","UZS","YER","ZAR","KWD","BHD","OMR","getCurrencyList$1","getCurrencySymbol$1","currencyCode","_a","ALLOWED_FORMAT_PARTS_KEYS","formatNumberByParts$1","parts","formatToParts","formattedObj","forEach","p","type","integer","value","findIndex","item","isPrefixSymbol","rawParts","PHONE_REGEX_MAPPER","IN","MY","AE","AL","AM","AR","AU","AW","BB","BD","BM","BN","BO","BS","BW","BZ","CH","CN","CO","OM","CR","CU","CZ","DK","DO","DZ","EG","ET","EU","FJ","GB","GH","GI","GM","GT","GY","HK","HN","HR","HT","HU","ID","IL","JM","KE","KG","KH","KY","KZ","LA","LK","LR","LS","MA","MD","MK","MM","MN","MO","MU","MV","MW","MX","NA","NG","NI","NO","NP","NZ","PE","PG","PH","PK","QA","RU","SA","SC","SE","SG","SL","SO","SS","SV","SZ","TH","TT","TZ","US","CA","UY","UZ","YE","ZA","KW","BH","TL","VC","VE","VN","ZM","ZW","LT","LU","LV","ME","MG","MZ","NL","PA","PL","PR","PS","PT","PY","RO","RS","RW","SI","SK","SM","SN","SR","TG","TJ","TN","TR","TW","UA","UG","DIAL_CODE_MAPPER","detectCountryCodeFromDialCode","phoneNumber","toString","charAt","cleanedPhoneNumberWithoutPlusPrefix","replace","matchingCountries","code","startsWith","push","find","countryCode","regex","test","cleanPhoneNumber","cleanedPhoneNumber","isValidPhoneNumber$1","PHONE_FORMATTER_MAPPER","formatPhoneNumber$1","pattern","charCountInFormatterPattern","i","length","diff","phoneNumberWithoutPrefix","slice","formattedNumber","numberIndex","patternChar","formattedPhoneNumberWithoutPrefix","join","trim","parsePhoneNumber$1","formattedPhoneNumber","formatPhoneNumber","dialCode","formatTemplate","add$1","date","unit","result","setDate","getDate","setMonth","getMonth","setFullYear","getFullYear","formatDateTime$1","dateObj","formatter","DateTimeFormat","formatDate$1","fullOptions","timeStyle","formattedDate","formatDateTime","formatTime$1","dateStyle","formattedTime","getFirstDayOfWeek$1","formatted","weekday","sampleDate","indexOf","toLowerCase","getQuarter$1","Math","ceil","getRelativeTime$1","baseDate","diffInSeconds","getTime","hour","minute","day","week","month","year","relativeTime","abs","RelativeTimeFormat","round","getWeek$1","firstDayOfYear","pastDaysOfYear","getDay","getWeekdays$1","Array","from","_","isAfter$1","date1","date2","isBefore$1","isLeapYear$1","isSameDay$1","isValidDate$1","isNaN","LOCALE_DATE_FORMATS","parseDateWithFormat$1","dateString","separator","includes","formatParts","split","dateParts","map","num","parseInt","yearSet","monthSet","daySet","part","index","parsedDate","parseDate$1","parseDateWithFormat","subtract$1","add"],"mappings":"AACM,MAAOA,UAAqBC,MAEhC,WAAAC,CAAYC,GACVC,MAAMD,GACNE,KAAKC,KAAO,gBACZD,KAAKE,UAAY,IAAIC,IAEtB,EAYI,MAAMC,EACXC,GAEO,YAA4BC,GACjC,IACE,OAAOD,EAAGE,KAAKP,QAASM,EACzB,CAAC,MAAOE,GAIP,MAHAC,QAAQC,KAAK,iBAAkBF,GAGzB,IAAIb,EAAaa,EACxB,CACH,QC7BWG,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AAWtE,aAAegC,GAC1BsC,EAAWxE,YAAcgC,EAEzB,OAAOwC,CAEV,CACD,OAAO,IAAI,ICvCb,IAAeC,EAAAnZ,GAfG,CAACoY,EAAoB3X,KAMhCA,IAAQA,EAASD,EAAMQ,WAAWP,QAAUgB,KAEjD,MAAMgB,EAASyV,EAAoBzX,GACnC,IAAKgC,EACH,MAAM,IAAIjD,MAAM,oCAAoCiB,KAEtD,OAAO2Y,EAAoBhB,EAAY3V,EAAO,ICRhD,IAAe4W,EAAArZ,GARE,CACfsU,EACA9K,EACA+K,IAEO+E,EAAIhF,GAAO9K,EAAO+K"} \ No newline at end of file +{"version":3,"file":"index.min.js","sources":["../../src/common/errorBoundary/index.ts","../../src/modules/.internal/state/index.ts","../../src/modules/.internal/utils/getDefaultState.ts","../../src/modules/core/getState.ts","../../src/modules/core/setState.ts","../../src/modules/core/resetState.ts","../../src/modules/.internal/utils/getLocale.ts","../../src/modules/.internal/utils/getIntlInstanceWithOptions.ts","../../src/modules/currency/formatNumber.ts","../../src/modules/currency/data/currencies.ts","../../src/modules/currency/getCurrencyList.ts","../../src/modules/currency/getCurrencySymbol.ts","../../src/modules/currency/constants.ts","../../src/modules/currency/formatNumberByParts.ts","../../src/modules/phoneNumber/data/phoneRegexMapper.ts","../../src/modules/phoneNumber/data/dialCodeMapper.ts","../../src/modules/phoneNumber/utils.ts","../../src/modules/phoneNumber/isValidPhoneNumber.ts","../../src/modules/phoneNumber/data/phoneFormatterMapper.ts","../../src/modules/phoneNumber/formatPhoneNumber.ts","../../src/modules/phoneNumber/parsePhoneNumber.ts","../../src/modules/dateTime/utils.ts","../../src/modules/dateTime/add.ts","../../src/modules/dateTime/formatDateTime.ts","../../src/modules/dateTime/formatDate.ts","../../src/modules/dateTime/formatTime.ts","../../src/modules/dateTime/getFirstDayOfWeek.ts","../../src/modules/dateTime/getQuarter.ts","../../src/modules/dateTime/getRelativeTime.ts","../../src/modules/dateTime/getWeek.ts","../../src/modules/dateTime/getWeekdays.ts","../../src/modules/dateTime/isAfter.ts","../../src/modules/dateTime/isBefore.ts","../../src/modules/dateTime/isLeapYear.ts","../../src/modules/dateTime/isSameDay.ts","../../src/modules/dateTime/isValidDate.ts","../../src/modules/dateTime/data/localeDateFormats.ts","../../src/modules/dateTime/parseDateWithFormat.ts","../../src/modules/dateTime/parseDate.ts","../../src/modules/dateTime/subtract.ts"],"sourcesContent":["// Custom Error class to extend properties to error object\nexport class I18nifyError extends Error {\n timestamp: Date;\n constructor(message: string | undefined) {\n super(message);\n this.name = 'i18nify Error';\n this.timestamp = new Date();\n // more params like type of error/severity can be added in future for better debugging.\n }\n}\n\n/**\n * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block.\n * It appends additional attributes and serves as a centralized error-handling service.\n * Usage =>\n * const wrappedUtilityFn = withErrorBoundary(utilityFn)\n *\n * @param fn utility that is wrapped in error boundary\n * @returns {Function} returns the function wrapped in try/catch block\n */\nexport const withErrorBoundary = any>(\n fn: T,\n): ((...args: Parameters) => ReturnType) => {\n return function (this: unknown, ...rest: Parameters): ReturnType {\n try {\n return fn.call(this, ...rest) as ReturnType;\n } catch (err) {\n console.warn('[I18N Error]: ', err);\n // Currently, we are throwing the error as it is to consumers.\n // In the future, this can be modified as per our requirement, like an error logging service.\n throw new I18nifyError(err as string | undefined);\n }\n };\n};\n","import { I18nState } from './types';\nimport { getDefaultState } from '../utils/getDefaultState';\n\nexport class I18nStateManager {\n private static instance: I18nStateManager | undefined;\n private state: I18nState;\n\n private constructor() {\n this.state = getDefaultState();\n }\n\n public static getInstance(): I18nStateManager {\n if (!I18nStateManager.instance) {\n I18nStateManager.instance = new I18nStateManager();\n }\n\n return I18nStateManager.instance;\n }\n\n public static resetInstance(): void {\n I18nStateManager.instance = undefined;\n }\n\n public getState(): I18nState {\n return { ...this.state };\n }\n\n public setState(newState: Partial): void {\n this.state = { ...this.state, ...newState };\n }\n\n public resetState(): void {\n this.state = getDefaultState();\n }\n}\n\nexport default I18nStateManager.getInstance();\n","import type { I18nState } from '../state/types';\n\nexport function getDefaultState(): I18nState {\n return {\n locale: '',\n direction: '',\n country: '',\n };\n}\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * function to return active i18n state\n *\n * ===== USAGE =====\n * import { getState } from '@razorpay/i18nify-js';\n *\n * console.log(getState())\n *\n * @returns i18n state\n */\nconst getState = (): I18nState => {\n return state.getState();\n};\n\nexport default withErrorBoundary(getState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * Function to set and override the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { setState } from \"@razorpay/i18nify-js\";\n * setState({locale: 'en-US'})\n *\n * @param newState data to set in i18nState instance\n */\nconst setState = (newState: Partial): void => {\n state.setState(newState);\n};\n\nexport default withErrorBoundary(setState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\n\n/**\n * Function to reset the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { resetState } from \"@razorpay/i18nify-js\";\n * resetState()\n *\n * @param newState data to set in i18nState instance\n */\nconst resetState = (): void => {\n state.resetState();\n};\n\nexport default withErrorBoundary(resetState);\n","export const getLocale = (): string => {\n // Check if running in a non-browser environment (e.g., Node.js or older browsers).\n if (typeof navigator === 'undefined') {\n return 'en-IN';\n }\n\n // Check if the browser supports the Intl object and user language preferences.\n if (\n window.Intl &&\n typeof window.Intl === 'object' &&\n (window.navigator.languages || window.navigator.language)\n ) {\n const userLocales = window.navigator.languages || [\n window.navigator.language,\n ];\n return userLocales[0];\n }\n\n // Fallback to a supported locale or the default locale.\n return 'en-IN';\n};\n","import { CURRENCIES } from '../../currency/data/currencies';\nimport state from '../state';\nimport { getLocale } from './getLocale';\n\nexport const getIntlInstanceWithOptions = (\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n) => {\n /** retrieve locale from below areas in order of preference\n * 1. options.locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n let locale = options?.locale || state.getState().locale;\n\n // If a specific locale is provided, use it; otherwise, use the browser's locale\n if (!locale) {\n locale = getLocale();\n }\n\n const intlOptions = options?.intlOptions ? { ...options.intlOptions } : {};\n\n if (options?.currency || intlOptions.currency) {\n intlOptions.style = 'currency';\n intlOptions.currency = (options.currency || intlOptions.currency) as string;\n }\n\n if (!locale) throw new Error('Pass valid locale !');\n\n return new Intl.NumberFormat(locale || undefined, intlOptions);\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\n\n// this function formats number based on different arguments passed\nconst formatNumber = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): string => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n let formattedAmount = '';\n\n try {\n formattedAmount = getIntlInstanceWithOptions(options).format(\n Number(amount),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedAmount;\n};\n\nexport default withErrorBoundary(formatNumber);\n","export const CURRENCIES: { [key: string]: { symbol: string; name: string } } = {\n AED: { symbol: 'د.إ', name: 'United Arab Emirates Dirham' },\n ALL: { symbol: 'Lek', name: 'Albanian Lek' },\n AMD: { symbol: '֏', name: 'Armenian Dram' },\n ARS: { symbol: 'ARS', name: 'Argentine Peso' },\n AUD: { symbol: 'A$', name: 'Australian Dollar' },\n AWG: { symbol: 'Afl.', name: 'Aruban Florin' },\n BBD: { symbol: '$', name: 'Barbadian Dollar' },\n BDT: { symbol: '৳', name: 'Bangladeshi Taka' },\n BMD: { symbol: '$', name: 'Bermudian Dollar' },\n BND: { symbol: 'BND', name: 'Brunei Dollar' },\n BOB: { symbol: 'Bs', name: 'Bolivian Boliviano' },\n BSD: { symbol: 'B$', name: 'Bahamian Dollar' },\n BWP: { symbol: 'P', name: 'Botswanan Pula' },\n BZD: { symbol: 'BZ$', name: 'Belize Dollar' },\n CAD: { symbol: 'C$', name: 'Canadian Dollar' },\n CHF: { symbol: 'CHf', name: 'Swiss Franc' },\n CNY: { symbol: '¥', name: 'Chinese Yuan' },\n COP: { symbol: 'COL$', name: 'Colombian Peso' },\n CRC: { symbol: '₡', name: 'Costa Rican Colón' },\n CUP: { symbol: '$MN', name: 'Cuban Peso' },\n CZK: { symbol: 'Kč', name: 'Czech Koruna' },\n DKK: { symbol: 'DKK', name: 'Danish Krone' },\n DOP: { symbol: 'RD$', name: 'Dominican Peso' },\n DZD: { symbol: 'د.ج', name: 'Algerian Dinar' },\n EGP: { symbol: 'E£', name: 'Egyptian Pound' },\n ETB: { symbol: 'ብር', name: 'Ethiopian Birr' },\n EUR: { symbol: '€', name: 'Euro' },\n FJD: { symbol: 'FJ$', name: 'Fijian Dollar' },\n GBP: { symbol: '£', name: 'British Pound' },\n GHS: { symbol: 'GH₵', name: 'Ghanaian Cedi' },\n GIP: { symbol: 'GIP', name: 'Gibraltar Pound' },\n GMD: { symbol: 'D', name: 'Gambian Dalasi' },\n GTQ: { symbol: 'Q', name: 'Guatemalan Quetzal' },\n GYD: { symbol: 'G$', name: 'Guyanese Dollar' },\n HKD: { symbol: 'HK$', name: 'Hong Kong Dollar' },\n HNL: { symbol: 'HNL', name: 'Honduran Lempira' },\n HRK: { symbol: 'kn', name: 'Croatian Kuna' },\n HTG: { symbol: 'G', name: 'Haitian Gourde' },\n HUF: { symbol: 'Ft', name: 'Hungarian Forint' },\n IDR: { symbol: 'Rp', name: 'Indonesian Rupiah' },\n ILS: { symbol: '₪', name: 'Israeli New Shekel' },\n INR: { symbol: '₹', name: 'Indian Rupee' },\n JMD: { symbol: 'J$', name: 'Jamaican Dollar' },\n KES: { symbol: 'Ksh', name: 'Kenyan Shilling' },\n KGS: { symbol: 'Лв', name: 'Kyrgystani Som' },\n KHR: { symbol: '៛', name: 'Cambodian Riel' },\n KYD: { symbol: 'CI$', name: 'Cayman Islands Dollar' },\n KZT: { symbol: '₸', name: 'Kazakhstani Tenge' },\n LAK: { symbol: '₭', name: 'Laotian Kip' },\n LKR: { symbol: 'රු', name: 'Sri Lankan Rupee' },\n LRD: { symbol: 'L$', name: 'Liberian Dollar' },\n LSL: { symbol: 'LSL', name: 'Lesotho Loti' },\n MAD: { symbol: 'د.م.', name: 'Moroccan Dirham' },\n MDL: { symbol: 'MDL', name: 'Moldovan Leu' },\n MKD: { symbol: 'ден', name: 'Macedonian Denar' },\n MMK: { symbol: 'MMK', name: 'Myanmar Kyat' },\n MNT: { symbol: '₮', name: 'Mongolian Tugrik' },\n MOP: { symbol: 'MOP$', name: 'Macanese Pataca' },\n MUR: { symbol: '₨', name: 'Mauritian Rupee' },\n MVR: { symbol: 'Rf', name: 'Maldivian Rufiyaa' },\n MWK: { symbol: 'MK', name: 'Malawian Kwacha' },\n MXN: { symbol: 'Mex$', name: 'Mexican Peso' },\n MYR: { symbol: 'RM', name: 'Malaysian Ringgit' },\n NAD: { symbol: 'N$', name: 'Namibian Dollar' },\n NGN: { symbol: '₦', name: 'Nigerian Naira' },\n NIO: { symbol: 'NIO', name: 'Nicaraguan Córdoba' },\n NOK: { symbol: 'NOK', name: 'Norwegian Krone' },\n NPR: { symbol: 'रू', name: 'Nepalese Rupee' },\n NZD: { symbol: 'NZ$', name: 'New Zealand Dollar' },\n PEN: { symbol: 'S/', name: 'Peruvian Nuevo Sol' },\n PGK: { symbol: 'PGK', name: 'Papua New Guinean Kina' },\n PHP: { symbol: '₱', name: 'Philippine Peso' },\n PKR: { symbol: '₨', name: 'Pakistani Rupee' },\n QAR: { symbol: 'QR', name: 'Qatari Riyal' },\n RUB: { symbol: '₽', name: 'Russian Ruble' },\n SAR: { symbol: 'SR', name: 'Saudi Riyal' },\n SCR: { symbol: 'SRe', name: 'Seychellois Rupee' },\n SEK: { symbol: 'SEK', name: 'Swedish Krona' },\n SGD: { symbol: 'S$', name: 'Singapore Dollar' },\n SLL: { symbol: 'Le', name: 'Sierra Leonean Leone' },\n SOS: { symbol: 'Sh.so.', name: 'Somali Shilling' },\n SSP: { symbol: 'SS£', name: 'South Sudanese Pound' },\n SVC: { symbol: '₡', name: 'Salvadoran Colón' },\n SZL: { symbol: 'E', name: 'Swazi Lilangeni' },\n THB: { symbol: '฿', name: 'Thai Baht' },\n TTD: { symbol: 'TT$', name: 'Trinidad and Tobago Dollar' },\n TZS: { symbol: 'Sh', name: 'Tanzanian Shilling' },\n USD: { symbol: '$', name: 'United States Dollar' },\n UYU: { symbol: '$U', name: 'Uruguayan Peso' },\n UZS: { symbol: \"so'm\", name: 'Uzbekistani Som' },\n YER: { symbol: '﷼', name: 'Yemeni Rial' },\n ZAR: { symbol: 'R', name: 'South African Rand' },\n KWD: { symbol: 'د.ك', name: 'Kuwaiti Dinar' },\n BHD: { symbol: 'د.ب.', name: 'Bahraini Dinar' },\n OMR: { symbol: 'ر.ع.', name: 'Omani Rial' },\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencyList = () => {\n return CURRENCIES;\n};\n\nexport default withErrorBoundary(getCurrencyList);\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencySymbol = (currencyCode: keyof typeof CURRENCIES): string => {\n if (currencyCode in CURRENCIES) return CURRENCIES[currencyCode]?.symbol;\n else throw new Error('Invalid currencyCode!');\n};\n\nexport default withErrorBoundary(getCurrencySymbol);\n","export const ALLOWED_FORMAT_PARTS_KEYS = [\n 'nan',\n 'infinity',\n 'percent',\n 'integer',\n 'group',\n 'decimal',\n 'fraction',\n 'plusSign',\n 'minusSign',\n 'percentSign',\n 'currency',\n 'code',\n 'symbol',\n 'name',\n 'compact',\n 'exponentInteger',\n 'exponentMinusSign',\n 'exponentSeparator',\n 'unit',\n] as const;\n","import { CURRENCIES } from './data/currencies';\nimport { ByParts, FormattedPartsObject } from './types';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\nimport { ALLOWED_FORMAT_PARTS_KEYS } from './constants';\n\nconst formatNumberByParts = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): ByParts => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n try {\n const formattedAmount = getIntlInstanceWithOptions(options).formatToParts(\n Number(amount),\n );\n\n const parts = formattedAmount;\n\n const formattedObj: FormattedPartsObject = {};\n\n parts.forEach((p) => {\n if (p.type === 'group') {\n formattedObj.integer = (formattedObj.integer || '') + p.value;\n } else if (\n ALLOWED_FORMAT_PARTS_KEYS.findIndex((item) => item === p.type) != -1\n ) {\n // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal' is skipped\n formattedObj[p.type] = (formattedObj[p.type] || '') + p.value;\n }\n });\n\n return {\n ...formattedObj,\n isPrefixSymbol: parts[0].type === 'currency',\n rawParts: parts,\n };\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(\n formatNumberByParts,\n);\n","export const PHONE_REGEX_MAPPER: { [key: string]: RegExp } = {\n IN: /^(?:(?:\\+|0{0,2})91\\s*[-]?\\s*|[0]?)?[6789]\\d{9}$/,\n MY: /^(\\+?6?0)?(\\d{1,3})[-. ]?(\\d{7,8})$/,\n AE: /^(?:\\+?971|0)?(?:2|3|4|6|7|9)\\d{8}$/,\n AL: /^(?:\\+?355)?(?:[4-9]\\d{7}|6\\d{8})$/,\n AM: /^(?:\\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/,\n AR: /^(?:(?:\\+|0{0,2})54)?(?:11|[2368]\\d)(?:(?=\\d{0,2}15)\\d{2})??\\d{8}$/,\n AU: /^(?:\\+?61|0)4\\d{8}$/,\n AW: /^(?:(?:\\+297)?(?!0)\\d{7})$/,\n BB: /^(?:(?:\\+1)?246)?(?:\\d{3})?\\d{7}$/,\n BD: /^(?:\\+?880|0)1[13456789]\\d{8}$/,\n BM: /^(?:(?:\\+1)?441)?(?:\\d{2})?\\d{7}$/,\n BN: /^(?:\\+?673)?(?:\\d{3})?\\d{4}$/,\n BO: /^(?:(?:\\+|0{0,2})591)?(?:(?:2|3|7|6)\\d{7})$/,\n BS: /^(?:(?:\\+1)?242)?(?:\\d{3})?\\d{7}$/,\n BW: /^(?:(?:\\+267)?\\s?)?[74]\\d{7}$/,\n BZ: /^(?:(?:\\+501)?\\s?)?[622]\\d{4}$/,\n CH: /^(?:(?:\\+41|0)(?:\\s*\\(?0\\)?\\s*))?(?:\\d{2}\\s*)?\\d{3}\\s*\\d{2}\\s*\\d{2}$/,\n CN: /^(?:(?:\\+|00)86)?1\\d{10}$/,\n CO: /^(?:(?:\\+57|0057)?)?[1-8]{1}\\d{6,7}$/,\n OM: /^(?:\\+?968)?(?:95|96|97|98)\\d{6}$/,\n CR: /^(?:(?:\\+506)?\\s*|0)?[1-9]\\d{7}$/,\n CU: /^(?:\\+?53)?(?:[5-8]\\d{7})$/,\n CZ: /^(?:\\+?420)?(?:\\d{9})$/,\n DK: /^(?:\\+?45)?(?:\\d{8})$/,\n DO: /^(?:(?:\\+1)?809|1-8(?:00|88|89))(?:\\d{7})$/,\n DZ: /^(?:\\+?213|0)([567]\\d{8})$/,\n EG: /^(?:(?:\\+20|20)?(\\d{10}))$/,\n ET: /^(?:\\+?251)?[1-59]\\d{8}$/,\n EU: /^(?:(?:\\+?3)?8)?\\s*(?:\\d{3}\\s*){3}\\d{2}$/,\n FJ: /^(?:(?:\\+?679)?\\s?\\d{3}\\s?\\d{4})?$/,\n GB: /^(?:(?:\\+44\\s?|0)7\\d{3}(\\s?\\d{4,})?)$/,\n GH: /^(?:(?:\\+233)|0)?(?:\\d{9})$/,\n GI: /^(?:\\+350)?\\d{5}$/,\n GM: /^(?:\\+220)?\\d{5,7}$/,\n GT: /^(?:\\+502)?[2468]\\d{7,8}$/,\n GY: /^(?:(?:\\+592)?(?:(?:\\s)?[2-9])(?:(?:\\s)?\\d))?(?:(?:\\s)?\\d{4})$/,\n HK: /^(?:\\+852\\s?)?[456789]\\d{3}\\s?\\d{4}$/,\n HN: /^(?:\\+504)?[89]\\d{7}$/,\n HR: /^(?:\\+?385)?\\d{8,9}$/,\n HT: /^(?:\\+?509)?\\d{8}$/,\n HU: /^(?:(?:\\+36))(\\s?\\d{2}\\s?\\d{3}\\s?\\d{4})$/,\n ID: /^(?:\\+?62|0[1-9])[\\s-]?\\d{2,4}[\\s-]?\\d{3,4}[\\s-]?\\d{3,4}$/,\n IL: /^(?:(?:\\+972|0)(?:-)?)[23489]\\d{7}$/,\n JM: /^(?:(?:\\+1876))\\d{7,10}$/,\n KE: /^(?:(?:\\+254)|(?:0))(?:\\d{6,7})$/,\n KG: /^(?:\\+996)?\\s?\\d{9}$/,\n KH: /^(?:(?:\\+855)|(?:0))(?:\\s?[1-9]\\d{7,8})$/,\n KY: /^(?:\\+?1\\s?(345))\\d{6}$/,\n KZ: /^(?:\\+?7|8)?7\\d{9}$/,\n LA: /^(?:(?:\\+?856)|0)(20\\d{7,9})$/,\n LK: /^(?:(?:\\+94)|0)(?:\\d{9})$/,\n LR: /^(?:\\+231)[ -\\d]{4}[ -\\d]{4}$/,\n LS: /^(?:(?:\\+?266)|0)?[56]\\d{7}$/,\n MA: /^(?:(?:\\+?212(\\s*[-|\\s*]?\\d{1,9})?)|(?:0))(?:\\d{9})$/,\n MD: /^(?:(?:\\+373)|(?:0))(?:\\d{7,8})$/,\n MK: /^(?:\\+389|0)(?:(?:2[0-4]|[3-9])\\s?)?\\d{6}$/,\n MM: /^(?:(?:\\+?95)|0)?[1-9]\\d{9}$/,\n MN: /^(?:\\+976|0)\\d{8}$/,\n MO: /^(?:(?:\\+?853)|[0-9])?\\d{8}$/,\n MU: /^(?:\\+230|0)?\\d{8}$/,\n MV: /^(?:(?:\\+?960)|0)?\\d{7}$/,\n MW: /^(?:\\+265)[1-9]\\d{6}$/,\n MX: /^(?:(?:\\+?52)?\\s?(?:1|01)?\\s?)?(?:\\d{3}\\s?\\d{3}\\s?\\d{4})$/,\n NA: /^(?:(?:\\+264)|0)?\\d{8}$/,\n NG: /^(?:(?:\\+234)|(?:0))(?:\\d{7,8})$/,\n NI: /^(?:(?:\\+505))?(?:\\d{8})$/,\n NO: /^(?:(?:\\+?47)|\\d{2}|\\d{3})\\s?\\d{2}\\s?\\d{3}$/,\n NP: /^(?:(?:\\+977))?(\\d{9,10})$/,\n NZ: /^(?:\\+?64|0)(\\d{2,5} \\d{4,8}|\\d{3,4} \\d{4})$/,\n PE: /^(?:(?:\\+51)|0)?(?:9\\d{8})$/,\n PG: /^(?:\\+?675)?(?:[7-9]\\d{7})$/,\n PH: /^(?:(?:\\+?63)|0)(?:\\d{10})$/,\n PK: /^(?:(?:\\+92)|0)?[345]\\d{9}$/,\n QA: /^(?:\\+?974)?-?33\\d{5}$/,\n RU: /^(?:\\+?7|8)?[ -]?\\(?9\\d{2}\\)?[ -]?\\d{3}[ -]?\\d{2}[ -]?\\d{2}$/,\n SA: /^(?:\\+?966)?\\s?1?[\\s-]?(?:[45]\\d{2}|5\\d{3})[\\s-]?\\d{4}$/,\n SC: /^(?:(?:\\+248)|\\d{4})\\d{5}$/,\n SE: /^(?:\\+?46|0)\\s?[1-57-9](?:[0-9]\\s?){8}$/,\n SG: /^(?:(?:\\+65)|(?:\\(\\+65\\))|(?:65))\\d{4}\\d{4}$/,\n SL: /^(?:(?:\\+232)|(?:0))?\\d{9}$/,\n SO: /^(?:\\+252|0)?[567]\\d{7}$/,\n SS: /^(?:\\+211|0)?[1-9]\\d{7,9}$/,\n SV: /^(?:(?:\\+?503)|(?:0))(?:\\d{8})$/,\n SZ: /^(?:\\+?268)?\\d{7,8}$/,\n TH: /^(?:(?:\\+66)|0)\\d{9}$/,\n TT: /^(?:(?:\\+?1-868)|\\(?868\\)?)(\\d{7})$/,\n TZ: /^(?:(?:\\+?255)|0)?[67]\\d{8}$/,\n US: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n CA: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n UY: /^(?:(?:\\+598|0)\\s?(9\\d{3}|2\\d{2}|[4-9]\\d{6}))$/,\n UZ: /^(?:\\+?998)?\\s?[3456789]\\d{8}$/,\n YE: /^(?:\\+?967)?(?:\\d{7,8})$/,\n ZA: /^(?:(?:\\+27)|0)(\\d{9})$/,\n KW: /^(?:\\+?965)[569]\\d{7}$/,\n BH: /^(?:\\+?973)?[356]\\d{7}$/,\n TL: /^(?:(?:\\+670)\\s?)?[0-9]{3}\\s?[0-9]{3,4}$/,\n VC: /^(?:(?:\\+1)?784)?(?:\\d{3})?\\d{7}$/,\n VE: /^(?:(?:\\+58)|0)?4\\d{9}$/,\n VN: /^(?:(?:\\+84)|0)?[1-9]\\d{8}$/,\n ZM: /^(?:(?:\\+260)|0)?[123456789]\\d{8,9}$/,\n ZW: /^(?:(?:\\+263)|0)?(?:\\d{9,10})$/,\n LT: /^(?:(?:\\+370)|8)\\d{8}$/,\n LU: /^(?:(?:\\+352)?(6|2(6|7|8|9))\\d{6})$/,\n LV: /^(?:(?:\\+371)?2\\d{7})$/,\n ME: /^(?:(?:\\+382)?[67]\\d{7,20})$/,\n MG: /^(?:(?:\\+261)?3[234568]\\d{7})$/,\n MZ: /^(?:(?:\\+258)|(?:258))?8[234567]\\d{7,8}$/,\n NL: /^(?:(?:\\+31)|0(6(?:\\d{8})|[1-9](?:(?:\\d{8})|(?:\\s\\d{3}\\s\\d{4}))|(?:\\d{8})))$/,\n PA: /^(?:(?:\\+507)\\s?)?[46]\\d{6,7}$/,\n PL: /^(?:(?:\\+48)?(?:\\s?\\d{3}\\s?\\d{3}\\s?\\d{3}|(?:\\d{2}\\s?){4}\\d{2}|\\d{3}-\\d{3}-\\d{3}))$/,\n PR: /^(?:(?:\\+1)?787|939)\\d{7}$/,\n PS: /^(?:(?:\\+970))(5[2349])\\d{7}$/,\n PT: /^(?:(?:\\+351)?9(1\\d|2[1-9]|6[12345789]|7[12345789])\\d{7})$/,\n PY: /^(?:(?:\\+595|0)9[9876]\\d{7})$/,\n RO: /^(?:(?:\\+40|0))(?:7[2-8]\\d{7}|21\\d{8})$/,\n RS: /^(?:(?:\\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/,\n RW: /^(?:(?:\\+250)|(0))\\d{9}$/,\n SI: /^(?:(?:\\+386)|0)?[1-59]\\d{7,8}$/,\n SK: /^(?:(?:\\+421))?(0|9[0-8])\\d{8}$/,\n SM: /^(?:(?:\\+378)|(0549|6\\d{4}))\\d{5}$/,\n SN: /^(?:(?:\\+221)|0)?[3679]\\d{7}$/,\n SR: /^(?:(?:\\+597))\\d{7}$/,\n TG: /^(?:(?:\\+228))\\d{8}$/,\n TJ: /^(?:(?:\\+992))(37|55|77)\\d{7}$/,\n TN: /^(?:(?:\\+216)|22|9[1-9])\\d{7}$/,\n TR: /^(?:(?:\\+90)|(0))\\s?5\\d{9}$/,\n TW: /^(?:(?:\\+886)|0)?9\\d{8}$/,\n UA: /^(?:(?:\\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\\d{7}$/,\n UG: /^(?:(?:\\+256)|0)?[39]\\d{8}$/,\n};\n","/* Source: Google LibPhoneNumber Metadata: https://github.com/google/libphonenumber/blob/master/javascript/i18n/phonenumbers/metadata.js */\n\nexport const DIAL_CODE_MAPPER: { [key: number]: string[] } = {\n 1: [\n 'US',\n 'AG',\n 'AI',\n 'AS',\n 'BB',\n 'BM',\n 'BS',\n 'CA',\n 'DM',\n 'DO',\n 'GD',\n 'GU',\n 'JM',\n 'KN',\n 'KY',\n 'LC',\n 'MP',\n 'MS',\n 'PR',\n 'SX',\n 'TC',\n 'TT',\n 'VC',\n 'VG',\n 'VI',\n ],\n 7: ['RU', 'KZ'],\n 20: ['EG'],\n 27: ['ZA'],\n 30: ['GR'],\n 31: ['NL'],\n 32: ['BE'],\n 33: ['FR'],\n 34: ['ES'],\n 36: ['HU'],\n 39: ['IT', 'VA'],\n 40: ['RO'],\n 41: ['CH'],\n 43: ['AT'],\n 44: ['GB', 'GG', 'IM', 'JE'],\n 45: ['DK'],\n 46: ['SE'],\n 47: ['NO', 'SJ'],\n 48: ['PL'],\n 49: ['DE'],\n 51: ['PE'],\n 52: ['MX'],\n 53: ['CU'],\n 54: ['AR'],\n 55: ['BR'],\n 56: ['CL'],\n 57: ['CO'],\n 58: ['VE'],\n 60: ['MY'],\n 61: ['AU', 'CC', 'CX'],\n 62: ['ID'],\n 63: ['PH'],\n 64: ['NZ'],\n 65: ['SG'],\n 66: ['TH'],\n 81: ['JP'],\n 82: ['KR'],\n 84: ['VN'],\n 86: ['CN'],\n 90: ['TR'],\n 91: ['IN'],\n 92: ['PK'],\n 93: ['AF'],\n 94: ['LK'],\n 95: ['MM'],\n 98: ['IR'],\n 211: ['SS'],\n 212: ['MA', 'EH'],\n 213: ['DZ'],\n 216: ['TN'],\n 218: ['LY'],\n 220: ['GM'],\n 221: ['SN'],\n 222: ['MR'],\n 223: ['ML'],\n 224: ['GN'],\n 225: ['CI'],\n 226: ['BF'],\n 227: ['NE'],\n 228: ['TG'],\n 229: ['BJ'],\n 230: ['MU'],\n 231: ['LR'],\n 232: ['SL'],\n 233: ['GH'],\n 234: ['NG'],\n 235: ['TD'],\n 236: ['CF'],\n 237: ['CM'],\n 238: ['CV'],\n 239: ['ST'],\n 240: ['GQ'],\n 241: ['GA'],\n 242: ['CG'],\n 243: ['CD'],\n 244: ['AO'],\n 245: ['GW'],\n 246: ['IO'],\n 247: ['AC'],\n 248: ['SC'],\n 249: ['SD'],\n 250: ['RW'],\n 251: ['ET'],\n 252: ['SO'],\n 253: ['DJ'],\n 254: ['KE'],\n 255: ['TZ'],\n 256: ['UG'],\n 257: ['BI'],\n 258: ['MZ'],\n 260: ['ZM'],\n 261: ['MG'],\n 262: ['RE', 'YT'],\n 263: ['ZW'],\n 264: ['NA'],\n 265: ['MW'],\n 266: ['LS'],\n 267: ['BW'],\n 268: ['SZ'],\n 269: ['KM'],\n 290: ['SH', 'TA'],\n 291: ['ER'],\n 297: ['AW'],\n 298: ['FO'],\n 299: ['GL'],\n 350: ['GI'],\n 351: ['PT'],\n 352: ['LU'],\n 353: ['IE'],\n 354: ['IS'],\n 355: ['AL'],\n 356: ['MT'],\n 357: ['CY'],\n 358: ['FI', 'AX'],\n 359: ['BG'],\n 370: ['LT'],\n 371: ['LV'],\n 372: ['EE'],\n 373: ['MD'],\n 374: ['AM'],\n 375: ['BY'],\n 376: ['AD'],\n 377: ['MC'],\n 378: ['SM'],\n 380: ['UA'],\n 381: ['RS'],\n 382: ['ME'],\n 383: ['XK'],\n 385: ['HR'],\n 386: ['SI'],\n 387: ['BA'],\n 389: ['MK'],\n 420: ['CZ'],\n 421: ['SK'],\n 423: ['LI'],\n 500: ['FK'],\n 501: ['BZ'],\n 502: ['GT'],\n 503: ['SV'],\n 504: ['HN'],\n 505: ['NI'],\n 506: ['CR'],\n 507: ['PA'],\n 508: ['PM'],\n 509: ['HT'],\n 590: ['GP', 'BL', 'MF'],\n 591: ['BO'],\n 592: ['GY'],\n 593: ['EC'],\n 594: ['GF'],\n 595: ['PY'],\n 596: ['MQ'],\n 597: ['SR'],\n 598: ['UY'],\n 599: ['CW', 'BQ'],\n 670: ['TL'],\n 672: ['NF'],\n 673: ['BN'],\n 674: ['NR'],\n 675: ['PG'],\n 676: ['TO'],\n 677: ['SB'],\n 678: ['VU'],\n 679: ['FJ'],\n 680: ['PW'],\n 681: ['WF'],\n 682: ['CK'],\n 683: ['NU'],\n 685: ['WS'],\n 686: ['KI'],\n 687: ['NC'],\n 688: ['TV'],\n 689: ['PF'],\n 690: ['TK'],\n 691: ['FM'],\n 692: ['MH'],\n 800: ['001'],\n 808: ['001'],\n 850: ['KP'],\n 852: ['HK'],\n 853: ['MO'],\n 855: ['KH'],\n 856: ['LA'],\n 870: ['001'],\n 878: ['001'],\n 880: ['BD'],\n 881: ['001'],\n 882: ['001'],\n 883: ['001'],\n 886: ['TW'],\n 888: ['001'],\n 960: ['MV'],\n 961: ['LB'],\n 962: ['JO'],\n 963: ['SY'],\n 964: ['IQ'],\n 965: ['KW'],\n 966: ['SA'],\n 967: ['YE'],\n 968: ['OM'],\n 970: ['PS'],\n 971: ['AE'],\n 972: ['IL'],\n 973: ['BH'],\n 974: ['QA'],\n 975: ['BT'],\n 976: ['MN'],\n 977: ['NP'],\n 979: ['001'],\n 992: ['TJ'],\n 993: ['TM'],\n 994: ['AZ'],\n 995: ['GE'],\n 996: ['KG'],\n 998: ['UZ'],\n};\n","import { DIAL_CODE_MAPPER } from './data/dialCodeMapper';\nimport { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\n\n/**\n * Determines the country code based on the provided phone number.\n * This function employs a multi-step approach to identify the country code:\n * - If the phone number starts with '+', it extracts the numeric characters\n * and matches the leading digits with known dial codes mapped to countries.\n * - For matched dial codes, it further filters based on country-specific regex patterns\n * to validate the phone number format for those countries.\n * - If the phone number doesn't start with '+', it directly matches the number\n * against regular expressions associated with various countries to identify the code.\n *\n * @param phoneNumber The input phone number (string or number).\n * @returns The detected country code or an empty string if not found.\n */\nexport const detectCountryCodeFromDialCode = (\n phoneNumber: string | number,\n): string => {\n // If the phone number starts with '+', extract numeric characters\n if (phoneNumber.toString().charAt(0) === '+') {\n const cleanedPhoneNumberWithoutPlusPrefix = phoneNumber\n .toString()\n .replace(/\\D/g, '');\n\n const matchingCountries: string[] = [];\n\n // Iterate through dial codes and check for matches with cleaned phone number\n for (const code in DIAL_CODE_MAPPER) {\n if (cleanedPhoneNumberWithoutPlusPrefix.startsWith(code)) {\n matchingCountries.push(...DIAL_CODE_MAPPER[code]);\n }\n }\n\n // Filter matching countries based on phone number validation regex\n const matchedCountryCode = matchingCountries.find((countryCode: string) => {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex && regex.test(phoneNumber.toString())) return countryCode;\n return undefined;\n });\n\n // Return the first matched country code, if any\n return matchedCountryCode || '';\n } else {\n // If phone number doesn't start with '+', directly match against country regexes\n for (const countryCode in PHONE_REGEX_MAPPER) {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex.test(phoneNumber.toString())) {\n return countryCode;\n }\n }\n }\n\n // Return empty string if no country code is detected\n return '';\n};\n\nexport const cleanPhoneNumber = (phoneNumber: string) => {\n // Regular expression to match all characters except numbers and + sign at the start\n const regex = /[^0-9+]|(?!A)\\+/g;\n // Replace matched characters with an empty string\n const cleanedPhoneNumber = phoneNumber.replace(regex, '');\n return phoneNumber[0] === '+' ? `+${cleanedPhoneNumber}` : cleanedPhoneNumber;\n};\n","import { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Validates whether a given phone number is valid based on the provided country code or auto-detects the country code and checks if the number matches the defined regex pattern for that country.\nconst isValidPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_REGEX_MAPPER,\n): boolean => {\n // Clean the provided phoneNumber by removing non-numeric characters\n const cleanedPhoneNumber = cleanPhoneNumber(phoneNumber.toString());\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_REGEX_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(cleanedPhoneNumber);\n\n // Return false if phoneNumber is empty\n if (!phoneNumber) return false;\n\n // Check if the countryCode exists in the PHONE_REGEX_MAPPER\n if (countryCode in PHONE_REGEX_MAPPER) {\n // Fetch the regex pattern for the countryCode\n const regex = PHONE_REGEX_MAPPER[countryCode];\n // Test if the cleanedPhoneNumber matches the regex pattern\n return regex.test(cleanedPhoneNumber as string);\n }\n\n // Return false if the countryCode is not supported\n return false;\n};\n\nexport default withErrorBoundary(isValidPhoneNumber);\n","export const PHONE_FORMATTER_MAPPER: { [key: string]: string } = {\n IN: 'xxxx xxxxxx',\n MY: 'xx xxxxx xx',\n AE: 'xx xxx xxxx',\n AL: 'xxx xx xxxx',\n AM: 'xx xx xx xx',\n AR: 'xxxx-xxxx',\n AU: 'xxx xxx xxx',\n AW: 'xxx-xxxx',\n BB: 'xxx-xxxx',\n BD: 'xxxx-xxxxxx',\n BM: 'xxx-xxxx',\n BN: 'xxxx-xxxx',\n BO: 'xxxx-xxxx',\n BS: 'xxx-xxxx',\n BW: 'xx xxxx xxxx',\n BZ: 'xxx-xxxx',\n CA: 'xxx-xxx-xxxx',\n CH: 'xxx xxx xxx',\n CN: 'xxxx-xxxxxxx',\n CO: 'xxxx-xxxxxxx',\n CR: 'xxxx-xxxx',\n CU: 'xxxx-xxxx',\n CZ: 'xxx xxx xxx',\n DK: 'xx xx xx xx',\n DO: 'xxx-xxxxxxx',\n DZ: 'xxxx-xxxx-xxx',\n EG: 'xx xxx xxxx',\n ET: 'xx xxx xxxx',\n EU: 'xxx xx xx xx',\n FJ: 'xxxx xxxx',\n GB: 'xxxx xxx xxx',\n GH: 'xxx xxx xxxx',\n GI: 'xxxx xxxx',\n GM: 'xxxx-xxxx',\n GT: 'xxxx-xxxx',\n GY: 'xxx-xxxx',\n HK: 'xxxx xxxx',\n HN: 'xxxx-xxxx',\n HR: 'xxx xxx xxxx',\n HT: 'xxx-xxxx',\n HU: 'xxx xxx xxxx',\n ID: 'xxxx-xxxx-xxxx',\n IL: 'xxxx-xxx-xxx',\n JM: 'xxx-xxxx',\n KE: 'xxx xxxxxx',\n KG: 'xxx-xx-xx-xx',\n KH: 'xxx-xxx-xxx',\n KY: 'xxx-xxxx',\n KZ: 'xxx-xxx-xx-xx',\n LA: 'xxx xx xxxx',\n LK: 'xx xxx xxxx',\n LR: 'xxx-xxx-xxxx',\n LS: 'xxx xx xxxx',\n LT: 'xxx xxxxx',\n LU: 'xxx xx xxx',\n LV: 'xxxx xxxx',\n MA: 'xxxx-xxxxxx',\n MD: 'xx xxxxxx',\n ME: 'xx xxxxxx',\n MG: 'xx xx xx xx xx',\n MK: 'xx xx xx xx',\n MM: 'xx xxxxxx',\n MN: 'xxx-xx-xxxx',\n MO: 'xxxx xxxx',\n MU: 'xx xxxx xxxx',\n MV: 'xxxxxx',\n MW: 'xx xxxx xxxx',\n MX: 'xxx-xxx-xxxx',\n MZ: 'xx xxxxxxx',\n NA: 'xx xxxx xxxx',\n NG: 'xxx xxx xxxx',\n NI: 'xxxx-xxxx',\n NL: 'xxx-xxxxxxx',\n NO: 'xxxx xxxx',\n NP: 'xxxx-xxxxxxx',\n NZ: 'xxx-xxxxxxx',\n OM: 'xxxx-xxxx',\n PA: 'xxx-xxxx',\n PE: 'xxx-xxx-xxx',\n PG: 'xxx-xxxxxx',\n PH: 'xxx-xxxx',\n PK: 'xxx-xxxxxxx',\n PL: 'xxx xxx xxx',\n PR: 'xxx-xxx-xxxx',\n PS: 'xxxx-xxxxxxx',\n PT: 'xxx xxx xxx',\n PY: 'xxx-xxxxxx',\n QA: 'xxxx xxxx',\n RO: 'xxx xxx xxxx',\n RS: 'xxx xxxxx',\n RU: 'xxx xxx-xx-xx',\n RW: 'xxx xxxxxx',\n SA: 'xxx-xxxxxxx',\n SC: 'xx xxxxx',\n SE: 'xxx-xxx xx xx',\n SG: 'xxxx xxxx',\n SI: 'xx xxxxxx',\n SK: 'xxx xxx xxx',\n SL: 'xxx-xxxxxx',\n SM: 'xxxxx xxxxx',\n SN: 'xx xxx xx xx',\n SO: 'xxx xxxxxxx',\n SR: 'xxx-xxxx',\n SS: 'xxx xxxx xxx',\n SV: 'xxxx-xxxx',\n SZ: 'xxx xx xxxx',\n TG: 'xx xx xx xx',\n TH: 'xxx-xxxxxxx',\n TJ: 'xxx xx xx xx',\n TL: 'xxx-xxxxxxx',\n TN: 'xx xxxxxx',\n TR: 'xxx xxx xx xx',\n TT: 'xxx-xxxx',\n TW: 'xxxx-xxxxxx',\n TZ: 'xxx xxx xxxx',\n UA: 'xx xxx xx xx',\n UG: 'xxx xxxxxxx',\n US: 'xxx-xxx-xxxx',\n UY: 'xxx-xxxxx',\n UZ: 'xxx-xxx-xx-xx',\n VC: 'xxx-xxxx',\n VE: 'xxxx-xxx-xxxx',\n VN: 'xxxx-xxxxxxx',\n YE: 'xxxx-xxxx',\n ZA: 'xxx-xxx-xxxx',\n ZM: 'xxx-xxxxxxx',\n ZW: 'xx xxx xxxx',\n KW: 'xxx xx xxxx',\n BH: 'xxxx xxxx',\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Formats a provided phone number according to the predefined format for a specific country code, or auto-detects the country code and formats the number accordingly.\nconst formatPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_FORMATTER_MAPPER,\n): string => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Convert phoneNumber to string and clean it by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_FORMATTER_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Fetch the pattern for the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern) return phoneNumber;\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n // Extract the phoneNumber without the prefix\n const phoneNumberWithoutPrefix = phoneNumber.slice(diff);\n const formattedNumber: string[] = [];\n let numberIndex = 0;\n\n // Loop through the pattern to format the phoneNumber\n for (let i = 0; i < pattern.length; i++) {\n const patternChar = pattern[i];\n if (patternChar === 'x') {\n // Insert phoneNumber digits at 'x' positions\n if (numberIndex < phoneNumberWithoutPrefix.length) {\n formattedNumber.push(phoneNumberWithoutPrefix[numberIndex]);\n numberIndex++;\n }\n } else {\n // Insert non-digit characters from the pattern\n formattedNumber.push(patternChar);\n }\n }\n\n // Join the formattedNumber array to create the formattedPhoneNumber without prefix\n const formattedPhoneNumberWithoutPrefix = formattedNumber.join('');\n // Combine the prefix and formattedPhoneNumberWithoutPrefix\n const formattedPhoneNumberWithPrefix =\n phoneNumber.slice(0, diff) + ' ' + formattedPhoneNumberWithoutPrefix;\n\n // Return the formattedPhoneNumber with prefix after trimming whitespace\n return formattedPhoneNumberWithPrefix.trim();\n};\n\nexport default withErrorBoundary(formatPhoneNumber);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport formatPhoneNumber from './formatPhoneNumber';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\ninterface PhoneInfo {\n countryCode: string;\n dialCode: string;\n formattedPhoneNumber: string;\n formatTemplate: string;\n}\n\n// Parses a given phone number, identifies its country code (if not provided), and returns an object with details including the country code, formatted phone number, dial code, and format template.\nconst parsePhoneNumber = (phoneNumber: string, country?: string): PhoneInfo => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Clean the phoneNumber by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n const countryCode =\n country && country in PHONE_FORMATTER_MAPPER\n ? country\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Format the phone number using the detected/validated country code\n const formattedPhoneNumber = formatPhoneNumber(phoneNumber, countryCode);\n\n // Fetch the pattern associated with the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern)\n return {\n countryCode: countryCode || '',\n dialCode: '',\n formattedPhoneNumber: phoneNumber,\n formatTemplate: '',\n };\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n\n // Extract the dialCode from the phoneNumber\n const dialCode = phoneNumber.slice(0, diff);\n\n // Obtain the format template associated with the countryCode\n const formatTemplate = PHONE_FORMATTER_MAPPER[countryCode];\n\n // Return the parsed phone number information\n return {\n countryCode,\n formattedPhoneNumber,\n dialCode,\n formatTemplate,\n };\n};\n\nexport default withErrorBoundary(parsePhoneNumber);\n","export const stringToDate = (dateString: string): Date => {\n const supportedDateFormats = [\n // Date formats\n {\n regex: /^(\\d{4})\\/(\\d{2})\\/(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY/MM/DD\n {\n regex: /^(\\d{2})\\/(\\d{2})\\/(\\d{4})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n }, // DD/MM/YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY.MM.DD\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // DD-MM-YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // MM/DD/YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY-MM-DD\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY. MM. DD.\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // DD.MM.YYYY\n\n // Timestamp formats\n {\n regex: /^(\\d{4})\\/(\\d{2})\\/(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY/MM/DD HH:MM:SS\n {\n regex: /^(\\d{2})\\/(\\d{2})\\/(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD/MM/YYYY HH:MM:SS\n {\n regex: /^(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY-MM-DD HH:MM:SS\n {\n regex: /^(\\d{2})-(\\d{2})-(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD-MM-YYYY HH:MM:SS\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY.MM.DD HH:MM:SS\n {\n regex: /^(\\d{2})\\.(\\d{2})\\.(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD.MM.YYYY HH:MM:SS\n ];\n\n for (const format of supportedDateFormats) {\n const match = dateString.match(format.regex);\n if (match) {\n const year = match[format.yearIndex];\n const month = match[format.monthIndex];\n const day = match[format.dayIndex];\n const hour = format.hourIndex ? match[format.hourIndex] : '00';\n const minute = format.minuteIndex ? match[format.minuteIndex] : '00';\n const second = format.secondIndex ? match[format.secondIndex] : '00';\n\n return new Date(`${year}-${month}-${day}T${hour}:${minute}:${second}`);\n }\n }\n\n throw new Error('Date format not recognized');\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Adds a specified amount of time to a date.\n *\n * @param date The original date.\n * @param value The amount to add.\n * @param unit The unit of time to add (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time added.\n */\nconst add = (\n date: DateInput,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n switch (unit) {\n case 'days':\n date.setDate(date.getDate() + value);\n break;\n case 'months':\n date.setMonth(date.getMonth() + value);\n break;\n case 'years':\n date.setFullYear(date.getFullYear() + value);\n break;\n }\n return date;\n};\n\nexport default withErrorBoundary(add);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Formats date and time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional).\n * @returns {string} Formatted date and time string.\n */\nconst formatDateTime = (\n date: DateInput,\n locale: Locale,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n const dateObj: Date = date instanceof Date ? date : new Date(date);\n let formatter;\n\n try {\n formatter = new Intl.DateTimeFormat(locale, intlOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formatter.format(dateObj);\n};\n\nexport default withErrorBoundary(formatDateTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n DateFormatOptions,\n} from './types';\n\n/**\n * Formats date based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional).\n * @returns {string} Formatted date string.\n */\nconst formatDate = (\n date: DateInput,\n locale: Locale,\n options: DateFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n timeStyle: undefined,\n };\n\n let formattedDate;\n\n try {\n formattedDate = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedDate;\n};\n\nexport default withErrorBoundary(formatDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n TimeFormatOptions,\n} from './types';\n\n/**\n * Formats time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional).\n * @returns {string} Formatted time string.\n */\nconst formatTime = (\n date: DateInput,\n locale: Locale,\n options: TimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n dateStyle: undefined,\n };\n\n let formattedTime;\n\n try {\n formattedTime = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedTime;\n};\n\nexport default withErrorBoundary(formatTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\n\n/**\n * Gets the first day of the week for a given locale.\n *\n * @param locale The locale to determine the first day of the week for.\n * @param intlOptions Optional Intl.DateTimeFormatOptions for customization.\n * @returns The first day of the week (0-6, where 0 is Sunday).\n */\nconst getFirstDayOfWeek = (\n locale: string,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n let formatted;\n\n if (!intlOptions.weekday) intlOptions.weekday = 'long';\n\n try {\n const formatter = new Intl.DateTimeFormat(locale, intlOptions);\n /**\n * This date was chosen because January 2, 2000, is a Sunday.\n * In the Gregorian calendar, Sunday is considered the start of the week in some cultures (like in the United States), while in others, it's Monday (like in much of Europe).\n * By using a date that is known to be a Sunday, the function can accurately determine what day of the week is considered the start in the specified locale.\n */\n const sundayDate = new Date(2000, 0, 2); // A known Sunday\n formatted = formatter.format(sundayDate);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n // Generate localized weekdays array starting from Sunday\n const weekdays = Array.from({ length: 7 }, (_, i) =>\n new Intl.DateTimeFormat(locale, intlOptions).format(\n new Date(2000, 0, 2 + i),\n ),\n );\n\n const firstDayIndex = weekdays.indexOf(formatted);\n if (firstDayIndex === -1) {\n throw new Error('Unable to determine the first day of the week');\n }\n\n return weekdays[(firstDayIndex + 1) % 7]; // Adjusting since our reference date is a Sunday\n};\n\nexport default withErrorBoundary(getFirstDayOfWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Determines the quarter of the year for a given date.\n *\n * @param date The date to determine the quarter for.\n * @returns The quarter of the year (1-4).\n */\nconst getQuarter = (date: DateInput): number => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n return Math.ceil((date.getMonth() + 1) / 3);\n};\n\nexport default withErrorBoundary(getQuarter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Provides a relative time string (e.g., '3 hours ago', 'in 2 days').\n * This function calculates the difference between the given date and the base date,\n * then formats it in a locale-sensitive manner. It allows customization of the output\n * through Intl.RelativeTimeFormat options.\n *\n * @param date - The date to compare.\n * @param baseDate - The date to compare against (default: current date).\n * @param locale - The locale to use for formatting.\n * @param options - Options for the Intl.RelativeTimeFormat (optional).\n * @returns The relative time as a string.\n */\nconst getRelativeTime = (\n date: DateInput,\n baseDate: DateInput = new Date(),\n locale: Locale,\n options?: Intl.RelativeTimeFormatOptions,\n): string => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n baseDate =\n typeof baseDate === 'string'\n ? new Date(stringToDate(baseDate))\n : new Date(baseDate);\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000;\n\n // Define time units in seconds\n const minute = 60;\n const hour = minute * 60;\n const day = hour * 24;\n const week = day * 7;\n const month = day * 30;\n const year = day * 365;\n\n let value: number;\n let unit: Intl.RelativeTimeFormatUnit;\n\n if (Math.abs(diffInSeconds) < minute) {\n value = diffInSeconds;\n unit = 'second';\n } else if (Math.abs(diffInSeconds) < hour) {\n value = diffInSeconds / minute;\n unit = 'minute';\n } else if (Math.abs(diffInSeconds) < day) {\n value = diffInSeconds / hour;\n unit = 'hour';\n } else if (Math.abs(diffInSeconds) < week) {\n value = diffInSeconds / day;\n unit = 'day';\n } else if (Math.abs(diffInSeconds) < month) {\n value = diffInSeconds / week;\n unit = 'week';\n } else if (Math.abs(diffInSeconds) < year) {\n value = diffInSeconds / month;\n unit = 'month';\n } else {\n value = diffInSeconds / year;\n unit = 'year';\n }\n\n let relativeTime;\n\n try {\n const rtf = new Intl.RelativeTimeFormat(locale, options);\n relativeTime = rtf.format(Math.round(value), unit);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return relativeTime;\n};\n\nexport default withErrorBoundary(getRelativeTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Calculates the week number of the year for a given date.\n *\n * @param date The date to calculate the week number for.\n * @returns The week number of the year.\n */\nconst getWeek = (date: DateInput): number => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n const firstDayOfYear = new Date(date.getFullYear(), 0, 1);\n const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000;\n return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7);\n};\n\nexport default withErrorBoundary(getWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Returns an array of weekdays according to the specified locale.\n *\n * @param locale The locale to get weekdays for.\n * @param intlOptions Optional Intl.DateTimeFormatOptions for customization.\n * @returns An array of weekday names.\n */\nconst getWeekdays = (\n locale: Locale,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string[] => {\n try {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n if (!intlOptions.weekday) intlOptions.weekday = 'long';\n\n const formatter = new Intl.DateTimeFormat(locale, intlOptions);\n\n /** The date January 1, 1970, is a well-known reference point in computing known as the Unix epoch.\n * It's the date at which time is measured for Unix systems, making it a consistent and reliable choice for date calculations.\n * The choice of the date January 4, 1970, as the starting point is significant.\n * January 4, 1970, was a Sunday.\n * Since weeks typically start on Sunday or Monday in most locales, starting from a known Sunday allows the function to cycle through a complete week, capturing all weekdays in the order they appear for the given locale.\n * */\n return Array.from({ length: 7 }, (_, i) =>\n formatter.format(new Date(1970, 0, 4 + i)),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(getWeekdays);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Compares two dates to determine if the first is after the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is after date2.\n */\nconst isAfter = (date1: DateInput, date2: DateInput): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 > dateObj2;\n};\n\nexport default withErrorBoundary(isAfter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Compares two dates to determine if the first is before the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is before date2.\n */\nconst isBefore = (date1: DateInput, date2: DateInput): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 < dateObj2;\n};\n\nexport default withErrorBoundary(isBefore);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given year is a leap year.\n *\n * @param year The year to check.\n * @returns True if the year is a leap year, false otherwise.\n */\nconst isLeapYear = (year: number): boolean => {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n};\n\nexport default withErrorBoundary(isLeapYear);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { stringToDate } from './utils';\n\n/**\n * Checks if two dates fall on the same day.\n *\n * @param date1 The first date.\n * @param date2 The second date.\n * @returns True if both dates are on the same day, false otherwise.\n */\nconst isSameDay = (date1: Date, date2: Date): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n return (\n date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear()\n );\n};\n\nexport default withErrorBoundary(isSameDay);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { stringToDate } from './utils';\n\n/**\n * Checks if a given object is a valid Date object.\n *\n * @param date The object to check.\n * @returns True if the object is a valid Date, false otherwise.\n */\nconst isValidDate = (date: any): boolean => {\n try {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return date instanceof Date && !isNaN(date.getTime());\n};\n\nexport default withErrorBoundary(isValidDate);\n","export const LOCALE_DATE_FORMATS: { [key: string]: string } = {\n 'ar-AE': 'DD/MM/YYYY', // Arabic (U.A.E.)\n 'sq-AL': 'DD.MM.YYYY', // Albanian (Albania)\n 'hy-AM': 'DD.MM.YYYY', // Armenian (Armenia)\n 'es-AR': 'DD/MM/YYYY', // Spanish (Argentina)\n 'en-AU': 'DD/MM/YYYY', // English (Australia)\n 'nl-AW': 'DD-MM-YYYY', // Dutch (Aruba)\n 'en-BB': 'MM/DD/YYYY', // English (Barbados)\n 'bn-BD': 'DD/MM/YYYY', // Bengali (Bangladesh)\n 'en-BM': 'MM/DD/YYYY', // English (Bermuda)\n 'ms-BN': 'DD/MM/YYYY', // Malay (Brunei)\n 'es-BO': 'DD/MM/YYYY', // Spanish (Bolivia)\n 'en-BS': 'MM/DD/YYYY', // English (Bahamas)\n 'en-BW': 'DD/MM/YYYY', // English (Botswana)\n 'en-BZ': 'MM/DD/YYYY', // English (Belize)\n 'en-CA': 'DD/MM/YYYY', // English (Canada)\n 'de-CH': 'DD.MM.YYYY', // German (Switzerland)\n 'zh-CN': 'YYYY/MM/DD', // Chinese (China)\n 'es-CO': 'DD/MM/YYYY', // Spanish (Colombia)\n 'es-CR': 'DD/MM/YYYY', // Spanish (Costa Rica)\n 'es-CU': 'DD/MM/YYYY', // Spanish (Cuba)\n 'cs-CZ': 'DD.MM.YYYY', // Czech (Czech Republic)\n 'da-DK': 'DD-MM-YYYY', // Danish (Denmark)\n 'es-DO': 'DD/MM/YYYY', // Spanish (Dominican Republic)\n 'ar-DZ': 'DD/MM/YYYY', // Arabic (Algeria)\n 'ar-EG': 'DD/MM/YYYY', // Arabic (Egypt)\n 'am-ET': 'DD/MM/YYYY', // Amharic (Ethiopia)\n 'en-EU': 'DD/MM/YYYY', // English (European Union)\n 'en-FJ': 'DD/MM/YYYY', // English (Fiji)\n 'en-GB': 'DD/MM/YYYY', // English (United Kingdom)\n 'en-GH': 'DD/MM/YYYY', // English (Ghana)\n 'en-GI': 'DD/MM/YYYY', // English (Gibraltar)\n 'en-GM': 'DD/MM/YYYY', // English (Gambia)\n 'es-GT': 'DD/MM/YYYY', // Spanish (Guatemala)\n 'en-GY': 'DD/MM/YYYY', // English (Guyana)\n 'en-HK': 'DD/MM/YYYY', // English (Hong Kong)\n 'es-HN': 'DD/MM/YYYY', // Spanish (Honduras)\n 'hr-HR': 'DD.MM.YYYY', // Croatian (Croatia)\n 'ht-HT': 'MM/DD/YYYY', // Haitian (Haiti)\n 'hu-HU': 'YYYY. MM. DD.', // Hungarian (Hungary)\n 'id-ID': 'DD/MM/YYYY', // Indonesian (Indonesia)\n 'he-IL': 'DD/MM/YYYY', // Hebrew (Israel)\n 'en-IN': 'DD-MM-YYYY', // English (India)\n 'en-JM': 'MM/DD/YYYY', // English (Jamaica)\n 'en-KE': 'DD/MM/YYYY', // English (Kenya)\n 'ky-KG': 'DD.MM.YYYY', // Kyrgyz (Kyrgyzstan)\n 'km-KH': 'DD/MM/YYYY', // Khmer (Cambodia)\n 'en-KY': 'MM/DD/YYYY', // English (Cayman Islands)\n 'kk-KZ': 'DD.MM.YYYY', // Kazakh (Kazakhstan)\n 'lo-LA': 'DD/MM/YYYY', // Lao (Laos)\n 'si-LK': 'YYYY-MM-DD', // Sinhala (Sri Lanka)\n 'en-LR': 'MM/DD/YYYY', // English (Liberia)\n 'en-LS': 'DD/MM/YYYY', // English (Lesotho)\n 'ar-MA': 'DD/MM/YYYY', // Arabic (Morocco)\n 'ro-MD': 'DD.MM.YYYY', // Romanian (Moldova)\n 'mk-MK': 'DD.MM.YYYY', // Macedonian (North Macedonia)\n 'my-MM': 'DD/MM/YYYY', // Burmese (Myanmar)\n 'mn-MN': 'YYYY.MM.DD', // Mongolian (Mongolia)\n 'zh-MO': 'DD/MM/YYYY', // Chinese (Macao)\n 'en-MU': 'DD/MM/YYYY', // English (Mauritius)\n 'dv-MV': 'DD/MM/YYYY', // Divehi (Maldives)\n 'en-MW': 'DD/MM/YYYY', // English (Malawi)\n 'es-MX': 'DD/MM/YYYY', // Spanish (Mexico)\n 'ms-MY': 'DD/MM/YYYY', // Malay (Malaysia)\n 'en-NA': 'DD/MM/YYYY', // English (Namibia)\n 'en-NG': 'DD/MM/YYYY', // English (Nigeria)\n 'es-NI': 'DD/MM/YYYY', // Spanish (Nicaragua)\n 'no-NO': 'DD.MM.YYYY', // Norwegian (Norway)\n 'ne-NP': 'YYYY/MM/DD', // Nepali (Nepal)\n 'en-NZ': 'DD/MM/YYYY', // English (New Zealand)\n 'es-PE': 'DD/MM/YYYY', // Spanish (Peru)\n 'en-PG': 'DD/MM/YYYY', // English (Papua New Guinea)\n 'en-PH': 'MM/DD/YYYY', // English (Philippines)\n 'en-PK': 'DD/MM/YYYY', // English (Pakistan)\n 'ar-QA': 'DD/MM/YYYY', // Arabic (Qatar)\n 'ru-RU': 'DD.MM.YYYY', // Russian (Russia)\n 'ar-SA': 'DD/MM/YYYY', // Arabic (Saudi Arabia)\n 'en-SC': 'DD/MM/YYYY', // English (Seychelles)\n 'sv-SE': 'YYYY-MM-DD', // Swedish (Sweden)\n 'en-SG': 'DD/MM/YYYY', // English (Singapore)\n 'en-SL': 'DD/MM/YYYY', // English (Sierra Leone)\n 'so-SO': 'DD/MM/YYYY', // Somali (Somalia)\n 'en-SS': 'DD/MM/YYYY', // English (South Sudan)\n 'es-SV': 'DD/MM/YYYY', // Spanish (El Salvador)\n 'en-SZ': 'DD/MM/YYYY', // English (Eswatini)\n 'th-TH': 'DD/MM/YYYY', // Thai (Thailand)\n 'en-TT': 'MM/DD/YYYY', // English (Trinidad and Tobago)\n 'sw-TZ': 'DD/MM/YYYY', // Swahili (Tanzania)\n 'en-US': 'MM/DD/YYYY', // English (United States)\n 'es-UY': 'DD/MM/YYYY', // Spanish (Uruguay)\n 'uz-UZ': 'DD/MM/YYYY', // Uzbek (Uzbekistan)\n 'ar-YE': 'DD/MM/YYYY', // Arabic (Yemen)\n 'en-ZA': 'YYYY/MM/DD', // English (South Africa)\n 'ar-KW': 'DD/MM/YYYY', // Arabic (Kuwait)\n 'ar-BH': 'DD/MM/YYYY', // Arabic (Bahrain)\n 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman)\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Parses a date string based on a specific format.\n *\n * @param dateString The date string to parse.\n * @param format The format to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDateWithFormat = (\n dateString: string,\n format: string,\n): Date | null => {\n // Determine the separator based on the format (supports '/', '.', or '-')\n const separator = format.includes('/')\n ? '/'\n : format.includes('.')\n ? '.'\n : '-';\n const formatParts = format.split(separator);\n const dateParts = dateString.split(separator).map((num) => parseInt(num, 10));\n\n let year: number = 0,\n month: number = 0,\n day: number = 0;\n let yearSet: boolean = false,\n monthSet: boolean = false,\n daySet: boolean = false;\n\n // Check for format and date string mismatch\n if (dateParts.length !== formatParts.length) {\n return null; // Mismatch between date string and format\n }\n\n formatParts.forEach((part, index) => {\n // Check for non-numeric values in date string\n if (isNaN(dateParts[index])) {\n return null; // Invalid date part\n }\n\n // Assign year, month, and day based on the format\n switch (part) {\n case 'DD':\n day = dateParts[index];\n daySet = true;\n break;\n case 'MM':\n month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date\n monthSet = true;\n break;\n case 'YYYY':\n year = dateParts[index];\n yearSet = true;\n break;\n }\n });\n\n // Validate and create the date only if all parts are set\n if (yearSet && monthSet && daySet) {\n const parsedDate = new Date(year, month, day);\n // Validate date to catch invalid dates like February 30th\n if (\n parsedDate.getFullYear() === year &&\n parsedDate.getMonth() === month &&\n parsedDate.getDate() === day\n ) {\n return parsedDate;\n }\n }\n return null; // Invalid date or incomplete date information\n};\n\nexport default withErrorBoundary(\n parseDateWithFormat,\n);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { LOCALE_DATE_FORMATS } from './data/localeDateFormats';\nimport parseDateWithFormat from './parseDateWithFormat';\nimport { Locale } from './types';\n\n/**\n * Attempts to parse a string into a date object based on locale.\n * Uses the localeDateFormats mapping for determining the date format.\n *\n * @param dateString - The date string to parse.\n * @param locale - The locale to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDate = (dateString: string, locale: Locale): Date | null => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const format = LOCALE_DATE_FORMATS[locale];\n if (!format) {\n throw new Error(`No date format found for locale: ${locale}`);\n }\n return parseDateWithFormat(dateString, format);\n};\n\nexport default withErrorBoundary(parseDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport add from './add';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Subtracts a specified amount of time from a date.\n *\n * @param date The original date.\n * @param value The amount to subtract.\n * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time subtracted.\n */\nconst subtract = (\n date: DateInput,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n return add(date, -value, unit); // Reuse the add function with negative value\n};\n\nexport default withErrorBoundary(subtract);\n"],"names":["I18nifyError","Error","constructor","message","super","this","name","timestamp","Date","withErrorBoundary","fn","rest","call","err","console","warn","I18nStateManager","state","locale","direction","country","getInstance","instance","resetInstance","undefined","getState","Object","assign","setState","newState","resetState","getState$1","setState$1","resetState$1","getLocale","navigator","window","Intl","languages","language","getIntlInstanceWithOptions","options","intlOptions","currency","style","NumberFormat","formatNumber$1","amount","Number","formattedAmount","format","CURRENCIES","AED","symbol","ALL","AMD","ARS","AUD","AWG","BBD","BDT","BMD","BND","BOB","BSD","BWP","BZD","CAD","CHF","CNY","COP","CRC","CUP","CZK","DKK","DOP","DZD","EGP","ETB","EUR","FJD","GBP","GHS","GIP","GMD","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","JMD","KES","KGS","KHR","KYD","KZT","LAK","LKR","LRD","LSL","MAD","MDL","MKD","MMK","MNT","MOP","MUR","MVR","MWK","MXN","MYR","NAD","NGN","NIO","NOK","NPR","NZD","PEN","PGK","PHP","PKR","QAR","RUB","SAR","SCR","SEK","SGD","SLL","SOS","SSP","SVC","SZL","THB","TTD","TZS","USD","UYU","UZS","YER","ZAR","KWD","BHD","OMR","getCurrencyList$1","getCurrencySymbol$1","currencyCode","_a","ALLOWED_FORMAT_PARTS_KEYS","formatNumberByParts$1","parts","formatToParts","formattedObj","forEach","p","type","integer","value","findIndex","item","isPrefixSymbol","rawParts","PHONE_REGEX_MAPPER","IN","MY","AE","AL","AM","AR","AU","AW","BB","BD","BM","BN","BO","BS","BW","BZ","CH","CN","CO","OM","CR","CU","CZ","DK","DO","DZ","EG","ET","EU","FJ","GB","GH","GI","GM","GT","GY","HK","HN","HR","HT","HU","ID","IL","JM","KE","KG","KH","KY","KZ","LA","LK","LR","LS","MA","MD","MK","MM","MN","MO","MU","MV","MW","MX","NA","NG","NI","NO","NP","NZ","PE","PG","PH","PK","QA","RU","SA","SC","SE","SG","SL","SO","SS","SV","SZ","TH","TT","TZ","US","CA","UY","UZ","YE","ZA","KW","BH","TL","VC","VE","VN","ZM","ZW","LT","LU","LV","ME","MG","MZ","NL","PA","PL","PR","PS","PT","PY","RO","RS","RW","SI","SK","SM","SN","SR","TG","TJ","TN","TR","TW","UA","UG","DIAL_CODE_MAPPER","detectCountryCodeFromDialCode","phoneNumber","toString","charAt","cleanedPhoneNumberWithoutPlusPrefix","replace","matchingCountries","code","startsWith","push","find","countryCode","regex","test","cleanPhoneNumber","cleanedPhoneNumber","isValidPhoneNumber$1","PHONE_FORMATTER_MAPPER","formatPhoneNumber$1","pattern","charCountInFormatterPattern","i","length","diff","phoneNumberWithoutPrefix","slice","formattedNumber","numberIndex","patternChar","formattedPhoneNumberWithoutPrefix","join","trim","parsePhoneNumber$1","formattedPhoneNumber","formatPhoneNumber","dialCode","formatTemplate","stringToDate","dateString","supportedDateFormats","yearIndex","monthIndex","dayIndex","hourIndex","minuteIndex","secondIndex","match","year","month","day","hour","minute","second","add$1","date","unit","setDate","getDate","setMonth","getMonth","setFullYear","getFullYear","formatDateTime$1","dateObj","formatter","DateTimeFormat","formatDate$1","fullOptions","timeStyle","formattedDate","formatDateTime","formatTime$1","dateStyle","formattedTime","getFirstDayOfWeek$1","formatted","weekday","sundayDate","weekdays","Array","from","_","firstDayIndex","indexOf","getQuarter$1","Math","ceil","getRelativeTime$1","baseDate","diffInSeconds","getTime","week","relativeTime","abs","RelativeTimeFormat","round","getWeek$1","firstDayOfYear","pastDaysOfYear","getDay","getWeekdays$1","isAfter$1","date1","date2","isBefore$1","isLeapYear$1","isSameDay$1","isValidDate$1","isNaN","LOCALE_DATE_FORMATS","parseDateWithFormat$1","separator","includes","formatParts","split","dateParts","map","num","parseInt","yearSet","monthSet","daySet","part","index","parsedDate","parseDate$1","parseDateWithFormat","subtract$1","add"],"mappings":"AACM,MAAOA,UAAqBC,MAEhC,WAAAC,CAAYC,GACVC,MAAMD,GACNE,KAAKC,KAAO,gBACZD,KAAKE,UAAY,IAAIC,IAEtB,EAYI,MAAMC,EACXC,GAEO,YAA4BC,GACjC,IACE,OAAOD,EAAGE,KAAKP,QAASM,EACzB,CAAC,MAAOE,GAIP,MAHAC,QAAQC,KAAK,iBAAkBF,GAGzB,IAAIb,EAAaa,EACxB,CACH,QC7BWG,EAIX,WAAAd,GACEG,KAAKY,MCLA,CACLC,OAAQ,GACRC,UAAW,GACXC,QAAS,GDGV,CAEM,kBAAOC,GAKZ,OAJKL,EAAiBM,WACpBN,EAAiBM,SAAW,IAAIN,GAG3BA,EAAiBM,QACzB,CAEM,oBAAOC,GACZP,EAAiBM,cAAWE,CAC7B,CAEM,QAAAC,GACL,OAAYC,OAAAC,OAAA,CAAA,EAAAtB,KAAKY,MAClB,CAEM,QAAAW,CAASC,GACdxB,KAAKY,MAAaS,OAAAC,OAAAD,OAAAC,OAAA,CAAA,EAAAtB,KAAKY,OAAUY,EAClC,CAEM,UAAAC,GACLzB,KAAKY,MC7BA,CACLC,OAAQ,GACRC,UAAW,GACXC,QAAS,GD2BV,EAGH,IAAeH,EAAAD,EAAiBK,cElBhC,IAAeU,EAAAtB,GAJE,IACRQ,EAAMQ,aCEf,IAAeO,EAAAvB,GAJGoB,IAChBZ,EAAMW,SAASC,EAAS,ICE1B,IAAeI,EAAAxB,GAJI,KACjBQ,EAAMa,YAAY,ICbb,MAAMI,EAAY,KAEvB,GAAyB,oBAAdC,UACT,MAAO,QAIT,GACEC,OAAOC,MACgB,iBAAhBD,OAAOC,OACbD,OAAOD,UAAUG,WAAaF,OAAOD,UAAUI,UAChD,CAIA,OAHoBH,OAAOD,UAAUG,WAAa,CAChDF,OAAOD,UAAUI,WAEA,EACpB,CAGD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fsV,EACA9L,EACA+L,KAEAD,EACkB,iBAATA,EAAoB,IAAIvV,KAAKsU,EAAaiB,IAAS,IAAIvV,KAAKuV,GAE9D0E,EAAI1E,GAAO9L,EAAO+L"} \ No newline at end of file diff --git a/lib/types/index.d.ts b/lib/types/index.d.ts index f0435e49..f5dd6e39 100644 --- a/lib/types/index.d.ts +++ b/lib/types/index.d.ts @@ -56,31 +56,29 @@ interface PhoneInfo { } declare const _default$g: (phoneNumber: string, country?: string | undefined) => PhoneInfo; -declare const _default$f: (date: Date, value: number, unit: "days" | "months" | "years") => Date; - type DateInput = Date | string; -interface DateTimeFormatOptions extends Intl.DateTimeFormatOptions { -} interface DateFormatOptions extends Omit { } interface TimeFormatOptions extends Omit { } +declare const _default$f: (date: DateInput, value: number, unit: "days" | "months" | "years") => Date; + declare const _default$e: (date: DateInput, locale: string, options?: DateFormatOptions | undefined) => string; -declare const _default$d: (date: DateInput, locale: string, options?: DateTimeFormatOptions | undefined) => string; +declare const _default$d: (date: DateInput, locale: string, intlOptions?: Intl.DateTimeFormatOptions | undefined) => string; declare const _default$c: (date: DateInput, locale: string, options?: TimeFormatOptions | undefined) => string; -declare const _default$b: (locale: string) => number; +declare const _default$b: (locale: string, intlOptions?: Intl.DateTimeFormatOptions | undefined) => string; -declare const _default$a: (date: Date) => number; +declare const _default$a: (date: DateInput) => number; -declare const _default$9: (date: Date, baseDate: Date | undefined, locale: string, options?: Intl.RelativeTimeFormatOptions | undefined) => string; +declare const _default$9: (date: DateInput, baseDate: DateInput | undefined, locale: string, options?: Intl.RelativeTimeFormatOptions | undefined) => string; -declare const _default$8: (date: Date) => number; +declare const _default$8: (date: DateInput) => number; -declare const _default$7: (locale: string) => string[]; +declare const _default$7: (locale: string, intlOptions?: Intl.DateTimeFormatOptions | undefined) => string[]; declare const _default$6: (date1: DateInput, date2: DateInput) => boolean; @@ -94,6 +92,6 @@ declare const _default$2: (date: any) => boolean; declare const _default$1: (dateString: string, locale: string) => Date | null; -declare const _default: (date: Date, value: number, unit: "days" | "months" | "years") => Date; +declare const _default: (date: DateInput, value: number, unit: "days" | "months" | "years") => Date; export { _default$f as add, _default$e as formatDate, _default$d as formatDateTime, _default$m as formatNumber, _default$j as formatNumberByParts, _default$h as formatPhoneNumber, _default$c as formatTime, _default$l as getCurrencyList, _default$k as getCurrencySymbol, _default$b as getFirstDayOfWeek, _default$a as getQuarter, _default$9 as getRelativeTime, _default$p as getState, _default$8 as getWeek, _default$7 as getWeekdays, _default$6 as isAfter, _default$5 as isBefore, _default$4 as isLeapYear, _default$3 as isSameDay, _default$2 as isValidDate, _default$i as isValidPhoneNumber, _default$1 as parseDate, _default$g as parsePhoneNumber, _default$n as resetState, _default$o as setState, _default as subtract }; diff --git a/lib/umd/index.js b/lib/umd/index.js index d8b2f137..95f78847 100644 --- a/lib/umd/index.js +++ b/lib/umd/index.js @@ -1023,6 +1023,128 @@ }; var parsePhoneNumber$1 = withErrorBoundary(parsePhoneNumber); + const stringToDate = (dateString) => { + const supportedDateFormats = [ + // Date formats + { + regex: /^(\d{4})\/(\d{2})\/(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, + { + regex: /^(\d{2})\/(\d{2})\/(\d{4})$/, + yearIndex: 3, + monthIndex: 2, + dayIndex: 1, + }, + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, + // Timestamp formats + { + regex: /^(\d{4})\/(\d{2})\/(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, + { + regex: /^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 3, + monthIndex: 2, + dayIndex: 1, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, + { + regex: /^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, + { + regex: /^(\d{2})-(\d{2})-(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 3, + monthIndex: 2, + dayIndex: 1, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, + { + regex: /^(\d{4})\.(\d{2})\.(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, + { + regex: /^(\d{2})\.(\d{2})\.(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 3, + monthIndex: 2, + dayIndex: 1, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, // DD.MM.YYYY HH:MM:SS + ]; + for (const format of supportedDateFormats) { + const match = dateString.match(format.regex); + if (match) { + const year = match[format.yearIndex]; + const month = match[format.monthIndex]; + const day = match[format.dayIndex]; + const hour = format.hourIndex ? match[format.hourIndex] : '00'; + const minute = format.minuteIndex ? match[format.minuteIndex] : '00'; + const second = format.secondIndex ? match[format.secondIndex] : '00'; + return new Date(`${year}-${month}-${day}T${hour}:${minute}:${second}`); + } + } + throw new Error('Date format not recognized'); + }; + /** * Adds a specified amount of time to a date. * @@ -1032,19 +1154,20 @@ * @returns A new Date object with the time added. */ const add = (date, value, unit) => { - const result = new Date(date); + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); switch (unit) { case 'days': - result.setDate(result.getDate() + value); + date.setDate(date.getDate() + value); break; case 'months': - result.setMonth(result.getMonth() + value); + date.setMonth(date.getMonth() + value); break; case 'years': - result.setFullYear(result.getFullYear() + value); + date.setFullYear(date.getFullYear() + value); break; } - return result; + return date; }; var add$1 = withErrorBoundary(add); @@ -1055,7 +1178,7 @@ * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional). * @returns {string} Formatted date and time string. */ - const formatDateTime = (date, locale, options = {}) => { + const formatDateTime = (date, locale, intlOptions = {}) => { /** retrieve locale from below areas in order of preference * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) * 2. i18nState.locale (uses locale set globally) @@ -1063,10 +1186,12 @@ * */ if (!locale) locale = state.getState().locale || getLocale(); + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); const dateObj = date instanceof Date ? date : new Date(date); let formatter; try { - formatter = new Intl.DateTimeFormat(locale, options); + formatter = new Intl.DateTimeFormat(locale, intlOptions); } catch (err) { if (err instanceof Error) { @@ -1148,9 +1273,10 @@ * Gets the first day of the week for a given locale. * * @param locale The locale to determine the first day of the week for. + * @param intlOptions Optional Intl.DateTimeFormatOptions for customization. * @returns The first day of the week (0-6, where 0 is Sunday). */ - const getFirstDayOfWeek = (locale) => { + const getFirstDayOfWeek = (locale, intlOptions = {}) => { /** retrieve locale from below areas in order of preference * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) * 2. i18nState.locale (uses locale set globally) @@ -1159,10 +1285,17 @@ if (!locale) locale = state.getState().locale || getLocale(); let formatted; + if (!intlOptions.weekday) + intlOptions.weekday = 'long'; try { - const formatter = new Intl.DateTimeFormat(locale, { weekday: 'short' }); - const sampleDate = new Date(2000, 0, 2); // A Sunday - formatted = formatter.format(sampleDate); + const formatter = new Intl.DateTimeFormat(locale, intlOptions); + /** + * This date was chosen because January 2, 2000, is a Sunday. + * In the Gregorian calendar, Sunday is considered the start of the week in some cultures (like in the United States), while in others, it's Monday (like in much of Europe). + * By using a date that is known to be a Sunday, the function can accurately determine what day of the week is considered the start in the specified locale. + */ + const sundayDate = new Date(2000, 0, 2); // A known Sunday + formatted = formatter.format(sundayDate); } catch (err) { if (err instanceof Error) { @@ -1172,7 +1305,13 @@ throw new Error(`An unknown error occurred = ${err}`); } } - return ['su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'].indexOf(formatted.slice(0, 2).toLowerCase()); + // Generate localized weekdays array starting from Sunday + const weekdays = Array.from({ length: 7 }, (_, i) => new Intl.DateTimeFormat(locale, intlOptions).format(new Date(2000, 0, 2 + i))); + const firstDayIndex = weekdays.indexOf(formatted); + if (firstDayIndex === -1) { + throw new Error('Unable to determine the first day of the week'); + } + return weekdays[(firstDayIndex + 1) % 7]; // Adjusting since our reference date is a Sunday }; var getFirstDayOfWeek$1 = withErrorBoundary(getFirstDayOfWeek); @@ -1183,6 +1322,8 @@ * @returns The quarter of the year (1-4). */ const getQuarter = (date) => { + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); return Math.ceil((date.getMonth() + 1) / 3); }; var getQuarter$1 = withErrorBoundary(getQuarter); @@ -1200,6 +1341,12 @@ * @returns The relative time as a string. */ const getRelativeTime = (date, baseDate = new Date(), locale, options) => { + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); + baseDate = + typeof baseDate === 'string' + ? new Date(stringToDate(baseDate)) + : new Date(baseDate); /** retrieve locale from below areas in order of preference * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) * 2. i18nState.locale (uses locale set globally) @@ -1269,6 +1416,8 @@ * @returns The week number of the year. */ const getWeek = (date) => { + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); const firstDayOfYear = new Date(date.getFullYear(), 0, 1); const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000; return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7); @@ -1279,9 +1428,10 @@ * Returns an array of weekdays according to the specified locale. * * @param locale The locale to get weekdays for. + * @param intlOptions Optional Intl.DateTimeFormatOptions for customization. * @returns An array of weekday names. */ - const getWeekdays = (locale) => { + const getWeekdays = (locale, intlOptions = {}) => { try { /** retrieve locale from below areas in order of preference * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) @@ -1290,7 +1440,15 @@ * */ if (!locale) locale = state.getState().locale || getLocale(); - const formatter = new Intl.DateTimeFormat(locale, { weekday: 'long' }); + if (!intlOptions.weekday) + intlOptions.weekday = 'long'; + const formatter = new Intl.DateTimeFormat(locale, intlOptions); + /** The date January 1, 1970, is a well-known reference point in computing known as the Unix epoch. + * It's the date at which time is measured for Unix systems, making it a consistent and reliable choice for date calculations. + * The choice of the date January 4, 1970, as the starting point is significant. + * January 4, 1970, was a Sunday. + * Since weeks typically start on Sunday or Monday in most locales, starting from a known Sunday allows the function to cycle through a complete week, capturing all weekdays in the order they appear for the given locale. + * */ return Array.from({ length: 7 }, (_, i) => formatter.format(new Date(1970, 0, 4 + i))); } catch (err) { @@ -1311,6 +1469,10 @@ * @returns {boolean} True if date1 is after date2. */ const isAfter = (date1, date2) => { + date1 = + typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1); + date2 = + typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2); const dateObj1 = date1 instanceof Date ? date1 : new Date(date1); const dateObj2 = date2 instanceof Date ? date2 : new Date(date2); return dateObj1 > dateObj2; @@ -1324,6 +1486,10 @@ * @returns {boolean} True if date1 is before date2. */ const isBefore = (date1, date2) => { + date1 = + typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1); + date2 = + typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2); const dateObj1 = date1 instanceof Date ? date1 : new Date(date1); const dateObj2 = date2 instanceof Date ? date2 : new Date(date2); return dateObj1 < dateObj2; @@ -1349,6 +1515,10 @@ * @returns True if both dates are on the same day, false otherwise. */ const isSameDay = (date1, date2) => { + date1 = + typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1); + date2 = + typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2); return (date1.getDate() === date2.getDate() && date1.getMonth() === date2.getMonth() && date1.getFullYear() === date2.getFullYear()); @@ -1362,6 +1532,18 @@ * @returns True if the object is a valid Date, false otherwise. */ const isValidDate = (date) => { + try { + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); + } + catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } + else { + throw new Error(`An unknown error occurred = ${err}`); + } + } return date instanceof Date && !isNaN(date.getTime()); }; var isValidDate$1 = withErrorBoundary(isValidDate); @@ -1554,6 +1736,8 @@ * @returns A new Date object with the time subtracted. */ const subtract = (date, value, unit) => { + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); return add$1(date, -value, unit); // Reuse the add function with negative value }; var subtract$1 = withErrorBoundary(subtract); diff --git a/lib/umd/index.js.map b/lib/umd/index.js.map index 210ecff8..4f859ab6 100644 --- a/lib/umd/index.js.map +++ b/lib/umd/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sources":["../../src/common/errorBoundary/index.ts","../../src/modules/.internal/utils/getDefaultState.ts","../../src/modules/.internal/state/index.ts","../../src/modules/core/getState.ts","../../src/modules/core/setState.ts","../../src/modules/core/resetState.ts","../../src/modules/.internal/utils/getLocale.ts","../../src/modules/.internal/utils/getIntlInstanceWithOptions.ts","../../src/modules/currency/formatNumber.ts","../../src/modules/currency/data/currencies.ts","../../src/modules/currency/getCurrencyList.ts","../../src/modules/currency/getCurrencySymbol.ts","../../src/modules/currency/constants.ts","../../src/modules/currency/formatNumberByParts.ts","../../src/modules/phoneNumber/data/phoneRegexMapper.ts","../../src/modules/phoneNumber/data/dialCodeMapper.ts","../../src/modules/phoneNumber/utils.ts","../../src/modules/phoneNumber/isValidPhoneNumber.ts","../../src/modules/phoneNumber/data/phoneFormatterMapper.ts","../../src/modules/phoneNumber/formatPhoneNumber.ts","../../src/modules/phoneNumber/parsePhoneNumber.ts","../../src/modules/dateTime/add.ts","../../src/modules/dateTime/formatDateTime.ts","../../src/modules/dateTime/formatDate.ts","../../src/modules/dateTime/formatTime.ts","../../src/modules/dateTime/getFirstDayOfWeek.ts","../../src/modules/dateTime/getQuarter.ts","../../src/modules/dateTime/getRelativeTime.ts","../../src/modules/dateTime/getWeek.ts","../../src/modules/dateTime/getWeekdays.ts","../../src/modules/dateTime/isAfter.ts","../../src/modules/dateTime/isBefore.ts","../../src/modules/dateTime/isLeapYear.ts","../../src/modules/dateTime/isSameDay.ts","../../src/modules/dateTime/isValidDate.ts","../../src/modules/dateTime/data/localeDateFormats.ts","../../src/modules/dateTime/parseDateWithFormat.ts","../../src/modules/dateTime/parseDate.ts","../../src/modules/dateTime/subtract.ts"],"sourcesContent":["// Custom Error class to extend properties to error object\nexport class I18nifyError extends Error {\n timestamp: Date;\n constructor(message: string | undefined) {\n super(message);\n this.name = 'i18nify Error';\n this.timestamp = new Date();\n // more params like type of error/severity can be added in future for better debugging.\n }\n}\n\n/**\n * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block.\n * It appends additional attributes and serves as a centralized error-handling service.\n * Usage =>\n * const wrappedUtilityFn = withErrorBoundary(utilityFn)\n *\n * @param fn utility that is wrapped in error boundary\n * @returns {Function} returns the function wrapped in try/catch block\n */\nexport const withErrorBoundary = any>(\n fn: T,\n): ((...args: Parameters) => ReturnType) => {\n return function (this: unknown, ...rest: Parameters): ReturnType {\n try {\n return fn.call(this, ...rest) as ReturnType;\n } catch (err) {\n console.warn('[I18N Error]: ', err);\n // Currently, we are throwing the error as it is to consumers.\n // In the future, this can be modified as per our requirement, like an error logging service.\n throw new I18nifyError(err as string | undefined);\n }\n };\n};\n","import type { I18nState } from '../state/types';\n\nexport function getDefaultState(): I18nState {\n return {\n locale: '',\n direction: '',\n country: '',\n };\n}\n","import { I18nState } from './types';\nimport { getDefaultState } from '../utils/getDefaultState';\n\nexport class I18nStateManager {\n private static instance: I18nStateManager | undefined;\n private state: I18nState;\n\n private constructor() {\n this.state = getDefaultState();\n }\n\n public static getInstance(): I18nStateManager {\n if (!I18nStateManager.instance) {\n I18nStateManager.instance = new I18nStateManager();\n }\n\n return I18nStateManager.instance;\n }\n\n public static resetInstance(): void {\n I18nStateManager.instance = undefined;\n }\n\n public getState(): I18nState {\n return { ...this.state };\n }\n\n public setState(newState: Partial): void {\n this.state = { ...this.state, ...newState };\n }\n\n public resetState(): void {\n this.state = getDefaultState();\n }\n}\n\nexport default I18nStateManager.getInstance();\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * function to return active i18n state\n *\n * ===== USAGE =====\n * import { getState } from '@razorpay/i18nify-js';\n *\n * console.log(getState())\n *\n * @returns i18n state\n */\nconst getState = (): I18nState => {\n return state.getState();\n};\n\nexport default withErrorBoundary(getState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * Function to set and override the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { setState } from \"@razorpay/i18nify-js\";\n * setState({locale: 'en-US'})\n *\n * @param newState data to set in i18nState instance\n */\nconst setState = (newState: Partial): void => {\n state.setState(newState);\n};\n\nexport default withErrorBoundary(setState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\n\n/**\n * Function to reset the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { resetState } from \"@razorpay/i18nify-js\";\n * resetState()\n *\n * @param newState data to set in i18nState instance\n */\nconst resetState = (): void => {\n state.resetState();\n};\n\nexport default withErrorBoundary(resetState);\n","export const getLocale = (): string => {\n // Check if running in a non-browser environment (e.g., Node.js or older browsers).\n if (typeof navigator === 'undefined') {\n return 'en-IN';\n }\n\n // Check if the browser supports the Intl object and user language preferences.\n if (\n window.Intl &&\n typeof window.Intl === 'object' &&\n (window.navigator.languages || window.navigator.language)\n ) {\n const userLocales = window.navigator.languages || [\n window.navigator.language,\n ];\n return userLocales[0];\n }\n\n // Fallback to a supported locale or the default locale.\n return 'en-IN';\n};\n","import { CURRENCIES } from '../../currency/data/currencies';\nimport state from '../state';\nimport { getLocale } from './getLocale';\n\nexport const getIntlInstanceWithOptions = (\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n) => {\n /** retrieve locale from below areas in order of preference\n * 1. options.locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n let locale = options?.locale || state.getState().locale;\n\n // If a specific locale is provided, use it; otherwise, use the browser's locale\n if (!locale) {\n locale = getLocale();\n }\n\n const intlOptions = options?.intlOptions ? { ...options.intlOptions } : {};\n\n if (options?.currency || intlOptions.currency) {\n intlOptions.style = 'currency';\n intlOptions.currency = (options.currency || intlOptions.currency) as string;\n }\n\n if (!locale) throw new Error('Pass valid locale !');\n\n return new Intl.NumberFormat(locale || undefined, intlOptions);\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\n\n// this function formats number based on different arguments passed\nconst formatNumber = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): string => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n let formattedAmount = '';\n\n try {\n formattedAmount = getIntlInstanceWithOptions(options).format(\n Number(amount),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedAmount;\n};\n\nexport default withErrorBoundary(formatNumber);\n","export const CURRENCIES: { [key: string]: { symbol: string; name: string } } = {\n AED: { symbol: 'د.إ', name: 'United Arab Emirates Dirham' },\n ALL: { symbol: 'Lek', name: 'Albanian Lek' },\n AMD: { symbol: '֏', name: 'Armenian Dram' },\n ARS: { symbol: 'ARS', name: 'Argentine Peso' },\n AUD: { symbol: 'A$', name: 'Australian Dollar' },\n AWG: { symbol: 'Afl.', name: 'Aruban Florin' },\n BBD: { symbol: '$', name: 'Barbadian Dollar' },\n BDT: { symbol: '৳', name: 'Bangladeshi Taka' },\n BMD: { symbol: '$', name: 'Bermudian Dollar' },\n BND: { symbol: 'BND', name: 'Brunei Dollar' },\n BOB: { symbol: 'Bs', name: 'Bolivian Boliviano' },\n BSD: { symbol: 'B$', name: 'Bahamian Dollar' },\n BWP: { symbol: 'P', name: 'Botswanan Pula' },\n BZD: { symbol: 'BZ$', name: 'Belize Dollar' },\n CAD: { symbol: 'C$', name: 'Canadian Dollar' },\n CHF: { symbol: 'CHf', name: 'Swiss Franc' },\n CNY: { symbol: '¥', name: 'Chinese Yuan' },\n COP: { symbol: 'COL$', name: 'Colombian Peso' },\n CRC: { symbol: '₡', name: 'Costa Rican Colón' },\n CUP: { symbol: '$MN', name: 'Cuban Peso' },\n CZK: { symbol: 'Kč', name: 'Czech Koruna' },\n DKK: { symbol: 'DKK', name: 'Danish Krone' },\n DOP: { symbol: 'RD$', name: 'Dominican Peso' },\n DZD: { symbol: 'د.ج', name: 'Algerian Dinar' },\n EGP: { symbol: 'E£', name: 'Egyptian Pound' },\n ETB: { symbol: 'ብር', name: 'Ethiopian Birr' },\n EUR: { symbol: '€', name: 'Euro' },\n FJD: { symbol: 'FJ$', name: 'Fijian Dollar' },\n GBP: { symbol: '£', name: 'British Pound' },\n GHS: { symbol: 'GH₵', name: 'Ghanaian Cedi' },\n GIP: { symbol: 'GIP', name: 'Gibraltar Pound' },\n GMD: { symbol: 'D', name: 'Gambian Dalasi' },\n GTQ: { symbol: 'Q', name: 'Guatemalan Quetzal' },\n GYD: { symbol: 'G$', name: 'Guyanese Dollar' },\n HKD: { symbol: 'HK$', name: 'Hong Kong Dollar' },\n HNL: { symbol: 'HNL', name: 'Honduran Lempira' },\n HRK: { symbol: 'kn', name: 'Croatian Kuna' },\n HTG: { symbol: 'G', name: 'Haitian Gourde' },\n HUF: { symbol: 'Ft', name: 'Hungarian Forint' },\n IDR: { symbol: 'Rp', name: 'Indonesian Rupiah' },\n ILS: { symbol: '₪', name: 'Israeli New Shekel' },\n INR: { symbol: '₹', name: 'Indian Rupee' },\n JMD: { symbol: 'J$', name: 'Jamaican Dollar' },\n KES: { symbol: 'Ksh', name: 'Kenyan Shilling' },\n KGS: { symbol: 'Лв', name: 'Kyrgystani Som' },\n KHR: { symbol: '៛', name: 'Cambodian Riel' },\n KYD: { symbol: 'CI$', name: 'Cayman Islands Dollar' },\n KZT: { symbol: '₸', name: 'Kazakhstani Tenge' },\n LAK: { symbol: '₭', name: 'Laotian Kip' },\n LKR: { symbol: 'රු', name: 'Sri Lankan Rupee' },\n LRD: { symbol: 'L$', name: 'Liberian Dollar' },\n LSL: { symbol: 'LSL', name: 'Lesotho Loti' },\n MAD: { symbol: 'د.م.', name: 'Moroccan Dirham' },\n MDL: { symbol: 'MDL', name: 'Moldovan Leu' },\n MKD: { symbol: 'ден', name: 'Macedonian Denar' },\n MMK: { symbol: 'MMK', name: 'Myanmar Kyat' },\n MNT: { symbol: '₮', name: 'Mongolian Tugrik' },\n MOP: { symbol: 'MOP$', name: 'Macanese Pataca' },\n MUR: { symbol: '₨', name: 'Mauritian Rupee' },\n MVR: { symbol: 'Rf', name: 'Maldivian Rufiyaa' },\n MWK: { symbol: 'MK', name: 'Malawian Kwacha' },\n MXN: { symbol: 'Mex$', name: 'Mexican Peso' },\n MYR: { symbol: 'RM', name: 'Malaysian Ringgit' },\n NAD: { symbol: 'N$', name: 'Namibian Dollar' },\n NGN: { symbol: '₦', name: 'Nigerian Naira' },\n NIO: { symbol: 'NIO', name: 'Nicaraguan Córdoba' },\n NOK: { symbol: 'NOK', name: 'Norwegian Krone' },\n NPR: { symbol: 'रू', name: 'Nepalese Rupee' },\n NZD: { symbol: 'NZ$', name: 'New Zealand Dollar' },\n PEN: { symbol: 'S/', name: 'Peruvian Nuevo Sol' },\n PGK: { symbol: 'PGK', name: 'Papua New Guinean Kina' },\n PHP: { symbol: '₱', name: 'Philippine Peso' },\n PKR: { symbol: '₨', name: 'Pakistani Rupee' },\n QAR: { symbol: 'QR', name: 'Qatari Riyal' },\n RUB: { symbol: '₽', name: 'Russian Ruble' },\n SAR: { symbol: 'SR', name: 'Saudi Riyal' },\n SCR: { symbol: 'SRe', name: 'Seychellois Rupee' },\n SEK: { symbol: 'SEK', name: 'Swedish Krona' },\n SGD: { symbol: 'S$', name: 'Singapore Dollar' },\n SLL: { symbol: 'Le', name: 'Sierra Leonean Leone' },\n SOS: { symbol: 'Sh.so.', name: 'Somali Shilling' },\n SSP: { symbol: 'SS£', name: 'South Sudanese Pound' },\n SVC: { symbol: '₡', name: 'Salvadoran Colón' },\n SZL: { symbol: 'E', name: 'Swazi Lilangeni' },\n THB: { symbol: '฿', name: 'Thai Baht' },\n TTD: { symbol: 'TT$', name: 'Trinidad and Tobago Dollar' },\n TZS: { symbol: 'Sh', name: 'Tanzanian Shilling' },\n USD: { symbol: '$', name: 'United States Dollar' },\n UYU: { symbol: '$U', name: 'Uruguayan Peso' },\n UZS: { symbol: \"so'm\", name: 'Uzbekistani Som' },\n YER: { symbol: '﷼', name: 'Yemeni Rial' },\n ZAR: { symbol: 'R', name: 'South African Rand' },\n KWD: { symbol: 'د.ك', name: 'Kuwaiti Dinar' },\n BHD: { symbol: 'د.ب.', name: 'Bahraini Dinar' },\n OMR: { symbol: 'ر.ع.', name: 'Omani Rial' },\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencyList = () => {\n return CURRENCIES;\n};\n\nexport default withErrorBoundary(getCurrencyList);\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencySymbol = (currencyCode: keyof typeof CURRENCIES): string => {\n if (currencyCode in CURRENCIES) return CURRENCIES[currencyCode]?.symbol;\n else throw new Error('Invalid currencyCode!');\n};\n\nexport default withErrorBoundary(getCurrencySymbol);\n","export const ALLOWED_FORMAT_PARTS_KEYS = [\n 'nan',\n 'infinity',\n 'percent',\n 'integer',\n 'group',\n 'decimal',\n 'fraction',\n 'plusSign',\n 'minusSign',\n 'percentSign',\n 'currency',\n 'code',\n 'symbol',\n 'name',\n 'compact',\n 'exponentInteger',\n 'exponentMinusSign',\n 'exponentSeparator',\n 'unit',\n] as const;\n","import { CURRENCIES } from './data/currencies';\nimport { ByParts, FormattedPartsObject } from './types';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\nimport { ALLOWED_FORMAT_PARTS_KEYS } from './constants';\n\nconst formatNumberByParts = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): ByParts => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n try {\n const formattedAmount = getIntlInstanceWithOptions(options).formatToParts(\n Number(amount),\n );\n\n const parts = formattedAmount;\n\n const formattedObj: FormattedPartsObject = {};\n\n parts.forEach((p) => {\n if (p.type === 'group') {\n formattedObj.integer = (formattedObj.integer || '') + p.value;\n } else if (\n ALLOWED_FORMAT_PARTS_KEYS.findIndex((item) => item === p.type) != -1\n ) {\n // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal' is skipped\n formattedObj[p.type] = (formattedObj[p.type] || '') + p.value;\n }\n });\n\n return {\n ...formattedObj,\n isPrefixSymbol: parts[0].type === 'currency',\n rawParts: parts,\n };\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(\n formatNumberByParts,\n);\n","export const PHONE_REGEX_MAPPER: { [key: string]: RegExp } = {\n IN: /^(?:(?:\\+|0{0,2})91\\s*[-]?\\s*|[0]?)?[6789]\\d{9}$/,\n MY: /^(\\+?6?0)?(\\d{1,3})[-. ]?(\\d{7,8})$/,\n AE: /^(?:\\+?971|0)?(?:2|3|4|6|7|9)\\d{8}$/,\n AL: /^(?:\\+?355)?(?:[4-9]\\d{7}|6\\d{8})$/,\n AM: /^(?:\\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/,\n AR: /^(?:(?:\\+|0{0,2})54)?(?:11|[2368]\\d)(?:(?=\\d{0,2}15)\\d{2})??\\d{8}$/,\n AU: /^(?:\\+?61|0)4\\d{8}$/,\n AW: /^(?:(?:\\+297)?(?!0)\\d{7})$/,\n BB: /^(?:(?:\\+1)?246)?(?:\\d{3})?\\d{7}$/,\n BD: /^(?:\\+?880|0)1[13456789]\\d{8}$/,\n BM: /^(?:(?:\\+1)?441)?(?:\\d{2})?\\d{7}$/,\n BN: /^(?:\\+?673)?(?:\\d{3})?\\d{4}$/,\n BO: /^(?:(?:\\+|0{0,2})591)?(?:(?:2|3|7|6)\\d{7})$/,\n BS: /^(?:(?:\\+1)?242)?(?:\\d{3})?\\d{7}$/,\n BW: /^(?:(?:\\+267)?\\s?)?[74]\\d{7}$/,\n BZ: /^(?:(?:\\+501)?\\s?)?[622]\\d{4}$/,\n CH: /^(?:(?:\\+41|0)(?:\\s*\\(?0\\)?\\s*))?(?:\\d{2}\\s*)?\\d{3}\\s*\\d{2}\\s*\\d{2}$/,\n CN: /^(?:(?:\\+|00)86)?1\\d{10}$/,\n CO: /^(?:(?:\\+57|0057)?)?[1-8]{1}\\d{6,7}$/,\n OM: /^(?:\\+?968)?(?:95|96|97|98)\\d{6}$/,\n CR: /^(?:(?:\\+506)?\\s*|0)?[1-9]\\d{7}$/,\n CU: /^(?:\\+?53)?(?:[5-8]\\d{7})$/,\n CZ: /^(?:\\+?420)?(?:\\d{9})$/,\n DK: /^(?:\\+?45)?(?:\\d{8})$/,\n DO: /^(?:(?:\\+1)?809|1-8(?:00|88|89))(?:\\d{7})$/,\n DZ: /^(?:\\+?213|0)([567]\\d{8})$/,\n EG: /^(?:(?:\\+20|20)?(\\d{10}))$/,\n ET: /^(?:\\+?251)?[1-59]\\d{8}$/,\n EU: /^(?:(?:\\+?3)?8)?\\s*(?:\\d{3}\\s*){3}\\d{2}$/,\n FJ: /^(?:(?:\\+?679)?\\s?\\d{3}\\s?\\d{4})?$/,\n GB: /^(?:(?:\\+44\\s?|0)7\\d{3}(\\s?\\d{4,})?)$/,\n GH: /^(?:(?:\\+233)|0)?(?:\\d{9})$/,\n GI: /^(?:\\+350)?\\d{5}$/,\n GM: /^(?:\\+220)?\\d{5,7}$/,\n GT: /^(?:\\+502)?[2468]\\d{7,8}$/,\n GY: /^(?:(?:\\+592)?(?:(?:\\s)?[2-9])(?:(?:\\s)?\\d))?(?:(?:\\s)?\\d{4})$/,\n HK: /^(?:\\+852\\s?)?[456789]\\d{3}\\s?\\d{4}$/,\n HN: /^(?:\\+504)?[89]\\d{7}$/,\n HR: /^(?:\\+?385)?\\d{8,9}$/,\n HT: /^(?:\\+?509)?\\d{8}$/,\n HU: /^(?:(?:\\+36))(\\s?\\d{2}\\s?\\d{3}\\s?\\d{4})$/,\n ID: /^(?:\\+?62|0[1-9])[\\s-]?\\d{2,4}[\\s-]?\\d{3,4}[\\s-]?\\d{3,4}$/,\n IL: /^(?:(?:\\+972|0)(?:-)?)[23489]\\d{7}$/,\n JM: /^(?:(?:\\+1876))\\d{7,10}$/,\n KE: /^(?:(?:\\+254)|(?:0))(?:\\d{6,7})$/,\n KG: /^(?:\\+996)?\\s?\\d{9}$/,\n KH: /^(?:(?:\\+855)|(?:0))(?:\\s?[1-9]\\d{7,8})$/,\n KY: /^(?:\\+?1\\s?(345))\\d{6}$/,\n KZ: /^(?:\\+?7|8)?7\\d{9}$/,\n LA: /^(?:(?:\\+?856)|0)(20\\d{7,9})$/,\n LK: /^(?:(?:\\+94)|0)(?:\\d{9})$/,\n LR: /^(?:\\+231)[ -\\d]{4}[ -\\d]{4}$/,\n LS: /^(?:(?:\\+?266)|0)?[56]\\d{7}$/,\n MA: /^(?:(?:\\+?212(\\s*[-|\\s*]?\\d{1,9})?)|(?:0))(?:\\d{9})$/,\n MD: /^(?:(?:\\+373)|(?:0))(?:\\d{7,8})$/,\n MK: /^(?:\\+389|0)(?:(?:2[0-4]|[3-9])\\s?)?\\d{6}$/,\n MM: /^(?:(?:\\+?95)|0)?[1-9]\\d{9}$/,\n MN: /^(?:\\+976|0)\\d{8}$/,\n MO: /^(?:(?:\\+?853)|[0-9])?\\d{8}$/,\n MU: /^(?:\\+230|0)?\\d{8}$/,\n MV: /^(?:(?:\\+?960)|0)?\\d{7}$/,\n MW: /^(?:\\+265)[1-9]\\d{6}$/,\n MX: /^(?:(?:\\+?52)?\\s?(?:1|01)?\\s?)?(?:\\d{3}\\s?\\d{3}\\s?\\d{4})$/,\n NA: /^(?:(?:\\+264)|0)?\\d{8}$/,\n NG: /^(?:(?:\\+234)|(?:0))(?:\\d{7,8})$/,\n NI: /^(?:(?:\\+505))?(?:\\d{8})$/,\n NO: /^(?:(?:\\+?47)|\\d{2}|\\d{3})\\s?\\d{2}\\s?\\d{3}$/,\n NP: /^(?:(?:\\+977))?(\\d{9,10})$/,\n NZ: /^(?:\\+?64|0)(\\d{2,5} \\d{4,8}|\\d{3,4} \\d{4})$/,\n PE: /^(?:(?:\\+51)|0)?(?:9\\d{8})$/,\n PG: /^(?:\\+?675)?(?:[7-9]\\d{7})$/,\n PH: /^(?:(?:\\+?63)|0)(?:\\d{10})$/,\n PK: /^(?:(?:\\+92)|0)?[345]\\d{9}$/,\n QA: /^(?:\\+?974)?-?33\\d{5}$/,\n RU: /^(?:\\+?7|8)?[ -]?\\(?9\\d{2}\\)?[ -]?\\d{3}[ -]?\\d{2}[ -]?\\d{2}$/,\n SA: /^(?:\\+?966)?\\s?1?[\\s-]?(?:[45]\\d{2}|5\\d{3})[\\s-]?\\d{4}$/,\n SC: /^(?:(?:\\+248)|\\d{4})\\d{5}$/,\n SE: /^(?:\\+?46|0)\\s?[1-57-9](?:[0-9]\\s?){8}$/,\n SG: /^(?:(?:\\+65)|(?:\\(\\+65\\))|(?:65))\\d{4}\\d{4}$/,\n SL: /^(?:(?:\\+232)|(?:0))?\\d{9}$/,\n SO: /^(?:\\+252|0)?[567]\\d{7}$/,\n SS: /^(?:\\+211|0)?[1-9]\\d{7,9}$/,\n SV: /^(?:(?:\\+?503)|(?:0))(?:\\d{8})$/,\n SZ: /^(?:\\+?268)?\\d{7,8}$/,\n TH: /^(?:(?:\\+66)|0)\\d{9}$/,\n TT: /^(?:(?:\\+?1-868)|\\(?868\\)?)(\\d{7})$/,\n TZ: /^(?:(?:\\+?255)|0)?[67]\\d{8}$/,\n US: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n CA: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n UY: /^(?:(?:\\+598|0)\\s?(9\\d{3}|2\\d{2}|[4-9]\\d{6}))$/,\n UZ: /^(?:\\+?998)?\\s?[3456789]\\d{8}$/,\n YE: /^(?:\\+?967)?(?:\\d{7,8})$/,\n ZA: /^(?:(?:\\+27)|0)(\\d{9})$/,\n KW: /^(?:\\+?965)[569]\\d{7}$/,\n BH: /^(?:\\+?973)?[356]\\d{7}$/,\n TL: /^(?:(?:\\+670)\\s?)?[0-9]{3}\\s?[0-9]{3,4}$/,\n VC: /^(?:(?:\\+1)?784)?(?:\\d{3})?\\d{7}$/,\n VE: /^(?:(?:\\+58)|0)?4\\d{9}$/,\n VN: /^(?:(?:\\+84)|0)?[1-9]\\d{8}$/,\n ZM: /^(?:(?:\\+260)|0)?[123456789]\\d{8,9}$/,\n ZW: /^(?:(?:\\+263)|0)?(?:\\d{9,10})$/,\n LT: /^(?:(?:\\+370)|8)\\d{8}$/,\n LU: /^(?:(?:\\+352)?(6|2(6|7|8|9))\\d{6})$/,\n LV: /^(?:(?:\\+371)?2\\d{7})$/,\n ME: /^(?:(?:\\+382)?[67]\\d{7,20})$/,\n MG: /^(?:(?:\\+261)?3[234568]\\d{7})$/,\n MZ: /^(?:(?:\\+258)|(?:258))?8[234567]\\d{7,8}$/,\n NL: /^(?:(?:\\+31)|0(6(?:\\d{8})|[1-9](?:(?:\\d{8})|(?:\\s\\d{3}\\s\\d{4}))|(?:\\d{8})))$/,\n PA: /^(?:(?:\\+507)\\s?)?[46]\\d{6,7}$/,\n PL: /^(?:(?:\\+48)?(?:\\s?\\d{3}\\s?\\d{3}\\s?\\d{3}|(?:\\d{2}\\s?){4}\\d{2}|\\d{3}-\\d{3}-\\d{3}))$/,\n PR: /^(?:(?:\\+1)?787|939)\\d{7}$/,\n PS: /^(?:(?:\\+970))(5[2349])\\d{7}$/,\n PT: /^(?:(?:\\+351)?9(1\\d|2[1-9]|6[12345789]|7[12345789])\\d{7})$/,\n PY: /^(?:(?:\\+595|0)9[9876]\\d{7})$/,\n RO: /^(?:(?:\\+40|0))(?:7[2-8]\\d{7}|21\\d{8})$/,\n RS: /^(?:(?:\\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/,\n RW: /^(?:(?:\\+250)|(0))\\d{9}$/,\n SI: /^(?:(?:\\+386)|0)?[1-59]\\d{7,8}$/,\n SK: /^(?:(?:\\+421))?(0|9[0-8])\\d{8}$/,\n SM: /^(?:(?:\\+378)|(0549|6\\d{4}))\\d{5}$/,\n SN: /^(?:(?:\\+221)|0)?[3679]\\d{7}$/,\n SR: /^(?:(?:\\+597))\\d{7}$/,\n TG: /^(?:(?:\\+228))\\d{8}$/,\n TJ: /^(?:(?:\\+992))(37|55|77)\\d{7}$/,\n TN: /^(?:(?:\\+216)|22|9[1-9])\\d{7}$/,\n TR: /^(?:(?:\\+90)|(0))\\s?5\\d{9}$/,\n TW: /^(?:(?:\\+886)|0)?9\\d{8}$/,\n UA: /^(?:(?:\\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\\d{7}$/,\n UG: /^(?:(?:\\+256)|0)?[39]\\d{8}$/,\n};\n","/* Source: Google LibPhoneNumber Metadata: https://github.com/google/libphonenumber/blob/master/javascript/i18n/phonenumbers/metadata.js */\n\nexport const DIAL_CODE_MAPPER: { [key: number]: string[] } = {\n 1: [\n 'US',\n 'AG',\n 'AI',\n 'AS',\n 'BB',\n 'BM',\n 'BS',\n 'CA',\n 'DM',\n 'DO',\n 'GD',\n 'GU',\n 'JM',\n 'KN',\n 'KY',\n 'LC',\n 'MP',\n 'MS',\n 'PR',\n 'SX',\n 'TC',\n 'TT',\n 'VC',\n 'VG',\n 'VI',\n ],\n 7: ['RU', 'KZ'],\n 20: ['EG'],\n 27: ['ZA'],\n 30: ['GR'],\n 31: ['NL'],\n 32: ['BE'],\n 33: ['FR'],\n 34: ['ES'],\n 36: ['HU'],\n 39: ['IT', 'VA'],\n 40: ['RO'],\n 41: ['CH'],\n 43: ['AT'],\n 44: ['GB', 'GG', 'IM', 'JE'],\n 45: ['DK'],\n 46: ['SE'],\n 47: ['NO', 'SJ'],\n 48: ['PL'],\n 49: ['DE'],\n 51: ['PE'],\n 52: ['MX'],\n 53: ['CU'],\n 54: ['AR'],\n 55: ['BR'],\n 56: ['CL'],\n 57: ['CO'],\n 58: ['VE'],\n 60: ['MY'],\n 61: ['AU', 'CC', 'CX'],\n 62: ['ID'],\n 63: ['PH'],\n 64: ['NZ'],\n 65: ['SG'],\n 66: ['TH'],\n 81: ['JP'],\n 82: ['KR'],\n 84: ['VN'],\n 86: ['CN'],\n 90: ['TR'],\n 91: ['IN'],\n 92: ['PK'],\n 93: ['AF'],\n 94: ['LK'],\n 95: ['MM'],\n 98: ['IR'],\n 211: ['SS'],\n 212: ['MA', 'EH'],\n 213: ['DZ'],\n 216: ['TN'],\n 218: ['LY'],\n 220: ['GM'],\n 221: ['SN'],\n 222: ['MR'],\n 223: ['ML'],\n 224: ['GN'],\n 225: ['CI'],\n 226: ['BF'],\n 227: ['NE'],\n 228: ['TG'],\n 229: ['BJ'],\n 230: ['MU'],\n 231: ['LR'],\n 232: ['SL'],\n 233: ['GH'],\n 234: ['NG'],\n 235: ['TD'],\n 236: ['CF'],\n 237: ['CM'],\n 238: ['CV'],\n 239: ['ST'],\n 240: ['GQ'],\n 241: ['GA'],\n 242: ['CG'],\n 243: ['CD'],\n 244: ['AO'],\n 245: ['GW'],\n 246: ['IO'],\n 247: ['AC'],\n 248: ['SC'],\n 249: ['SD'],\n 250: ['RW'],\n 251: ['ET'],\n 252: ['SO'],\n 253: ['DJ'],\n 254: ['KE'],\n 255: ['TZ'],\n 256: ['UG'],\n 257: ['BI'],\n 258: ['MZ'],\n 260: ['ZM'],\n 261: ['MG'],\n 262: ['RE', 'YT'],\n 263: ['ZW'],\n 264: ['NA'],\n 265: ['MW'],\n 266: ['LS'],\n 267: ['BW'],\n 268: ['SZ'],\n 269: ['KM'],\n 290: ['SH', 'TA'],\n 291: ['ER'],\n 297: ['AW'],\n 298: ['FO'],\n 299: ['GL'],\n 350: ['GI'],\n 351: ['PT'],\n 352: ['LU'],\n 353: ['IE'],\n 354: ['IS'],\n 355: ['AL'],\n 356: ['MT'],\n 357: ['CY'],\n 358: ['FI', 'AX'],\n 359: ['BG'],\n 370: ['LT'],\n 371: ['LV'],\n 372: ['EE'],\n 373: ['MD'],\n 374: ['AM'],\n 375: ['BY'],\n 376: ['AD'],\n 377: ['MC'],\n 378: ['SM'],\n 380: ['UA'],\n 381: ['RS'],\n 382: ['ME'],\n 383: ['XK'],\n 385: ['HR'],\n 386: ['SI'],\n 387: ['BA'],\n 389: ['MK'],\n 420: ['CZ'],\n 421: ['SK'],\n 423: ['LI'],\n 500: ['FK'],\n 501: ['BZ'],\n 502: ['GT'],\n 503: ['SV'],\n 504: ['HN'],\n 505: ['NI'],\n 506: ['CR'],\n 507: ['PA'],\n 508: ['PM'],\n 509: ['HT'],\n 590: ['GP', 'BL', 'MF'],\n 591: ['BO'],\n 592: ['GY'],\n 593: ['EC'],\n 594: ['GF'],\n 595: ['PY'],\n 596: ['MQ'],\n 597: ['SR'],\n 598: ['UY'],\n 599: ['CW', 'BQ'],\n 670: ['TL'],\n 672: ['NF'],\n 673: ['BN'],\n 674: ['NR'],\n 675: ['PG'],\n 676: ['TO'],\n 677: ['SB'],\n 678: ['VU'],\n 679: ['FJ'],\n 680: ['PW'],\n 681: ['WF'],\n 682: ['CK'],\n 683: ['NU'],\n 685: ['WS'],\n 686: ['KI'],\n 687: ['NC'],\n 688: ['TV'],\n 689: ['PF'],\n 690: ['TK'],\n 691: ['FM'],\n 692: ['MH'],\n 800: ['001'],\n 808: ['001'],\n 850: ['KP'],\n 852: ['HK'],\n 853: ['MO'],\n 855: ['KH'],\n 856: ['LA'],\n 870: ['001'],\n 878: ['001'],\n 880: ['BD'],\n 881: ['001'],\n 882: ['001'],\n 883: ['001'],\n 886: ['TW'],\n 888: ['001'],\n 960: ['MV'],\n 961: ['LB'],\n 962: ['JO'],\n 963: ['SY'],\n 964: ['IQ'],\n 965: ['KW'],\n 966: ['SA'],\n 967: ['YE'],\n 968: ['OM'],\n 970: ['PS'],\n 971: ['AE'],\n 972: ['IL'],\n 973: ['BH'],\n 974: ['QA'],\n 975: ['BT'],\n 976: ['MN'],\n 977: ['NP'],\n 979: ['001'],\n 992: ['TJ'],\n 993: ['TM'],\n 994: ['AZ'],\n 995: ['GE'],\n 996: ['KG'],\n 998: ['UZ'],\n};\n","import { DIAL_CODE_MAPPER } from './data/dialCodeMapper';\nimport { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\n\n/**\n * Determines the country code based on the provided phone number.\n * This function employs a multi-step approach to identify the country code:\n * - If the phone number starts with '+', it extracts the numeric characters\n * and matches the leading digits with known dial codes mapped to countries.\n * - For matched dial codes, it further filters based on country-specific regex patterns\n * to validate the phone number format for those countries.\n * - If the phone number doesn't start with '+', it directly matches the number\n * against regular expressions associated with various countries to identify the code.\n *\n * @param phoneNumber The input phone number (string or number).\n * @returns The detected country code or an empty string if not found.\n */\nexport const detectCountryCodeFromDialCode = (\n phoneNumber: string | number,\n): string => {\n // If the phone number starts with '+', extract numeric characters\n if (phoneNumber.toString().charAt(0) === '+') {\n const cleanedPhoneNumberWithoutPlusPrefix = phoneNumber\n .toString()\n .replace(/\\D/g, '');\n\n const matchingCountries: string[] = [];\n\n // Iterate through dial codes and check for matches with cleaned phone number\n for (const code in DIAL_CODE_MAPPER) {\n if (cleanedPhoneNumberWithoutPlusPrefix.startsWith(code)) {\n matchingCountries.push(...DIAL_CODE_MAPPER[code]);\n }\n }\n\n // Filter matching countries based on phone number validation regex\n const matchedCountryCode = matchingCountries.find((countryCode: string) => {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex && regex.test(phoneNumber.toString())) return countryCode;\n return undefined;\n });\n\n // Return the first matched country code, if any\n return matchedCountryCode || '';\n } else {\n // If phone number doesn't start with '+', directly match against country regexes\n for (const countryCode in PHONE_REGEX_MAPPER) {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex.test(phoneNumber.toString())) {\n return countryCode;\n }\n }\n }\n\n // Return empty string if no country code is detected\n return '';\n};\n\nexport const cleanPhoneNumber = (phoneNumber: string) => {\n // Regular expression to match all characters except numbers and + sign at the start\n const regex = /[^0-9+]|(?!A)\\+/g;\n // Replace matched characters with an empty string\n const cleanedPhoneNumber = phoneNumber.replace(regex, '');\n return phoneNumber[0] === '+' ? `+${cleanedPhoneNumber}` : cleanedPhoneNumber;\n};\n","import { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Validates whether a given phone number is valid based on the provided country code or auto-detects the country code and checks if the number matches the defined regex pattern for that country.\nconst isValidPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_REGEX_MAPPER,\n): boolean => {\n // Clean the provided phoneNumber by removing non-numeric characters\n const cleanedPhoneNumber = cleanPhoneNumber(phoneNumber.toString());\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_REGEX_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(cleanedPhoneNumber);\n\n // Return false if phoneNumber is empty\n if (!phoneNumber) return false;\n\n // Check if the countryCode exists in the PHONE_REGEX_MAPPER\n if (countryCode in PHONE_REGEX_MAPPER) {\n // Fetch the regex pattern for the countryCode\n const regex = PHONE_REGEX_MAPPER[countryCode];\n // Test if the cleanedPhoneNumber matches the regex pattern\n return regex.test(cleanedPhoneNumber as string);\n }\n\n // Return false if the countryCode is not supported\n return false;\n};\n\nexport default withErrorBoundary(isValidPhoneNumber);\n","export const PHONE_FORMATTER_MAPPER: { [key: string]: string } = {\n IN: 'xxxx xxxxxx',\n MY: 'xx xxxxx xx',\n AE: 'xx xxx xxxx',\n AL: 'xxx xx xxxx',\n AM: 'xx xx xx xx',\n AR: 'xxxx-xxxx',\n AU: 'xxx xxx xxx',\n AW: 'xxx-xxxx',\n BB: 'xxx-xxxx',\n BD: 'xxxx-xxxxxx',\n BM: 'xxx-xxxx',\n BN: 'xxxx-xxxx',\n BO: 'xxxx-xxxx',\n BS: 'xxx-xxxx',\n BW: 'xx xxxx xxxx',\n BZ: 'xxx-xxxx',\n CA: 'xxx-xxx-xxxx',\n CH: 'xxx xxx xxx',\n CN: 'xxxx-xxxxxxx',\n CO: 'xxxx-xxxxxxx',\n CR: 'xxxx-xxxx',\n CU: 'xxxx-xxxx',\n CZ: 'xxx xxx xxx',\n DK: 'xx xx xx xx',\n DO: 'xxx-xxxxxxx',\n DZ: 'xxxx-xxxx-xxx',\n EG: 'xx xxx xxxx',\n ET: 'xx xxx xxxx',\n EU: 'xxx xx xx xx',\n FJ: 'xxxx xxxx',\n GB: 'xxxx xxx xxx',\n GH: 'xxx xxx xxxx',\n GI: 'xxxx xxxx',\n GM: 'xxxx-xxxx',\n GT: 'xxxx-xxxx',\n GY: 'xxx-xxxx',\n HK: 'xxxx xxxx',\n HN: 'xxxx-xxxx',\n HR: 'xxx xxx xxxx',\n HT: 'xxx-xxxx',\n HU: 'xxx xxx xxxx',\n ID: 'xxxx-xxxx-xxxx',\n IL: 'xxxx-xxx-xxx',\n JM: 'xxx-xxxx',\n KE: 'xxx xxxxxx',\n KG: 'xxx-xx-xx-xx',\n KH: 'xxx-xxx-xxx',\n KY: 'xxx-xxxx',\n KZ: 'xxx-xxx-xx-xx',\n LA: 'xxx xx xxxx',\n LK: 'xx xxx xxxx',\n LR: 'xxx-xxx-xxxx',\n LS: 'xxx xx xxxx',\n LT: 'xxx xxxxx',\n LU: 'xxx xx xxx',\n LV: 'xxxx xxxx',\n MA: 'xxxx-xxxxxx',\n MD: 'xx xxxxxx',\n ME: 'xx xxxxxx',\n MG: 'xx xx xx xx xx',\n MK: 'xx xx xx xx',\n MM: 'xx xxxxxx',\n MN: 'xxx-xx-xxxx',\n MO: 'xxxx xxxx',\n MU: 'xx xxxx xxxx',\n MV: 'xxxxxx',\n MW: 'xx xxxx xxxx',\n MX: 'xxx-xxx-xxxx',\n MZ: 'xx xxxxxxx',\n NA: 'xx xxxx xxxx',\n NG: 'xxx xxx xxxx',\n NI: 'xxxx-xxxx',\n NL: 'xxx-xxxxxxx',\n NO: 'xxxx xxxx',\n NP: 'xxxx-xxxxxxx',\n NZ: 'xxx-xxxxxxx',\n OM: 'xxxx-xxxx',\n PA: 'xxx-xxxx',\n PE: 'xxx-xxx-xxx',\n PG: 'xxx-xxxxxx',\n PH: 'xxx-xxxx',\n PK: 'xxx-xxxxxxx',\n PL: 'xxx xxx xxx',\n PR: 'xxx-xxx-xxxx',\n PS: 'xxxx-xxxxxxx',\n PT: 'xxx xxx xxx',\n PY: 'xxx-xxxxxx',\n QA: 'xxxx xxxx',\n RO: 'xxx xxx xxxx',\n RS: 'xxx xxxxx',\n RU: 'xxx xxx-xx-xx',\n RW: 'xxx xxxxxx',\n SA: 'xxx-xxxxxxx',\n SC: 'xx xxxxx',\n SE: 'xxx-xxx xx xx',\n SG: 'xxxx xxxx',\n SI: 'xx xxxxxx',\n SK: 'xxx xxx xxx',\n SL: 'xxx-xxxxxx',\n SM: 'xxxxx xxxxx',\n SN: 'xx xxx xx xx',\n SO: 'xxx xxxxxxx',\n SR: 'xxx-xxxx',\n SS: 'xxx xxxx xxx',\n SV: 'xxxx-xxxx',\n SZ: 'xxx xx xxxx',\n TG: 'xx xx xx xx',\n TH: 'xxx-xxxxxxx',\n TJ: 'xxx xx xx xx',\n TL: 'xxx-xxxxxxx',\n TN: 'xx xxxxxx',\n TR: 'xxx xxx xx xx',\n TT: 'xxx-xxxx',\n TW: 'xxxx-xxxxxx',\n TZ: 'xxx xxx xxxx',\n UA: 'xx xxx xx xx',\n UG: 'xxx xxxxxxx',\n US: 'xxx-xxx-xxxx',\n UY: 'xxx-xxxxx',\n UZ: 'xxx-xxx-xx-xx',\n VC: 'xxx-xxxx',\n VE: 'xxxx-xxx-xxxx',\n VN: 'xxxx-xxxxxxx',\n YE: 'xxxx-xxxx',\n ZA: 'xxx-xxx-xxxx',\n ZM: 'xxx-xxxxxxx',\n ZW: 'xx xxx xxxx',\n KW: 'xxx xx xxxx',\n BH: 'xxxx xxxx',\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Formats a provided phone number according to the predefined format for a specific country code, or auto-detects the country code and formats the number accordingly.\nconst formatPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_FORMATTER_MAPPER,\n): string => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Convert phoneNumber to string and clean it by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_FORMATTER_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Fetch the pattern for the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern) return phoneNumber;\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n // Extract the phoneNumber without the prefix\n const phoneNumberWithoutPrefix = phoneNumber.slice(diff);\n const formattedNumber: string[] = [];\n let numberIndex = 0;\n\n // Loop through the pattern to format the phoneNumber\n for (let i = 0; i < pattern.length; i++) {\n const patternChar = pattern[i];\n if (patternChar === 'x') {\n // Insert phoneNumber digits at 'x' positions\n if (numberIndex < phoneNumberWithoutPrefix.length) {\n formattedNumber.push(phoneNumberWithoutPrefix[numberIndex]);\n numberIndex++;\n }\n } else {\n // Insert non-digit characters from the pattern\n formattedNumber.push(patternChar);\n }\n }\n\n // Join the formattedNumber array to create the formattedPhoneNumber without prefix\n const formattedPhoneNumberWithoutPrefix = formattedNumber.join('');\n // Combine the prefix and formattedPhoneNumberWithoutPrefix\n const formattedPhoneNumberWithPrefix =\n phoneNumber.slice(0, diff) + ' ' + formattedPhoneNumberWithoutPrefix;\n\n // Return the formattedPhoneNumber with prefix after trimming whitespace\n return formattedPhoneNumberWithPrefix.trim();\n};\n\nexport default withErrorBoundary(formatPhoneNumber);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport formatPhoneNumber from './formatPhoneNumber';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\ninterface PhoneInfo {\n countryCode: string;\n dialCode: string;\n formattedPhoneNumber: string;\n formatTemplate: string;\n}\n\n// Parses a given phone number, identifies its country code (if not provided), and returns an object with details including the country code, formatted phone number, dial code, and format template.\nconst parsePhoneNumber = (phoneNumber: string, country?: string): PhoneInfo => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Clean the phoneNumber by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n const countryCode =\n country && country in PHONE_FORMATTER_MAPPER\n ? country\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Format the phone number using the detected/validated country code\n const formattedPhoneNumber = formatPhoneNumber(phoneNumber, countryCode);\n\n // Fetch the pattern associated with the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern)\n return {\n countryCode: countryCode || '',\n dialCode: '',\n formattedPhoneNumber: phoneNumber,\n formatTemplate: '',\n };\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n\n // Extract the dialCode from the phoneNumber\n const dialCode = phoneNumber.slice(0, diff);\n\n // Obtain the format template associated with the countryCode\n const formatTemplate = PHONE_FORMATTER_MAPPER[countryCode];\n\n // Return the parsed phone number information\n return {\n countryCode,\n formattedPhoneNumber,\n dialCode,\n formatTemplate,\n };\n};\n\nexport default withErrorBoundary(parsePhoneNumber);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Adds a specified amount of time to a date.\n *\n * @param date The original date.\n * @param value The amount to add.\n * @param unit The unit of time to add (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time added.\n */\nconst add = (\n date: Date,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n const result = new Date(date);\n switch (unit) {\n case 'days':\n result.setDate(result.getDate() + value);\n break;\n case 'months':\n result.setMonth(result.getMonth() + value);\n break;\n case 'years':\n result.setFullYear(result.getFullYear() + value);\n break;\n }\n return result;\n};\n\nexport default withErrorBoundary(add);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale, DateTimeFormatOptions } from './types';\n\n/**\n * Formats date and time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional).\n * @returns {string} Formatted date and time string.\n */\nconst formatDateTime = (\n date: DateInput,\n locale: Locale,\n options: DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const dateObj: Date = date instanceof Date ? date : new Date(date);\n let formatter;\n\n try {\n formatter = new Intl.DateTimeFormat(locale, options);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formatter.format(dateObj);\n};\n\nexport default withErrorBoundary(formatDateTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n DateFormatOptions,\n} from './types';\n\n/**\n * Formats date based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional).\n * @returns {string} Formatted date string.\n */\nconst formatDate = (\n date: DateInput,\n locale: Locale,\n options: DateFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n timeStyle: undefined,\n };\n\n let formattedDate;\n\n try {\n formattedDate = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedDate;\n};\n\nexport default withErrorBoundary(formatDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n TimeFormatOptions,\n} from './types';\n\n/**\n * Formats time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional).\n * @returns {string} Formatted time string.\n */\nconst formatTime = (\n date: DateInput,\n locale: Locale,\n options: TimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n dateStyle: undefined,\n };\n\n let formattedTime;\n\n try {\n formattedTime = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedTime;\n};\n\nexport default withErrorBoundary(formatTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\n\n/**\n * Gets the first day of the week for a given locale.\n *\n * @param locale The locale to determine the first day of the week for.\n * @returns The first day of the week (0-6, where 0 is Sunday).\n */\nconst getFirstDayOfWeek = (locale: string): number => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n let formatted;\n\n try {\n const formatter = new Intl.DateTimeFormat(locale, { weekday: 'short' });\n const sampleDate = new Date(2000, 0, 2); // A Sunday\n formatted = formatter.format(sampleDate);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return ['su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'].indexOf(\n formatted.slice(0, 2).toLowerCase(),\n );\n};\n\nexport default withErrorBoundary(getFirstDayOfWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Determines the quarter of the year for a given date.\n *\n * @param date The date to determine the quarter for.\n * @returns The quarter of the year (1-4).\n */\nconst getQuarter = (date: Date): number => {\n return Math.ceil((date.getMonth() + 1) / 3);\n};\n\nexport default withErrorBoundary(getQuarter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Provides a relative time string (e.g., '3 hours ago', 'in 2 days').\n * This function calculates the difference between the given date and the base date,\n * then formats it in a locale-sensitive manner. It allows customization of the output\n * through Intl.RelativeTimeFormat options.\n *\n * @param date - The date to compare.\n * @param baseDate - The date to compare against (default: current date).\n * @param locale - The locale to use for formatting.\n * @param options - Options for the Intl.RelativeTimeFormat (optional).\n * @returns The relative time as a string.\n */\nconst getRelativeTime = (\n date: Date,\n baseDate: Date = new Date(),\n locale: Locale,\n options?: Intl.RelativeTimeFormatOptions,\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000;\n\n // Define time units in seconds\n const minute = 60;\n const hour = minute * 60;\n const day = hour * 24;\n const week = day * 7;\n const month = day * 30;\n const year = day * 365;\n\n let value: number;\n let unit: Intl.RelativeTimeFormatUnit;\n\n if (Math.abs(diffInSeconds) < minute) {\n value = diffInSeconds;\n unit = 'second';\n } else if (Math.abs(diffInSeconds) < hour) {\n value = diffInSeconds / minute;\n unit = 'minute';\n } else if (Math.abs(diffInSeconds) < day) {\n value = diffInSeconds / hour;\n unit = 'hour';\n } else if (Math.abs(diffInSeconds) < week) {\n value = diffInSeconds / day;\n unit = 'day';\n } else if (Math.abs(diffInSeconds) < month) {\n value = diffInSeconds / week;\n unit = 'week';\n } else if (Math.abs(diffInSeconds) < year) {\n value = diffInSeconds / month;\n unit = 'month';\n } else {\n value = diffInSeconds / year;\n unit = 'year';\n }\n\n let relativeTime;\n\n try {\n const rtf = new Intl.RelativeTimeFormat(locale, options);\n relativeTime = rtf.format(Math.round(value), unit);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return relativeTime;\n};\n\nexport default withErrorBoundary(getRelativeTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Calculates the week number of the year for a given date.\n *\n * @param date The date to calculate the week number for.\n * @returns The week number of the year.\n */\nconst getWeek = (date: Date): number => {\n const firstDayOfYear = new Date(date.getFullYear(), 0, 1);\n const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000;\n return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7);\n};\n\nexport default withErrorBoundary(getWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Returns an array of weekdays according to the specified locale.\n *\n * @param locale The locale to get weekdays for.\n * @returns An array of weekday names.\n */\nconst getWeekdays = (locale: Locale): string[] => {\n try {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n const formatter = new Intl.DateTimeFormat(locale, { weekday: 'long' });\n return Array.from({ length: 7 }, (_, i) =>\n formatter.format(new Date(1970, 0, 4 + i)),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(getWeekdays);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\n\n/**\n * Compares two dates to determine if the first is after the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is after date2.\n */\nconst isAfter = (date1: DateInput, date2: DateInput): boolean => {\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 > dateObj2;\n};\n\nexport default withErrorBoundary(isAfter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\n\n/**\n * Compares two dates to determine if the first is before the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is before date2.\n */\nconst isBefore = (date1: DateInput, date2: DateInput): boolean => {\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 < dateObj2;\n};\n\nexport default withErrorBoundary(isBefore);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given year is a leap year.\n *\n * @param year The year to check.\n * @returns True if the year is a leap year, false otherwise.\n */\nconst isLeapYear = (year: number): boolean => {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n};\n\nexport default withErrorBoundary(isLeapYear);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if two dates fall on the same day.\n *\n * @param date1 The first date.\n * @param date2 The second date.\n * @returns True if both dates are on the same day, false otherwise.\n */\nconst isSameDay = (date1: Date, date2: Date): boolean => {\n return (\n date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear()\n );\n};\n\nexport default withErrorBoundary(isSameDay);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given object is a valid Date object.\n *\n * @param date The object to check.\n * @returns True if the object is a valid Date, false otherwise.\n */\nconst isValidDate = (date: any): boolean => {\n return date instanceof Date && !isNaN(date.getTime());\n};\n\nexport default withErrorBoundary(isValidDate);\n","export const LOCALE_DATE_FORMATS: { [key: string]: string } = {\n 'ar-AE': 'DD/MM/YYYY', // Arabic (U.A.E.)\n 'sq-AL': 'DD.MM.YYYY', // Albanian (Albania)\n 'hy-AM': 'DD.MM.YYYY', // Armenian (Armenia)\n 'es-AR': 'DD/MM/YYYY', // Spanish (Argentina)\n 'en-AU': 'DD/MM/YYYY', // English (Australia)\n 'nl-AW': 'DD-MM-YYYY', // Dutch (Aruba)\n 'en-BB': 'MM/DD/YYYY', // English (Barbados)\n 'bn-BD': 'DD/MM/YYYY', // Bengali (Bangladesh)\n 'en-BM': 'MM/DD/YYYY', // English (Bermuda)\n 'ms-BN': 'DD/MM/YYYY', // Malay (Brunei)\n 'es-BO': 'DD/MM/YYYY', // Spanish (Bolivia)\n 'en-BS': 'MM/DD/YYYY', // English (Bahamas)\n 'en-BW': 'DD/MM/YYYY', // English (Botswana)\n 'en-BZ': 'MM/DD/YYYY', // English (Belize)\n 'en-CA': 'DD/MM/YYYY', // English (Canada)\n 'de-CH': 'DD.MM.YYYY', // German (Switzerland)\n 'zh-CN': 'YYYY/MM/DD', // Chinese (China)\n 'es-CO': 'DD/MM/YYYY', // Spanish (Colombia)\n 'es-CR': 'DD/MM/YYYY', // Spanish (Costa Rica)\n 'es-CU': 'DD/MM/YYYY', // Spanish (Cuba)\n 'cs-CZ': 'DD.MM.YYYY', // Czech (Czech Republic)\n 'da-DK': 'DD-MM-YYYY', // Danish (Denmark)\n 'es-DO': 'DD/MM/YYYY', // Spanish (Dominican Republic)\n 'ar-DZ': 'DD/MM/YYYY', // Arabic (Algeria)\n 'ar-EG': 'DD/MM/YYYY', // Arabic (Egypt)\n 'am-ET': 'DD/MM/YYYY', // Amharic (Ethiopia)\n 'en-EU': 'DD/MM/YYYY', // English (European Union)\n 'en-FJ': 'DD/MM/YYYY', // English (Fiji)\n 'en-GB': 'DD/MM/YYYY', // English (United Kingdom)\n 'en-GH': 'DD/MM/YYYY', // English (Ghana)\n 'en-GI': 'DD/MM/YYYY', // English (Gibraltar)\n 'en-GM': 'DD/MM/YYYY', // English (Gambia)\n 'es-GT': 'DD/MM/YYYY', // Spanish (Guatemala)\n 'en-GY': 'DD/MM/YYYY', // English (Guyana)\n 'en-HK': 'DD/MM/YYYY', // English (Hong Kong)\n 'es-HN': 'DD/MM/YYYY', // Spanish (Honduras)\n 'hr-HR': 'DD.MM.YYYY', // Croatian (Croatia)\n 'ht-HT': 'MM/DD/YYYY', // Haitian (Haiti)\n 'hu-HU': 'YYYY. MM. DD.', // Hungarian (Hungary)\n 'id-ID': 'DD/MM/YYYY', // Indonesian (Indonesia)\n 'he-IL': 'DD/MM/YYYY', // Hebrew (Israel)\n 'en-IN': 'DD-MM-YYYY', // English (India)\n 'en-JM': 'MM/DD/YYYY', // English (Jamaica)\n 'en-KE': 'DD/MM/YYYY', // English (Kenya)\n 'ky-KG': 'DD.MM.YYYY', // Kyrgyz (Kyrgyzstan)\n 'km-KH': 'DD/MM/YYYY', // Khmer (Cambodia)\n 'en-KY': 'MM/DD/YYYY', // English (Cayman Islands)\n 'kk-KZ': 'DD.MM.YYYY', // Kazakh (Kazakhstan)\n 'lo-LA': 'DD/MM/YYYY', // Lao (Laos)\n 'si-LK': 'YYYY-MM-DD', // Sinhala (Sri Lanka)\n 'en-LR': 'MM/DD/YYYY', // English (Liberia)\n 'en-LS': 'DD/MM/YYYY', // English (Lesotho)\n 'ar-MA': 'DD/MM/YYYY', // Arabic (Morocco)\n 'ro-MD': 'DD.MM.YYYY', // Romanian (Moldova)\n 'mk-MK': 'DD.MM.YYYY', // Macedonian (North Macedonia)\n 'my-MM': 'DD/MM/YYYY', // Burmese (Myanmar)\n 'mn-MN': 'YYYY.MM.DD', // Mongolian (Mongolia)\n 'zh-MO': 'DD/MM/YYYY', // Chinese (Macao)\n 'en-MU': 'DD/MM/YYYY', // English (Mauritius)\n 'dv-MV': 'DD/MM/YYYY', // Divehi (Maldives)\n 'en-MW': 'DD/MM/YYYY', // English (Malawi)\n 'es-MX': 'DD/MM/YYYY', // Spanish (Mexico)\n 'ms-MY': 'DD/MM/YYYY', // Malay (Malaysia)\n 'en-NA': 'DD/MM/YYYY', // English (Namibia)\n 'en-NG': 'DD/MM/YYYY', // English (Nigeria)\n 'es-NI': 'DD/MM/YYYY', // Spanish (Nicaragua)\n 'no-NO': 'DD.MM.YYYY', // Norwegian (Norway)\n 'ne-NP': 'YYYY/MM/DD', // Nepali (Nepal)\n 'en-NZ': 'DD/MM/YYYY', // English (New Zealand)\n 'es-PE': 'DD/MM/YYYY', // Spanish (Peru)\n 'en-PG': 'DD/MM/YYYY', // English (Papua New Guinea)\n 'en-PH': 'MM/DD/YYYY', // English (Philippines)\n 'en-PK': 'DD/MM/YYYY', // English (Pakistan)\n 'ar-QA': 'DD/MM/YYYY', // Arabic (Qatar)\n 'ru-RU': 'DD.MM.YYYY', // Russian (Russia)\n 'ar-SA': 'DD/MM/YYYY', // Arabic (Saudi Arabia)\n 'en-SC': 'DD/MM/YYYY', // English (Seychelles)\n 'sv-SE': 'YYYY-MM-DD', // Swedish (Sweden)\n 'en-SG': 'DD/MM/YYYY', // English (Singapore)\n 'en-SL': 'DD/MM/YYYY', // English (Sierra Leone)\n 'so-SO': 'DD/MM/YYYY', // Somali (Somalia)\n 'en-SS': 'DD/MM/YYYY', // English (South Sudan)\n 'es-SV': 'DD/MM/YYYY', // Spanish (El Salvador)\n 'en-SZ': 'DD/MM/YYYY', // English (Eswatini)\n 'th-TH': 'DD/MM/YYYY', // Thai (Thailand)\n 'en-TT': 'MM/DD/YYYY', // English (Trinidad and Tobago)\n 'sw-TZ': 'DD/MM/YYYY', // Swahili (Tanzania)\n 'en-US': 'MM/DD/YYYY', // English (United States)\n 'es-UY': 'DD/MM/YYYY', // Spanish (Uruguay)\n 'uz-UZ': 'DD/MM/YYYY', // Uzbek (Uzbekistan)\n 'ar-YE': 'DD/MM/YYYY', // Arabic (Yemen)\n 'en-ZA': 'YYYY/MM/DD', // English (South Africa)\n 'ar-KW': 'DD/MM/YYYY', // Arabic (Kuwait)\n 'ar-BH': 'DD/MM/YYYY', // Arabic (Bahrain)\n 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman)\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Parses a date string based on a specific format.\n *\n * @param dateString The date string to parse.\n * @param format The format to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDateWithFormat = (\n dateString: string,\n format: string,\n): Date | null => {\n // Determine the separator based on the format (supports '/', '.', or '-')\n const separator = format.includes('/')\n ? '/'\n : format.includes('.')\n ? '.'\n : '-';\n const formatParts = format.split(separator);\n const dateParts = dateString.split(separator).map((num) => parseInt(num, 10));\n\n let year: number = 0,\n month: number = 0,\n day: number = 0;\n let yearSet: boolean = false,\n monthSet: boolean = false,\n daySet: boolean = false;\n\n // Check for format and date string mismatch\n if (dateParts.length !== formatParts.length) {\n return null; // Mismatch between date string and format\n }\n\n formatParts.forEach((part, index) => {\n // Check for non-numeric values in date string\n if (isNaN(dateParts[index])) {\n return null; // Invalid date part\n }\n\n // Assign year, month, and day based on the format\n switch (part) {\n case 'DD':\n day = dateParts[index];\n daySet = true;\n break;\n case 'MM':\n month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date\n monthSet = true;\n break;\n case 'YYYY':\n year = dateParts[index];\n yearSet = true;\n break;\n }\n });\n\n // Validate and create the date only if all parts are set\n if (yearSet && monthSet && daySet) {\n const parsedDate = new Date(year, month, day);\n // Validate date to catch invalid dates like February 30th\n if (\n parsedDate.getFullYear() === year &&\n parsedDate.getMonth() === month &&\n parsedDate.getDate() === day\n ) {\n return parsedDate;\n }\n }\n return null; // Invalid date or incomplete date information\n};\n\nexport default withErrorBoundary(\n parseDateWithFormat,\n);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { LOCALE_DATE_FORMATS } from './data/localeDateFormats';\nimport parseDateWithFormat from './parseDateWithFormat';\nimport { Locale } from './types';\n\n/**\n * Attempts to parse a string into a date object based on locale.\n * Uses the localeDateFormats mapping for determining the date format.\n *\n * @param dateString - The date string to parse.\n * @param locale - The locale to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDate = (dateString: string, locale: Locale): Date | null => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const format = LOCALE_DATE_FORMATS[locale];\n if (!format) {\n throw new Error(`No date format found for locale: ${locale}`);\n }\n return parseDateWithFormat(dateString, format);\n};\n\nexport default withErrorBoundary(parseDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport add from './add';\n\n/**\n * Subtracts a specified amount of time from a date.\n *\n * @param date The original date.\n * @param value The amount to subtract.\n * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time subtracted.\n */\nconst subtract = (\n date: Date,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n return add(date, -value, unit); // Reuse the add function with negative value\n};\n\nexport default withErrorBoundary(subtract);\n"],"names":["formatPhoneNumber","formatDateTime","parseDateWithFormat","add"],"mappings":";;;;;;IAAA;IACM,MAAO,YAAa,SAAQ,KAAK,CAAA;IAErC,IAAA,WAAA,CAAY,OAA2B,EAAA;YACrC,KAAK,CAAC,OAAO,CAAC,CAAC;IACf,QAAA,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC5B,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;;SAE7B;IACF,CAAA;IAED;;;;;;;;IAQG;IACI,MAAM,iBAAiB,GAAG,CAC/B,EAAK,KAC0C;QAC/C,OAAO,UAAyB,GAAG,IAAmB,EAAA;YACpD,IAAI;gBACF,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAkB,CAAC;IAChD,SAAA;IAAC,QAAA,OAAO,GAAG,EAAE;IACZ,YAAA,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC;;;IAGpC,YAAA,MAAM,IAAI,YAAY,CAAC,GAAyB,CAAC,CAAC;IACnD,SAAA;IACH,KAAC,CAAC;IACJ,CAAC;;aC/Be,eAAe,GAAA;QAC7B,OAAO;IACL,QAAA,MAAM,EAAE,EAAE;IACV,QAAA,SAAS,EAAE,EAAE;IACb,QAAA,OAAO,EAAE,EAAE;SACZ,CAAC;IACJ;;UCLa,gBAAgB,CAAA;IAI3B,IAAA,WAAA,GAAA;IACE,QAAA,IAAI,CAAC,KAAK,GAAG,eAAe,EAAE,CAAC;SAChC;IAEM,IAAA,OAAO,WAAW,GAAA;IACvB,QAAA,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE;IAC9B,YAAA,gBAAgB,CAAC,QAAQ,GAAG,IAAI,gBAAgB,EAAE,CAAC;IACpD,SAAA;YAED,OAAO,gBAAgB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,CAAC;IACnB,SAAA;IACF,KAAA;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AAEF,gCAAe,iBAAiB,CAC9B,mBAAmB,CACpB;;ICnED;;;;;;;IAOG;IACH,MAAM,SAAS,GAAG,CAAC,UAAkB,EAAE,MAAc,KAAiB;IACpE;;;;IAIK;IACL,IAAA,IAAI,CAAC,MAAM;YAAE,MAAM,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC,MAAM,IAAI,SAAS,EAAE,CAAC;IAE7D,IAAA,MAAM,MAAM,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;QAC3C,IAAI,CAAC,MAAM,EAAE;IACX,QAAA,MAAM,IAAI,KAAK,CAAC,oCAAoC,MAAM,CAAA,CAAE,CAAC,CAAC;IAC/D,KAAA;IACD,IAAA,OAAOC,qBAAmB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACjD,CAAC,CAAC;AAEF,sBAAe,iBAAiB,CAAmB,SAAS,CAAC;;IC3B7D;;;;;;;IAOG;IACH,MAAM,QAAQ,GAAG,CACf,IAAU,EACV,KAAa,EACb,IAAiC,KACzB;QACR,OAAOC,KAAG,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC,CAAC;AAEF,qBAAe,iBAAiB,CAAkB,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"index.js","sources":["../../src/common/errorBoundary/index.ts","../../src/modules/.internal/utils/getDefaultState.ts","../../src/modules/.internal/state/index.ts","../../src/modules/core/getState.ts","../../src/modules/core/setState.ts","../../src/modules/core/resetState.ts","../../src/modules/.internal/utils/getLocale.ts","../../src/modules/.internal/utils/getIntlInstanceWithOptions.ts","../../src/modules/currency/formatNumber.ts","../../src/modules/currency/data/currencies.ts","../../src/modules/currency/getCurrencyList.ts","../../src/modules/currency/getCurrencySymbol.ts","../../src/modules/currency/constants.ts","../../src/modules/currency/formatNumberByParts.ts","../../src/modules/phoneNumber/data/phoneRegexMapper.ts","../../src/modules/phoneNumber/data/dialCodeMapper.ts","../../src/modules/phoneNumber/utils.ts","../../src/modules/phoneNumber/isValidPhoneNumber.ts","../../src/modules/phoneNumber/data/phoneFormatterMapper.ts","../../src/modules/phoneNumber/formatPhoneNumber.ts","../../src/modules/phoneNumber/parsePhoneNumber.ts","../../src/modules/dateTime/utils.ts","../../src/modules/dateTime/add.ts","../../src/modules/dateTime/formatDateTime.ts","../../src/modules/dateTime/formatDate.ts","../../src/modules/dateTime/formatTime.ts","../../src/modules/dateTime/getFirstDayOfWeek.ts","../../src/modules/dateTime/getQuarter.ts","../../src/modules/dateTime/getRelativeTime.ts","../../src/modules/dateTime/getWeek.ts","../../src/modules/dateTime/getWeekdays.ts","../../src/modules/dateTime/isAfter.ts","../../src/modules/dateTime/isBefore.ts","../../src/modules/dateTime/isLeapYear.ts","../../src/modules/dateTime/isSameDay.ts","../../src/modules/dateTime/isValidDate.ts","../../src/modules/dateTime/data/localeDateFormats.ts","../../src/modules/dateTime/parseDateWithFormat.ts","../../src/modules/dateTime/parseDate.ts","../../src/modules/dateTime/subtract.ts"],"sourcesContent":["// Custom Error class to extend properties to error object\nexport class I18nifyError extends Error {\n timestamp: Date;\n constructor(message: string | undefined) {\n super(message);\n this.name = 'i18nify Error';\n this.timestamp = new Date();\n // more params like type of error/severity can be added in future for better debugging.\n }\n}\n\n/**\n * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block.\n * It appends additional attributes and serves as a centralized error-handling service.\n * Usage =>\n * const wrappedUtilityFn = withErrorBoundary(utilityFn)\n *\n * @param fn utility that is wrapped in error boundary\n * @returns {Function} returns the function wrapped in try/catch block\n */\nexport const withErrorBoundary = any>(\n fn: T,\n): ((...args: Parameters) => ReturnType) => {\n return function (this: unknown, ...rest: Parameters): ReturnType {\n try {\n return fn.call(this, ...rest) as ReturnType;\n } catch (err) {\n console.warn('[I18N Error]: ', err);\n // Currently, we are throwing the error as it is to consumers.\n // In the future, this can be modified as per our requirement, like an error logging service.\n throw new I18nifyError(err as string | undefined);\n }\n };\n};\n","import type { I18nState } from '../state/types';\n\nexport function getDefaultState(): I18nState {\n return {\n locale: '',\n direction: '',\n country: '',\n };\n}\n","import { I18nState } from './types';\nimport { getDefaultState } from '../utils/getDefaultState';\n\nexport class I18nStateManager {\n private static instance: I18nStateManager | undefined;\n private state: I18nState;\n\n private constructor() {\n this.state = getDefaultState();\n }\n\n public static getInstance(): I18nStateManager {\n if (!I18nStateManager.instance) {\n I18nStateManager.instance = new I18nStateManager();\n }\n\n return I18nStateManager.instance;\n }\n\n public static resetInstance(): void {\n I18nStateManager.instance = undefined;\n }\n\n public getState(): I18nState {\n return { ...this.state };\n }\n\n public setState(newState: Partial): void {\n this.state = { ...this.state, ...newState };\n }\n\n public resetState(): void {\n this.state = getDefaultState();\n }\n}\n\nexport default I18nStateManager.getInstance();\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * function to return active i18n state\n *\n * ===== USAGE =====\n * import { getState } from '@razorpay/i18nify-js';\n *\n * console.log(getState())\n *\n * @returns i18n state\n */\nconst getState = (): I18nState => {\n return state.getState();\n};\n\nexport default withErrorBoundary(getState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * Function to set and override the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { setState } from \"@razorpay/i18nify-js\";\n * setState({locale: 'en-US'})\n *\n * @param newState data to set in i18nState instance\n */\nconst setState = (newState: Partial): void => {\n state.setState(newState);\n};\n\nexport default withErrorBoundary(setState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\n\n/**\n * Function to reset the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { resetState } from \"@razorpay/i18nify-js\";\n * resetState()\n *\n * @param newState data to set in i18nState instance\n */\nconst resetState = (): void => {\n state.resetState();\n};\n\nexport default withErrorBoundary(resetState);\n","export const getLocale = (): string => {\n // Check if running in a non-browser environment (e.g., Node.js or older browsers).\n if (typeof navigator === 'undefined') {\n return 'en-IN';\n }\n\n // Check if the browser supports the Intl object and user language preferences.\n if (\n window.Intl &&\n typeof window.Intl === 'object' &&\n (window.navigator.languages || window.navigator.language)\n ) {\n const userLocales = window.navigator.languages || [\n window.navigator.language,\n ];\n return userLocales[0];\n }\n\n // Fallback to a supported locale or the default locale.\n return 'en-IN';\n};\n","import { CURRENCIES } from '../../currency/data/currencies';\nimport state from '../state';\nimport { getLocale } from './getLocale';\n\nexport const getIntlInstanceWithOptions = (\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n) => {\n /** retrieve locale from below areas in order of preference\n * 1. options.locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n let locale = options?.locale || state.getState().locale;\n\n // If a specific locale is provided, use it; otherwise, use the browser's locale\n if (!locale) {\n locale = getLocale();\n }\n\n const intlOptions = options?.intlOptions ? { ...options.intlOptions } : {};\n\n if (options?.currency || intlOptions.currency) {\n intlOptions.style = 'currency';\n intlOptions.currency = (options.currency || intlOptions.currency) as string;\n }\n\n if (!locale) throw new Error('Pass valid locale !');\n\n return new Intl.NumberFormat(locale || undefined, intlOptions);\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\n\n// this function formats number based on different arguments passed\nconst formatNumber = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): string => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n let formattedAmount = '';\n\n try {\n formattedAmount = getIntlInstanceWithOptions(options).format(\n Number(amount),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedAmount;\n};\n\nexport default withErrorBoundary(formatNumber);\n","export const CURRENCIES: { [key: string]: { symbol: string; name: string } } = {\n AED: { symbol: 'د.إ', name: 'United Arab Emirates Dirham' },\n ALL: { symbol: 'Lek', name: 'Albanian Lek' },\n AMD: { symbol: '֏', name: 'Armenian Dram' },\n ARS: { symbol: 'ARS', name: 'Argentine Peso' },\n AUD: { symbol: 'A$', name: 'Australian Dollar' },\n AWG: { symbol: 'Afl.', name: 'Aruban Florin' },\n BBD: { symbol: '$', name: 'Barbadian Dollar' },\n BDT: { symbol: '৳', name: 'Bangladeshi Taka' },\n BMD: { symbol: '$', name: 'Bermudian Dollar' },\n BND: { symbol: 'BND', name: 'Brunei Dollar' },\n BOB: { symbol: 'Bs', name: 'Bolivian Boliviano' },\n BSD: { symbol: 'B$', name: 'Bahamian Dollar' },\n BWP: { symbol: 'P', name: 'Botswanan Pula' },\n BZD: { symbol: 'BZ$', name: 'Belize Dollar' },\n CAD: { symbol: 'C$', name: 'Canadian Dollar' },\n CHF: { symbol: 'CHf', name: 'Swiss Franc' },\n CNY: { symbol: '¥', name: 'Chinese Yuan' },\n COP: { symbol: 'COL$', name: 'Colombian Peso' },\n CRC: { symbol: '₡', name: 'Costa Rican Colón' },\n CUP: { symbol: '$MN', name: 'Cuban Peso' },\n CZK: { symbol: 'Kč', name: 'Czech Koruna' },\n DKK: { symbol: 'DKK', name: 'Danish Krone' },\n DOP: { symbol: 'RD$', name: 'Dominican Peso' },\n DZD: { symbol: 'د.ج', name: 'Algerian Dinar' },\n EGP: { symbol: 'E£', name: 'Egyptian Pound' },\n ETB: { symbol: 'ብር', name: 'Ethiopian Birr' },\n EUR: { symbol: '€', name: 'Euro' },\n FJD: { symbol: 'FJ$', name: 'Fijian Dollar' },\n GBP: { symbol: '£', name: 'British Pound' },\n GHS: { symbol: 'GH₵', name: 'Ghanaian Cedi' },\n GIP: { symbol: 'GIP', name: 'Gibraltar Pound' },\n GMD: { symbol: 'D', name: 'Gambian Dalasi' },\n GTQ: { symbol: 'Q', name: 'Guatemalan Quetzal' },\n GYD: { symbol: 'G$', name: 'Guyanese Dollar' },\n HKD: { symbol: 'HK$', name: 'Hong Kong Dollar' },\n HNL: { symbol: 'HNL', name: 'Honduran Lempira' },\n HRK: { symbol: 'kn', name: 'Croatian Kuna' },\n HTG: { symbol: 'G', name: 'Haitian Gourde' },\n HUF: { symbol: 'Ft', name: 'Hungarian Forint' },\n IDR: { symbol: 'Rp', name: 'Indonesian Rupiah' },\n ILS: { symbol: '₪', name: 'Israeli New Shekel' },\n INR: { symbol: '₹', name: 'Indian Rupee' },\n JMD: { symbol: 'J$', name: 'Jamaican Dollar' },\n KES: { symbol: 'Ksh', name: 'Kenyan Shilling' },\n KGS: { symbol: 'Лв', name: 'Kyrgystani Som' },\n KHR: { symbol: '៛', name: 'Cambodian Riel' },\n KYD: { symbol: 'CI$', name: 'Cayman Islands Dollar' },\n KZT: { symbol: '₸', name: 'Kazakhstani Tenge' },\n LAK: { symbol: '₭', name: 'Laotian Kip' },\n LKR: { symbol: 'රු', name: 'Sri Lankan Rupee' },\n LRD: { symbol: 'L$', name: 'Liberian Dollar' },\n LSL: { symbol: 'LSL', name: 'Lesotho Loti' },\n MAD: { symbol: 'د.م.', name: 'Moroccan Dirham' },\n MDL: { symbol: 'MDL', name: 'Moldovan Leu' },\n MKD: { symbol: 'ден', name: 'Macedonian Denar' },\n MMK: { symbol: 'MMK', name: 'Myanmar Kyat' },\n MNT: { symbol: '₮', name: 'Mongolian Tugrik' },\n MOP: { symbol: 'MOP$', name: 'Macanese Pataca' },\n MUR: { symbol: '₨', name: 'Mauritian Rupee' },\n MVR: { symbol: 'Rf', name: 'Maldivian Rufiyaa' },\n MWK: { symbol: 'MK', name: 'Malawian Kwacha' },\n MXN: { symbol: 'Mex$', name: 'Mexican Peso' },\n MYR: { symbol: 'RM', name: 'Malaysian Ringgit' },\n NAD: { symbol: 'N$', name: 'Namibian Dollar' },\n NGN: { symbol: '₦', name: 'Nigerian Naira' },\n NIO: { symbol: 'NIO', name: 'Nicaraguan Córdoba' },\n NOK: { symbol: 'NOK', name: 'Norwegian Krone' },\n NPR: { symbol: 'रू', name: 'Nepalese Rupee' },\n NZD: { symbol: 'NZ$', name: 'New Zealand Dollar' },\n PEN: { symbol: 'S/', name: 'Peruvian Nuevo Sol' },\n PGK: { symbol: 'PGK', name: 'Papua New Guinean Kina' },\n PHP: { symbol: '₱', name: 'Philippine Peso' },\n PKR: { symbol: '₨', name: 'Pakistani Rupee' },\n QAR: { symbol: 'QR', name: 'Qatari Riyal' },\n RUB: { symbol: '₽', name: 'Russian Ruble' },\n SAR: { symbol: 'SR', name: 'Saudi Riyal' },\n SCR: { symbol: 'SRe', name: 'Seychellois Rupee' },\n SEK: { symbol: 'SEK', name: 'Swedish Krona' },\n SGD: { symbol: 'S$', name: 'Singapore Dollar' },\n SLL: { symbol: 'Le', name: 'Sierra Leonean Leone' },\n SOS: { symbol: 'Sh.so.', name: 'Somali Shilling' },\n SSP: { symbol: 'SS£', name: 'South Sudanese Pound' },\n SVC: { symbol: '₡', name: 'Salvadoran Colón' },\n SZL: { symbol: 'E', name: 'Swazi Lilangeni' },\n THB: { symbol: '฿', name: 'Thai Baht' },\n TTD: { symbol: 'TT$', name: 'Trinidad and Tobago Dollar' },\n TZS: { symbol: 'Sh', name: 'Tanzanian Shilling' },\n USD: { symbol: '$', name: 'United States Dollar' },\n UYU: { symbol: '$U', name: 'Uruguayan Peso' },\n UZS: { symbol: \"so'm\", name: 'Uzbekistani Som' },\n YER: { symbol: '﷼', name: 'Yemeni Rial' },\n ZAR: { symbol: 'R', name: 'South African Rand' },\n KWD: { symbol: 'د.ك', name: 'Kuwaiti Dinar' },\n BHD: { symbol: 'د.ب.', name: 'Bahraini Dinar' },\n OMR: { symbol: 'ر.ع.', name: 'Omani Rial' },\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencyList = () => {\n return CURRENCIES;\n};\n\nexport default withErrorBoundary(getCurrencyList);\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencySymbol = (currencyCode: keyof typeof CURRENCIES): string => {\n if (currencyCode in CURRENCIES) return CURRENCIES[currencyCode]?.symbol;\n else throw new Error('Invalid currencyCode!');\n};\n\nexport default withErrorBoundary(getCurrencySymbol);\n","export const ALLOWED_FORMAT_PARTS_KEYS = [\n 'nan',\n 'infinity',\n 'percent',\n 'integer',\n 'group',\n 'decimal',\n 'fraction',\n 'plusSign',\n 'minusSign',\n 'percentSign',\n 'currency',\n 'code',\n 'symbol',\n 'name',\n 'compact',\n 'exponentInteger',\n 'exponentMinusSign',\n 'exponentSeparator',\n 'unit',\n] as const;\n","import { CURRENCIES } from './data/currencies';\nimport { ByParts, FormattedPartsObject } from './types';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\nimport { ALLOWED_FORMAT_PARTS_KEYS } from './constants';\n\nconst formatNumberByParts = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): ByParts => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n try {\n const formattedAmount = getIntlInstanceWithOptions(options).formatToParts(\n Number(amount),\n );\n\n const parts = formattedAmount;\n\n const formattedObj: FormattedPartsObject = {};\n\n parts.forEach((p) => {\n if (p.type === 'group') {\n formattedObj.integer = (formattedObj.integer || '') + p.value;\n } else if (\n ALLOWED_FORMAT_PARTS_KEYS.findIndex((item) => item === p.type) != -1\n ) {\n // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal' is skipped\n formattedObj[p.type] = (formattedObj[p.type] || '') + p.value;\n }\n });\n\n return {\n ...formattedObj,\n isPrefixSymbol: parts[0].type === 'currency',\n rawParts: parts,\n };\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(\n formatNumberByParts,\n);\n","export const PHONE_REGEX_MAPPER: { [key: string]: RegExp } = {\n IN: /^(?:(?:\\+|0{0,2})91\\s*[-]?\\s*|[0]?)?[6789]\\d{9}$/,\n MY: /^(\\+?6?0)?(\\d{1,3})[-. ]?(\\d{7,8})$/,\n AE: /^(?:\\+?971|0)?(?:2|3|4|6|7|9)\\d{8}$/,\n AL: /^(?:\\+?355)?(?:[4-9]\\d{7}|6\\d{8})$/,\n AM: /^(?:\\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/,\n AR: /^(?:(?:\\+|0{0,2})54)?(?:11|[2368]\\d)(?:(?=\\d{0,2}15)\\d{2})??\\d{8}$/,\n AU: /^(?:\\+?61|0)4\\d{8}$/,\n AW: /^(?:(?:\\+297)?(?!0)\\d{7})$/,\n BB: /^(?:(?:\\+1)?246)?(?:\\d{3})?\\d{7}$/,\n BD: /^(?:\\+?880|0)1[13456789]\\d{8}$/,\n BM: /^(?:(?:\\+1)?441)?(?:\\d{2})?\\d{7}$/,\n BN: /^(?:\\+?673)?(?:\\d{3})?\\d{4}$/,\n BO: /^(?:(?:\\+|0{0,2})591)?(?:(?:2|3|7|6)\\d{7})$/,\n BS: /^(?:(?:\\+1)?242)?(?:\\d{3})?\\d{7}$/,\n BW: /^(?:(?:\\+267)?\\s?)?[74]\\d{7}$/,\n BZ: /^(?:(?:\\+501)?\\s?)?[622]\\d{4}$/,\n CH: /^(?:(?:\\+41|0)(?:\\s*\\(?0\\)?\\s*))?(?:\\d{2}\\s*)?\\d{3}\\s*\\d{2}\\s*\\d{2}$/,\n CN: /^(?:(?:\\+|00)86)?1\\d{10}$/,\n CO: /^(?:(?:\\+57|0057)?)?[1-8]{1}\\d{6,7}$/,\n OM: /^(?:\\+?968)?(?:95|96|97|98)\\d{6}$/,\n CR: /^(?:(?:\\+506)?\\s*|0)?[1-9]\\d{7}$/,\n CU: /^(?:\\+?53)?(?:[5-8]\\d{7})$/,\n CZ: /^(?:\\+?420)?(?:\\d{9})$/,\n DK: /^(?:\\+?45)?(?:\\d{8})$/,\n DO: /^(?:(?:\\+1)?809|1-8(?:00|88|89))(?:\\d{7})$/,\n DZ: /^(?:\\+?213|0)([567]\\d{8})$/,\n EG: /^(?:(?:\\+20|20)?(\\d{10}))$/,\n ET: /^(?:\\+?251)?[1-59]\\d{8}$/,\n EU: /^(?:(?:\\+?3)?8)?\\s*(?:\\d{3}\\s*){3}\\d{2}$/,\n FJ: /^(?:(?:\\+?679)?\\s?\\d{3}\\s?\\d{4})?$/,\n GB: /^(?:(?:\\+44\\s?|0)7\\d{3}(\\s?\\d{4,})?)$/,\n GH: /^(?:(?:\\+233)|0)?(?:\\d{9})$/,\n GI: /^(?:\\+350)?\\d{5}$/,\n GM: /^(?:\\+220)?\\d{5,7}$/,\n GT: /^(?:\\+502)?[2468]\\d{7,8}$/,\n GY: /^(?:(?:\\+592)?(?:(?:\\s)?[2-9])(?:(?:\\s)?\\d))?(?:(?:\\s)?\\d{4})$/,\n HK: /^(?:\\+852\\s?)?[456789]\\d{3}\\s?\\d{4}$/,\n HN: /^(?:\\+504)?[89]\\d{7}$/,\n HR: /^(?:\\+?385)?\\d{8,9}$/,\n HT: /^(?:\\+?509)?\\d{8}$/,\n HU: /^(?:(?:\\+36))(\\s?\\d{2}\\s?\\d{3}\\s?\\d{4})$/,\n ID: /^(?:\\+?62|0[1-9])[\\s-]?\\d{2,4}[\\s-]?\\d{3,4}[\\s-]?\\d{3,4}$/,\n IL: /^(?:(?:\\+972|0)(?:-)?)[23489]\\d{7}$/,\n JM: /^(?:(?:\\+1876))\\d{7,10}$/,\n KE: /^(?:(?:\\+254)|(?:0))(?:\\d{6,7})$/,\n KG: /^(?:\\+996)?\\s?\\d{9}$/,\n KH: /^(?:(?:\\+855)|(?:0))(?:\\s?[1-9]\\d{7,8})$/,\n KY: /^(?:\\+?1\\s?(345))\\d{6}$/,\n KZ: /^(?:\\+?7|8)?7\\d{9}$/,\n LA: /^(?:(?:\\+?856)|0)(20\\d{7,9})$/,\n LK: /^(?:(?:\\+94)|0)(?:\\d{9})$/,\n LR: /^(?:\\+231)[ -\\d]{4}[ -\\d]{4}$/,\n LS: /^(?:(?:\\+?266)|0)?[56]\\d{7}$/,\n MA: /^(?:(?:\\+?212(\\s*[-|\\s*]?\\d{1,9})?)|(?:0))(?:\\d{9})$/,\n MD: /^(?:(?:\\+373)|(?:0))(?:\\d{7,8})$/,\n MK: /^(?:\\+389|0)(?:(?:2[0-4]|[3-9])\\s?)?\\d{6}$/,\n MM: /^(?:(?:\\+?95)|0)?[1-9]\\d{9}$/,\n MN: /^(?:\\+976|0)\\d{8}$/,\n MO: /^(?:(?:\\+?853)|[0-9])?\\d{8}$/,\n MU: /^(?:\\+230|0)?\\d{8}$/,\n MV: /^(?:(?:\\+?960)|0)?\\d{7}$/,\n MW: /^(?:\\+265)[1-9]\\d{6}$/,\n MX: /^(?:(?:\\+?52)?\\s?(?:1|01)?\\s?)?(?:\\d{3}\\s?\\d{3}\\s?\\d{4})$/,\n NA: /^(?:(?:\\+264)|0)?\\d{8}$/,\n NG: /^(?:(?:\\+234)|(?:0))(?:\\d{7,8})$/,\n NI: /^(?:(?:\\+505))?(?:\\d{8})$/,\n NO: /^(?:(?:\\+?47)|\\d{2}|\\d{3})\\s?\\d{2}\\s?\\d{3}$/,\n NP: /^(?:(?:\\+977))?(\\d{9,10})$/,\n NZ: /^(?:\\+?64|0)(\\d{2,5} \\d{4,8}|\\d{3,4} \\d{4})$/,\n PE: /^(?:(?:\\+51)|0)?(?:9\\d{8})$/,\n PG: /^(?:\\+?675)?(?:[7-9]\\d{7})$/,\n PH: /^(?:(?:\\+?63)|0)(?:\\d{10})$/,\n PK: /^(?:(?:\\+92)|0)?[345]\\d{9}$/,\n QA: /^(?:\\+?974)?-?33\\d{5}$/,\n RU: /^(?:\\+?7|8)?[ -]?\\(?9\\d{2}\\)?[ -]?\\d{3}[ -]?\\d{2}[ -]?\\d{2}$/,\n SA: /^(?:\\+?966)?\\s?1?[\\s-]?(?:[45]\\d{2}|5\\d{3})[\\s-]?\\d{4}$/,\n SC: /^(?:(?:\\+248)|\\d{4})\\d{5}$/,\n SE: /^(?:\\+?46|0)\\s?[1-57-9](?:[0-9]\\s?){8}$/,\n SG: /^(?:(?:\\+65)|(?:\\(\\+65\\))|(?:65))\\d{4}\\d{4}$/,\n SL: /^(?:(?:\\+232)|(?:0))?\\d{9}$/,\n SO: /^(?:\\+252|0)?[567]\\d{7}$/,\n SS: /^(?:\\+211|0)?[1-9]\\d{7,9}$/,\n SV: /^(?:(?:\\+?503)|(?:0))(?:\\d{8})$/,\n SZ: /^(?:\\+?268)?\\d{7,8}$/,\n TH: /^(?:(?:\\+66)|0)\\d{9}$/,\n TT: /^(?:(?:\\+?1-868)|\\(?868\\)?)(\\d{7})$/,\n TZ: /^(?:(?:\\+?255)|0)?[67]\\d{8}$/,\n US: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n CA: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n UY: /^(?:(?:\\+598|0)\\s?(9\\d{3}|2\\d{2}|[4-9]\\d{6}))$/,\n UZ: /^(?:\\+?998)?\\s?[3456789]\\d{8}$/,\n YE: /^(?:\\+?967)?(?:\\d{7,8})$/,\n ZA: /^(?:(?:\\+27)|0)(\\d{9})$/,\n KW: /^(?:\\+?965)[569]\\d{7}$/,\n BH: /^(?:\\+?973)?[356]\\d{7}$/,\n TL: /^(?:(?:\\+670)\\s?)?[0-9]{3}\\s?[0-9]{3,4}$/,\n VC: /^(?:(?:\\+1)?784)?(?:\\d{3})?\\d{7}$/,\n VE: /^(?:(?:\\+58)|0)?4\\d{9}$/,\n VN: /^(?:(?:\\+84)|0)?[1-9]\\d{8}$/,\n ZM: /^(?:(?:\\+260)|0)?[123456789]\\d{8,9}$/,\n ZW: /^(?:(?:\\+263)|0)?(?:\\d{9,10})$/,\n LT: /^(?:(?:\\+370)|8)\\d{8}$/,\n LU: /^(?:(?:\\+352)?(6|2(6|7|8|9))\\d{6})$/,\n LV: /^(?:(?:\\+371)?2\\d{7})$/,\n ME: /^(?:(?:\\+382)?[67]\\d{7,20})$/,\n MG: /^(?:(?:\\+261)?3[234568]\\d{7})$/,\n MZ: /^(?:(?:\\+258)|(?:258))?8[234567]\\d{7,8}$/,\n NL: /^(?:(?:\\+31)|0(6(?:\\d{8})|[1-9](?:(?:\\d{8})|(?:\\s\\d{3}\\s\\d{4}))|(?:\\d{8})))$/,\n PA: /^(?:(?:\\+507)\\s?)?[46]\\d{6,7}$/,\n PL: /^(?:(?:\\+48)?(?:\\s?\\d{3}\\s?\\d{3}\\s?\\d{3}|(?:\\d{2}\\s?){4}\\d{2}|\\d{3}-\\d{3}-\\d{3}))$/,\n PR: /^(?:(?:\\+1)?787|939)\\d{7}$/,\n PS: /^(?:(?:\\+970))(5[2349])\\d{7}$/,\n PT: /^(?:(?:\\+351)?9(1\\d|2[1-9]|6[12345789]|7[12345789])\\d{7})$/,\n PY: /^(?:(?:\\+595|0)9[9876]\\d{7})$/,\n RO: /^(?:(?:\\+40|0))(?:7[2-8]\\d{7}|21\\d{8})$/,\n RS: /^(?:(?:\\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/,\n RW: /^(?:(?:\\+250)|(0))\\d{9}$/,\n SI: /^(?:(?:\\+386)|0)?[1-59]\\d{7,8}$/,\n SK: /^(?:(?:\\+421))?(0|9[0-8])\\d{8}$/,\n SM: /^(?:(?:\\+378)|(0549|6\\d{4}))\\d{5}$/,\n SN: /^(?:(?:\\+221)|0)?[3679]\\d{7}$/,\n SR: /^(?:(?:\\+597))\\d{7}$/,\n TG: /^(?:(?:\\+228))\\d{8}$/,\n TJ: /^(?:(?:\\+992))(37|55|77)\\d{7}$/,\n TN: /^(?:(?:\\+216)|22|9[1-9])\\d{7}$/,\n TR: /^(?:(?:\\+90)|(0))\\s?5\\d{9}$/,\n TW: /^(?:(?:\\+886)|0)?9\\d{8}$/,\n UA: /^(?:(?:\\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\\d{7}$/,\n UG: /^(?:(?:\\+256)|0)?[39]\\d{8}$/,\n};\n","/* Source: Google LibPhoneNumber Metadata: https://github.com/google/libphonenumber/blob/master/javascript/i18n/phonenumbers/metadata.js */\n\nexport const DIAL_CODE_MAPPER: { [key: number]: string[] } = {\n 1: [\n 'US',\n 'AG',\n 'AI',\n 'AS',\n 'BB',\n 'BM',\n 'BS',\n 'CA',\n 'DM',\n 'DO',\n 'GD',\n 'GU',\n 'JM',\n 'KN',\n 'KY',\n 'LC',\n 'MP',\n 'MS',\n 'PR',\n 'SX',\n 'TC',\n 'TT',\n 'VC',\n 'VG',\n 'VI',\n ],\n 7: ['RU', 'KZ'],\n 20: ['EG'],\n 27: ['ZA'],\n 30: ['GR'],\n 31: ['NL'],\n 32: ['BE'],\n 33: ['FR'],\n 34: ['ES'],\n 36: ['HU'],\n 39: ['IT', 'VA'],\n 40: ['RO'],\n 41: ['CH'],\n 43: ['AT'],\n 44: ['GB', 'GG', 'IM', 'JE'],\n 45: ['DK'],\n 46: ['SE'],\n 47: ['NO', 'SJ'],\n 48: ['PL'],\n 49: ['DE'],\n 51: ['PE'],\n 52: ['MX'],\n 53: ['CU'],\n 54: ['AR'],\n 55: ['BR'],\n 56: ['CL'],\n 57: ['CO'],\n 58: ['VE'],\n 60: ['MY'],\n 61: ['AU', 'CC', 'CX'],\n 62: ['ID'],\n 63: ['PH'],\n 64: ['NZ'],\n 65: ['SG'],\n 66: ['TH'],\n 81: ['JP'],\n 82: ['KR'],\n 84: ['VN'],\n 86: ['CN'],\n 90: ['TR'],\n 91: ['IN'],\n 92: ['PK'],\n 93: ['AF'],\n 94: ['LK'],\n 95: ['MM'],\n 98: ['IR'],\n 211: ['SS'],\n 212: ['MA', 'EH'],\n 213: ['DZ'],\n 216: ['TN'],\n 218: ['LY'],\n 220: ['GM'],\n 221: ['SN'],\n 222: ['MR'],\n 223: ['ML'],\n 224: ['GN'],\n 225: ['CI'],\n 226: ['BF'],\n 227: ['NE'],\n 228: ['TG'],\n 229: ['BJ'],\n 230: ['MU'],\n 231: ['LR'],\n 232: ['SL'],\n 233: ['GH'],\n 234: ['NG'],\n 235: ['TD'],\n 236: ['CF'],\n 237: ['CM'],\n 238: ['CV'],\n 239: ['ST'],\n 240: ['GQ'],\n 241: ['GA'],\n 242: ['CG'],\n 243: ['CD'],\n 244: ['AO'],\n 245: ['GW'],\n 246: ['IO'],\n 247: ['AC'],\n 248: ['SC'],\n 249: ['SD'],\n 250: ['RW'],\n 251: ['ET'],\n 252: ['SO'],\n 253: ['DJ'],\n 254: ['KE'],\n 255: ['TZ'],\n 256: ['UG'],\n 257: ['BI'],\n 258: ['MZ'],\n 260: ['ZM'],\n 261: ['MG'],\n 262: ['RE', 'YT'],\n 263: ['ZW'],\n 264: ['NA'],\n 265: ['MW'],\n 266: ['LS'],\n 267: ['BW'],\n 268: ['SZ'],\n 269: ['KM'],\n 290: ['SH', 'TA'],\n 291: ['ER'],\n 297: ['AW'],\n 298: ['FO'],\n 299: ['GL'],\n 350: ['GI'],\n 351: ['PT'],\n 352: ['LU'],\n 353: ['IE'],\n 354: ['IS'],\n 355: ['AL'],\n 356: ['MT'],\n 357: ['CY'],\n 358: ['FI', 'AX'],\n 359: ['BG'],\n 370: ['LT'],\n 371: ['LV'],\n 372: ['EE'],\n 373: ['MD'],\n 374: ['AM'],\n 375: ['BY'],\n 376: ['AD'],\n 377: ['MC'],\n 378: ['SM'],\n 380: ['UA'],\n 381: ['RS'],\n 382: ['ME'],\n 383: ['XK'],\n 385: ['HR'],\n 386: ['SI'],\n 387: ['BA'],\n 389: ['MK'],\n 420: ['CZ'],\n 421: ['SK'],\n 423: ['LI'],\n 500: ['FK'],\n 501: ['BZ'],\n 502: ['GT'],\n 503: ['SV'],\n 504: ['HN'],\n 505: ['NI'],\n 506: ['CR'],\n 507: ['PA'],\n 508: ['PM'],\n 509: ['HT'],\n 590: ['GP', 'BL', 'MF'],\n 591: ['BO'],\n 592: ['GY'],\n 593: ['EC'],\n 594: ['GF'],\n 595: ['PY'],\n 596: ['MQ'],\n 597: ['SR'],\n 598: ['UY'],\n 599: ['CW', 'BQ'],\n 670: ['TL'],\n 672: ['NF'],\n 673: ['BN'],\n 674: ['NR'],\n 675: ['PG'],\n 676: ['TO'],\n 677: ['SB'],\n 678: ['VU'],\n 679: ['FJ'],\n 680: ['PW'],\n 681: ['WF'],\n 682: ['CK'],\n 683: ['NU'],\n 685: ['WS'],\n 686: ['KI'],\n 687: ['NC'],\n 688: ['TV'],\n 689: ['PF'],\n 690: ['TK'],\n 691: ['FM'],\n 692: ['MH'],\n 800: ['001'],\n 808: ['001'],\n 850: ['KP'],\n 852: ['HK'],\n 853: ['MO'],\n 855: ['KH'],\n 856: ['LA'],\n 870: ['001'],\n 878: ['001'],\n 880: ['BD'],\n 881: ['001'],\n 882: ['001'],\n 883: ['001'],\n 886: ['TW'],\n 888: ['001'],\n 960: ['MV'],\n 961: ['LB'],\n 962: ['JO'],\n 963: ['SY'],\n 964: ['IQ'],\n 965: ['KW'],\n 966: ['SA'],\n 967: ['YE'],\n 968: ['OM'],\n 970: ['PS'],\n 971: ['AE'],\n 972: ['IL'],\n 973: ['BH'],\n 974: ['QA'],\n 975: ['BT'],\n 976: ['MN'],\n 977: ['NP'],\n 979: ['001'],\n 992: ['TJ'],\n 993: ['TM'],\n 994: ['AZ'],\n 995: ['GE'],\n 996: ['KG'],\n 998: ['UZ'],\n};\n","import { DIAL_CODE_MAPPER } from './data/dialCodeMapper';\nimport { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\n\n/**\n * Determines the country code based on the provided phone number.\n * This function employs a multi-step approach to identify the country code:\n * - If the phone number starts with '+', it extracts the numeric characters\n * and matches the leading digits with known dial codes mapped to countries.\n * - For matched dial codes, it further filters based on country-specific regex patterns\n * to validate the phone number format for those countries.\n * - If the phone number doesn't start with '+', it directly matches the number\n * against regular expressions associated with various countries to identify the code.\n *\n * @param phoneNumber The input phone number (string or number).\n * @returns The detected country code or an empty string if not found.\n */\nexport const detectCountryCodeFromDialCode = (\n phoneNumber: string | number,\n): string => {\n // If the phone number starts with '+', extract numeric characters\n if (phoneNumber.toString().charAt(0) === '+') {\n const cleanedPhoneNumberWithoutPlusPrefix = phoneNumber\n .toString()\n .replace(/\\D/g, '');\n\n const matchingCountries: string[] = [];\n\n // Iterate through dial codes and check for matches with cleaned phone number\n for (const code in DIAL_CODE_MAPPER) {\n if (cleanedPhoneNumberWithoutPlusPrefix.startsWith(code)) {\n matchingCountries.push(...DIAL_CODE_MAPPER[code]);\n }\n }\n\n // Filter matching countries based on phone number validation regex\n const matchedCountryCode = matchingCountries.find((countryCode: string) => {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex && regex.test(phoneNumber.toString())) return countryCode;\n return undefined;\n });\n\n // Return the first matched country code, if any\n return matchedCountryCode || '';\n } else {\n // If phone number doesn't start with '+', directly match against country regexes\n for (const countryCode in PHONE_REGEX_MAPPER) {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex.test(phoneNumber.toString())) {\n return countryCode;\n }\n }\n }\n\n // Return empty string if no country code is detected\n return '';\n};\n\nexport const cleanPhoneNumber = (phoneNumber: string) => {\n // Regular expression to match all characters except numbers and + sign at the start\n const regex = /[^0-9+]|(?!A)\\+/g;\n // Replace matched characters with an empty string\n const cleanedPhoneNumber = phoneNumber.replace(regex, '');\n return phoneNumber[0] === '+' ? `+${cleanedPhoneNumber}` : cleanedPhoneNumber;\n};\n","import { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Validates whether a given phone number is valid based on the provided country code or auto-detects the country code and checks if the number matches the defined regex pattern for that country.\nconst isValidPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_REGEX_MAPPER,\n): boolean => {\n // Clean the provided phoneNumber by removing non-numeric characters\n const cleanedPhoneNumber = cleanPhoneNumber(phoneNumber.toString());\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_REGEX_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(cleanedPhoneNumber);\n\n // Return false if phoneNumber is empty\n if (!phoneNumber) return false;\n\n // Check if the countryCode exists in the PHONE_REGEX_MAPPER\n if (countryCode in PHONE_REGEX_MAPPER) {\n // Fetch the regex pattern for the countryCode\n const regex = PHONE_REGEX_MAPPER[countryCode];\n // Test if the cleanedPhoneNumber matches the regex pattern\n return regex.test(cleanedPhoneNumber as string);\n }\n\n // Return false if the countryCode is not supported\n return false;\n};\n\nexport default withErrorBoundary(isValidPhoneNumber);\n","export const PHONE_FORMATTER_MAPPER: { [key: string]: string } = {\n IN: 'xxxx xxxxxx',\n MY: 'xx xxxxx xx',\n AE: 'xx xxx xxxx',\n AL: 'xxx xx xxxx',\n AM: 'xx xx xx xx',\n AR: 'xxxx-xxxx',\n AU: 'xxx xxx xxx',\n AW: 'xxx-xxxx',\n BB: 'xxx-xxxx',\n BD: 'xxxx-xxxxxx',\n BM: 'xxx-xxxx',\n BN: 'xxxx-xxxx',\n BO: 'xxxx-xxxx',\n BS: 'xxx-xxxx',\n BW: 'xx xxxx xxxx',\n BZ: 'xxx-xxxx',\n CA: 'xxx-xxx-xxxx',\n CH: 'xxx xxx xxx',\n CN: 'xxxx-xxxxxxx',\n CO: 'xxxx-xxxxxxx',\n CR: 'xxxx-xxxx',\n CU: 'xxxx-xxxx',\n CZ: 'xxx xxx xxx',\n DK: 'xx xx xx xx',\n DO: 'xxx-xxxxxxx',\n DZ: 'xxxx-xxxx-xxx',\n EG: 'xx xxx xxxx',\n ET: 'xx xxx xxxx',\n EU: 'xxx xx xx xx',\n FJ: 'xxxx xxxx',\n GB: 'xxxx xxx xxx',\n GH: 'xxx xxx xxxx',\n GI: 'xxxx xxxx',\n GM: 'xxxx-xxxx',\n GT: 'xxxx-xxxx',\n GY: 'xxx-xxxx',\n HK: 'xxxx xxxx',\n HN: 'xxxx-xxxx',\n HR: 'xxx xxx xxxx',\n HT: 'xxx-xxxx',\n HU: 'xxx xxx xxxx',\n ID: 'xxxx-xxxx-xxxx',\n IL: 'xxxx-xxx-xxx',\n JM: 'xxx-xxxx',\n KE: 'xxx xxxxxx',\n KG: 'xxx-xx-xx-xx',\n KH: 'xxx-xxx-xxx',\n KY: 'xxx-xxxx',\n KZ: 'xxx-xxx-xx-xx',\n LA: 'xxx xx xxxx',\n LK: 'xx xxx xxxx',\n LR: 'xxx-xxx-xxxx',\n LS: 'xxx xx xxxx',\n LT: 'xxx xxxxx',\n LU: 'xxx xx xxx',\n LV: 'xxxx xxxx',\n MA: 'xxxx-xxxxxx',\n MD: 'xx xxxxxx',\n ME: 'xx xxxxxx',\n MG: 'xx xx xx xx xx',\n MK: 'xx xx xx xx',\n MM: 'xx xxxxxx',\n MN: 'xxx-xx-xxxx',\n MO: 'xxxx xxxx',\n MU: 'xx xxxx xxxx',\n MV: 'xxxxxx',\n MW: 'xx xxxx xxxx',\n MX: 'xxx-xxx-xxxx',\n MZ: 'xx xxxxxxx',\n NA: 'xx xxxx xxxx',\n NG: 'xxx xxx xxxx',\n NI: 'xxxx-xxxx',\n NL: 'xxx-xxxxxxx',\n NO: 'xxxx xxxx',\n NP: 'xxxx-xxxxxxx',\n NZ: 'xxx-xxxxxxx',\n OM: 'xxxx-xxxx',\n PA: 'xxx-xxxx',\n PE: 'xxx-xxx-xxx',\n PG: 'xxx-xxxxxx',\n PH: 'xxx-xxxx',\n PK: 'xxx-xxxxxxx',\n PL: 'xxx xxx xxx',\n PR: 'xxx-xxx-xxxx',\n PS: 'xxxx-xxxxxxx',\n PT: 'xxx xxx xxx',\n PY: 'xxx-xxxxxx',\n QA: 'xxxx xxxx',\n RO: 'xxx xxx xxxx',\n RS: 'xxx xxxxx',\n RU: 'xxx xxx-xx-xx',\n RW: 'xxx xxxxxx',\n SA: 'xxx-xxxxxxx',\n SC: 'xx xxxxx',\n SE: 'xxx-xxx xx xx',\n SG: 'xxxx xxxx',\n SI: 'xx xxxxxx',\n SK: 'xxx xxx xxx',\n SL: 'xxx-xxxxxx',\n SM: 'xxxxx xxxxx',\n SN: 'xx xxx xx xx',\n SO: 'xxx xxxxxxx',\n SR: 'xxx-xxxx',\n SS: 'xxx xxxx xxx',\n SV: 'xxxx-xxxx',\n SZ: 'xxx xx xxxx',\n TG: 'xx xx xx xx',\n TH: 'xxx-xxxxxxx',\n TJ: 'xxx xx xx xx',\n TL: 'xxx-xxxxxxx',\n TN: 'xx xxxxxx',\n TR: 'xxx xxx xx xx',\n TT: 'xxx-xxxx',\n TW: 'xxxx-xxxxxx',\n TZ: 'xxx xxx xxxx',\n UA: 'xx xxx xx xx',\n UG: 'xxx xxxxxxx',\n US: 'xxx-xxx-xxxx',\n UY: 'xxx-xxxxx',\n UZ: 'xxx-xxx-xx-xx',\n VC: 'xxx-xxxx',\n VE: 'xxxx-xxx-xxxx',\n VN: 'xxxx-xxxxxxx',\n YE: 'xxxx-xxxx',\n ZA: 'xxx-xxx-xxxx',\n ZM: 'xxx-xxxxxxx',\n ZW: 'xx xxx xxxx',\n KW: 'xxx xx xxxx',\n BH: 'xxxx xxxx',\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Formats a provided phone number according to the predefined format for a specific country code, or auto-detects the country code and formats the number accordingly.\nconst formatPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_FORMATTER_MAPPER,\n): string => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Convert phoneNumber to string and clean it by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_FORMATTER_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Fetch the pattern for the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern) return phoneNumber;\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n // Extract the phoneNumber without the prefix\n const phoneNumberWithoutPrefix = phoneNumber.slice(diff);\n const formattedNumber: string[] = [];\n let numberIndex = 0;\n\n // Loop through the pattern to format the phoneNumber\n for (let i = 0; i < pattern.length; i++) {\n const patternChar = pattern[i];\n if (patternChar === 'x') {\n // Insert phoneNumber digits at 'x' positions\n if (numberIndex < phoneNumberWithoutPrefix.length) {\n formattedNumber.push(phoneNumberWithoutPrefix[numberIndex]);\n numberIndex++;\n }\n } else {\n // Insert non-digit characters from the pattern\n formattedNumber.push(patternChar);\n }\n }\n\n // Join the formattedNumber array to create the formattedPhoneNumber without prefix\n const formattedPhoneNumberWithoutPrefix = formattedNumber.join('');\n // Combine the prefix and formattedPhoneNumberWithoutPrefix\n const formattedPhoneNumberWithPrefix =\n phoneNumber.slice(0, diff) + ' ' + formattedPhoneNumberWithoutPrefix;\n\n // Return the formattedPhoneNumber with prefix after trimming whitespace\n return formattedPhoneNumberWithPrefix.trim();\n};\n\nexport default withErrorBoundary(formatPhoneNumber);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport formatPhoneNumber from './formatPhoneNumber';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\ninterface PhoneInfo {\n countryCode: string;\n dialCode: string;\n formattedPhoneNumber: string;\n formatTemplate: string;\n}\n\n// Parses a given phone number, identifies its country code (if not provided), and returns an object with details including the country code, formatted phone number, dial code, and format template.\nconst parsePhoneNumber = (phoneNumber: string, country?: string): PhoneInfo => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Clean the phoneNumber by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n const countryCode =\n country && country in PHONE_FORMATTER_MAPPER\n ? country\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Format the phone number using the detected/validated country code\n const formattedPhoneNumber = formatPhoneNumber(phoneNumber, countryCode);\n\n // Fetch the pattern associated with the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern)\n return {\n countryCode: countryCode || '',\n dialCode: '',\n formattedPhoneNumber: phoneNumber,\n formatTemplate: '',\n };\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n\n // Extract the dialCode from the phoneNumber\n const dialCode = phoneNumber.slice(0, diff);\n\n // Obtain the format template associated with the countryCode\n const formatTemplate = PHONE_FORMATTER_MAPPER[countryCode];\n\n // Return the parsed phone number information\n return {\n countryCode,\n formattedPhoneNumber,\n dialCode,\n formatTemplate,\n };\n};\n\nexport default withErrorBoundary(parsePhoneNumber);\n","export const stringToDate = (dateString: string): Date => {\n const supportedDateFormats = [\n // Date formats\n {\n regex: /^(\\d{4})\\/(\\d{2})\\/(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY/MM/DD\n {\n regex: /^(\\d{2})\\/(\\d{2})\\/(\\d{4})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n }, // DD/MM/YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY.MM.DD\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // DD-MM-YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // MM/DD/YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY-MM-DD\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY. MM. DD.\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // DD.MM.YYYY\n\n // Timestamp formats\n {\n regex: /^(\\d{4})\\/(\\d{2})\\/(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY/MM/DD HH:MM:SS\n {\n regex: /^(\\d{2})\\/(\\d{2})\\/(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD/MM/YYYY HH:MM:SS\n {\n regex: /^(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY-MM-DD HH:MM:SS\n {\n regex: /^(\\d{2})-(\\d{2})-(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD-MM-YYYY HH:MM:SS\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY.MM.DD HH:MM:SS\n {\n regex: /^(\\d{2})\\.(\\d{2})\\.(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD.MM.YYYY HH:MM:SS\n ];\n\n for (const format of supportedDateFormats) {\n const match = dateString.match(format.regex);\n if (match) {\n const year = match[format.yearIndex];\n const month = match[format.monthIndex];\n const day = match[format.dayIndex];\n const hour = format.hourIndex ? match[format.hourIndex] : '00';\n const minute = format.minuteIndex ? match[format.minuteIndex] : '00';\n const second = format.secondIndex ? match[format.secondIndex] : '00';\n\n return new Date(`${year}-${month}-${day}T${hour}:${minute}:${second}`);\n }\n }\n\n throw new Error('Date format not recognized');\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Adds a specified amount of time to a date.\n *\n * @param date The original date.\n * @param value The amount to add.\n * @param unit The unit of time to add (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time added.\n */\nconst add = (\n date: DateInput,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n switch (unit) {\n case 'days':\n date.setDate(date.getDate() + value);\n break;\n case 'months':\n date.setMonth(date.getMonth() + value);\n break;\n case 'years':\n date.setFullYear(date.getFullYear() + value);\n break;\n }\n return date;\n};\n\nexport default withErrorBoundary(add);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Formats date and time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional).\n * @returns {string} Formatted date and time string.\n */\nconst formatDateTime = (\n date: DateInput,\n locale: Locale,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n const dateObj: Date = date instanceof Date ? date : new Date(date);\n let formatter;\n\n try {\n formatter = new Intl.DateTimeFormat(locale, intlOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formatter.format(dateObj);\n};\n\nexport default withErrorBoundary(formatDateTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n DateFormatOptions,\n} from './types';\n\n/**\n * Formats date based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional).\n * @returns {string} Formatted date string.\n */\nconst formatDate = (\n date: DateInput,\n locale: Locale,\n options: DateFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n timeStyle: undefined,\n };\n\n let formattedDate;\n\n try {\n formattedDate = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedDate;\n};\n\nexport default withErrorBoundary(formatDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n TimeFormatOptions,\n} from './types';\n\n/**\n * Formats time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional).\n * @returns {string} Formatted time string.\n */\nconst formatTime = (\n date: DateInput,\n locale: Locale,\n options: TimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n dateStyle: undefined,\n };\n\n let formattedTime;\n\n try {\n formattedTime = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedTime;\n};\n\nexport default withErrorBoundary(formatTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\n\n/**\n * Gets the first day of the week for a given locale.\n *\n * @param locale The locale to determine the first day of the week for.\n * @param intlOptions Optional Intl.DateTimeFormatOptions for customization.\n * @returns The first day of the week (0-6, where 0 is Sunday).\n */\nconst getFirstDayOfWeek = (\n locale: string,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n let formatted;\n\n if (!intlOptions.weekday) intlOptions.weekday = 'long';\n\n try {\n const formatter = new Intl.DateTimeFormat(locale, intlOptions);\n /**\n * This date was chosen because January 2, 2000, is a Sunday.\n * In the Gregorian calendar, Sunday is considered the start of the week in some cultures (like in the United States), while in others, it's Monday (like in much of Europe).\n * By using a date that is known to be a Sunday, the function can accurately determine what day of the week is considered the start in the specified locale.\n */\n const sundayDate = new Date(2000, 0, 2); // A known Sunday\n formatted = formatter.format(sundayDate);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n // Generate localized weekdays array starting from Sunday\n const weekdays = Array.from({ length: 7 }, (_, i) =>\n new Intl.DateTimeFormat(locale, intlOptions).format(\n new Date(2000, 0, 2 + i),\n ),\n );\n\n const firstDayIndex = weekdays.indexOf(formatted);\n if (firstDayIndex === -1) {\n throw new Error('Unable to determine the first day of the week');\n }\n\n return weekdays[(firstDayIndex + 1) % 7]; // Adjusting since our reference date is a Sunday\n};\n\nexport default withErrorBoundary(getFirstDayOfWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Determines the quarter of the year for a given date.\n *\n * @param date The date to determine the quarter for.\n * @returns The quarter of the year (1-4).\n */\nconst getQuarter = (date: DateInput): number => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n return Math.ceil((date.getMonth() + 1) / 3);\n};\n\nexport default withErrorBoundary(getQuarter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Provides a relative time string (e.g., '3 hours ago', 'in 2 days').\n * This function calculates the difference between the given date and the base date,\n * then formats it in a locale-sensitive manner. It allows customization of the output\n * through Intl.RelativeTimeFormat options.\n *\n * @param date - The date to compare.\n * @param baseDate - The date to compare against (default: current date).\n * @param locale - The locale to use for formatting.\n * @param options - Options for the Intl.RelativeTimeFormat (optional).\n * @returns The relative time as a string.\n */\nconst getRelativeTime = (\n date: DateInput,\n baseDate: DateInput = new Date(),\n locale: Locale,\n options?: Intl.RelativeTimeFormatOptions,\n): string => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n baseDate =\n typeof baseDate === 'string'\n ? new Date(stringToDate(baseDate))\n : new Date(baseDate);\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000;\n\n // Define time units in seconds\n const minute = 60;\n const hour = minute * 60;\n const day = hour * 24;\n const week = day * 7;\n const month = day * 30;\n const year = day * 365;\n\n let value: number;\n let unit: Intl.RelativeTimeFormatUnit;\n\n if (Math.abs(diffInSeconds) < minute) {\n value = diffInSeconds;\n unit = 'second';\n } else if (Math.abs(diffInSeconds) < hour) {\n value = diffInSeconds / minute;\n unit = 'minute';\n } else if (Math.abs(diffInSeconds) < day) {\n value = diffInSeconds / hour;\n unit = 'hour';\n } else if (Math.abs(diffInSeconds) < week) {\n value = diffInSeconds / day;\n unit = 'day';\n } else if (Math.abs(diffInSeconds) < month) {\n value = diffInSeconds / week;\n unit = 'week';\n } else if (Math.abs(diffInSeconds) < year) {\n value = diffInSeconds / month;\n unit = 'month';\n } else {\n value = diffInSeconds / year;\n unit = 'year';\n }\n\n let relativeTime;\n\n try {\n const rtf = new Intl.RelativeTimeFormat(locale, options);\n relativeTime = rtf.format(Math.round(value), unit);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return relativeTime;\n};\n\nexport default withErrorBoundary(getRelativeTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Calculates the week number of the year for a given date.\n *\n * @param date The date to calculate the week number for.\n * @returns The week number of the year.\n */\nconst getWeek = (date: DateInput): number => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n const firstDayOfYear = new Date(date.getFullYear(), 0, 1);\n const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000;\n return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7);\n};\n\nexport default withErrorBoundary(getWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Returns an array of weekdays according to the specified locale.\n *\n * @param locale The locale to get weekdays for.\n * @param intlOptions Optional Intl.DateTimeFormatOptions for customization.\n * @returns An array of weekday names.\n */\nconst getWeekdays = (\n locale: Locale,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string[] => {\n try {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n if (!intlOptions.weekday) intlOptions.weekday = 'long';\n\n const formatter = new Intl.DateTimeFormat(locale, intlOptions);\n\n /** The date January 1, 1970, is a well-known reference point in computing known as the Unix epoch.\n * It's the date at which time is measured for Unix systems, making it a consistent and reliable choice for date calculations.\n * The choice of the date January 4, 1970, as the starting point is significant.\n * January 4, 1970, was a Sunday.\n * Since weeks typically start on Sunday or Monday in most locales, starting from a known Sunday allows the function to cycle through a complete week, capturing all weekdays in the order they appear for the given locale.\n * */\n return Array.from({ length: 7 }, (_, i) =>\n formatter.format(new Date(1970, 0, 4 + i)),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(getWeekdays);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Compares two dates to determine if the first is after the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is after date2.\n */\nconst isAfter = (date1: DateInput, date2: DateInput): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 > dateObj2;\n};\n\nexport default withErrorBoundary(isAfter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Compares two dates to determine if the first is before the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is before date2.\n */\nconst isBefore = (date1: DateInput, date2: DateInput): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 < dateObj2;\n};\n\nexport default withErrorBoundary(isBefore);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given year is a leap year.\n *\n * @param year The year to check.\n * @returns True if the year is a leap year, false otherwise.\n */\nconst isLeapYear = (year: number): boolean => {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n};\n\nexport default withErrorBoundary(isLeapYear);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { stringToDate } from './utils';\n\n/**\n * Checks if two dates fall on the same day.\n *\n * @param date1 The first date.\n * @param date2 The second date.\n * @returns True if both dates are on the same day, false otherwise.\n */\nconst isSameDay = (date1: Date, date2: Date): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n return (\n date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear()\n );\n};\n\nexport default withErrorBoundary(isSameDay);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { stringToDate } from './utils';\n\n/**\n * Checks if a given object is a valid Date object.\n *\n * @param date The object to check.\n * @returns True if the object is a valid Date, false otherwise.\n */\nconst isValidDate = (date: any): boolean => {\n try {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return date instanceof Date && !isNaN(date.getTime());\n};\n\nexport default withErrorBoundary(isValidDate);\n","export const LOCALE_DATE_FORMATS: { [key: string]: string } = {\n 'ar-AE': 'DD/MM/YYYY', // Arabic (U.A.E.)\n 'sq-AL': 'DD.MM.YYYY', // Albanian (Albania)\n 'hy-AM': 'DD.MM.YYYY', // Armenian (Armenia)\n 'es-AR': 'DD/MM/YYYY', // Spanish (Argentina)\n 'en-AU': 'DD/MM/YYYY', // English (Australia)\n 'nl-AW': 'DD-MM-YYYY', // Dutch (Aruba)\n 'en-BB': 'MM/DD/YYYY', // English (Barbados)\n 'bn-BD': 'DD/MM/YYYY', // Bengali (Bangladesh)\n 'en-BM': 'MM/DD/YYYY', // English (Bermuda)\n 'ms-BN': 'DD/MM/YYYY', // Malay (Brunei)\n 'es-BO': 'DD/MM/YYYY', // Spanish (Bolivia)\n 'en-BS': 'MM/DD/YYYY', // English (Bahamas)\n 'en-BW': 'DD/MM/YYYY', // English (Botswana)\n 'en-BZ': 'MM/DD/YYYY', // English (Belize)\n 'en-CA': 'DD/MM/YYYY', // English (Canada)\n 'de-CH': 'DD.MM.YYYY', // German (Switzerland)\n 'zh-CN': 'YYYY/MM/DD', // Chinese (China)\n 'es-CO': 'DD/MM/YYYY', // Spanish (Colombia)\n 'es-CR': 'DD/MM/YYYY', // Spanish (Costa Rica)\n 'es-CU': 'DD/MM/YYYY', // Spanish (Cuba)\n 'cs-CZ': 'DD.MM.YYYY', // Czech (Czech Republic)\n 'da-DK': 'DD-MM-YYYY', // Danish (Denmark)\n 'es-DO': 'DD/MM/YYYY', // Spanish (Dominican Republic)\n 'ar-DZ': 'DD/MM/YYYY', // Arabic (Algeria)\n 'ar-EG': 'DD/MM/YYYY', // Arabic (Egypt)\n 'am-ET': 'DD/MM/YYYY', // Amharic (Ethiopia)\n 'en-EU': 'DD/MM/YYYY', // English (European Union)\n 'en-FJ': 'DD/MM/YYYY', // English (Fiji)\n 'en-GB': 'DD/MM/YYYY', // English (United Kingdom)\n 'en-GH': 'DD/MM/YYYY', // English (Ghana)\n 'en-GI': 'DD/MM/YYYY', // English (Gibraltar)\n 'en-GM': 'DD/MM/YYYY', // English (Gambia)\n 'es-GT': 'DD/MM/YYYY', // Spanish (Guatemala)\n 'en-GY': 'DD/MM/YYYY', // English (Guyana)\n 'en-HK': 'DD/MM/YYYY', // English (Hong Kong)\n 'es-HN': 'DD/MM/YYYY', // Spanish (Honduras)\n 'hr-HR': 'DD.MM.YYYY', // Croatian (Croatia)\n 'ht-HT': 'MM/DD/YYYY', // Haitian (Haiti)\n 'hu-HU': 'YYYY. MM. DD.', // Hungarian (Hungary)\n 'id-ID': 'DD/MM/YYYY', // Indonesian (Indonesia)\n 'he-IL': 'DD/MM/YYYY', // Hebrew (Israel)\n 'en-IN': 'DD-MM-YYYY', // English (India)\n 'en-JM': 'MM/DD/YYYY', // English (Jamaica)\n 'en-KE': 'DD/MM/YYYY', // English (Kenya)\n 'ky-KG': 'DD.MM.YYYY', // Kyrgyz (Kyrgyzstan)\n 'km-KH': 'DD/MM/YYYY', // Khmer (Cambodia)\n 'en-KY': 'MM/DD/YYYY', // English (Cayman Islands)\n 'kk-KZ': 'DD.MM.YYYY', // Kazakh (Kazakhstan)\n 'lo-LA': 'DD/MM/YYYY', // Lao (Laos)\n 'si-LK': 'YYYY-MM-DD', // Sinhala (Sri Lanka)\n 'en-LR': 'MM/DD/YYYY', // English (Liberia)\n 'en-LS': 'DD/MM/YYYY', // English (Lesotho)\n 'ar-MA': 'DD/MM/YYYY', // Arabic (Morocco)\n 'ro-MD': 'DD.MM.YYYY', // Romanian (Moldova)\n 'mk-MK': 'DD.MM.YYYY', // Macedonian (North Macedonia)\n 'my-MM': 'DD/MM/YYYY', // Burmese (Myanmar)\n 'mn-MN': 'YYYY.MM.DD', // Mongolian (Mongolia)\n 'zh-MO': 'DD/MM/YYYY', // Chinese (Macao)\n 'en-MU': 'DD/MM/YYYY', // English (Mauritius)\n 'dv-MV': 'DD/MM/YYYY', // Divehi (Maldives)\n 'en-MW': 'DD/MM/YYYY', // English (Malawi)\n 'es-MX': 'DD/MM/YYYY', // Spanish (Mexico)\n 'ms-MY': 'DD/MM/YYYY', // Malay (Malaysia)\n 'en-NA': 'DD/MM/YYYY', // English (Namibia)\n 'en-NG': 'DD/MM/YYYY', // English (Nigeria)\n 'es-NI': 'DD/MM/YYYY', // Spanish (Nicaragua)\n 'no-NO': 'DD.MM.YYYY', // Norwegian (Norway)\n 'ne-NP': 'YYYY/MM/DD', // Nepali (Nepal)\n 'en-NZ': 'DD/MM/YYYY', // English (New Zealand)\n 'es-PE': 'DD/MM/YYYY', // Spanish (Peru)\n 'en-PG': 'DD/MM/YYYY', // English (Papua New Guinea)\n 'en-PH': 'MM/DD/YYYY', // English (Philippines)\n 'en-PK': 'DD/MM/YYYY', // English (Pakistan)\n 'ar-QA': 'DD/MM/YYYY', // Arabic (Qatar)\n 'ru-RU': 'DD.MM.YYYY', // Russian (Russia)\n 'ar-SA': 'DD/MM/YYYY', // Arabic (Saudi Arabia)\n 'en-SC': 'DD/MM/YYYY', // English (Seychelles)\n 'sv-SE': 'YYYY-MM-DD', // Swedish (Sweden)\n 'en-SG': 'DD/MM/YYYY', // English (Singapore)\n 'en-SL': 'DD/MM/YYYY', // English (Sierra Leone)\n 'so-SO': 'DD/MM/YYYY', // Somali (Somalia)\n 'en-SS': 'DD/MM/YYYY', // English (South Sudan)\n 'es-SV': 'DD/MM/YYYY', // Spanish (El Salvador)\n 'en-SZ': 'DD/MM/YYYY', // English (Eswatini)\n 'th-TH': 'DD/MM/YYYY', // Thai (Thailand)\n 'en-TT': 'MM/DD/YYYY', // English (Trinidad and Tobago)\n 'sw-TZ': 'DD/MM/YYYY', // Swahili (Tanzania)\n 'en-US': 'MM/DD/YYYY', // English (United States)\n 'es-UY': 'DD/MM/YYYY', // Spanish (Uruguay)\n 'uz-UZ': 'DD/MM/YYYY', // Uzbek (Uzbekistan)\n 'ar-YE': 'DD/MM/YYYY', // Arabic (Yemen)\n 'en-ZA': 'YYYY/MM/DD', // English (South Africa)\n 'ar-KW': 'DD/MM/YYYY', // Arabic (Kuwait)\n 'ar-BH': 'DD/MM/YYYY', // Arabic (Bahrain)\n 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman)\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Parses a date string based on a specific format.\n *\n * @param dateString The date string to parse.\n * @param format The format to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDateWithFormat = (\n dateString: string,\n format: string,\n): Date | null => {\n // Determine the separator based on the format (supports '/', '.', or '-')\n const separator = format.includes('/')\n ? '/'\n : format.includes('.')\n ? '.'\n : '-';\n const formatParts = format.split(separator);\n const dateParts = dateString.split(separator).map((num) => parseInt(num, 10));\n\n let year: number = 0,\n month: number = 0,\n day: number = 0;\n let yearSet: boolean = false,\n monthSet: boolean = false,\n daySet: boolean = false;\n\n // Check for format and date string mismatch\n if (dateParts.length !== formatParts.length) {\n return null; // Mismatch between date string and format\n }\n\n formatParts.forEach((part, index) => {\n // Check for non-numeric values in date string\n if (isNaN(dateParts[index])) {\n return null; // Invalid date part\n }\n\n // Assign year, month, and day based on the format\n switch (part) {\n case 'DD':\n day = dateParts[index];\n daySet = true;\n break;\n case 'MM':\n month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date\n monthSet = true;\n break;\n case 'YYYY':\n year = dateParts[index];\n yearSet = true;\n break;\n }\n });\n\n // Validate and create the date only if all parts are set\n if (yearSet && monthSet && daySet) {\n const parsedDate = new Date(year, month, day);\n // Validate date to catch invalid dates like February 30th\n if (\n parsedDate.getFullYear() === year &&\n parsedDate.getMonth() === month &&\n parsedDate.getDate() === day\n ) {\n return parsedDate;\n }\n }\n return null; // Invalid date or incomplete date information\n};\n\nexport default withErrorBoundary(\n parseDateWithFormat,\n);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { LOCALE_DATE_FORMATS } from './data/localeDateFormats';\nimport parseDateWithFormat from './parseDateWithFormat';\nimport { Locale } from './types';\n\n/**\n * Attempts to parse a string into a date object based on locale.\n * Uses the localeDateFormats mapping for determining the date format.\n *\n * @param dateString - The date string to parse.\n * @param locale - The locale to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDate = (dateString: string, locale: Locale): Date | null => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const format = LOCALE_DATE_FORMATS[locale];\n if (!format) {\n throw new Error(`No date format found for locale: ${locale}`);\n }\n return parseDateWithFormat(dateString, format);\n};\n\nexport default withErrorBoundary(parseDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport add from './add';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Subtracts a specified amount of time from a date.\n *\n * @param date The original date.\n * @param value The amount to subtract.\n * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time subtracted.\n */\nconst subtract = (\n date: DateInput,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n return add(date, -value, unit); // Reuse the add function with negative value\n};\n\nexport default withErrorBoundary(subtract);\n"],"names":["formatPhoneNumber","formatDateTime","parseDateWithFormat","add"],"mappings":";;;;;;IAAA;IACM,MAAO,YAAa,SAAQ,KAAK,CAAA;IAErC,IAAA,WAAA,CAAY,OAA2B,EAAA;YACrC,KAAK,CAAC,OAAO,CAAC,CAAC;IACf,QAAA,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC5B,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;;SAE7B;IACF,CAAA;IAED;;;;;;;;IAQG;IACI,MAAM,iBAAiB,GAAG,CAC/B,EAAK,KAC0C;QAC/C,OAAO,UAAyB,GAAG,IAAmB,EAAA;YACpD,IAAI;gBACF,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAkB,CAAC;IACh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mB,SAAS,CAAC;;ICzB7D;;;;;;;IAOG;IACH,MAAM,QAAQ,GAAG,CACf,IAAe,EACf,KAAa,EACb,IAAiC,KACzB;QACR,IAAI;YACF,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;QAE3E,OAAOC,KAAG,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC,CAAC;AAEF,qBAAe,iBAAiB,CAAkB,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/lib/umd/index.min.js b/lib/umd/index.min.js index d7a095a6..2209db13 100644 --- a/lib/umd/index.min.js +++ b/lib/umd/index.min.js @@ -1,2 +1,2 @@ -!function(x,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((x="undefined"!=typeof globalThis?globalThis:x||self).i18nify={})}(this,(function(x){"use strict";class e extends Error{constructor(x){super(x),this.name="i18nify Error",this.timestamp=new Date}}const n=x=>function(...n){try{return x.call(this,...n)}catch(x){throw console.warn("[I18N Error]: ",x),new e(x)}};class a{constructor(){this.state={locale:"",direction:"",country:""}}static getInstance(){return a.instance||(a.instance=new a),a.instance}static resetInstance(){a.instance=void 0}getState(){return Object.assign({},this.state)}setState(x){this.state=Object.assign(Object.assign({},this.state),x)}resetState(){this.state={locale:"",direction:"",country:""}}}var r=a.getInstance();var t=n((()=>r.getState()));var o=n((x=>{r.setState(x)}));var Y=n((()=>{r.resetState()}));const s=()=>{if("undefined"==typeof navigator)return"en-IN";if(window.Intl&&"object"==typeof window.Intl&&(window.navigator.languages||window.navigator.language)){return(window.navigator.languages||[window.navigator.language])[0]}return"en-IN"},M=(x={})=>{let e=(null==x?void 0:x.locale)||r.getState().locale;e||(e=s());const n=(null==x?void 0:x.intlOptions)?Object.assign({},x.intlOptions):{};if(((null==x?void 0:x.currency)||n.currency)&&(n.style="currency",n.currency=x.currency||n.currency),!e)throw new Error("Pass valid locale !");return new Intl.NumberFormat(e||void 0,n)};var i=n(((x,e={})=>{if(!Number(x)&&0!==Number(x))throw new Error("Parameter `amount` is not a number!");let n="";try{n=M(e).format(Number(x))}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return n}));const D={AED:{symbol:"د.إ",name:"United Arab Emirates Dirham"},ALL:{symbol:"Lek",name:"Albanian Lek"},AMD:{symbol:"֏",name:"Armenian Dram"},ARS:{symbol:"ARS",name:"Argentine Peso"},AUD:{symbol:"A$",name:"Australian Dollar"},AWG:{symbol:"Afl.",name:"Aruban Florin"},BBD:{symbol:"$",name:"Barbadian Dollar"},BDT:{symbol:"৳",name:"Bangladeshi Taka"},BMD:{symbol:"$",name:"Bermudian Dollar"},BND:{symbol:"BND",name:"Brunei Dollar"},BOB:{symbol:"Bs",name:"Bolivian Boliviano"},BSD:{symbol:"B$",name:"Bahamian Dollar"},BWP:{symbol:"P",name:"Botswanan Pula"},BZD:{symbol:"BZ$",name:"Belize Dollar"},CAD:{symbol:"C$",name:"Canadian Dollar"},CHF:{symbol:"CHf",name:"Swiss Franc"},CNY:{symbol:"¥",name:"Chinese Yuan"},COP:{symbol:"COL$",name:"Colombian Peso"},CRC:{symbol:"₡",name:"Costa Rican Colón"},CUP:{symbol:"$MN",name:"Cuban Peso"},CZK:{symbol:"Kč",name:"Czech Koruna"},DKK:{symbol:"DKK",name:"Danish Krone"},DOP:{symbol:"RD$",name:"Dominican Peso"},DZD:{symbol:"د.ج",name:"Algerian Dinar"},EGP:{symbol:"E£",name:"Egyptian Pound"},ETB:{symbol:"ብር",name:"Ethiopian Birr"},EUR:{symbol:"€",name:"Euro"},FJD:{symbol:"FJ$",name:"Fijian Dollar"},GBP:{symbol:"£",name:"British Pound"},GHS:{symbol:"GH₵",name:"Ghanaian Cedi"},GIP:{symbol:"GIP",name:"Gibraltar Pound"},GMD:{symbol:"D",name:"Gambian Dalasi"},GTQ:{symbol:"Q",name:"Guatemalan Quetzal"},GYD:{symbol:"G$",name:"Guyanese Dollar"},HKD:{symbol:"HK$",name:"Hong Kong Dollar"},HNL:{symbol:"HNL",name:"Honduran Lempira"},HRK:{symbol:"kn",name:"Croatian Kuna"},HTG:{symbol:"G",name:"Haitian Gourde"},HUF:{symbol:"Ft",name:"Hungarian Forint"},IDR:{symbol:"Rp",name:"Indonesian Rupiah"},ILS:{symbol:"₪",name:"Israeli New Shekel"},INR:{symbol:"₹",name:"Indian Rupee"},JMD:{symbol:"J$",name:"Jamaican Dollar"},KES:{symbol:"Ksh",name:"Kenyan Shilling"},KGS:{symbol:"Лв",name:"Kyrgystani Som"},KHR:{symbol:"៛",name:"Cambodian Riel"},KYD:{symbol:"CI$",name:"Cayman Islands Dollar"},KZT:{symbol:"₸",name:"Kazakhstani Tenge"},LAK:{symbol:"₭",name:"Laotian Kip"},LKR:{symbol:"රු",name:"Sri Lankan Rupee"},LRD:{symbol:"L$",name:"Liberian Dollar"},LSL:{symbol:"LSL",name:"Lesotho Loti"},MAD:{symbol:"د.م.",name:"Moroccan Dirham"},MDL:{symbol:"MDL",name:"Moldovan Leu"},MKD:{symbol:"ден",name:"Macedonian Denar"},MMK:{symbol:"MMK",name:"Myanmar Kyat"},MNT:{symbol:"₮",name:"Mongolian Tugrik"},MOP:{symbol:"MOP$",name:"Macanese Pataca"},MUR:{symbol:"₨",name:"Mauritian Rupee"},MVR:{symbol:"Rf",name:"Maldivian Rufiyaa"},MWK:{symbol:"MK",name:"Malawian Kwacha"},MXN:{symbol:"Mex$",name:"Mexican Peso"},MYR:{symbol:"RM",name:"Malaysian Ringgit"},NAD:{symbol:"N$",name:"Namibian Dollar"},NGN:{symbol:"₦",name:"Nigerian Naira"},NIO:{symbol:"NIO",name:"Nicaraguan Córdoba"},NOK:{symbol:"NOK",name:"Norwegian Krone"},NPR:{symbol:"रू",name:"Nepalese Rupee"},NZD:{symbol:"NZ$",name:"New Zealand Dollar"},PEN:{symbol:"S/",name:"Peruvian Nuevo Sol"},PGK:{symbol:"PGK",name:"Papua New Guinean Kina"},PHP:{symbol:"₱",name:"Philippine Peso"},PKR:{symbol:"₨",name:"Pakistani Rupee"},QAR:{symbol:"QR",name:"Qatari Riyal"},RUB:{symbol:"₽",name:"Russian Ruble"},SAR:{symbol:"SR",name:"Saudi Riyal"},SCR:{symbol:"SRe",name:"Seychellois Rupee"},SEK:{symbol:"SEK",name:"Swedish Krona"},SGD:{symbol:"S$",name:"Singapore Dollar"},SLL:{symbol:"Le",name:"Sierra Leonean Leone"},SOS:{symbol:"Sh.so.",name:"Somali Shilling"},SSP:{symbol:"SS£",name:"South Sudanese Pound"},SVC:{symbol:"₡",name:"Salvadoran Colón"},SZL:{symbol:"E",name:"Swazi Lilangeni"},THB:{symbol:"฿",name:"Thai Baht"},TTD:{symbol:"TT$",name:"Trinidad and Tobago Dollar"},TZS:{symbol:"Sh",name:"Tanzanian Shilling"},USD:{symbol:"$",name:"United States Dollar"},UYU:{symbol:"$U",name:"Uruguayan Peso"},UZS:{symbol:"so'm",name:"Uzbekistani Som"},YER:{symbol:"﷼",name:"Yemeni Rial"},ZAR:{symbol:"R",name:"South African Rand"},KWD:{symbol:"د.ك",name:"Kuwaiti Dinar"},BHD:{symbol:"د.ب.",name:"Bahraini Dinar"},OMR:{symbol:"ر.ع.",name:"Omani Rial"}};var l=n((()=>D));var m=n((x=>{var e;if(x in D)return null===(e=D[x])||void 0===e?void 0:e.symbol;throw new Error("Invalid currencyCode!")}));const d=["nan","infinity","percent","integer","group","decimal","fraction","plusSign","minusSign","percentSign","currency","code","symbol","name","compact","exponentInteger","exponentMinusSign","exponentSeparator","unit"];var c=n(((x,e={})=>{if(!Number(x)&&0!==Number(x))throw new Error("Parameter `amount` is not a number!");try{const n=M(e).formatToParts(Number(x)),a={};return n.forEach((x=>{"group"===x.type?a.integer=(a.integer||"")+x.value:-1!=d.findIndex((e=>e===x.type))&&(a[x.type]=(a[x.type]||"")+x.value)})),Object.assign(Object.assign({},a),{isPrefixSymbol:"currency"===n[0].type,rawParts:n})}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}}));const u={IN:/^(?:(?:\+|0{0,2})91\s*[-]?\s*|[0]?)?[6789]\d{9}$/,MY:/^(\+?6?0)?(\d{1,3})[-. ]?(\d{7,8})$/,AE:/^(?:\+?971|0)?(?:2|3|4|6|7|9)\d{8}$/,AL:/^(?:\+?355)?(?:[4-9]\d{7}|6\d{8})$/,AM:/^(?:\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/,AR:/^(?:(?:\+|0{0,2})54)?(?:11|[2368]\d)(?:(?=\d{0,2}15)\d{2})??\d{8}$/,AU:/^(?:\+?61|0)4\d{8}$/,AW:/^(?:(?:\+297)?(?!0)\d{7})$/,BB:/^(?:(?:\+1)?246)?(?:\d{3})?\d{7}$/,BD:/^(?:\+?880|0)1[13456789]\d{8}$/,BM:/^(?:(?:\+1)?441)?(?:\d{2})?\d{7}$/,BN:/^(?:\+?673)?(?:\d{3})?\d{4}$/,BO:/^(?:(?:\+|0{0,2})591)?(?:(?:2|3|7|6)\d{7})$/,BS:/^(?:(?:\+1)?242)?(?:\d{3})?\d{7}$/,BW:/^(?:(?:\+267)?\s?)?[74]\d{7}$/,BZ:/^(?:(?:\+501)?\s?)?[622]\d{4}$/,CH:/^(?:(?:\+41|0)(?:\s*\(?0\)?\s*))?(?:\d{2}\s*)?\d{3}\s*\d{2}\s*\d{2}$/,CN:/^(?:(?:\+|00)86)?1\d{10}$/,CO:/^(?:(?:\+57|0057)?)?[1-8]{1}\d{6,7}$/,OM:/^(?:\+?968)?(?:95|96|97|98)\d{6}$/,CR:/^(?:(?:\+506)?\s*|0)?[1-9]\d{7}$/,CU:/^(?:\+?53)?(?:[5-8]\d{7})$/,CZ:/^(?:\+?420)?(?:\d{9})$/,DK:/^(?:\+?45)?(?:\d{8})$/,D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?:(?:\+351)?9(1\d|2[1-9]|6[12345789]|7[12345789])\d{7})$/,PY:/^(?:(?:\+595|0)9[9876]\d{7})$/,RO:/^(?:(?:\+40|0))(?:7[2-8]\d{7}|21\d{8})$/,RS:/^(?:(?:\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/,RW:/^(?:(?:\+250)|(0))\d{9}$/,SI:/^(?:(?:\+386)|0)?[1-59]\d{7,8}$/,SK:/^(?:(?:\+421))?(0|9[0-8])\d{8}$/,SM:/^(?:(?:\+378)|(0549|6\d{4}))\d{5}$/,SN:/^(?:(?:\+221)|0)?[3679]\d{7}$/,SR:/^(?:(?:\+597))\d{7}$/,TG:/^(?:(?:\+228))\d{8}$/,TJ:/^(?:(?:\+992))(37|55|77)\d{7}$/,TN:/^(?:(?:\+216)|22|9[1-9])\d{7}$/,TR:/^(?:(?:\+90)|(0))\s?5\d{9}$/,TW:/^(?:(?:\+886)|0)?9\d{8}$/,UA:/^(?:(?:\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\d{7}$/,UG:/^(?:(?:\+256)|0)?[39]\d{8}$/},S={1:["US","AG","AI","AS","BB","BM","BS","CA","DM","DO","GD","GU","JM","KN","KY","LC","MP","MS","PR","SX","TC","TT","VC","VG","VI"],7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT","VA"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH","TA"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],380:["UA"],381:["RS"],382:["ME"],383:["XK"],385:["HR"],386:["SI"],387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],691:["FM"],692:["MH"],800:["001"],808:["001"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],870:["001"],878:["001"],880:["BD"],881:["001"],882:["001"],883:["001"],886:["TW"],888:["001"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],979:["001"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},y=x=>{if("+"===x.toString().charAt(0)){const e=x.toString().replace(/\D/g,""),n=[];for(const x in S)e.startsWith(x)&&n.push(...S[x]);return n.find((e=>{const n=u[e];if(n&&n.test(x.toString()))return e}))||""}for(const e in u){if(u[e].test(x.toString()))return e}return""},$=x=>{const e=x.replace(/[^0-9+]|(?!A)\+/g,"");return"+"===x[0]?`+${e}`:e};var b=n(((x,e)=>{const n=$(x.toString());if(e=e&&e in u?e:y(n),!x)return!1;if(e in u){return u[e].test(n)}return!1}));const g={IN:"xxxx xxxxxx",MY:"xx xxxxx xx",AE:"xx xxx xxxx",AL:"xxx xx xxxx",AM:"xx xx xx xx",AR:"xxxx-xxxx",AU:"xxx xxx xxx",AW:"xxx-xxxx",BB:"xxx-xxxx",BD:"xxxx-xxxxxx",BM:"xxx-xxxx",BN:"xxxx-xxxx",BO:"xxxx-xxxx",BS:"xxx-xxxx",BW:"xx xxxx xxxx",BZ:"xxx-xxxx",CA:"xxx-xxx-xxxx",CH:"xxx xxx xxx",CN:"xxxx-xxxxxxx",CO:"xxxx-xxxxxxx",CR:"xxxx-xxxx",CU:"xxxx-xxxx",CZ:"xxx xxx xxx",DK:"xx xx xx xx",DO:"xxx-xxxxxxx",DZ:"xxxx-xxxx-xxx",EG:"xx xxx xxxx",ET:"xx xxx xxxx",EU:"xxx xx xx xx",FJ:"xxxx xxxx",GB:"xxxx xxx xxx",GH:"xxx xxx xxxx",GI:"xxxx xxxx",GM:"xxxx-xxxx",GT:"xxxx-xxxx",GY:"xxx-xxxx",HK:"xxxx xxxx",HN:"xxxx-xxxx",HR:"xxx xxx xxxx",HT:"xxx-xxxx",HU:"xxx xxx xxxx",ID:"xxxx-xxxx-xxxx",IL:"xxxx-xxx-xxx",JM:"xxx-xxxx",KE:"xxx xxxxxx",KG:"xxx-xx-xx-xx",KH:"xxx-xxx-xxx",KY:"xxx-xxxx",KZ:"xxx-xxx-xx-xx",LA:"xxx xx xxxx",LK:"xx xxx xxxx",LR:"xxx-xxx-xxxx",LS:"xxx xx xxxx",LT:"xxx xxxxx",LU:"xxx xx xxx",LV:"xxxx xxxx",MA:"xxxx-xxxxxx",MD:"xx xxxxxx",ME:"xx xxxxxx",MG:"xx xx xx xx xx",MK:"xx xx xx xx",MM:"xx xxxxxx",MN:"xxx-xx-xxxx",MO:"xxxx xxxx",MU:"xx xxxx xxxx",MV:"xxxxxx",MW:"xx xxxx xxxx",MX:"xxx-xxx-xxxx",MZ:"xx xxxxxxx",NA:"xx xxxx xxxx",NG:"xxx xxx xxxx",NI:"xxxx-xxxx",NL:"xxx-xxxxxxx",NO:"xxxx xxxx",NP:"xxxx-xxxxxxx",NZ:"xxx-xxxxxxx",OM:"xxxx-xxxx",PA:"xxx-xxxx",PE:"xxx-xxx-xxx",PG:"xxx-xxxxxx",PH:"xxx-xxxx",PK:"xxx-xxxxxxx",PL:"xxx xxx xxx",PR:"xxx-xxx-xxxx",PS:"xxxx-xxxxxxx",PT:"xxx xxx xxx",PY:"xxx-xxxxxx",QA:"xxxx xxxx",RO:"xxx xxx xxxx",RS:"xxx xxxxx",RU:"xxx xxx-xx-xx",RW:"xxx xxxxxx",SA:"xxx-xxxxxxx",SC:"xx xxxxx",SE:"xxx-xxx xx xx",SG:"xxxx xxxx",SI:"xx xxxxxx",SK:"xxx xxx xxx",SL:"xxx-xxxxxx",SM:"xxxxx xxxxx",SN:"xx xxx xx xx",SO:"xxx xxxxxxx",SR:"xxx-xxxx",SS:"xxx xxxx xxx",SV:"xxxx-xxxx",SZ:"xxx xx xxxx",TG:"xx xx xx xx",TH:"xxx-xxxxxxx",TJ:"xxx xx xx xx",TL:"xxx-xxxxxxx",TN:"xx xxxxxx",TR:"xxx xxx xx xx",TT:"xxx-xxxx",TW:"xxxx-xxxxxx",TZ:"xxx xxx xxxx",UA:"xx xxx xx xx",UG:"xxx xxxxxxx",US:"xxx-xxx-xxxx",UY:"xxx-xxxxx",UZ:"xxx-xxx-xx-xx",VC:"xxx-xxxx",VE:"xxxx-xxx-xxxx",VN:"xxxx-xxxxxxx",YE:"xxxx-xxxx",ZA:"xxx-xxx-xxxx",ZM:"xxx-xxxxxxx",ZW:"xx xxx xxxx",KW:"xxx xx xxxx",BH:"xxxx xxxx"};var h=n(((x,e)=>{if(!x)throw new Error("Parameter `phoneNumber` is invalid!");x=x.toString(),x=$(x),e=e&&e in g?e:y(x);const n=g[e];if(!n)return x;let a=0;for(let x=0;x{if(!x)throw new Error("Parameter `phoneNumber` is invalid!");x=x.toString(),x=$(x);const n=e&&e in g?e:y(x),a=h(x,n),r=g[n];if(!r)return{countryCode:n||"",dialCode:"",formattedPhoneNumber:x,formatTemplate:""};let t=0;for(let x=0;x{const a=new Date(x);switch(n){case"days":a.setDate(a.getDate()+e);break;case"months":a.setMonth(a.getMonth()+e);break;case"years":a.setFullYear(a.getFullYear()+e)}return a}));var E=n(((x,e,n={})=>{e||(e=r.getState().locale||s());const a=x instanceof Date?x:new Date(x);let t;try{t=new Intl.DateTimeFormat(e,n)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return t.format(a)}));var T=n(((x,e,n={})=>{e||(e=r.getState().locale||s());const a=Object.assign(Object.assign({},n),{timeStyle:void 0});let t;try{t=E(x,e,a)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return t}));var K=n(((x,e,n={})=>{e||(e=r.getState().locale||s());const a=Object.assign(Object.assign({},n),{dateStyle:void 0});let t;try{t=E(x,e,a)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return t}));var w=n((x=>{let e;x||(x=r.getState().locale||s());try{const n=new Intl.DateTimeFormat(x,{weekday:"short"}),a=new Date(2e3,0,2);e=n.format(a)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return["su","mo","tu","we","th","fr","sa"].indexOf(e.slice(0,2).toLowerCase())}));var R=n((x=>Math.ceil((x.getMonth()+1)/3)));var f=n(((x,e=new Date,n,a)=>{n||(n=r.getState().locale||s());const t=(x.getTime()-e.getTime())/1e3,o=3600,Y=86400,M=7*Y,i=30*Y,D=365*Y;let l,m,d;Math.abs(t)<60?(l=t,m="second"):Math.abs(t){const e=new Date(x.getFullYear(),0,1),n=(x.getTime()-e.getTime())/864e5;return Math.ceil((n+e.getDay()+1)/7)}));var P=n((x=>{try{x||(x=r.getState().locale||s());const e=new Intl.DateTimeFormat(x,{weekday:"long"});return Array.from({length:7},((x,n)=>e.format(new Date(1970,0,4+n))))}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}}));var B=n(((x,e)=>(x instanceof Date?x:new Date(x))>(e instanceof Date?e:new Date(e))));var C=n(((x,e)=>(x instanceof Date?x:new Date(x))<(e instanceof Date?e:new Date(e))));var L=n((x=>x%4==0&&x%100!=0||x%400==0));var H=n(((x,e)=>x.getDate()===e.getDate()&&x.getMonth()===e.getMonth()&&x.getFullYear()===e.getFullYear()));var I=n((x=>x instanceof Date&&!isNaN(x.getTime())));const O={"ar-AE":"DD/MM/YYYY","sq-AL":"DD.MM.YYYY","hy-AM":"DD.MM.YYYY","es-AR":"DD/MM/YYYY","en-AU":"DD/MM/YYYY","nl-AW":"DD-MM-YYYY","en-BB":"MM/DD/YYYY","bn-BD":"DD/MM/YYYY","en-BM":"MM/DD/YYYY","ms-BN":"DD/MM/YYYY","es-BO":"DD/MM/YYYY","en-BS":"MM/DD/YYYY","en-BW":"DD/MM/YYYY","en-BZ":"MM/DD/YYYY","en-CA":"DD/MM/YYYY","de-CH":"DD.MM.YYYY","zh-CN":"YYYY/MM/DD","es-CO":"DD/MM/YYYY","es-CR":"DD/MM/YYYY","es-CU":"DD/MM/YYYY","cs-CZ":"DD.MM.YYYY","da-DK":"DD-MM-YYYY","es-DO":"DD/MM/YYYY","ar-DZ":"DD/MM/YYYY","ar-EG":"DD/MM/YYYY","am-ET":"DD/MM/YYYY","en-EU":"DD/MM/YYYY","en-FJ":"DD/MM/YYYY","en-GB":"DD/MM/YYYY","en-GH":"DD/MM/YYYY","en-GI":"DD/MM/YYYY","en-GM":"DD/MM/YYYY","es-GT":"DD/MM/YYYY","en-GY":"DD/MM/YYYY","en-HK":"DD/MM/YYYY","es-HN":"DD/MM/YYYY","hr-HR":"DD.MM.YYYY","ht-HT":"MM/DD/YYYY","hu-HU":"YYYY. MM. DD.","id-ID":"DD/MM/YYYY","he-IL":"DD/MM/YYYY","en-IN":"DD-MM-YYYY","en-JM":"MM/DD/YYYY","en-KE":"DD/MM/YYYY","ky-KG":"DD.MM.YYYY","km-KH":"DD/MM/YYYY","en-KY":"MM/DD/YYYY","kk-KZ":"DD.MM.YYYY","lo-LA":"DD/MM/YYYY","si-LK":"YYYY-MM-DD","en-LR":"MM/DD/YYYY","en-LS":"DD/MM/YYYY","ar-MA":"DD/MM/YYYY","ro-MD":"DD.MM.YYYY","mk-MK":"DD.MM.YYYY","my-MM":"DD/MM/YYYY","mn-MN":"YYYY.MM.DD","zh-MO":"DD/MM/YYYY","en-MU":"DD/MM/YYYY","dv-MV":"DD/MM/YYYY","en-MW":"DD/MM/YYYY","es-MX":"DD/MM/YYYY","ms-MY":"DD/MM/YYYY","en-NA":"DD/MM/YYYY","en-NG":"DD/MM/YYYY","es-NI":"DD/MM/YYYY","no-NO":"DD.MM.YYYY","ne-NP":"YYYY/MM/DD","en-NZ":"DD/MM/YYYY","es-PE":"DD/MM/YYYY","en-PG":"DD/MM/YYYY","en-PH":"MM/DD/YYYY","en-PK":"DD/MM/YYYY","ar-QA":"DD/MM/YYYY","ru-RU":"DD.MM.YYYY","ar-SA":"DD/MM/YYYY","en-SC":"DD/MM/YYYY","sv-SE":"YYYY-MM-DD","en-SG":"DD/MM/YYYY","en-SL":"DD/MM/YYYY","so-SO":"DD/MM/YYYY","en-SS":"DD/MM/YYYY","es-SV":"DD/MM/YYYY","en-SZ":"DD/MM/YYYY","th-TH":"DD/MM/YYYY","en-TT":"MM/DD/YYYY","sw-TZ":"DD/MM/YYYY","en-US":"MM/DD/YYYY","es-UY":"DD/MM/YYYY","uz-UZ":"DD/MM/YYYY","ar-YE":"DD/MM/YYYY","en-ZA":"YYYY/MM/DD","ar-KW":"DD/MM/YYYY","ar-BH":"DD/MM/YYYY","ar-OM":"DD/MM/YYYY"};var U=n(((x,e)=>{const n=e.includes("/")?"/":e.includes(".")?".":"-",a=e.split(n),r=x.split(n).map((x=>parseInt(x,10)));let t=0,o=0,Y=0,s=!1,M=!1,i=!1;if(r.length!==a.length)return null;if(a.forEach(((x,e)=>{if(isNaN(r[e]))return null;switch(x){case"DD":Y=r[e],i=!0;break;case"MM":o=r[e]-1,M=!0;break;case"YYYY":t=r[e],s=!0}})),s&&M&&i){const x=new Date(t,o,Y);if(x.getFullYear()===t&&x.getMonth()===o&&x.getDate()===Y)return x}return null}));var p=n(((x,e)=>{e||(e=r.getState().locale||s());const n=O[e];if(!n)throw new Error(`No date format found for locale: ${e}`);return U(x,n)}));var v=n(((x,e,n)=>A(x,-e,n)));x.add=A,x.formatDate=T,x.formatDateTime=E,x.formatNumber=i,x.formatNumberByParts=c,x.formatPhoneNumber=h,x.formatTime=K,x.getCurrencyList=l,x.getCurrencySymbol=m,x.getFirstDayOfWeek=w,x.getQuarter=R,x.getRelativeTime=f,x.getState=t,x.getWeek=G,x.getWeekdays=P,x.isAfter=B,x.isBefore=C,x.isLeapYear=L,x.isSameDay=H,x.isValidDate=I,x.isValidPhoneNumber=b,x.parseDate=p,x.parsePhoneNumber=N,x.resetState=Y,x.setState=o,x.subtract=v})); +!function(x,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((x="undefined"!=typeof globalThis?globalThis:x||self).i18nify={})}(this,(function(x){"use strict";class e extends Error{constructor(x){super(x),this.name="i18nify Error",this.timestamp=new Date}}const n=x=>function(...n){try{return x.call(this,...n)}catch(x){throw console.warn("[I18N Error]: ",x),new e(x)}};class a{constructor(){this.state={locale:"",direction:"",country:""}}static getInstance(){return a.instance||(a.instance=new a),a.instance}static resetInstance(){a.instance=void 0}getState(){return Object.assign({},this.state)}setState(x){this.state=Object.assign(Object.assign({},this.state),x)}resetState(){this.state={locale:"",direction:"",country:""}}}var r=a.getInstance();var t=n((()=>r.getState()));var o=n((x=>{r.setState(x)}));var d=n((()=>{r.resetState()}));const s=()=>{if("undefined"==typeof navigator)return"en-IN";if(window.Intl&&"object"==typeof window.Intl&&(window.navigator.languages||window.navigator.language)){return(window.navigator.languages||[window.navigator.language])[0]}return"en-IN"},Y=(x={})=>{let e=(null==x?void 0:x.locale)||r.getState().locale;e||(e=s());const n=(null==x?void 0:x.intlOptions)?Object.assign({},x.intlOptions):{};if(((null==x?void 0:x.currency)||n.currency)&&(n.style="currency",n.currency=x.currency||n.currency),!e)throw new Error("Pass valid locale !");return new Intl.NumberFormat(e||void 0,n)};var D=n(((x,e={})=>{if(!Number(x)&&0!==Number(x))throw new Error("Parameter `amount` is not a number!");let n="";try{n=Y(e).format(Number(x))}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return n}));const i={AED:{symbol:"د.إ",name:"United Arab Emirates Dirham"},ALL:{symbol:"Lek",name:"Albanian Lek"},AMD:{symbol:"֏",name:"Armenian Dram"},ARS:{symbol:"ARS",name:"Argentine Peso"},AUD:{symbol:"A$",name:"Australian Dollar"},AWG:{symbol:"Afl.",name:"Aruban Florin"},BBD:{symbol:"$",name:"Barbadian Dollar"},BDT:{symbol:"৳",name:"Bangladeshi Taka"},BMD:{symbol:"$",name:"Bermudian Dollar"},BND:{symbol:"BND",name:"Brunei Dollar"},BOB:{symbol:"Bs",name:"Bolivian Boliviano"},BSD:{symbol:"B$",name:"Bahamian Dollar"},BWP:{symbol:"P",name:"Botswanan Pula"},BZD:{symbol:"BZ$",name:"Belize Dollar"},CAD:{symbol:"C$",name:"Canadian Dollar"},CHF:{symbol:"CHf",name:"Swiss Franc"},CNY:{symbol:"¥",name:"Chinese Yuan"},COP:{symbol:"COL$",name:"Colombian Peso"},CRC:{symbol:"₡",name:"Costa Rican Colón"},CUP:{symbol:"$MN",name:"Cuban Peso"},CZK:{symbol:"Kč",name:"Czech Koruna"},DKK:{symbol:"DKK",name:"Danish Krone"},DOP:{symbol:"RD$",name:"Dominican Peso"},DZD:{symbol:"د.ج",name:"Algerian Dinar"},EGP:{symbol:"E£",name:"Egyptian Pound"},ETB:{symbol:"ብር",name:"Ethiopian Birr"},EUR:{symbol:"€",name:"Euro"},FJD:{symbol:"FJ$",name:"Fijian Dollar"},GBP:{symbol:"£",name:"British Pound"},GHS:{symbol:"GH₵",name:"Ghanaian Cedi"},GIP:{symbol:"GIP",name:"Gibraltar Pound"},GMD:{symbol:"D",name:"Gambian Dalasi"},GTQ:{symbol:"Q",name:"Guatemalan Quetzal"},GYD:{symbol:"G$",name:"Guyanese Dollar"},HKD:{symbol:"HK$",name:"Hong Kong Dollar"},HNL:{symbol:"HNL",name:"Honduran Lempira"},HRK:{symbol:"kn",name:"Croatian Kuna"},HTG:{symbol:"G",name:"Haitian Gourde"},HUF:{symbol:"Ft",name:"Hungarian Forint"},IDR:{symbol:"Rp",name:"Indonesian Rupiah"},ILS:{symbol:"₪",name:"Israeli New Shekel"},INR:{symbol:"₹",name:"Indian Rupee"},JMD:{symbol:"J$",name:"Jamaican Dollar"},KES:{symbol:"Ksh",name:"Kenyan Shilling"},KGS:{symbol:"Лв",name:"Kyrgystani Som"},KHR:{symbol:"៛",name:"Cambodian Riel"},KYD:{symbol:"CI$",name:"Cayman Islands Dollar"},KZT:{symbol:"₸",name:"Kazakhstani Tenge"},LAK:{symbol:"₭",name:"Laotian Kip"},LKR:{symbol:"රු",name:"Sri Lankan Rupee"},LRD:{symbol:"L$",name:"Liberian Dollar"},LSL:{symbol:"LSL",name:"Lesotho Loti"},MAD:{symbol:"د.م.",name:"Moroccan Dirham"},MDL:{symbol:"MDL",name:"Moldovan Leu"},MKD:{symbol:"ден",name:"Macedonian Denar"},MMK:{symbol:"MMK",name:"Myanmar Kyat"},MNT:{symbol:"₮",name:"Mongolian Tugrik"},MOP:{symbol:"MOP$",name:"Macanese Pataca"},MUR:{symbol:"₨",name:"Mauritian Rupee"},MVR:{symbol:"Rf",name:"Maldivian Rufiyaa"},MWK:{symbol:"MK",name:"Malawian Kwacha"},MXN:{symbol:"Mex$",name:"Mexican Peso"},MYR:{symbol:"RM",name:"Malaysian Ringgit"},NAD:{symbol:"N$",name:"Namibian Dollar"},NGN:{symbol:"₦",name:"Nigerian Naira"},NIO:{symbol:"NIO",name:"Nicaraguan Córdoba"},NOK:{symbol:"NOK",name:"Norwegian Krone"},NPR:{symbol:"रू",name:"Nepalese Rupee"},NZD:{symbol:"NZ$",name:"New Zealand Dollar"},PEN:{symbol:"S/",name:"Peruvian Nuevo Sol"},PGK:{symbol:"PGK",name:"Papua New Guinean Kina"},PHP:{symbol:"₱",name:"Philippine Peso"},PKR:{symbol:"₨",name:"Pakistani Rupee"},QAR:{symbol:"QR",name:"Qatari Riyal"},RUB:{symbol:"₽",name:"Russian Ruble"},SAR:{symbol:"SR",name:"Saudi Riyal"},SCR:{symbol:"SRe",name:"Seychellois Rupee"},SEK:{symbol:"SEK",name:"Swedish Krona"},SGD:{symbol:"S$",name:"Singapore Dollar"},SLL:{symbol:"Le",name:"Sierra Leonean Leone"},SOS:{symbol:"Sh.so.",name:"Somali Shilling"},SSP:{symbol:"SS£",name:"South Sudanese Pound"},SVC:{symbol:"₡",name:"Salvadoran Colón"},SZL:{symbol:"E",name:"Swazi Lilangeni"},THB:{symbol:"฿",name:"Thai Baht"},TTD:{symbol:"TT$",name:"Trinidad and Tobago Dollar"},TZS:{symbol:"Sh",name:"Tanzanian Shilling"},USD:{symbol:"$",name:"United States Dollar"},UYU:{symbol:"$U",name:"Uruguayan Peso"},UZS:{symbol:"so'm",name:"Uzbekistani Som"},YER:{symbol:"﷼",name:"Yemeni Rial"},ZAR:{symbol:"R",name:"South African Rand"},KWD:{symbol:"د.ك",name:"Kuwaiti Dinar"},BHD:{symbol:"د.ب.",name:"Bahraini Dinar"},OMR:{symbol:"ر.ع.",name:"Omani Rial"}};var M=n((()=>i));var m=n((x=>{var e;if(x in i)return null===(e=i[x])||void 0===e?void 0:e.symbol;throw new Error("Invalid currencyCode!")}));const l=["nan","infinity","percent","integer","group","decimal","fraction","plusSign","minusSign","percentSign","currency","code","symbol","name","compact","exponentInteger","exponentMinusSign","exponentSeparator","unit"];var c=n(((x,e={})=>{if(!Number(x)&&0!==Number(x))throw new Error("Parameter `amount` is not a number!");try{const n=Y(e).formatToParts(Number(x)),a={};return n.forEach((x=>{"group"===x.type?a.integer=(a.integer||"")+x.value:-1!=l.findIndex((e=>e===x.type))&&(a[x.type]=(a[x.type]||"")+x.value)})),Object.assign(Object.assign({},a),{isPrefixSymbol:"currency"===n[0].type,rawParts:n})}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}}));const y={IN:/^(?:(?:\+|0{0,2})91\s*[-]?\s*|[0]?)?[6789]\d{9}$/,MY:/^(\+?6?0)?(\d{1,3})[-. ]?(\d{7,8})$/,AE:/^(?:\+?971|0)?(?:2|3|4|6|7|9)\d{8}$/,AL:/^(?:\+?355)?(?:[4-9]\d{7}|6\d{8})$/,AM:/^(?:\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/,AR:/^(?:(?:\+|0{0,2})54)?(?:11|[2368]\d)(?:(?=\d{0,2}15)\d{2})??\d{8}$/,AU:/^(?:\+?61|0)4\d{8}$/,AW:/^(?:(?:\+297)?(?!0)\d{7})$/,BB:/^(?:(?:\+1)?246)?(?:\d{3})?\d{7}$/,BD:/^(?:\+?880|0)1[13456789]\d{8}$/,BM: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:(?:\+260)|0)?[123456789]\d{8,9}$/,ZW:/^(?:(?:\+263)|0)?(?:\d{9,10})$/,LT:/^(?:(?:\+370)|8)\d{8}$/,LU:/^(?:(?:\+352)?(6|2(6|7|8|9))\d{6})$/,LV:/^(?:(?:\+371)?2\d{7})$/,ME:/^(?:(?:\+382)?[67]\d{7,20})$/,MG:/^(?:(?:\+261)?3[234568]\d{7})$/,MZ:/^(?:(?:\+258)|(?:258))?8[234567]\d{7,8}$/,NL:/^(?:(?:\+31)|0(6(?:\d{8})|[1-9](?:(?:\d{8})|(?:\s\d{3}\s\d{4}))|(?:\d{8})))$/,PA:/^(?:(?:\+507)\s?)?[46]\d{6,7}$/,PL:/^(?:(?:\+48)?(?:\s?\d{3}\s?\d{3}\s?\d{3}|(?:\d{2}\s?){4}\d{2}|\d{3}-\d{3}-\d{3}))$/,PR:/^(?:(?:\+1)?787|939)\d{7}$/,PS:/^(?:(?:\+970))(5[2349])\d{7}$/,PT:/^(?:(?:\+351)?9(1\d|2[1-9]|6[12345789]|7[12345789])\d{7})$/,PY:/^(?:(?:\+595|0)9[9876]\d{7})$/,RO:/^(?:(?:\+40|0))(?:7[2-8]\d{7}|21\d{8})$/,RS:/^(?:(?:\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/,RW:/^(?:(?:\+250)|(0))\d{9}$/,SI:/^(?:(?:\+386)|0)?[1-59]\d{7,8}$/,SK:/^(?:(?:\+421))?(0|9[0-8])\d{8}$/,SM:/^(?:(?:\+378)|(0549|6\d{4}))\d{5}$/,SN:/^(?:(?:\+221)|0)?[3679]\d{7}$/,SR:/^(?:(?:\+597))\d{7}$/,TG:/^(?:(?:\+228))\d{8}$/,TJ:/^(?:(?:\+992))(37|55|77)\d{7}$/,TN:/^(?:(?:\+216)|22|9[1-9])\d{7}$/,TR:/^(?:(?:\+90)|(0))\s?5\d{9}$/,TW:/^(?:(?:\+886)|0)?9\d{8}$/,UA:/^(?:(?:\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\d{7}$/,UG:/^(?:(?:\+256)|0)?[39]\d{8}$/},u={1:["US","AG","AI","AS","BB","BM","BS","CA","DM","DO","GD","GU","JM","KN","KY","LC","MP","MS","PR","SX","TC","TT","VC","VG","VI"],7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT","VA"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH","TA"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],380:["UA"],381:["RS"],382:["ME"],383:["XK"],385:["HR"],386:["SI"],387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],691:["FM"],692:["MH"],800:["001"],808:["001"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],870:["001"],878:["001"],880:["BD"],881:["001"],882:["001"],883:["001"],886:["TW"],888:["001"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],979:["001"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},$=x=>{if("+"===x.toString().charAt(0)){const e=x.toString().replace(/\D/g,""),n=[];for(const x in u)e.startsWith(x)&&n.push(...u[x]);return n.find((e=>{const n=y[e];if(n&&n.test(x.toString()))return e}))||""}for(const e in y){if(y[e].test(x.toString()))return e}return""},S=x=>{const e=x.replace(/[^0-9+]|(?!A)\+/g,"");return"+"===x[0]?`+${e}`:e};var b=n(((x,e)=>{const n=S(x.toString());if(e=e&&e in y?e:$(n),!x)return!1;if(e in y){return y[e].test(n)}return!1}));const g={IN:"xxxx xxxxxx",MY:"xx xxxxx xx",AE:"xx xxx xxxx",AL:"xxx xx xxxx",AM:"xx xx xx xx",AR:"xxxx-xxxx",AU:"xxx xxx xxx",AW:"xxx-xxxx",BB:"xxx-xxxx",BD:"xxxx-xxxxxx",BM:"xxx-xxxx",BN:"xxxx-xxxx",BO:"xxxx-xxxx",BS:"xxx-xxxx",BW:"xx xxxx xxxx",BZ:"xxx-xxxx",CA:"xxx-xxx-xxxx",CH:"xxx xxx xxx",CN:"xxxx-xxxxxxx",CO:"xxxx-xxxxxxx",CR:"xxxx-xxxx",CU:"xxxx-xxxx",CZ:"xxx xxx xxx",DK:"xx xx xx xx",DO:"xxx-xxxxxxx",DZ:"xxxx-xxxx-xxx",EG:"xx xxx xxxx",ET:"xx xxx xxxx",EU:"xxx xx xx xx",FJ:"xxxx xxxx",GB:"xxxx xxx xxx",GH:"xxx xxx xxxx",GI:"xxxx xxxx",GM:"xxxx-xxxx",GT:"xxxx-xxxx",GY:"xxx-xxxx",HK:"xxxx xxxx",HN:"xxxx-xxxx",HR:"xxx xxx xxxx",HT:"xxx-xxxx",HU:"xxx xxx xxxx",ID:"xxxx-xxxx-xxxx",IL:"xxxx-xxx-xxx",JM:"xxx-xxxx",KE:"xxx xxxxxx",KG:"xxx-xx-xx-xx",KH:"xxx-xxx-xxx",KY:"xxx-xxxx",KZ:"xxx-xxx-xx-xx",LA:"xxx xx xxxx",LK:"xx xxx xxxx",LR:"xxx-xxx-xxxx",LS:"xxx xx xxxx",LT:"xxx xxxxx",LU:"xxx xx xxx",LV:"xxxx xxxx",MA:"xxxx-xxxxxx",MD:"xx xxxxxx",ME:"xx xxxxxx",MG:"xx xx xx xx xx",MK:"xx xx xx xx",MM:"xx xxxxxx",MN:"xxx-xx-xxxx",MO:"xxxx xxxx",MU:"xx xxxx xxxx",MV:"xxxxxx",MW:"xx xxxx xxxx",MX:"xxx-xxx-xxxx",MZ:"xx xxxxxxx",NA:"xx xxxx xxxx",NG:"xxx xxx xxxx",NI:"xxxx-xxxx",NL:"xxx-xxxxxxx",NO:"xxxx xxxx",NP:"xxxx-xxxxxxx",NZ:"xxx-xxxxxxx",OM:"xxxx-xxxx",PA:"xxx-xxxx",PE:"xxx-xxx-xxx",PG:"xxx-xxxxxx",PH:"xxx-xxxx",PK:"xxx-xxxxxxx",PL:"xxx xxx xxx",PR:"xxx-xxx-xxxx",PS:"xxxx-xxxxxxx",PT:"xxx xxx xxx",PY:"xxx-xxxxxx",QA:"xxxx xxxx",RO:"xxx xxx xxxx",RS:"xxx xxxxx",RU:"xxx xxx-xx-xx",RW:"xxx xxxxxx",SA:"xxx-xxxxxxx",SC:"xx xxxxx",SE:"xxx-xxx xx xx",SG:"xxxx xxxx",SI:"xx xxxxxx",SK:"xxx xxx xxx",SL:"xxx-xxxxxx",SM:"xxxxx xxxxx",SN:"xx xxx xx xx",SO:"xxx xxxxxxx",SR:"xxx-xxxx",SS:"xxx xxxx xxx",SV:"xxxx-xxxx",SZ:"xxx xx xxxx",TG:"xx xx xx xx",TH:"xxx-xxxxxxx",TJ:"xxx xx xx xx",TL:"xxx-xxxxxxx",TN:"xx xxxxxx",TR:"xxx xxx xx xx",TT:"xxx-xxxx",TW:"xxxx-xxxxxx",TZ:"xxx xxx xxxx",UA:"xx xxx xx xx",UG:"xxx xxxxxxx",US:"xxx-xxx-xxxx",UY:"xxx-xxxxx",UZ:"xxx-xxx-xx-xx",VC:"xxx-xxxx",VE:"xxxx-xxx-xxxx",VN:"xxxx-xxxxxxx",YE:"xxxx-xxxx",ZA:"xxx-xxx-xxxx",ZM:"xxx-xxxxxxx",ZW:"xx xxx xxxx",KW:"xxx xx xxxx",BH:"xxxx xxxx"};var h=n(((x,e)=>{if(!x)throw new Error("Parameter `phoneNumber` is invalid!");x=x.toString(),x=S(x),e=e&&e in g?e:$(x);const n=g[e];if(!n)return x;let a=0;for(let x=0;x{if(!x)throw new Error("Parameter `phoneNumber` is invalid!");x=x.toString(),x=S(x);const n=e&&e in g?e:$(x),a=h(x,n),r=g[n];if(!r)return{countryCode:n||"",dialCode:"",formattedPhoneNumber:x,formatTemplate:""};let t=0;for(let x=0;x{const e=[{regex:/^(\d{4})\/(\d{2})\/(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3},{regex:/^(\d{2})\/(\d{2})\/(\d{4})$/,yearIndex:3,monthIndex:2,dayIndex:1},{regex:/^(\d{4})\.(\d{2})\.(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3},{regex:/^(\d{4})\.(\d{2})\.(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3},{regex:/^(\d{4})\.(\d{2})\.(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3},{regex:/^(\d{4})\.(\d{2})\.(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3},{regex:/^(\d{4})\.(\d{2})\.(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3},{regex:/^(\d{4})\.(\d{2})\.(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3},{regex:/^(\d{4})\/(\d{2})\/(\d{2}) (\d{2}):(\d{2}):(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3,hourIndex:4,minuteIndex:5,secondIndex:6},{regex:/^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2}):(\d{2})$/,yearIndex:3,monthIndex:2,dayIndex:1,hourIndex:4,minuteIndex:5,secondIndex:6},{regex:/^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3,hourIndex:4,minuteIndex:5,secondIndex:6},{regex:/^(\d{2})-(\d{2})-(\d{4}) (\d{2}):(\d{2}):(\d{2})$/,yearIndex:3,monthIndex:2,dayIndex:1,hourIndex:4,minuteIndex:5,secondIndex:6},{regex:/^(\d{4})\.(\d{2})\.(\d{2}) (\d{2}):(\d{2}):(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3,hourIndex:4,minuteIndex:5,secondIndex:6},{regex:/^(\d{2})\.(\d{2})\.(\d{4}) (\d{2}):(\d{2}):(\d{2})$/,yearIndex:3,monthIndex:2,dayIndex:1,hourIndex:4,minuteIndex:5,secondIndex:6}];for(const n of e){const e=x.match(n.regex);if(e){const x=e[n.yearIndex],a=e[n.monthIndex],r=e[n.dayIndex],t=n.hourIndex?e[n.hourIndex]:"00",o=n.minuteIndex?e[n.minuteIndex]:"00",d=n.secondIndex?e[n.secondIndex]:"00";return new Date(`${x}-${a}-${r}T${t}:${o}:${d}`)}}throw new Error("Date format not recognized")};var f=n(((x,e,n)=>{switch(x="string"==typeof x?new Date(I(x)):new Date(x),n){case"days":x.setDate(x.getDate()+e);break;case"months":x.setMonth(x.getMonth()+e);break;case"years":x.setFullYear(x.getFullYear()+e)}return x}));var N=n(((x,e,n={})=>{e||(e=r.getState().locale||s());const a=(x="string"==typeof x?new Date(I(x)):new Date(x))instanceof Date?x:new Date(x);let t;try{t=new Intl.DateTimeFormat(e,n)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return t.format(a)}));var A=n(((x,e,n={})=>{e||(e=r.getState().locale||s());const a=Object.assign(Object.assign({},n),{timeStyle:void 0});let t;try{t=N(x,e,a)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return t}));var E=n(((x,e,n={})=>{e||(e=r.getState().locale||s());const a=Object.assign(Object.assign({},n),{dateStyle:void 0});let t;try{t=N(x,e,a)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return t}));var T=n(((x,e={})=>{let n;x||(x=r.getState().locale||s()),e.weekday||(e.weekday="long");try{const a=new Intl.DateTimeFormat(x,e),r=new Date(2e3,0,2);n=a.format(r)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}const a=Array.from({length:7},((n,a)=>new Intl.DateTimeFormat(x,e).format(new Date(2e3,0,2+a)))),t=a.indexOf(n);if(-1===t)throw new Error("Unable to determine the first day of the week");return a[(t+1)%7]}));var K=n((x=>(x="string"==typeof x?new Date(I(x)):new Date(x),Math.ceil((x.getMonth()+1)/3))));var R=n(((x,e=new Date,n,a)=>{x="string"==typeof x?new Date(I(x)):new Date(x),e="string"==typeof e?new Date(I(e)):new Date(e),n||(n=r.getState().locale||s());const t=(x.getTime()-e.getTime())/1e3,o=3600,d=86400,Y=7*d,D=30*d,i=365*d;let M,m,l;Math.abs(t)<60?(M=t,m="second"):Math.abs(t){x="string"==typeof x?new Date(I(x)):new Date(x);const e=new Date(x.getFullYear(),0,1),n=(x.getTime()-e.getTime())/864e5;return Math.ceil((n+e.getDay()+1)/7)}));var P=n(((x,e={})=>{try{x||(x=r.getState().locale||s()),e.weekday||(e.weekday="long");const n=new Intl.DateTimeFormat(x,e);return Array.from({length:7},((x,e)=>n.format(new Date(1970,0,4+e))))}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}}));var B=n(((x,e)=>{x="string"==typeof x?new Date(I(x)):new Date(x),e="string"==typeof e?new Date(I(e)):new Date(e);return(x instanceof Date?x:new Date(x))>(e instanceof Date?e:new Date(e))}));var C=n(((x,e)=>{x="string"==typeof x?new Date(I(x)):new Date(x),e="string"==typeof e?new Date(I(e)):new Date(e);return(x instanceof Date?x:new Date(x))<(e instanceof Date?e:new Date(e))}));var L=n((x=>x%4==0&&x%100!=0||x%400==0));var p=n(((x,e)=>(x="string"==typeof x?new Date(I(x)):new Date(x),e="string"==typeof e?new Date(I(e)):new Date(e),x.getDate()===e.getDate()&&x.getMonth()===e.getMonth()&&x.getFullYear()===e.getFullYear())));var H=n((x=>{try{x="string"==typeof x?new Date(I(x)):new Date(x)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return x instanceof Date&&!isNaN(x.getTime())}));const O={"ar-AE":"DD/MM/YYYY","sq-AL":"DD.MM.YYYY","hy-AM":"DD.MM.YYYY","es-AR":"DD/MM/YYYY","en-AU":"DD/MM/YYYY","nl-AW":"DD-MM-YYYY","en-BB":"MM/DD/YYYY","bn-BD":"DD/MM/YYYY","en-BM":"MM/DD/YYYY","ms-BN":"DD/MM/YYYY","es-BO":"DD/MM/YYYY","en-BS":"MM/DD/YYYY","en-BW":"DD/MM/YYYY","en-BZ":"MM/DD/YYYY","en-CA":"DD/MM/YYYY","de-CH":"DD.MM.YYYY","zh-CN":"YYYY/MM/DD","es-CO":"DD/MM/YYYY","es-CR":"DD/MM/YYYY","es-CU":"DD/MM/YYYY","cs-CZ":"DD.MM.YYYY","da-DK":"DD-MM-YYYY","es-DO":"DD/MM/YYYY","ar-DZ":"DD/MM/YYYY","ar-EG":"DD/MM/YYYY","am-ET":"DD/MM/YYYY","en-EU":"DD/MM/YYYY","en-FJ":"DD/MM/YYYY","en-GB":"DD/MM/YYYY","en-GH":"DD/MM/YYYY","en-GI":"DD/MM/YYYY","en-GM":"DD/MM/YYYY","es-GT":"DD/MM/YYYY","en-GY":"DD/MM/YYYY","en-HK":"DD/MM/YYYY","es-HN":"DD/MM/YYYY","hr-HR":"DD.MM.YYYY","ht-HT":"MM/DD/YYYY","hu-HU":"YYYY. MM. DD.","id-ID":"DD/MM/YYYY","he-IL":"DD/MM/YYYY","en-IN":"DD-MM-YYYY","en-JM":"MM/DD/YYYY","en-KE":"DD/MM/YYYY","ky-KG":"DD.MM.YYYY","km-KH":"DD/MM/YYYY","en-KY":"MM/DD/YYYY","kk-KZ":"DD.MM.YYYY","lo-LA":"DD/MM/YYYY","si-LK":"YYYY-MM-DD","en-LR":"MM/DD/YYYY","en-LS":"DD/MM/YYYY","ar-MA":"DD/MM/YYYY","ro-MD":"DD.MM.YYYY","mk-MK":"DD.MM.YYYY","my-MM":"DD/MM/YYYY","mn-MN":"YYYY.MM.DD","zh-MO":"DD/MM/YYYY","en-MU":"DD/MM/YYYY","dv-MV":"DD/MM/YYYY","en-MW":"DD/MM/YYYY","es-MX":"DD/MM/YYYY","ms-MY":"DD/MM/YYYY","en-NA":"DD/MM/YYYY","en-NG":"DD/MM/YYYY","es-NI":"DD/MM/YYYY","no-NO":"DD.MM.YYYY","ne-NP":"YYYY/MM/DD","en-NZ":"DD/MM/YYYY","es-PE":"DD/MM/YYYY","en-PG":"DD/MM/YYYY","en-PH":"MM/DD/YYYY","en-PK":"DD/MM/YYYY","ar-QA":"DD/MM/YYYY","ru-RU":"DD.MM.YYYY","ar-SA":"DD/MM/YYYY","en-SC":"DD/MM/YYYY","sv-SE":"YYYY-MM-DD","en-SG":"DD/MM/YYYY","en-SL":"DD/MM/YYYY","so-SO":"DD/MM/YYYY","en-SS":"DD/MM/YYYY","es-SV":"DD/MM/YYYY","en-SZ":"DD/MM/YYYY","th-TH":"DD/MM/YYYY","en-TT":"MM/DD/YYYY","sw-TZ":"DD/MM/YYYY","en-US":"MM/DD/YYYY","es-UY":"DD/MM/YYYY","uz-UZ":"DD/MM/YYYY","ar-YE":"DD/MM/YYYY","en-ZA":"YYYY/MM/DD","ar-KW":"DD/MM/YYYY","ar-BH":"DD/MM/YYYY","ar-OM":"DD/MM/YYYY"};var U=n(((x,e)=>{const n=e.includes("/")?"/":e.includes(".")?".":"-",a=e.split(n),r=x.split(n).map((x=>parseInt(x,10)));let t=0,o=0,d=0,s=!1,Y=!1,D=!1;if(r.length!==a.length)return null;if(a.forEach(((x,e)=>{if(isNaN(r[e]))return null;switch(x){case"DD":d=r[e],D=!0;break;case"MM":o=r[e]-1,Y=!0;break;case"YYYY":t=r[e],s=!0}})),s&&Y&&D){const x=new Date(t,o,d);if(x.getFullYear()===t&&x.getMonth()===o&&x.getDate()===d)return x}return null}));var v=n(((x,e)=>{e||(e=r.getState().locale||s());const n=O[e];if(!n)throw new Error(`No date format found for locale: ${e}`);return U(x,n)}));var Z=n(((x,e,n)=>(x="string"==typeof x?new Date(I(x)):new Date(x),f(x,-e,n))));x.add=f,x.formatDate=A,x.formatDateTime=N,x.formatNumber=D,x.formatNumberByParts=c,x.formatPhoneNumber=h,x.formatTime=E,x.getCurrencyList=M,x.getCurrencySymbol=m,x.getFirstDayOfWeek=T,x.getQuarter=K,x.getRelativeTime=R,x.getState=t,x.getWeek=G,x.getWeekdays=P,x.isAfter=B,x.isBefore=C,x.isLeapYear=L,x.isSameDay=p,x.isValidDate=H,x.isValidPhoneNumber=b,x.parseDate=v,x.parsePhoneNumber=w,x.resetState=d,x.setState=o,x.subtract=Z})); //# sourceMappingURL=index.min.js.map diff --git a/lib/umd/index.min.js.map b/lib/umd/index.min.js.map index d04e1655..828fead7 100644 --- a/lib/umd/index.min.js.map +++ b/lib/umd/index.min.js.map @@ -1 +1 @@ -{"version":3,"file":"index.min.js","sources":["../../src/common/errorBoundary/index.ts","../../src/modules/.internal/state/index.ts","../../src/modules/.internal/utils/getDefaultState.ts","../../src/modules/core/getState.ts","../../src/modules/core/setState.ts","../../src/modules/core/resetState.ts","../../src/modules/.internal/utils/getLocale.ts","../../src/modules/.internal/utils/getIntlInstanceWithOptions.ts","../../src/modules/currency/formatNumber.ts","../../src/modules/currency/data/currencies.ts","../../src/modules/currency/getCurrencyList.ts","../../src/modules/currency/getCurrencySymbol.ts","../../src/modules/currency/constants.ts","../../src/modules/currency/formatNumberByParts.ts","../../src/modules/phoneNumber/data/phoneRegexMapper.ts","../../src/modules/phoneNumber/data/dialCodeMapper.ts","../../src/modules/phoneNumber/utils.ts","../../src/modules/phoneNumber/isValidPhoneNumber.ts","../../src/modules/phoneNumber/data/phoneFormatterMapper.ts","../../src/modules/phoneNumber/formatPhoneNumber.ts","../../src/modules/phoneNumber/parsePhoneNumber.ts","../../src/modules/dateTime/add.ts","../../src/modules/dateTime/formatDateTime.ts","../../src/modules/dateTime/formatDate.ts","../../src/modules/dateTime/formatTime.ts","../../src/modules/dateTime/getFirstDayOfWeek.ts","../../src/modules/dateTime/getQuarter.ts","../../src/modules/dateTime/getRelativeTime.ts","../../src/modules/dateTime/getWeek.ts","../../src/modules/dateTime/getWeekdays.ts","../../src/modules/dateTime/isAfter.ts","../../src/modules/dateTime/isBefore.ts","../../src/modules/dateTime/isLeapYear.ts","../../src/modules/dateTime/isSameDay.ts","../../src/modules/dateTime/isValidDate.ts","../../src/modules/dateTime/data/localeDateFormats.ts","../../src/modules/dateTime/parseDateWithFormat.ts","../../src/modules/dateTime/parseDate.ts","../../src/modules/dateTime/subtract.ts"],"sourcesContent":["// Custom Error class to extend properties to error object\nexport class I18nifyError extends Error {\n timestamp: Date;\n constructor(message: string | undefined) {\n super(message);\n this.name = 'i18nify Error';\n this.timestamp = new Date();\n // more params like type of error/severity can be added in future for better debugging.\n }\n}\n\n/**\n * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block.\n * It appends additional attributes and serves as a centralized error-handling service.\n * Usage =>\n * const wrappedUtilityFn = withErrorBoundary(utilityFn)\n *\n * @param fn utility that is wrapped in error boundary\n * @returns {Function} returns the function wrapped in try/catch block\n */\nexport const withErrorBoundary = any>(\n fn: T,\n): ((...args: Parameters) => ReturnType) => {\n return function (this: unknown, ...rest: Parameters): ReturnType {\n try {\n return fn.call(this, ...rest) as ReturnType;\n } catch (err) {\n console.warn('[I18N Error]: ', err);\n // Currently, we are throwing the error as it is to consumers.\n // In the future, this can be modified as per our requirement, like an error logging service.\n throw new I18nifyError(err as string | undefined);\n }\n };\n};\n","import { I18nState } from './types';\nimport { getDefaultState } from '../utils/getDefaultState';\n\nexport class I18nStateManager {\n private static instance: I18nStateManager | undefined;\n private state: I18nState;\n\n private constructor() {\n this.state = getDefaultState();\n }\n\n public static getInstance(): I18nStateManager {\n if (!I18nStateManager.instance) {\n I18nStateManager.instance = new I18nStateManager();\n }\n\n return I18nStateManager.instance;\n }\n\n public static resetInstance(): void {\n I18nStateManager.instance = undefined;\n }\n\n public getState(): I18nState {\n return { ...this.state };\n }\n\n public setState(newState: Partial): void {\n this.state = { ...this.state, ...newState };\n }\n\n public resetState(): void {\n this.state = getDefaultState();\n }\n}\n\nexport default I18nStateManager.getInstance();\n","import type { I18nState } from '../state/types';\n\nexport function getDefaultState(): I18nState {\n return {\n locale: '',\n direction: '',\n country: '',\n };\n}\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * function to return active i18n state\n *\n * ===== USAGE =====\n * import { getState } from '@razorpay/i18nify-js';\n *\n * console.log(getState())\n *\n * @returns i18n state\n */\nconst getState = (): I18nState => {\n return state.getState();\n};\n\nexport default withErrorBoundary(getState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * Function to set and override the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { setState } from \"@razorpay/i18nify-js\";\n * setState({locale: 'en-US'})\n *\n * @param newState data to set in i18nState instance\n */\nconst setState = (newState: Partial): void => {\n state.setState(newState);\n};\n\nexport default withErrorBoundary(setState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\n\n/**\n * Function to reset the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { resetState } from \"@razorpay/i18nify-js\";\n * resetState()\n *\n * @param newState data to set in i18nState instance\n */\nconst resetState = (): void => {\n state.resetState();\n};\n\nexport default withErrorBoundary(resetState);\n","export const getLocale = (): string => {\n // Check if running in a non-browser environment (e.g., Node.js or older browsers).\n if (typeof navigator === 'undefined') {\n return 'en-IN';\n }\n\n // Check if the browser supports the Intl object and user language preferences.\n if (\n window.Intl &&\n typeof window.Intl === 'object' &&\n (window.navigator.languages || window.navigator.language)\n ) {\n const userLocales = window.navigator.languages || [\n window.navigator.language,\n ];\n return userLocales[0];\n }\n\n // Fallback to a supported locale or the default locale.\n return 'en-IN';\n};\n","import { CURRENCIES } from '../../currency/data/currencies';\nimport state from '../state';\nimport { getLocale } from './getLocale';\n\nexport const getIntlInstanceWithOptions = (\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n) => {\n /** retrieve locale from below areas in order of preference\n * 1. options.locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n let locale = options?.locale || state.getState().locale;\n\n // If a specific locale is provided, use it; otherwise, use the browser's locale\n if (!locale) {\n locale = getLocale();\n }\n\n const intlOptions = options?.intlOptions ? { ...options.intlOptions } : {};\n\n if (options?.currency || intlOptions.currency) {\n intlOptions.style = 'currency';\n intlOptions.currency = (options.currency || intlOptions.currency) as string;\n }\n\n if (!locale) throw new Error('Pass valid locale !');\n\n return new Intl.NumberFormat(locale || undefined, intlOptions);\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\n\n// this function formats number based on different arguments passed\nconst formatNumber = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): string => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n let formattedAmount = '';\n\n try {\n formattedAmount = getIntlInstanceWithOptions(options).format(\n Number(amount),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedAmount;\n};\n\nexport default withErrorBoundary(formatNumber);\n","export const CURRENCIES: { [key: string]: { symbol: string; name: string } } = {\n AED: { symbol: 'د.إ', name: 'United Arab Emirates Dirham' },\n ALL: { symbol: 'Lek', name: 'Albanian Lek' },\n AMD: { symbol: '֏', name: 'Armenian Dram' },\n ARS: { symbol: 'ARS', name: 'Argentine Peso' },\n AUD: { symbol: 'A$', name: 'Australian Dollar' },\n AWG: { symbol: 'Afl.', name: 'Aruban Florin' },\n BBD: { symbol: '$', name: 'Barbadian Dollar' },\n BDT: { symbol: '৳', name: 'Bangladeshi Taka' },\n BMD: { symbol: '$', name: 'Bermudian Dollar' },\n BND: { symbol: 'BND', name: 'Brunei Dollar' },\n BOB: { symbol: 'Bs', name: 'Bolivian Boliviano' },\n BSD: { symbol: 'B$', name: 'Bahamian Dollar' },\n BWP: { symbol: 'P', name: 'Botswanan Pula' },\n BZD: { symbol: 'BZ$', name: 'Belize Dollar' },\n CAD: { symbol: 'C$', name: 'Canadian Dollar' },\n CHF: { symbol: 'CHf', name: 'Swiss Franc' },\n CNY: { symbol: '¥', name: 'Chinese Yuan' },\n COP: { symbol: 'COL$', name: 'Colombian Peso' },\n CRC: { symbol: '₡', name: 'Costa Rican Colón' },\n CUP: { symbol: '$MN', name: 'Cuban Peso' },\n CZK: { symbol: 'Kč', name: 'Czech Koruna' },\n DKK: { symbol: 'DKK', name: 'Danish Krone' },\n DOP: { symbol: 'RD$', name: 'Dominican Peso' },\n DZD: { symbol: 'د.ج', name: 'Algerian Dinar' },\n EGP: { symbol: 'E£', name: 'Egyptian Pound' },\n ETB: { symbol: 'ብር', name: 'Ethiopian Birr' },\n EUR: { symbol: '€', name: 'Euro' },\n FJD: { symbol: 'FJ$', name: 'Fijian Dollar' },\n GBP: { symbol: '£', name: 'British Pound' },\n GHS: { symbol: 'GH₵', name: 'Ghanaian Cedi' },\n GIP: { symbol: 'GIP', name: 'Gibraltar Pound' },\n GMD: { symbol: 'D', name: 'Gambian Dalasi' },\n GTQ: { symbol: 'Q', name: 'Guatemalan Quetzal' },\n GYD: { symbol: 'G$', name: 'Guyanese Dollar' },\n HKD: { symbol: 'HK$', name: 'Hong Kong Dollar' },\n HNL: { symbol: 'HNL', name: 'Honduran Lempira' },\n HRK: { symbol: 'kn', name: 'Croatian Kuna' },\n HTG: { symbol: 'G', name: 'Haitian Gourde' },\n HUF: { symbol: 'Ft', name: 'Hungarian Forint' },\n IDR: { symbol: 'Rp', name: 'Indonesian Rupiah' },\n ILS: { symbol: '₪', name: 'Israeli New Shekel' },\n INR: { symbol: '₹', name: 'Indian Rupee' },\n JMD: { symbol: 'J$', name: 'Jamaican Dollar' },\n KES: { symbol: 'Ksh', name: 'Kenyan Shilling' },\n KGS: { symbol: 'Лв', name: 'Kyrgystani Som' },\n KHR: { symbol: '៛', name: 'Cambodian Riel' },\n KYD: { symbol: 'CI$', name: 'Cayman Islands Dollar' },\n KZT: { symbol: '₸', name: 'Kazakhstani Tenge' },\n LAK: { symbol: '₭', name: 'Laotian Kip' },\n LKR: { symbol: 'රු', name: 'Sri Lankan Rupee' },\n LRD: { symbol: 'L$', name: 'Liberian Dollar' },\n LSL: { symbol: 'LSL', name: 'Lesotho Loti' },\n MAD: { symbol: 'د.م.', name: 'Moroccan Dirham' },\n MDL: { symbol: 'MDL', name: 'Moldovan Leu' },\n MKD: { symbol: 'ден', name: 'Macedonian Denar' },\n MMK: { symbol: 'MMK', name: 'Myanmar Kyat' },\n MNT: { symbol: '₮', name: 'Mongolian Tugrik' },\n MOP: { symbol: 'MOP$', name: 'Macanese Pataca' },\n MUR: { symbol: '₨', name: 'Mauritian Rupee' },\n MVR: { symbol: 'Rf', name: 'Maldivian Rufiyaa' },\n MWK: { symbol: 'MK', name: 'Malawian Kwacha' },\n MXN: { symbol: 'Mex$', name: 'Mexican Peso' },\n MYR: { symbol: 'RM', name: 'Malaysian Ringgit' },\n NAD: { symbol: 'N$', name: 'Namibian Dollar' },\n NGN: { symbol: '₦', name: 'Nigerian Naira' },\n NIO: { symbol: 'NIO', name: 'Nicaraguan Córdoba' },\n NOK: { symbol: 'NOK', name: 'Norwegian Krone' },\n NPR: { symbol: 'रू', name: 'Nepalese Rupee' },\n NZD: { symbol: 'NZ$', name: 'New Zealand Dollar' },\n PEN: { symbol: 'S/', name: 'Peruvian Nuevo Sol' },\n PGK: { symbol: 'PGK', name: 'Papua New Guinean Kina' },\n PHP: { symbol: '₱', name: 'Philippine Peso' },\n PKR: { symbol: '₨', name: 'Pakistani Rupee' },\n QAR: { symbol: 'QR', name: 'Qatari Riyal' },\n RUB: { symbol: '₽', name: 'Russian Ruble' },\n SAR: { symbol: 'SR', name: 'Saudi Riyal' },\n SCR: { symbol: 'SRe', name: 'Seychellois Rupee' },\n SEK: { symbol: 'SEK', name: 'Swedish Krona' },\n SGD: { symbol: 'S$', name: 'Singapore Dollar' },\n SLL: { symbol: 'Le', name: 'Sierra Leonean Leone' },\n SOS: { symbol: 'Sh.so.', name: 'Somali Shilling' },\n SSP: { symbol: 'SS£', name: 'South Sudanese Pound' },\n SVC: { symbol: '₡', name: 'Salvadoran Colón' },\n SZL: { symbol: 'E', name: 'Swazi Lilangeni' },\n THB: { symbol: '฿', name: 'Thai Baht' },\n TTD: { symbol: 'TT$', name: 'Trinidad and Tobago Dollar' },\n TZS: { symbol: 'Sh', name: 'Tanzanian Shilling' },\n USD: { symbol: '$', name: 'United States Dollar' },\n UYU: { symbol: '$U', name: 'Uruguayan Peso' },\n UZS: { symbol: \"so'm\", name: 'Uzbekistani Som' },\n YER: { symbol: '﷼', name: 'Yemeni Rial' },\n ZAR: { symbol: 'R', name: 'South African Rand' },\n KWD: { symbol: 'د.ك', name: 'Kuwaiti Dinar' },\n BHD: { symbol: 'د.ب.', name: 'Bahraini Dinar' },\n OMR: { symbol: 'ر.ع.', name: 'Omani Rial' },\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencyList = () => {\n return CURRENCIES;\n};\n\nexport default withErrorBoundary(getCurrencyList);\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencySymbol = (currencyCode: keyof typeof CURRENCIES): string => {\n if (currencyCode in CURRENCIES) return CURRENCIES[currencyCode]?.symbol;\n else throw new Error('Invalid currencyCode!');\n};\n\nexport default withErrorBoundary(getCurrencySymbol);\n","export const ALLOWED_FORMAT_PARTS_KEYS = [\n 'nan',\n 'infinity',\n 'percent',\n 'integer',\n 'group',\n 'decimal',\n 'fraction',\n 'plusSign',\n 'minusSign',\n 'percentSign',\n 'currency',\n 'code',\n 'symbol',\n 'name',\n 'compact',\n 'exponentInteger',\n 'exponentMinusSign',\n 'exponentSeparator',\n 'unit',\n] as const;\n","import { CURRENCIES } from './data/currencies';\nimport { ByParts, FormattedPartsObject } from './types';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\nimport { ALLOWED_FORMAT_PARTS_KEYS } from './constants';\n\nconst formatNumberByParts = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): ByParts => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n try {\n const formattedAmount = getIntlInstanceWithOptions(options).formatToParts(\n Number(amount),\n );\n\n const parts = formattedAmount;\n\n const formattedObj: FormattedPartsObject = {};\n\n parts.forEach((p) => {\n if (p.type === 'group') {\n formattedObj.integer = (formattedObj.integer || '') + p.value;\n } else if (\n ALLOWED_FORMAT_PARTS_KEYS.findIndex((item) => item === p.type) != -1\n ) {\n // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal' is skipped\n formattedObj[p.type] = (formattedObj[p.type] || '') + p.value;\n }\n });\n\n return {\n ...formattedObj,\n isPrefixSymbol: parts[0].type === 'currency',\n rawParts: parts,\n };\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(\n formatNumberByParts,\n);\n","export const PHONE_REGEX_MAPPER: { [key: string]: RegExp } = {\n IN: /^(?:(?:\\+|0{0,2})91\\s*[-]?\\s*|[0]?)?[6789]\\d{9}$/,\n MY: /^(\\+?6?0)?(\\d{1,3})[-. ]?(\\d{7,8})$/,\n AE: /^(?:\\+?971|0)?(?:2|3|4|6|7|9)\\d{8}$/,\n AL: /^(?:\\+?355)?(?:[4-9]\\d{7}|6\\d{8})$/,\n AM: /^(?:\\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/,\n AR: /^(?:(?:\\+|0{0,2})54)?(?:11|[2368]\\d)(?:(?=\\d{0,2}15)\\d{2})??\\d{8}$/,\n AU: /^(?:\\+?61|0)4\\d{8}$/,\n AW: /^(?:(?:\\+297)?(?!0)\\d{7})$/,\n BB: /^(?:(?:\\+1)?246)?(?:\\d{3})?\\d{7}$/,\n BD: /^(?:\\+?880|0)1[13456789]\\d{8}$/,\n BM: /^(?:(?:\\+1)?441)?(?:\\d{2})?\\d{7}$/,\n BN: /^(?:\\+?673)?(?:\\d{3})?\\d{4}$/,\n BO: /^(?:(?:\\+|0{0,2})591)?(?:(?:2|3|7|6)\\d{7})$/,\n BS: /^(?:(?:\\+1)?242)?(?:\\d{3})?\\d{7}$/,\n BW: /^(?:(?:\\+267)?\\s?)?[74]\\d{7}$/,\n BZ: /^(?:(?:\\+501)?\\s?)?[622]\\d{4}$/,\n CH: /^(?:(?:\\+41|0)(?:\\s*\\(?0\\)?\\s*))?(?:\\d{2}\\s*)?\\d{3}\\s*\\d{2}\\s*\\d{2}$/,\n CN: /^(?:(?:\\+|00)86)?1\\d{10}$/,\n CO: /^(?:(?:\\+57|0057)?)?[1-8]{1}\\d{6,7}$/,\n OM: /^(?:\\+?968)?(?:95|96|97|98)\\d{6}$/,\n CR: /^(?:(?:\\+506)?\\s*|0)?[1-9]\\d{7}$/,\n CU: /^(?:\\+?53)?(?:[5-8]\\d{7})$/,\n CZ: /^(?:\\+?420)?(?:\\d{9})$/,\n DK: /^(?:\\+?45)?(?:\\d{8})$/,\n DO: /^(?:(?:\\+1)?809|1-8(?:00|88|89))(?:\\d{7})$/,\n DZ: /^(?:\\+?213|0)([567]\\d{8})$/,\n EG: /^(?:(?:\\+20|20)?(\\d{10}))$/,\n ET: /^(?:\\+?251)?[1-59]\\d{8}$/,\n EU: /^(?:(?:\\+?3)?8)?\\s*(?:\\d{3}\\s*){3}\\d{2}$/,\n FJ: /^(?:(?:\\+?679)?\\s?\\d{3}\\s?\\d{4})?$/,\n GB: /^(?:(?:\\+44\\s?|0)7\\d{3}(\\s?\\d{4,})?)$/,\n GH: /^(?:(?:\\+233)|0)?(?:\\d{9})$/,\n GI: /^(?:\\+350)?\\d{5}$/,\n GM: /^(?:\\+220)?\\d{5,7}$/,\n GT: /^(?:\\+502)?[2468]\\d{7,8}$/,\n GY: /^(?:(?:\\+592)?(?:(?:\\s)?[2-9])(?:(?:\\s)?\\d))?(?:(?:\\s)?\\d{4})$/,\n HK: /^(?:\\+852\\s?)?[456789]\\d{3}\\s?\\d{4}$/,\n HN: /^(?:\\+504)?[89]\\d{7}$/,\n HR: /^(?:\\+?385)?\\d{8,9}$/,\n HT: /^(?:\\+?509)?\\d{8}$/,\n HU: /^(?:(?:\\+36))(\\s?\\d{2}\\s?\\d{3}\\s?\\d{4})$/,\n ID: /^(?:\\+?62|0[1-9])[\\s-]?\\d{2,4}[\\s-]?\\d{3,4}[\\s-]?\\d{3,4}$/,\n IL: /^(?:(?:\\+972|0)(?:-)?)[23489]\\d{7}$/,\n JM: /^(?:(?:\\+1876))\\d{7,10}$/,\n KE: /^(?:(?:\\+254)|(?:0))(?:\\d{6,7})$/,\n KG: /^(?:\\+996)?\\s?\\d{9}$/,\n KH: /^(?:(?:\\+855)|(?:0))(?:\\s?[1-9]\\d{7,8})$/,\n KY: /^(?:\\+?1\\s?(345))\\d{6}$/,\n KZ: /^(?:\\+?7|8)?7\\d{9}$/,\n LA: /^(?:(?:\\+?856)|0)(20\\d{7,9})$/,\n LK: /^(?:(?:\\+94)|0)(?:\\d{9})$/,\n LR: /^(?:\\+231)[ -\\d]{4}[ -\\d]{4}$/,\n LS: /^(?:(?:\\+?266)|0)?[56]\\d{7}$/,\n MA: /^(?:(?:\\+?212(\\s*[-|\\s*]?\\d{1,9})?)|(?:0))(?:\\d{9})$/,\n MD: /^(?:(?:\\+373)|(?:0))(?:\\d{7,8})$/,\n MK: /^(?:\\+389|0)(?:(?:2[0-4]|[3-9])\\s?)?\\d{6}$/,\n MM: /^(?:(?:\\+?95)|0)?[1-9]\\d{9}$/,\n MN: /^(?:\\+976|0)\\d{8}$/,\n MO: /^(?:(?:\\+?853)|[0-9])?\\d{8}$/,\n MU: /^(?:\\+230|0)?\\d{8}$/,\n MV: /^(?:(?:\\+?960)|0)?\\d{7}$/,\n MW: /^(?:\\+265)[1-9]\\d{6}$/,\n MX: /^(?:(?:\\+?52)?\\s?(?:1|01)?\\s?)?(?:\\d{3}\\s?\\d{3}\\s?\\d{4})$/,\n NA: /^(?:(?:\\+264)|0)?\\d{8}$/,\n NG: /^(?:(?:\\+234)|(?:0))(?:\\d{7,8})$/,\n NI: /^(?:(?:\\+505))?(?:\\d{8})$/,\n NO: /^(?:(?:\\+?47)|\\d{2}|\\d{3})\\s?\\d{2}\\s?\\d{3}$/,\n NP: /^(?:(?:\\+977))?(\\d{9,10})$/,\n NZ: /^(?:\\+?64|0)(\\d{2,5} \\d{4,8}|\\d{3,4} \\d{4})$/,\n PE: /^(?:(?:\\+51)|0)?(?:9\\d{8})$/,\n PG: /^(?:\\+?675)?(?:[7-9]\\d{7})$/,\n PH: /^(?:(?:\\+?63)|0)(?:\\d{10})$/,\n PK: /^(?:(?:\\+92)|0)?[345]\\d{9}$/,\n QA: /^(?:\\+?974)?-?33\\d{5}$/,\n RU: /^(?:\\+?7|8)?[ -]?\\(?9\\d{2}\\)?[ -]?\\d{3}[ -]?\\d{2}[ -]?\\d{2}$/,\n SA: /^(?:\\+?966)?\\s?1?[\\s-]?(?:[45]\\d{2}|5\\d{3})[\\s-]?\\d{4}$/,\n SC: /^(?:(?:\\+248)|\\d{4})\\d{5}$/,\n SE: /^(?:\\+?46|0)\\s?[1-57-9](?:[0-9]\\s?){8}$/,\n SG: /^(?:(?:\\+65)|(?:\\(\\+65\\))|(?:65))\\d{4}\\d{4}$/,\n SL: /^(?:(?:\\+232)|(?:0))?\\d{9}$/,\n SO: /^(?:\\+252|0)?[567]\\d{7}$/,\n SS: /^(?:\\+211|0)?[1-9]\\d{7,9}$/,\n SV: /^(?:(?:\\+?503)|(?:0))(?:\\d{8})$/,\n SZ: /^(?:\\+?268)?\\d{7,8}$/,\n TH: /^(?:(?:\\+66)|0)\\d{9}$/,\n TT: /^(?:(?:\\+?1-868)|\\(?868\\)?)(\\d{7})$/,\n TZ: /^(?:(?:\\+?255)|0)?[67]\\d{8}$/,\n US: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n CA: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n UY: /^(?:(?:\\+598|0)\\s?(9\\d{3}|2\\d{2}|[4-9]\\d{6}))$/,\n UZ: /^(?:\\+?998)?\\s?[3456789]\\d{8}$/,\n YE: /^(?:\\+?967)?(?:\\d{7,8})$/,\n ZA: /^(?:(?:\\+27)|0)(\\d{9})$/,\n KW: /^(?:\\+?965)[569]\\d{7}$/,\n BH: /^(?:\\+?973)?[356]\\d{7}$/,\n TL: /^(?:(?:\\+670)\\s?)?[0-9]{3}\\s?[0-9]{3,4}$/,\n VC: /^(?:(?:\\+1)?784)?(?:\\d{3})?\\d{7}$/,\n VE: /^(?:(?:\\+58)|0)?4\\d{9}$/,\n VN: /^(?:(?:\\+84)|0)?[1-9]\\d{8}$/,\n ZM: /^(?:(?:\\+260)|0)?[123456789]\\d{8,9}$/,\n ZW: /^(?:(?:\\+263)|0)?(?:\\d{9,10})$/,\n LT: /^(?:(?:\\+370)|8)\\d{8}$/,\n LU: /^(?:(?:\\+352)?(6|2(6|7|8|9))\\d{6})$/,\n LV: /^(?:(?:\\+371)?2\\d{7})$/,\n ME: /^(?:(?:\\+382)?[67]\\d{7,20})$/,\n MG: /^(?:(?:\\+261)?3[234568]\\d{7})$/,\n MZ: /^(?:(?:\\+258)|(?:258))?8[234567]\\d{7,8}$/,\n NL: /^(?:(?:\\+31)|0(6(?:\\d{8})|[1-9](?:(?:\\d{8})|(?:\\s\\d{3}\\s\\d{4}))|(?:\\d{8})))$/,\n PA: /^(?:(?:\\+507)\\s?)?[46]\\d{6,7}$/,\n PL: /^(?:(?:\\+48)?(?:\\s?\\d{3}\\s?\\d{3}\\s?\\d{3}|(?:\\d{2}\\s?){4}\\d{2}|\\d{3}-\\d{3}-\\d{3}))$/,\n PR: /^(?:(?:\\+1)?787|939)\\d{7}$/,\n PS: /^(?:(?:\\+970))(5[2349])\\d{7}$/,\n PT: /^(?:(?:\\+351)?9(1\\d|2[1-9]|6[12345789]|7[12345789])\\d{7})$/,\n PY: /^(?:(?:\\+595|0)9[9876]\\d{7})$/,\n RO: /^(?:(?:\\+40|0))(?:7[2-8]\\d{7}|21\\d{8})$/,\n RS: /^(?:(?:\\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/,\n RW: /^(?:(?:\\+250)|(0))\\d{9}$/,\n SI: /^(?:(?:\\+386)|0)?[1-59]\\d{7,8}$/,\n SK: /^(?:(?:\\+421))?(0|9[0-8])\\d{8}$/,\n SM: /^(?:(?:\\+378)|(0549|6\\d{4}))\\d{5}$/,\n SN: /^(?:(?:\\+221)|0)?[3679]\\d{7}$/,\n SR: /^(?:(?:\\+597))\\d{7}$/,\n TG: /^(?:(?:\\+228))\\d{8}$/,\n TJ: /^(?:(?:\\+992))(37|55|77)\\d{7}$/,\n TN: /^(?:(?:\\+216)|22|9[1-9])\\d{7}$/,\n TR: /^(?:(?:\\+90)|(0))\\s?5\\d{9}$/,\n TW: /^(?:(?:\\+886)|0)?9\\d{8}$/,\n UA: /^(?:(?:\\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\\d{7}$/,\n UG: /^(?:(?:\\+256)|0)?[39]\\d{8}$/,\n};\n","/* Source: Google LibPhoneNumber Metadata: https://github.com/google/libphonenumber/blob/master/javascript/i18n/phonenumbers/metadata.js */\n\nexport const DIAL_CODE_MAPPER: { [key: number]: string[] } = {\n 1: [\n 'US',\n 'AG',\n 'AI',\n 'AS',\n 'BB',\n 'BM',\n 'BS',\n 'CA',\n 'DM',\n 'DO',\n 'GD',\n 'GU',\n 'JM',\n 'KN',\n 'KY',\n 'LC',\n 'MP',\n 'MS',\n 'PR',\n 'SX',\n 'TC',\n 'TT',\n 'VC',\n 'VG',\n 'VI',\n ],\n 7: ['RU', 'KZ'],\n 20: ['EG'],\n 27: ['ZA'],\n 30: ['GR'],\n 31: ['NL'],\n 32: ['BE'],\n 33: ['FR'],\n 34: ['ES'],\n 36: ['HU'],\n 39: ['IT', 'VA'],\n 40: ['RO'],\n 41: ['CH'],\n 43: ['AT'],\n 44: ['GB', 'GG', 'IM', 'JE'],\n 45: ['DK'],\n 46: ['SE'],\n 47: ['NO', 'SJ'],\n 48: ['PL'],\n 49: ['DE'],\n 51: ['PE'],\n 52: ['MX'],\n 53: ['CU'],\n 54: ['AR'],\n 55: ['BR'],\n 56: ['CL'],\n 57: ['CO'],\n 58: ['VE'],\n 60: ['MY'],\n 61: ['AU', 'CC', 'CX'],\n 62: ['ID'],\n 63: ['PH'],\n 64: ['NZ'],\n 65: ['SG'],\n 66: ['TH'],\n 81: ['JP'],\n 82: ['KR'],\n 84: ['VN'],\n 86: ['CN'],\n 90: ['TR'],\n 91: ['IN'],\n 92: ['PK'],\n 93: ['AF'],\n 94: ['LK'],\n 95: ['MM'],\n 98: ['IR'],\n 211: ['SS'],\n 212: ['MA', 'EH'],\n 213: ['DZ'],\n 216: ['TN'],\n 218: ['LY'],\n 220: ['GM'],\n 221: ['SN'],\n 222: ['MR'],\n 223: ['ML'],\n 224: ['GN'],\n 225: ['CI'],\n 226: ['BF'],\n 227: ['NE'],\n 228: ['TG'],\n 229: ['BJ'],\n 230: ['MU'],\n 231: ['LR'],\n 232: ['SL'],\n 233: ['GH'],\n 234: ['NG'],\n 235: ['TD'],\n 236: ['CF'],\n 237: ['CM'],\n 238: ['CV'],\n 239: ['ST'],\n 240: ['GQ'],\n 241: ['GA'],\n 242: ['CG'],\n 243: ['CD'],\n 244: ['AO'],\n 245: ['GW'],\n 246: ['IO'],\n 247: ['AC'],\n 248: ['SC'],\n 249: ['SD'],\n 250: ['RW'],\n 251: ['ET'],\n 252: ['SO'],\n 253: ['DJ'],\n 254: ['KE'],\n 255: ['TZ'],\n 256: ['UG'],\n 257: ['BI'],\n 258: ['MZ'],\n 260: ['ZM'],\n 261: ['MG'],\n 262: ['RE', 'YT'],\n 263: ['ZW'],\n 264: ['NA'],\n 265: ['MW'],\n 266: ['LS'],\n 267: ['BW'],\n 268: ['SZ'],\n 269: ['KM'],\n 290: ['SH', 'TA'],\n 291: ['ER'],\n 297: ['AW'],\n 298: ['FO'],\n 299: ['GL'],\n 350: ['GI'],\n 351: ['PT'],\n 352: ['LU'],\n 353: ['IE'],\n 354: ['IS'],\n 355: ['AL'],\n 356: ['MT'],\n 357: ['CY'],\n 358: ['FI', 'AX'],\n 359: ['BG'],\n 370: ['LT'],\n 371: ['LV'],\n 372: ['EE'],\n 373: ['MD'],\n 374: ['AM'],\n 375: ['BY'],\n 376: ['AD'],\n 377: ['MC'],\n 378: ['SM'],\n 380: ['UA'],\n 381: ['RS'],\n 382: ['ME'],\n 383: ['XK'],\n 385: ['HR'],\n 386: ['SI'],\n 387: ['BA'],\n 389: ['MK'],\n 420: ['CZ'],\n 421: ['SK'],\n 423: ['LI'],\n 500: ['FK'],\n 501: ['BZ'],\n 502: ['GT'],\n 503: ['SV'],\n 504: ['HN'],\n 505: ['NI'],\n 506: ['CR'],\n 507: ['PA'],\n 508: ['PM'],\n 509: ['HT'],\n 590: ['GP', 'BL', 'MF'],\n 591: ['BO'],\n 592: ['GY'],\n 593: ['EC'],\n 594: ['GF'],\n 595: ['PY'],\n 596: ['MQ'],\n 597: ['SR'],\n 598: ['UY'],\n 599: ['CW', 'BQ'],\n 670: ['TL'],\n 672: ['NF'],\n 673: ['BN'],\n 674: ['NR'],\n 675: ['PG'],\n 676: ['TO'],\n 677: ['SB'],\n 678: ['VU'],\n 679: ['FJ'],\n 680: ['PW'],\n 681: ['WF'],\n 682: ['CK'],\n 683: ['NU'],\n 685: ['WS'],\n 686: ['KI'],\n 687: ['NC'],\n 688: ['TV'],\n 689: ['PF'],\n 690: ['TK'],\n 691: ['FM'],\n 692: ['MH'],\n 800: ['001'],\n 808: ['001'],\n 850: ['KP'],\n 852: ['HK'],\n 853: ['MO'],\n 855: ['KH'],\n 856: ['LA'],\n 870: ['001'],\n 878: ['001'],\n 880: ['BD'],\n 881: ['001'],\n 882: ['001'],\n 883: ['001'],\n 886: ['TW'],\n 888: ['001'],\n 960: ['MV'],\n 961: ['LB'],\n 962: ['JO'],\n 963: ['SY'],\n 964: ['IQ'],\n 965: ['KW'],\n 966: ['SA'],\n 967: ['YE'],\n 968: ['OM'],\n 970: ['PS'],\n 971: ['AE'],\n 972: ['IL'],\n 973: ['BH'],\n 974: ['QA'],\n 975: ['BT'],\n 976: ['MN'],\n 977: ['NP'],\n 979: ['001'],\n 992: ['TJ'],\n 993: ['TM'],\n 994: ['AZ'],\n 995: ['GE'],\n 996: ['KG'],\n 998: ['UZ'],\n};\n","import { DIAL_CODE_MAPPER } from './data/dialCodeMapper';\nimport { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\n\n/**\n * Determines the country code based on the provided phone number.\n * This function employs a multi-step approach to identify the country code:\n * - If the phone number starts with '+', it extracts the numeric characters\n * and matches the leading digits with known dial codes mapped to countries.\n * - For matched dial codes, it further filters based on country-specific regex patterns\n * to validate the phone number format for those countries.\n * - If the phone number doesn't start with '+', it directly matches the number\n * against regular expressions associated with various countries to identify the code.\n *\n * @param phoneNumber The input phone number (string or number).\n * @returns The detected country code or an empty string if not found.\n */\nexport const detectCountryCodeFromDialCode = (\n phoneNumber: string | number,\n): string => {\n // If the phone number starts with '+', extract numeric characters\n if (phoneNumber.toString().charAt(0) === '+') {\n const cleanedPhoneNumberWithoutPlusPrefix = phoneNumber\n .toString()\n .replace(/\\D/g, '');\n\n const matchingCountries: string[] = [];\n\n // Iterate through dial codes and check for matches with cleaned phone number\n for (const code in DIAL_CODE_MAPPER) {\n if (cleanedPhoneNumberWithoutPlusPrefix.startsWith(code)) {\n matchingCountries.push(...DIAL_CODE_MAPPER[code]);\n }\n }\n\n // Filter matching countries based on phone number validation regex\n const matchedCountryCode = matchingCountries.find((countryCode: string) => {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex && regex.test(phoneNumber.toString())) return countryCode;\n return undefined;\n });\n\n // Return the first matched country code, if any\n return matchedCountryCode || '';\n } else {\n // If phone number doesn't start with '+', directly match against country regexes\n for (const countryCode in PHONE_REGEX_MAPPER) {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex.test(phoneNumber.toString())) {\n return countryCode;\n }\n }\n }\n\n // Return empty string if no country code is detected\n return '';\n};\n\nexport const cleanPhoneNumber = (phoneNumber: string) => {\n // Regular expression to match all characters except numbers and + sign at the start\n const regex = /[^0-9+]|(?!A)\\+/g;\n // Replace matched characters with an empty string\n const cleanedPhoneNumber = phoneNumber.replace(regex, '');\n return phoneNumber[0] === '+' ? `+${cleanedPhoneNumber}` : cleanedPhoneNumber;\n};\n","import { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Validates whether a given phone number is valid based on the provided country code or auto-detects the country code and checks if the number matches the defined regex pattern for that country.\nconst isValidPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_REGEX_MAPPER,\n): boolean => {\n // Clean the provided phoneNumber by removing non-numeric characters\n const cleanedPhoneNumber = cleanPhoneNumber(phoneNumber.toString());\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_REGEX_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(cleanedPhoneNumber);\n\n // Return false if phoneNumber is empty\n if (!phoneNumber) return false;\n\n // Check if the countryCode exists in the PHONE_REGEX_MAPPER\n if (countryCode in PHONE_REGEX_MAPPER) {\n // Fetch the regex pattern for the countryCode\n const regex = PHONE_REGEX_MAPPER[countryCode];\n // Test if the cleanedPhoneNumber matches the regex pattern\n return regex.test(cleanedPhoneNumber as string);\n }\n\n // Return false if the countryCode is not supported\n return false;\n};\n\nexport default withErrorBoundary(isValidPhoneNumber);\n","export const PHONE_FORMATTER_MAPPER: { [key: string]: string } = {\n IN: 'xxxx xxxxxx',\n MY: 'xx xxxxx xx',\n AE: 'xx xxx xxxx',\n AL: 'xxx xx xxxx',\n AM: 'xx xx xx xx',\n AR: 'xxxx-xxxx',\n AU: 'xxx xxx xxx',\n AW: 'xxx-xxxx',\n BB: 'xxx-xxxx',\n BD: 'xxxx-xxxxxx',\n BM: 'xxx-xxxx',\n BN: 'xxxx-xxxx',\n BO: 'xxxx-xxxx',\n BS: 'xxx-xxxx',\n BW: 'xx xxxx xxxx',\n BZ: 'xxx-xxxx',\n CA: 'xxx-xxx-xxxx',\n CH: 'xxx xxx xxx',\n CN: 'xxxx-xxxxxxx',\n CO: 'xxxx-xxxxxxx',\n CR: 'xxxx-xxxx',\n CU: 'xxxx-xxxx',\n CZ: 'xxx xxx xxx',\n DK: 'xx xx xx xx',\n DO: 'xxx-xxxxxxx',\n DZ: 'xxxx-xxxx-xxx',\n EG: 'xx xxx xxxx',\n ET: 'xx xxx xxxx',\n EU: 'xxx xx xx xx',\n FJ: 'xxxx xxxx',\n GB: 'xxxx xxx xxx',\n GH: 'xxx xxx xxxx',\n GI: 'xxxx xxxx',\n GM: 'xxxx-xxxx',\n GT: 'xxxx-xxxx',\n GY: 'xxx-xxxx',\n HK: 'xxxx xxxx',\n HN: 'xxxx-xxxx',\n HR: 'xxx xxx xxxx',\n HT: 'xxx-xxxx',\n HU: 'xxx xxx xxxx',\n ID: 'xxxx-xxxx-xxxx',\n IL: 'xxxx-xxx-xxx',\n JM: 'xxx-xxxx',\n KE: 'xxx xxxxxx',\n KG: 'xxx-xx-xx-xx',\n KH: 'xxx-xxx-xxx',\n KY: 'xxx-xxxx',\n KZ: 'xxx-xxx-xx-xx',\n LA: 'xxx xx xxxx',\n LK: 'xx xxx xxxx',\n LR: 'xxx-xxx-xxxx',\n LS: 'xxx xx xxxx',\n LT: 'xxx xxxxx',\n LU: 'xxx xx xxx',\n LV: 'xxxx xxxx',\n MA: 'xxxx-xxxxxx',\n MD: 'xx xxxxxx',\n ME: 'xx xxxxxx',\n MG: 'xx xx xx xx xx',\n MK: 'xx xx xx xx',\n MM: 'xx xxxxxx',\n MN: 'xxx-xx-xxxx',\n MO: 'xxxx xxxx',\n MU: 'xx xxxx xxxx',\n MV: 'xxxxxx',\n MW: 'xx xxxx xxxx',\n MX: 'xxx-xxx-xxxx',\n MZ: 'xx xxxxxxx',\n NA: 'xx xxxx xxxx',\n NG: 'xxx xxx xxxx',\n NI: 'xxxx-xxxx',\n NL: 'xxx-xxxxxxx',\n NO: 'xxxx xxxx',\n NP: 'xxxx-xxxxxxx',\n NZ: 'xxx-xxxxxxx',\n OM: 'xxxx-xxxx',\n PA: 'xxx-xxxx',\n PE: 'xxx-xxx-xxx',\n PG: 'xxx-xxxxxx',\n PH: 'xxx-xxxx',\n PK: 'xxx-xxxxxxx',\n PL: 'xxx xxx xxx',\n PR: 'xxx-xxx-xxxx',\n PS: 'xxxx-xxxxxxx',\n PT: 'xxx xxx xxx',\n PY: 'xxx-xxxxxx',\n QA: 'xxxx xxxx',\n RO: 'xxx xxx xxxx',\n RS: 'xxx xxxxx',\n RU: 'xxx xxx-xx-xx',\n RW: 'xxx xxxxxx',\n SA: 'xxx-xxxxxxx',\n SC: 'xx xxxxx',\n SE: 'xxx-xxx xx xx',\n SG: 'xxxx xxxx',\n SI: 'xx xxxxxx',\n SK: 'xxx xxx xxx',\n SL: 'xxx-xxxxxx',\n SM: 'xxxxx xxxxx',\n SN: 'xx xxx xx xx',\n SO: 'xxx xxxxxxx',\n SR: 'xxx-xxxx',\n SS: 'xxx xxxx xxx',\n SV: 'xxxx-xxxx',\n SZ: 'xxx xx xxxx',\n TG: 'xx xx xx xx',\n TH: 'xxx-xxxxxxx',\n TJ: 'xxx xx xx xx',\n TL: 'xxx-xxxxxxx',\n TN: 'xx xxxxxx',\n TR: 'xxx xxx xx xx',\n TT: 'xxx-xxxx',\n TW: 'xxxx-xxxxxx',\n TZ: 'xxx xxx xxxx',\n UA: 'xx xxx xx xx',\n UG: 'xxx xxxxxxx',\n US: 'xxx-xxx-xxxx',\n UY: 'xxx-xxxxx',\n UZ: 'xxx-xxx-xx-xx',\n VC: 'xxx-xxxx',\n VE: 'xxxx-xxx-xxxx',\n VN: 'xxxx-xxxxxxx',\n YE: 'xxxx-xxxx',\n ZA: 'xxx-xxx-xxxx',\n ZM: 'xxx-xxxxxxx',\n ZW: 'xx xxx xxxx',\n KW: 'xxx xx xxxx',\n BH: 'xxxx xxxx',\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Formats a provided phone number according to the predefined format for a specific country code, or auto-detects the country code and formats the number accordingly.\nconst formatPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_FORMATTER_MAPPER,\n): string => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Convert phoneNumber to string and clean it by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_FORMATTER_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Fetch the pattern for the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern) return phoneNumber;\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n // Extract the phoneNumber without the prefix\n const phoneNumberWithoutPrefix = phoneNumber.slice(diff);\n const formattedNumber: string[] = [];\n let numberIndex = 0;\n\n // Loop through the pattern to format the phoneNumber\n for (let i = 0; i < pattern.length; i++) {\n const patternChar = pattern[i];\n if (patternChar === 'x') {\n // Insert phoneNumber digits at 'x' positions\n if (numberIndex < phoneNumberWithoutPrefix.length) {\n formattedNumber.push(phoneNumberWithoutPrefix[numberIndex]);\n numberIndex++;\n }\n } else {\n // Insert non-digit characters from the pattern\n formattedNumber.push(patternChar);\n }\n }\n\n // Join the formattedNumber array to create the formattedPhoneNumber without prefix\n const formattedPhoneNumberWithoutPrefix = formattedNumber.join('');\n // Combine the prefix and formattedPhoneNumberWithoutPrefix\n const formattedPhoneNumberWithPrefix =\n phoneNumber.slice(0, diff) + ' ' + formattedPhoneNumberWithoutPrefix;\n\n // Return the formattedPhoneNumber with prefix after trimming whitespace\n return formattedPhoneNumberWithPrefix.trim();\n};\n\nexport default withErrorBoundary(formatPhoneNumber);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport formatPhoneNumber from './formatPhoneNumber';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\ninterface PhoneInfo {\n countryCode: string;\n dialCode: string;\n formattedPhoneNumber: string;\n formatTemplate: string;\n}\n\n// Parses a given phone number, identifies its country code (if not provided), and returns an object with details including the country code, formatted phone number, dial code, and format template.\nconst parsePhoneNumber = (phoneNumber: string, country?: string): PhoneInfo => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Clean the phoneNumber by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n const countryCode =\n country && country in PHONE_FORMATTER_MAPPER\n ? country\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Format the phone number using the detected/validated country code\n const formattedPhoneNumber = formatPhoneNumber(phoneNumber, countryCode);\n\n // Fetch the pattern associated with the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern)\n return {\n countryCode: countryCode || '',\n dialCode: '',\n formattedPhoneNumber: phoneNumber,\n formatTemplate: '',\n };\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n\n // Extract the dialCode from the phoneNumber\n const dialCode = phoneNumber.slice(0, diff);\n\n // Obtain the format template associated with the countryCode\n const formatTemplate = PHONE_FORMATTER_MAPPER[countryCode];\n\n // Return the parsed phone number information\n return {\n countryCode,\n formattedPhoneNumber,\n dialCode,\n formatTemplate,\n };\n};\n\nexport default withErrorBoundary(parsePhoneNumber);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Adds a specified amount of time to a date.\n *\n * @param date The original date.\n * @param value The amount to add.\n * @param unit The unit of time to add (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time added.\n */\nconst add = (\n date: Date,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n const result = new Date(date);\n switch (unit) {\n case 'days':\n result.setDate(result.getDate() + value);\n break;\n case 'months':\n result.setMonth(result.getMonth() + value);\n break;\n case 'years':\n result.setFullYear(result.getFullYear() + value);\n break;\n }\n return result;\n};\n\nexport default withErrorBoundary(add);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale, DateTimeFormatOptions } from './types';\n\n/**\n * Formats date and time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional).\n * @returns {string} Formatted date and time string.\n */\nconst formatDateTime = (\n date: DateInput,\n locale: Locale,\n options: DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const dateObj: Date = date instanceof Date ? date : new Date(date);\n let formatter;\n\n try {\n formatter = new Intl.DateTimeFormat(locale, options);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formatter.format(dateObj);\n};\n\nexport default withErrorBoundary(formatDateTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n DateFormatOptions,\n} from './types';\n\n/**\n * Formats date based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional).\n * @returns {string} Formatted date string.\n */\nconst formatDate = (\n date: DateInput,\n locale: Locale,\n options: DateFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n timeStyle: undefined,\n };\n\n let formattedDate;\n\n try {\n formattedDate = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedDate;\n};\n\nexport default withErrorBoundary(formatDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n TimeFormatOptions,\n} from './types';\n\n/**\n * Formats time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional).\n * @returns {string} Formatted time string.\n */\nconst formatTime = (\n date: DateInput,\n locale: Locale,\n options: TimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n dateStyle: undefined,\n };\n\n let formattedTime;\n\n try {\n formattedTime = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedTime;\n};\n\nexport default withErrorBoundary(formatTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\n\n/**\n * Gets the first day of the week for a given locale.\n *\n * @param locale The locale to determine the first day of the week for.\n * @returns The first day of the week (0-6, where 0 is Sunday).\n */\nconst getFirstDayOfWeek = (locale: string): number => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n let formatted;\n\n try {\n const formatter = new Intl.DateTimeFormat(locale, { weekday: 'short' });\n const sampleDate = new Date(2000, 0, 2); // A Sunday\n formatted = formatter.format(sampleDate);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return ['su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'].indexOf(\n formatted.slice(0, 2).toLowerCase(),\n );\n};\n\nexport default withErrorBoundary(getFirstDayOfWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Determines the quarter of the year for a given date.\n *\n * @param date The date to determine the quarter for.\n * @returns The quarter of the year (1-4).\n */\nconst getQuarter = (date: Date): number => {\n return Math.ceil((date.getMonth() + 1) / 3);\n};\n\nexport default withErrorBoundary(getQuarter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Provides a relative time string (e.g., '3 hours ago', 'in 2 days').\n * This function calculates the difference between the given date and the base date,\n * then formats it in a locale-sensitive manner. It allows customization of the output\n * through Intl.RelativeTimeFormat options.\n *\n * @param date - The date to compare.\n * @param baseDate - The date to compare against (default: current date).\n * @param locale - The locale to use for formatting.\n * @param options - Options for the Intl.RelativeTimeFormat (optional).\n * @returns The relative time as a string.\n */\nconst getRelativeTime = (\n date: Date,\n baseDate: Date = new Date(),\n locale: Locale,\n options?: Intl.RelativeTimeFormatOptions,\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000;\n\n // Define time units in seconds\n const minute = 60;\n const hour = minute * 60;\n const day = hour * 24;\n const week = day * 7;\n const month = day * 30;\n const year = day * 365;\n\n let value: number;\n let unit: Intl.RelativeTimeFormatUnit;\n\n if (Math.abs(diffInSeconds) < minute) {\n value = diffInSeconds;\n unit = 'second';\n } else if (Math.abs(diffInSeconds) < hour) {\n value = diffInSeconds / minute;\n unit = 'minute';\n } else if (Math.abs(diffInSeconds) < day) {\n value = diffInSeconds / hour;\n unit = 'hour';\n } else if (Math.abs(diffInSeconds) < week) {\n value = diffInSeconds / day;\n unit = 'day';\n } else if (Math.abs(diffInSeconds) < month) {\n value = diffInSeconds / week;\n unit = 'week';\n } else if (Math.abs(diffInSeconds) < year) {\n value = diffInSeconds / month;\n unit = 'month';\n } else {\n value = diffInSeconds / year;\n unit = 'year';\n }\n\n let relativeTime;\n\n try {\n const rtf = new Intl.RelativeTimeFormat(locale, options);\n relativeTime = rtf.format(Math.round(value), unit);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return relativeTime;\n};\n\nexport default withErrorBoundary(getRelativeTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Calculates the week number of the year for a given date.\n *\n * @param date The date to calculate the week number for.\n * @returns The week number of the year.\n */\nconst getWeek = (date: Date): number => {\n const firstDayOfYear = new Date(date.getFullYear(), 0, 1);\n const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000;\n return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7);\n};\n\nexport default withErrorBoundary(getWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Returns an array of weekdays according to the specified locale.\n *\n * @param locale The locale to get weekdays for.\n * @returns An array of weekday names.\n */\nconst getWeekdays = (locale: Locale): string[] => {\n try {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n const formatter = new Intl.DateTimeFormat(locale, { weekday: 'long' });\n return Array.from({ length: 7 }, (_, i) =>\n formatter.format(new Date(1970, 0, 4 + i)),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(getWeekdays);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\n\n/**\n * Compares two dates to determine if the first is after the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is after date2.\n */\nconst isAfter = (date1: DateInput, date2: DateInput): boolean => {\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 > dateObj2;\n};\n\nexport default withErrorBoundary(isAfter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\n\n/**\n * Compares two dates to determine if the first is before the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is before date2.\n */\nconst isBefore = (date1: DateInput, date2: DateInput): boolean => {\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 < dateObj2;\n};\n\nexport default withErrorBoundary(isBefore);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given year is a leap year.\n *\n * @param year The year to check.\n * @returns True if the year is a leap year, false otherwise.\n */\nconst isLeapYear = (year: number): boolean => {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n};\n\nexport default withErrorBoundary(isLeapYear);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if two dates fall on the same day.\n *\n * @param date1 The first date.\n * @param date2 The second date.\n * @returns True if both dates are on the same day, false otherwise.\n */\nconst isSameDay = (date1: Date, date2: Date): boolean => {\n return (\n date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear()\n );\n};\n\nexport default withErrorBoundary(isSameDay);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given object is a valid Date object.\n *\n * @param date The object to check.\n * @returns True if the object is a valid Date, false otherwise.\n */\nconst isValidDate = (date: any): boolean => {\n return date instanceof Date && !isNaN(date.getTime());\n};\n\nexport default withErrorBoundary(isValidDate);\n","export const LOCALE_DATE_FORMATS: { [key: string]: string } = {\n 'ar-AE': 'DD/MM/YYYY', // Arabic (U.A.E.)\n 'sq-AL': 'DD.MM.YYYY', // Albanian (Albania)\n 'hy-AM': 'DD.MM.YYYY', // Armenian (Armenia)\n 'es-AR': 'DD/MM/YYYY', // Spanish (Argentina)\n 'en-AU': 'DD/MM/YYYY', // English (Australia)\n 'nl-AW': 'DD-MM-YYYY', // Dutch (Aruba)\n 'en-BB': 'MM/DD/YYYY', // English (Barbados)\n 'bn-BD': 'DD/MM/YYYY', // Bengali (Bangladesh)\n 'en-BM': 'MM/DD/YYYY', // English (Bermuda)\n 'ms-BN': 'DD/MM/YYYY', // Malay (Brunei)\n 'es-BO': 'DD/MM/YYYY', // Spanish (Bolivia)\n 'en-BS': 'MM/DD/YYYY', // English (Bahamas)\n 'en-BW': 'DD/MM/YYYY', // English (Botswana)\n 'en-BZ': 'MM/DD/YYYY', // English (Belize)\n 'en-CA': 'DD/MM/YYYY', // English (Canada)\n 'de-CH': 'DD.MM.YYYY', // German (Switzerland)\n 'zh-CN': 'YYYY/MM/DD', // Chinese (China)\n 'es-CO': 'DD/MM/YYYY', // Spanish (Colombia)\n 'es-CR': 'DD/MM/YYYY', // Spanish (Costa Rica)\n 'es-CU': 'DD/MM/YYYY', // Spanish (Cuba)\n 'cs-CZ': 'DD.MM.YYYY', // Czech (Czech Republic)\n 'da-DK': 'DD-MM-YYYY', // Danish (Denmark)\n 'es-DO': 'DD/MM/YYYY', // Spanish (Dominican Republic)\n 'ar-DZ': 'DD/MM/YYYY', // Arabic (Algeria)\n 'ar-EG': 'DD/MM/YYYY', // Arabic (Egypt)\n 'am-ET': 'DD/MM/YYYY', // Amharic (Ethiopia)\n 'en-EU': 'DD/MM/YYYY', // English (European Union)\n 'en-FJ': 'DD/MM/YYYY', // English (Fiji)\n 'en-GB': 'DD/MM/YYYY', // English (United Kingdom)\n 'en-GH': 'DD/MM/YYYY', // English (Ghana)\n 'en-GI': 'DD/MM/YYYY', // English (Gibraltar)\n 'en-GM': 'DD/MM/YYYY', // English (Gambia)\n 'es-GT': 'DD/MM/YYYY', // Spanish (Guatemala)\n 'en-GY': 'DD/MM/YYYY', // English (Guyana)\n 'en-HK': 'DD/MM/YYYY', // English (Hong Kong)\n 'es-HN': 'DD/MM/YYYY', // Spanish (Honduras)\n 'hr-HR': 'DD.MM.YYYY', // Croatian (Croatia)\n 'ht-HT': 'MM/DD/YYYY', // Haitian (Haiti)\n 'hu-HU': 'YYYY. MM. DD.', // Hungarian (Hungary)\n 'id-ID': 'DD/MM/YYYY', // Indonesian (Indonesia)\n 'he-IL': 'DD/MM/YYYY', // Hebrew (Israel)\n 'en-IN': 'DD-MM-YYYY', // English (India)\n 'en-JM': 'MM/DD/YYYY', // English (Jamaica)\n 'en-KE': 'DD/MM/YYYY', // English (Kenya)\n 'ky-KG': 'DD.MM.YYYY', // Kyrgyz (Kyrgyzstan)\n 'km-KH': 'DD/MM/YYYY', // Khmer (Cambodia)\n 'en-KY': 'MM/DD/YYYY', // English (Cayman Islands)\n 'kk-KZ': 'DD.MM.YYYY', // Kazakh (Kazakhstan)\n 'lo-LA': 'DD/MM/YYYY', // Lao (Laos)\n 'si-LK': 'YYYY-MM-DD', // Sinhala (Sri Lanka)\n 'en-LR': 'MM/DD/YYYY', // English (Liberia)\n 'en-LS': 'DD/MM/YYYY', // English (Lesotho)\n 'ar-MA': 'DD/MM/YYYY', // Arabic (Morocco)\n 'ro-MD': 'DD.MM.YYYY', // Romanian (Moldova)\n 'mk-MK': 'DD.MM.YYYY', // Macedonian (North Macedonia)\n 'my-MM': 'DD/MM/YYYY', // Burmese (Myanmar)\n 'mn-MN': 'YYYY.MM.DD', // Mongolian (Mongolia)\n 'zh-MO': 'DD/MM/YYYY', // Chinese (Macao)\n 'en-MU': 'DD/MM/YYYY', // English (Mauritius)\n 'dv-MV': 'DD/MM/YYYY', // Divehi (Maldives)\n 'en-MW': 'DD/MM/YYYY', // English (Malawi)\n 'es-MX': 'DD/MM/YYYY', // Spanish (Mexico)\n 'ms-MY': 'DD/MM/YYYY', // Malay (Malaysia)\n 'en-NA': 'DD/MM/YYYY', // English (Namibia)\n 'en-NG': 'DD/MM/YYYY', // English (Nigeria)\n 'es-NI': 'DD/MM/YYYY', // Spanish (Nicaragua)\n 'no-NO': 'DD.MM.YYYY', // Norwegian (Norway)\n 'ne-NP': 'YYYY/MM/DD', // Nepali (Nepal)\n 'en-NZ': 'DD/MM/YYYY', // English (New Zealand)\n 'es-PE': 'DD/MM/YYYY', // Spanish (Peru)\n 'en-PG': 'DD/MM/YYYY', // English (Papua New Guinea)\n 'en-PH': 'MM/DD/YYYY', // English (Philippines)\n 'en-PK': 'DD/MM/YYYY', // English (Pakistan)\n 'ar-QA': 'DD/MM/YYYY', // Arabic (Qatar)\n 'ru-RU': 'DD.MM.YYYY', // Russian (Russia)\n 'ar-SA': 'DD/MM/YYYY', // Arabic (Saudi Arabia)\n 'en-SC': 'DD/MM/YYYY', // English (Seychelles)\n 'sv-SE': 'YYYY-MM-DD', // Swedish (Sweden)\n 'en-SG': 'DD/MM/YYYY', // English (Singapore)\n 'en-SL': 'DD/MM/YYYY', // English (Sierra Leone)\n 'so-SO': 'DD/MM/YYYY', // Somali (Somalia)\n 'en-SS': 'DD/MM/YYYY', // English (South Sudan)\n 'es-SV': 'DD/MM/YYYY', // Spanish (El Salvador)\n 'en-SZ': 'DD/MM/YYYY', // English (Eswatini)\n 'th-TH': 'DD/MM/YYYY', // Thai (Thailand)\n 'en-TT': 'MM/DD/YYYY', // English (Trinidad and Tobago)\n 'sw-TZ': 'DD/MM/YYYY', // Swahili (Tanzania)\n 'en-US': 'MM/DD/YYYY', // English (United States)\n 'es-UY': 'DD/MM/YYYY', // Spanish (Uruguay)\n 'uz-UZ': 'DD/MM/YYYY', // Uzbek (Uzbekistan)\n 'ar-YE': 'DD/MM/YYYY', // Arabic (Yemen)\n 'en-ZA': 'YYYY/MM/DD', // English (South Africa)\n 'ar-KW': 'DD/MM/YYYY', // Arabic (Kuwait)\n 'ar-BH': 'DD/MM/YYYY', // Arabic (Bahrain)\n 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman)\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Parses a date string based on a specific format.\n *\n * @param dateString The date string to parse.\n * @param format The format to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDateWithFormat = (\n dateString: string,\n format: string,\n): Date | null => {\n // Determine the separator based on the format (supports '/', '.', or '-')\n const separator = format.includes('/')\n ? '/'\n : format.includes('.')\n ? '.'\n : '-';\n const formatParts = format.split(separator);\n const dateParts = dateString.split(separator).map((num) => parseInt(num, 10));\n\n let year: number = 0,\n month: number = 0,\n day: number = 0;\n let yearSet: boolean = false,\n monthSet: boolean = false,\n daySet: boolean = false;\n\n // Check for format and date string mismatch\n if (dateParts.length !== formatParts.length) {\n return null; // Mismatch between date string and format\n }\n\n formatParts.forEach((part, index) => {\n // Check for non-numeric values in date string\n if (isNaN(dateParts[index])) {\n return null; // Invalid date part\n }\n\n // Assign year, month, and day based on the format\n switch (part) {\n case 'DD':\n day = dateParts[index];\n daySet = true;\n break;\n case 'MM':\n month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date\n monthSet = true;\n break;\n case 'YYYY':\n year = dateParts[index];\n yearSet = true;\n break;\n }\n });\n\n // Validate and create the date only if all parts are set\n if (yearSet && monthSet && daySet) {\n const parsedDate = new Date(year, month, day);\n // Validate date to catch invalid dates like February 30th\n if (\n parsedDate.getFullYear() === year &&\n parsedDate.getMonth() === month &&\n parsedDate.getDate() === day\n ) {\n return parsedDate;\n }\n }\n return null; // Invalid date or incomplete date information\n};\n\nexport default withErrorBoundary(\n parseDateWithFormat,\n);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { LOCALE_DATE_FORMATS } from './data/localeDateFormats';\nimport parseDateWithFormat from './parseDateWithFormat';\nimport { Locale } from './types';\n\n/**\n * Attempts to parse a string into a date object based on locale.\n * Uses the localeDateFormats mapping for determining the date format.\n *\n * @param dateString - The date string to parse.\n * @param locale - The locale to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDate = (dateString: string, locale: Locale): Date | null => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const format = LOCALE_DATE_FORMATS[locale];\n if (!format) {\n throw new Error(`No date format found for locale: ${locale}`);\n }\n return parseDateWithFormat(dateString, format);\n};\n\nexport default withErrorBoundary(parseDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport add from './add';\n\n/**\n * Subtracts a specified amount of time from a date.\n *\n * @param date The original date.\n * @param value The amount to subtract.\n * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time subtracted.\n */\nconst subtract = (\n date: Date,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n return add(date, -value, unit); // Reuse the add function with negative value\n};\n\nexport default withErrorBoundary(subtract);\n"],"names":["I18nifyError","Error","constructor","message","super","this","name","timestamp","Date","withErrorBoundary","fn","rest","call","err","console","warn","I18nStateManager","state","locale","direction","country","getInstance","instance","resetInstance","undefined","getState","Object","assign","setState","newState","resetState","getState$1","setState$1","resetState$1","getLocale","navigator","window","Intl","languages","language","getIntlInstanceWithOptions","options","intlOptions","currency","style","NumberFormat","formatNumber$1","amount","Number","formattedAmount","format","CURRENCIES","AED","symbol","ALL","AMD","ARS","AUD","AWG","BBD","BDT","BMD","BND","BOB","BSD","BWP","BZD","CAD","CHF","CNY","COP","CRC","CUP","CZK","DKK","DOP","DZD","EGP","ETB","EUR","FJD","GBP","GHS","GIP","GMD","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","JMD","KES","KGS","KHR","KYD","KZT","LAK","LKR","LRD","LSL","MAD","MDL","MKD","MMK","MNT","MOP","MUR","MVR","MWK","MXN","MYR","NAD","NGN","NIO","NOK","NPR","NZD","PEN","PGK","PHP","PKR","QAR","RUB","SAR","SCR","SEK","SGD","SLL","SOS","SSP","SVC","SZL","THB","TTD","TZS","USD","UYU","UZS","YER","ZAR","KWD","BHD","OMR","getCurrencyList$1","getCurrencySymbol$1","currencyCode","_a","ALLOWED_FORMAT_PARTS_KEYS","formatNumberByParts$1","parts","formatToParts","formattedObj","forEach","p","type","integer","value","findIndex","item","isPrefixSymbol","rawParts","PHONE_REGEX_MAPPER","IN","MY","AE","AL","AM","AR","AU","AW","BB","BD","BM","BN","BO","BS","BW","BZ","CH","CN","CO","OM","CR","CU","CZ","DK","DO","DZ","EG","ET","EU","FJ","GB","GH","GI","GM","GT","GY","HK","HN","HR","HT","HU","ID","IL","JM","KE","KG","KH","KY","KZ","LA","LK","LR","LS","MA","MD","MK","MM","MN","MO","MU","MV","MW","MX","NA","NG","NI","NO","NP","NZ","PE","PG","PH","PK","QA","RU","SA","SC","SE","SG","SL","SO","SS","SV","SZ","TH","TT","TZ","US","CA","UY","UZ","YE","ZA","KW","BH","TL","VC","VE","VN","ZM","ZW","LT","LU","LV","ME","MG","MZ","NL","PA","PL","PR","PS","PT","PY","RO","RS","RW","SI","SK","SM","SN","SR","TG","TJ","TN","TR","TW","UA","UG","DIAL_CODE_MAPPER","detectCountryCodeFromDialCode","phoneNumber","toString","charAt","cleanedPhoneNumberWithoutPlusPrefix","replace","matchingCountries","code","startsWith","push","find","countryCode","regex","test","cleanPhoneNumber","cleanedPhoneNumber","isValidPhoneNumber$1","PHONE_FORMATTER_MAPPER","formatPhoneNumber$1","pattern","charCountInFormatterPattern","i","length","diff","phoneNumberWithoutPrefix","slice","formattedNumber","numberIndex","patternChar","formattedPhoneNumberWithoutPrefix","join","trim","parsePhoneNumber$1","formattedPhoneNumber","formatPhoneNumber","dialCode","formatTemplate","add$1","date","unit","result","setDate","getDate","setMonth","getMonth","setFullYear","getFullYear","formatDateTime$1","dateObj","formatter","DateTimeFormat","formatDate$1","fullOptions","timeStyle","formattedDate","formatDateTime","formatTime$1","dateStyle","formattedTime","getFirstDayOfWeek$1","formatted","weekday","sampleDate","indexOf","toLowerCase","getQuarter$1","Math","ceil","getRelativeTime$1","baseDate","diffInSeconds","getTime","hour","minute","day","week","month","year","relativeTime","abs","RelativeTimeFormat","round","getWeek$1","firstDayOfYear","pastDaysOfYear","getDay","getWeekdays$1","Array","from","_","isAfter$1","date1","date2","isBefore$1","isLeapYear$1","isSameDay$1","isValidDate$1","isNaN","LOCALE_DATE_FORMATS","parseDateWithFormat$1","dateString","separator","includes","formatParts","split","dateParts","map","num","parseInt","yearSet","monthSet","daySet","part","index","parsedDate","parseDate$1","parseDateWithFormat","subtract$1","add"],"mappings":"+OACM,MAAOA,UAAqBC,MAEhC,WAAAC,CAAYC,GACVC,MAAMD,GACNE,KAAKC,KAAO,gBACZD,KAAKE,UAAY,IAAIC,IAEtB,EAYI,MAAMC,EACXC,GAEO,YAA4BC,GACjC,IACE,OAAOD,EAAGE,KAAKP,QAASM,EACzB,CAAC,MAAOE,GAIP,MAHAC,QAAQC,KAAK,iBAAkBF,GAGzB,IAAIb,EAAaa,EACxB,CACH,QC7BWG,EAIX,WAAAd,GACEG,KAAKY,MCLA,CACLC,OAAQ,GACRC,UAAW,GACXC,QAAS,GDGV,CAEM,kBAAOC,GAKZ,OAJKL,EAAiBM,WACpBN,EAAiBM,SAAW,IAAIN,GAG3BA,EAAiBM,QACzB,CAEM,oBAAOC,GACZP,EAAiBM,cAAWE,CAC7B,CAEM,QAAAC,GACL,OAAYC,OAAAC,OAAA,CAAA,EAAAtB,KAAKY,MAClB,CAEM,QAAAW,CAASC,GACdx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,gCACJC,GAAI,+BACJC,GAAI,uDACJC,GAAI,mCACJC,GAAI,6CACJC,GAAI,+BACJC,GAAI,qBACJC,GAAI,+BACJC,GAAI,sBACJC,GAAI,2BACJC,GAAI,wBACJC,GAAI,4DACJC,GAAI,0BACJC,GAAI,mCACJC,GAAI,4BACJC,GAAI,8CACJC,GAAI,6BACJC,GAAI,+CACJC,GAAI,8BACJC,GAAI,8BACJC,GAAI,8BACJC,GAAI,8BACJC,GAAI,yBACJC,GAAI,+DACJC,GAAI,0DACJC,GAAI,6BACJC,GAAI,0CACJC,GAAI,+CACJC,GAAI,8BACJC,GAAI,2BACJC,GAAI,6BACJC,GAAI,kCACJC,GAAI,uBACJC,GAAI,wBACJC,GAAI,sCACJC,GAAI,+BACJC,GAAI,gDACJC,GAAI,gDACJC,GAAI,iDACJC,GAAI,iCACJC,GAAI,2BACJC,GAAI,0BACJC,GAAI,yBACJC,GAAI,0BACJC,GAAI,2CACJC,GAAI,oCACJC,GAAI,0BACJC,GAAI,8BACJC,GAAI,uCACJC,GAAI,iCACJC,GAAI,yBACJC,GAAI,sCACJC,GAAI,yBACJC,GAAI,+BACJC,GAAI,iCACJC,GAAI,2CACJC,GAAI,+EACJC,GAAI,iCACJC,GAAI,qFACJC,GAAI,6BACJC,GAAI,gCACJC,GAAI,6DACJC,GAAI,gCACJC,GAAI,0CACJC,GAAI,kDACJC,GAAI,2BACJC,GAAI,kCACJC,GAAI,kCACJC,GAAI,qCACJC,GAAI,gCACJC,GAAI,uBACJC,GAAI,uBACJC,GAAI,iCACJC,GAAI,iCACJC,GAAI,8BACJC,GAAI,2BACJC,GAAI,0EACJC,GAAI,+BC/HOC,EAAgD,CAC3D,EAAG,CACD,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,MAEF,EAAG,CAAC,KAAM,MACV,GAAI,CAAC,MACL,GAAI,CAAC,MACL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O,ICRjC,IAAA4W,EAAArZ,GARE,CACfsU,EACA9K,EACA+K,IAEO+E,EAAIhF,GAAO9K,EAAO+K"} \ No newline at end of file +{"version":3,"file":"index.min.js","sources":["../../src/common/errorBoundary/index.ts","../../src/modules/.internal/state/index.ts","../../src/modules/.internal/utils/getDefaultState.ts","../../src/modules/core/getState.ts","../../src/modules/core/setState.ts","../../src/modules/core/resetState.ts","../../src/modules/.internal/utils/getLocale.ts","../../src/modules/.internal/utils/getIntlInstanceWithOptions.ts","../../src/modules/currency/formatNumber.ts","../../src/modules/currency/data/currencies.ts","../../src/modules/currency/getCurrencyList.ts","../../src/modules/currency/getCurrencySymbol.ts","../../src/modules/currency/constants.ts","../../src/modules/currency/formatNumberByParts.ts","../../src/modules/phoneNumber/data/phoneRegexMapper.ts","../../src/modules/phoneNumber/data/dialCodeMapper.ts","../../src/modules/phoneNumber/utils.ts","../../src/modules/phoneNumber/isValidPhoneNumber.ts","../../src/modules/phoneNumber/data/phoneFormatterMapper.ts","../../src/modules/phoneNumber/formatPhoneNumber.ts","../../src/modules/phoneNumber/parsePhoneNumber.ts","../../src/modules/dateTime/utils.ts","../../src/modules/dateTime/add.ts","../../src/modules/dateTime/formatDateTime.ts","../../src/modules/dateTime/formatDate.ts","../../src/modules/dateTime/formatTime.ts","../../src/modules/dateTime/getFirstDayOfWeek.ts","../../src/modules/dateTime/getQuarter.ts","../../src/modules/dateTime/getRelativeTime.ts","../../src/modules/dateTime/getWeek.ts","../../src/modules/dateTime/getWeekdays.ts","../../src/modules/dateTime/isAfter.ts","../../src/modules/dateTime/isBefore.ts","../../src/modules/dateTime/isLeapYear.ts","../../src/modules/dateTime/isSameDay.ts","../../src/modules/dateTime/isValidDate.ts","../../src/modules/dateTime/data/localeDateFormats.ts","../../src/modules/dateTime/parseDateWithFormat.ts","../../src/modules/dateTime/parseDate.ts","../../src/modules/dateTime/subtract.ts"],"sourcesContent":["// Custom Error class to extend properties to error object\nexport class I18nifyError extends Error {\n timestamp: Date;\n constructor(message: string | undefined) {\n super(message);\n this.name = 'i18nify Error';\n this.timestamp = new Date();\n // more params like type of error/severity can be added in future for better debugging.\n }\n}\n\n/**\n * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block.\n * It appends additional attributes and serves as a centralized error-handling service.\n * Usage =>\n * const wrappedUtilityFn = withErrorBoundary(utilityFn)\n *\n * @param fn utility that is wrapped in error boundary\n * @returns {Function} returns the function wrapped in try/catch block\n */\nexport const withErrorBoundary = any>(\n fn: T,\n): ((...args: Parameters) => ReturnType) => {\n return function (this: unknown, ...rest: Parameters): ReturnType {\n try {\n return fn.call(this, ...rest) as ReturnType;\n } catch (err) {\n console.warn('[I18N Error]: ', err);\n // Currently, we are throwing the error as it is to consumers.\n // In the future, this can be modified as per our requirement, like an error logging service.\n throw new I18nifyError(err as string | undefined);\n }\n };\n};\n","import { I18nState } from './types';\nimport { getDefaultState } from '../utils/getDefaultState';\n\nexport class I18nStateManager {\n private static instance: I18nStateManager | undefined;\n private state: I18nState;\n\n private constructor() {\n this.state = getDefaultState();\n }\n\n public static getInstance(): I18nStateManager {\n if (!I18nStateManager.instance) {\n I18nStateManager.instance = new I18nStateManager();\n }\n\n return I18nStateManager.instance;\n }\n\n public static resetInstance(): void {\n I18nStateManager.instance = undefined;\n }\n\n public getState(): I18nState {\n return { ...this.state };\n }\n\n public setState(newState: Partial): void {\n this.state = { ...this.state, ...newState };\n }\n\n public resetState(): void {\n this.state = getDefaultState();\n }\n}\n\nexport default I18nStateManager.getInstance();\n","import type { I18nState } from '../state/types';\n\nexport function getDefaultState(): I18nState {\n return {\n locale: '',\n direction: '',\n country: '',\n };\n}\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * function to return active i18n state\n *\n * ===== USAGE =====\n * import { getState } from '@razorpay/i18nify-js';\n *\n * console.log(getState())\n *\n * @returns i18n state\n */\nconst getState = (): I18nState => {\n return state.getState();\n};\n\nexport default withErrorBoundary(getState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * Function to set and override the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { setState } from \"@razorpay/i18nify-js\";\n * setState({locale: 'en-US'})\n *\n * @param newState data to set in i18nState instance\n */\nconst setState = (newState: Partial): void => {\n state.setState(newState);\n};\n\nexport default withErrorBoundary(setState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\n\n/**\n * Function to reset the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { resetState } from \"@razorpay/i18nify-js\";\n * resetState()\n *\n * @param newState data to set in i18nState instance\n */\nconst resetState = (): void => {\n state.resetState();\n};\n\nexport default withErrorBoundary(resetState);\n","export const getLocale = (): string => {\n // Check if running in a non-browser environment (e.g., Node.js or older browsers).\n if (typeof navigator === 'undefined') {\n return 'en-IN';\n }\n\n // Check if the browser supports the Intl object and user language preferences.\n if (\n window.Intl &&\n typeof window.Intl === 'object' &&\n (window.navigator.languages || window.navigator.language)\n ) {\n const userLocales = window.navigator.languages || [\n window.navigator.language,\n ];\n return userLocales[0];\n }\n\n // Fallback to a supported locale or the default locale.\n return 'en-IN';\n};\n","import { CURRENCIES } from '../../currency/data/currencies';\nimport state from '../state';\nimport { getLocale } from './getLocale';\n\nexport const getIntlInstanceWithOptions = (\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n) => {\n /** retrieve locale from below areas in order of preference\n * 1. options.locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n let locale = options?.locale || state.getState().locale;\n\n // If a specific locale is provided, use it; otherwise, use the browser's locale\n if (!locale) {\n locale = getLocale();\n }\n\n const intlOptions = options?.intlOptions ? { ...options.intlOptions } : {};\n\n if (options?.currency || intlOptions.currency) {\n intlOptions.style = 'currency';\n intlOptions.currency = (options.currency || intlOptions.currency) as string;\n }\n\n if (!locale) throw new Error('Pass valid locale !');\n\n return new Intl.NumberFormat(locale || undefined, intlOptions);\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\n\n// this function formats number based on different arguments passed\nconst formatNumber = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): string => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n let formattedAmount = '';\n\n try {\n formattedAmount = getIntlInstanceWithOptions(options).format(\n Number(amount),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedAmount;\n};\n\nexport default withErrorBoundary(formatNumber);\n","export const CURRENCIES: { [key: string]: { symbol: string; name: string } } = {\n AED: { symbol: 'د.إ', name: 'United Arab Emirates Dirham' },\n ALL: { symbol: 'Lek', name: 'Albanian Lek' },\n AMD: { symbol: '֏', name: 'Armenian Dram' },\n ARS: { symbol: 'ARS', name: 'Argentine Peso' },\n AUD: { symbol: 'A$', name: 'Australian Dollar' },\n AWG: { symbol: 'Afl.', name: 'Aruban Florin' },\n BBD: { symbol: '$', name: 'Barbadian Dollar' },\n BDT: { symbol: '৳', name: 'Bangladeshi Taka' },\n BMD: { symbol: '$', name: 'Bermudian Dollar' },\n BND: { symbol: 'BND', name: 'Brunei Dollar' },\n BOB: { symbol: 'Bs', name: 'Bolivian Boliviano' },\n BSD: { symbol: 'B$', name: 'Bahamian Dollar' },\n BWP: { symbol: 'P', name: 'Botswanan Pula' },\n BZD: { symbol: 'BZ$', name: 'Belize Dollar' },\n CAD: { symbol: 'C$', name: 'Canadian Dollar' },\n CHF: { symbol: 'CHf', name: 'Swiss Franc' },\n CNY: { symbol: '¥', name: 'Chinese Yuan' },\n COP: { symbol: 'COL$', name: 'Colombian Peso' },\n CRC: { symbol: '₡', name: 'Costa Rican Colón' },\n CUP: { symbol: '$MN', name: 'Cuban Peso' },\n CZK: { symbol: 'Kč', name: 'Czech Koruna' },\n DKK: { symbol: 'DKK', name: 'Danish Krone' },\n DOP: { symbol: 'RD$', name: 'Dominican Peso' },\n DZD: { symbol: 'د.ج', name: 'Algerian Dinar' },\n EGP: { symbol: 'E£', name: 'Egyptian Pound' },\n ETB: { symbol: 'ብር', name: 'Ethiopian Birr' },\n EUR: { symbol: '€', name: 'Euro' },\n FJD: { symbol: 'FJ$', name: 'Fijian Dollar' },\n GBP: { symbol: '£', name: 'British Pound' },\n GHS: { symbol: 'GH₵', name: 'Ghanaian Cedi' },\n GIP: { symbol: 'GIP', name: 'Gibraltar Pound' },\n GMD: { symbol: 'D', name: 'Gambian Dalasi' },\n GTQ: { symbol: 'Q', name: 'Guatemalan Quetzal' },\n GYD: { symbol: 'G$', name: 'Guyanese Dollar' },\n HKD: { symbol: 'HK$', name: 'Hong Kong Dollar' },\n HNL: { symbol: 'HNL', name: 'Honduran Lempira' },\n HRK: { symbol: 'kn', name: 'Croatian Kuna' },\n HTG: { symbol: 'G', name: 'Haitian Gourde' },\n HUF: { symbol: 'Ft', name: 'Hungarian Forint' },\n IDR: { symbol: 'Rp', name: 'Indonesian Rupiah' },\n ILS: { symbol: '₪', name: 'Israeli New Shekel' },\n INR: { symbol: '₹', name: 'Indian Rupee' },\n JMD: { symbol: 'J$', name: 'Jamaican Dollar' },\n KES: { symbol: 'Ksh', name: 'Kenyan Shilling' },\n KGS: { symbol: 'Лв', name: 'Kyrgystani Som' },\n KHR: { symbol: '៛', name: 'Cambodian Riel' },\n KYD: { symbol: 'CI$', name: 'Cayman Islands Dollar' },\n KZT: { symbol: '₸', name: 'Kazakhstani Tenge' },\n LAK: { symbol: '₭', name: 'Laotian Kip' },\n LKR: { symbol: 'රු', name: 'Sri Lankan Rupee' },\n LRD: { symbol: 'L$', name: 'Liberian Dollar' },\n LSL: { symbol: 'LSL', name: 'Lesotho Loti' },\n MAD: { symbol: 'د.م.', name: 'Moroccan Dirham' },\n MDL: { symbol: 'MDL', name: 'Moldovan Leu' },\n MKD: { symbol: 'ден', name: 'Macedonian Denar' },\n MMK: { symbol: 'MMK', name: 'Myanmar Kyat' },\n MNT: { symbol: '₮', name: 'Mongolian Tugrik' },\n MOP: { symbol: 'MOP$', name: 'Macanese Pataca' },\n MUR: { symbol: '₨', name: 'Mauritian Rupee' },\n MVR: { symbol: 'Rf', name: 'Maldivian Rufiyaa' },\n MWK: { symbol: 'MK', name: 'Malawian Kwacha' },\n MXN: { symbol: 'Mex$', name: 'Mexican Peso' },\n MYR: { symbol: 'RM', name: 'Malaysian Ringgit' },\n NAD: { symbol: 'N$', name: 'Namibian Dollar' },\n NGN: { symbol: '₦', name: 'Nigerian Naira' },\n NIO: { symbol: 'NIO', name: 'Nicaraguan Córdoba' },\n NOK: { symbol: 'NOK', name: 'Norwegian Krone' },\n NPR: { symbol: 'रू', name: 'Nepalese Rupee' },\n NZD: { symbol: 'NZ$', name: 'New Zealand Dollar' },\n PEN: { symbol: 'S/', name: 'Peruvian Nuevo Sol' },\n PGK: { symbol: 'PGK', name: 'Papua New Guinean Kina' },\n PHP: { symbol: '₱', name: 'Philippine Peso' },\n PKR: { symbol: '₨', name: 'Pakistani Rupee' },\n QAR: { symbol: 'QR', name: 'Qatari Riyal' },\n RUB: { symbol: '₽', name: 'Russian Ruble' },\n SAR: { symbol: 'SR', name: 'Saudi Riyal' },\n SCR: { symbol: 'SRe', name: 'Seychellois Rupee' },\n SEK: { symbol: 'SEK', name: 'Swedish Krona' },\n SGD: { symbol: 'S$', name: 'Singapore Dollar' },\n SLL: { symbol: 'Le', name: 'Sierra Leonean Leone' },\n SOS: { symbol: 'Sh.so.', name: 'Somali Shilling' },\n SSP: { symbol: 'SS£', name: 'South Sudanese Pound' },\n SVC: { symbol: '₡', name: 'Salvadoran Colón' },\n SZL: { symbol: 'E', name: 'Swazi Lilangeni' },\n THB: { symbol: '฿', name: 'Thai Baht' },\n TTD: { symbol: 'TT$', name: 'Trinidad and Tobago Dollar' },\n TZS: { symbol: 'Sh', name: 'Tanzanian Shilling' },\n USD: { symbol: '$', name: 'United States Dollar' },\n UYU: { symbol: '$U', name: 'Uruguayan Peso' },\n UZS: { symbol: \"so'm\", name: 'Uzbekistani Som' },\n YER: { symbol: '﷼', name: 'Yemeni Rial' },\n ZAR: { symbol: 'R', name: 'South African Rand' },\n KWD: { symbol: 'د.ك', name: 'Kuwaiti Dinar' },\n BHD: { symbol: 'د.ب.', name: 'Bahraini Dinar' },\n OMR: { symbol: 'ر.ع.', name: 'Omani Rial' },\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencyList = () => {\n return CURRENCIES;\n};\n\nexport default withErrorBoundary(getCurrencyList);\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencySymbol = (currencyCode: keyof typeof CURRENCIES): string => {\n if (currencyCode in CURRENCIES) return CURRENCIES[currencyCode]?.symbol;\n else throw new Error('Invalid currencyCode!');\n};\n\nexport default withErrorBoundary(getCurrencySymbol);\n","export const ALLOWED_FORMAT_PARTS_KEYS = [\n 'nan',\n 'infinity',\n 'percent',\n 'integer',\n 'group',\n 'decimal',\n 'fraction',\n 'plusSign',\n 'minusSign',\n 'percentSign',\n 'currency',\n 'code',\n 'symbol',\n 'name',\n 'compact',\n 'exponentInteger',\n 'exponentMinusSign',\n 'exponentSeparator',\n 'unit',\n] as const;\n","import { CURRENCIES } from './data/currencies';\nimport { ByParts, FormattedPartsObject } from './types';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\nimport { ALLOWED_FORMAT_PARTS_KEYS } from './constants';\n\nconst formatNumberByParts = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): ByParts => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n try {\n const formattedAmount = getIntlInstanceWithOptions(options).formatToParts(\n Number(amount),\n );\n\n const parts = formattedAmount;\n\n const formattedObj: FormattedPartsObject = {};\n\n parts.forEach((p) => {\n if (p.type === 'group') {\n formattedObj.integer = (formattedObj.integer || '') + p.value;\n } else if (\n ALLOWED_FORMAT_PARTS_KEYS.findIndex((item) => item === p.type) != -1\n ) {\n // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal' is skipped\n formattedObj[p.type] = (formattedObj[p.type] || '') + p.value;\n }\n });\n\n return {\n ...formattedObj,\n isPrefixSymbol: parts[0].type === 'currency',\n rawParts: parts,\n };\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(\n formatNumberByParts,\n);\n","export const PHONE_REGEX_MAPPER: { [key: string]: RegExp } = {\n IN: /^(?:(?:\\+|0{0,2})91\\s*[-]?\\s*|[0]?)?[6789]\\d{9}$/,\n MY: /^(\\+?6?0)?(\\d{1,3})[-. ]?(\\d{7,8})$/,\n AE: /^(?:\\+?971|0)?(?:2|3|4|6|7|9)\\d{8}$/,\n AL: /^(?:\\+?355)?(?:[4-9]\\d{7}|6\\d{8})$/,\n AM: /^(?:\\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/,\n AR: /^(?:(?:\\+|0{0,2})54)?(?:11|[2368]\\d)(?:(?=\\d{0,2}15)\\d{2})??\\d{8}$/,\n AU: /^(?:\\+?61|0)4\\d{8}$/,\n AW: /^(?:(?:\\+297)?(?!0)\\d{7})$/,\n BB: /^(?:(?:\\+1)?246)?(?:\\d{3})?\\d{7}$/,\n BD: /^(?:\\+?880|0)1[13456789]\\d{8}$/,\n BM: /^(?:(?:\\+1)?441)?(?:\\d{2})?\\d{7}$/,\n BN: /^(?:\\+?673)?(?:\\d{3})?\\d{4}$/,\n BO: /^(?:(?:\\+|0{0,2})591)?(?:(?:2|3|7|6)\\d{7})$/,\n BS: /^(?:(?:\\+1)?242)?(?:\\d{3})?\\d{7}$/,\n BW: /^(?:(?:\\+267)?\\s?)?[74]\\d{7}$/,\n BZ: /^(?:(?:\\+501)?\\s?)?[622]\\d{4}$/,\n CH: /^(?:(?:\\+41|0)(?:\\s*\\(?0\\)?\\s*))?(?:\\d{2}\\s*)?\\d{3}\\s*\\d{2}\\s*\\d{2}$/,\n CN: /^(?:(?:\\+|00)86)?1\\d{10}$/,\n CO: /^(?:(?:\\+57|0057)?)?[1-8]{1}\\d{6,7}$/,\n OM: /^(?:\\+?968)?(?:95|96|97|98)\\d{6}$/,\n CR: /^(?:(?:\\+506)?\\s*|0)?[1-9]\\d{7}$/,\n CU: /^(?:\\+?53)?(?:[5-8]\\d{7})$/,\n CZ: /^(?:\\+?420)?(?:\\d{9})$/,\n DK: /^(?:\\+?45)?(?:\\d{8})$/,\n DO: /^(?:(?:\\+1)?809|1-8(?:00|88|89))(?:\\d{7})$/,\n DZ: /^(?:\\+?213|0)([567]\\d{8})$/,\n EG: /^(?:(?:\\+20|20)?(\\d{10}))$/,\n ET: /^(?:\\+?251)?[1-59]\\d{8}$/,\n EU: /^(?:(?:\\+?3)?8)?\\s*(?:\\d{3}\\s*){3}\\d{2}$/,\n FJ: /^(?:(?:\\+?679)?\\s?\\d{3}\\s?\\d{4})?$/,\n GB: /^(?:(?:\\+44\\s?|0)7\\d{3}(\\s?\\d{4,})?)$/,\n GH: /^(?:(?:\\+233)|0)?(?:\\d{9})$/,\n GI: /^(?:\\+350)?\\d{5}$/,\n GM: /^(?:\\+220)?\\d{5,7}$/,\n GT: /^(?:\\+502)?[2468]\\d{7,8}$/,\n GY: /^(?:(?:\\+592)?(?:(?:\\s)?[2-9])(?:(?:\\s)?\\d))?(?:(?:\\s)?\\d{4})$/,\n HK: /^(?:\\+852\\s?)?[456789]\\d{3}\\s?\\d{4}$/,\n HN: /^(?:\\+504)?[89]\\d{7}$/,\n HR: /^(?:\\+?385)?\\d{8,9}$/,\n HT: /^(?:\\+?509)?\\d{8}$/,\n HU: /^(?:(?:\\+36))(\\s?\\d{2}\\s?\\d{3}\\s?\\d{4})$/,\n ID: /^(?:\\+?62|0[1-9])[\\s-]?\\d{2,4}[\\s-]?\\d{3,4}[\\s-]?\\d{3,4}$/,\n IL: /^(?:(?:\\+972|0)(?:-)?)[23489]\\d{7}$/,\n JM: /^(?:(?:\\+1876))\\d{7,10}$/,\n KE: /^(?:(?:\\+254)|(?:0))(?:\\d{6,7})$/,\n KG: /^(?:\\+996)?\\s?\\d{9}$/,\n KH: /^(?:(?:\\+855)|(?:0))(?:\\s?[1-9]\\d{7,8})$/,\n KY: /^(?:\\+?1\\s?(345))\\d{6}$/,\n KZ: /^(?:\\+?7|8)?7\\d{9}$/,\n LA: /^(?:(?:\\+?856)|0)(20\\d{7,9})$/,\n LK: /^(?:(?:\\+94)|0)(?:\\d{9})$/,\n LR: /^(?:\\+231)[ -\\d]{4}[ -\\d]{4}$/,\n LS: /^(?:(?:\\+?266)|0)?[56]\\d{7}$/,\n MA: /^(?:(?:\\+?212(\\s*[-|\\s*]?\\d{1,9})?)|(?:0))(?:\\d{9})$/,\n MD: /^(?:(?:\\+373)|(?:0))(?:\\d{7,8})$/,\n MK: /^(?:\\+389|0)(?:(?:2[0-4]|[3-9])\\s?)?\\d{6}$/,\n MM: /^(?:(?:\\+?95)|0)?[1-9]\\d{9}$/,\n MN: /^(?:\\+976|0)\\d{8}$/,\n MO: /^(?:(?:\\+?853)|[0-9])?\\d{8}$/,\n MU: /^(?:\\+230|0)?\\d{8}$/,\n MV: /^(?:(?:\\+?960)|0)?\\d{7}$/,\n MW: /^(?:\\+265)[1-9]\\d{6}$/,\n MX: /^(?:(?:\\+?52)?\\s?(?:1|01)?\\s?)?(?:\\d{3}\\s?\\d{3}\\s?\\d{4})$/,\n NA: /^(?:(?:\\+264)|0)?\\d{8}$/,\n NG: /^(?:(?:\\+234)|(?:0))(?:\\d{7,8})$/,\n NI: /^(?:(?:\\+505))?(?:\\d{8})$/,\n NO: /^(?:(?:\\+?47)|\\d{2}|\\d{3})\\s?\\d{2}\\s?\\d{3}$/,\n NP: /^(?:(?:\\+977))?(\\d{9,10})$/,\n NZ: /^(?:\\+?64|0)(\\d{2,5} \\d{4,8}|\\d{3,4} \\d{4})$/,\n PE: /^(?:(?:\\+51)|0)?(?:9\\d{8})$/,\n PG: /^(?:\\+?675)?(?:[7-9]\\d{7})$/,\n PH: /^(?:(?:\\+?63)|0)(?:\\d{10})$/,\n PK: /^(?:(?:\\+92)|0)?[345]\\d{9}$/,\n QA: /^(?:\\+?974)?-?33\\d{5}$/,\n RU: /^(?:\\+?7|8)?[ -]?\\(?9\\d{2}\\)?[ -]?\\d{3}[ -]?\\d{2}[ -]?\\d{2}$/,\n SA: /^(?:\\+?966)?\\s?1?[\\s-]?(?:[45]\\d{2}|5\\d{3})[\\s-]?\\d{4}$/,\n SC: /^(?:(?:\\+248)|\\d{4})\\d{5}$/,\n SE: /^(?:\\+?46|0)\\s?[1-57-9](?:[0-9]\\s?){8}$/,\n SG: /^(?:(?:\\+65)|(?:\\(\\+65\\))|(?:65))\\d{4}\\d{4}$/,\n SL: /^(?:(?:\\+232)|(?:0))?\\d{9}$/,\n SO: /^(?:\\+252|0)?[567]\\d{7}$/,\n SS: /^(?:\\+211|0)?[1-9]\\d{7,9}$/,\n SV: /^(?:(?:\\+?503)|(?:0))(?:\\d{8})$/,\n SZ: /^(?:\\+?268)?\\d{7,8}$/,\n TH: /^(?:(?:\\+66)|0)\\d{9}$/,\n TT: /^(?:(?:\\+?1-868)|\\(?868\\)?)(\\d{7})$/,\n TZ: /^(?:(?:\\+?255)|0)?[67]\\d{8}$/,\n US: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n CA: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n UY: /^(?:(?:\\+598|0)\\s?(9\\d{3}|2\\d{2}|[4-9]\\d{6}))$/,\n UZ: /^(?:\\+?998)?\\s?[3456789]\\d{8}$/,\n YE: /^(?:\\+?967)?(?:\\d{7,8})$/,\n ZA: /^(?:(?:\\+27)|0)(\\d{9})$/,\n KW: /^(?:\\+?965)[569]\\d{7}$/,\n BH: /^(?:\\+?973)?[356]\\d{7}$/,\n TL: /^(?:(?:\\+670)\\s?)?[0-9]{3}\\s?[0-9]{3,4}$/,\n VC: /^(?:(?:\\+1)?784)?(?:\\d{3})?\\d{7}$/,\n VE: /^(?:(?:\\+58)|0)?4\\d{9}$/,\n VN: /^(?:(?:\\+84)|0)?[1-9]\\d{8}$/,\n ZM: /^(?:(?:\\+260)|0)?[123456789]\\d{8,9}$/,\n ZW: /^(?:(?:\\+263)|0)?(?:\\d{9,10})$/,\n LT: /^(?:(?:\\+370)|8)\\d{8}$/,\n LU: /^(?:(?:\\+352)?(6|2(6|7|8|9))\\d{6})$/,\n LV: /^(?:(?:\\+371)?2\\d{7})$/,\n ME: /^(?:(?:\\+382)?[67]\\d{7,20})$/,\n MG: /^(?:(?:\\+261)?3[234568]\\d{7})$/,\n MZ: /^(?:(?:\\+258)|(?:258))?8[234567]\\d{7,8}$/,\n NL: /^(?:(?:\\+31)|0(6(?:\\d{8})|[1-9](?:(?:\\d{8})|(?:\\s\\d{3}\\s\\d{4}))|(?:\\d{8})))$/,\n PA: /^(?:(?:\\+507)\\s?)?[46]\\d{6,7}$/,\n PL: /^(?:(?:\\+48)?(?:\\s?\\d{3}\\s?\\d{3}\\s?\\d{3}|(?:\\d{2}\\s?){4}\\d{2}|\\d{3}-\\d{3}-\\d{3}))$/,\n PR: /^(?:(?:\\+1)?787|939)\\d{7}$/,\n PS: /^(?:(?:\\+970))(5[2349])\\d{7}$/,\n PT: /^(?:(?:\\+351)?9(1\\d|2[1-9]|6[12345789]|7[12345789])\\d{7})$/,\n PY: /^(?:(?:\\+595|0)9[9876]\\d{7})$/,\n RO: /^(?:(?:\\+40|0))(?:7[2-8]\\d{7}|21\\d{8})$/,\n RS: /^(?:(?:\\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/,\n RW: /^(?:(?:\\+250)|(0))\\d{9}$/,\n SI: /^(?:(?:\\+386)|0)?[1-59]\\d{7,8}$/,\n SK: /^(?:(?:\\+421))?(0|9[0-8])\\d{8}$/,\n SM: /^(?:(?:\\+378)|(0549|6\\d{4}))\\d{5}$/,\n SN: /^(?:(?:\\+221)|0)?[3679]\\d{7}$/,\n SR: /^(?:(?:\\+597))\\d{7}$/,\n TG: /^(?:(?:\\+228))\\d{8}$/,\n TJ: /^(?:(?:\\+992))(37|55|77)\\d{7}$/,\n TN: /^(?:(?:\\+216)|22|9[1-9])\\d{7}$/,\n TR: /^(?:(?:\\+90)|(0))\\s?5\\d{9}$/,\n TW: /^(?:(?:\\+886)|0)?9\\d{8}$/,\n UA: /^(?:(?:\\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\\d{7}$/,\n UG: /^(?:(?:\\+256)|0)?[39]\\d{8}$/,\n};\n","/* Source: Google LibPhoneNumber Metadata: https://github.com/google/libphonenumber/blob/master/javascript/i18n/phonenumbers/metadata.js */\n\nexport const DIAL_CODE_MAPPER: { [key: number]: string[] } = {\n 1: [\n 'US',\n 'AG',\n 'AI',\n 'AS',\n 'BB',\n 'BM',\n 'BS',\n 'CA',\n 'DM',\n 'DO',\n 'GD',\n 'GU',\n 'JM',\n 'KN',\n 'KY',\n 'LC',\n 'MP',\n 'MS',\n 'PR',\n 'SX',\n 'TC',\n 'TT',\n 'VC',\n 'VG',\n 'VI',\n ],\n 7: ['RU', 'KZ'],\n 20: ['EG'],\n 27: ['ZA'],\n 30: ['GR'],\n 31: ['NL'],\n 32: ['BE'],\n 33: ['FR'],\n 34: ['ES'],\n 36: ['HU'],\n 39: ['IT', 'VA'],\n 40: ['RO'],\n 41: ['CH'],\n 43: ['AT'],\n 44: ['GB', 'GG', 'IM', 'JE'],\n 45: ['DK'],\n 46: ['SE'],\n 47: ['NO', 'SJ'],\n 48: ['PL'],\n 49: ['DE'],\n 51: ['PE'],\n 52: ['MX'],\n 53: ['CU'],\n 54: ['AR'],\n 55: ['BR'],\n 56: ['CL'],\n 57: ['CO'],\n 58: ['VE'],\n 60: ['MY'],\n 61: ['AU', 'CC', 'CX'],\n 62: ['ID'],\n 63: ['PH'],\n 64: ['NZ'],\n 65: ['SG'],\n 66: ['TH'],\n 81: ['JP'],\n 82: ['KR'],\n 84: ['VN'],\n 86: ['CN'],\n 90: ['TR'],\n 91: ['IN'],\n 92: ['PK'],\n 93: ['AF'],\n 94: ['LK'],\n 95: ['MM'],\n 98: ['IR'],\n 211: ['SS'],\n 212: ['MA', 'EH'],\n 213: ['DZ'],\n 216: ['TN'],\n 218: ['LY'],\n 220: ['GM'],\n 221: ['SN'],\n 222: ['MR'],\n 223: ['ML'],\n 224: ['GN'],\n 225: ['CI'],\n 226: ['BF'],\n 227: ['NE'],\n 228: ['TG'],\n 229: ['BJ'],\n 230: ['MU'],\n 231: ['LR'],\n 232: ['SL'],\n 233: ['GH'],\n 234: ['NG'],\n 235: ['TD'],\n 236: ['CF'],\n 237: ['CM'],\n 238: ['CV'],\n 239: ['ST'],\n 240: ['GQ'],\n 241: ['GA'],\n 242: ['CG'],\n 243: ['CD'],\n 244: ['AO'],\n 245: ['GW'],\n 246: ['IO'],\n 247: ['AC'],\n 248: ['SC'],\n 249: ['SD'],\n 250: ['RW'],\n 251: ['ET'],\n 252: ['SO'],\n 253: ['DJ'],\n 254: ['KE'],\n 255: ['TZ'],\n 256: ['UG'],\n 257: ['BI'],\n 258: ['MZ'],\n 260: ['ZM'],\n 261: ['MG'],\n 262: ['RE', 'YT'],\n 263: ['ZW'],\n 264: ['NA'],\n 265: ['MW'],\n 266: ['LS'],\n 267: ['BW'],\n 268: ['SZ'],\n 269: ['KM'],\n 290: ['SH', 'TA'],\n 291: ['ER'],\n 297: ['AW'],\n 298: ['FO'],\n 299: ['GL'],\n 350: ['GI'],\n 351: ['PT'],\n 352: ['LU'],\n 353: ['IE'],\n 354: ['IS'],\n 355: ['AL'],\n 356: ['MT'],\n 357: ['CY'],\n 358: ['FI', 'AX'],\n 359: ['BG'],\n 370: ['LT'],\n 371: ['LV'],\n 372: ['EE'],\n 373: ['MD'],\n 374: ['AM'],\n 375: ['BY'],\n 376: ['AD'],\n 377: ['MC'],\n 378: ['SM'],\n 380: ['UA'],\n 381: ['RS'],\n 382: ['ME'],\n 383: ['XK'],\n 385: ['HR'],\n 386: ['SI'],\n 387: ['BA'],\n 389: ['MK'],\n 420: ['CZ'],\n 421: ['SK'],\n 423: ['LI'],\n 500: ['FK'],\n 501: ['BZ'],\n 502: ['GT'],\n 503: ['SV'],\n 504: ['HN'],\n 505: ['NI'],\n 506: ['CR'],\n 507: ['PA'],\n 508: ['PM'],\n 509: ['HT'],\n 590: ['GP', 'BL', 'MF'],\n 591: ['BO'],\n 592: ['GY'],\n 593: ['EC'],\n 594: ['GF'],\n 595: ['PY'],\n 596: ['MQ'],\n 597: ['SR'],\n 598: ['UY'],\n 599: ['CW', 'BQ'],\n 670: ['TL'],\n 672: ['NF'],\n 673: ['BN'],\n 674: ['NR'],\n 675: ['PG'],\n 676: ['TO'],\n 677: ['SB'],\n 678: ['VU'],\n 679: ['FJ'],\n 680: ['PW'],\n 681: ['WF'],\n 682: ['CK'],\n 683: ['NU'],\n 685: ['WS'],\n 686: ['KI'],\n 687: ['NC'],\n 688: ['TV'],\n 689: ['PF'],\n 690: ['TK'],\n 691: ['FM'],\n 692: ['MH'],\n 800: ['001'],\n 808: ['001'],\n 850: ['KP'],\n 852: ['HK'],\n 853: ['MO'],\n 855: ['KH'],\n 856: ['LA'],\n 870: ['001'],\n 878: ['001'],\n 880: ['BD'],\n 881: ['001'],\n 882: ['001'],\n 883: ['001'],\n 886: ['TW'],\n 888: ['001'],\n 960: ['MV'],\n 961: ['LB'],\n 962: ['JO'],\n 963: ['SY'],\n 964: ['IQ'],\n 965: ['KW'],\n 966: ['SA'],\n 967: ['YE'],\n 968: ['OM'],\n 970: ['PS'],\n 971: ['AE'],\n 972: ['IL'],\n 973: ['BH'],\n 974: ['QA'],\n 975: ['BT'],\n 976: ['MN'],\n 977: ['NP'],\n 979: ['001'],\n 992: ['TJ'],\n 993: ['TM'],\n 994: ['AZ'],\n 995: ['GE'],\n 996: ['KG'],\n 998: ['UZ'],\n};\n","import { DIAL_CODE_MAPPER } from './data/dialCodeMapper';\nimport { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\n\n/**\n * Determines the country code based on the provided phone number.\n * This function employs a multi-step approach to identify the country code:\n * - If the phone number starts with '+', it extracts the numeric characters\n * and matches the leading digits with known dial codes mapped to countries.\n * - For matched dial codes, it further filters based on country-specific regex patterns\n * to validate the phone number format for those countries.\n * - If the phone number doesn't start with '+', it directly matches the number\n * against regular expressions associated with various countries to identify the code.\n *\n * @param phoneNumber The input phone number (string or number).\n * @returns The detected country code or an empty string if not found.\n */\nexport const detectCountryCodeFromDialCode = (\n phoneNumber: string | number,\n): string => {\n // If the phone number starts with '+', extract numeric characters\n if (phoneNumber.toString().charAt(0) === '+') {\n const cleanedPhoneNumberWithoutPlusPrefix = phoneNumber\n .toString()\n .replace(/\\D/g, '');\n\n const matchingCountries: string[] = [];\n\n // Iterate through dial codes and check for matches with cleaned phone number\n for (const code in DIAL_CODE_MAPPER) {\n if (cleanedPhoneNumberWithoutPlusPrefix.startsWith(code)) {\n matchingCountries.push(...DIAL_CODE_MAPPER[code]);\n }\n }\n\n // Filter matching countries based on phone number validation regex\n const matchedCountryCode = matchingCountries.find((countryCode: string) => {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex && regex.test(phoneNumber.toString())) return countryCode;\n return undefined;\n });\n\n // Return the first matched country code, if any\n return matchedCountryCode || '';\n } else {\n // If phone number doesn't start with '+', directly match against country regexes\n for (const countryCode in PHONE_REGEX_MAPPER) {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex.test(phoneNumber.toString())) {\n return countryCode;\n }\n }\n }\n\n // Return empty string if no country code is detected\n return '';\n};\n\nexport const cleanPhoneNumber = (phoneNumber: string) => {\n // Regular expression to match all characters except numbers and + sign at the start\n const regex = /[^0-9+]|(?!A)\\+/g;\n // Replace matched characters with an empty string\n const cleanedPhoneNumber = phoneNumber.replace(regex, '');\n return phoneNumber[0] === '+' ? `+${cleanedPhoneNumber}` : cleanedPhoneNumber;\n};\n","import { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Validates whether a given phone number is valid based on the provided country code or auto-detects the country code and checks if the number matches the defined regex pattern for that country.\nconst isValidPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_REGEX_MAPPER,\n): boolean => {\n // Clean the provided phoneNumber by removing non-numeric characters\n const cleanedPhoneNumber = cleanPhoneNumber(phoneNumber.toString());\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_REGEX_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(cleanedPhoneNumber);\n\n // Return false if phoneNumber is empty\n if (!phoneNumber) return false;\n\n // Check if the countryCode exists in the PHONE_REGEX_MAPPER\n if (countryCode in PHONE_REGEX_MAPPER) {\n // Fetch the regex pattern for the countryCode\n const regex = PHONE_REGEX_MAPPER[countryCode];\n // Test if the cleanedPhoneNumber matches the regex pattern\n return regex.test(cleanedPhoneNumber as string);\n }\n\n // Return false if the countryCode is not supported\n return false;\n};\n\nexport default withErrorBoundary(isValidPhoneNumber);\n","export const PHONE_FORMATTER_MAPPER: { [key: string]: string } = {\n IN: 'xxxx xxxxxx',\n MY: 'xx xxxxx xx',\n AE: 'xx xxx xxxx',\n AL: 'xxx xx xxxx',\n AM: 'xx xx xx xx',\n AR: 'xxxx-xxxx',\n AU: 'xxx xxx xxx',\n AW: 'xxx-xxxx',\n BB: 'xxx-xxxx',\n BD: 'xxxx-xxxxxx',\n BM: 'xxx-xxxx',\n BN: 'xxxx-xxxx',\n BO: 'xxxx-xxxx',\n BS: 'xxx-xxxx',\n BW: 'xx xxxx xxxx',\n BZ: 'xxx-xxxx',\n CA: 'xxx-xxx-xxxx',\n CH: 'xxx xxx xxx',\n CN: 'xxxx-xxxxxxx',\n CO: 'xxxx-xxxxxxx',\n CR: 'xxxx-xxxx',\n CU: 'xxxx-xxxx',\n CZ: 'xxx xxx xxx',\n DK: 'xx xx xx xx',\n DO: 'xxx-xxxxxxx',\n DZ: 'xxxx-xxxx-xxx',\n EG: 'xx xxx xxxx',\n ET: 'xx xxx xxxx',\n EU: 'xxx xx xx xx',\n FJ: 'xxxx xxxx',\n GB: 'xxxx xxx xxx',\n GH: 'xxx xxx xxxx',\n GI: 'xxxx xxxx',\n GM: 'xxxx-xxxx',\n GT: 'xxxx-xxxx',\n GY: 'xxx-xxxx',\n HK: 'xxxx xxxx',\n HN: 'xxxx-xxxx',\n HR: 'xxx xxx xxxx',\n HT: 'xxx-xxxx',\n HU: 'xxx xxx xxxx',\n ID: 'xxxx-xxxx-xxxx',\n IL: 'xxxx-xxx-xxx',\n JM: 'xxx-xxxx',\n KE: 'xxx xxxxxx',\n KG: 'xxx-xx-xx-xx',\n KH: 'xxx-xxx-xxx',\n KY: 'xxx-xxxx',\n KZ: 'xxx-xxx-xx-xx',\n LA: 'xxx xx xxxx',\n LK: 'xx xxx xxxx',\n LR: 'xxx-xxx-xxxx',\n LS: 'xxx xx xxxx',\n LT: 'xxx xxxxx',\n LU: 'xxx xx xxx',\n LV: 'xxxx xxxx',\n MA: 'xxxx-xxxxxx',\n MD: 'xx xxxxxx',\n ME: 'xx xxxxxx',\n MG: 'xx xx xx xx xx',\n MK: 'xx xx xx xx',\n MM: 'xx xxxxxx',\n MN: 'xxx-xx-xxxx',\n MO: 'xxxx xxxx',\n MU: 'xx xxxx xxxx',\n MV: 'xxxxxx',\n MW: 'xx xxxx xxxx',\n MX: 'xxx-xxx-xxxx',\n MZ: 'xx xxxxxxx',\n NA: 'xx xxxx xxxx',\n NG: 'xxx xxx xxxx',\n NI: 'xxxx-xxxx',\n NL: 'xxx-xxxxxxx',\n NO: 'xxxx xxxx',\n NP: 'xxxx-xxxxxxx',\n NZ: 'xxx-xxxxxxx',\n OM: 'xxxx-xxxx',\n PA: 'xxx-xxxx',\n PE: 'xxx-xxx-xxx',\n PG: 'xxx-xxxxxx',\n PH: 'xxx-xxxx',\n PK: 'xxx-xxxxxxx',\n PL: 'xxx xxx xxx',\n PR: 'xxx-xxx-xxxx',\n PS: 'xxxx-xxxxxxx',\n PT: 'xxx xxx xxx',\n PY: 'xxx-xxxxxx',\n QA: 'xxxx xxxx',\n RO: 'xxx xxx xxxx',\n RS: 'xxx xxxxx',\n RU: 'xxx xxx-xx-xx',\n RW: 'xxx xxxxxx',\n SA: 'xxx-xxxxxxx',\n SC: 'xx xxxxx',\n SE: 'xxx-xxx xx xx',\n SG: 'xxxx xxxx',\n SI: 'xx xxxxxx',\n SK: 'xxx xxx xxx',\n SL: 'xxx-xxxxxx',\n SM: 'xxxxx xxxxx',\n SN: 'xx xxx xx xx',\n SO: 'xxx xxxxxxx',\n SR: 'xxx-xxxx',\n SS: 'xxx xxxx xxx',\n SV: 'xxxx-xxxx',\n SZ: 'xxx xx xxxx',\n TG: 'xx xx xx xx',\n TH: 'xxx-xxxxxxx',\n TJ: 'xxx xx xx xx',\n TL: 'xxx-xxxxxxx',\n TN: 'xx xxxxxx',\n TR: 'xxx xxx xx xx',\n TT: 'xxx-xxxx',\n TW: 'xxxx-xxxxxx',\n TZ: 'xxx xxx xxxx',\n UA: 'xx xxx xx xx',\n UG: 'xxx xxxxxxx',\n US: 'xxx-xxx-xxxx',\n UY: 'xxx-xxxxx',\n UZ: 'xxx-xxx-xx-xx',\n VC: 'xxx-xxxx',\n VE: 'xxxx-xxx-xxxx',\n VN: 'xxxx-xxxxxxx',\n YE: 'xxxx-xxxx',\n ZA: 'xxx-xxx-xxxx',\n ZM: 'xxx-xxxxxxx',\n ZW: 'xx xxx xxxx',\n KW: 'xxx xx xxxx',\n BH: 'xxxx xxxx',\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Formats a provided phone number according to the predefined format for a specific country code, or auto-detects the country code and formats the number accordingly.\nconst formatPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_FORMATTER_MAPPER,\n): string => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Convert phoneNumber to string and clean it by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_FORMATTER_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Fetch the pattern for the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern) return phoneNumber;\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n // Extract the phoneNumber without the prefix\n const phoneNumberWithoutPrefix = phoneNumber.slice(diff);\n const formattedNumber: string[] = [];\n let numberIndex = 0;\n\n // Loop through the pattern to format the phoneNumber\n for (let i = 0; i < pattern.length; i++) {\n const patternChar = pattern[i];\n if (patternChar === 'x') {\n // Insert phoneNumber digits at 'x' positions\n if (numberIndex < phoneNumberWithoutPrefix.length) {\n formattedNumber.push(phoneNumberWithoutPrefix[numberIndex]);\n numberIndex++;\n }\n } else {\n // Insert non-digit characters from the pattern\n formattedNumber.push(patternChar);\n }\n }\n\n // Join the formattedNumber array to create the formattedPhoneNumber without prefix\n const formattedPhoneNumberWithoutPrefix = formattedNumber.join('');\n // Combine the prefix and formattedPhoneNumberWithoutPrefix\n const formattedPhoneNumberWithPrefix =\n phoneNumber.slice(0, diff) + ' ' + formattedPhoneNumberWithoutPrefix;\n\n // Return the formattedPhoneNumber with prefix after trimming whitespace\n return formattedPhoneNumberWithPrefix.trim();\n};\n\nexport default withErrorBoundary(formatPhoneNumber);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport formatPhoneNumber from './formatPhoneNumber';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\ninterface PhoneInfo {\n countryCode: string;\n dialCode: string;\n formattedPhoneNumber: string;\n formatTemplate: string;\n}\n\n// Parses a given phone number, identifies its country code (if not provided), and returns an object with details including the country code, formatted phone number, dial code, and format template.\nconst parsePhoneNumber = (phoneNumber: string, country?: string): PhoneInfo => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Clean the phoneNumber by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n const countryCode =\n country && country in PHONE_FORMATTER_MAPPER\n ? country\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Format the phone number using the detected/validated country code\n const formattedPhoneNumber = formatPhoneNumber(phoneNumber, countryCode);\n\n // Fetch the pattern associated with the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern)\n return {\n countryCode: countryCode || '',\n dialCode: '',\n formattedPhoneNumber: phoneNumber,\n formatTemplate: '',\n };\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n\n // Extract the dialCode from the phoneNumber\n const dialCode = phoneNumber.slice(0, diff);\n\n // Obtain the format template associated with the countryCode\n const formatTemplate = PHONE_FORMATTER_MAPPER[countryCode];\n\n // Return the parsed phone number information\n return {\n countryCode,\n formattedPhoneNumber,\n dialCode,\n formatTemplate,\n };\n};\n\nexport default withErrorBoundary(parsePhoneNumber);\n","export const stringToDate = (dateString: string): Date => {\n const supportedDateFormats = [\n // Date formats\n {\n regex: /^(\\d{4})\\/(\\d{2})\\/(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY/MM/DD\n {\n regex: /^(\\d{2})\\/(\\d{2})\\/(\\d{4})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n }, // DD/MM/YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY.MM.DD\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // DD-MM-YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // MM/DD/YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY-MM-DD\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY. MM. DD.\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // DD.MM.YYYY\n\n // Timestamp formats\n {\n regex: /^(\\d{4})\\/(\\d{2})\\/(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY/MM/DD HH:MM:SS\n {\n regex: /^(\\d{2})\\/(\\d{2})\\/(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD/MM/YYYY HH:MM:SS\n {\n regex: /^(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY-MM-DD HH:MM:SS\n {\n regex: /^(\\d{2})-(\\d{2})-(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD-MM-YYYY HH:MM:SS\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY.MM.DD HH:MM:SS\n {\n regex: /^(\\d{2})\\.(\\d{2})\\.(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD.MM.YYYY HH:MM:SS\n ];\n\n for (const format of supportedDateFormats) {\n const match = dateString.match(format.regex);\n if (match) {\n const year = match[format.yearIndex];\n const month = match[format.monthIndex];\n const day = match[format.dayIndex];\n const hour = format.hourIndex ? match[format.hourIndex] : '00';\n const minute = format.minuteIndex ? match[format.minuteIndex] : '00';\n const second = format.secondIndex ? match[format.secondIndex] : '00';\n\n return new Date(`${year}-${month}-${day}T${hour}:${minute}:${second}`);\n }\n }\n\n throw new Error('Date format not recognized');\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Adds a specified amount of time to a date.\n *\n * @param date The original date.\n * @param value The amount to add.\n * @param unit The unit of time to add (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time added.\n */\nconst add = (\n date: DateInput,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n switch (unit) {\n case 'days':\n date.setDate(date.getDate() + value);\n break;\n case 'months':\n date.setMonth(date.getMonth() + value);\n break;\n case 'years':\n date.setFullYear(date.getFullYear() + value);\n break;\n }\n return date;\n};\n\nexport default withErrorBoundary(add);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Formats date and time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional).\n * @returns {string} Formatted date and time string.\n */\nconst formatDateTime = (\n date: DateInput,\n locale: Locale,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n const dateObj: Date = date instanceof Date ? date : new Date(date);\n let formatter;\n\n try {\n formatter = new Intl.DateTimeFormat(locale, intlOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formatter.format(dateObj);\n};\n\nexport default withErrorBoundary(formatDateTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n DateFormatOptions,\n} from './types';\n\n/**\n * Formats date based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional).\n * @returns {string} Formatted date string.\n */\nconst formatDate = (\n date: DateInput,\n locale: Locale,\n options: DateFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n timeStyle: undefined,\n };\n\n let formattedDate;\n\n try {\n formattedDate = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedDate;\n};\n\nexport default withErrorBoundary(formatDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n TimeFormatOptions,\n} from './types';\n\n/**\n * Formats time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional).\n * @returns {string} Formatted time string.\n */\nconst formatTime = (\n date: DateInput,\n locale: Locale,\n options: TimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n dateStyle: undefined,\n };\n\n let formattedTime;\n\n try {\n formattedTime = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedTime;\n};\n\nexport default withErrorBoundary(formatTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\n\n/**\n * Gets the first day of the week for a given locale.\n *\n * @param locale The locale to determine the first day of the week for.\n * @param intlOptions Optional Intl.DateTimeFormatOptions for customization.\n * @returns The first day of the week (0-6, where 0 is Sunday).\n */\nconst getFirstDayOfWeek = (\n locale: string,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n let formatted;\n\n if (!intlOptions.weekday) intlOptions.weekday = 'long';\n\n try {\n const formatter = new Intl.DateTimeFormat(locale, intlOptions);\n /**\n * This date was chosen because January 2, 2000, is a Sunday.\n * In the Gregorian calendar, Sunday is considered the start of the week in some cultures (like in the United States), while in others, it's Monday (like in much of Europe).\n * By using a date that is known to be a Sunday, the function can accurately determine what day of the week is considered the start in the specified locale.\n */\n const sundayDate = new Date(2000, 0, 2); // A known Sunday\n formatted = formatter.format(sundayDate);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n // Generate localized weekdays array starting from Sunday\n const weekdays = Array.from({ length: 7 }, (_, i) =>\n new Intl.DateTimeFormat(locale, intlOptions).format(\n new Date(2000, 0, 2 + i),\n ),\n );\n\n const firstDayIndex = weekdays.indexOf(formatted);\n if (firstDayIndex === -1) {\n throw new Error('Unable to determine the first day of the week');\n }\n\n return weekdays[(firstDayIndex + 1) % 7]; // Adjusting since our reference date is a Sunday\n};\n\nexport default withErrorBoundary(getFirstDayOfWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Determines the quarter of the year for a given date.\n *\n * @param date The date to determine the quarter for.\n * @returns The quarter of the year (1-4).\n */\nconst getQuarter = (date: DateInput): number => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n return Math.ceil((date.getMonth() + 1) / 3);\n};\n\nexport default withErrorBoundary(getQuarter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Provides a relative time string (e.g., '3 hours ago', 'in 2 days').\n * This function calculates the difference between the given date and the base date,\n * then formats it in a locale-sensitive manner. It allows customization of the output\n * through Intl.RelativeTimeFormat options.\n *\n * @param date - The date to compare.\n * @param baseDate - The date to compare against (default: current date).\n * @param locale - The locale to use for formatting.\n * @param options - Options for the Intl.RelativeTimeFormat (optional).\n * @returns The relative time as a string.\n */\nconst getRelativeTime = (\n date: DateInput,\n baseDate: DateInput = new Date(),\n locale: Locale,\n options?: Intl.RelativeTimeFormatOptions,\n): string => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n baseDate =\n typeof baseDate === 'string'\n ? new Date(stringToDate(baseDate))\n : new Date(baseDate);\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000;\n\n // Define time units in seconds\n const minute = 60;\n const hour = minute * 60;\n const day = hour * 24;\n const week = day * 7;\n const month = day * 30;\n const year = day * 365;\n\n let value: number;\n let unit: Intl.RelativeTimeFormatUnit;\n\n if (Math.abs(diffInSeconds) < minute) {\n value = diffInSeconds;\n unit = 'second';\n } else if (Math.abs(diffInSeconds) < hour) {\n value = diffInSeconds / minute;\n unit = 'minute';\n } else if (Math.abs(diffInSeconds) < day) {\n value = diffInSeconds / hour;\n unit = 'hour';\n } else if (Math.abs(diffInSeconds) < week) {\n value = diffInSeconds / day;\n unit = 'day';\n } else if (Math.abs(diffInSeconds) < month) {\n value = diffInSeconds / week;\n unit = 'week';\n } else if (Math.abs(diffInSeconds) < year) {\n value = diffInSeconds / month;\n unit = 'month';\n } else {\n value = diffInSeconds / year;\n unit = 'year';\n }\n\n let relativeTime;\n\n try {\n const rtf = new Intl.RelativeTimeFormat(locale, options);\n relativeTime = rtf.format(Math.round(value), unit);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return relativeTime;\n};\n\nexport default withErrorBoundary(getRelativeTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Calculates the week number of the year for a given date.\n *\n * @param date The date to calculate the week number for.\n * @returns The week number of the year.\n */\nconst getWeek = (date: DateInput): number => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n const firstDayOfYear = new Date(date.getFullYear(), 0, 1);\n const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000;\n return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7);\n};\n\nexport default withErrorBoundary(getWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Returns an array of weekdays according to the specified locale.\n *\n * @param locale The locale to get weekdays for.\n * @param intlOptions Optional Intl.DateTimeFormatOptions for customization.\n * @returns An array of weekday names.\n */\nconst getWeekdays = (\n locale: Locale,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string[] => {\n try {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n if (!intlOptions.weekday) intlOptions.weekday = 'long';\n\n const formatter = new Intl.DateTimeFormat(locale, intlOptions);\n\n /** The date January 1, 1970, is a well-known reference point in computing known as the Unix epoch.\n * It's the date at which time is measured for Unix systems, making it a consistent and reliable choice for date calculations.\n * The choice of the date January 4, 1970, as the starting point is significant.\n * January 4, 1970, was a Sunday.\n * Since weeks typically start on Sunday or Monday in most locales, starting from a known Sunday allows the function to cycle through a complete week, capturing all weekdays in the order they appear for the given locale.\n * */\n return Array.from({ length: 7 }, (_, i) =>\n formatter.format(new Date(1970, 0, 4 + i)),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(getWeekdays);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Compares two dates to determine if the first is after the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is after date2.\n */\nconst isAfter = (date1: DateInput, date2: DateInput): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 > dateObj2;\n};\n\nexport default withErrorBoundary(isAfter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Compares two dates to determine if the first is before the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is before date2.\n */\nconst isBefore = (date1: DateInput, date2: DateInput): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 < dateObj2;\n};\n\nexport default withErrorBoundary(isBefore);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given year is a leap year.\n *\n * @param year The year to check.\n * @returns True if the year is a leap year, false otherwise.\n */\nconst isLeapYear = (year: number): boolean => {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n};\n\nexport default withErrorBoundary(isLeapYear);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { stringToDate } from './utils';\n\n/**\n * Checks if two dates fall on the same day.\n *\n * @param date1 The first date.\n * @param date2 The second date.\n * @returns True if both dates are on the same day, false otherwise.\n */\nconst isSameDay = (date1: Date, date2: Date): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n return (\n date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear()\n );\n};\n\nexport default withErrorBoundary(isSameDay);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { stringToDate } from './utils';\n\n/**\n * Checks if a given object is a valid Date object.\n *\n * @param date The object to check.\n * @returns True if the object is a valid Date, false otherwise.\n */\nconst isValidDate = (date: any): boolean => {\n try {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return date instanceof Date && !isNaN(date.getTime());\n};\n\nexport default withErrorBoundary(isValidDate);\n","export const LOCALE_DATE_FORMATS: { [key: string]: string } = {\n 'ar-AE': 'DD/MM/YYYY', // Arabic (U.A.E.)\n 'sq-AL': 'DD.MM.YYYY', // Albanian (Albania)\n 'hy-AM': 'DD.MM.YYYY', // Armenian (Armenia)\n 'es-AR': 'DD/MM/YYYY', // Spanish (Argentina)\n 'en-AU': 'DD/MM/YYYY', // English (Australia)\n 'nl-AW': 'DD-MM-YYYY', // Dutch (Aruba)\n 'en-BB': 'MM/DD/YYYY', // English (Barbados)\n 'bn-BD': 'DD/MM/YYYY', // Bengali (Bangladesh)\n 'en-BM': 'MM/DD/YYYY', // English (Bermuda)\n 'ms-BN': 'DD/MM/YYYY', // Malay (Brunei)\n 'es-BO': 'DD/MM/YYYY', // Spanish (Bolivia)\n 'en-BS': 'MM/DD/YYYY', // English (Bahamas)\n 'en-BW': 'DD/MM/YYYY', // English (Botswana)\n 'en-BZ': 'MM/DD/YYYY', // English (Belize)\n 'en-CA': 'DD/MM/YYYY', // English (Canada)\n 'de-CH': 'DD.MM.YYYY', // German (Switzerland)\n 'zh-CN': 'YYYY/MM/DD', // Chinese (China)\n 'es-CO': 'DD/MM/YYYY', // Spanish (Colombia)\n 'es-CR': 'DD/MM/YYYY', // Spanish (Costa Rica)\n 'es-CU': 'DD/MM/YYYY', // Spanish (Cuba)\n 'cs-CZ': 'DD.MM.YYYY', // Czech (Czech Republic)\n 'da-DK': 'DD-MM-YYYY', // Danish (Denmark)\n 'es-DO': 'DD/MM/YYYY', // Spanish (Dominican Republic)\n 'ar-DZ': 'DD/MM/YYYY', // Arabic (Algeria)\n 'ar-EG': 'DD/MM/YYYY', // Arabic (Egypt)\n 'am-ET': 'DD/MM/YYYY', // Amharic (Ethiopia)\n 'en-EU': 'DD/MM/YYYY', // English (European Union)\n 'en-FJ': 'DD/MM/YYYY', // English (Fiji)\n 'en-GB': 'DD/MM/YYYY', // English (United Kingdom)\n 'en-GH': 'DD/MM/YYYY', // English (Ghana)\n 'en-GI': 'DD/MM/YYYY', // English (Gibraltar)\n 'en-GM': 'DD/MM/YYYY', // English (Gambia)\n 'es-GT': 'DD/MM/YYYY', // Spanish (Guatemala)\n 'en-GY': 'DD/MM/YYYY', // English (Guyana)\n 'en-HK': 'DD/MM/YYYY', // English (Hong Kong)\n 'es-HN': 'DD/MM/YYYY', // Spanish (Honduras)\n 'hr-HR': 'DD.MM.YYYY', // Croatian (Croatia)\n 'ht-HT': 'MM/DD/YYYY', // Haitian (Haiti)\n 'hu-HU': 'YYYY. MM. DD.', // Hungarian (Hungary)\n 'id-ID': 'DD/MM/YYYY', // Indonesian (Indonesia)\n 'he-IL': 'DD/MM/YYYY', // Hebrew (Israel)\n 'en-IN': 'DD-MM-YYYY', // English (India)\n 'en-JM': 'MM/DD/YYYY', // English (Jamaica)\n 'en-KE': 'DD/MM/YYYY', // English (Kenya)\n 'ky-KG': 'DD.MM.YYYY', // Kyrgyz (Kyrgyzstan)\n 'km-KH': 'DD/MM/YYYY', // Khmer (Cambodia)\n 'en-KY': 'MM/DD/YYYY', // English (Cayman Islands)\n 'kk-KZ': 'DD.MM.YYYY', // Kazakh (Kazakhstan)\n 'lo-LA': 'DD/MM/YYYY', // Lao (Laos)\n 'si-LK': 'YYYY-MM-DD', // Sinhala (Sri Lanka)\n 'en-LR': 'MM/DD/YYYY', // English (Liberia)\n 'en-LS': 'DD/MM/YYYY', // English (Lesotho)\n 'ar-MA': 'DD/MM/YYYY', // Arabic (Morocco)\n 'ro-MD': 'DD.MM.YYYY', // Romanian (Moldova)\n 'mk-MK': 'DD.MM.YYYY', // Macedonian (North Macedonia)\n 'my-MM': 'DD/MM/YYYY', // Burmese (Myanmar)\n 'mn-MN': 'YYYY.MM.DD', // Mongolian (Mongolia)\n 'zh-MO': 'DD/MM/YYYY', // Chinese (Macao)\n 'en-MU': 'DD/MM/YYYY', // English (Mauritius)\n 'dv-MV': 'DD/MM/YYYY', // Divehi (Maldives)\n 'en-MW': 'DD/MM/YYYY', // English (Malawi)\n 'es-MX': 'DD/MM/YYYY', // Spanish (Mexico)\n 'ms-MY': 'DD/MM/YYYY', // Malay (Malaysia)\n 'en-NA': 'DD/MM/YYYY', // English (Namibia)\n 'en-NG': 'DD/MM/YYYY', // English (Nigeria)\n 'es-NI': 'DD/MM/YYYY', // Spanish (Nicaragua)\n 'no-NO': 'DD.MM.YYYY', // Norwegian (Norway)\n 'ne-NP': 'YYYY/MM/DD', // Nepali (Nepal)\n 'en-NZ': 'DD/MM/YYYY', // English (New Zealand)\n 'es-PE': 'DD/MM/YYYY', // Spanish (Peru)\n 'en-PG': 'DD/MM/YYYY', // English (Papua New Guinea)\n 'en-PH': 'MM/DD/YYYY', // English (Philippines)\n 'en-PK': 'DD/MM/YYYY', // English (Pakistan)\n 'ar-QA': 'DD/MM/YYYY', // Arabic (Qatar)\n 'ru-RU': 'DD.MM.YYYY', // Russian (Russia)\n 'ar-SA': 'DD/MM/YYYY', // Arabic (Saudi Arabia)\n 'en-SC': 'DD/MM/YYYY', // English (Seychelles)\n 'sv-SE': 'YYYY-MM-DD', // Swedish (Sweden)\n 'en-SG': 'DD/MM/YYYY', // English (Singapore)\n 'en-SL': 'DD/MM/YYYY', // English (Sierra Leone)\n 'so-SO': 'DD/MM/YYYY', // Somali (Somalia)\n 'en-SS': 'DD/MM/YYYY', // English (South Sudan)\n 'es-SV': 'DD/MM/YYYY', // Spanish (El Salvador)\n 'en-SZ': 'DD/MM/YYYY', // English (Eswatini)\n 'th-TH': 'DD/MM/YYYY', // Thai (Thailand)\n 'en-TT': 'MM/DD/YYYY', // English (Trinidad and Tobago)\n 'sw-TZ': 'DD/MM/YYYY', // Swahili (Tanzania)\n 'en-US': 'MM/DD/YYYY', // English (United States)\n 'es-UY': 'DD/MM/YYYY', // Spanish (Uruguay)\n 'uz-UZ': 'DD/MM/YYYY', // Uzbek (Uzbekistan)\n 'ar-YE': 'DD/MM/YYYY', // Arabic (Yemen)\n 'en-ZA': 'YYYY/MM/DD', // English (South Africa)\n 'ar-KW': 'DD/MM/YYYY', // Arabic (Kuwait)\n 'ar-BH': 'DD/MM/YYYY', // Arabic (Bahrain)\n 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman)\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Parses a date string based on a specific format.\n *\n * @param dateString The date string to parse.\n * @param format The format to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDateWithFormat = (\n dateString: string,\n format: string,\n): Date | null => {\n // Determine the separator based on the format (supports '/', '.', or '-')\n const separator = format.includes('/')\n ? '/'\n : format.includes('.')\n ? '.'\n : '-';\n const formatParts = format.split(separator);\n const dateParts = dateString.split(separator).map((num) => parseInt(num, 10));\n\n let year: number = 0,\n month: number = 0,\n day: number = 0;\n let yearSet: boolean = false,\n monthSet: boolean = false,\n daySet: boolean = false;\n\n // Check for format and date string mismatch\n if (dateParts.length !== formatParts.length) {\n return null; // Mismatch between date string and format\n }\n\n formatParts.forEach((part, index) => {\n // Check for non-numeric values in date string\n if (isNaN(dateParts[index])) {\n return null; // Invalid date part\n }\n\n // Assign year, month, and day based on the format\n switch (part) {\n case 'DD':\n day = dateParts[index];\n daySet = true;\n break;\n case 'MM':\n month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date\n monthSet = true;\n break;\n case 'YYYY':\n year = dateParts[index];\n yearSet = true;\n break;\n }\n });\n\n // Validate and create the date only if all parts are set\n if (yearSet && monthSet && daySet) {\n const parsedDate = new Date(year, month, day);\n // Validate date to catch invalid dates like February 30th\n if (\n parsedDate.getFullYear() === year &&\n parsedDate.getMonth() === month &&\n parsedDate.getDate() === day\n ) {\n return parsedDate;\n }\n }\n return null; // Invalid date or incomplete date information\n};\n\nexport default withErrorBoundary(\n parseDateWithFormat,\n);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { LOCALE_DATE_FORMATS } from './data/localeDateFormats';\nimport parseDateWithFormat from './parseDateWithFormat';\nimport { Locale } from './types';\n\n/**\n * Attempts to parse a string into a date object based on locale.\n * Uses the localeDateFormats mapping for determining the date format.\n *\n * @param dateString - The date string to parse.\n * @param locale - The locale to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDate = (dateString: string, locale: Locale): Date | null => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const format = LOCALE_DATE_FORMATS[locale];\n if (!format) {\n throw new Error(`No date format found for locale: ${locale}`);\n }\n return parseDateWithFormat(dateString, format);\n};\n\nexport default withErrorBoundary(parseDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport add from './add';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Subtracts a specified amount of time from a date.\n *\n * @param date The original date.\n * @param value The amount to subtract.\n * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time subtracted.\n */\nconst subtract = (\n date: DateInput,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n return add(date, -value, unit); // Reuse the add function with negative value\n};\n\nexport default withErrorBoundary(subtract);\n"],"names":["I18nifyError","Error","constructor","message","super","this","name","timestamp","Date","withErrorBoundary","fn","rest","call","err","console","warn","I18nStateManager","state","locale","direction","country","getInstance","instance","resetInstance","undefined","getState","Object","assign","setState","newState","resetState","getState$1","setState$1","resetState$1","getLocale","navigator","window","Intl","languages","language","getIntlInstanceWithOptions","options","intlOptions","currency","style","NumberFormat","formatNumber$1","amount","Number","formattedAmount","format","CURRENCIES","AED","symbol","ALL","AMD","ARS","AUD","AWG","BBD","BDT","BMD","BND","BOB","BSD","BWP","BZD","CAD","CHF","CNY","COP","CRC","CUP","CZK","DKK","DOP","DZD","EGP","ETB","EUR","FJD","GBP","GHS","GIP","GMD","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","JMD","KES","KGS","KHR","KYD","KZT","LAK","LKR","LRD","LSL","MAD","MDL","MKD","MMK","MNT","MOP","MUR","MVR","MWK","MXN","MYR","NAD","NGN","NIO","NOK","NPR","NZD","PEN","PGK","PHP","PKR","QAR","RUB","SAR","SCR","SEK","SGD","SLL","SOS","SSP","SVC","SZL","THB","TTD","TZS","USD","UYU","UZS","YER","ZAR","KWD","BHD","OMR","getCurrencyList$1","getCurrencySymbol$1","currencyCode","_a","ALLOWED_FORMAT_PARTS_KEYS","formatNumberByParts$1","parts","formatToParts","formattedObj","forEach","p","type","integer","value","findIndex","item","isPrefixSymbol","rawParts","PHONE_REGEX_MAPPER","IN","MY","AE","AL","AM","AR","AU","AW","BB","BD","BM","BN","BO","BS","BW","BZ","CH","CN","CO","OM","CR","CU","CZ","DK","DO","DZ","EG","ET","EU","FJ","GB","GH","GI","GM","GT","GY","HK","HN","HR","HT","HU","ID","IL","JM","KE","KG","KH","KY","KZ","LA","LK","LR","LS","MA","MD","MK","MM","MN","MO","MU","MV","MW","MX","NA","NG","NI","NO","NP","NZ","PE","PG","PH","PK","QA","RU","SA","SC","SE","SG","SL","SO","SS","SV","SZ","TH","TT","TZ","US","CA","UY","UZ","YE","ZA","KW","BH","TL","VC","VE","VN","ZM","ZW","LT","LU","LV","ME","MG","MZ","NL","PA","PL","PR","PS","PT","PY","RO","RS","RW","SI","SK","SM","SN","SR","TG","TJ","TN","TR","TW","UA","UG","DIAL_CODE_MAPPER","detectCountryCodeFromDialCode","phoneNumber","toString","charAt","cleanedPhoneNumberWithoutPlusPrefix","replace","matchingCountries","code","startsWith","push","find","countryCode","regex","test","cleanPhoneNumber","cleanedPhoneNumber","isValidPhoneNumber$1","PHONE_FORMATTER_MAPPER","formatPhoneNumber$1","pattern","charCountInFormatterPattern","i","length","diff","phoneNumberWithoutPrefix","slice","formattedNumber","numberIndex","patternChar","formattedPhoneNumberWithoutPrefix","join","trim","parsePhoneNumber$1","formattedPhoneNumber","formatPhoneNumber","dialCode","formatTemplate","stringToDate","dateString","supportedDateFormats","yearIndex","monthIndex","dayIndex","hourIndex","minuteIndex","secondIndex","match","year","month","day","hour","minute","second","add$1","date","unit","setDate","getDate","setMonth","getMonth","setFullYear","getFullYear","formatDateTime$1","dateObj","formatter","DateTimeFormat","formatDate$1","fullOptions","timeStyle","formattedDate","formatDateTime","formatTime$1","dateStyle","formattedTime","getFirstDayOfWeek$1","formatted","weekday","sundayDate","weekdays","Array","from","_","firstDayIndex","indexOf","getQuarter$1","Math","ceil","getRelativeTime$1","baseDate","diffInSeconds","getTime","week","relativeTime","abs","RelativeTimeFormat","round","getWeek$1","firstDayOfYear","pastDaysOfYear","getDay","getWeekdays$1","isAfter$1","date1","date2","isBefore$1","isLeapYear$1","isSameDay$1","isValidDate$1","isNaN","LOCALE_DATE_FORMATS","parseDateWithFormat$1","separator","includes","formatParts","split","dateParts","map","num","parseInt","yearSet","monthSet","daySet","part","index","parsedDate","parseDate$1","parseDateWithFormat","subtract$1","add"],"mappings":"+OACM,MAAOA,UAAqBC,MAEhC,WAAAC,CAAYC,GACVC,MAAMD,GACNE,KAAKC,KAAO,gBACZD,KAAKE,UAAY,IAAIC,IAEtB,EAYI,MAAMC,EACXC,GAEO,YAA4BC,GACjC,IACE,OAAOD,EAAGE,KAAKP,QAASM,EACzB,CAAC,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,MAAMH,GAC3BI,EAAY7E,EAAW4E,MAAMH,GAAWK,KAAKC,GAAQC,SAASD,EAAK,MAEzE,IAAItE,EAAe,EACjBC,EAAgB,EAChBC,EAAc,EACZsE,GAAmB,EACrBC,GAAoB,EACpBC,GAAkB,EAGpB,GAAIN,EAAU7F,SAAW2F,EAAY3F,OACnC,OAAO,KA2BT,GAxBA2F,EAAY7P,SAAQ,CAACsQ,EAAMC,KAEzB,GAAIf,MAAMO,EAAUQ,IAClB,OAAO,KAIT,OAAQD,GACN,IAAK,KACHzE,EAAMkE,EAAUQ,GAChBF,GAAS,EACT,MACF,IAAK,KACHzE,EAAQmE,EAAUQ,GAAS,EAC3BH,GAAW,EACX,MACF,IAAK,OACHzE,EAAOoE,EAAUQ,GACjBJ,GAAU,EAEb,IAICA,GAAWC,GAAYC,EAAQ,CACjC,MAAMG,EAAa,IAAI7Z,KAAKgV,EAAMC,EAAOC,GAEzC,GACE2E,EAAW/D,gBAAkBd,GAC7B6E,EAAWjE,aAAeX,GAC1B4E,EAAWnE,YAAcR,EAEzB,OAAO2E,CAEV,CACD,OAAO,IAAI,ICvCE,IAAAC,EAAA7Z,GAfG,CAACsU,EAAoB7T,KAMhCA,IAAQA,EAASD,EAAMQ,WAAWP,QAAUgB,KAEjD,MAAMgB,EAASoW,EAAoBpY,GACnC,IAAKgC,EACH,MAAM,IAAIjD,MAAM,oCAAoCiB,KAEtD,OAAOqZ,EAAoBxF,EAAY7R,EAAO,ICHjC,IAAAsX,EAAA/Z,GAXE,CACfsV,EACA9L,EACA+L,KAEAD,EACkB,iBAATA,EAAoB,IAAIvV,KAAKsU,EAAaiB,IAAS,IAAIvV,KAAKuV,GAE9D0E,EAAI1E,GAAO9L,EAAO+L"} \ No newline at end of file diff --git a/src/modules/dateTime/add.ts b/src/modules/dateTime/add.ts index 3c1317fd..06d5ae79 100644 --- a/src/modules/dateTime/add.ts +++ b/src/modules/dateTime/add.ts @@ -1,4 +1,6 @@ import { withErrorBoundary } from '../../common/errorBoundary'; +import { DateInput } from './types'; +import { stringToDate } from './utils'; /** * Adds a specified amount of time to a date. @@ -9,23 +11,25 @@ import { withErrorBoundary } from '../../common/errorBoundary'; * @returns A new Date object with the time added. */ const add = ( - date: Date, + date: DateInput, value: number, unit: 'days' | 'months' | 'years', ): Date => { - const result = new Date(date); + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); + switch (unit) { case 'days': - result.setDate(result.getDate() + value); + date.setDate(date.getDate() + value); break; case 'months': - result.setMonth(result.getMonth() + value); + date.setMonth(date.getMonth() + value); break; case 'years': - result.setFullYear(result.getFullYear() + value); + date.setFullYear(date.getFullYear() + value); break; } - return result; + return date; }; export default withErrorBoundary(add); diff --git a/src/modules/dateTime/formatDateTime.ts b/src/modules/dateTime/formatDateTime.ts index 5933ca09..d11eda08 100644 --- a/src/modules/dateTime/formatDateTime.ts +++ b/src/modules/dateTime/formatDateTime.ts @@ -1,7 +1,8 @@ import { withErrorBoundary } from '../../common/errorBoundary'; import state from '../.internal/state'; import { getLocale } from '../.internal/utils'; -import { DateInput, Locale, DateTimeFormatOptions } from './types'; +import { DateInput, Locale } from './types'; +import { stringToDate } from './utils'; /** * Formats date and time based on the locale. @@ -13,7 +14,7 @@ import { DateInput, Locale, DateTimeFormatOptions } from './types'; const formatDateTime = ( date: DateInput, locale: Locale, - options: DateTimeFormatOptions = {}, + intlOptions: Intl.DateTimeFormatOptions = {}, ): string => { /** retrieve locale from below areas in order of preference * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) @@ -22,11 +23,14 @@ const formatDateTime = ( * */ if (!locale) locale = state.getState().locale || getLocale(); + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); + const dateObj: Date = date instanceof Date ? date : new Date(date); let formatter; try { - formatter = new Intl.DateTimeFormat(locale, options); + formatter = new Intl.DateTimeFormat(locale, intlOptions); } catch (err) { if (err instanceof Error) { throw new Error(err.message); diff --git a/src/modules/dateTime/getFirstDayOfWeek.ts b/src/modules/dateTime/getFirstDayOfWeek.ts index 980f3cdf..101436c1 100644 --- a/src/modules/dateTime/getFirstDayOfWeek.ts +++ b/src/modules/dateTime/getFirstDayOfWeek.ts @@ -6,9 +6,13 @@ import { getLocale } from '../.internal/utils'; * Gets the first day of the week for a given locale. * * @param locale The locale to determine the first day of the week for. + * @param intlOptions Optional Intl.DateTimeFormatOptions for customization. * @returns The first day of the week (0-6, where 0 is Sunday). */ -const getFirstDayOfWeek = (locale: string): number => { +const getFirstDayOfWeek = ( + locale: string, + intlOptions: Intl.DateTimeFormatOptions = {}, +): string => { /** retrieve locale from below areas in order of preference * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) * 2. i18nState.locale (uses locale set globally) @@ -18,10 +22,17 @@ const getFirstDayOfWeek = (locale: string): number => { let formatted; + if (!intlOptions.weekday) intlOptions.weekday = 'long'; + try { - const formatter = new Intl.DateTimeFormat(locale, { weekday: 'short' }); - const sampleDate = new Date(2000, 0, 2); // A Sunday - formatted = formatter.format(sampleDate); + const formatter = new Intl.DateTimeFormat(locale, intlOptions); + /** + * This date was chosen because January 2, 2000, is a Sunday. + * In the Gregorian calendar, Sunday is considered the start of the week in some cultures (like in the United States), while in others, it's Monday (like in much of Europe). + * By using a date that is known to be a Sunday, the function can accurately determine what day of the week is considered the start in the specified locale. + */ + const sundayDate = new Date(2000, 0, 2); // A known Sunday + formatted = formatter.format(sundayDate); } catch (err) { if (err instanceof Error) { throw new Error(err.message); @@ -30,9 +41,19 @@ const getFirstDayOfWeek = (locale: string): number => { } } - return ['su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'].indexOf( - formatted.slice(0, 2).toLowerCase(), + // Generate localized weekdays array starting from Sunday + const weekdays = Array.from({ length: 7 }, (_, i) => + new Intl.DateTimeFormat(locale, intlOptions).format( + new Date(2000, 0, 2 + i), + ), ); + + const firstDayIndex = weekdays.indexOf(formatted); + if (firstDayIndex === -1) { + throw new Error('Unable to determine the first day of the week'); + } + + return weekdays[(firstDayIndex + 1) % 7]; // Adjusting since our reference date is a Sunday }; export default withErrorBoundary(getFirstDayOfWeek); diff --git a/src/modules/dateTime/getQuarter.ts b/src/modules/dateTime/getQuarter.ts index 551f1aed..b3e28eba 100644 --- a/src/modules/dateTime/getQuarter.ts +++ b/src/modules/dateTime/getQuarter.ts @@ -1,4 +1,6 @@ import { withErrorBoundary } from '../../common/errorBoundary'; +import { DateInput } from './types'; +import { stringToDate } from './utils'; /** * Determines the quarter of the year for a given date. @@ -6,7 +8,9 @@ import { withErrorBoundary } from '../../common/errorBoundary'; * @param date The date to determine the quarter for. * @returns The quarter of the year (1-4). */ -const getQuarter = (date: Date): number => { +const getQuarter = (date: DateInput): number => { + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); return Math.ceil((date.getMonth() + 1) / 3); }; diff --git a/src/modules/dateTime/getRelativeTime.ts b/src/modules/dateTime/getRelativeTime.ts index 106d8736..6c161820 100644 --- a/src/modules/dateTime/getRelativeTime.ts +++ b/src/modules/dateTime/getRelativeTime.ts @@ -1,7 +1,8 @@ import { withErrorBoundary } from '../../common/errorBoundary'; import state from '../.internal/state'; import { getLocale } from '../.internal/utils'; -import { Locale } from './types'; +import { DateInput, Locale } from './types'; +import { stringToDate } from './utils'; /** * Provides a relative time string (e.g., '3 hours ago', 'in 2 days'). @@ -16,11 +17,18 @@ import { Locale } from './types'; * @returns The relative time as a string. */ const getRelativeTime = ( - date: Date, - baseDate: Date = new Date(), + date: DateInput, + baseDate: DateInput = new Date(), locale: Locale, options?: Intl.RelativeTimeFormatOptions, ): string => { + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); + + baseDate = + typeof baseDate === 'string' + ? new Date(stringToDate(baseDate)) + : new Date(baseDate); /** retrieve locale from below areas in order of preference * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) * 2. i18nState.locale (uses locale set globally) diff --git a/src/modules/dateTime/getWeek.ts b/src/modules/dateTime/getWeek.ts index 9f32bdac..1973c9f2 100644 --- a/src/modules/dateTime/getWeek.ts +++ b/src/modules/dateTime/getWeek.ts @@ -1,4 +1,6 @@ import { withErrorBoundary } from '../../common/errorBoundary'; +import { DateInput } from './types'; +import { stringToDate } from './utils'; /** * Calculates the week number of the year for a given date. @@ -6,7 +8,9 @@ import { withErrorBoundary } from '../../common/errorBoundary'; * @param date The date to calculate the week number for. * @returns The week number of the year. */ -const getWeek = (date: Date): number => { +const getWeek = (date: DateInput): number => { + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); const firstDayOfYear = new Date(date.getFullYear(), 0, 1); const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000; return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7); diff --git a/src/modules/dateTime/getWeekdays.ts b/src/modules/dateTime/getWeekdays.ts index 827f499d..633a7452 100644 --- a/src/modules/dateTime/getWeekdays.ts +++ b/src/modules/dateTime/getWeekdays.ts @@ -7,9 +7,13 @@ import { Locale } from './types'; * Returns an array of weekdays according to the specified locale. * * @param locale The locale to get weekdays for. + * @param intlOptions Optional Intl.DateTimeFormatOptions for customization. * @returns An array of weekday names. */ -const getWeekdays = (locale: Locale): string[] => { +const getWeekdays = ( + locale: Locale, + intlOptions: Intl.DateTimeFormatOptions = {}, +): string[] => { try { /** retrieve locale from below areas in order of preference * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) @@ -17,7 +21,16 @@ const getWeekdays = (locale: Locale): string[] => { * 3. navigator (in case locale is not passed or set, use it from browser's navigator) * */ if (!locale) locale = state.getState().locale || getLocale(); - const formatter = new Intl.DateTimeFormat(locale, { weekday: 'long' }); + if (!intlOptions.weekday) intlOptions.weekday = 'long'; + + const formatter = new Intl.DateTimeFormat(locale, intlOptions); + + /** The date January 1, 1970, is a well-known reference point in computing known as the Unix epoch. + * It's the date at which time is measured for Unix systems, making it a consistent and reliable choice for date calculations. + * The choice of the date January 4, 1970, as the starting point is significant. + * January 4, 1970, was a Sunday. + * Since weeks typically start on Sunday or Monday in most locales, starting from a known Sunday allows the function to cycle through a complete week, capturing all weekdays in the order they appear for the given locale. + * */ return Array.from({ length: 7 }, (_, i) => formatter.format(new Date(1970, 0, 4 + i)), ); diff --git a/src/modules/dateTime/isAfter.ts b/src/modules/dateTime/isAfter.ts index d7799f4b..6cc0919f 100644 --- a/src/modules/dateTime/isAfter.ts +++ b/src/modules/dateTime/isAfter.ts @@ -1,5 +1,6 @@ import { withErrorBoundary } from '../../common/errorBoundary'; import { DateInput } from './types'; +import { stringToDate } from './utils'; /** * Compares two dates to determine if the first is after the second. @@ -8,6 +9,11 @@ import { DateInput } from './types'; * @returns {boolean} True if date1 is after date2. */ const isAfter = (date1: DateInput, date2: DateInput): boolean => { + date1 = + typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1); + date2 = + typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2); + const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1); const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2); return dateObj1 > dateObj2; diff --git a/src/modules/dateTime/isBefore.ts b/src/modules/dateTime/isBefore.ts index 8998933b..3fbdf441 100644 --- a/src/modules/dateTime/isBefore.ts +++ b/src/modules/dateTime/isBefore.ts @@ -1,5 +1,6 @@ import { withErrorBoundary } from '../../common/errorBoundary'; import { DateInput } from './types'; +import { stringToDate } from './utils'; /** * Compares two dates to determine if the first is before the second. @@ -8,6 +9,11 @@ import { DateInput } from './types'; * @returns {boolean} True if date1 is before date2. */ const isBefore = (date1: DateInput, date2: DateInput): boolean => { + date1 = + typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1); + date2 = + typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2); + const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1); const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2); return dateObj1 < dateObj2; diff --git a/src/modules/dateTime/isSameDay.ts b/src/modules/dateTime/isSameDay.ts index cec4ac3b..952424a0 100644 --- a/src/modules/dateTime/isSameDay.ts +++ b/src/modules/dateTime/isSameDay.ts @@ -1,4 +1,5 @@ import { withErrorBoundary } from '../../common/errorBoundary'; +import { stringToDate } from './utils'; /** * Checks if two dates fall on the same day. @@ -8,6 +9,11 @@ import { withErrorBoundary } from '../../common/errorBoundary'; * @returns True if both dates are on the same day, false otherwise. */ const isSameDay = (date1: Date, date2: Date): boolean => { + date1 = + typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1); + date2 = + typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2); + return ( date1.getDate() === date2.getDate() && date1.getMonth() === date2.getMonth() && diff --git a/src/modules/dateTime/isValidDate.ts b/src/modules/dateTime/isValidDate.ts index d90cc9ce..652f9bc2 100644 --- a/src/modules/dateTime/isValidDate.ts +++ b/src/modules/dateTime/isValidDate.ts @@ -1,4 +1,5 @@ import { withErrorBoundary } from '../../common/errorBoundary'; +import { stringToDate } from './utils'; /** * Checks if a given object is a valid Date object. @@ -7,6 +8,17 @@ import { withErrorBoundary } from '../../common/errorBoundary'; * @returns True if the object is a valid Date, false otherwise. */ const isValidDate = (date: any): boolean => { + try { + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); + } catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } else { + throw new Error(`An unknown error occurred = ${err}`); + } + } + return date instanceof Date && !isNaN(date.getTime()); }; diff --git a/src/modules/dateTime/subtract.ts b/src/modules/dateTime/subtract.ts index 24e5c80d..6bb3ea7f 100644 --- a/src/modules/dateTime/subtract.ts +++ b/src/modules/dateTime/subtract.ts @@ -1,5 +1,7 @@ import { withErrorBoundary } from '../../common/errorBoundary'; import add from './add'; +import { DateInput } from './types'; +import { stringToDate } from './utils'; /** * Subtracts a specified amount of time from a date. @@ -10,10 +12,13 @@ import add from './add'; * @returns A new Date object with the time subtracted. */ const subtract = ( - date: Date, + date: DateInput, value: number, unit: 'days' | 'months' | 'years', ): Date => { + date = + typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); + return add(date, -value, unit); // Reuse the add function with negative value }; diff --git a/src/modules/dateTime/utils.ts b/src/modules/dateTime/utils.ts new file mode 100644 index 00000000..4d270e00 --- /dev/null +++ b/src/modules/dateTime/utils.ts @@ -0,0 +1,125 @@ +export const stringToDate = (dateString: string): Date => { + const supportedDateFormats = [ + // Date formats + { + regex: /^(\d{4})\/(\d{2})\/(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, // YYYY/MM/DD + { + regex: /^(\d{2})\/(\d{2})\/(\d{4})$/, + yearIndex: 3, + monthIndex: 2, + dayIndex: 1, + }, // DD/MM/YYYY + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, // YYYY.MM.DD + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, // DD-MM-YYYY + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, // MM/DD/YYYY + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, // YYYY-MM-DD + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, // YYYY. MM. DD. + { + regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + }, // DD.MM.YYYY + + // Timestamp formats + { + regex: /^(\d{4})\/(\d{2})\/(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, // YYYY/MM/DD HH:MM:SS + { + regex: /^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 3, + monthIndex: 2, + dayIndex: 1, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, // DD/MM/YYYY HH:MM:SS + { + regex: /^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, // YYYY-MM-DD HH:MM:SS + { + regex: /^(\d{2})-(\d{2})-(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 3, + monthIndex: 2, + dayIndex: 1, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, // DD-MM-YYYY HH:MM:SS + { + regex: /^(\d{4})\.(\d{2})\.(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, // YYYY.MM.DD HH:MM:SS + { + regex: /^(\d{2})\.(\d{2})\.(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 3, + monthIndex: 2, + dayIndex: 1, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + }, // DD.MM.YYYY HH:MM:SS + ]; + + for (const format of supportedDateFormats) { + const match = dateString.match(format.regex); + if (match) { + const year = match[format.yearIndex]; + const month = match[format.monthIndex]; + const day = match[format.dayIndex]; + const hour = format.hourIndex ? match[format.hourIndex] : '00'; + const minute = format.minuteIndex ? match[format.minuteIndex] : '00'; + const second = format.secondIndex ? match[format.secondIndex] : '00'; + + return new Date(`${year}-${month}-${day}T${hour}:${minute}:${second}`); + } + } + + throw new Error('Date format not recognized'); +}; From bbbebf5332968cf2f0bf05c392e38f367e325458 Mon Sep 17 00:00:00 2001 From: RgnDunes Date: Thu, 18 Jan 2024 16:23:23 +0530 Subject: [PATCH 15/28] remove build --- lib/cjs/index.js | 1766 ----------------------------- lib/esm/core/index.d.ts | 13 - lib/esm/core/index.js | 110 -- lib/esm/core/index.js.map | 1 - lib/esm/currency/index.d.ts | 35 - lib/esm/currency/index.js | 289 ----- lib/esm/currency/index.js.map | 1 - lib/esm/dateTime/index.d.ts | 39 - lib/esm/dateTime/index.js | 804 -------------- lib/esm/dateTime/index.js.map | 1 - lib/esm/index.js | 1740 ----------------------------- lib/esm/index.js.map | 1 - lib/esm/index.min.js | 2 - lib/esm/index.min.js.map | 1 - lib/esm/phoneNumber/index.d.ts | 13 - lib/esm/phoneNumber/index.js | 723 ------------ lib/esm/phoneNumber/index.js.map | 1 - lib/types/index.d.ts | 97 -- lib/umd/index.js | 1773 ------------------------------ lib/umd/index.js.map | 1 - lib/umd/index.min.js | 2 - lib/umd/index.min.js.map | 1 - 22 files changed, 7414 deletions(-) delete mode 100644 lib/cjs/index.js delete mode 100644 lib/esm/core/index.d.ts delete mode 100644 lib/esm/core/index.js delete mode 100644 lib/esm/core/index.js.map delete mode 100644 lib/esm/currency/index.d.ts delete mode 100644 lib/esm/currency/index.js delete mode 100644 lib/esm/currency/index.js.map delete mode 100644 lib/esm/dateTime/index.d.ts delete mode 100644 lib/esm/dateTime/index.js delete mode 100644 lib/esm/dateTime/index.js.map delete mode 100644 lib/esm/index.js delete mode 100644 lib/esm/index.js.map delete mode 100644 lib/esm/index.min.js delete mode 100644 lib/esm/index.min.js.map delete mode 100644 lib/esm/phoneNumber/index.d.ts delete mode 100644 lib/esm/phoneNumber/index.js delete mode 100644 lib/esm/phoneNumber/index.js.map delete mode 100644 lib/types/index.d.ts delete mode 100644 lib/umd/index.js delete mode 100644 lib/umd/index.js.map delete mode 100644 lib/umd/index.min.js delete mode 100644 lib/umd/index.min.js.map diff --git a/lib/cjs/index.js b/lib/cjs/index.js deleted file mode 100644 index 0676c76c..00000000 --- a/lib/cjs/index.js +++ /dev/null @@ -1,1766 +0,0 @@ -'use strict'; - -// Custom Error class to extend properties to error object -class I18nifyError extends Error { - constructor(message) { - super(message); - this.name = 'i18nify Error'; - this.timestamp = new Date(); - // more params like type of error/severity can be added in future for better debugging. - } -} -/** - * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block. - * It appends additional attributes and serves as a centralized error-handling service. - * Usage => - * const wrappedUtilityFn = withErrorBoundary(utilityFn) - * - * @param fn utility that is wrapped in error boundary - * @returns {Function} returns the function wrapped in try/catch block - */ -const withErrorBoundary = (fn) => { - return function (...rest) { - try { - return fn.call(this, ...rest); - } - catch (err) { - console.warn('[I18N Error]: ', err); - // Currently, we are throwing the error as it is to consumers. - // In the future, this can be modified as per our requirement, like an error logging service. - throw new I18nifyError(err); - } - }; -}; - -function getDefaultState() { - return { - locale: '', - direction: '', - country: '', - }; -} - -class I18nStateManager { - constructor() { - this.state = getDefaultState(); - } - static getInstance() { - if (!I18nStateManager.instance) { - I18nStateManager.instance = new I18nStateManager(); - } - return I18nStateManager.instance; - } - static resetInstance() { - I18nStateManager.instance = undefined; - } - getState() { - return Object.assign({}, this.state); - } - setState(newState) { - this.state = Object.assign(Object.assign({}, this.state), newState); - } - resetState() { - this.state = getDefaultState(); - } -} -var state = I18nStateManager.getInstance(); - -/** - * function to return active i18n state - * - * ===== USAGE ===== - * import { getState } from '@razorpay/i18nify-js'; - * - * console.log(getState()) - * - * @returns i18n state - */ -const getState = () => { - return state.getState(); -}; -var getState$1 = withErrorBoundary(getState); - -/** - * Function to set and override the active state in i18nify SDK - * - * ===== USAGE ===== - * import { setState } from "@razorpay/i18nify-js"; - * setState({locale: 'en-US'}) - * - * @param newState data to set in i18nState instance - */ -const setState = (newState) => { - state.setState(newState); -}; -var setState$1 = withErrorBoundary(setState); - -/** - * Function to reset the active state in i18nify SDK - * - * ===== USAGE ===== - * import { resetState } from "@razorpay/i18nify-js"; - * resetState() - * - * @param newState data to set in i18nState instance - */ -const resetState = () => { - state.resetState(); -}; -var resetState$1 = withErrorBoundary(resetState); - -const getLocale = () => { - // Check if running in a non-browser environment (e.g., Node.js or older browsers). - if (typeof navigator === 'undefined') { - return 'en-IN'; - } - // Check if the browser supports the Intl object and user language preferences. - if (window.Intl && - typeof window.Intl === 'object' && - (window.navigator.languages || window.navigator.language)) { - const userLocales = window.navigator.languages || [ - window.navigator.language, - ]; - return userLocales[0]; - } - // Fallback to a supported locale or the default locale. - return 'en-IN'; -}; - -const getIntlInstanceWithOptions = (options = {}) => { - /** retrieve locale from below areas in order of preference - * 1. options.locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - let locale = (options === null || options === void 0 ? void 0 : options.locale) || state.getState().locale; - // If a specific locale is provided, use it; otherwise, use the browser's locale - if (!locale) { - locale = getLocale(); - } - const intlOptions = (options === null || options === void 0 ? void 0 : options.intlOptions) ? Object.assign({}, options.intlOptions) : {}; - if ((options === null || options === void 0 ? void 0 : options.currency) || intlOptions.currency) { - intlOptions.style = 'currency'; - intlOptions.currency = (options.currency || intlOptions.currency); - } - if (!locale) - throw new Error('Pass valid locale !'); - return new Intl.NumberFormat(locale || undefined, intlOptions); -}; - -// this function formats number based on different arguments passed -const formatNumber = (amount, options = {}) => { - if (!Number(amount) && Number(amount) !== 0) - throw new Error('Parameter `amount` is not a number!'); - let formattedAmount = ''; - try { - formattedAmount = getIntlInstanceWithOptions(options).format(Number(amount)); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - return formattedAmount; -}; -var formatNumber$1 = withErrorBoundary(formatNumber); - -const CURRENCIES = { - AED: { symbol: 'د.إ', name: 'United Arab Emirates Dirham' }, - ALL: { symbol: 'Lek', name: 'Albanian Lek' }, - AMD: { symbol: '֏', name: 'Armenian Dram' }, - ARS: { symbol: 'ARS', name: 'Argentine Peso' }, - AUD: { symbol: 'A$', name: 'Australian Dollar' }, - AWG: { symbol: 'Afl.', name: 'Aruban Florin' }, - BBD: { symbol: '$', name: 'Barbadian Dollar' }, - BDT: { symbol: '৳', name: 'Bangladeshi Taka' }, - BMD: { symbol: '$', name: 'Bermudian Dollar' }, - BND: { symbol: 'BND', name: 'Brunei Dollar' }, - BOB: { symbol: 'Bs', name: 'Bolivian Boliviano' }, - BSD: { symbol: 'B$', name: 'Bahamian Dollar' }, - BWP: { symbol: 'P', name: 'Botswanan Pula' }, - BZD: { symbol: 'BZ$', name: 'Belize Dollar' }, - CAD: { symbol: 'C$', name: 'Canadian Dollar' }, - CHF: { symbol: 'CHf', name: 'Swiss Franc' }, - CNY: { symbol: '¥', name: 'Chinese Yuan' }, - COP: { symbol: 'COL$', name: 'Colombian Peso' }, - CRC: { symbol: '₡', name: 'Costa Rican Colón' }, - CUP: { symbol: '$MN', name: 'Cuban Peso' }, - CZK: { symbol: 'Kč', name: 'Czech Koruna' }, - DKK: { symbol: 'DKK', name: 'Danish Krone' }, - DOP: { symbol: 'RD$', name: 'Dominican Peso' }, - DZD: { symbol: 'د.ج', name: 'Algerian Dinar' }, - EGP: { symbol: 'E£', name: 'Egyptian Pound' }, - ETB: { symbol: 'ብር', name: 'Ethiopian Birr' }, - EUR: { symbol: '€', name: 'Euro' }, - FJD: { symbol: 'FJ$', name: 'Fijian Dollar' }, - GBP: { symbol: '£', name: 'British Pound' }, - GHS: { symbol: 'GH₵', name: 'Ghanaian Cedi' }, - GIP: { symbol: 'GIP', name: 'Gibraltar Pound' }, - GMD: { symbol: 'D', name: 'Gambian Dalasi' }, - GTQ: { symbol: 'Q', name: 'Guatemalan Quetzal' }, - GYD: { symbol: 'G$', name: 'Guyanese Dollar' }, - HKD: { symbol: 'HK$', name: 'Hong Kong Dollar' }, - HNL: { symbol: 'HNL', name: 'Honduran Lempira' }, - HRK: { symbol: 'kn', name: 'Croatian Kuna' }, - HTG: { symbol: 'G', name: 'Haitian Gourde' }, - HUF: { symbol: 'Ft', name: 'Hungarian Forint' }, - IDR: { symbol: 'Rp', name: 'Indonesian Rupiah' }, - ILS: { symbol: '₪', name: 'Israeli New Shekel' }, - INR: { symbol: '₹', name: 'Indian Rupee' }, - JMD: { symbol: 'J$', name: 'Jamaican Dollar' }, - KES: { symbol: 'Ksh', name: 'Kenyan Shilling' }, - KGS: { symbol: 'Лв', name: 'Kyrgystani Som' }, - KHR: { symbol: '៛', name: 'Cambodian Riel' }, - KYD: { symbol: 'CI$', name: 'Cayman Islands Dollar' }, - KZT: { symbol: '₸', name: 'Kazakhstani Tenge' }, - LAK: { symbol: '₭', name: 'Laotian Kip' }, - LKR: { symbol: 'රු', name: 'Sri Lankan Rupee' }, - LRD: { symbol: 'L$', name: 'Liberian Dollar' }, - LSL: { symbol: 'LSL', name: 'Lesotho Loti' }, - MAD: { symbol: 'د.م.', name: 'Moroccan Dirham' }, - MDL: { symbol: 'MDL', name: 'Moldovan Leu' }, - MKD: { symbol: 'ден', name: 'Macedonian Denar' }, - MMK: { symbol: 'MMK', name: 'Myanmar Kyat' }, - MNT: { symbol: '₮', name: 'Mongolian Tugrik' }, - MOP: { symbol: 'MOP$', name: 'Macanese Pataca' }, - MUR: { symbol: '₨', name: 'Mauritian Rupee' }, - MVR: { symbol: 'Rf', name: 'Maldivian Rufiyaa' }, - MWK: { symbol: 'MK', name: 'Malawian Kwacha' }, - MXN: { symbol: 'Mex$', name: 'Mexican Peso' }, - MYR: { symbol: 'RM', name: 'Malaysian Ringgit' }, - NAD: { symbol: 'N$', name: 'Namibian Dollar' }, - NGN: { symbol: '₦', name: 'Nigerian Naira' }, - NIO: { symbol: 'NIO', name: 'Nicaraguan Córdoba' }, - NOK: { symbol: 'NOK', name: 'Norwegian Krone' }, - NPR: { symbol: 'रू', name: 'Nepalese Rupee' }, - NZD: { symbol: 'NZ$', name: 'New Zealand Dollar' }, - PEN: { symbol: 'S/', name: 'Peruvian Nuevo Sol' }, - PGK: { symbol: 'PGK', name: 'Papua New Guinean Kina' }, - PHP: { symbol: '₱', name: 'Philippine Peso' }, - PKR: { symbol: '₨', name: 'Pakistani Rupee' }, - QAR: { symbol: 'QR', name: 'Qatari Riyal' }, - RUB: { symbol: '₽', name: 'Russian Ruble' }, - SAR: { symbol: 'SR', name: 'Saudi Riyal' }, - SCR: { symbol: 'SRe', name: 'Seychellois Rupee' }, - SEK: { symbol: 'SEK', name: 'Swedish Krona' }, - SGD: { symbol: 'S$', name: 'Singapore Dollar' }, - SLL: { symbol: 'Le', name: 'Sierra Leonean Leone' }, - SOS: { symbol: 'Sh.so.', name: 'Somali Shilling' }, - SSP: { symbol: 'SS£', name: 'South Sudanese Pound' }, - SVC: { symbol: '₡', name: 'Salvadoran Colón' }, - SZL: { symbol: 'E', name: 'Swazi Lilangeni' }, - THB: { symbol: '฿', name: 'Thai Baht' }, - TTD: { symbol: 'TT$', name: 'Trinidad and Tobago Dollar' }, - TZS: { symbol: 'Sh', name: 'Tanzanian Shilling' }, - USD: { symbol: '$', name: 'United States Dollar' }, - UYU: { symbol: '$U', name: 'Uruguayan Peso' }, - UZS: { symbol: "so'm", name: 'Uzbekistani Som' }, - YER: { symbol: '﷼', name: 'Yemeni Rial' }, - ZAR: { symbol: 'R', name: 'South African Rand' }, - KWD: { symbol: 'د.ك', name: 'Kuwaiti Dinar' }, - BHD: { symbol: 'د.ب.', name: 'Bahraini Dinar' }, - OMR: { symbol: 'ر.ع.', name: 'Omani Rial' }, -}; - -const getCurrencyList = () => { - return CURRENCIES; -}; -var getCurrencyList$1 = withErrorBoundary(getCurrencyList); - -const getCurrencySymbol = (currencyCode) => { - var _a; - if (currencyCode in CURRENCIES) - return (_a = CURRENCIES[currencyCode]) === null || _a === void 0 ? void 0 : _a.symbol; - else - throw new Error('Invalid currencyCode!'); -}; -var getCurrencySymbol$1 = withErrorBoundary(getCurrencySymbol); - -const ALLOWED_FORMAT_PARTS_KEYS = [ - 'nan', - 'infinity', - 'percent', - 'integer', - 'group', - 'decimal', - 'fraction', - 'plusSign', - 'minusSign', - 'percentSign', - 'currency', - 'code', - 'symbol', - 'name', - 'compact', - 'exponentInteger', - 'exponentMinusSign', - 'exponentSeparator', - 'unit', -]; - -const formatNumberByParts = (amount, options = {}) => { - if (!Number(amount) && Number(amount) !== 0) - throw new Error('Parameter `amount` is not a number!'); - try { - const formattedAmount = getIntlInstanceWithOptions(options).formatToParts(Number(amount)); - const parts = formattedAmount; - const formattedObj = {}; - parts.forEach((p) => { - if (p.type === 'group') { - formattedObj.integer = (formattedObj.integer || '') + p.value; - } - else if (ALLOWED_FORMAT_PARTS_KEYS.findIndex((item) => item === p.type) != -1) { - // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal' is skipped - formattedObj[p.type] = (formattedObj[p.type] || '') + p.value; - } - }); - return Object.assign(Object.assign({}, formattedObj), { isPrefixSymbol: parts[0].type === 'currency', rawParts: parts }); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } -}; -var formatNumberByParts$1 = withErrorBoundary(formatNumberByParts); - -const PHONE_REGEX_MAPPER = { - IN: /^(?:(?:\+|0{0,2})91\s*[-]?\s*|[0]?)?[6789]\d{9}$/, - MY: /^(\+?6?0)?(\d{1,3})[-. ]?(\d{7,8})$/, - AE: /^(?:\+?971|0)?(?:2|3|4|6|7|9)\d{8}$/, - AL: /^(?:\+?355)?(?:[4-9]\d{7}|6\d{8})$/, - AM: /^(?:\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/, - AR: /^(?:(?:\+|0{0,2})54)?(?:11|[2368]\d)(?:(?=\d{0,2}15)\d{2})??\d{8}$/, - AU: /^(?:\+?61|0)4\d{8}$/, - AW: /^(?:(?:\+297)?(?!0)\d{7})$/, - BB: /^(?:(?:\+1)?246)?(?:\d{3})?\d{7}$/, - BD: /^(?:\+?880|0)1[13456789]\d{8}$/, - BM: /^(?:(?:\+1)?441)?(?:\d{2})?\d{7}$/, - BN: /^(?:\+?673)?(?:\d{3})?\d{4}$/, - BO: /^(?:(?:\+|0{0,2})591)?(?:(?:2|3|7|6)\d{7})$/, - BS: /^(?:(?:\+1)?242)?(?:\d{3})?\d{7}$/, - BW: /^(?:(?:\+267)?\s?)?[74]\d{7}$/, - BZ: /^(?:(?:\+501)?\s?)?[622]\d{4}$/, - CH: /^(?:(?:\+41|0)(?:\s*\(?0\)?\s*))?(?:\d{2}\s*)?\d{3}\s*\d{2}\s*\d{2}$/, - CN: /^(?:(?:\+|00)86)?1\d{10}$/, - CO: /^(?:(?:\+57|0057)?)?[1-8]{1}\d{6,7}$/, - OM: /^(?:\+?968)?(?:95|96|97|98)\d{6}$/, - CR: /^(?:(?:\+506)?\s*|0)?[1-9]\d{7}$/, - CU: /^(?:\+?53)?(?:[5-8]\d{7})$/, - CZ: /^(?:\+?420)?(?:\d{9})$/, - DK: /^(?:\+?45)?(?:\d{8})$/, - DO: /^(?:(?:\+1)?809|1-8(?:00|88|89))(?:\d{7})$/, - DZ: /^(?:\+?213|0)([567]\d{8})$/, - EG: /^(?:(?:\+20|20)?(\d{10}))$/, - ET: /^(?:\+?251)?[1-59]\d{8}$/, - EU: /^(?:(?:\+?3)?8)?\s*(?:\d{3}\s*){3}\d{2}$/, - FJ: /^(?:(?:\+?679)?\s?\d{3}\s?\d{4})?$/, - GB: /^(?:(?:\+44\s?|0)7\d{3}(\s?\d{4,})?)$/, - GH: /^(?:(?:\+233)|0)?(?:\d{9})$/, - GI: /^(?:\+350)?\d{5}$/, - GM: /^(?:\+220)?\d{5,7}$/, - GT: /^(?:\+502)?[2468]\d{7,8}$/, - GY: /^(?:(?:\+592)?(?:(?:\s)?[2-9])(?:(?:\s)?\d))?(?:(?:\s)?\d{4})$/, - HK: /^(?:\+852\s?)?[456789]\d{3}\s?\d{4}$/, - HN: /^(?:\+504)?[89]\d{7}$/, - HR: /^(?:\+?385)?\d{8,9}$/, - HT: /^(?:\+?509)?\d{8}$/, - HU: /^(?:(?:\+36))(\s?\d{2}\s?\d{3}\s?\d{4})$/, - ID: /^(?:\+?62|0[1-9])[\s-]?\d{2,4}[\s-]?\d{3,4}[\s-]?\d{3,4}$/, - IL: /^(?:(?:\+972|0)(?:-)?)[23489]\d{7}$/, - JM: /^(?:(?:\+1876))\d{7,10}$/, - KE: /^(?:(?:\+254)|(?:0))(?:\d{6,7})$/, - KG: /^(?:\+996)?\s?\d{9}$/, - KH: /^(?:(?:\+855)|(?:0))(?:\s?[1-9]\d{7,8})$/, - KY: /^(?:\+?1\s?(345))\d{6}$/, - KZ: /^(?:\+?7|8)?7\d{9}$/, - LA: /^(?:(?:\+?856)|0)(20\d{7,9})$/, - LK: /^(?:(?:\+94)|0)(?:\d{9})$/, - LR: /^(?:\+231)[ -\d]{4}[ -\d]{4}$/, - LS: /^(?:(?:\+?266)|0)?[56]\d{7}$/, - MA: /^(?:(?:\+?212(\s*[-|\s*]?\d{1,9})?)|(?:0))(?:\d{9})$/, - MD: /^(?:(?:\+373)|(?:0))(?:\d{7,8})$/, - MK: /^(?:\+389|0)(?:(?:2[0-4]|[3-9])\s?)?\d{6}$/, - MM: /^(?:(?:\+?95)|0)?[1-9]\d{9}$/, - MN: /^(?:\+976|0)\d{8}$/, - MO: /^(?:(?:\+?853)|[0-9])?\d{8}$/, - MU: /^(?:\+230|0)?\d{8}$/, - MV: /^(?:(?:\+?960)|0)?\d{7}$/, - MW: /^(?:\+265)[1-9]\d{6}$/, - MX: /^(?:(?:\+?52)?\s?(?:1|01)?\s?)?(?:\d{3}\s?\d{3}\s?\d{4})$/, - NA: /^(?:(?:\+264)|0)?\d{8}$/, - NG: /^(?:(?:\+234)|(?:0))(?:\d{7,8})$/, - NI: /^(?:(?:\+505))?(?:\d{8})$/, - NO: /^(?:(?:\+?47)|\d{2}|\d{3})\s?\d{2}\s?\d{3}$/, - NP: /^(?:(?:\+977))?(\d{9,10})$/, - NZ: /^(?:\+?64|0)(\d{2,5} \d{4,8}|\d{3,4} \d{4})$/, - PE: /^(?:(?:\+51)|0)?(?:9\d{8})$/, - PG: /^(?:\+?675)?(?:[7-9]\d{7})$/, - PH: /^(?:(?:\+?63)|0)(?:\d{10})$/, - PK: /^(?:(?:\+92)|0)?[345]\d{9}$/, - QA: /^(?:\+?974)?-?33\d{5}$/, - RU: /^(?:\+?7|8)?[ -]?\(?9\d{2}\)?[ -]?\d{3}[ -]?\d{2}[ -]?\d{2}$/, - SA: /^(?:\+?966)?\s?1?[\s-]?(?:[45]\d{2}|5\d{3})[\s-]?\d{4}$/, - SC: /^(?:(?:\+248)|\d{4})\d{5}$/, - SE: /^(?:\+?46|0)\s?[1-57-9](?:[0-9]\s?){8}$/, - SG: /^(?:(?:\+65)|(?:\(\+65\))|(?:65))\d{4}\d{4}$/, - SL: /^(?:(?:\+232)|(?:0))?\d{9}$/, - SO: /^(?:\+252|0)?[567]\d{7}$/, - SS: /^(?:\+211|0)?[1-9]\d{7,9}$/, - SV: /^(?:(?:\+?503)|(?:0))(?:\d{8})$/, - SZ: /^(?:\+?268)?\d{7,8}$/, - TH: /^(?:(?:\+66)|0)\d{9}$/, - TT: /^(?:(?:\+?1-868)|\(?868\)?)(\d{7})$/, - TZ: /^(?:(?:\+?255)|0)?[67]\d{8}$/, - US: /^(\+\d{1,2}\s?)?([2-9]{1}\d{2}[2-9]{1}\d{6})$/, - CA: /^(\+\d{1,2}\s?)?([2-9]{1}\d{2}[2-9]{1}\d{6})$/, - UY: /^(?:(?:\+598|0)\s?(9\d{3}|2\d{2}|[4-9]\d{6}))$/, - UZ: /^(?:\+?998)?\s?[3456789]\d{8}$/, - YE: /^(?:\+?967)?(?:\d{7,8})$/, - ZA: /^(?:(?:\+27)|0)(\d{9})$/, - KW: /^(?:\+?965)[569]\d{7}$/, - BH: /^(?:\+?973)?[356]\d{7}$/, - TL: /^(?:(?:\+670)\s?)?[0-9]{3}\s?[0-9]{3,4}$/, - VC: /^(?:(?:\+1)?784)?(?:\d{3})?\d{7}$/, - VE: /^(?:(?:\+58)|0)?4\d{9}$/, - VN: /^(?:(?:\+84)|0)?[1-9]\d{8}$/, - ZM: /^(?:(?:\+260)|0)?[123456789]\d{8,9}$/, - ZW: /^(?:(?:\+263)|0)?(?:\d{9,10})$/, - LT: /^(?:(?:\+370)|8)\d{8}$/, - LU: /^(?:(?:\+352)?(6|2(6|7|8|9))\d{6})$/, - LV: /^(?:(?:\+371)?2\d{7})$/, - ME: /^(?:(?:\+382)?[67]\d{7,20})$/, - MG: /^(?:(?:\+261)?3[234568]\d{7})$/, - MZ: /^(?:(?:\+258)|(?:258))?8[234567]\d{7,8}$/, - NL: /^(?:(?:\+31)|0(6(?:\d{8})|[1-9](?:(?:\d{8})|(?:\s\d{3}\s\d{4}))|(?:\d{8})))$/, - PA: /^(?:(?:\+507)\s?)?[46]\d{6,7}$/, - PL: /^(?:(?:\+48)?(?:\s?\d{3}\s?\d{3}\s?\d{3}|(?:\d{2}\s?){4}\d{2}|\d{3}-\d{3}-\d{3}))$/, - PR: /^(?:(?:\+1)?787|939)\d{7}$/, - PS: /^(?:(?:\+970))(5[2349])\d{7}$/, - PT: /^(?:(?:\+351)?9(1\d|2[1-9]|6[12345789]|7[12345789])\d{7})$/, - PY: /^(?:(?:\+595|0)9[9876]\d{7})$/, - RO: /^(?:(?:\+40|0))(?:7[2-8]\d{7}|21\d{8})$/, - RS: /^(?:(?:\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/, - RW: /^(?:(?:\+250)|(0))\d{9}$/, - SI: /^(?:(?:\+386)|0)?[1-59]\d{7,8}$/, - SK: /^(?:(?:\+421))?(0|9[0-8])\d{8}$/, - SM: /^(?:(?:\+378)|(0549|6\d{4}))\d{5}$/, - SN: /^(?:(?:\+221)|0)?[3679]\d{7}$/, - SR: /^(?:(?:\+597))\d{7}$/, - TG: /^(?:(?:\+228))\d{8}$/, - TJ: /^(?:(?:\+992))(37|55|77)\d{7}$/, - TN: /^(?:(?:\+216)|22|9[1-9])\d{7}$/, - TR: /^(?:(?:\+90)|(0))\s?5\d{9}$/, - TW: /^(?:(?:\+886)|0)?9\d{8}$/, - UA: /^(?:(?:\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\d{7}$/, - UG: /^(?:(?:\+256)|0)?[39]\d{8}$/, -}; - -/* Source: Google LibPhoneNumber Metadata: https://github.com/google/libphonenumber/blob/master/javascript/i18n/phonenumbers/metadata.js */ -const DIAL_CODE_MAPPER = { - 1: [ - 'US', - 'AG', - 'AI', - 'AS', - 'BB', - 'BM', - 'BS', - 'CA', - 'DM', - 'DO', - 'GD', - 'GU', - 'JM', - 'KN', - 'KY', - 'LC', - 'MP', - 'MS', - 'PR', - 'SX', - 'TC', - 'TT', - 'VC', - 'VG', - 'VI', - ], - 7: ['RU', 'KZ'], - 20: ['EG'], - 27: ['ZA'], - 30: ['GR'], - 31: ['NL'], - 32: ['BE'], - 33: ['FR'], - 34: ['ES'], - 36: ['HU'], - 39: ['IT', 'VA'], - 40: ['RO'], - 41: ['CH'], - 43: ['AT'], - 44: ['GB', 'GG', 'IM', 'JE'], - 45: ['DK'], - 46: ['SE'], - 47: ['NO', 'SJ'], - 48: ['PL'], - 49: ['DE'], - 51: ['PE'], - 52: ['MX'], - 53: ['CU'], - 54: ['AR'], - 55: ['BR'], - 56: ['CL'], - 57: ['CO'], - 58: ['VE'], - 60: ['MY'], - 61: ['AU', 'CC', 'CX'], - 62: ['ID'], - 63: ['PH'], - 64: ['NZ'], - 65: ['SG'], - 66: ['TH'], - 81: ['JP'], - 82: ['KR'], - 84: ['VN'], - 86: ['CN'], - 90: ['TR'], - 91: ['IN'], - 92: ['PK'], - 93: ['AF'], - 94: ['LK'], - 95: ['MM'], - 98: ['IR'], - 211: ['SS'], - 212: ['MA', 'EH'], - 213: ['DZ'], - 216: ['TN'], - 218: ['LY'], - 220: ['GM'], - 221: ['SN'], - 222: ['MR'], - 223: ['ML'], - 224: ['GN'], - 225: ['CI'], - 226: ['BF'], - 227: ['NE'], - 228: ['TG'], - 229: ['BJ'], - 230: ['MU'], - 231: ['LR'], - 232: ['SL'], - 233: ['GH'], - 234: ['NG'], - 235: ['TD'], - 236: ['CF'], - 237: ['CM'], - 238: ['CV'], - 239: ['ST'], - 240: ['GQ'], - 241: ['GA'], - 242: ['CG'], - 243: ['CD'], - 244: ['AO'], - 245: ['GW'], - 246: ['IO'], - 247: ['AC'], - 248: ['SC'], - 249: ['SD'], - 250: ['RW'], - 251: ['ET'], - 252: ['SO'], - 253: ['DJ'], - 254: ['KE'], - 255: ['TZ'], - 256: ['UG'], - 257: ['BI'], - 258: ['MZ'], - 260: ['ZM'], - 261: ['MG'], - 262: ['RE', 'YT'], - 263: ['ZW'], - 264: ['NA'], - 265: ['MW'], - 266: ['LS'], - 267: ['BW'], - 268: ['SZ'], - 269: ['KM'], - 290: ['SH', 'TA'], - 291: ['ER'], - 297: ['AW'], - 298: ['FO'], - 299: ['GL'], - 350: ['GI'], - 351: ['PT'], - 352: ['LU'], - 353: ['IE'], - 354: ['IS'], - 355: ['AL'], - 356: ['MT'], - 357: ['CY'], - 358: ['FI', 'AX'], - 359: ['BG'], - 370: ['LT'], - 371: ['LV'], - 372: ['EE'], - 373: ['MD'], - 374: ['AM'], - 375: ['BY'], - 376: ['AD'], - 377: ['MC'], - 378: ['SM'], - 380: ['UA'], - 381: ['RS'], - 382: ['ME'], - 383: ['XK'], - 385: ['HR'], - 386: ['SI'], - 387: ['BA'], - 389: ['MK'], - 420: ['CZ'], - 421: ['SK'], - 423: ['LI'], - 500: ['FK'], - 501: ['BZ'], - 502: ['GT'], - 503: ['SV'], - 504: ['HN'], - 505: ['NI'], - 506: ['CR'], - 507: ['PA'], - 508: ['PM'], - 509: ['HT'], - 590: ['GP', 'BL', 'MF'], - 591: ['BO'], - 592: ['GY'], - 593: ['EC'], - 594: ['GF'], - 595: ['PY'], - 596: ['MQ'], - 597: ['SR'], - 598: ['UY'], - 599: ['CW', 'BQ'], - 670: ['TL'], - 672: ['NF'], - 673: ['BN'], - 674: ['NR'], - 675: ['PG'], - 676: ['TO'], - 677: ['SB'], - 678: ['VU'], - 679: ['FJ'], - 680: ['PW'], - 681: ['WF'], - 682: ['CK'], - 683: ['NU'], - 685: ['WS'], - 686: ['KI'], - 687: ['NC'], - 688: ['TV'], - 689: ['PF'], - 690: ['TK'], - 691: ['FM'], - 692: ['MH'], - 800: ['001'], - 808: ['001'], - 850: ['KP'], - 852: ['HK'], - 853: ['MO'], - 855: ['KH'], - 856: ['LA'], - 870: ['001'], - 878: ['001'], - 880: ['BD'], - 881: ['001'], - 882: ['001'], - 883: ['001'], - 886: ['TW'], - 888: ['001'], - 960: ['MV'], - 961: ['LB'], - 962: ['JO'], - 963: ['SY'], - 964: ['IQ'], - 965: ['KW'], - 966: ['SA'], - 967: ['YE'], - 968: ['OM'], - 970: ['PS'], - 971: ['AE'], - 972: ['IL'], - 973: ['BH'], - 974: ['QA'], - 975: ['BT'], - 976: ['MN'], - 977: ['NP'], - 979: ['001'], - 992: ['TJ'], - 993: ['TM'], - 994: ['AZ'], - 995: ['GE'], - 996: ['KG'], - 998: ['UZ'], -}; - -/** - * Determines the country code based on the provided phone number. - * This function employs a multi-step approach to identify the country code: - * - If the phone number starts with '+', it extracts the numeric characters - * and matches the leading digits with known dial codes mapped to countries. - * - For matched dial codes, it further filters based on country-specific regex patterns - * to validate the phone number format for those countries. - * - If the phone number doesn't start with '+', it directly matches the number - * against regular expressions associated with various countries to identify the code. - * - * @param phoneNumber The input phone number (string or number). - * @returns The detected country code or an empty string if not found. - */ -const detectCountryCodeFromDialCode = (phoneNumber) => { - // If the phone number starts with '+', extract numeric characters - if (phoneNumber.toString().charAt(0) === '+') { - const cleanedPhoneNumberWithoutPlusPrefix = phoneNumber - .toString() - .replace(/\D/g, ''); - const matchingCountries = []; - // Iterate through dial codes and check for matches with cleaned phone number - for (const code in DIAL_CODE_MAPPER) { - if (cleanedPhoneNumberWithoutPlusPrefix.startsWith(code)) { - matchingCountries.push(...DIAL_CODE_MAPPER[code]); - } - } - // Filter matching countries based on phone number validation regex - const matchedCountryCode = matchingCountries.find((countryCode) => { - const regex = PHONE_REGEX_MAPPER[countryCode]; - if (regex && regex.test(phoneNumber.toString())) - return countryCode; - return undefined; - }); - // Return the first matched country code, if any - return matchedCountryCode || ''; - } - else { - // If phone number doesn't start with '+', directly match against country regexes - for (const countryCode in PHONE_REGEX_MAPPER) { - const regex = PHONE_REGEX_MAPPER[countryCode]; - if (regex.test(phoneNumber.toString())) { - return countryCode; - } - } - } - // Return empty string if no country code is detected - return ''; -}; -const cleanPhoneNumber = (phoneNumber) => { - // Regular expression to match all characters except numbers and + sign at the start - const regex = /[^0-9+]|(?!A)\+/g; - // Replace matched characters with an empty string - const cleanedPhoneNumber = phoneNumber.replace(regex, ''); - return phoneNumber[0] === '+' ? `+${cleanedPhoneNumber}` : cleanedPhoneNumber; -}; - -// Validates whether a given phone number is valid based on the provided country code or auto-detects the country code and checks if the number matches the defined regex pattern for that country. -const isValidPhoneNumber = (phoneNumber, countryCode) => { - // Clean the provided phoneNumber by removing non-numeric characters - const cleanedPhoneNumber = cleanPhoneNumber(phoneNumber.toString()); - // Detect or validate the country code - countryCode = - countryCode && countryCode in PHONE_REGEX_MAPPER - ? countryCode - : detectCountryCodeFromDialCode(cleanedPhoneNumber); - // Return false if phoneNumber is empty - if (!phoneNumber) - return false; - // Check if the countryCode exists in the PHONE_REGEX_MAPPER - if (countryCode in PHONE_REGEX_MAPPER) { - // Fetch the regex pattern for the countryCode - const regex = PHONE_REGEX_MAPPER[countryCode]; - // Test if the cleanedPhoneNumber matches the regex pattern - return regex.test(cleanedPhoneNumber); - } - // Return false if the countryCode is not supported - return false; -}; -var isValidPhoneNumber$1 = withErrorBoundary(isValidPhoneNumber); - -const PHONE_FORMATTER_MAPPER = { - IN: 'xxxx xxxxxx', - MY: 'xx xxxxx xx', - AE: 'xx xxx xxxx', - AL: 'xxx xx xxxx', - AM: 'xx xx xx xx', - AR: 'xxxx-xxxx', - AU: 'xxx xxx xxx', - AW: 'xxx-xxxx', - BB: 'xxx-xxxx', - BD: 'xxxx-xxxxxx', - BM: 'xxx-xxxx', - BN: 'xxxx-xxxx', - BO: 'xxxx-xxxx', - BS: 'xxx-xxxx', - BW: 'xx xxxx xxxx', - BZ: 'xxx-xxxx', - CA: 'xxx-xxx-xxxx', - CH: 'xxx xxx xxx', - CN: 'xxxx-xxxxxxx', - CO: 'xxxx-xxxxxxx', - CR: 'xxxx-xxxx', - CU: 'xxxx-xxxx', - CZ: 'xxx xxx xxx', - DK: 'xx xx xx xx', - DO: 'xxx-xxxxxxx', - DZ: 'xxxx-xxxx-xxx', - EG: 'xx xxx xxxx', - ET: 'xx xxx xxxx', - EU: 'xxx xx xx xx', - FJ: 'xxxx xxxx', - GB: 'xxxx xxx xxx', - GH: 'xxx xxx xxxx', - GI: 'xxxx xxxx', - GM: 'xxxx-xxxx', - GT: 'xxxx-xxxx', - GY: 'xxx-xxxx', - HK: 'xxxx xxxx', - HN: 'xxxx-xxxx', - HR: 'xxx xxx xxxx', - HT: 'xxx-xxxx', - HU: 'xxx xxx xxxx', - ID: 'xxxx-xxxx-xxxx', - IL: 'xxxx-xxx-xxx', - JM: 'xxx-xxxx', - KE: 'xxx xxxxxx', - KG: 'xxx-xx-xx-xx', - KH: 'xxx-xxx-xxx', - KY: 'xxx-xxxx', - KZ: 'xxx-xxx-xx-xx', - LA: 'xxx xx xxxx', - LK: 'xx xxx xxxx', - LR: 'xxx-xxx-xxxx', - LS: 'xxx xx xxxx', - LT: 'xxx xxxxx', - LU: 'xxx xx xxx', - LV: 'xxxx xxxx', - MA: 'xxxx-xxxxxx', - MD: 'xx xxxxxx', - ME: 'xx xxxxxx', - MG: 'xx xx xx xx xx', - MK: 'xx xx xx xx', - MM: 'xx xxxxxx', - MN: 'xxx-xx-xxxx', - MO: 'xxxx xxxx', - MU: 'xx xxxx xxxx', - MV: 'xxxxxx', - MW: 'xx xxxx xxxx', - MX: 'xxx-xxx-xxxx', - MZ: 'xx xxxxxxx', - NA: 'xx xxxx xxxx', - NG: 'xxx xxx xxxx', - NI: 'xxxx-xxxx', - NL: 'xxx-xxxxxxx', - NO: 'xxxx xxxx', - NP: 'xxxx-xxxxxxx', - NZ: 'xxx-xxxxxxx', - OM: 'xxxx-xxxx', - PA: 'xxx-xxxx', - PE: 'xxx-xxx-xxx', - PG: 'xxx-xxxxxx', - PH: 'xxx-xxxx', - PK: 'xxx-xxxxxxx', - PL: 'xxx xxx xxx', - PR: 'xxx-xxx-xxxx', - PS: 'xxxx-xxxxxxx', - PT: 'xxx xxx xxx', - PY: 'xxx-xxxxxx', - QA: 'xxxx xxxx', - RO: 'xxx xxx xxxx', - RS: 'xxx xxxxx', - RU: 'xxx xxx-xx-xx', - RW: 'xxx xxxxxx', - SA: 'xxx-xxxxxxx', - SC: 'xx xxxxx', - SE: 'xxx-xxx xx xx', - SG: 'xxxx xxxx', - SI: 'xx xxxxxx', - SK: 'xxx xxx xxx', - SL: 'xxx-xxxxxx', - SM: 'xxxxx xxxxx', - SN: 'xx xxx xx xx', - SO: 'xxx xxxxxxx', - SR: 'xxx-xxxx', - SS: 'xxx xxxx xxx', - SV: 'xxxx-xxxx', - SZ: 'xxx xx xxxx', - TG: 'xx xx xx xx', - TH: 'xxx-xxxxxxx', - TJ: 'xxx xx xx xx', - TL: 'xxx-xxxxxxx', - TN: 'xx xxxxxx', - TR: 'xxx xxx xx xx', - TT: 'xxx-xxxx', - TW: 'xxxx-xxxxxx', - TZ: 'xxx xxx xxxx', - UA: 'xx xxx xx xx', - UG: 'xxx xxxxxxx', - US: 'xxx-xxx-xxxx', - UY: 'xxx-xxxxx', - UZ: 'xxx-xxx-xx-xx', - VC: 'xxx-xxxx', - VE: 'xxxx-xxx-xxxx', - VN: 'xxxx-xxxxxxx', - YE: 'xxxx-xxxx', - ZA: 'xxx-xxx-xxxx', - ZM: 'xxx-xxxxxxx', - ZW: 'xx xxx xxxx', - KW: 'xxx xx xxxx', - BH: 'xxxx xxxx', -}; - -// Formats a provided phone number according to the predefined format for a specific country code, or auto-detects the country code and formats the number accordingly. -const formatPhoneNumber = (phoneNumber, countryCode) => { - // Throw errors if phoneNumber is invalid - if (!phoneNumber) - throw new Error('Parameter `phoneNumber` is invalid!'); - // Convert phoneNumber to string and clean it by removing non-numeric characters - phoneNumber = phoneNumber.toString(); - phoneNumber = cleanPhoneNumber(phoneNumber); - // Detect or validate the country code - countryCode = - countryCode && countryCode in PHONE_FORMATTER_MAPPER - ? countryCode - : detectCountryCodeFromDialCode(phoneNumber); - // Fetch the pattern for the countryCode from the PHONE_FORMATTER_MAPPER - const pattern = PHONE_FORMATTER_MAPPER[countryCode]; - if (!pattern) - return phoneNumber; - // Count the number of 'x' characters in the format pattern - let charCountInFormatterPattern = 0; - for (let i = 0; i < pattern.length; i++) { - if (pattern[i] === 'x') { - charCountInFormatterPattern++; - } - } - // Calculate the difference between phoneNumber length and 'x' characters count in pattern - const diff = phoneNumber.length - charCountInFormatterPattern; - // Extract the phoneNumber without the prefix - const phoneNumberWithoutPrefix = phoneNumber.slice(diff); - const formattedNumber = []; - let numberIndex = 0; - // Loop through the pattern to format the phoneNumber - for (let i = 0; i < pattern.length; i++) { - const patternChar = pattern[i]; - if (patternChar === 'x') { - // Insert phoneNumber digits at 'x' positions - if (numberIndex < phoneNumberWithoutPrefix.length) { - formattedNumber.push(phoneNumberWithoutPrefix[numberIndex]); - numberIndex++; - } - } - else { - // Insert non-digit characters from the pattern - formattedNumber.push(patternChar); - } - } - // Join the formattedNumber array to create the formattedPhoneNumber without prefix - const formattedPhoneNumberWithoutPrefix = formattedNumber.join(''); - // Combine the prefix and formattedPhoneNumberWithoutPrefix - const formattedPhoneNumberWithPrefix = phoneNumber.slice(0, diff) + ' ' + formattedPhoneNumberWithoutPrefix; - // Return the formattedPhoneNumber with prefix after trimming whitespace - return formattedPhoneNumberWithPrefix.trim(); -}; -var formatPhoneNumber$1 = withErrorBoundary(formatPhoneNumber); - -// Parses a given phone number, identifies its country code (if not provided), and returns an object with details including the country code, formatted phone number, dial code, and format template. -const parsePhoneNumber = (phoneNumber, country) => { - // Throw errors if phoneNumber is invalid - if (!phoneNumber) - throw new Error('Parameter `phoneNumber` is invalid!'); - // Clean the phoneNumber by removing non-numeric characters - phoneNumber = phoneNumber.toString(); - phoneNumber = cleanPhoneNumber(phoneNumber); - // Detect or validate the country code - const countryCode = country && country in PHONE_FORMATTER_MAPPER - ? country - : detectCountryCodeFromDialCode(phoneNumber); - // Format the phone number using the detected/validated country code - const formattedPhoneNumber = formatPhoneNumber$1(phoneNumber, countryCode); - // Fetch the pattern associated with the countryCode from the PHONE_FORMATTER_MAPPER - const pattern = PHONE_FORMATTER_MAPPER[countryCode]; - if (!pattern) - return { - countryCode: countryCode || '', - dialCode: '', - formattedPhoneNumber: phoneNumber, - formatTemplate: '', - }; - // Count the number of 'x' characters in the format pattern - let charCountInFormatterPattern = 0; - for (let i = 0; i < pattern.length; i++) { - if (pattern[i] === 'x') { - charCountInFormatterPattern++; - } - } - // Calculate the difference between phoneNumber length and 'x' characters count in pattern - const diff = phoneNumber.length - charCountInFormatterPattern; - // Extract the dialCode from the phoneNumber - const dialCode = phoneNumber.slice(0, diff); - // Obtain the format template associated with the countryCode - const formatTemplate = PHONE_FORMATTER_MAPPER[countryCode]; - // Return the parsed phone number information - return { - countryCode, - formattedPhoneNumber, - dialCode, - formatTemplate, - }; -}; -var parsePhoneNumber$1 = withErrorBoundary(parsePhoneNumber); - -const stringToDate = (dateString) => { - const supportedDateFormats = [ - // Date formats - { - regex: /^(\d{4})\/(\d{2})\/(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, - { - regex: /^(\d{2})\/(\d{2})\/(\d{4})$/, - yearIndex: 3, - monthIndex: 2, - dayIndex: 1, - }, - { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, - { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, - { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, - { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, - { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, - { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, - // Timestamp formats - { - regex: /^(\d{4})\/(\d{2})\/(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, - { - regex: /^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 3, - monthIndex: 2, - dayIndex: 1, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, - { - regex: /^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, - { - regex: /^(\d{2})-(\d{2})-(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 3, - monthIndex: 2, - dayIndex: 1, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, - { - regex: /^(\d{4})\.(\d{2})\.(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, - { - regex: /^(\d{2})\.(\d{2})\.(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 3, - monthIndex: 2, - dayIndex: 1, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, // DD.MM.YYYY HH:MM:SS - ]; - for (const format of supportedDateFormats) { - const match = dateString.match(format.regex); - if (match) { - const year = match[format.yearIndex]; - const month = match[format.monthIndex]; - const day = match[format.dayIndex]; - const hour = format.hourIndex ? match[format.hourIndex] : '00'; - const minute = format.minuteIndex ? match[format.minuteIndex] : '00'; - const second = format.secondIndex ? match[format.secondIndex] : '00'; - return new Date(`${year}-${month}-${day}T${hour}:${minute}:${second}`); - } - } - throw new Error('Date format not recognized'); -}; - -/** - * Adds a specified amount of time to a date. - * - * @param date The original date. - * @param value The amount to add. - * @param unit The unit of time to add (e.g., 'days', 'months', 'years'). - * @returns A new Date object with the time added. - */ -const add = (date, value, unit) => { - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - switch (unit) { - case 'days': - date.setDate(date.getDate() + value); - break; - case 'months': - date.setMonth(date.getMonth() + value); - break; - case 'years': - date.setFullYear(date.getFullYear() + value); - break; - } - return date; -}; -var add$1 = withErrorBoundary(add); - -/** - * Formats date and time based on the locale. - * @param {DateInput} date - Date object or date string. - * @param {Locale} locale - Locale string. - * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional). - * @returns {string} Formatted date and time string. - */ -const formatDateTime = (date, locale, intlOptions = {}) => { - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) - locale = state.getState().locale || getLocale(); - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - const dateObj = date instanceof Date ? date : new Date(date); - let formatter; - try { - formatter = new Intl.DateTimeFormat(locale, intlOptions); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - return formatter.format(dateObj); -}; -var formatDateTime$1 = withErrorBoundary(formatDateTime); - -/** - * Formats date based on the locale. - * @param {DateInput} date - Date object or date string. - * @param {Locale} locale - Locale string. - * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional). - * @returns {string} Formatted date string. - */ -const formatDate = (date, locale, options = {}) => { - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) - locale = state.getState().locale || getLocale(); - const fullOptions = Object.assign(Object.assign({}, options), { timeStyle: undefined }); - let formattedDate; - try { - formattedDate = formatDateTime$1(date, locale, fullOptions); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - return formattedDate; -}; -var formatDate$1 = withErrorBoundary(formatDate); - -/** - * Formats time based on the locale. - * @param {DateInput} date - Date object or date string. - * @param {Locale} locale - Locale string. - * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional). - * @returns {string} Formatted time string. - */ -const formatTime = (date, locale, options = {}) => { - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) - locale = state.getState().locale || getLocale(); - const fullOptions = Object.assign(Object.assign({}, options), { dateStyle: undefined }); - let formattedTime; - try { - formattedTime = formatDateTime$1(date, locale, fullOptions); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - return formattedTime; -}; -var formatTime$1 = withErrorBoundary(formatTime); - -/** - * Gets the first day of the week for a given locale. - * - * @param locale The locale to determine the first day of the week for. - * @param intlOptions Optional Intl.DateTimeFormatOptions for customization. - * @returns The first day of the week (0-6, where 0 is Sunday). - */ -const getFirstDayOfWeek = (locale, intlOptions = {}) => { - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) - locale = state.getState().locale || getLocale(); - let formatted; - if (!intlOptions.weekday) - intlOptions.weekday = 'long'; - try { - const formatter = new Intl.DateTimeFormat(locale, intlOptions); - /** - * This date was chosen because January 2, 2000, is a Sunday. - * In the Gregorian calendar, Sunday is considered the start of the week in some cultures (like in the United States), while in others, it's Monday (like in much of Europe). - * By using a date that is known to be a Sunday, the function can accurately determine what day of the week is considered the start in the specified locale. - */ - const sundayDate = new Date(2000, 0, 2); // A known Sunday - formatted = formatter.format(sundayDate); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - // Generate localized weekdays array starting from Sunday - const weekdays = Array.from({ length: 7 }, (_, i) => new Intl.DateTimeFormat(locale, intlOptions).format(new Date(2000, 0, 2 + i))); - const firstDayIndex = weekdays.indexOf(formatted); - if (firstDayIndex === -1) { - throw new Error('Unable to determine the first day of the week'); - } - return weekdays[(firstDayIndex + 1) % 7]; // Adjusting since our reference date is a Sunday -}; -var getFirstDayOfWeek$1 = withErrorBoundary(getFirstDayOfWeek); - -/** - * Determines the quarter of the year for a given date. - * - * @param date The date to determine the quarter for. - * @returns The quarter of the year (1-4). - */ -const getQuarter = (date) => { - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - return Math.ceil((date.getMonth() + 1) / 3); -}; -var getQuarter$1 = withErrorBoundary(getQuarter); - -/** - * Provides a relative time string (e.g., '3 hours ago', 'in 2 days'). - * This function calculates the difference between the given date and the base date, - * then formats it in a locale-sensitive manner. It allows customization of the output - * through Intl.RelativeTimeFormat options. - * - * @param date - The date to compare. - * @param baseDate - The date to compare against (default: current date). - * @param locale - The locale to use for formatting. - * @param options - Options for the Intl.RelativeTimeFormat (optional). - * @returns The relative time as a string. - */ -const getRelativeTime = (date, baseDate = new Date(), locale, options) => { - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - baseDate = - typeof baseDate === 'string' - ? new Date(stringToDate(baseDate)) - : new Date(baseDate); - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) - locale = state.getState().locale || getLocale(); - const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000; - // Define time units in seconds - const minute = 60; - const hour = minute * 60; - const day = hour * 24; - const week = day * 7; - const month = day * 30; - const year = day * 365; - let value; - let unit; - if (Math.abs(diffInSeconds) < minute) { - value = diffInSeconds; - unit = 'second'; - } - else if (Math.abs(diffInSeconds) < hour) { - value = diffInSeconds / minute; - unit = 'minute'; - } - else if (Math.abs(diffInSeconds) < day) { - value = diffInSeconds / hour; - unit = 'hour'; - } - else if (Math.abs(diffInSeconds) < week) { - value = diffInSeconds / day; - unit = 'day'; - } - else if (Math.abs(diffInSeconds) < month) { - value = diffInSeconds / week; - unit = 'week'; - } - else if (Math.abs(diffInSeconds) < year) { - value = diffInSeconds / month; - unit = 'month'; - } - else { - value = diffInSeconds / year; - unit = 'year'; - } - let relativeTime; - try { - const rtf = new Intl.RelativeTimeFormat(locale, options); - relativeTime = rtf.format(Math.round(value), unit); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - return relativeTime; -}; -var getRelativeTime$1 = withErrorBoundary(getRelativeTime); - -/** - * Calculates the week number of the year for a given date. - * - * @param date The date to calculate the week number for. - * @returns The week number of the year. - */ -const getWeek = (date) => { - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - const firstDayOfYear = new Date(date.getFullYear(), 0, 1); - const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000; - return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7); -}; -var getWeek$1 = withErrorBoundary(getWeek); - -/** - * Returns an array of weekdays according to the specified locale. - * - * @param locale The locale to get weekdays for. - * @param intlOptions Optional Intl.DateTimeFormatOptions for customization. - * @returns An array of weekday names. - */ -const getWeekdays = (locale, intlOptions = {}) => { - try { - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) - locale = state.getState().locale || getLocale(); - if (!intlOptions.weekday) - intlOptions.weekday = 'long'; - const formatter = new Intl.DateTimeFormat(locale, intlOptions); - /** The date January 1, 1970, is a well-known reference point in computing known as the Unix epoch. - * It's the date at which time is measured for Unix systems, making it a consistent and reliable choice for date calculations. - * The choice of the date January 4, 1970, as the starting point is significant. - * January 4, 1970, was a Sunday. - * Since weeks typically start on Sunday or Monday in most locales, starting from a known Sunday allows the function to cycle through a complete week, capturing all weekdays in the order they appear for the given locale. - * */ - return Array.from({ length: 7 }, (_, i) => formatter.format(new Date(1970, 0, 4 + i))); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } -}; -var getWeekdays$1 = withErrorBoundary(getWeekdays); - -/** - * Compares two dates to determine if the first is after the second. - * @param {DateInput} date1 - First date object or date string. - * @param {DateInput} date2 - Second date object or date string. - * @returns {boolean} True if date1 is after date2. - */ -const isAfter = (date1, date2) => { - date1 = - typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1); - date2 = - typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2); - const dateObj1 = date1 instanceof Date ? date1 : new Date(date1); - const dateObj2 = date2 instanceof Date ? date2 : new Date(date2); - return dateObj1 > dateObj2; -}; -var isAfter$1 = withErrorBoundary(isAfter); - -/** - * Compares two dates to determine if the first is before the second. - * @param {DateInput} date1 - First date object or date string. - * @param {DateInput} date2 - Second date object or date string. - * @returns {boolean} True if date1 is before date2. - */ -const isBefore = (date1, date2) => { - date1 = - typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1); - date2 = - typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2); - const dateObj1 = date1 instanceof Date ? date1 : new Date(date1); - const dateObj2 = date2 instanceof Date ? date2 : new Date(date2); - return dateObj1 < dateObj2; -}; -var isBefore$1 = withErrorBoundary(isBefore); - -/** - * Checks if a given year is a leap year. - * - * @param year The year to check. - * @returns True if the year is a leap year, false otherwise. - */ -const isLeapYear = (year) => { - return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; -}; -var isLeapYear$1 = withErrorBoundary(isLeapYear); - -/** - * Checks if two dates fall on the same day. - * - * @param date1 The first date. - * @param date2 The second date. - * @returns True if both dates are on the same day, false otherwise. - */ -const isSameDay = (date1, date2) => { - date1 = - typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1); - date2 = - typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2); - return (date1.getDate() === date2.getDate() && - date1.getMonth() === date2.getMonth() && - date1.getFullYear() === date2.getFullYear()); -}; -var isSameDay$1 = withErrorBoundary(isSameDay); - -/** - * Checks if a given object is a valid Date object. - * - * @param date The object to check. - * @returns True if the object is a valid Date, false otherwise. - */ -const isValidDate = (date) => { - try { - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - return date instanceof Date && !isNaN(date.getTime()); -}; -var isValidDate$1 = withErrorBoundary(isValidDate); - -const LOCALE_DATE_FORMATS = { - 'ar-AE': 'DD/MM/YYYY', - 'sq-AL': 'DD.MM.YYYY', - 'hy-AM': 'DD.MM.YYYY', - 'es-AR': 'DD/MM/YYYY', - 'en-AU': 'DD/MM/YYYY', - 'nl-AW': 'DD-MM-YYYY', - 'en-BB': 'MM/DD/YYYY', - 'bn-BD': 'DD/MM/YYYY', - 'en-BM': 'MM/DD/YYYY', - 'ms-BN': 'DD/MM/YYYY', - 'es-BO': 'DD/MM/YYYY', - 'en-BS': 'MM/DD/YYYY', - 'en-BW': 'DD/MM/YYYY', - 'en-BZ': 'MM/DD/YYYY', - 'en-CA': 'DD/MM/YYYY', - 'de-CH': 'DD.MM.YYYY', - 'zh-CN': 'YYYY/MM/DD', - 'es-CO': 'DD/MM/YYYY', - 'es-CR': 'DD/MM/YYYY', - 'es-CU': 'DD/MM/YYYY', - 'cs-CZ': 'DD.MM.YYYY', - 'da-DK': 'DD-MM-YYYY', - 'es-DO': 'DD/MM/YYYY', - 'ar-DZ': 'DD/MM/YYYY', - 'ar-EG': 'DD/MM/YYYY', - 'am-ET': 'DD/MM/YYYY', - 'en-EU': 'DD/MM/YYYY', - 'en-FJ': 'DD/MM/YYYY', - 'en-GB': 'DD/MM/YYYY', - 'en-GH': 'DD/MM/YYYY', - 'en-GI': 'DD/MM/YYYY', - 'en-GM': 'DD/MM/YYYY', - 'es-GT': 'DD/MM/YYYY', - 'en-GY': 'DD/MM/YYYY', - 'en-HK': 'DD/MM/YYYY', - 'es-HN': 'DD/MM/YYYY', - 'hr-HR': 'DD.MM.YYYY', - 'ht-HT': 'MM/DD/YYYY', - 'hu-HU': 'YYYY. MM. DD.', - 'id-ID': 'DD/MM/YYYY', - 'he-IL': 'DD/MM/YYYY', - 'en-IN': 'DD-MM-YYYY', - 'en-JM': 'MM/DD/YYYY', - 'en-KE': 'DD/MM/YYYY', - 'ky-KG': 'DD.MM.YYYY', - 'km-KH': 'DD/MM/YYYY', - 'en-KY': 'MM/DD/YYYY', - 'kk-KZ': 'DD.MM.YYYY', - 'lo-LA': 'DD/MM/YYYY', - 'si-LK': 'YYYY-MM-DD', - 'en-LR': 'MM/DD/YYYY', - 'en-LS': 'DD/MM/YYYY', - 'ar-MA': 'DD/MM/YYYY', - 'ro-MD': 'DD.MM.YYYY', - 'mk-MK': 'DD.MM.YYYY', - 'my-MM': 'DD/MM/YYYY', - 'mn-MN': 'YYYY.MM.DD', - 'zh-MO': 'DD/MM/YYYY', - 'en-MU': 'DD/MM/YYYY', - 'dv-MV': 'DD/MM/YYYY', - 'en-MW': 'DD/MM/YYYY', - 'es-MX': 'DD/MM/YYYY', - 'ms-MY': 'DD/MM/YYYY', - 'en-NA': 'DD/MM/YYYY', - 'en-NG': 'DD/MM/YYYY', - 'es-NI': 'DD/MM/YYYY', - 'no-NO': 'DD.MM.YYYY', - 'ne-NP': 'YYYY/MM/DD', - 'en-NZ': 'DD/MM/YYYY', - 'es-PE': 'DD/MM/YYYY', - 'en-PG': 'DD/MM/YYYY', - 'en-PH': 'MM/DD/YYYY', - 'en-PK': 'DD/MM/YYYY', - 'ar-QA': 'DD/MM/YYYY', - 'ru-RU': 'DD.MM.YYYY', - 'ar-SA': 'DD/MM/YYYY', - 'en-SC': 'DD/MM/YYYY', - 'sv-SE': 'YYYY-MM-DD', - 'en-SG': 'DD/MM/YYYY', - 'en-SL': 'DD/MM/YYYY', - 'so-SO': 'DD/MM/YYYY', - 'en-SS': 'DD/MM/YYYY', - 'es-SV': 'DD/MM/YYYY', - 'en-SZ': 'DD/MM/YYYY', - 'th-TH': 'DD/MM/YYYY', - 'en-TT': 'MM/DD/YYYY', - 'sw-TZ': 'DD/MM/YYYY', - 'en-US': 'MM/DD/YYYY', - 'es-UY': 'DD/MM/YYYY', - 'uz-UZ': 'DD/MM/YYYY', - 'ar-YE': 'DD/MM/YYYY', - 'en-ZA': 'YYYY/MM/DD', - 'ar-KW': 'DD/MM/YYYY', - 'ar-BH': 'DD/MM/YYYY', - 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman) -}; - -/** - * Parses a date string based on a specific format. - * - * @param dateString The date string to parse. - * @param format The format to use for parsing. - * @returns The parsed Date object or null if parsing fails. - */ -const parseDateWithFormat = (dateString, format) => { - // Determine the separator based on the format (supports '/', '.', or '-') - const separator = format.includes('/') - ? '/' - : format.includes('.') - ? '.' - : '-'; - const formatParts = format.split(separator); - const dateParts = dateString.split(separator).map((num) => parseInt(num, 10)); - let year = 0, month = 0, day = 0; - let yearSet = false, monthSet = false, daySet = false; - // Check for format and date string mismatch - if (dateParts.length !== formatParts.length) { - return null; // Mismatch between date string and format - } - formatParts.forEach((part, index) => { - // Check for non-numeric values in date string - if (isNaN(dateParts[index])) { - return null; // Invalid date part - } - // Assign year, month, and day based on the format - switch (part) { - case 'DD': - day = dateParts[index]; - daySet = true; - break; - case 'MM': - month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date - monthSet = true; - break; - case 'YYYY': - year = dateParts[index]; - yearSet = true; - break; - } - }); - // Validate and create the date only if all parts are set - if (yearSet && monthSet && daySet) { - const parsedDate = new Date(year, month, day); - // Validate date to catch invalid dates like February 30th - if (parsedDate.getFullYear() === year && - parsedDate.getMonth() === month && - parsedDate.getDate() === day) { - return parsedDate; - } - } - return null; // Invalid date or incomplete date information -}; -var parseDateWithFormat$1 = withErrorBoundary(parseDateWithFormat); - -/** - * Attempts to parse a string into a date object based on locale. - * Uses the localeDateFormats mapping for determining the date format. - * - * @param dateString - The date string to parse. - * @param locale - The locale to use for parsing. - * @returns The parsed Date object or null if parsing fails. - */ -const parseDate = (dateString, locale) => { - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) - locale = state.getState().locale || getLocale(); - const format = LOCALE_DATE_FORMATS[locale]; - if (!format) { - throw new Error(`No date format found for locale: ${locale}`); - } - return parseDateWithFormat$1(dateString, format); -}; -var parseDate$1 = withErrorBoundary(parseDate); - -/** - * Subtracts a specified amount of time from a date. - * - * @param date The original date. - * @param value The amount to subtract. - * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years'). - * @returns A new Date object with the time subtracted. - */ -const subtract = (date, value, unit) => { - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - return add$1(date, -value, unit); // Reuse the add function with negative value -}; -var subtract$1 = withErrorBoundary(subtract); - -exports.add = add$1; -exports.formatDate = formatDate$1; -exports.formatDateTime = formatDateTime$1; -exports.formatNumber = formatNumber$1; -exports.formatNumberByParts = formatNumberByParts$1; -exports.formatPhoneNumber = formatPhoneNumber$1; -exports.formatTime = formatTime$1; -exports.getCurrencyList = getCurrencyList$1; -exports.getCurrencySymbol = getCurrencySymbol$1; -exports.getFirstDayOfWeek = getFirstDayOfWeek$1; -exports.getQuarter = getQuarter$1; -exports.getRelativeTime = getRelativeTime$1; -exports.getState = getState$1; -exports.getWeek = getWeek$1; -exports.getWeekdays = getWeekdays$1; -exports.isAfter = isAfter$1; -exports.isBefore = isBefore$1; -exports.isLeapYear = isLeapYear$1; -exports.isSameDay = isSameDay$1; -exports.isValidDate = isValidDate$1; -exports.isValidPhoneNumber = isValidPhoneNumber$1; -exports.parseDate = parseDate$1; -exports.parsePhoneNumber = parsePhoneNumber$1; -exports.resetState = resetState$1; -exports.setState = setState$1; -exports.subtract = subtract$1; diff --git a/lib/esm/core/index.d.ts b/lib/esm/core/index.d.ts deleted file mode 100644 index 13c528ac..00000000 --- a/lib/esm/core/index.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -interface I18nState { - locale: string; - direction: 'ltr' | 'rtl' | string; - country: string; -} - -declare const _default$2: () => I18nState; - -declare const _default$1: (newState: Partial) => void; - -declare const _default: () => void; - -export { _default$2 as getState, _default as resetState, _default$1 as setState }; diff --git a/lib/esm/core/index.js b/lib/esm/core/index.js deleted file mode 100644 index 1f8d0378..00000000 --- a/lib/esm/core/index.js +++ /dev/null @@ -1,110 +0,0 @@ -// Custom Error class to extend properties to error object -class I18nifyError extends Error { - constructor(message) { - super(message); - this.name = 'i18nify Error'; - this.timestamp = new Date(); - // more params like type of error/severity can be added in future for better debugging. - } -} -/** - * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block. - * It appends additional attributes and serves as a centralized error-handling service. - * Usage => - * const wrappedUtilityFn = withErrorBoundary(utilityFn) - * - * @param fn utility that is wrapped in error boundary - * @returns {Function} returns the function wrapped in try/catch block - */ -const withErrorBoundary = (fn) => { - return function (...rest) { - try { - return fn.call(this, ...rest); - } - catch (err) { - console.warn('[I18N Error]: ', err); - // Currently, we are throwing the error as it is to consumers. - // In the future, this can be modified as per our requirement, like an error logging service. - throw new I18nifyError(err); - } - }; -}; - -function getDefaultState() { - return { - locale: '', - direction: '', - country: '', - }; -} - -class I18nStateManager { - constructor() { - this.state = getDefaultState(); - } - static getInstance() { - if (!I18nStateManager.instance) { - I18nStateManager.instance = new I18nStateManager(); - } - return I18nStateManager.instance; - } - static resetInstance() { - I18nStateManager.instance = undefined; - } - getState() { - return Object.assign({}, this.state); - } - setState(newState) { - this.state = Object.assign(Object.assign({}, this.state), newState); - } - resetState() { - this.state = getDefaultState(); - } -} -var state = I18nStateManager.getInstance(); - -/** - * function to return active i18n state - * - * ===== USAGE ===== - * import { getState } from '@razorpay/i18nify-js'; - * - * console.log(getState()) - * - * @returns i18n state - */ -const getState = () => { - return state.getState(); -}; -var getState$1 = withErrorBoundary(getState); - -/** - * Function to set and override the active state in i18nify SDK - * - * ===== USAGE ===== - * import { setState } from "@razorpay/i18nify-js"; - * setState({locale: 'en-US'}) - * - * @param newState data to set in i18nState instance - */ -const setState = (newState) => { - state.setState(newState); -}; -var setState$1 = withErrorBoundary(setState); - -/** - * Function to reset the active state in i18nify SDK - * - * ===== USAGE ===== - * import { resetState } from "@razorpay/i18nify-js"; - * resetState() - * - * @param newState data to set in i18nState instance - */ -const resetState = () => { - state.resetState(); -}; -var resetState$1 = withErrorBoundary(resetState); - -export { getState$1 as getState, resetState$1 as resetState, setState$1 as setState }; -//# sourceMappingURL=index.js.map diff --git a/lib/esm/core/index.js.map b/lib/esm/core/index.js.map deleted file mode 100644 index c6bb15e0..00000000 --- a/lib/esm/core/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sources":["../../../src/common/errorBoundary/index.ts","../../../src/modules/.internal/utils/getDefaultState.ts","../../../src/modules/.internal/state/index.ts","../../../src/modules/core/getState.ts","../../../src/modules/core/setState.ts","../../../src/modules/core/resetState.ts"],"sourcesContent":["// Custom Error class to extend properties to error object\nexport class I18nifyError extends Error {\n timestamp: Date;\n constructor(message: string | undefined) {\n super(message);\n this.name = 'i18nify Error';\n this.timestamp = new Date();\n // more params like type of error/severity can be added in future for better debugging.\n }\n}\n\n/**\n * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block.\n * It appends additional attributes and serves as a centralized error-handling service.\n * Usage =>\n * const wrappedUtilityFn = withErrorBoundary(utilityFn)\n *\n * @param fn utility that is wrapped in error boundary\n * @returns {Function} returns the function wrapped in try/catch block\n */\nexport const withErrorBoundary = any>(\n fn: T,\n): ((...args: Parameters) => ReturnType) => {\n return function (this: unknown, ...rest: Parameters): ReturnType {\n try {\n return fn.call(this, ...rest) as ReturnType;\n } catch (err) {\n console.warn('[I18N Error]: ', err);\n // Currently, we are throwing the error as it is to consumers.\n // In the future, this can be modified as per our requirement, like an error logging service.\n throw new I18nifyError(err as string | undefined);\n }\n };\n};\n","import type { I18nState } from '../state/types';\n\nexport function getDefaultState(): I18nState {\n return {\n locale: '',\n direction: '',\n country: '',\n };\n}\n","import { I18nState } from './types';\nimport { getDefaultState } from '../utils/getDefaultState';\n\nexport class I18nStateManager {\n private static instance: I18nStateManager | undefined;\n private state: I18nState;\n\n private constructor() {\n this.state = getDefaultState();\n }\n\n public static getInstance(): I18nStateManager {\n if (!I18nStateManager.instance) {\n I18nStateManager.instance = new I18nStateManager();\n }\n\n return I18nStateManager.instance;\n }\n\n public static resetInstance(): void {\n I18nStateManager.instance = undefined;\n }\n\n public getState(): I18nState {\n return { ...this.state };\n }\n\n public setState(newState: Partial): void {\n this.state = { ...this.state, ...newState };\n }\n\n public resetState(): void {\n this.state = getDefaultState();\n }\n}\n\nexport default I18nStateManager.getInstance();\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * function to return active i18n state\n *\n * ===== USAGE =====\n * import { getState } from '@razorpay/i18nify-js';\n *\n * console.log(getState())\n *\n * @returns i18n state\n */\nconst getState = (): I18nState => {\n return state.getState();\n};\n\nexport default withErrorBoundary(getState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * Function to set and override the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { setState } from \"@razorpay/i18nify-js\";\n * setState({locale: 'en-US'})\n *\n * @param newState data to set in i18nState instance\n */\nconst setState = (newState: Partial): void => {\n state.setState(newState);\n};\n\nexport default withErrorBoundary(setState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\n\n/**\n * Function to reset the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { resetState } from \"@razorpay/i18nify-js\";\n * resetState()\n *\n * @param newState data to set in i18nState instance\n */\nconst resetState = (): void => {\n state.resetState();\n};\n\nexport default withErrorBoundary(resetState);\n"],"names":[],"mappings":"AAAA;AACM,MAAO,YAAa,SAAQ,KAAK,CAAA;AAErC,IAAA,WAAA,CAAY,OAA2B,EAAA;QACrC,KAAK,CAAC,OAAO,CAAC,CAAC;AACf,QAAA,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;AAC5B,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;;KAE7B;AACF,CAAA;AAED;;;;;;;;AAQG;AACI,MAAM,iBAAiB,GAAG,CAC/B,EAAK,KAC0C;IAC/C,OAAO,UAAyB,GAAG,IAAmB,EAAA;QACpD,IAAI;YACF,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAkB,CAAC;AAChD,SAAA;AAAC,QAAA,OAAO,GAAG,EAAE;AACZ,YAAA,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC;;;AAGpC,YAAA,MAAM,IAAI,YAAY,CAAC,GAAyB,CAAC,CAAC;AACnD,SAAA;AACH,KAAC,CAAC;AACJ,CAAC;;SC/Be,eAAe,GAAA;IAC7B,OAAO;AACL,QAAA,MAAM,EAAE,EAAE;AACV,QAAA,SAAS,EAAE,EAAE;AACb,QAAA,OAAO,EAAE,EAAE;KACZ,CAAC;AACJ;;MCLa,gBAAgB,CAAA;AAI3B,IAAA,WAAA,GAAA;AACE,QAAA,IAAI,CAAC,KAAK,GAAG,eAAe,EAAE,CAAC;KACh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a/lib/esm/currency/index.d.ts b/lib/esm/currency/index.d.ts deleted file mode 100644 index 75ba176c..00000000 --- a/lib/esm/currency/index.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -declare const _default$3: (amount: string | number, options?: { - currency?: string | number | undefined; - locale?: string | undefined; - intlOptions?: Intl.NumberFormatOptions | undefined; -} | undefined) => string; - -declare const _default$2: () => { - [key: string]: { - symbol: string; - name: string; - }; -}; - -declare const _default$1: (currencyCode: string | number) => string; - -declare const ALLOWED_FORMAT_PARTS_KEYS: readonly ["nan", "infinity", "percent", "integer", "group", "decimal", "fraction", "plusSign", "minusSign", "percentSign", "currency", "code", "symbol", "name", "compact", "exponentInteger", "exponentMinusSign", "exponentSeparator", "unit"]; - -type FormattedPartsObject = { - [key in (typeof ALLOWED_FORMAT_PARTS_KEYS)[number]]?: string | undefined; -}; -interface ByParts extends FormattedPartsObject { - isPrefixSymbol: boolean; - rawParts: Array<{ - type: string; - value: unknown; - }>; -} - -declare const _default: (amount: string | number, options?: { - currency?: string | number | undefined; - locale?: string | undefined; - intlOptions?: Intl.NumberFormatOptions | undefined; -} | undefined) => ByParts; - -export { _default$3 as formatNumber, _default as formatNumberByParts, _default$2 as getCurrencyList, _default$1 as getCurrencySymbol }; diff --git a/lib/esm/currency/index.js b/lib/esm/currency/index.js deleted file mode 100644 index fa44224f..00000000 --- a/lib/esm/currency/index.js +++ /dev/null @@ -1,289 +0,0 @@ -// Custom Error class to extend properties to error object -class I18nifyError extends Error { - constructor(message) { - super(message); - this.name = 'i18nify Error'; - this.timestamp = new Date(); - // more params like type of error/severity can be added in future for better debugging. - } -} -/** - * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block. - * It appends additional attributes and serves as a centralized error-handling service. - * Usage => - * const wrappedUtilityFn = withErrorBoundary(utilityFn) - * - * @param fn utility that is wrapped in error boundary - * @returns {Function} returns the function wrapped in try/catch block - */ -const withErrorBoundary = (fn) => { - return function (...rest) { - try { - return fn.call(this, ...rest); - } - catch (err) { - console.warn('[I18N Error]: ', err); - // Currently, we are throwing the error as it is to consumers. - // In the future, this can be modified as per our requirement, like an error logging service. - throw new I18nifyError(err); - } - }; -}; - -function getDefaultState() { - return { - locale: '', - direction: '', - country: '', - }; -} - -class I18nStateManager { - constructor() { - this.state = getDefaultState(); - } - static getInstance() { - if (!I18nStateManager.instance) { - I18nStateManager.instance = new I18nStateManager(); - } - return I18nStateManager.instance; - } - static resetInstance() { - I18nStateManager.instance = undefined; - } - getState() { - return Object.assign({}, this.state); - } - setState(newState) { - this.state = Object.assign(Object.assign({}, this.state), newState); - } - resetState() { - this.state = getDefaultState(); - } -} -var state = I18nStateManager.getInstance(); - -const getLocale = () => { - // Check if running in a non-browser environment (e.g., Node.js or older browsers). - if (typeof navigator === 'undefined') { - return 'en-IN'; - } - // Check if the browser supports the Intl object and user language preferences. - if (window.Intl && - typeof window.Intl === 'object' && - (window.navigator.languages || window.navigator.language)) { - const userLocales = window.navigator.languages || [ - window.navigator.language, - ]; - return userLocales[0]; - } - // Fallback to a supported locale or the default locale. - return 'en-IN'; -}; - -const getIntlInstanceWithOptions = (options = {}) => { - /** retrieve locale from below areas in order of preference - * 1. options.locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - let locale = (options === null || options === void 0 ? void 0 : options.locale) || state.getState().locale; - // If a specific locale is provided, use it; otherwise, use the browser's locale - if (!locale) { - locale = getLocale(); - } - const intlOptions = (options === null || options === void 0 ? void 0 : options.intlOptions) ? Object.assign({}, options.intlOptions) : {}; - if ((options === null || options === void 0 ? void 0 : options.currency) || intlOptions.currency) { - intlOptions.style = 'currency'; - intlOptions.currency = (options.currency || intlOptions.currency); - } - if (!locale) - throw new Error('Pass valid locale !'); - return new Intl.NumberFormat(locale || undefined, intlOptions); -}; - -// this function formats number based on different arguments passed -const formatNumber = (amount, options = {}) => { - if (!Number(amount) && Number(amount) !== 0) - throw new Error('Parameter `amount` is not a number!'); - let formattedAmount = ''; - try { - formattedAmount = getIntlInstanceWithOptions(options).format(Number(amount)); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - return formattedAmount; -}; -var formatNumber$1 = withErrorBoundary(formatNumber); - -const CURRENCIES = { - AED: { symbol: 'د.إ', name: 'United Arab Emirates Dirham' }, - ALL: { symbol: 'Lek', name: 'Albanian Lek' }, - AMD: { symbol: '֏', name: 'Armenian Dram' }, - ARS: { symbol: 'ARS', name: 'Argentine Peso' }, - AUD: { symbol: 'A$', name: 'Australian Dollar' }, - AWG: { symbol: 'Afl.', name: 'Aruban Florin' }, - BBD: { symbol: '$', name: 'Barbadian Dollar' }, - BDT: { symbol: '৳', name: 'Bangladeshi Taka' }, - BMD: { symbol: '$', name: 'Bermudian Dollar' }, - BND: { symbol: 'BND', name: 'Brunei Dollar' }, - BOB: { symbol: 'Bs', name: 'Bolivian Boliviano' }, - BSD: { symbol: 'B$', name: 'Bahamian Dollar' }, - BWP: { symbol: 'P', name: 'Botswanan Pula' }, - BZD: { symbol: 'BZ$', name: 'Belize Dollar' }, - CAD: { symbol: 'C$', name: 'Canadian Dollar' }, - CHF: { symbol: 'CHf', name: 'Swiss Franc' }, - CNY: { symbol: '¥', name: 'Chinese Yuan' }, - COP: { symbol: 'COL$', name: 'Colombian Peso' }, - CRC: { symbol: '₡', name: 'Costa Rican Colón' }, - CUP: { symbol: '$MN', name: 'Cuban Peso' }, - CZK: { symbol: 'Kč', name: 'Czech Koruna' }, - DKK: { symbol: 'DKK', name: 'Danish Krone' }, - DOP: { symbol: 'RD$', name: 'Dominican Peso' }, - DZD: { symbol: 'د.ج', name: 'Algerian Dinar' }, - EGP: { symbol: 'E£', name: 'Egyptian Pound' }, - ETB: { symbol: 'ብር', name: 'Ethiopian Birr' }, - EUR: { symbol: '€', name: 'Euro' }, - FJD: { symbol: 'FJ$', name: 'Fijian Dollar' }, - GBP: { symbol: '£', name: 'British Pound' }, - GHS: { symbol: 'GH₵', name: 'Ghanaian Cedi' }, - GIP: { symbol: 'GIP', name: 'Gibraltar Pound' }, - GMD: { symbol: 'D', name: 'Gambian Dalasi' }, - GTQ: { symbol: 'Q', name: 'Guatemalan Quetzal' }, - GYD: { symbol: 'G$', name: 'Guyanese Dollar' }, - HKD: { symbol: 'HK$', name: 'Hong Kong Dollar' }, - HNL: { symbol: 'HNL', name: 'Honduran Lempira' }, - HRK: { symbol: 'kn', name: 'Croatian Kuna' }, - HTG: { symbol: 'G', name: 'Haitian Gourde' }, - HUF: { symbol: 'Ft', name: 'Hungarian Forint' }, - IDR: { symbol: 'Rp', name: 'Indonesian Rupiah' }, - ILS: { symbol: '₪', name: 'Israeli New Shekel' }, - INR: { symbol: '₹', name: 'Indian Rupee' }, - JMD: { symbol: 'J$', name: 'Jamaican Dollar' }, - KES: { symbol: 'Ksh', name: 'Kenyan Shilling' }, - KGS: { symbol: 'Лв', name: 'Kyrgystani Som' }, - KHR: { symbol: '៛', name: 'Cambodian Riel' }, - KYD: { symbol: 'CI$', name: 'Cayman Islands Dollar' }, - KZT: { symbol: '₸', name: 'Kazakhstani Tenge' }, - LAK: { symbol: '₭', name: 'Laotian Kip' }, - LKR: { symbol: 'රු', name: 'Sri Lankan Rupee' }, - LRD: { symbol: 'L$', name: 'Liberian Dollar' }, - LSL: { symbol: 'LSL', name: 'Lesotho Loti' }, - MAD: { symbol: 'د.م.', name: 'Moroccan Dirham' }, - MDL: { symbol: 'MDL', name: 'Moldovan Leu' }, - MKD: { symbol: 'ден', name: 'Macedonian Denar' }, - MMK: { symbol: 'MMK', name: 'Myanmar Kyat' }, - MNT: { symbol: '₮', name: 'Mongolian Tugrik' }, - MOP: { symbol: 'MOP$', name: 'Macanese Pataca' }, - MUR: { symbol: '₨', name: 'Mauritian Rupee' }, - MVR: { symbol: 'Rf', name: 'Maldivian Rufiyaa' }, - MWK: { symbol: 'MK', name: 'Malawian Kwacha' }, - MXN: { symbol: 'Mex$', name: 'Mexican Peso' }, - MYR: { symbol: 'RM', name: 'Malaysian Ringgit' }, - NAD: { symbol: 'N$', name: 'Namibian Dollar' }, - NGN: { symbol: '₦', name: 'Nigerian Naira' }, - NIO: { symbol: 'NIO', name: 'Nicaraguan Córdoba' }, - NOK: { symbol: 'NOK', name: 'Norwegian Krone' }, - NPR: { symbol: 'रू', name: 'Nepalese Rupee' }, - NZD: { symbol: 'NZ$', name: 'New Zealand Dollar' }, - PEN: { symbol: 'S/', name: 'Peruvian Nuevo Sol' }, - PGK: { symbol: 'PGK', name: 'Papua New Guinean Kina' }, - PHP: { symbol: '₱', name: 'Philippine Peso' }, - PKR: { symbol: '₨', name: 'Pakistani Rupee' }, - QAR: { symbol: 'QR', name: 'Qatari Riyal' }, - RUB: { symbol: '₽', name: 'Russian Ruble' }, - SAR: { symbol: 'SR', name: 'Saudi Riyal' }, - SCR: { symbol: 'SRe', name: 'Seychellois Rupee' }, - SEK: { symbol: 'SEK', name: 'Swedish Krona' }, - SGD: { symbol: 'S$', name: 'Singapore Dollar' }, - SLL: { symbol: 'Le', name: 'Sierra Leonean Leone' }, - SOS: { symbol: 'Sh.so.', name: 'Somali Shilling' }, - SSP: { symbol: 'SS£', name: 'South Sudanese Pound' }, - SVC: { symbol: '₡', name: 'Salvadoran Colón' }, - SZL: { symbol: 'E', name: 'Swazi Lilangeni' }, - THB: { symbol: '฿', name: 'Thai Baht' }, - TTD: { symbol: 'TT$', name: 'Trinidad and Tobago Dollar' }, - TZS: { symbol: 'Sh', name: 'Tanzanian Shilling' }, - USD: { symbol: '$', name: 'United States Dollar' }, - UYU: { symbol: '$U', name: 'Uruguayan Peso' }, - UZS: { symbol: "so'm", name: 'Uzbekistani Som' }, - YER: { symbol: '﷼', name: 'Yemeni Rial' }, - ZAR: { symbol: 'R', name: 'South African Rand' }, - KWD: { symbol: 'د.ك', name: 'Kuwaiti Dinar' }, - BHD: { symbol: 'د.ب.', name: 'Bahraini Dinar' }, - OMR: { symbol: 'ر.ع.', name: 'Omani Rial' }, -}; - -const getCurrencyList = () => { - return CURRENCIES; -}; -var getCurrencyList$1 = withErrorBoundary(getCurrencyList); - -const getCurrencySymbol = (currencyCode) => { - var _a; - if (currencyCode in CURRENCIES) - return (_a = CURRENCIES[currencyCode]) === null || _a === void 0 ? void 0 : _a.symbol; - else - throw new Error('Invalid currencyCode!'); -}; -var getCurrencySymbol$1 = withErrorBoundary(getCurrencySymbol); - -const ALLOWED_FORMAT_PARTS_KEYS = [ - 'nan', - 'infinity', - 'percent', - 'integer', - 'group', - 'decimal', - 'fraction', - 'plusSign', - 'minusSign', - 'percentSign', - 'currency', - 'code', - 'symbol', - 'name', - 'compact', - 'exponentInteger', - 'exponentMinusSign', - 'exponentSeparator', - 'unit', -]; - -const formatNumberByParts = (amount, options = {}) => { - if (!Number(amount) && Number(amount) !== 0) - throw new Error('Parameter `amount` is not a number!'); - try { - const formattedAmount = getIntlInstanceWithOptions(options).formatToParts(Number(amount)); - const parts = formattedAmount; - const formattedObj = {}; - parts.forEach((p) => { - if (p.type === 'group') { - formattedObj.integer = (formattedObj.integer || '') + p.value; - } - else if (ALLOWED_FORMAT_PARTS_KEYS.findIndex((item) => item === p.type) != -1) { - // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal' is skipped - formattedObj[p.type] = (formattedObj[p.type] || '') + p.value; - } - }); - return Object.assign(Object.assign({}, formattedObj), { isPrefixSymbol: parts[0].type === 'currency', rawParts: parts }); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } -}; -var formatNumberByParts$1 = withErrorBoundary(formatNumberByParts); - -export { formatNumber$1 as formatNumber, formatNumberByParts$1 as formatNumberByParts, getCurrencyList$1 as getCurrencyList, getCurrencySymbol$1 as getCurrencySymbol }; -//# sourceMappingURL=index.js.map diff --git a/lib/esm/currency/index.js.map b/lib/esm/currency/index.js.map deleted file mode 100644 index 1d984277..00000000 --- a/lib/esm/currency/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sources":["../../../src/common/errorBoundary/index.ts","../../../src/modules/.internal/utils/getDefaultState.ts","../../../src/modules/.internal/state/index.ts","../../../src/modules/.internal/utils/getLocale.ts","../../../src/modules/.internal/utils/getIntlInstanceWithOptions.ts","../../../src/modules/currency/formatNumber.ts","../../../src/modules/currency/data/currencies.ts","../../../src/modules/currency/getCurrencyList.ts","../../../src/modules/currency/getCurrencySymbol.ts","../../../src/modules/currency/constants.ts","../../../src/modules/currency/formatNumberByParts.ts"],"sourcesContent":["// Custom Error class to extend properties to error object\nexport class I18nifyError extends Error {\n timestamp: Date;\n constructor(message: string | undefined) {\n super(message);\n this.name = 'i18nify Error';\n this.timestamp = new Date();\n // more params like type of error/severity can be added in future for better debugging.\n }\n}\n\n/**\n * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block.\n * It appends additional attributes and serves as a centralized error-handling service.\n * Usage =>\n * const wrappedUtilityFn = withErrorBoundary(utilityFn)\n *\n * @param fn utility that is wrapped in error boundary\n * @returns {Function} returns the function wrapped in try/catch block\n */\nexport const withErrorBoundary = any>(\n fn: T,\n): ((...args: Parameters) => ReturnType) => {\n return function (this: unknown, ...rest: Parameters): ReturnType {\n try {\n return fn.call(this, ...rest) as ReturnType;\n } catch (err) {\n console.warn('[I18N Error]: ', err);\n // Currently, we are throwing the error as it is to consumers.\n // In the future, this can be modified as per our requirement, like an error logging service.\n throw new I18nifyError(err as string | undefined);\n }\n };\n};\n","import type { I18nState } from '../state/types';\n\nexport function getDefaultState(): I18nState {\n return {\n locale: '',\n direction: '',\n country: '',\n };\n}\n","import { I18nState } from './types';\nimport { getDefaultState } from '../utils/getDefaultState';\n\nexport class I18nStateManager {\n private static instance: I18nStateManager | undefined;\n private state: I18nState;\n\n private constructor() {\n this.state = getDefaultState();\n }\n\n public static getInstance(): I18nStateManager {\n if (!I18nStateManager.instance) {\n I18nStateManager.instance = new I18nStateManager();\n }\n\n return I18nStateManager.instance;\n }\n\n public static resetInstance(): void {\n I18nStateManager.instance = undefined;\n }\n\n public getState(): I18nState {\n return { ...this.state };\n }\n\n public setState(newState: Partial): void {\n this.state = { ...this.state, ...newState };\n }\n\n public resetState(): void {\n this.state = getDefaultState();\n }\n}\n\nexport default I18nStateManager.getInstance();\n","export const getLocale = (): string => {\n // Check if running in a non-browser environment (e.g., Node.js or older browsers).\n if (typeof navigator === 'undefined') {\n return 'en-IN';\n }\n\n // Check if the browser supports the Intl object and user language preferences.\n if (\n window.Intl &&\n typeof window.Intl === 'object' &&\n (window.navigator.languages || window.navigator.language)\n ) {\n const userLocales = window.navigator.languages || [\n window.navigator.language,\n ];\n return userLocales[0];\n }\n\n // Fallback to a supported locale or the default locale.\n return 'en-IN';\n};\n","import { CURRENCIES } from '../../currency/data/currencies';\nimport state from '../state';\nimport { getLocale } from './getLocale';\n\nexport const getIntlInstanceWithOptions = (\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n) => {\n /** retrieve locale from below areas in order of preference\n * 1. options.locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n let locale = options?.locale || state.getState().locale;\n\n // If a specific locale is provided, use it; otherwise, use the browser's locale\n if (!locale) {\n locale = getLocale();\n }\n\n const intlOptions = options?.intlOptions ? { ...options.intlOptions } : {};\n\n if (options?.currency || intlOptions.currency) {\n intlOptions.style = 'currency';\n intlOptions.currency = (options.currency || intlOptions.currency) as string;\n }\n\n if (!locale) throw new Error('Pass valid locale !');\n\n return new Intl.NumberFormat(locale || undefined, intlOptions);\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\n\n// this function formats number based on different arguments passed\nconst formatNumber = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): string => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n let formattedAmount = '';\n\n try {\n formattedAmount = getIntlInstanceWithOptions(options).format(\n Number(amount),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedAmount;\n};\n\nexport default withErrorBoundary(formatNumber);\n","export const CURRENCIES: { [key: string]: { symbol: string; name: string } } = {\n AED: { symbol: 'د.إ', name: 'United Arab Emirates Dirham' },\n ALL: { symbol: 'Lek', name: 'Albanian Lek' },\n AMD: { symbol: '֏', name: 'Armenian Dram' },\n ARS: { symbol: 'ARS', name: 'Argentine Peso' },\n AUD: { symbol: 'A$', name: 'Australian Dollar' },\n AWG: { symbol: 'Afl.', name: 'Aruban Florin' },\n BBD: { symbol: '$', name: 'Barbadian Dollar' },\n BDT: { symbol: '৳', name: 'Bangladeshi Taka' },\n BMD: { symbol: '$', name: 'Bermudian Dollar' },\n BND: { symbol: 'BND', name: 'Brunei Dollar' },\n BOB: { symbol: 'Bs', name: 'Bolivian Boliviano' },\n BSD: { symbol: 'B$', name: 'Bahamian Dollar' },\n BWP: { symbol: 'P', name: 'Botswanan Pula' },\n BZD: { symbol: 'BZ$', name: 'Belize Dollar' },\n CAD: { symbol: 'C$', name: 'Canadian Dollar' },\n CHF: { symbol: 'CHf', name: 'Swiss Franc' },\n CNY: { symbol: '¥', name: 'Chinese Yuan' },\n COP: { symbol: 'COL$', name: 'Colombian Peso' },\n CRC: { symbol: '₡', name: 'Costa Rican Colón' },\n CUP: { symbol: '$MN', name: 'Cuban Peso' },\n CZK: { symbol: 'Kč', name: 'Czech Koruna' },\n DKK: { symbol: 'DKK', name: 'Danish Krone' },\n DOP: { symbol: 'RD$', name: 'Dominican Peso' },\n DZD: { symbol: 'د.ج', name: 'Algerian Dinar' },\n EGP: { symbol: 'E£', name: 'Egyptian Pound' },\n ETB: { symbol: 'ብር', name: 'Ethiopian Birr' },\n EUR: { symbol: '€', name: 'Euro' },\n FJD: { symbol: 'FJ$', name: 'Fijian Dollar' },\n GBP: { symbol: '£', name: 'British Pound' },\n GHS: { symbol: 'GH₵', name: 'Ghanaian Cedi' },\n GIP: { symbol: 'GIP', name: 'Gibraltar Pound' },\n GMD: { symbol: 'D', name: 'Gambian Dalasi' },\n GTQ: { symbol: 'Q', name: 'Guatemalan Quetzal' },\n GYD: { symbol: 'G$', name: 'Guyanese Dollar' },\n HKD: { symbol: 'HK$', name: 'Hong Kong Dollar' },\n HNL: { symbol: 'HNL', name: 'Honduran Lempira' },\n HRK: { symbol: 'kn', name: 'Croatian Kuna' },\n HTG: { symbol: 'G', name: 'Haitian Gourde' },\n HUF: { symbol: 'Ft', name: 'Hungarian Forint' },\n IDR: { symbol: 'Rp', name: 'Indonesian Rupiah' },\n ILS: { symbol: '₪', name: 'Israeli New Shekel' },\n INR: { symbol: '₹', name: 'Indian Rupee' },\n JMD: { symbol: 'J$', name: 'Jamaican Dollar' },\n KES: { symbol: 'Ksh', name: 'Kenyan Shilling' },\n KGS: { symbol: 'Лв', name: 'Kyrgystani Som' },\n KHR: { symbol: '៛', name: 'Cambodian Riel' },\n KYD: { symbol: 'CI$', name: 'Cayman Islands Dollar' },\n KZT: { symbol: '₸', name: 'Kazakhstani Tenge' },\n LAK: { symbol: '₭', name: 'Laotian Kip' },\n LKR: { symbol: 'රු', name: 'Sri Lankan Rupee' },\n LRD: { symbol: 'L$', name: 'Liberian Dollar' },\n LSL: { symbol: 'LSL', name: 'Lesotho Loti' },\n MAD: { symbol: 'د.م.', name: 'Moroccan Dirham' },\n MDL: { symbol: 'MDL', name: 'Moldovan Leu' },\n MKD: { symbol: 'ден', name: 'Macedonian Denar' },\n MMK: { symbol: 'MMK', name: 'Myanmar Kyat' },\n MNT: { symbol: '₮', name: 'Mongolian Tugrik' },\n MOP: { symbol: 'MOP$', name: 'Macanese Pataca' },\n MUR: { symbol: '₨', name: 'Mauritian Rupee' },\n MVR: { symbol: 'Rf', name: 'Maldivian Rufiyaa' },\n MWK: { symbol: 'MK', name: 'Malawian Kwacha' },\n MXN: { symbol: 'Mex$', name: 'Mexican Peso' },\n MYR: { symbol: 'RM', name: 'Malaysian Ringgit' },\n NAD: { symbol: 'N$', name: 'Namibian Dollar' },\n NGN: { symbol: '₦', name: 'Nigerian Naira' },\n NIO: { symbol: 'NIO', name: 'Nicaraguan Córdoba' },\n NOK: { symbol: 'NOK', name: 'Norwegian Krone' },\n NPR: { symbol: 'रू', name: 'Nepalese Rupee' },\n NZD: { symbol: 'NZ$', name: 'New Zealand Dollar' },\n PEN: { symbol: 'S/', name: 'Peruvian Nuevo Sol' },\n PGK: { symbol: 'PGK', name: 'Papua New Guinean Kina' },\n PHP: { symbol: '₱', name: 'Philippine Peso' },\n PKR: { symbol: '₨', name: 'Pakistani Rupee' },\n QAR: { symbol: 'QR', name: 'Qatari Riyal' },\n RUB: { symbol: '₽', name: 'Russian Ruble' },\n SAR: { symbol: 'SR', name: 'Saudi Riyal' },\n SCR: { symbol: 'SRe', name: 'Seychellois Rupee' },\n SEK: { symbol: 'SEK', name: 'Swedish Krona' },\n SGD: { symbol: 'S$', name: 'Singapore Dollar' },\n SLL: { symbol: 'Le', name: 'Sierra Leonean Leone' },\n SOS: { symbol: 'Sh.so.', name: 'Somali Shilling' },\n SSP: { symbol: 'SS£', name: 'South Sudanese Pound' },\n SVC: { symbol: '₡', name: 'Salvadoran Colón' },\n SZL: { symbol: 'E', name: 'Swazi Lilangeni' },\n THB: { symbol: '฿', name: 'Thai Baht' },\n TTD: { symbol: 'TT$', name: 'Trinidad and Tobago Dollar' },\n TZS: { symbol: 'Sh', name: 'Tanzanian Shilling' },\n USD: { symbol: '$', name: 'United States Dollar' },\n UYU: { symbol: '$U', name: 'Uruguayan Peso' },\n UZS: { symbol: \"so'm\", name: 'Uzbekistani Som' },\n YER: { symbol: '﷼', name: 'Yemeni Rial' },\n ZAR: { symbol: 'R', name: 'South African Rand' },\n KWD: { symbol: 'د.ك', name: 'Kuwaiti Dinar' },\n BHD: { symbol: 'د.ب.', name: 'Bahraini Dinar' },\n OMR: { symbol: 'ر.ع.', name: 'Omani Rial' },\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencyList = () => {\n return CURRENCIES;\n};\n\nexport default withErrorBoundary(getCurrencyList);\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencySymbol = (currencyCode: keyof typeof CURRENCIES): string => {\n if (currencyCode in CURRENCIES) return CURRENCIES[currencyCode]?.symbol;\n else throw new Error('Invalid currencyCode!');\n};\n\nexport default withErrorBoundary(getCurrencySymbol);\n","export const ALLOWED_FORMAT_PARTS_KEYS = [\n 'nan',\n 'infinity',\n 'percent',\n 'integer',\n 'group',\n 'decimal',\n 'fraction',\n 'plusSign',\n 'minusSign',\n 'percentSign',\n 'currency',\n 'code',\n 'symbol',\n 'name',\n 'compact',\n 'exponentInteger',\n 'exponentMinusSign',\n 'exponentSeparator',\n 'unit',\n] as const;\n","import { CURRENCIES } from './data/currencies';\nimport { ByParts, FormattedPartsObject } from './types';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\nimport { ALLOWED_FORMAT_PARTS_KEYS } from './constants';\n\nconst formatNumberByParts = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): ByParts => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n try {\n const formattedAmount = getIntlInstanceWithOptions(options).formatToParts(\n Number(amount),\n );\n\n const parts = formattedAmount;\n\n const formattedObj: FormattedPartsObject = {};\n\n parts.forEach((p) => {\n if (p.type === 'group') {\n formattedObj.integer = (formattedObj.integer || '') + p.value;\n } else if (\n ALLOWED_FORMAT_PARTS_KEYS.findIndex((item) => item === p.type) != -1\n ) {\n // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal' is skipped\n formattedObj[p.type] = (formattedObj[p.type] || '') + p.value;\n }\n });\n\n return {\n ...formattedObj,\n isPrefixSymbol: parts[0].type === 'currency',\n rawParts: parts,\n };\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(\n formatNumberByParts,\n);\n"],"names":[],"mappings":"AAAA;AACM,MAAO,YAAa,SAAQ,KAAK,CAAA;AAErC,IAAA,WAAA,CAAY,OAA2B,EAAA;QACrC,KAAK,CAAC,OAAO,CAAC,CAAC;AACf,QAAA,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;AAC5B,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;;KAE7B;AACF,CAAA;AAED;;;;;;;;AAQG;AACI,MAAM,iBAAiB,GAAG,CAC/B,EAAK,KAC0C;IAC/C,OAAO,UAAyB,GAAG,IAAmB,EAAA;QACpD,IAAI;YACF,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAkB,CAAC;AAChD,SAAA;AAAC,QAAA,OAAO,GAAG,EAAE;AACZ,YAAA,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC;;;AAGpC,YAAA,MAAM,IAAI,YAAY,CAAC,GAAyB,CAAC,CAAC;AACnD,SAAA;AACH,KAAC,CAAC;AACJ,CAAC;;SC/Be,eAAe,GAAA;IAC7B,OAAO;AACL,QAAA,MAAM,EAAE,EAAE;AACV,QAAA,SAAS,EAAE,EAAE;AACb,QAAA,OAAO,EAAE,EAAE;KACZ,CAAC;AACJ;;MCLa,gBAAgB,CAAA;AAI3B,IAAA,WAAA,GAAA;AACE,QAAA,IAAI,CAAC,KAAK,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ib/esm/dateTime/index.d.ts deleted file mode 100644 index b6d677a7..00000000 --- a/lib/esm/dateTime/index.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -type DateInput = Date | string; -interface DateFormatOptions extends Omit { -} -interface TimeFormatOptions extends Omit { -} - -declare const _default$f: (date: DateInput, value: number, unit: "days" | "months" | "years") => Date; - -declare const _default$e: (date: DateInput, locale: string, options?: DateFormatOptions | undefined) => string; - -declare const _default$d: (date: DateInput, locale: string, intlOptions?: Intl.DateTimeFormatOptions | undefined) => string; - -declare const _default$c: (date: DateInput, locale: string, options?: TimeFormatOptions | undefined) => string; - -declare const _default$b: (locale: string, intlOptions?: Intl.DateTimeFormatOptions | undefined) => string; - -declare const _default$a: (date: DateInput) => number; - -declare const _default$9: (date: DateInput, baseDate: DateInput | undefined, locale: string, options?: Intl.RelativeTimeFormatOptions | undefined) => string; - -declare const _default$8: (date: DateInput) => number; - -declare const _default$7: (locale: string, intlOptions?: Intl.DateTimeFormatOptions | undefined) => string[]; - -declare const _default$6: (date1: DateInput, date2: DateInput) => boolean; - -declare const _default$5: (date1: DateInput, date2: DateInput) => boolean; - -declare const _default$4: (year: number) => boolean; - -declare const _default$3: (date1: Date, date2: Date) => boolean; - -declare const _default$2: (date: any) => boolean; - -declare const _default$1: (dateString: string, locale: string) => Date | null; - -declare const _default: (date: DateInput, value: number, unit: "days" | "months" | "years") => Date; - -export { _default$f as add, _default$e as formatDate, _default$d as formatDateTime, _default$c as formatTime, _default$b as getFirstDayOfWeek, _default$a as getQuarter, _default$9 as getRelativeTime, _default$8 as getWeek, _default$7 as getWeekdays, _default$6 as isAfter, _default$5 as isBefore, _default$4 as isLeapYear, _default$3 as isSameDay, _default$2 as isValidDate, _default$1 as parseDate, _default as subtract }; diff --git a/lib/esm/dateTime/index.js b/lib/esm/dateTime/index.js deleted file mode 100644 index bb72a67d..00000000 --- a/lib/esm/dateTime/index.js +++ /dev/null @@ -1,804 +0,0 @@ -// Custom Error class to extend properties to error object -class I18nifyError extends Error { - constructor(message) { - super(message); - this.name = 'i18nify Error'; - this.timestamp = new Date(); - // more params like type of error/severity can be added in future for better debugging. - } -} -/** - * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block. - * It appends additional attributes and serves as a centralized error-handling service. - * Usage => - * const wrappedUtilityFn = withErrorBoundary(utilityFn) - * - * @param fn utility that is wrapped in error boundary - * @returns {Function} returns the function wrapped in try/catch block - */ -const withErrorBoundary = (fn) => { - return function (...rest) { - try { - return fn.call(this, ...rest); - } - catch (err) { - console.warn('[I18N Error]: ', err); - // Currently, we are throwing the error as it is to consumers. - // In the future, this can be modified as per our requirement, like an error logging service. - throw new I18nifyError(err); - } - }; -}; - -const stringToDate = (dateString) => { - const supportedDateFormats = [ - // Date formats - { - regex: /^(\d{4})\/(\d{2})\/(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, - { - regex: /^(\d{2})\/(\d{2})\/(\d{4})$/, - yearIndex: 3, - monthIndex: 2, - dayIndex: 1, - }, - { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, - { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, - { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, - { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, - { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, - { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, - // Timestamp formats - { - regex: /^(\d{4})\/(\d{2})\/(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, - { - regex: /^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 3, - monthIndex: 2, - dayIndex: 1, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, - { - regex: /^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, - { - regex: /^(\d{2})-(\d{2})-(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 3, - monthIndex: 2, - dayIndex: 1, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, - { - regex: /^(\d{4})\.(\d{2})\.(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, - { - regex: /^(\d{2})\.(\d{2})\.(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 3, - monthIndex: 2, - dayIndex: 1, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, // DD.MM.YYYY HH:MM:SS - ]; - for (const format of supportedDateFormats) { - const match = dateString.match(format.regex); - if (match) { - const year = match[format.yearIndex]; - const month = match[format.monthIndex]; - const day = match[format.dayIndex]; - const hour = format.hourIndex ? match[format.hourIndex] : '00'; - const minute = format.minuteIndex ? match[format.minuteIndex] : '00'; - const second = format.secondIndex ? match[format.secondIndex] : '00'; - return new Date(`${year}-${month}-${day}T${hour}:${minute}:${second}`); - } - } - throw new Error('Date format not recognized'); -}; - -/** - * Adds a specified amount of time to a date. - * - * @param date The original date. - * @param value The amount to add. - * @param unit The unit of time to add (e.g., 'days', 'months', 'years'). - * @returns A new Date object with the time added. - */ -const add = (date, value, unit) => { - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - switch (unit) { - case 'days': - date.setDate(date.getDate() + value); - break; - case 'months': - date.setMonth(date.getMonth() + value); - break; - case 'years': - date.setFullYear(date.getFullYear() + value); - break; - } - return date; -}; -var add$1 = withErrorBoundary(add); - -function getDefaultState() { - return { - locale: '', - direction: '', - country: '', - }; -} - -class I18nStateManager { - constructor() { - this.state = getDefaultState(); - } - static getInstance() { - if (!I18nStateManager.instance) { - I18nStateManager.instance = new I18nStateManager(); - } - return I18nStateManager.instance; - } - static resetInstance() { - I18nStateManager.instance = undefined; - } - getState() { - return Object.assign({}, this.state); - } - setState(newState) { - this.state = Object.assign(Object.assign({}, this.state), newState); - } - resetState() { - this.state = getDefaultState(); - } -} -var state = I18nStateManager.getInstance(); - -const getLocale = () => { - // Check if running in a non-browser environment (e.g., Node.js or older browsers). - if (typeof navigator === 'undefined') { - return 'en-IN'; - } - // Check if the browser supports the Intl object and user language preferences. - if (window.Intl && - typeof window.Intl === 'object' && - (window.navigator.languages || window.navigator.language)) { - const userLocales = window.navigator.languages || [ - window.navigator.language, - ]; - return userLocales[0]; - } - // Fallback to a supported locale or the default locale. - return 'en-IN'; -}; - -/** - * Formats date and time based on the locale. - * @param {DateInput} date - Date object or date string. - * @param {Locale} locale - Locale string. - * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional). - * @returns {string} Formatted date and time string. - */ -const formatDateTime = (date, locale, intlOptions = {}) => { - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) - locale = state.getState().locale || getLocale(); - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - const dateObj = date instanceof Date ? date : new Date(date); - let formatter; - try { - formatter = new Intl.DateTimeFormat(locale, intlOptions); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - return formatter.format(dateObj); -}; -var formatDateTime$1 = withErrorBoundary(formatDateTime); - -/** - * Formats date based on the locale. - * @param {DateInput} date - Date object or date string. - * @param {Locale} locale - Locale string. - * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional). - * @returns {string} Formatted date string. - */ -const formatDate = (date, locale, options = {}) => { - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) - locale = state.getState().locale || getLocale(); - const fullOptions = Object.assign(Object.assign({}, options), { timeStyle: undefined }); - let formattedDate; - try { - formattedDate = formatDateTime$1(date, locale, fullOptions); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - return formattedDate; -}; -var formatDate$1 = withErrorBoundary(formatDate); - -/** - * Formats time based on the locale. - * @param {DateInput} date - Date object or date string. - * @param {Locale} locale - Locale string. - * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional). - * @returns {string} Formatted time string. - */ -const formatTime = (date, locale, options = {}) => { - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) - locale = state.getState().locale || getLocale(); - const fullOptions = Object.assign(Object.assign({}, options), { dateStyle: undefined }); - let formattedTime; - try { - formattedTime = formatDateTime$1(date, locale, fullOptions); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - return formattedTime; -}; -var formatTime$1 = withErrorBoundary(formatTime); - -/** - * Gets the first day of the week for a given locale. - * - * @param locale The locale to determine the first day of the week for. - * @param intlOptions Optional Intl.DateTimeFormatOptions for customization. - * @returns The first day of the week (0-6, where 0 is Sunday). - */ -const getFirstDayOfWeek = (locale, intlOptions = {}) => { - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) - locale = state.getState().locale || getLocale(); - let formatted; - if (!intlOptions.weekday) - intlOptions.weekday = 'long'; - try { - const formatter = new Intl.DateTimeFormat(locale, intlOptions); - /** - * This date was chosen because January 2, 2000, is a Sunday. - * In the Gregorian calendar, Sunday is considered the start of the week in some cultures (like in the United States), while in others, it's Monday (like in much of Europe). - * By using a date that is known to be a Sunday, the function can accurately determine what day of the week is considered the start in the specified locale. - */ - const sundayDate = new Date(2000, 0, 2); // A known Sunday - formatted = formatter.format(sundayDate); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - // Generate localized weekdays array starting from Sunday - const weekdays = Array.from({ length: 7 }, (_, i) => new Intl.DateTimeFormat(locale, intlOptions).format(new Date(2000, 0, 2 + i))); - const firstDayIndex = weekdays.indexOf(formatted); - if (firstDayIndex === -1) { - throw new Error('Unable to determine the first day of the week'); - } - return weekdays[(firstDayIndex + 1) % 7]; // Adjusting since our reference date is a Sunday -}; -var getFirstDayOfWeek$1 = withErrorBoundary(getFirstDayOfWeek); - -/** - * Determines the quarter of the year for a given date. - * - * @param date The date to determine the quarter for. - * @returns The quarter of the year (1-4). - */ -const getQuarter = (date) => { - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - return Math.ceil((date.getMonth() + 1) / 3); -}; -var getQuarter$1 = withErrorBoundary(getQuarter); - -/** - * Provides a relative time string (e.g., '3 hours ago', 'in 2 days'). - * This function calculates the difference between the given date and the base date, - * then formats it in a locale-sensitive manner. It allows customization of the output - * through Intl.RelativeTimeFormat options. - * - * @param date - The date to compare. - * @param baseDate - The date to compare against (default: current date). - * @param locale - The locale to use for formatting. - * @param options - Options for the Intl.RelativeTimeFormat (optional). - * @returns The relative time as a string. - */ -const getRelativeTime = (date, baseDate = new Date(), locale, options) => { - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - baseDate = - typeof baseDate === 'string' - ? new Date(stringToDate(baseDate)) - : new Date(baseDate); - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) - locale = state.getState().locale || getLocale(); - const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000; - // Define time units in seconds - const minute = 60; - const hour = minute * 60; - const day = hour * 24; - const week = day * 7; - const month = day * 30; - const year = day * 365; - let value; - let unit; - if (Math.abs(diffInSeconds) < minute) { - value = diffInSeconds; - unit = 'second'; - } - else if (Math.abs(diffInSeconds) < hour) { - value = diffInSeconds / minute; - unit = 'minute'; - } - else if (Math.abs(diffInSeconds) < day) { - value = diffInSeconds / hour; - unit = 'hour'; - } - else if (Math.abs(diffInSeconds) < week) { - value = diffInSeconds / day; - unit = 'day'; - } - else if (Math.abs(diffInSeconds) < month) { - value = diffInSeconds / week; - unit = 'week'; - } - else if (Math.abs(diffInSeconds) < year) { - value = diffInSeconds / month; - unit = 'month'; - } - else { - value = diffInSeconds / year; - unit = 'year'; - } - let relativeTime; - try { - const rtf = new Intl.RelativeTimeFormat(locale, options); - relativeTime = rtf.format(Math.round(value), unit); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - return relativeTime; -}; -var getRelativeTime$1 = withErrorBoundary(getRelativeTime); - -/** - * Calculates the week number of the year for a given date. - * - * @param date The date to calculate the week number for. - * @returns The week number of the year. - */ -const getWeek = (date) => { - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - const firstDayOfYear = new Date(date.getFullYear(), 0, 1); - const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000; - return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7); -}; -var getWeek$1 = withErrorBoundary(getWeek); - -/** - * Returns an array of weekdays according to the specified locale. - * - * @param locale The locale to get weekdays for. - * @param intlOptions Optional Intl.DateTimeFormatOptions for customization. - * @returns An array of weekday names. - */ -const getWeekdays = (locale, intlOptions = {}) => { - try { - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) - locale = state.getState().locale || getLocale(); - if (!intlOptions.weekday) - intlOptions.weekday = 'long'; - const formatter = new Intl.DateTimeFormat(locale, intlOptions); - /** The date January 1, 1970, is a well-known reference point in computing known as the Unix epoch. - * It's the date at which time is measured for Unix systems, making it a consistent and reliable choice for date calculations. - * The choice of the date January 4, 1970, as the starting point is significant. - * January 4, 1970, was a Sunday. - * Since weeks typically start on Sunday or Monday in most locales, starting from a known Sunday allows the function to cycle through a complete week, capturing all weekdays in the order they appear for the given locale. - * */ - return Array.from({ length: 7 }, (_, i) => formatter.format(new Date(1970, 0, 4 + i))); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } -}; -var getWeekdays$1 = withErrorBoundary(getWeekdays); - -/** - * Compares two dates to determine if the first is after the second. - * @param {DateInput} date1 - First date object or date string. - * @param {DateInput} date2 - Second date object or date string. - * @returns {boolean} True if date1 is after date2. - */ -const isAfter = (date1, date2) => { - date1 = - typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1); - date2 = - typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2); - const dateObj1 = date1 instanceof Date ? date1 : new Date(date1); - const dateObj2 = date2 instanceof Date ? date2 : new Date(date2); - return dateObj1 > dateObj2; -}; -var isAfter$1 = withErrorBoundary(isAfter); - -/** - * Compares two dates to determine if the first is before the second. - * @param {DateInput} date1 - First date object or date string. - * @param {DateInput} date2 - Second date object or date string. - * @returns {boolean} True if date1 is before date2. - */ -const isBefore = (date1, date2) => { - date1 = - typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1); - date2 = - typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2); - const dateObj1 = date1 instanceof Date ? date1 : new Date(date1); - const dateObj2 = date2 instanceof Date ? date2 : new Date(date2); - return dateObj1 < dateObj2; -}; -var isBefore$1 = withErrorBoundary(isBefore); - -/** - * Checks if a given year is a leap year. - * - * @param year The year to check. - * @returns True if the year is a leap year, false otherwise. - */ -const isLeapYear = (year) => { - return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; -}; -var isLeapYear$1 = withErrorBoundary(isLeapYear); - -/** - * Checks if two dates fall on the same day. - * - * @param date1 The first date. - * @param date2 The second date. - * @returns True if both dates are on the same day, false otherwise. - */ -const isSameDay = (date1, date2) => { - date1 = - typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1); - date2 = - typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2); - return (date1.getDate() === date2.getDate() && - date1.getMonth() === date2.getMonth() && - date1.getFullYear() === date2.getFullYear()); -}; -var isSameDay$1 = withErrorBoundary(isSameDay); - -/** - * Checks if a given object is a valid Date object. - * - * @param date The object to check. - * @returns True if the object is a valid Date, false otherwise. - */ -const isValidDate = (date) => { - try { - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - return date instanceof Date && !isNaN(date.getTime()); -}; -var isValidDate$1 = withErrorBoundary(isValidDate); - -const LOCALE_DATE_FORMATS = { - 'ar-AE': 'DD/MM/YYYY', - 'sq-AL': 'DD.MM.YYYY', - 'hy-AM': 'DD.MM.YYYY', - 'es-AR': 'DD/MM/YYYY', - 'en-AU': 'DD/MM/YYYY', - 'nl-AW': 'DD-MM-YYYY', - 'en-BB': 'MM/DD/YYYY', - 'bn-BD': 'DD/MM/YYYY', - 'en-BM': 'MM/DD/YYYY', - 'ms-BN': 'DD/MM/YYYY', - 'es-BO': 'DD/MM/YYYY', - 'en-BS': 'MM/DD/YYYY', - 'en-BW': 'DD/MM/YYYY', - 'en-BZ': 'MM/DD/YYYY', - 'en-CA': 'DD/MM/YYYY', - 'de-CH': 'DD.MM.YYYY', - 'zh-CN': 'YYYY/MM/DD', - 'es-CO': 'DD/MM/YYYY', - 'es-CR': 'DD/MM/YYYY', - 'es-CU': 'DD/MM/YYYY', - 'cs-CZ': 'DD.MM.YYYY', - 'da-DK': 'DD-MM-YYYY', - 'es-DO': 'DD/MM/YYYY', - 'ar-DZ': 'DD/MM/YYYY', - 'ar-EG': 'DD/MM/YYYY', - 'am-ET': 'DD/MM/YYYY', - 'en-EU': 'DD/MM/YYYY', - 'en-FJ': 'DD/MM/YYYY', - 'en-GB': 'DD/MM/YYYY', - 'en-GH': 'DD/MM/YYYY', - 'en-GI': 'DD/MM/YYYY', - 'en-GM': 'DD/MM/YYYY', - 'es-GT': 'DD/MM/YYYY', - 'en-GY': 'DD/MM/YYYY', - 'en-HK': 'DD/MM/YYYY', - 'es-HN': 'DD/MM/YYYY', - 'hr-HR': 'DD.MM.YYYY', - 'ht-HT': 'MM/DD/YYYY', - 'hu-HU': 'YYYY. MM. DD.', - 'id-ID': 'DD/MM/YYYY', - 'he-IL': 'DD/MM/YYYY', - 'en-IN': 'DD-MM-YYYY', - 'en-JM': 'MM/DD/YYYY', - 'en-KE': 'DD/MM/YYYY', - 'ky-KG': 'DD.MM.YYYY', - 'km-KH': 'DD/MM/YYYY', - 'en-KY': 'MM/DD/YYYY', - 'kk-KZ': 'DD.MM.YYYY', - 'lo-LA': 'DD/MM/YYYY', - 'si-LK': 'YYYY-MM-DD', - 'en-LR': 'MM/DD/YYYY', - 'en-LS': 'DD/MM/YYYY', - 'ar-MA': 'DD/MM/YYYY', - 'ro-MD': 'DD.MM.YYYY', - 'mk-MK': 'DD.MM.YYYY', - 'my-MM': 'DD/MM/YYYY', - 'mn-MN': 'YYYY.MM.DD', - 'zh-MO': 'DD/MM/YYYY', - 'en-MU': 'DD/MM/YYYY', - 'dv-MV': 'DD/MM/YYYY', - 'en-MW': 'DD/MM/YYYY', - 'es-MX': 'DD/MM/YYYY', - 'ms-MY': 'DD/MM/YYYY', - 'en-NA': 'DD/MM/YYYY', - 'en-NG': 'DD/MM/YYYY', - 'es-NI': 'DD/MM/YYYY', - 'no-NO': 'DD.MM.YYYY', - 'ne-NP': 'YYYY/MM/DD', - 'en-NZ': 'DD/MM/YYYY', - 'es-PE': 'DD/MM/YYYY', - 'en-PG': 'DD/MM/YYYY', - 'en-PH': 'MM/DD/YYYY', - 'en-PK': 'DD/MM/YYYY', - 'ar-QA': 'DD/MM/YYYY', - 'ru-RU': 'DD.MM.YYYY', - 'ar-SA': 'DD/MM/YYYY', - 'en-SC': 'DD/MM/YYYY', - 'sv-SE': 'YYYY-MM-DD', - 'en-SG': 'DD/MM/YYYY', - 'en-SL': 'DD/MM/YYYY', - 'so-SO': 'DD/MM/YYYY', - 'en-SS': 'DD/MM/YYYY', - 'es-SV': 'DD/MM/YYYY', - 'en-SZ': 'DD/MM/YYYY', - 'th-TH': 'DD/MM/YYYY', - 'en-TT': 'MM/DD/YYYY', - 'sw-TZ': 'DD/MM/YYYY', - 'en-US': 'MM/DD/YYYY', - 'es-UY': 'DD/MM/YYYY', - 'uz-UZ': 'DD/MM/YYYY', - 'ar-YE': 'DD/MM/YYYY', - 'en-ZA': 'YYYY/MM/DD', - 'ar-KW': 'DD/MM/YYYY', - 'ar-BH': 'DD/MM/YYYY', - 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman) -}; - -/** - * Parses a date string based on a specific format. - * - * @param dateString The date string to parse. - * @param format The format to use for parsing. - * @returns The parsed Date object or null if parsing fails. - */ -const parseDateWithFormat = (dateString, format) => { - // Determine the separator based on the format (supports '/', '.', or '-') - const separator = format.includes('/') - ? '/' - : format.includes('.') - ? '.' - : '-'; - const formatParts = format.split(separator); - const dateParts = dateString.split(separator).map((num) => parseInt(num, 10)); - let year = 0, month = 0, day = 0; - let yearSet = false, monthSet = false, daySet = false; - // Check for format and date string mismatch - if (dateParts.length !== formatParts.length) { - return null; // Mismatch between date string and format - } - formatParts.forEach((part, index) => { - // Check for non-numeric values in date string - if (isNaN(dateParts[index])) { - return null; // Invalid date part - } - // Assign year, month, and day based on the format - switch (part) { - case 'DD': - day = dateParts[index]; - daySet = true; - break; - case 'MM': - month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date - monthSet = true; - break; - case 'YYYY': - year = dateParts[index]; - yearSet = true; - break; - } - }); - // Validate and create the date only if all parts are set - if (yearSet && monthSet && daySet) { - const parsedDate = new Date(year, month, day); - // Validate date to catch invalid dates like February 30th - if (parsedDate.getFullYear() === year && - parsedDate.getMonth() === month && - parsedDate.getDate() === day) { - return parsedDate; - } - } - return null; // Invalid date or incomplete date information -}; -var parseDateWithFormat$1 = withErrorBoundary(parseDateWithFormat); - -/** - * Attempts to parse a string into a date object based on locale. - * Uses the localeDateFormats mapping for determining the date format. - * - * @param dateString - The date string to parse. - * @param locale - The locale to use for parsing. - * @returns The parsed Date object or null if parsing fails. - */ -const parseDate = (dateString, locale) => { - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) - locale = state.getState().locale || getLocale(); - const format = LOCALE_DATE_FORMATS[locale]; - if (!format) { - throw new Error(`No date format found for locale: ${locale}`); - } - return parseDateWithFormat$1(dateString, format); -}; -var parseDate$1 = withErrorBoundary(parseDate); - -/** - * Subtracts a specified amount of time from a date. - * - * @param date The original date. - * @param value The amount to subtract. - * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years'). - * @returns A new Date object with the time subtracted. - */ -const subtract = (date, value, unit) => { - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - return add$1(date, -value, unit); // Reuse the add function with negative value -}; -var subtract$1 = withErrorBoundary(subtract); - -export { add$1 as add, formatDate$1 as formatDate, formatDateTime$1 as formatDateTime, formatTime$1 as formatTime, getFirstDayOfWeek$1 as getFirstDayOfWeek, getQuarter$1 as getQuarter, getRelativeTime$1 as getRelativeTime, getWeek$1 as getWeek, getWeekdays$1 as getWeekdays, isAfter$1 as isAfter, isBefore$1 as isBefore, isLeapYear$1 as isLeapYear, isSameDay$1 as isSameDay, isValidDate$1 as isValidDate, parseDate$1 as parseDate, subtract$1 as subtract }; -//# sourceMappingURL=index.js.map diff --git a/lib/esm/dateTime/index.js.map b/lib/esm/dateTime/index.js.map deleted file mode 100644 index 318dde23..00000000 --- a/lib/esm/dateTime/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sources":["../../../src/common/errorBoundary/index.ts","../../../src/modules/dateTime/utils.ts","../../../src/modules/dateTime/add.ts","../../../src/modules/.internal/utils/getDefaultState.ts","../../../src/modules/.internal/state/index.ts","../../../src/modules/.internal/utils/getLocale.ts","../../../src/modules/dateTime/formatDateTime.ts","../../../src/modules/dateTime/formatDate.ts","../../../src/modules/dateTime/formatTime.ts","../../../src/modules/dateTime/getFirstDayOfWeek.ts","../../../src/modules/dateTime/getQuarter.ts","../../../src/modules/dateTime/getRelativeTime.ts","../../../src/modules/dateTime/getWeek.ts","../../../src/modules/dateTime/getWeekdays.ts","../../../src/modules/dateTime/isAfter.ts","../../../src/modules/dateTime/isBefore.ts","../../../src/modules/dateTime/isLeapYear.ts","../../../src/modules/dateTime/isSameDay.ts","../../../src/modules/dateTime/isValidDate.ts","../../../src/modules/dateTime/data/localeDateFormats.ts","../../../src/modules/dateTime/parseDateWithFormat.ts","../../../src/modules/dateTime/parseDate.ts","../../../src/modules/dateTime/subtract.ts"],"sourcesContent":["// Custom Error class to extend properties to error object\nexport class I18nifyError extends Error {\n timestamp: Date;\n constructor(message: string | undefined) {\n super(message);\n this.name = 'i18nify Error';\n this.timestamp = new Date();\n // more params like type of error/severity can be added in future for better debugging.\n }\n}\n\n/**\n * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block.\n * It appends additional attributes and serves as a centralized error-handling service.\n * Usage =>\n * const wrappedUtilityFn = withErrorBoundary(utilityFn)\n *\n * @param fn utility that is wrapped in error boundary\n * @returns {Function} returns the function wrapped in try/catch block\n */\nexport const withErrorBoundary = any>(\n fn: T,\n): ((...args: Parameters) => ReturnType) => {\n return function (this: unknown, ...rest: Parameters): ReturnType {\n try {\n return fn.call(this, ...rest) as ReturnType;\n } catch (err) {\n console.warn('[I18N Error]: ', err);\n // Currently, we are throwing the error as it is to consumers.\n // In the future, this can be modified as per our requirement, like an error logging service.\n throw new I18nifyError(err as string | undefined);\n }\n };\n};\n","export const stringToDate = (dateString: string): Date => {\n const supportedDateFormats = [\n // Date formats\n {\n regex: /^(\\d{4})\\/(\\d{2})\\/(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY/MM/DD\n {\n regex: /^(\\d{2})\\/(\\d{2})\\/(\\d{4})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n }, // DD/MM/YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY.MM.DD\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // DD-MM-YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // MM/DD/YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY-MM-DD\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY. MM. DD.\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // DD.MM.YYYY\n\n // Timestamp formats\n {\n regex: /^(\\d{4})\\/(\\d{2})\\/(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY/MM/DD HH:MM:SS\n {\n regex: /^(\\d{2})\\/(\\d{2})\\/(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD/MM/YYYY HH:MM:SS\n {\n regex: /^(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY-MM-DD HH:MM:SS\n {\n regex: /^(\\d{2})-(\\d{2})-(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD-MM-YYYY HH:MM:SS\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY.MM.DD HH:MM:SS\n {\n regex: /^(\\d{2})\\.(\\d{2})\\.(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD.MM.YYYY HH:MM:SS\n ];\n\n for (const format of supportedDateFormats) {\n const match = dateString.match(format.regex);\n if (match) {\n const year = match[format.yearIndex];\n const month = match[format.monthIndex];\n const day = match[format.dayIndex];\n const hour = format.hourIndex ? match[format.hourIndex] : '00';\n const minute = format.minuteIndex ? match[format.minuteIndex] : '00';\n const second = format.secondIndex ? match[format.secondIndex] : '00';\n\n return new Date(`${year}-${month}-${day}T${hour}:${minute}:${second}`);\n }\n }\n\n throw new Error('Date format not recognized');\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Adds a specified amount of time to a date.\n *\n * @param date The original date.\n * @param value The amount to add.\n * @param unit The unit of time to add (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time added.\n */\nconst add = (\n date: DateInput,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n switch (unit) {\n case 'days':\n date.setDate(date.getDate() + value);\n break;\n case 'months':\n date.setMonth(date.getMonth() + value);\n break;\n case 'years':\n date.setFullYear(date.getFullYear() + value);\n break;\n }\n return date;\n};\n\nexport default withErrorBoundary(add);\n","import type { I18nState } from '../state/types';\n\nexport function getDefaultState(): I18nState {\n return {\n locale: '',\n direction: '',\n country: '',\n };\n}\n","import { I18nState } from './types';\nimport { getDefaultState } from '../utils/getDefaultState';\n\nexport class I18nStateManager {\n private static instance: I18nStateManager | undefined;\n private state: I18nState;\n\n private constructor() {\n this.state = getDefaultState();\n }\n\n public static getInstance(): I18nStateManager {\n if (!I18nStateManager.instance) {\n I18nStateManager.instance = new I18nStateManager();\n }\n\n return I18nStateManager.instance;\n }\n\n public static resetInstance(): void {\n I18nStateManager.instance = undefined;\n }\n\n public getState(): I18nState {\n return { ...this.state };\n }\n\n public setState(newState: Partial): void {\n this.state = { ...this.state, ...newState };\n }\n\n public resetState(): void {\n this.state = getDefaultState();\n }\n}\n\nexport default I18nStateManager.getInstance();\n","export const getLocale = (): string => {\n // Check if running in a non-browser environment (e.g., Node.js or older browsers).\n if (typeof navigator === 'undefined') {\n return 'en-IN';\n }\n\n // Check if the browser supports the Intl object and user language preferences.\n if (\n window.Intl &&\n typeof window.Intl === 'object' &&\n (window.navigator.languages || window.navigator.language)\n ) {\n const userLocales = window.navigator.languages || [\n window.navigator.language,\n ];\n return userLocales[0];\n }\n\n // Fallback to a supported locale or the default locale.\n return 'en-IN';\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Formats date and time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional).\n * @returns {string} Formatted date and time string.\n */\nconst formatDateTime = (\n date: DateInput,\n locale: Locale,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n const dateObj: Date = date instanceof Date ? date : new Date(date);\n let formatter;\n\n try {\n formatter = new Intl.DateTimeFormat(locale, intlOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formatter.format(dateObj);\n};\n\nexport default withErrorBoundary(formatDateTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n DateFormatOptions,\n} from './types';\n\n/**\n * Formats date based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional).\n * @returns {string} Formatted date string.\n */\nconst formatDate = (\n date: DateInput,\n locale: Locale,\n options: DateFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n timeStyle: undefined,\n };\n\n let formattedDate;\n\n try {\n formattedDate = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedDate;\n};\n\nexport default withErrorBoundary(formatDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n TimeFormatOptions,\n} from './types';\n\n/**\n * Formats time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional).\n * @returns {string} Formatted time string.\n */\nconst formatTime = (\n date: DateInput,\n locale: Locale,\n options: TimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n dateStyle: undefined,\n };\n\n let formattedTime;\n\n try {\n formattedTime = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedTime;\n};\n\nexport default withErrorBoundary(formatTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\n\n/**\n * Gets the first day of the week for a given locale.\n *\n * @param locale The locale to determine the first day of the week for.\n * @param intlOptions Optional Intl.DateTimeFormatOptions for customization.\n * @returns The first day of the week (0-6, where 0 is Sunday).\n */\nconst getFirstDayOfWeek = (\n locale: string,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n let formatted;\n\n if (!intlOptions.weekday) intlOptions.weekday = 'long';\n\n try {\n const formatter = new Intl.DateTimeFormat(locale, intlOptions);\n /**\n * This date was chosen because January 2, 2000, is a Sunday.\n * In the Gregorian calendar, Sunday is considered the start of the week in some cultures (like in the United States), while in others, it's Monday (like in much of Europe).\n * By using a date that is known to be a Sunday, the function can accurately determine what day of the week is considered the start in the specified locale.\n */\n const sundayDate = new Date(2000, 0, 2); // A known Sunday\n formatted = formatter.format(sundayDate);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n // Generate localized weekdays array starting from Sunday\n const weekdays = Array.from({ length: 7 }, (_, i) =>\n new Intl.DateTimeFormat(locale, intlOptions).format(\n new Date(2000, 0, 2 + i),\n ),\n );\n\n const firstDayIndex = weekdays.indexOf(formatted);\n if (firstDayIndex === -1) {\n throw new Error('Unable to determine the first day of the week');\n }\n\n return weekdays[(firstDayIndex + 1) % 7]; // Adjusting since our reference date is a Sunday\n};\n\nexport default withErrorBoundary(getFirstDayOfWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Determines the quarter of the year for a given date.\n *\n * @param date The date to determine the quarter for.\n * @returns The quarter of the year (1-4).\n */\nconst getQuarter = (date: DateInput): number => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n return Math.ceil((date.getMonth() + 1) / 3);\n};\n\nexport default withErrorBoundary(getQuarter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Provides a relative time string (e.g., '3 hours ago', 'in 2 days').\n * This function calculates the difference between the given date and the base date,\n * then formats it in a locale-sensitive manner. It allows customization of the output\n * through Intl.RelativeTimeFormat options.\n *\n * @param date - The date to compare.\n * @param baseDate - The date to compare against (default: current date).\n * @param locale - The locale to use for formatting.\n * @param options - Options for the Intl.RelativeTimeFormat (optional).\n * @returns The relative time as a string.\n */\nconst getRelativeTime = (\n date: DateInput,\n baseDate: DateInput = new Date(),\n locale: Locale,\n options?: Intl.RelativeTimeFormatOptions,\n): string => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n baseDate =\n typeof baseDate === 'string'\n ? new Date(stringToDate(baseDate))\n : new Date(baseDate);\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000;\n\n // Define time units in seconds\n const minute = 60;\n const hour = minute * 60;\n const day = hour * 24;\n const week = day * 7;\n const month = day * 30;\n const year = day * 365;\n\n let value: number;\n let unit: Intl.RelativeTimeFormatUnit;\n\n if (Math.abs(diffInSeconds) < minute) {\n value = diffInSeconds;\n unit = 'second';\n } else if (Math.abs(diffInSeconds) < hour) {\n value = diffInSeconds / minute;\n unit = 'minute';\n } else if (Math.abs(diffInSeconds) < day) {\n value = diffInSeconds / hour;\n unit = 'hour';\n } else if (Math.abs(diffInSeconds) < week) {\n value = diffInSeconds / day;\n unit = 'day';\n } else if (Math.abs(diffInSeconds) < month) {\n value = diffInSeconds / week;\n unit = 'week';\n } else if (Math.abs(diffInSeconds) < year) {\n value = diffInSeconds / month;\n unit = 'month';\n } else {\n value = diffInSeconds / year;\n unit = 'year';\n }\n\n let relativeTime;\n\n try {\n const rtf = new Intl.RelativeTimeFormat(locale, options);\n relativeTime = rtf.format(Math.round(value), unit);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return relativeTime;\n};\n\nexport default withErrorBoundary(getRelativeTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Calculates the week number of the year for a given date.\n *\n * @param date The date to calculate the week number for.\n * @returns The week number of the year.\n */\nconst getWeek = (date: DateInput): number => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n const firstDayOfYear = new Date(date.getFullYear(), 0, 1);\n const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000;\n return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7);\n};\n\nexport default withErrorBoundary(getWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Returns an array of weekdays according to the specified locale.\n *\n * @param locale The locale to get weekdays for.\n * @param intlOptions Optional Intl.DateTimeFormatOptions for customization.\n * @returns An array of weekday names.\n */\nconst getWeekdays = (\n locale: Locale,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string[] => {\n try {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n if (!intlOptions.weekday) intlOptions.weekday = 'long';\n\n const formatter = new Intl.DateTimeFormat(locale, intlOptions);\n\n /** The date January 1, 1970, is a well-known reference point in computing known as the Unix epoch.\n * It's the date at which time is measured for Unix systems, making it a consistent and reliable choice for date calculations.\n * The choice of the date January 4, 1970, as the starting point is significant.\n * January 4, 1970, was a Sunday.\n * Since weeks typically start on Sunday or Monday in most locales, starting from a known Sunday allows the function to cycle through a complete week, capturing all weekdays in the order they appear for the given locale.\n * */\n return Array.from({ length: 7 }, (_, i) =>\n formatter.format(new Date(1970, 0, 4 + i)),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(getWeekdays);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Compares two dates to determine if the first is after the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is after date2.\n */\nconst isAfter = (date1: DateInput, date2: DateInput): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 > dateObj2;\n};\n\nexport default withErrorBoundary(isAfter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Compares two dates to determine if the first is before the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is before date2.\n */\nconst isBefore = (date1: DateInput, date2: DateInput): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 < dateObj2;\n};\n\nexport default withErrorBoundary(isBefore);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given year is a leap year.\n *\n * @param year The year to check.\n * @returns True if the year is a leap year, false otherwise.\n */\nconst isLeapYear = (year: number): boolean => {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n};\n\nexport default withErrorBoundary(isLeapYear);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { stringToDate } from './utils';\n\n/**\n * Checks if two dates fall on the same day.\n *\n * @param date1 The first date.\n * @param date2 The second date.\n * @returns True if both dates are on the same day, false otherwise.\n */\nconst isSameDay = (date1: Date, date2: Date): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n return (\n date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear()\n );\n};\n\nexport default withErrorBoundary(isSameDay);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { stringToDate } from './utils';\n\n/**\n * Checks if a given object is a valid Date object.\n *\n * @param date The object to check.\n * @returns True if the object is a valid Date, false otherwise.\n */\nconst isValidDate = (date: any): boolean => {\n try {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return date instanceof Date && !isNaN(date.getTime());\n};\n\nexport default withErrorBoundary(isValidDate);\n","export const LOCALE_DATE_FORMATS: { [key: string]: string } = {\n 'ar-AE': 'DD/MM/YYYY', // Arabic (U.A.E.)\n 'sq-AL': 'DD.MM.YYYY', // Albanian (Albania)\n 'hy-AM': 'DD.MM.YYYY', // Armenian (Armenia)\n 'es-AR': 'DD/MM/YYYY', // Spanish (Argentina)\n 'en-AU': 'DD/MM/YYYY', // English (Australia)\n 'nl-AW': 'DD-MM-YYYY', // Dutch (Aruba)\n 'en-BB': 'MM/DD/YYYY', // English (Barbados)\n 'bn-BD': 'DD/MM/YYYY', // Bengali (Bangladesh)\n 'en-BM': 'MM/DD/YYYY', // English (Bermuda)\n 'ms-BN': 'DD/MM/YYYY', // Malay (Brunei)\n 'es-BO': 'DD/MM/YYYY', // Spanish (Bolivia)\n 'en-BS': 'MM/DD/YYYY', // English (Bahamas)\n 'en-BW': 'DD/MM/YYYY', // English (Botswana)\n 'en-BZ': 'MM/DD/YYYY', // English (Belize)\n 'en-CA': 'DD/MM/YYYY', // English (Canada)\n 'de-CH': 'DD.MM.YYYY', // German (Switzerland)\n 'zh-CN': 'YYYY/MM/DD', // Chinese (China)\n 'es-CO': 'DD/MM/YYYY', // Spanish (Colombia)\n 'es-CR': 'DD/MM/YYYY', // Spanish (Costa Rica)\n 'es-CU': 'DD/MM/YYYY', // Spanish (Cuba)\n 'cs-CZ': 'DD.MM.YYYY', // Czech (Czech Republic)\n 'da-DK': 'DD-MM-YYYY', // Danish (Denmark)\n 'es-DO': 'DD/MM/YYYY', // Spanish (Dominican Republic)\n 'ar-DZ': 'DD/MM/YYYY', // Arabic (Algeria)\n 'ar-EG': 'DD/MM/YYYY', // Arabic (Egypt)\n 'am-ET': 'DD/MM/YYYY', // Amharic (Ethiopia)\n 'en-EU': 'DD/MM/YYYY', // English (European Union)\n 'en-FJ': 'DD/MM/YYYY', // English (Fiji)\n 'en-GB': 'DD/MM/YYYY', // English (United Kingdom)\n 'en-GH': 'DD/MM/YYYY', // English (Ghana)\n 'en-GI': 'DD/MM/YYYY', // English (Gibraltar)\n 'en-GM': 'DD/MM/YYYY', // English (Gambia)\n 'es-GT': 'DD/MM/YYYY', // Spanish (Guatemala)\n 'en-GY': 'DD/MM/YYYY', // English (Guyana)\n 'en-HK': 'DD/MM/YYYY', // English (Hong Kong)\n 'es-HN': 'DD/MM/YYYY', // Spanish (Honduras)\n 'hr-HR': 'DD.MM.YYYY', // Croatian (Croatia)\n 'ht-HT': 'MM/DD/YYYY', // Haitian (Haiti)\n 'hu-HU': 'YYYY. MM. DD.', // Hungarian (Hungary)\n 'id-ID': 'DD/MM/YYYY', // Indonesian (Indonesia)\n 'he-IL': 'DD/MM/YYYY', // Hebrew (Israel)\n 'en-IN': 'DD-MM-YYYY', // English (India)\n 'en-JM': 'MM/DD/YYYY', // English (Jamaica)\n 'en-KE': 'DD/MM/YYYY', // English (Kenya)\n 'ky-KG': 'DD.MM.YYYY', // Kyrgyz (Kyrgyzstan)\n 'km-KH': 'DD/MM/YYYY', // Khmer (Cambodia)\n 'en-KY': 'MM/DD/YYYY', // English (Cayman Islands)\n 'kk-KZ': 'DD.MM.YYYY', // Kazakh (Kazakhstan)\n 'lo-LA': 'DD/MM/YYYY', // Lao (Laos)\n 'si-LK': 'YYYY-MM-DD', // Sinhala (Sri Lanka)\n 'en-LR': 'MM/DD/YYYY', // English (Liberia)\n 'en-LS': 'DD/MM/YYYY', // English (Lesotho)\n 'ar-MA': 'DD/MM/YYYY', // Arabic (Morocco)\n 'ro-MD': 'DD.MM.YYYY', // Romanian (Moldova)\n 'mk-MK': 'DD.MM.YYYY', // Macedonian (North Macedonia)\n 'my-MM': 'DD/MM/YYYY', // Burmese (Myanmar)\n 'mn-MN': 'YYYY.MM.DD', // Mongolian (Mongolia)\n 'zh-MO': 'DD/MM/YYYY', // Chinese (Macao)\n 'en-MU': 'DD/MM/YYYY', // English (Mauritius)\n 'dv-MV': 'DD/MM/YYYY', // Divehi (Maldives)\n 'en-MW': 'DD/MM/YYYY', // English (Malawi)\n 'es-MX': 'DD/MM/YYYY', // Spanish (Mexico)\n 'ms-MY': 'DD/MM/YYYY', // Malay (Malaysia)\n 'en-NA': 'DD/MM/YYYY', // English (Namibia)\n 'en-NG': 'DD/MM/YYYY', // English (Nigeria)\n 'es-NI': 'DD/MM/YYYY', // Spanish (Nicaragua)\n 'no-NO': 'DD.MM.YYYY', // Norwegian (Norway)\n 'ne-NP': 'YYYY/MM/DD', // Nepali (Nepal)\n 'en-NZ': 'DD/MM/YYYY', // English (New Zealand)\n 'es-PE': 'DD/MM/YYYY', // Spanish (Peru)\n 'en-PG': 'DD/MM/YYYY', // English (Papua New Guinea)\n 'en-PH': 'MM/DD/YYYY', // English (Philippines)\n 'en-PK': 'DD/MM/YYYY', // English (Pakistan)\n 'ar-QA': 'DD/MM/YYYY', // Arabic (Qatar)\n 'ru-RU': 'DD.MM.YYYY', // Russian (Russia)\n 'ar-SA': 'DD/MM/YYYY', // Arabic (Saudi Arabia)\n 'en-SC': 'DD/MM/YYYY', // English (Seychelles)\n 'sv-SE': 'YYYY-MM-DD', // Swedish (Sweden)\n 'en-SG': 'DD/MM/YYYY', // English (Singapore)\n 'en-SL': 'DD/MM/YYYY', // English (Sierra Leone)\n 'so-SO': 'DD/MM/YYYY', // Somali (Somalia)\n 'en-SS': 'DD/MM/YYYY', // English (South Sudan)\n 'es-SV': 'DD/MM/YYYY', // Spanish (El Salvador)\n 'en-SZ': 'DD/MM/YYYY', // English (Eswatini)\n 'th-TH': 'DD/MM/YYYY', // Thai (Thailand)\n 'en-TT': 'MM/DD/YYYY', // English (Trinidad and Tobago)\n 'sw-TZ': 'DD/MM/YYYY', // Swahili (Tanzania)\n 'en-US': 'MM/DD/YYYY', // English (United States)\n 'es-UY': 'DD/MM/YYYY', // Spanish (Uruguay)\n 'uz-UZ': 'DD/MM/YYYY', // Uzbek (Uzbekistan)\n 'ar-YE': 'DD/MM/YYYY', // Arabic (Yemen)\n 'en-ZA': 'YYYY/MM/DD', // English (South Africa)\n 'ar-KW': 'DD/MM/YYYY', // Arabic (Kuwait)\n 'ar-BH': 'DD/MM/YYYY', // Arabic (Bahrain)\n 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman)\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Parses a date string based on a specific format.\n *\n * @param dateString The date string to parse.\n * @param format The format to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDateWithFormat = (\n dateString: string,\n format: string,\n): Date | null => {\n // Determine the separator based on the format (supports '/', '.', or '-')\n const separator = format.includes('/')\n ? '/'\n : format.includes('.')\n ? '.'\n : '-';\n const formatParts = format.split(separator);\n const dateParts = dateString.split(separator).map((num) => parseInt(num, 10));\n\n let year: number = 0,\n month: number = 0,\n day: number = 0;\n let yearSet: boolean = false,\n monthSet: boolean = false,\n daySet: boolean = false;\n\n // Check for format and date string mismatch\n if (dateParts.length !== formatParts.length) {\n return null; // Mismatch between date string and format\n }\n\n formatParts.forEach((part, index) => {\n // Check for non-numeric values in date string\n if (isNaN(dateParts[index])) {\n return null; // Invalid date part\n }\n\n // Assign year, month, and day based on the format\n switch (part) {\n case 'DD':\n day = dateParts[index];\n daySet = true;\n break;\n case 'MM':\n month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date\n monthSet = true;\n break;\n case 'YYYY':\n year = dateParts[index];\n yearSet = true;\n break;\n }\n });\n\n // Validate and create the date only if all parts are set\n if (yearSet && monthSet && daySet) {\n const parsedDate = new Date(year, month, day);\n // Validate date to catch invalid dates like February 30th\n if (\n parsedDate.getFullYear() === year &&\n parsedDate.getMonth() === month &&\n parsedDate.getDate() === day\n ) {\n return parsedDate;\n }\n }\n return null; // Invalid date or incomplete date information\n};\n\nexport default withErrorBoundary(\n parseDateWithFormat,\n);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { LOCALE_DATE_FORMATS } from './data/localeDateFormats';\nimport parseDateWithFormat from './parseDateWithFormat';\nimport { Locale } from './types';\n\n/**\n * Attempts to parse a string into a date object based on locale.\n * Uses the localeDateFormats mapping for determining the date format.\n *\n * @param dateString - The date string to parse.\n * @param locale - The locale to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDate = (dateString: string, locale: Locale): Date | null => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const format = LOCALE_DATE_FORMATS[locale];\n if (!format) {\n throw new Error(`No date format found for locale: ${locale}`);\n }\n return parseDateWithFormat(dateString, format);\n};\n\nexport default withErrorBoundary(parseDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport add from './add';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Subtracts a specified amount of time from a date.\n *\n * @param date The original date.\n * @param value The amount to subtract.\n * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time subtracted.\n */\nconst subtract = (\n date: DateInput,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n return add(date, -value, unit); // Reuse the add function with negative value\n};\n\nexport default withErrorBoundary(subtract);\n"],"names":["formatDateTime","parseDateWithFormat","add"],"mappings":"AAAA;AACM,MAAO,YAAa,SAAQ,KAAK,CAAA;AAErC,IAAA,WAAA,CAAY,OAA2B,EAAA;QACrC,KAAK,CAAC,OAAO,CAAC,CAAC;AACf,QAAA,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;AAC5B,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;;KAE7B;AACF,CAAA;AAED;;;;;;;;AAQG;AACI,MAAM,iBAAiB,GAAG,CAC/B,EAAK,KAC0C;IAC/C,OAAO,UAAyB,GAAG,IAAmB,EAAA;QACpD,IAAI;YACF,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAkB,CAAC;AAChD,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AAM,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC3C,IAAI,CAAC,MAAM,EAAE;AACX,QAAA,MAAM,IAAI,KAAK,CAAC,oCAAoC,MAAM,CAAA,CAAE,CAAC,CAAC;AAC/D,KAAA;AACD,IAAA,OAAOC,qBAAmB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC,CAAC;AAEF,kBAAe,iBAAiB,CAAmB,SAAS,CAAC;;ACzB7D;;;;;;;AAOG;AACH,MAAM,QAAQ,GAAG,CACf,IAAe,EACf,KAAa,EACb,IAAiC,KACzB;IACR,IAAI;QACF,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;IAE3E,OAAOC,KAAG,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACjC,CAAC,CAAC;AAEF,iBAAe,iBAAiB,CAAkB,QAAQ,CAAC;;;;"} \ No newline at end of file diff --git a/lib/esm/index.js b/lib/esm/index.js deleted file mode 100644 index 5307d378..00000000 --- a/lib/esm/index.js +++ /dev/null @@ -1,1740 +0,0 @@ -// Custom Error class to extend properties to error object -class I18nifyError extends Error { - constructor(message) { - super(message); - this.name = 'i18nify Error'; - this.timestamp = new Date(); - // more params like type of error/severity can be added in future for better debugging. - } -} -/** - * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block. - * It appends additional attributes and serves as a centralized error-handling service. - * Usage => - * const wrappedUtilityFn = withErrorBoundary(utilityFn) - * - * @param fn utility that is wrapped in error boundary - * @returns {Function} returns the function wrapped in try/catch block - */ -const withErrorBoundary = (fn) => { - return function (...rest) { - try { - return fn.call(this, ...rest); - } - catch (err) { - console.warn('[I18N Error]: ', err); - // Currently, we are throwing the error as it is to consumers. - // In the future, this can be modified as per our requirement, like an error logging service. - throw new I18nifyError(err); - } - }; -}; - -function getDefaultState() { - return { - locale: '', - direction: '', - country: '', - }; -} - -class I18nStateManager { - constructor() { - this.state = getDefaultState(); - } - static getInstance() { - if (!I18nStateManager.instance) { - I18nStateManager.instance = new I18nStateManager(); - } - return I18nStateManager.instance; - } - static resetInstance() { - I18nStateManager.instance = undefined; - } - getState() { - return Object.assign({}, this.state); - } - setState(newState) { - this.state = Object.assign(Object.assign({}, this.state), newState); - } - resetState() { - this.state = getDefaultState(); - } -} -var state = I18nStateManager.getInstance(); - -/** - * function to return active i18n state - * - * ===== USAGE ===== - * import { getState } from '@razorpay/i18nify-js'; - * - * console.log(getState()) - * - * @returns i18n state - */ -const getState = () => { - return state.getState(); -}; -var getState$1 = withErrorBoundary(getState); - -/** - * Function to set and override the active state in i18nify SDK - * - * ===== USAGE ===== - * import { setState } from "@razorpay/i18nify-js"; - * setState({locale: 'en-US'}) - * - * @param newState data to set in i18nState instance - */ -const setState = (newState) => { - state.setState(newState); -}; -var setState$1 = withErrorBoundary(setState); - -/** - * Function to reset the active state in i18nify SDK - * - * ===== USAGE ===== - * import { resetState } from "@razorpay/i18nify-js"; - * resetState() - * - * @param newState data to set in i18nState instance - */ -const resetState = () => { - state.resetState(); -}; -var resetState$1 = withErrorBoundary(resetState); - -const getLocale = () => { - // Check if running in a non-browser environment (e.g., Node.js or older browsers). - if (typeof navigator === 'undefined') { - return 'en-IN'; - } - // Check if the browser supports the Intl object and user language preferences. - if (window.Intl && - typeof window.Intl === 'object' && - (window.navigator.languages || window.navigator.language)) { - const userLocales = window.navigator.languages || [ - window.navigator.language, - ]; - return userLocales[0]; - } - // Fallback to a supported locale or the default locale. - return 'en-IN'; -}; - -const getIntlInstanceWithOptions = (options = {}) => { - /** retrieve locale from below areas in order of preference - * 1. options.locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - let locale = (options === null || options === void 0 ? void 0 : options.locale) || state.getState().locale; - // If a specific locale is provided, use it; otherwise, use the browser's locale - if (!locale) { - locale = getLocale(); - } - const intlOptions = (options === null || options === void 0 ? void 0 : options.intlOptions) ? Object.assign({}, options.intlOptions) : {}; - if ((options === null || options === void 0 ? void 0 : options.currency) || intlOptions.currency) { - intlOptions.style = 'currency'; - intlOptions.currency = (options.currency || intlOptions.currency); - } - if (!locale) - throw new Error('Pass valid locale !'); - return new Intl.NumberFormat(locale || undefined, intlOptions); -}; - -// this function formats number based on different arguments passed -const formatNumber = (amount, options = {}) => { - if (!Number(amount) && Number(amount) !== 0) - throw new Error('Parameter `amount` is not a number!'); - let formattedAmount = ''; - try { - formattedAmount = getIntlInstanceWithOptions(options).format(Number(amount)); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - return formattedAmount; -}; -var formatNumber$1 = withErrorBoundary(formatNumber); - -const CURRENCIES = { - AED: { symbol: 'د.إ', name: 'United Arab Emirates Dirham' }, - ALL: { symbol: 'Lek', name: 'Albanian Lek' }, - AMD: { symbol: '֏', name: 'Armenian Dram' }, - ARS: { symbol: 'ARS', name: 'Argentine Peso' }, - AUD: { symbol: 'A$', name: 'Australian Dollar' }, - AWG: { symbol: 'Afl.', name: 'Aruban Florin' }, - BBD: { symbol: '$', name: 'Barbadian Dollar' }, - BDT: { symbol: '৳', name: 'Bangladeshi Taka' }, - BMD: { symbol: '$', name: 'Bermudian Dollar' }, - BND: { symbol: 'BND', name: 'Brunei Dollar' }, - BOB: { symbol: 'Bs', name: 'Bolivian Boliviano' }, - BSD: { symbol: 'B$', name: 'Bahamian Dollar' }, - BWP: { symbol: 'P', name: 'Botswanan Pula' }, - BZD: { symbol: 'BZ$', name: 'Belize Dollar' }, - CAD: { symbol: 'C$', name: 'Canadian Dollar' }, - CHF: { symbol: 'CHf', name: 'Swiss Franc' }, - CNY: { symbol: '¥', name: 'Chinese Yuan' }, - COP: { symbol: 'COL$', name: 'Colombian Peso' }, - CRC: { symbol: '₡', name: 'Costa Rican Colón' }, - CUP: { symbol: '$MN', name: 'Cuban Peso' }, - CZK: { symbol: 'Kč', name: 'Czech Koruna' }, - DKK: { symbol: 'DKK', name: 'Danish Krone' }, - DOP: { symbol: 'RD$', name: 'Dominican Peso' }, - DZD: { symbol: 'د.ج', name: 'Algerian Dinar' }, - EGP: { symbol: 'E£', name: 'Egyptian Pound' }, - ETB: { symbol: 'ብር', name: 'Ethiopian Birr' }, - EUR: { symbol: '€', name: 'Euro' }, - FJD: { symbol: 'FJ$', name: 'Fijian Dollar' }, - GBP: { symbol: '£', name: 'British Pound' }, - GHS: { symbol: 'GH₵', name: 'Ghanaian Cedi' }, - GIP: { symbol: 'GIP', name: 'Gibraltar Pound' }, - GMD: { symbol: 'D', name: 'Gambian Dalasi' }, - GTQ: { symbol: 'Q', name: 'Guatemalan Quetzal' }, - GYD: { symbol: 'G$', name: 'Guyanese Dollar' }, - HKD: { symbol: 'HK$', name: 'Hong Kong Dollar' }, - HNL: { symbol: 'HNL', name: 'Honduran Lempira' }, - HRK: { symbol: 'kn', name: 'Croatian Kuna' }, - HTG: { symbol: 'G', name: 'Haitian Gourde' }, - HUF: { symbol: 'Ft', name: 'Hungarian Forint' }, - IDR: { symbol: 'Rp', name: 'Indonesian Rupiah' }, - ILS: { symbol: '₪', name: 'Israeli New Shekel' }, - INR: { symbol: '₹', name: 'Indian Rupee' }, - JMD: { symbol: 'J$', name: 'Jamaican Dollar' }, - KES: { symbol: 'Ksh', name: 'Kenyan Shilling' }, - KGS: { symbol: 'Лв', name: 'Kyrgystani Som' }, - KHR: { symbol: '៛', name: 'Cambodian Riel' }, - KYD: { symbol: 'CI$', name: 'Cayman Islands Dollar' }, - KZT: { symbol: '₸', name: 'Kazakhstani Tenge' }, - LAK: { symbol: '₭', name: 'Laotian Kip' }, - LKR: { symbol: 'රු', name: 'Sri Lankan Rupee' }, - LRD: { symbol: 'L$', name: 'Liberian Dollar' }, - LSL: { symbol: 'LSL', name: 'Lesotho Loti' }, - MAD: { symbol: 'د.م.', name: 'Moroccan Dirham' }, - MDL: { symbol: 'MDL', name: 'Moldovan Leu' }, - MKD: { symbol: 'ден', name: 'Macedonian Denar' }, - MMK: { symbol: 'MMK', name: 'Myanmar Kyat' }, - MNT: { symbol: '₮', name: 'Mongolian Tugrik' }, - MOP: { symbol: 'MOP$', name: 'Macanese Pataca' }, - MUR: { symbol: '₨', name: 'Mauritian Rupee' }, - MVR: { symbol: 'Rf', name: 'Maldivian Rufiyaa' }, - MWK: { symbol: 'MK', name: 'Malawian Kwacha' }, - MXN: { symbol: 'Mex$', name: 'Mexican Peso' }, - MYR: { symbol: 'RM', name: 'Malaysian Ringgit' }, - NAD: { symbol: 'N$', name: 'Namibian Dollar' }, - NGN: { symbol: '₦', name: 'Nigerian Naira' }, - NIO: { symbol: 'NIO', name: 'Nicaraguan Córdoba' }, - NOK: { symbol: 'NOK', name: 'Norwegian Krone' }, - NPR: { symbol: 'रू', name: 'Nepalese Rupee' }, - NZD: { symbol: 'NZ$', name: 'New Zealand Dollar' }, - PEN: { symbol: 'S/', name: 'Peruvian Nuevo Sol' }, - PGK: { symbol: 'PGK', name: 'Papua New Guinean Kina' }, - PHP: { symbol: '₱', name: 'Philippine Peso' }, - PKR: { symbol: '₨', name: 'Pakistani Rupee' }, - QAR: { symbol: 'QR', name: 'Qatari Riyal' }, - RUB: { symbol: '₽', name: 'Russian Ruble' }, - SAR: { symbol: 'SR', name: 'Saudi Riyal' }, - SCR: { symbol: 'SRe', name: 'Seychellois Rupee' }, - SEK: { symbol: 'SEK', name: 'Swedish Krona' }, - SGD: { symbol: 'S$', name: 'Singapore Dollar' }, - SLL: { symbol: 'Le', name: 'Sierra Leonean Leone' }, - SOS: { symbol: 'Sh.so.', name: 'Somali Shilling' }, - SSP: { symbol: 'SS£', name: 'South Sudanese Pound' }, - SVC: { symbol: '₡', name: 'Salvadoran Colón' }, - SZL: { symbol: 'E', name: 'Swazi Lilangeni' }, - THB: { symbol: '฿', name: 'Thai Baht' }, - TTD: { symbol: 'TT$', name: 'Trinidad and Tobago Dollar' }, - TZS: { symbol: 'Sh', name: 'Tanzanian Shilling' }, - USD: { symbol: '$', name: 'United States Dollar' }, - UYU: { symbol: '$U', name: 'Uruguayan Peso' }, - UZS: { symbol: "so'm", name: 'Uzbekistani Som' }, - YER: { symbol: '﷼', name: 'Yemeni Rial' }, - ZAR: { symbol: 'R', name: 'South African Rand' }, - KWD: { symbol: 'د.ك', name: 'Kuwaiti Dinar' }, - BHD: { symbol: 'د.ب.', name: 'Bahraini Dinar' }, - OMR: { symbol: 'ر.ع.', name: 'Omani Rial' }, -}; - -const getCurrencyList = () => { - return CURRENCIES; -}; -var getCurrencyList$1 = withErrorBoundary(getCurrencyList); - -const getCurrencySymbol = (currencyCode) => { - var _a; - if (currencyCode in CURRENCIES) - return (_a = CURRENCIES[currencyCode]) === null || _a === void 0 ? void 0 : _a.symbol; - else - throw new Error('Invalid currencyCode!'); -}; -var getCurrencySymbol$1 = withErrorBoundary(getCurrencySymbol); - -const ALLOWED_FORMAT_PARTS_KEYS = [ - 'nan', - 'infinity', - 'percent', - 'integer', - 'group', - 'decimal', - 'fraction', - 'plusSign', - 'minusSign', - 'percentSign', - 'currency', - 'code', - 'symbol', - 'name', - 'compact', - 'exponentInteger', - 'exponentMinusSign', - 'exponentSeparator', - 'unit', -]; - -const formatNumberByParts = (amount, options = {}) => { - if (!Number(amount) && Number(amount) !== 0) - throw new Error('Parameter `amount` is not a number!'); - try { - const formattedAmount = getIntlInstanceWithOptions(options).formatToParts(Number(amount)); - const parts = formattedAmount; - const formattedObj = {}; - parts.forEach((p) => { - if (p.type === 'group') { - formattedObj.integer = (formattedObj.integer || '') + p.value; - } - else if (ALLOWED_FORMAT_PARTS_KEYS.findIndex((item) => item === p.type) != -1) { - // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal' is skipped - formattedObj[p.type] = (formattedObj[p.type] || '') + p.value; - } - }); - return Object.assign(Object.assign({}, formattedObj), { isPrefixSymbol: parts[0].type === 'currency', rawParts: parts }); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } -}; -var formatNumberByParts$1 = withErrorBoundary(formatNumberByParts); - -const PHONE_REGEX_MAPPER = { - IN: /^(?:(?:\+|0{0,2})91\s*[-]?\s*|[0]?)?[6789]\d{9}$/, - MY: /^(\+?6?0)?(\d{1,3})[-. ]?(\d{7,8})$/, - AE: /^(?:\+?971|0)?(?:2|3|4|6|7|9)\d{8}$/, - AL: /^(?:\+?355)?(?:[4-9]\d{7}|6\d{8})$/, - AM: /^(?:\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/, - AR: /^(?:(?:\+|0{0,2})54)?(?:11|[2368]\d)(?:(?=\d{0,2}15)\d{2})??\d{8}$/, - AU: /^(?:\+?61|0)4\d{8}$/, - AW: /^(?:(?:\+297)?(?!0)\d{7})$/, - BB: /^(?:(?:\+1)?246)?(?:\d{3})?\d{7}$/, - BD: /^(?:\+?880|0)1[13456789]\d{8}$/, - BM: /^(?:(?:\+1)?441)?(?:\d{2})?\d{7}$/, - BN: /^(?:\+?673)?(?:\d{3})?\d{4}$/, - BO: /^(?:(?:\+|0{0,2})591)?(?:(?:2|3|7|6)\d{7})$/, - BS: /^(?:(?:\+1)?242)?(?:\d{3})?\d{7}$/, - BW: /^(?:(?:\+267)?\s?)?[74]\d{7}$/, - BZ: /^(?:(?:\+501)?\s?)?[622]\d{4}$/, - CH: /^(?:(?:\+41|0)(?:\s*\(?0\)?\s*))?(?:\d{2}\s*)?\d{3}\s*\d{2}\s*\d{2}$/, - CN: /^(?:(?:\+|00)86)?1\d{10}$/, - CO: /^(?:(?:\+57|0057)?)?[1-8]{1}\d{6,7}$/, - OM: /^(?:\+?968)?(?:95|96|97|98)\d{6}$/, - CR: /^(?:(?:\+506)?\s*|0)?[1-9]\d{7}$/, - CU: /^(?:\+?53)?(?:[5-8]\d{7})$/, - CZ: /^(?:\+?420)?(?:\d{9})$/, - DK: /^(?:\+?45)?(?:\d{8})$/, - DO: /^(?:(?:\+1)?809|1-8(?:00|88|89))(?:\d{7})$/, - DZ: /^(?:\+?213|0)([567]\d{8})$/, - EG: /^(?:(?:\+20|20)?(\d{10}))$/, - ET: /^(?:\+?251)?[1-59]\d{8}$/, - EU: /^(?:(?:\+?3)?8)?\s*(?:\d{3}\s*){3}\d{2}$/, - FJ: /^(?:(?:\+?679)?\s?\d{3}\s?\d{4})?$/, - GB: /^(?:(?:\+44\s?|0)7\d{3}(\s?\d{4,})?)$/, - GH: /^(?:(?:\+233)|0)?(?:\d{9})$/, - GI: /^(?:\+350)?\d{5}$/, - GM: /^(?:\+220)?\d{5,7}$/, - GT: /^(?:\+502)?[2468]\d{7,8}$/, - GY: /^(?:(?:\+592)?(?:(?:\s)?[2-9])(?:(?:\s)?\d))?(?:(?:\s)?\d{4})$/, - HK: /^(?:\+852\s?)?[456789]\d{3}\s?\d{4}$/, - HN: /^(?:\+504)?[89]\d{7}$/, - HR: /^(?:\+?385)?\d{8,9}$/, - HT: /^(?:\+?509)?\d{8}$/, - HU: /^(?:(?:\+36))(\s?\d{2}\s?\d{3}\s?\d{4})$/, - ID: /^(?:\+?62|0[1-9])[\s-]?\d{2,4}[\s-]?\d{3,4}[\s-]?\d{3,4}$/, - IL: /^(?:(?:\+972|0)(?:-)?)[23489]\d{7}$/, - JM: /^(?:(?:\+1876))\d{7,10}$/, - KE: /^(?:(?:\+254)|(?:0))(?:\d{6,7})$/, - KG: /^(?:\+996)?\s?\d{9}$/, - KH: /^(?:(?:\+855)|(?:0))(?:\s?[1-9]\d{7,8})$/, - KY: /^(?:\+?1\s?(345))\d{6}$/, - KZ: /^(?:\+?7|8)?7\d{9}$/, - LA: /^(?:(?:\+?856)|0)(20\d{7,9})$/, - LK: /^(?:(?:\+94)|0)(?:\d{9})$/, - LR: /^(?:\+231)[ -\d]{4}[ -\d]{4}$/, - LS: /^(?:(?:\+?266)|0)?[56]\d{7}$/, - MA: /^(?:(?:\+?212(\s*[-|\s*]?\d{1,9})?)|(?:0))(?:\d{9})$/, - MD: /^(?:(?:\+373)|(?:0))(?:\d{7,8})$/, - MK: /^(?:\+389|0)(?:(?:2[0-4]|[3-9])\s?)?\d{6}$/, - MM: /^(?:(?:\+?95)|0)?[1-9]\d{9}$/, - MN: /^(?:\+976|0)\d{8}$/, - MO: /^(?:(?:\+?853)|[0-9])?\d{8}$/, - MU: /^(?:\+230|0)?\d{8}$/, - MV: /^(?:(?:\+?960)|0)?\d{7}$/, - MW: /^(?:\+265)[1-9]\d{6}$/, - MX: /^(?:(?:\+?52)?\s?(?:1|01)?\s?)?(?:\d{3}\s?\d{3}\s?\d{4})$/, - NA: /^(?:(?:\+264)|0)?\d{8}$/, - NG: /^(?:(?:\+234)|(?:0))(?:\d{7,8})$/, - NI: /^(?:(?:\+505))?(?:\d{8})$/, - NO: /^(?:(?:\+?47)|\d{2}|\d{3})\s?\d{2}\s?\d{3}$/, - NP: /^(?:(?:\+977))?(\d{9,10})$/, - NZ: /^(?:\+?64|0)(\d{2,5} \d{4,8}|\d{3,4} \d{4})$/, - PE: /^(?:(?:\+51)|0)?(?:9\d{8})$/, - PG: /^(?:\+?675)?(?:[7-9]\d{7})$/, - PH: /^(?:(?:\+?63)|0)(?:\d{10})$/, - PK: /^(?:(?:\+92)|0)?[345]\d{9}$/, - QA: /^(?:\+?974)?-?33\d{5}$/, - RU: /^(?:\+?7|8)?[ -]?\(?9\d{2}\)?[ -]?\d{3}[ -]?\d{2}[ -]?\d{2}$/, - SA: /^(?:\+?966)?\s?1?[\s-]?(?:[45]\d{2}|5\d{3})[\s-]?\d{4}$/, - SC: /^(?:(?:\+248)|\d{4})\d{5}$/, - SE: /^(?:\+?46|0)\s?[1-57-9](?:[0-9]\s?){8}$/, - SG: /^(?:(?:\+65)|(?:\(\+65\))|(?:65))\d{4}\d{4}$/, - SL: /^(?:(?:\+232)|(?:0))?\d{9}$/, - SO: /^(?:\+252|0)?[567]\d{7}$/, - SS: /^(?:\+211|0)?[1-9]\d{7,9}$/, - SV: /^(?:(?:\+?503)|(?:0))(?:\d{8})$/, - SZ: /^(?:\+?268)?\d{7,8}$/, - TH: /^(?:(?:\+66)|0)\d{9}$/, - TT: /^(?:(?:\+?1-868)|\(?868\)?)(\d{7})$/, - TZ: /^(?:(?:\+?255)|0)?[67]\d{8}$/, - US: /^(\+\d{1,2}\s?)?([2-9]{1}\d{2}[2-9]{1}\d{6})$/, - CA: /^(\+\d{1,2}\s?)?([2-9]{1}\d{2}[2-9]{1}\d{6})$/, - UY: /^(?:(?:\+598|0)\s?(9\d{3}|2\d{2}|[4-9]\d{6}))$/, - UZ: /^(?:\+?998)?\s?[3456789]\d{8}$/, - YE: /^(?:\+?967)?(?:\d{7,8})$/, - ZA: /^(?:(?:\+27)|0)(\d{9})$/, - KW: /^(?:\+?965)[569]\d{7}$/, - BH: /^(?:\+?973)?[356]\d{7}$/, - TL: /^(?:(?:\+670)\s?)?[0-9]{3}\s?[0-9]{3,4}$/, - VC: /^(?:(?:\+1)?784)?(?:\d{3})?\d{7}$/, - VE: /^(?:(?:\+58)|0)?4\d{9}$/, - VN: /^(?:(?:\+84)|0)?[1-9]\d{8}$/, - ZM: /^(?:(?:\+260)|0)?[123456789]\d{8,9}$/, - ZW: /^(?:(?:\+263)|0)?(?:\d{9,10})$/, - LT: /^(?:(?:\+370)|8)\d{8}$/, - LU: /^(?:(?:\+352)?(6|2(6|7|8|9))\d{6})$/, - LV: /^(?:(?:\+371)?2\d{7})$/, - ME: /^(?:(?:\+382)?[67]\d{7,20})$/, - MG: /^(?:(?:\+261)?3[234568]\d{7})$/, - MZ: /^(?:(?:\+258)|(?:258))?8[234567]\d{7,8}$/, - NL: /^(?:(?:\+31)|0(6(?:\d{8})|[1-9](?:(?:\d{8})|(?:\s\d{3}\s\d{4}))|(?:\d{8})))$/, - PA: /^(?:(?:\+507)\s?)?[46]\d{6,7}$/, - PL: /^(?:(?:\+48)?(?:\s?\d{3}\s?\d{3}\s?\d{3}|(?:\d{2}\s?){4}\d{2}|\d{3}-\d{3}-\d{3}))$/, - PR: /^(?:(?:\+1)?787|939)\d{7}$/, - PS: /^(?:(?:\+970))(5[2349])\d{7}$/, - PT: /^(?:(?:\+351)?9(1\d|2[1-9]|6[12345789]|7[12345789])\d{7})$/, - PY: /^(?:(?:\+595|0)9[9876]\d{7})$/, - RO: /^(?:(?:\+40|0))(?:7[2-8]\d{7}|21\d{8})$/, - RS: /^(?:(?:\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/, - RW: /^(?:(?:\+250)|(0))\d{9}$/, - SI: /^(?:(?:\+386)|0)?[1-59]\d{7,8}$/, - SK: /^(?:(?:\+421))?(0|9[0-8])\d{8}$/, - SM: /^(?:(?:\+378)|(0549|6\d{4}))\d{5}$/, - SN: /^(?:(?:\+221)|0)?[3679]\d{7}$/, - SR: /^(?:(?:\+597))\d{7}$/, - TG: /^(?:(?:\+228))\d{8}$/, - TJ: /^(?:(?:\+992))(37|55|77)\d{7}$/, - TN: /^(?:(?:\+216)|22|9[1-9])\d{7}$/, - TR: /^(?:(?:\+90)|(0))\s?5\d{9}$/, - TW: /^(?:(?:\+886)|0)?9\d{8}$/, - UA: /^(?:(?:\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\d{7}$/, - UG: /^(?:(?:\+256)|0)?[39]\d{8}$/, -}; - -/* Source: Google LibPhoneNumber Metadata: https://github.com/google/libphonenumber/blob/master/javascript/i18n/phonenumbers/metadata.js */ -const DIAL_CODE_MAPPER = { - 1: [ - 'US', - 'AG', - 'AI', - 'AS', - 'BB', - 'BM', - 'BS', - 'CA', - 'DM', - 'DO', - 'GD', - 'GU', - 'JM', - 'KN', - 'KY', - 'LC', - 'MP', - 'MS', - 'PR', - 'SX', - 'TC', - 'TT', - 'VC', - 'VG', - 'VI', - ], - 7: ['RU', 'KZ'], - 20: ['EG'], - 27: ['ZA'], - 30: ['GR'], - 31: ['NL'], - 32: ['BE'], - 33: ['FR'], - 34: ['ES'], - 36: ['HU'], - 39: ['IT', 'VA'], - 40: ['RO'], - 41: ['CH'], - 43: ['AT'], - 44: ['GB', 'GG', 'IM', 'JE'], - 45: ['DK'], - 46: ['SE'], - 47: ['NO', 'SJ'], - 48: ['PL'], - 49: ['DE'], - 51: ['PE'], - 52: ['MX'], - 53: ['CU'], - 54: ['AR'], - 55: ['BR'], - 56: ['CL'], - 57: ['CO'], - 58: ['VE'], - 60: ['MY'], - 61: ['AU', 'CC', 'CX'], - 62: ['ID'], - 63: ['PH'], - 64: ['NZ'], - 65: ['SG'], - 66: ['TH'], - 81: ['JP'], - 82: ['KR'], - 84: ['VN'], - 86: ['CN'], - 90: ['TR'], - 91: ['IN'], - 92: ['PK'], - 93: ['AF'], - 94: ['LK'], - 95: ['MM'], - 98: ['IR'], - 211: ['SS'], - 212: ['MA', 'EH'], - 213: ['DZ'], - 216: ['TN'], - 218: ['LY'], - 220: ['GM'], - 221: ['SN'], - 222: ['MR'], - 223: ['ML'], - 224: ['GN'], - 225: ['CI'], - 226: ['BF'], - 227: ['NE'], - 228: ['TG'], - 229: ['BJ'], - 230: ['MU'], - 231: ['LR'], - 232: ['SL'], - 233: ['GH'], - 234: ['NG'], - 235: ['TD'], - 236: ['CF'], - 237: ['CM'], - 238: ['CV'], - 239: ['ST'], - 240: ['GQ'], - 241: ['GA'], - 242: ['CG'], - 243: ['CD'], - 244: ['AO'], - 245: ['GW'], - 246: ['IO'], - 247: ['AC'], - 248: ['SC'], - 249: ['SD'], - 250: ['RW'], - 251: ['ET'], - 252: ['SO'], - 253: ['DJ'], - 254: ['KE'], - 255: ['TZ'], - 256: ['UG'], - 257: ['BI'], - 258: ['MZ'], - 260: ['ZM'], - 261: ['MG'], - 262: ['RE', 'YT'], - 263: ['ZW'], - 264: ['NA'], - 265: ['MW'], - 266: ['LS'], - 267: ['BW'], - 268: ['SZ'], - 269: ['KM'], - 290: ['SH', 'TA'], - 291: ['ER'], - 297: ['AW'], - 298: ['FO'], - 299: ['GL'], - 350: ['GI'], - 351: ['PT'], - 352: ['LU'], - 353: ['IE'], - 354: ['IS'], - 355: ['AL'], - 356: ['MT'], - 357: ['CY'], - 358: ['FI', 'AX'], - 359: ['BG'], - 370: ['LT'], - 371: ['LV'], - 372: ['EE'], - 373: ['MD'], - 374: ['AM'], - 375: ['BY'], - 376: ['AD'], - 377: ['MC'], - 378: ['SM'], - 380: ['UA'], - 381: ['RS'], - 382: ['ME'], - 383: ['XK'], - 385: ['HR'], - 386: ['SI'], - 387: ['BA'], - 389: ['MK'], - 420: ['CZ'], - 421: ['SK'], - 423: ['LI'], - 500: ['FK'], - 501: ['BZ'], - 502: ['GT'], - 503: ['SV'], - 504: ['HN'], - 505: ['NI'], - 506: ['CR'], - 507: ['PA'], - 508: ['PM'], - 509: ['HT'], - 590: ['GP', 'BL', 'MF'], - 591: ['BO'], - 592: ['GY'], - 593: ['EC'], - 594: ['GF'], - 595: ['PY'], - 596: ['MQ'], - 597: ['SR'], - 598: ['UY'], - 599: ['CW', 'BQ'], - 670: ['TL'], - 672: ['NF'], - 673: ['BN'], - 674: ['NR'], - 675: ['PG'], - 676: ['TO'], - 677: ['SB'], - 678: ['VU'], - 679: ['FJ'], - 680: ['PW'], - 681: ['WF'], - 682: ['CK'], - 683: ['NU'], - 685: ['WS'], - 686: ['KI'], - 687: ['NC'], - 688: ['TV'], - 689: ['PF'], - 690: ['TK'], - 691: ['FM'], - 692: ['MH'], - 800: ['001'], - 808: ['001'], - 850: ['KP'], - 852: ['HK'], - 853: ['MO'], - 855: ['KH'], - 856: ['LA'], - 870: ['001'], - 878: ['001'], - 880: ['BD'], - 881: ['001'], - 882: ['001'], - 883: ['001'], - 886: ['TW'], - 888: ['001'], - 960: ['MV'], - 961: ['LB'], - 962: ['JO'], - 963: ['SY'], - 964: ['IQ'], - 965: ['KW'], - 966: ['SA'], - 967: ['YE'], - 968: ['OM'], - 970: ['PS'], - 971: ['AE'], - 972: ['IL'], - 973: ['BH'], - 974: ['QA'], - 975: ['BT'], - 976: ['MN'], - 977: ['NP'], - 979: ['001'], - 992: ['TJ'], - 993: ['TM'], - 994: ['AZ'], - 995: ['GE'], - 996: ['KG'], - 998: ['UZ'], -}; - -/** - * Determines the country code based on the provided phone number. - * This function employs a multi-step approach to identify the country code: - * - If the phone number starts with '+', it extracts the numeric characters - * and matches the leading digits with known dial codes mapped to countries. - * - For matched dial codes, it further filters based on country-specific regex patterns - * to validate the phone number format for those countries. - * - If the phone number doesn't start with '+', it directly matches the number - * against regular expressions associated with various countries to identify the code. - * - * @param phoneNumber The input phone number (string or number). - * @returns The detected country code or an empty string if not found. - */ -const detectCountryCodeFromDialCode = (phoneNumber) => { - // If the phone number starts with '+', extract numeric characters - if (phoneNumber.toString().charAt(0) === '+') { - const cleanedPhoneNumberWithoutPlusPrefix = phoneNumber - .toString() - .replace(/\D/g, ''); - const matchingCountries = []; - // Iterate through dial codes and check for matches with cleaned phone number - for (const code in DIAL_CODE_MAPPER) { - if (cleanedPhoneNumberWithoutPlusPrefix.startsWith(code)) { - matchingCountries.push(...DIAL_CODE_MAPPER[code]); - } - } - // Filter matching countries based on phone number validation regex - const matchedCountryCode = matchingCountries.find((countryCode) => { - const regex = PHONE_REGEX_MAPPER[countryCode]; - if (regex && regex.test(phoneNumber.toString())) - return countryCode; - return undefined; - }); - // Return the first matched country code, if any - return matchedCountryCode || ''; - } - else { - // If phone number doesn't start with '+', directly match against country regexes - for (const countryCode in PHONE_REGEX_MAPPER) { - const regex = PHONE_REGEX_MAPPER[countryCode]; - if (regex.test(phoneNumber.toString())) { - return countryCode; - } - } - } - // Return empty string if no country code is detected - return ''; -}; -const cleanPhoneNumber = (phoneNumber) => { - // Regular expression to match all characters except numbers and + sign at the start - const regex = /[^0-9+]|(?!A)\+/g; - // Replace matched characters with an empty string - const cleanedPhoneNumber = phoneNumber.replace(regex, ''); - return phoneNumber[0] === '+' ? `+${cleanedPhoneNumber}` : cleanedPhoneNumber; -}; - -// Validates whether a given phone number is valid based on the provided country code or auto-detects the country code and checks if the number matches the defined regex pattern for that country. -const isValidPhoneNumber = (phoneNumber, countryCode) => { - // Clean the provided phoneNumber by removing non-numeric characters - const cleanedPhoneNumber = cleanPhoneNumber(phoneNumber.toString()); - // Detect or validate the country code - countryCode = - countryCode && countryCode in PHONE_REGEX_MAPPER - ? countryCode - : detectCountryCodeFromDialCode(cleanedPhoneNumber); - // Return false if phoneNumber is empty - if (!phoneNumber) - return false; - // Check if the countryCode exists in the PHONE_REGEX_MAPPER - if (countryCode in PHONE_REGEX_MAPPER) { - // Fetch the regex pattern for the countryCode - const regex = PHONE_REGEX_MAPPER[countryCode]; - // Test if the cleanedPhoneNumber matches the regex pattern - return regex.test(cleanedPhoneNumber); - } - // Return false if the countryCode is not supported - return false; -}; -var isValidPhoneNumber$1 = withErrorBoundary(isValidPhoneNumber); - -const PHONE_FORMATTER_MAPPER = { - IN: 'xxxx xxxxxx', - MY: 'xx xxxxx xx', - AE: 'xx xxx xxxx', - AL: 'xxx xx xxxx', - AM: 'xx xx xx xx', - AR: 'xxxx-xxxx', - AU: 'xxx xxx xxx', - AW: 'xxx-xxxx', - BB: 'xxx-xxxx', - BD: 'xxxx-xxxxxx', - BM: 'xxx-xxxx', - BN: 'xxxx-xxxx', - BO: 'xxxx-xxxx', - BS: 'xxx-xxxx', - BW: 'xx xxxx xxxx', - BZ: 'xxx-xxxx', - CA: 'xxx-xxx-xxxx', - CH: 'xxx xxx xxx', - CN: 'xxxx-xxxxxxx', - CO: 'xxxx-xxxxxxx', - CR: 'xxxx-xxxx', - CU: 'xxxx-xxxx', - CZ: 'xxx xxx xxx', - DK: 'xx xx xx xx', - DO: 'xxx-xxxxxxx', - DZ: 'xxxx-xxxx-xxx', - EG: 'xx xxx xxxx', - ET: 'xx xxx xxxx', - EU: 'xxx xx xx xx', - FJ: 'xxxx xxxx', - GB: 'xxxx xxx xxx', - GH: 'xxx xxx xxxx', - GI: 'xxxx xxxx', - GM: 'xxxx-xxxx', - GT: 'xxxx-xxxx', - GY: 'xxx-xxxx', - HK: 'xxxx xxxx', - HN: 'xxxx-xxxx', - HR: 'xxx xxx xxxx', - HT: 'xxx-xxxx', - HU: 'xxx xxx xxxx', - ID: 'xxxx-xxxx-xxxx', - IL: 'xxxx-xxx-xxx', - JM: 'xxx-xxxx', - KE: 'xxx xxxxxx', - KG: 'xxx-xx-xx-xx', - KH: 'xxx-xxx-xxx', - KY: 'xxx-xxxx', - KZ: 'xxx-xxx-xx-xx', - LA: 'xxx xx xxxx', - LK: 'xx xxx xxxx', - LR: 'xxx-xxx-xxxx', - LS: 'xxx xx xxxx', - LT: 'xxx xxxxx', - LU: 'xxx xx xxx', - LV: 'xxxx xxxx', - MA: 'xxxx-xxxxxx', - MD: 'xx xxxxxx', - ME: 'xx xxxxxx', - MG: 'xx xx xx xx xx', - MK: 'xx xx xx xx', - MM: 'xx xxxxxx', - MN: 'xxx-xx-xxxx', - MO: 'xxxx xxxx', - MU: 'xx xxxx xxxx', - MV: 'xxxxxx', - MW: 'xx xxxx xxxx', - MX: 'xxx-xxx-xxxx', - MZ: 'xx xxxxxxx', - NA: 'xx xxxx xxxx', - NG: 'xxx xxx xxxx', - NI: 'xxxx-xxxx', - NL: 'xxx-xxxxxxx', - NO: 'xxxx xxxx', - NP: 'xxxx-xxxxxxx', - NZ: 'xxx-xxxxxxx', - OM: 'xxxx-xxxx', - PA: 'xxx-xxxx', - PE: 'xxx-xxx-xxx', - PG: 'xxx-xxxxxx', - PH: 'xxx-xxxx', - PK: 'xxx-xxxxxxx', - PL: 'xxx xxx xxx', - PR: 'xxx-xxx-xxxx', - PS: 'xxxx-xxxxxxx', - PT: 'xxx xxx xxx', - PY: 'xxx-xxxxxx', - QA: 'xxxx xxxx', - RO: 'xxx xxx xxxx', - RS: 'xxx xxxxx', - RU: 'xxx xxx-xx-xx', - RW: 'xxx xxxxxx', - SA: 'xxx-xxxxxxx', - SC: 'xx xxxxx', - SE: 'xxx-xxx xx xx', - SG: 'xxxx xxxx', - SI: 'xx xxxxxx', - SK: 'xxx xxx xxx', - SL: 'xxx-xxxxxx', - SM: 'xxxxx xxxxx', - SN: 'xx xxx xx xx', - SO: 'xxx xxxxxxx', - SR: 'xxx-xxxx', - SS: 'xxx xxxx xxx', - SV: 'xxxx-xxxx', - SZ: 'xxx xx xxxx', - TG: 'xx xx xx xx', - TH: 'xxx-xxxxxxx', - TJ: 'xxx xx xx xx', - TL: 'xxx-xxxxxxx', - TN: 'xx xxxxxx', - TR: 'xxx xxx xx xx', - TT: 'xxx-xxxx', - TW: 'xxxx-xxxxxx', - TZ: 'xxx xxx xxxx', - UA: 'xx xxx xx xx', - UG: 'xxx xxxxxxx', - US: 'xxx-xxx-xxxx', - UY: 'xxx-xxxxx', - UZ: 'xxx-xxx-xx-xx', - VC: 'xxx-xxxx', - VE: 'xxxx-xxx-xxxx', - VN: 'xxxx-xxxxxxx', - YE: 'xxxx-xxxx', - ZA: 'xxx-xxx-xxxx', - ZM: 'xxx-xxxxxxx', - ZW: 'xx xxx xxxx', - KW: 'xxx xx xxxx', - BH: 'xxxx xxxx', -}; - -// Formats a provided phone number according to the predefined format for a specific country code, or auto-detects the country code and formats the number accordingly. -const formatPhoneNumber = (phoneNumber, countryCode) => { - // Throw errors if phoneNumber is invalid - if (!phoneNumber) - throw new Error('Parameter `phoneNumber` is invalid!'); - // Convert phoneNumber to string and clean it by removing non-numeric characters - phoneNumber = phoneNumber.toString(); - phoneNumber = cleanPhoneNumber(phoneNumber); - // Detect or validate the country code - countryCode = - countryCode && countryCode in PHONE_FORMATTER_MAPPER - ? countryCode - : detectCountryCodeFromDialCode(phoneNumber); - // Fetch the pattern for the countryCode from the PHONE_FORMATTER_MAPPER - const pattern = PHONE_FORMATTER_MAPPER[countryCode]; - if (!pattern) - return phoneNumber; - // Count the number of 'x' characters in the format pattern - let charCountInFormatterPattern = 0; - for (let i = 0; i < pattern.length; i++) { - if (pattern[i] === 'x') { - charCountInFormatterPattern++; - } - } - // Calculate the difference between phoneNumber length and 'x' characters count in pattern - const diff = phoneNumber.length - charCountInFormatterPattern; - // Extract the phoneNumber without the prefix - const phoneNumberWithoutPrefix = phoneNumber.slice(diff); - const formattedNumber = []; - let numberIndex = 0; - // Loop through the pattern to format the phoneNumber - for (let i = 0; i < pattern.length; i++) { - const patternChar = pattern[i]; - if (patternChar === 'x') { - // Insert phoneNumber digits at 'x' positions - if (numberIndex < phoneNumberWithoutPrefix.length) { - formattedNumber.push(phoneNumberWithoutPrefix[numberIndex]); - numberIndex++; - } - } - else { - // Insert non-digit characters from the pattern - formattedNumber.push(patternChar); - } - } - // Join the formattedNumber array to create the formattedPhoneNumber without prefix - const formattedPhoneNumberWithoutPrefix = formattedNumber.join(''); - // Combine the prefix and formattedPhoneNumberWithoutPrefix - const formattedPhoneNumberWithPrefix = phoneNumber.slice(0, diff) + ' ' + formattedPhoneNumberWithoutPrefix; - // Return the formattedPhoneNumber with prefix after trimming whitespace - return formattedPhoneNumberWithPrefix.trim(); -}; -var formatPhoneNumber$1 = withErrorBoundary(formatPhoneNumber); - -// Parses a given phone number, identifies its country code (if not provided), and returns an object with details including the country code, formatted phone number, dial code, and format template. -const parsePhoneNumber = (phoneNumber, country) => { - // Throw errors if phoneNumber is invalid - if (!phoneNumber) - throw new Error('Parameter `phoneNumber` is invalid!'); - // Clean the phoneNumber by removing non-numeric characters - phoneNumber = phoneNumber.toString(); - phoneNumber = cleanPhoneNumber(phoneNumber); - // Detect or validate the country code - const countryCode = country && country in PHONE_FORMATTER_MAPPER - ? country - : detectCountryCodeFromDialCode(phoneNumber); - // Format the phone number using the detected/validated country code - const formattedPhoneNumber = formatPhoneNumber$1(phoneNumber, countryCode); - // Fetch the pattern associated with the countryCode from the PHONE_FORMATTER_MAPPER - const pattern = PHONE_FORMATTER_MAPPER[countryCode]; - if (!pattern) - return { - countryCode: countryCode || '', - dialCode: '', - formattedPhoneNumber: phoneNumber, - formatTemplate: '', - }; - // Count the number of 'x' characters in the format pattern - let charCountInFormatterPattern = 0; - for (let i = 0; i < pattern.length; i++) { - if (pattern[i] === 'x') { - charCountInFormatterPattern++; - } - } - // Calculate the difference between phoneNumber length and 'x' characters count in pattern - const diff = phoneNumber.length - charCountInFormatterPattern; - // Extract the dialCode from the phoneNumber - const dialCode = phoneNumber.slice(0, diff); - // Obtain the format template associated with the countryCode - const formatTemplate = PHONE_FORMATTER_MAPPER[countryCode]; - // Return the parsed phone number information - return { - countryCode, - formattedPhoneNumber, - dialCode, - formatTemplate, - }; -}; -var parsePhoneNumber$1 = withErrorBoundary(parsePhoneNumber); - -const stringToDate = (dateString) => { - const supportedDateFormats = [ - // Date formats - { - regex: /^(\d{4})\/(\d{2})\/(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, - { - regex: /^(\d{2})\/(\d{2})\/(\d{4})$/, - yearIndex: 3, - monthIndex: 2, - dayIndex: 1, - }, - { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, - { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, - { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, - { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, - { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, - { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, - // Timestamp formats - { - regex: /^(\d{4})\/(\d{2})\/(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, - { - regex: /^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 3, - monthIndex: 2, - dayIndex: 1, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, - { - regex: /^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, - { - regex: /^(\d{2})-(\d{2})-(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 3, - monthIndex: 2, - dayIndex: 1, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, - { - regex: /^(\d{4})\.(\d{2})\.(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, - { - regex: /^(\d{2})\.(\d{2})\.(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 3, - monthIndex: 2, - dayIndex: 1, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, // DD.MM.YYYY HH:MM:SS - ]; - for (const format of supportedDateFormats) { - const match = dateString.match(format.regex); - if (match) { - const year = match[format.yearIndex]; - const month = match[format.monthIndex]; - const day = match[format.dayIndex]; - const hour = format.hourIndex ? match[format.hourIndex] : '00'; - const minute = format.minuteIndex ? match[format.minuteIndex] : '00'; - const second = format.secondIndex ? match[format.secondIndex] : '00'; - return new Date(`${year}-${month}-${day}T${hour}:${minute}:${second}`); - } - } - throw new Error('Date format not recognized'); -}; - -/** - * Adds a specified amount of time to a date. - * - * @param date The original date. - * @param value The amount to add. - * @param unit The unit of time to add (e.g., 'days', 'months', 'years'). - * @returns A new Date object with the time added. - */ -const add = (date, value, unit) => { - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - switch (unit) { - case 'days': - date.setDate(date.getDate() + value); - break; - case 'months': - date.setMonth(date.getMonth() + value); - break; - case 'years': - date.setFullYear(date.getFullYear() + value); - break; - } - return date; -}; -var add$1 = withErrorBoundary(add); - -/** - * Formats date and time based on the locale. - * @param {DateInput} date - Date object or date string. - * @param {Locale} locale - Locale string. - * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional). - * @returns {string} Formatted date and time string. - */ -const formatDateTime = (date, locale, intlOptions = {}) => { - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) - locale = state.getState().locale || getLocale(); - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - const dateObj = date instanceof Date ? date : new Date(date); - let formatter; - try { - formatter = new Intl.DateTimeFormat(locale, intlOptions); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - return formatter.format(dateObj); -}; -var formatDateTime$1 = withErrorBoundary(formatDateTime); - -/** - * Formats date based on the locale. - * @param {DateInput} date - Date object or date string. - * @param {Locale} locale - Locale string. - * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional). - * @returns {string} Formatted date string. - */ -const formatDate = (date, locale, options = {}) => { - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) - locale = state.getState().locale || getLocale(); - const fullOptions = Object.assign(Object.assign({}, options), { timeStyle: undefined }); - let formattedDate; - try { - formattedDate = formatDateTime$1(date, locale, fullOptions); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - return formattedDate; -}; -var formatDate$1 = withErrorBoundary(formatDate); - -/** - * Formats time based on the locale. - * @param {DateInput} date - Date object or date string. - * @param {Locale} locale - Locale string. - * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional). - * @returns {string} Formatted time string. - */ -const formatTime = (date, locale, options = {}) => { - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) - locale = state.getState().locale || getLocale(); - const fullOptions = Object.assign(Object.assign({}, options), { dateStyle: undefined }); - let formattedTime; - try { - formattedTime = formatDateTime$1(date, locale, fullOptions); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - return formattedTime; -}; -var formatTime$1 = withErrorBoundary(formatTime); - -/** - * Gets the first day of the week for a given locale. - * - * @param locale The locale to determine the first day of the week for. - * @param intlOptions Optional Intl.DateTimeFormatOptions for customization. - * @returns The first day of the week (0-6, where 0 is Sunday). - */ -const getFirstDayOfWeek = (locale, intlOptions = {}) => { - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) - locale = state.getState().locale || getLocale(); - let formatted; - if (!intlOptions.weekday) - intlOptions.weekday = 'long'; - try { - const formatter = new Intl.DateTimeFormat(locale, intlOptions); - /** - * This date was chosen because January 2, 2000, is a Sunday. - * In the Gregorian calendar, Sunday is considered the start of the week in some cultures (like in the United States), while in others, it's Monday (like in much of Europe). - * By using a date that is known to be a Sunday, the function can accurately determine what day of the week is considered the start in the specified locale. - */ - const sundayDate = new Date(2000, 0, 2); // A known Sunday - formatted = formatter.format(sundayDate); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - // Generate localized weekdays array starting from Sunday - const weekdays = Array.from({ length: 7 }, (_, i) => new Intl.DateTimeFormat(locale, intlOptions).format(new Date(2000, 0, 2 + i))); - const firstDayIndex = weekdays.indexOf(formatted); - if (firstDayIndex === -1) { - throw new Error('Unable to determine the first day of the week'); - } - return weekdays[(firstDayIndex + 1) % 7]; // Adjusting since our reference date is a Sunday -}; -var getFirstDayOfWeek$1 = withErrorBoundary(getFirstDayOfWeek); - -/** - * Determines the quarter of the year for a given date. - * - * @param date The date to determine the quarter for. - * @returns The quarter of the year (1-4). - */ -const getQuarter = (date) => { - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - return Math.ceil((date.getMonth() + 1) / 3); -}; -var getQuarter$1 = withErrorBoundary(getQuarter); - -/** - * Provides a relative time string (e.g., '3 hours ago', 'in 2 days'). - * This function calculates the difference between the given date and the base date, - * then formats it in a locale-sensitive manner. It allows customization of the output - * through Intl.RelativeTimeFormat options. - * - * @param date - The date to compare. - * @param baseDate - The date to compare against (default: current date). - * @param locale - The locale to use for formatting. - * @param options - Options for the Intl.RelativeTimeFormat (optional). - * @returns The relative time as a string. - */ -const getRelativeTime = (date, baseDate = new Date(), locale, options) => { - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - baseDate = - typeof baseDate === 'string' - ? new Date(stringToDate(baseDate)) - : new Date(baseDate); - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) - locale = state.getState().locale || getLocale(); - const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000; - // Define time units in seconds - const minute = 60; - const hour = minute * 60; - const day = hour * 24; - const week = day * 7; - const month = day * 30; - const year = day * 365; - let value; - let unit; - if (Math.abs(diffInSeconds) < minute) { - value = diffInSeconds; - unit = 'second'; - } - else if (Math.abs(diffInSeconds) < hour) { - value = diffInSeconds / minute; - unit = 'minute'; - } - else if (Math.abs(diffInSeconds) < day) { - value = diffInSeconds / hour; - unit = 'hour'; - } - else if (Math.abs(diffInSeconds) < week) { - value = diffInSeconds / day; - unit = 'day'; - } - else if (Math.abs(diffInSeconds) < month) { - value = diffInSeconds / week; - unit = 'week'; - } - else if (Math.abs(diffInSeconds) < year) { - value = diffInSeconds / month; - unit = 'month'; - } - else { - value = diffInSeconds / year; - unit = 'year'; - } - let relativeTime; - try { - const rtf = new Intl.RelativeTimeFormat(locale, options); - relativeTime = rtf.format(Math.round(value), unit); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - return relativeTime; -}; -var getRelativeTime$1 = withErrorBoundary(getRelativeTime); - -/** - * Calculates the week number of the year for a given date. - * - * @param date The date to calculate the week number for. - * @returns The week number of the year. - */ -const getWeek = (date) => { - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - const firstDayOfYear = new Date(date.getFullYear(), 0, 1); - const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000; - return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7); -}; -var getWeek$1 = withErrorBoundary(getWeek); - -/** - * Returns an array of weekdays according to the specified locale. - * - * @param locale The locale to get weekdays for. - * @param intlOptions Optional Intl.DateTimeFormatOptions for customization. - * @returns An array of weekday names. - */ -const getWeekdays = (locale, intlOptions = {}) => { - try { - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) - locale = state.getState().locale || getLocale(); - if (!intlOptions.weekday) - intlOptions.weekday = 'long'; - const formatter = new Intl.DateTimeFormat(locale, intlOptions); - /** The date January 1, 1970, is a well-known reference point in computing known as the Unix epoch. - * It's the date at which time is measured for Unix systems, making it a consistent and reliable choice for date calculations. - * The choice of the date January 4, 1970, as the starting point is significant. - * January 4, 1970, was a Sunday. - * Since weeks typically start on Sunday or Monday in most locales, starting from a known Sunday allows the function to cycle through a complete week, capturing all weekdays in the order they appear for the given locale. - * */ - return Array.from({ length: 7 }, (_, i) => formatter.format(new Date(1970, 0, 4 + i))); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } -}; -var getWeekdays$1 = withErrorBoundary(getWeekdays); - -/** - * Compares two dates to determine if the first is after the second. - * @param {DateInput} date1 - First date object or date string. - * @param {DateInput} date2 - Second date object or date string. - * @returns {boolean} True if date1 is after date2. - */ -const isAfter = (date1, date2) => { - date1 = - typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1); - date2 = - typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2); - const dateObj1 = date1 instanceof Date ? date1 : new Date(date1); - const dateObj2 = date2 instanceof Date ? date2 : new Date(date2); - return dateObj1 > dateObj2; -}; -var isAfter$1 = withErrorBoundary(isAfter); - -/** - * Compares two dates to determine if the first is before the second. - * @param {DateInput} date1 - First date object or date string. - * @param {DateInput} date2 - Second date object or date string. - * @returns {boolean} True if date1 is before date2. - */ -const isBefore = (date1, date2) => { - date1 = - typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1); - date2 = - typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2); - const dateObj1 = date1 instanceof Date ? date1 : new Date(date1); - const dateObj2 = date2 instanceof Date ? date2 : new Date(date2); - return dateObj1 < dateObj2; -}; -var isBefore$1 = withErrorBoundary(isBefore); - -/** - * Checks if a given year is a leap year. - * - * @param year The year to check. - * @returns True if the year is a leap year, false otherwise. - */ -const isLeapYear = (year) => { - return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; -}; -var isLeapYear$1 = withErrorBoundary(isLeapYear); - -/** - * Checks if two dates fall on the same day. - * - * @param date1 The first date. - * @param date2 The second date. - * @returns True if both dates are on the same day, false otherwise. - */ -const isSameDay = (date1, date2) => { - date1 = - typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1); - date2 = - typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2); - return (date1.getDate() === date2.getDate() && - date1.getMonth() === date2.getMonth() && - date1.getFullYear() === date2.getFullYear()); -}; -var isSameDay$1 = withErrorBoundary(isSameDay); - -/** - * Checks if a given object is a valid Date object. - * - * @param date The object to check. - * @returns True if the object is a valid Date, false otherwise. - */ -const isValidDate = (date) => { - try { - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - return date instanceof Date && !isNaN(date.getTime()); -}; -var isValidDate$1 = withErrorBoundary(isValidDate); - -const LOCALE_DATE_FORMATS = { - 'ar-AE': 'DD/MM/YYYY', - 'sq-AL': 'DD.MM.YYYY', - 'hy-AM': 'DD.MM.YYYY', - 'es-AR': 'DD/MM/YYYY', - 'en-AU': 'DD/MM/YYYY', - 'nl-AW': 'DD-MM-YYYY', - 'en-BB': 'MM/DD/YYYY', - 'bn-BD': 'DD/MM/YYYY', - 'en-BM': 'MM/DD/YYYY', - 'ms-BN': 'DD/MM/YYYY', - 'es-BO': 'DD/MM/YYYY', - 'en-BS': 'MM/DD/YYYY', - 'en-BW': 'DD/MM/YYYY', - 'en-BZ': 'MM/DD/YYYY', - 'en-CA': 'DD/MM/YYYY', - 'de-CH': 'DD.MM.YYYY', - 'zh-CN': 'YYYY/MM/DD', - 'es-CO': 'DD/MM/YYYY', - 'es-CR': 'DD/MM/YYYY', - 'es-CU': 'DD/MM/YYYY', - 'cs-CZ': 'DD.MM.YYYY', - 'da-DK': 'DD-MM-YYYY', - 'es-DO': 'DD/MM/YYYY', - 'ar-DZ': 'DD/MM/YYYY', - 'ar-EG': 'DD/MM/YYYY', - 'am-ET': 'DD/MM/YYYY', - 'en-EU': 'DD/MM/YYYY', - 'en-FJ': 'DD/MM/YYYY', - 'en-GB': 'DD/MM/YYYY', - 'en-GH': 'DD/MM/YYYY', - 'en-GI': 'DD/MM/YYYY', - 'en-GM': 'DD/MM/YYYY', - 'es-GT': 'DD/MM/YYYY', - 'en-GY': 'DD/MM/YYYY', - 'en-HK': 'DD/MM/YYYY', - 'es-HN': 'DD/MM/YYYY', - 'hr-HR': 'DD.MM.YYYY', - 'ht-HT': 'MM/DD/YYYY', - 'hu-HU': 'YYYY. MM. DD.', - 'id-ID': 'DD/MM/YYYY', - 'he-IL': 'DD/MM/YYYY', - 'en-IN': 'DD-MM-YYYY', - 'en-JM': 'MM/DD/YYYY', - 'en-KE': 'DD/MM/YYYY', - 'ky-KG': 'DD.MM.YYYY', - 'km-KH': 'DD/MM/YYYY', - 'en-KY': 'MM/DD/YYYY', - 'kk-KZ': 'DD.MM.YYYY', - 'lo-LA': 'DD/MM/YYYY', - 'si-LK': 'YYYY-MM-DD', - 'en-LR': 'MM/DD/YYYY', - 'en-LS': 'DD/MM/YYYY', - 'ar-MA': 'DD/MM/YYYY', - 'ro-MD': 'DD.MM.YYYY', - 'mk-MK': 'DD.MM.YYYY', - 'my-MM': 'DD/MM/YYYY', - 'mn-MN': 'YYYY.MM.DD', - 'zh-MO': 'DD/MM/YYYY', - 'en-MU': 'DD/MM/YYYY', - 'dv-MV': 'DD/MM/YYYY', - 'en-MW': 'DD/MM/YYYY', - 'es-MX': 'DD/MM/YYYY', - 'ms-MY': 'DD/MM/YYYY', - 'en-NA': 'DD/MM/YYYY', - 'en-NG': 'DD/MM/YYYY', - 'es-NI': 'DD/MM/YYYY', - 'no-NO': 'DD.MM.YYYY', - 'ne-NP': 'YYYY/MM/DD', - 'en-NZ': 'DD/MM/YYYY', - 'es-PE': 'DD/MM/YYYY', - 'en-PG': 'DD/MM/YYYY', - 'en-PH': 'MM/DD/YYYY', - 'en-PK': 'DD/MM/YYYY', - 'ar-QA': 'DD/MM/YYYY', - 'ru-RU': 'DD.MM.YYYY', - 'ar-SA': 'DD/MM/YYYY', - 'en-SC': 'DD/MM/YYYY', - 'sv-SE': 'YYYY-MM-DD', - 'en-SG': 'DD/MM/YYYY', - 'en-SL': 'DD/MM/YYYY', - 'so-SO': 'DD/MM/YYYY', - 'en-SS': 'DD/MM/YYYY', - 'es-SV': 'DD/MM/YYYY', - 'en-SZ': 'DD/MM/YYYY', - 'th-TH': 'DD/MM/YYYY', - 'en-TT': 'MM/DD/YYYY', - 'sw-TZ': 'DD/MM/YYYY', - 'en-US': 'MM/DD/YYYY', - 'es-UY': 'DD/MM/YYYY', - 'uz-UZ': 'DD/MM/YYYY', - 'ar-YE': 'DD/MM/YYYY', - 'en-ZA': 'YYYY/MM/DD', - 'ar-KW': 'DD/MM/YYYY', - 'ar-BH': 'DD/MM/YYYY', - 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman) -}; - -/** - * Parses a date string based on a specific format. - * - * @param dateString The date string to parse. - * @param format The format to use for parsing. - * @returns The parsed Date object or null if parsing fails. - */ -const parseDateWithFormat = (dateString, format) => { - // Determine the separator based on the format (supports '/', '.', or '-') - const separator = format.includes('/') - ? '/' - : format.includes('.') - ? '.' - : '-'; - const formatParts = format.split(separator); - const dateParts = dateString.split(separator).map((num) => parseInt(num, 10)); - let year = 0, month = 0, day = 0; - let yearSet = false, monthSet = false, daySet = false; - // Check for format and date string mismatch - if (dateParts.length !== formatParts.length) { - return null; // Mismatch between date string and format - } - formatParts.forEach((part, index) => { - // Check for non-numeric values in date string - if (isNaN(dateParts[index])) { - return null; // Invalid date part - } - // Assign year, month, and day based on the format - switch (part) { - case 'DD': - day = dateParts[index]; - daySet = true; - break; - case 'MM': - month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date - monthSet = true; - break; - case 'YYYY': - year = dateParts[index]; - yearSet = true; - break; - } - }); - // Validate and create the date only if all parts are set - if (yearSet && monthSet && daySet) { - const parsedDate = new Date(year, month, day); - // Validate date to catch invalid dates like February 30th - if (parsedDate.getFullYear() === year && - parsedDate.getMonth() === month && - parsedDate.getDate() === day) { - return parsedDate; - } - } - return null; // Invalid date or incomplete date information -}; -var parseDateWithFormat$1 = withErrorBoundary(parseDateWithFormat); - -/** - * Attempts to parse a string into a date object based on locale. - * Uses the localeDateFormats mapping for determining the date format. - * - * @param dateString - The date string to parse. - * @param locale - The locale to use for parsing. - * @returns The parsed Date object or null if parsing fails. - */ -const parseDate = (dateString, locale) => { - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) - locale = state.getState().locale || getLocale(); - const format = LOCALE_DATE_FORMATS[locale]; - if (!format) { - throw new Error(`No date format found for locale: ${locale}`); - } - return parseDateWithFormat$1(dateString, format); -}; -var parseDate$1 = withErrorBoundary(parseDate); - -/** - * Subtracts a specified amount of time from a date. - * - * @param date The original date. - * @param value The amount to subtract. - * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years'). - * @returns A new Date object with the time subtracted. - */ -const subtract = (date, value, unit) => { - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - return add$1(date, -value, unit); // Reuse the add function with negative value -}; -var subtract$1 = withErrorBoundary(subtract); - -export { add$1 as add, formatDate$1 as formatDate, formatDateTime$1 as formatDateTime, formatNumber$1 as formatNumber, formatNumberByParts$1 as formatNumberByParts, formatPhoneNumber$1 as formatPhoneNumber, formatTime$1 as formatTime, getCurrencyList$1 as getCurrencyList, getCurrencySymbol$1 as getCurrencySymbol, getFirstDayOfWeek$1 as getFirstDayOfWeek, getQuarter$1 as getQuarter, getRelativeTime$1 as getRelativeTime, getState$1 as getState, getWeek$1 as getWeek, getWeekdays$1 as getWeekdays, isAfter$1 as isAfter, isBefore$1 as isBefore, isLeapYear$1 as isLeapYear, isSameDay$1 as isSameDay, isValidDate$1 as isValidDate, isValidPhoneNumber$1 as isValidPhoneNumber, parseDate$1 as parseDate, parsePhoneNumber$1 as parsePhoneNumber, resetState$1 as resetState, setState$1 as setState, subtract$1 as subtract }; -//# sourceMappingURL=index.js.map diff --git a/lib/esm/index.js.map b/lib/esm/index.js.map deleted file mode 100644 index 1d363bef..00000000 --- a/lib/esm/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sources":["../../src/common/errorBoundary/index.ts","../../src/modules/.internal/utils/getDefaultState.ts","../../src/modules/.internal/state/index.ts","../../src/modules/core/getState.ts","../../src/modules/core/setState.ts","../../src/modules/core/resetState.ts","../../src/modules/.internal/utils/getLocale.ts","../../src/modules/.internal/utils/getIntlInstanceWithOptions.ts","../../src/modules/currency/formatNumber.ts","../../src/modules/currency/data/currencies.ts","../../src/modules/currency/getCurrencyList.ts","../../src/modules/currency/getCurrencySymbol.ts","../../src/modules/currency/constants.ts","../../src/modules/currency/formatNumberByParts.ts","../../src/modules/phoneNumber/data/phoneRegexMapper.ts","../../src/modules/phoneNumber/data/dialCodeMapper.ts","../../src/modules/phoneNumber/utils.ts","../../src/modules/phoneNumber/isValidPhoneNumber.ts","../../src/modules/phoneNumber/data/phoneFormatterMapper.ts","../../src/modules/phoneNumber/formatPhoneNumber.ts","../../src/modules/phoneNumber/parsePhoneNumber.ts","../../src/modules/dateTime/utils.ts","../../src/modules/dateTime/add.ts","../../src/modules/dateTime/formatDateTime.ts","../../src/modules/dateTime/formatDate.ts","../../src/modules/dateTime/formatTime.ts","../../src/modules/dateTime/getFirstDayOfWeek.ts","../../src/modules/dateTime/getQuarter.ts","../../src/modules/dateTime/getRelativeTime.ts","../../src/modules/dateTime/getWeek.ts","../../src/modules/dateTime/getWeekdays.ts","../../src/modules/dateTime/isAfter.ts","../../src/modules/dateTime/isBefore.ts","../../src/modules/dateTime/isLeapYear.ts","../../src/modules/dateTime/isSameDay.ts","../../src/modules/dateTime/isValidDate.ts","../../src/modules/dateTime/data/localeDateFormats.ts","../../src/modules/dateTime/parseDateWithFormat.ts","../../src/modules/dateTime/parseDate.ts","../../src/modules/dateTime/subtract.ts"],"sourcesContent":["// Custom Error class to extend properties to error object\nexport class I18nifyError extends Error {\n timestamp: Date;\n constructor(message: string | undefined) {\n super(message);\n this.name = 'i18nify Error';\n this.timestamp = new Date();\n // more params like type of error/severity can be added in future for better debugging.\n }\n}\n\n/**\n * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block.\n * It appends additional attributes and serves as a centralized error-handling service.\n * Usage =>\n * const wrappedUtilityFn = withErrorBoundary(utilityFn)\n *\n * @param fn utility that is wrapped in error boundary\n * @returns {Function} returns the function wrapped in try/catch block\n */\nexport const withErrorBoundary = any>(\n fn: T,\n): ((...args: Parameters) => ReturnType) => {\n return function (this: unknown, ...rest: Parameters): ReturnType {\n try {\n return fn.call(this, ...rest) as ReturnType;\n } catch (err) {\n console.warn('[I18N Error]: ', err);\n // Currently, we are throwing the error as it is to consumers.\n // In the future, this can be modified as per our requirement, like an error logging service.\n throw new I18nifyError(err as string | undefined);\n }\n };\n};\n","import type { I18nState } from '../state/types';\n\nexport function getDefaultState(): I18nState {\n return {\n locale: '',\n direction: '',\n country: '',\n };\n}\n","import { I18nState } from './types';\nimport { getDefaultState } from '../utils/getDefaultState';\n\nexport class I18nStateManager {\n private static instance: I18nStateManager | undefined;\n private state: I18nState;\n\n private constructor() {\n this.state = getDefaultState();\n }\n\n public static getInstance(): I18nStateManager {\n if (!I18nStateManager.instance) {\n I18nStateManager.instance = new I18nStateManager();\n }\n\n return I18nStateManager.instance;\n }\n\n public static resetInstance(): void {\n I18nStateManager.instance = undefined;\n }\n\n public getState(): I18nState {\n return { ...this.state };\n }\n\n public setState(newState: Partial): void {\n this.state = { ...this.state, ...newState };\n }\n\n public resetState(): void {\n this.state = getDefaultState();\n }\n}\n\nexport default I18nStateManager.getInstance();\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * function to return active i18n state\n *\n * ===== USAGE =====\n * import { getState } from '@razorpay/i18nify-js';\n *\n * console.log(getState())\n *\n * @returns i18n state\n */\nconst getState = (): I18nState => {\n return state.getState();\n};\n\nexport default withErrorBoundary(getState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * Function to set and override the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { setState } from \"@razorpay/i18nify-js\";\n * setState({locale: 'en-US'})\n *\n * @param newState data to set in i18nState instance\n */\nconst setState = (newState: Partial): void => {\n state.setState(newState);\n};\n\nexport default withErrorBoundary(setState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\n\n/**\n * Function to reset the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { resetState } from \"@razorpay/i18nify-js\";\n * resetState()\n *\n * @param newState data to set in i18nState instance\n */\nconst resetState = (): void => {\n state.resetState();\n};\n\nexport default withErrorBoundary(resetState);\n","export const getLocale = (): string => {\n // Check if running in a non-browser environment (e.g., Node.js or older browsers).\n if (typeof navigator === 'undefined') {\n return 'en-IN';\n }\n\n // Check if the browser supports the Intl object and user language preferences.\n if (\n window.Intl &&\n typeof window.Intl === 'object' &&\n (window.navigator.languages || window.navigator.language)\n ) {\n const userLocales = window.navigator.languages || [\n window.navigator.language,\n ];\n return userLocales[0];\n }\n\n // Fallback to a supported locale or the default locale.\n return 'en-IN';\n};\n","import { CURRENCIES } from '../../currency/data/currencies';\nimport state from '../state';\nimport { getLocale } from './getLocale';\n\nexport const getIntlInstanceWithOptions = (\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n) => {\n /** retrieve locale from below areas in order of preference\n * 1. options.locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n let locale = options?.locale || state.getState().locale;\n\n // If a specific locale is provided, use it; otherwise, use the browser's locale\n if (!locale) {\n locale = getLocale();\n }\n\n const intlOptions = options?.intlOptions ? { ...options.intlOptions } : {};\n\n if (options?.currency || intlOptions.currency) {\n intlOptions.style = 'currency';\n intlOptions.currency = (options.currency || intlOptions.currency) as string;\n }\n\n if (!locale) throw new Error('Pass valid locale !');\n\n return new Intl.NumberFormat(locale || undefined, intlOptions);\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\n\n// this function formats number based on different arguments passed\nconst formatNumber = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): string => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n let formattedAmount = '';\n\n try {\n formattedAmount = getIntlInstanceWithOptions(options).format(\n Number(amount),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedAmount;\n};\n\nexport default withErrorBoundary(formatNumber);\n","export const CURRENCIES: { [key: string]: { symbol: string; name: string } } = {\n AED: { symbol: 'د.إ', name: 'United Arab Emirates Dirham' },\n ALL: { symbol: 'Lek', name: 'Albanian Lek' },\n AMD: { symbol: '֏', name: 'Armenian Dram' },\n ARS: { symbol: 'ARS', name: 'Argentine Peso' },\n AUD: { symbol: 'A$', name: 'Australian Dollar' },\n AWG: { symbol: 'Afl.', name: 'Aruban Florin' },\n BBD: { symbol: '$', name: 'Barbadian Dollar' },\n BDT: { symbol: '৳', name: 'Bangladeshi Taka' },\n BMD: { symbol: '$', name: 'Bermudian Dollar' },\n BND: { symbol: 'BND', name: 'Brunei Dollar' },\n BOB: { symbol: 'Bs', name: 'Bolivian Boliviano' },\n BSD: { symbol: 'B$', name: 'Bahamian Dollar' },\n BWP: { symbol: 'P', name: 'Botswanan Pula' },\n BZD: { symbol: 'BZ$', name: 'Belize Dollar' },\n CAD: { symbol: 'C$', name: 'Canadian Dollar' },\n CHF: { symbol: 'CHf', name: 'Swiss Franc' },\n CNY: { symbol: '¥', name: 'Chinese Yuan' },\n COP: { symbol: 'COL$', name: 'Colombian Peso' },\n CRC: { symbol: '₡', name: 'Costa Rican Colón' },\n CUP: { symbol: '$MN', name: 'Cuban Peso' },\n CZK: { symbol: 'Kč', name: 'Czech Koruna' },\n DKK: { symbol: 'DKK', name: 'Danish Krone' },\n DOP: { symbol: 'RD$', name: 'Dominican Peso' },\n DZD: { symbol: 'د.ج', name: 'Algerian Dinar' },\n EGP: { symbol: 'E£', name: 'Egyptian Pound' },\n ETB: { symbol: 'ብር', name: 'Ethiopian Birr' },\n EUR: { symbol: '€', name: 'Euro' },\n FJD: { symbol: 'FJ$', name: 'Fijian Dollar' },\n GBP: { symbol: '£', name: 'British Pound' },\n GHS: { symbol: 'GH₵', name: 'Ghanaian Cedi' },\n GIP: { symbol: 'GIP', name: 'Gibraltar Pound' },\n GMD: { symbol: 'D', name: 'Gambian Dalasi' },\n GTQ: { symbol: 'Q', name: 'Guatemalan Quetzal' },\n GYD: { symbol: 'G$', name: 'Guyanese Dollar' },\n HKD: { symbol: 'HK$', name: 'Hong Kong Dollar' },\n HNL: { symbol: 'HNL', name: 'Honduran Lempira' },\n HRK: { symbol: 'kn', name: 'Croatian Kuna' },\n HTG: { symbol: 'G', name: 'Haitian Gourde' },\n HUF: { symbol: 'Ft', name: 'Hungarian Forint' },\n IDR: { symbol: 'Rp', name: 'Indonesian Rupiah' },\n ILS: { symbol: '₪', name: 'Israeli New Shekel' },\n INR: { symbol: '₹', name: 'Indian Rupee' },\n JMD: { symbol: 'J$', name: 'Jamaican Dollar' },\n KES: { symbol: 'Ksh', name: 'Kenyan Shilling' },\n KGS: { symbol: 'Лв', name: 'Kyrgystani Som' },\n KHR: { symbol: '៛', name: 'Cambodian Riel' },\n KYD: { symbol: 'CI$', name: 'Cayman Islands Dollar' },\n KZT: { symbol: '₸', name: 'Kazakhstani Tenge' },\n LAK: { symbol: '₭', name: 'Laotian Kip' },\n LKR: { symbol: 'රු', name: 'Sri Lankan Rupee' },\n LRD: { symbol: 'L$', name: 'Liberian Dollar' },\n LSL: { symbol: 'LSL', name: 'Lesotho Loti' },\n MAD: { symbol: 'د.م.', name: 'Moroccan Dirham' },\n MDL: { symbol: 'MDL', name: 'Moldovan Leu' },\n MKD: { symbol: 'ден', name: 'Macedonian Denar' },\n MMK: { symbol: 'MMK', name: 'Myanmar Kyat' },\n MNT: { symbol: '₮', name: 'Mongolian Tugrik' },\n MOP: { symbol: 'MOP$', name: 'Macanese Pataca' },\n MUR: { symbol: '₨', name: 'Mauritian Rupee' },\n MVR: { symbol: 'Rf', name: 'Maldivian Rufiyaa' },\n MWK: { symbol: 'MK', name: 'Malawian Kwacha' },\n MXN: { symbol: 'Mex$', name: 'Mexican Peso' },\n MYR: { symbol: 'RM', name: 'Malaysian Ringgit' },\n NAD: { symbol: 'N$', name: 'Namibian Dollar' },\n NGN: { symbol: '₦', name: 'Nigerian Naira' },\n NIO: { symbol: 'NIO', name: 'Nicaraguan Córdoba' },\n NOK: { symbol: 'NOK', name: 'Norwegian Krone' },\n NPR: { symbol: 'रू', name: 'Nepalese Rupee' },\n NZD: { symbol: 'NZ$', name: 'New Zealand Dollar' },\n PEN: { symbol: 'S/', name: 'Peruvian Nuevo Sol' },\n PGK: { symbol: 'PGK', name: 'Papua New Guinean Kina' },\n PHP: { symbol: '₱', name: 'Philippine Peso' },\n PKR: { symbol: '₨', name: 'Pakistani Rupee' },\n QAR: { symbol: 'QR', name: 'Qatari Riyal' },\n RUB: { symbol: '₽', name: 'Russian Ruble' },\n SAR: { symbol: 'SR', name: 'Saudi Riyal' },\n SCR: { symbol: 'SRe', name: 'Seychellois Rupee' },\n SEK: { symbol: 'SEK', name: 'Swedish Krona' },\n SGD: { symbol: 'S$', name: 'Singapore Dollar' },\n SLL: { symbol: 'Le', name: 'Sierra Leonean Leone' },\n SOS: { symbol: 'Sh.so.', name: 'Somali Shilling' },\n SSP: { symbol: 'SS£', name: 'South Sudanese Pound' },\n SVC: { symbol: '₡', name: 'Salvadoran Colón' },\n SZL: { symbol: 'E', name: 'Swazi Lilangeni' },\n THB: { symbol: '฿', name: 'Thai Baht' },\n TTD: { symbol: 'TT$', name: 'Trinidad and Tobago Dollar' },\n TZS: { symbol: 'Sh', name: 'Tanzanian Shilling' },\n USD: { symbol: '$', name: 'United States Dollar' },\n UYU: { symbol: '$U', name: 'Uruguayan Peso' },\n UZS: { symbol: \"so'm\", name: 'Uzbekistani Som' },\n YER: { symbol: '﷼', name: 'Yemeni Rial' },\n ZAR: { symbol: 'R', name: 'South African Rand' },\n KWD: { symbol: 'د.ك', name: 'Kuwaiti Dinar' },\n BHD: { symbol: 'د.ب.', name: 'Bahraini Dinar' },\n OMR: { symbol: 'ر.ع.', name: 'Omani Rial' },\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencyList = () => {\n return CURRENCIES;\n};\n\nexport default withErrorBoundary(getCurrencyList);\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencySymbol = (currencyCode: keyof typeof CURRENCIES): string => {\n if (currencyCode in CURRENCIES) return CURRENCIES[currencyCode]?.symbol;\n else throw new Error('Invalid currencyCode!');\n};\n\nexport default withErrorBoundary(getCurrencySymbol);\n","export const ALLOWED_FORMAT_PARTS_KEYS = [\n 'nan',\n 'infinity',\n 'percent',\n 'integer',\n 'group',\n 'decimal',\n 'fraction',\n 'plusSign',\n 'minusSign',\n 'percentSign',\n 'currency',\n 'code',\n 'symbol',\n 'name',\n 'compact',\n 'exponentInteger',\n 'exponentMinusSign',\n 'exponentSeparator',\n 'unit',\n] as const;\n","import { CURRENCIES } from './data/currencies';\nimport { ByParts, FormattedPartsObject } from './types';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\nimport { ALLOWED_FORMAT_PARTS_KEYS } from './constants';\n\nconst formatNumberByParts = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): ByParts => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n try {\n const formattedAmount = getIntlInstanceWithOptions(options).formatToParts(\n Number(amount),\n );\n\n const parts = formattedAmount;\n\n const formattedObj: FormattedPartsObject = {};\n\n parts.forEach((p) => {\n if (p.type === 'group') {\n formattedObj.integer = (formattedObj.integer || '') + p.value;\n } else if (\n ALLOWED_FORMAT_PARTS_KEYS.findIndex((item) => item === p.type) != -1\n ) {\n // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal' is skipped\n formattedObj[p.type] = (formattedObj[p.type] || '') + p.value;\n }\n });\n\n return {\n ...formattedObj,\n isPrefixSymbol: parts[0].type === 'currency',\n rawParts: parts,\n };\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(\n formatNumberByParts,\n);\n","export const PHONE_REGEX_MAPPER: { [key: string]: RegExp } = {\n IN: /^(?:(?:\\+|0{0,2})91\\s*[-]?\\s*|[0]?)?[6789]\\d{9}$/,\n MY: /^(\\+?6?0)?(\\d{1,3})[-. ]?(\\d{7,8})$/,\n AE: /^(?:\\+?971|0)?(?:2|3|4|6|7|9)\\d{8}$/,\n AL: /^(?:\\+?355)?(?:[4-9]\\d{7}|6\\d{8})$/,\n AM: /^(?:\\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/,\n AR: /^(?:(?:\\+|0{0,2})54)?(?:11|[2368]\\d)(?:(?=\\d{0,2}15)\\d{2})??\\d{8}$/,\n AU: /^(?:\\+?61|0)4\\d{8}$/,\n AW: /^(?:(?:\\+297)?(?!0)\\d{7})$/,\n BB: /^(?:(?:\\+1)?246)?(?:\\d{3})?\\d{7}$/,\n BD: /^(?:\\+?880|0)1[13456789]\\d{8}$/,\n BM: /^(?:(?:\\+1)?441)?(?:\\d{2})?\\d{7}$/,\n BN: /^(?:\\+?673)?(?:\\d{3})?\\d{4}$/,\n BO: /^(?:(?:\\+|0{0,2})591)?(?:(?:2|3|7|6)\\d{7})$/,\n BS: /^(?:(?:\\+1)?242)?(?:\\d{3})?\\d{7}$/,\n BW: /^(?:(?:\\+267)?\\s?)?[74]\\d{7}$/,\n BZ: /^(?:(?:\\+501)?\\s?)?[622]\\d{4}$/,\n CH: /^(?:(?:\\+41|0)(?:\\s*\\(?0\\)?\\s*))?(?:\\d{2}\\s*)?\\d{3}\\s*\\d{2}\\s*\\d{2}$/,\n CN: /^(?:(?:\\+|00)86)?1\\d{10}$/,\n CO: /^(?:(?:\\+57|0057)?)?[1-8]{1}\\d{6,7}$/,\n OM: /^(?:\\+?968)?(?:95|96|97|98)\\d{6}$/,\n CR: /^(?:(?:\\+506)?\\s*|0)?[1-9]\\d{7}$/,\n CU: /^(?:\\+?53)?(?:[5-8]\\d{7})$/,\n CZ: /^(?:\\+?420)?(?:\\d{9})$/,\n DK: /^(?:\\+?45)?(?:\\d{8})$/,\n DO: /^(?:(?:\\+1)?809|1-8(?:00|88|89))(?:\\d{7})$/,\n DZ: /^(?:\\+?213|0)([567]\\d{8})$/,\n EG: /^(?:(?:\\+20|20)?(\\d{10}))$/,\n ET: /^(?:\\+?251)?[1-59]\\d{8}$/,\n EU: /^(?:(?:\\+?3)?8)?\\s*(?:\\d{3}\\s*){3}\\d{2}$/,\n FJ: /^(?:(?:\\+?679)?\\s?\\d{3}\\s?\\d{4})?$/,\n GB: /^(?:(?:\\+44\\s?|0)7\\d{3}(\\s?\\d{4,})?)$/,\n GH: /^(?:(?:\\+233)|0)?(?:\\d{9})$/,\n GI: /^(?:\\+350)?\\d{5}$/,\n GM: /^(?:\\+220)?\\d{5,7}$/,\n GT: /^(?:\\+502)?[2468]\\d{7,8}$/,\n GY: /^(?:(?:\\+592)?(?:(?:\\s)?[2-9])(?:(?:\\s)?\\d))?(?:(?:\\s)?\\d{4})$/,\n HK: /^(?:\\+852\\s?)?[456789]\\d{3}\\s?\\d{4}$/,\n HN: /^(?:\\+504)?[89]\\d{7}$/,\n HR: /^(?:\\+?385)?\\d{8,9}$/,\n HT: /^(?:\\+?509)?\\d{8}$/,\n HU: /^(?:(?:\\+36))(\\s?\\d{2}\\s?\\d{3}\\s?\\d{4})$/,\n ID: /^(?:\\+?62|0[1-9])[\\s-]?\\d{2,4}[\\s-]?\\d{3,4}[\\s-]?\\d{3,4}$/,\n IL: /^(?:(?:\\+972|0)(?:-)?)[23489]\\d{7}$/,\n JM: /^(?:(?:\\+1876))\\d{7,10}$/,\n KE: /^(?:(?:\\+254)|(?:0))(?:\\d{6,7})$/,\n KG: /^(?:\\+996)?\\s?\\d{9}$/,\n KH: /^(?:(?:\\+855)|(?:0))(?:\\s?[1-9]\\d{7,8})$/,\n KY: /^(?:\\+?1\\s?(345))\\d{6}$/,\n KZ: /^(?:\\+?7|8)?7\\d{9}$/,\n LA: /^(?:(?:\\+?856)|0)(20\\d{7,9})$/,\n LK: /^(?:(?:\\+94)|0)(?:\\d{9})$/,\n LR: /^(?:\\+231)[ -\\d]{4}[ -\\d]{4}$/,\n LS: /^(?:(?:\\+?266)|0)?[56]\\d{7}$/,\n MA: /^(?:(?:\\+?212(\\s*[-|\\s*]?\\d{1,9})?)|(?:0))(?:\\d{9})$/,\n MD: /^(?:(?:\\+373)|(?:0))(?:\\d{7,8})$/,\n MK: /^(?:\\+389|0)(?:(?:2[0-4]|[3-9])\\s?)?\\d{6}$/,\n MM: /^(?:(?:\\+?95)|0)?[1-9]\\d{9}$/,\n MN: /^(?:\\+976|0)\\d{8}$/,\n MO: /^(?:(?:\\+?853)|[0-9])?\\d{8}$/,\n MU: /^(?:\\+230|0)?\\d{8}$/,\n MV: /^(?:(?:\\+?960)|0)?\\d{7}$/,\n MW: /^(?:\\+265)[1-9]\\d{6}$/,\n MX: /^(?:(?:\\+?52)?\\s?(?:1|01)?\\s?)?(?:\\d{3}\\s?\\d{3}\\s?\\d{4})$/,\n NA: /^(?:(?:\\+264)|0)?\\d{8}$/,\n NG: /^(?:(?:\\+234)|(?:0))(?:\\d{7,8})$/,\n NI: /^(?:(?:\\+505))?(?:\\d{8})$/,\n NO: /^(?:(?:\\+?47)|\\d{2}|\\d{3})\\s?\\d{2}\\s?\\d{3}$/,\n NP: /^(?:(?:\\+977))?(\\d{9,10})$/,\n NZ: /^(?:\\+?64|0)(\\d{2,5} \\d{4,8}|\\d{3,4} \\d{4})$/,\n PE: /^(?:(?:\\+51)|0)?(?:9\\d{8})$/,\n PG: /^(?:\\+?675)?(?:[7-9]\\d{7})$/,\n PH: /^(?:(?:\\+?63)|0)(?:\\d{10})$/,\n PK: /^(?:(?:\\+92)|0)?[345]\\d{9}$/,\n QA: /^(?:\\+?974)?-?33\\d{5}$/,\n RU: /^(?:\\+?7|8)?[ -]?\\(?9\\d{2}\\)?[ -]?\\d{3}[ -]?\\d{2}[ -]?\\d{2}$/,\n SA: /^(?:\\+?966)?\\s?1?[\\s-]?(?:[45]\\d{2}|5\\d{3})[\\s-]?\\d{4}$/,\n SC: /^(?:(?:\\+248)|\\d{4})\\d{5}$/,\n SE: /^(?:\\+?46|0)\\s?[1-57-9](?:[0-9]\\s?){8}$/,\n SG: /^(?:(?:\\+65)|(?:\\(\\+65\\))|(?:65))\\d{4}\\d{4}$/,\n SL: /^(?:(?:\\+232)|(?:0))?\\d{9}$/,\n SO: /^(?:\\+252|0)?[567]\\d{7}$/,\n SS: /^(?:\\+211|0)?[1-9]\\d{7,9}$/,\n SV: /^(?:(?:\\+?503)|(?:0))(?:\\d{8})$/,\n SZ: /^(?:\\+?268)?\\d{7,8}$/,\n TH: /^(?:(?:\\+66)|0)\\d{9}$/,\n TT: /^(?:(?:\\+?1-868)|\\(?868\\)?)(\\d{7})$/,\n TZ: /^(?:(?:\\+?255)|0)?[67]\\d{8}$/,\n US: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n CA: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n UY: /^(?:(?:\\+598|0)\\s?(9\\d{3}|2\\d{2}|[4-9]\\d{6}))$/,\n UZ: /^(?:\\+?998)?\\s?[3456789]\\d{8}$/,\n YE: /^(?:\\+?967)?(?:\\d{7,8})$/,\n ZA: /^(?:(?:\\+27)|0)(\\d{9})$/,\n KW: /^(?:\\+?965)[569]\\d{7}$/,\n BH: /^(?:\\+?973)?[356]\\d{7}$/,\n TL: /^(?:(?:\\+670)\\s?)?[0-9]{3}\\s?[0-9]{3,4}$/,\n VC: /^(?:(?:\\+1)?784)?(?:\\d{3})?\\d{7}$/,\n VE: /^(?:(?:\\+58)|0)?4\\d{9}$/,\n VN: /^(?:(?:\\+84)|0)?[1-9]\\d{8}$/,\n ZM: /^(?:(?:\\+260)|0)?[123456789]\\d{8,9}$/,\n ZW: /^(?:(?:\\+263)|0)?(?:\\d{9,10})$/,\n LT: /^(?:(?:\\+370)|8)\\d{8}$/,\n LU: /^(?:(?:\\+352)?(6|2(6|7|8|9))\\d{6})$/,\n LV: /^(?:(?:\\+371)?2\\d{7})$/,\n ME: /^(?:(?:\\+382)?[67]\\d{7,20})$/,\n MG: /^(?:(?:\\+261)?3[234568]\\d{7})$/,\n MZ: /^(?:(?:\\+258)|(?:258))?8[234567]\\d{7,8}$/,\n NL: /^(?:(?:\\+31)|0(6(?:\\d{8})|[1-9](?:(?:\\d{8})|(?:\\s\\d{3}\\s\\d{4}))|(?:\\d{8})))$/,\n PA: /^(?:(?:\\+507)\\s?)?[46]\\d{6,7}$/,\n PL: /^(?:(?:\\+48)?(?:\\s?\\d{3}\\s?\\d{3}\\s?\\d{3}|(?:\\d{2}\\s?){4}\\d{2}|\\d{3}-\\d{3}-\\d{3}))$/,\n PR: /^(?:(?:\\+1)?787|939)\\d{7}$/,\n PS: /^(?:(?:\\+970))(5[2349])\\d{7}$/,\n PT: /^(?:(?:\\+351)?9(1\\d|2[1-9]|6[12345789]|7[12345789])\\d{7})$/,\n PY: /^(?:(?:\\+595|0)9[9876]\\d{7})$/,\n RO: /^(?:(?:\\+40|0))(?:7[2-8]\\d{7}|21\\d{8})$/,\n RS: /^(?:(?:\\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/,\n RW: /^(?:(?:\\+250)|(0))\\d{9}$/,\n SI: /^(?:(?:\\+386)|0)?[1-59]\\d{7,8}$/,\n SK: /^(?:(?:\\+421))?(0|9[0-8])\\d{8}$/,\n SM: /^(?:(?:\\+378)|(0549|6\\d{4}))\\d{5}$/,\n SN: /^(?:(?:\\+221)|0)?[3679]\\d{7}$/,\n SR: /^(?:(?:\\+597))\\d{7}$/,\n TG: /^(?:(?:\\+228))\\d{8}$/,\n TJ: /^(?:(?:\\+992))(37|55|77)\\d{7}$/,\n TN: /^(?:(?:\\+216)|22|9[1-9])\\d{7}$/,\n TR: /^(?:(?:\\+90)|(0))\\s?5\\d{9}$/,\n TW: /^(?:(?:\\+886)|0)?9\\d{8}$/,\n UA: /^(?:(?:\\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\\d{7}$/,\n UG: /^(?:(?:\\+256)|0)?[39]\\d{8}$/,\n};\n","/* Source: Google LibPhoneNumber Metadata: https://github.com/google/libphonenumber/blob/master/javascript/i18n/phonenumbers/metadata.js */\n\nexport const DIAL_CODE_MAPPER: { [key: number]: string[] } = {\n 1: [\n 'US',\n 'AG',\n 'AI',\n 'AS',\n 'BB',\n 'BM',\n 'BS',\n 'CA',\n 'DM',\n 'DO',\n 'GD',\n 'GU',\n 'JM',\n 'KN',\n 'KY',\n 'LC',\n 'MP',\n 'MS',\n 'PR',\n 'SX',\n 'TC',\n 'TT',\n 'VC',\n 'VG',\n 'VI',\n ],\n 7: ['RU', 'KZ'],\n 20: ['EG'],\n 27: ['ZA'],\n 30: ['GR'],\n 31: ['NL'],\n 32: ['BE'],\n 33: ['FR'],\n 34: ['ES'],\n 36: ['HU'],\n 39: ['IT', 'VA'],\n 40: ['RO'],\n 41: ['CH'],\n 43: ['AT'],\n 44: ['GB', 'GG', 'IM', 'JE'],\n 45: ['DK'],\n 46: ['SE'],\n 47: ['NO', 'SJ'],\n 48: ['PL'],\n 49: ['DE'],\n 51: ['PE'],\n 52: ['MX'],\n 53: ['CU'],\n 54: ['AR'],\n 55: ['BR'],\n 56: ['CL'],\n 57: ['CO'],\n 58: ['VE'],\n 60: ['MY'],\n 61: ['AU', 'CC', 'CX'],\n 62: ['ID'],\n 63: ['PH'],\n 64: ['NZ'],\n 65: ['SG'],\n 66: ['TH'],\n 81: ['JP'],\n 82: ['KR'],\n 84: ['VN'],\n 86: ['CN'],\n 90: ['TR'],\n 91: ['IN'],\n 92: ['PK'],\n 93: ['AF'],\n 94: ['LK'],\n 95: ['MM'],\n 98: ['IR'],\n 211: ['SS'],\n 212: ['MA', 'EH'],\n 213: ['DZ'],\n 216: ['TN'],\n 218: ['LY'],\n 220: ['GM'],\n 221: ['SN'],\n 222: ['MR'],\n 223: ['ML'],\n 224: ['GN'],\n 225: ['CI'],\n 226: ['BF'],\n 227: ['NE'],\n 228: ['TG'],\n 229: ['BJ'],\n 230: ['MU'],\n 231: ['LR'],\n 232: ['SL'],\n 233: ['GH'],\n 234: ['NG'],\n 235: ['TD'],\n 236: ['CF'],\n 237: ['CM'],\n 238: ['CV'],\n 239: ['ST'],\n 240: ['GQ'],\n 241: ['GA'],\n 242: ['CG'],\n 243: ['CD'],\n 244: ['AO'],\n 245: ['GW'],\n 246: ['IO'],\n 247: ['AC'],\n 248: ['SC'],\n 249: ['SD'],\n 250: ['RW'],\n 251: ['ET'],\n 252: ['SO'],\n 253: ['DJ'],\n 254: ['KE'],\n 255: ['TZ'],\n 256: ['UG'],\n 257: ['BI'],\n 258: ['MZ'],\n 260: ['ZM'],\n 261: ['MG'],\n 262: ['RE', 'YT'],\n 263: ['ZW'],\n 264: ['NA'],\n 265: ['MW'],\n 266: ['LS'],\n 267: ['BW'],\n 268: ['SZ'],\n 269: ['KM'],\n 290: ['SH', 'TA'],\n 291: ['ER'],\n 297: ['AW'],\n 298: ['FO'],\n 299: ['GL'],\n 350: ['GI'],\n 351: ['PT'],\n 352: ['LU'],\n 353: ['IE'],\n 354: ['IS'],\n 355: ['AL'],\n 356: ['MT'],\n 357: ['CY'],\n 358: ['FI', 'AX'],\n 359: ['BG'],\n 370: ['LT'],\n 371: ['LV'],\n 372: ['EE'],\n 373: ['MD'],\n 374: ['AM'],\n 375: ['BY'],\n 376: ['AD'],\n 377: ['MC'],\n 378: ['SM'],\n 380: ['UA'],\n 381: ['RS'],\n 382: ['ME'],\n 383: ['XK'],\n 385: ['HR'],\n 386: ['SI'],\n 387: ['BA'],\n 389: ['MK'],\n 420: ['CZ'],\n 421: ['SK'],\n 423: ['LI'],\n 500: ['FK'],\n 501: ['BZ'],\n 502: ['GT'],\n 503: ['SV'],\n 504: ['HN'],\n 505: ['NI'],\n 506: ['CR'],\n 507: ['PA'],\n 508: ['PM'],\n 509: ['HT'],\n 590: ['GP', 'BL', 'MF'],\n 591: ['BO'],\n 592: ['GY'],\n 593: ['EC'],\n 594: ['GF'],\n 595: ['PY'],\n 596: ['MQ'],\n 597: ['SR'],\n 598: ['UY'],\n 599: ['CW', 'BQ'],\n 670: ['TL'],\n 672: ['NF'],\n 673: ['BN'],\n 674: ['NR'],\n 675: ['PG'],\n 676: ['TO'],\n 677: ['SB'],\n 678: ['VU'],\n 679: ['FJ'],\n 680: ['PW'],\n 681: ['WF'],\n 682: ['CK'],\n 683: ['NU'],\n 685: ['WS'],\n 686: ['KI'],\n 687: ['NC'],\n 688: ['TV'],\n 689: ['PF'],\n 690: ['TK'],\n 691: ['FM'],\n 692: ['MH'],\n 800: ['001'],\n 808: ['001'],\n 850: ['KP'],\n 852: ['HK'],\n 853: ['MO'],\n 855: ['KH'],\n 856: ['LA'],\n 870: ['001'],\n 878: ['001'],\n 880: ['BD'],\n 881: ['001'],\n 882: ['001'],\n 883: ['001'],\n 886: ['TW'],\n 888: ['001'],\n 960: ['MV'],\n 961: ['LB'],\n 962: ['JO'],\n 963: ['SY'],\n 964: ['IQ'],\n 965: ['KW'],\n 966: ['SA'],\n 967: ['YE'],\n 968: ['OM'],\n 970: ['PS'],\n 971: ['AE'],\n 972: ['IL'],\n 973: ['BH'],\n 974: ['QA'],\n 975: ['BT'],\n 976: ['MN'],\n 977: ['NP'],\n 979: ['001'],\n 992: ['TJ'],\n 993: ['TM'],\n 994: ['AZ'],\n 995: ['GE'],\n 996: ['KG'],\n 998: ['UZ'],\n};\n","import { DIAL_CODE_MAPPER } from './data/dialCodeMapper';\nimport { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\n\n/**\n * Determines the country code based on the provided phone number.\n * This function employs a multi-step approach to identify the country code:\n * - If the phone number starts with '+', it extracts the numeric characters\n * and matches the leading digits with known dial codes mapped to countries.\n * - For matched dial codes, it further filters based on country-specific regex patterns\n * to validate the phone number format for those countries.\n * - If the phone number doesn't start with '+', it directly matches the number\n * against regular expressions associated with various countries to identify the code.\n *\n * @param phoneNumber The input phone number (string or number).\n * @returns The detected country code or an empty string if not found.\n */\nexport const detectCountryCodeFromDialCode = (\n phoneNumber: string | number,\n): string => {\n // If the phone number starts with '+', extract numeric characters\n if (phoneNumber.toString().charAt(0) === '+') {\n const cleanedPhoneNumberWithoutPlusPrefix = phoneNumber\n .toString()\n .replace(/\\D/g, '');\n\n const matchingCountries: string[] = [];\n\n // Iterate through dial codes and check for matches with cleaned phone number\n for (const code in DIAL_CODE_MAPPER) {\n if (cleanedPhoneNumberWithoutPlusPrefix.startsWith(code)) {\n matchingCountries.push(...DIAL_CODE_MAPPER[code]);\n }\n }\n\n // Filter matching countries based on phone number validation regex\n const matchedCountryCode = matchingCountries.find((countryCode: string) => {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex && regex.test(phoneNumber.toString())) return countryCode;\n return undefined;\n });\n\n // Return the first matched country code, if any\n return matchedCountryCode || '';\n } else {\n // If phone number doesn't start with '+', directly match against country regexes\n for (const countryCode in PHONE_REGEX_MAPPER) {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex.test(phoneNumber.toString())) {\n return countryCode;\n }\n }\n }\n\n // Return empty string if no country code is detected\n return '';\n};\n\nexport const cleanPhoneNumber = (phoneNumber: string) => {\n // Regular expression to match all characters except numbers and + sign at the start\n const regex = /[^0-9+]|(?!A)\\+/g;\n // Replace matched characters with an empty string\n const cleanedPhoneNumber = phoneNumber.replace(regex, '');\n return phoneNumber[0] === '+' ? `+${cleanedPhoneNumber}` : cleanedPhoneNumber;\n};\n","import { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Validates whether a given phone number is valid based on the provided country code or auto-detects the country code and checks if the number matches the defined regex pattern for that country.\nconst isValidPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_REGEX_MAPPER,\n): boolean => {\n // Clean the provided phoneNumber by removing non-numeric characters\n const cleanedPhoneNumber = cleanPhoneNumber(phoneNumber.toString());\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_REGEX_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(cleanedPhoneNumber);\n\n // Return false if phoneNumber is empty\n if (!phoneNumber) return false;\n\n // Check if the countryCode exists in the PHONE_REGEX_MAPPER\n if (countryCode in PHONE_REGEX_MAPPER) {\n // Fetch the regex pattern for the countryCode\n const regex = PHONE_REGEX_MAPPER[countryCode];\n // Test if the cleanedPhoneNumber matches the regex pattern\n return regex.test(cleanedPhoneNumber as string);\n }\n\n // Return false if the countryCode is not supported\n return false;\n};\n\nexport default withErrorBoundary(isValidPhoneNumber);\n","export const PHONE_FORMATTER_MAPPER: { [key: string]: string } = {\n IN: 'xxxx xxxxxx',\n MY: 'xx xxxxx xx',\n AE: 'xx xxx xxxx',\n AL: 'xxx xx xxxx',\n AM: 'xx xx xx xx',\n AR: 'xxxx-xxxx',\n AU: 'xxx xxx xxx',\n AW: 'xxx-xxxx',\n BB: 'xxx-xxxx',\n BD: 'xxxx-xxxxxx',\n BM: 'xxx-xxxx',\n BN: 'xxxx-xxxx',\n BO: 'xxxx-xxxx',\n BS: 'xxx-xxxx',\n BW: 'xx xxxx xxxx',\n BZ: 'xxx-xxxx',\n CA: 'xxx-xxx-xxxx',\n CH: 'xxx xxx xxx',\n CN: 'xxxx-xxxxxxx',\n CO: 'xxxx-xxxxxxx',\n CR: 'xxxx-xxxx',\n CU: 'xxxx-xxxx',\n CZ: 'xxx xxx xxx',\n DK: 'xx xx xx xx',\n DO: 'xxx-xxxxxxx',\n DZ: 'xxxx-xxxx-xxx',\n EG: 'xx xxx xxxx',\n ET: 'xx xxx xxxx',\n EU: 'xxx xx xx xx',\n FJ: 'xxxx xxxx',\n GB: 'xxxx xxx xxx',\n GH: 'xxx xxx xxxx',\n GI: 'xxxx xxxx',\n GM: 'xxxx-xxxx',\n GT: 'xxxx-xxxx',\n GY: 'xxx-xxxx',\n HK: 'xxxx xxxx',\n HN: 'xxxx-xxxx',\n HR: 'xxx xxx xxxx',\n HT: 'xxx-xxxx',\n HU: 'xxx xxx xxxx',\n ID: 'xxxx-xxxx-xxxx',\n IL: 'xxxx-xxx-xxx',\n JM: 'xxx-xxxx',\n KE: 'xxx xxxxxx',\n KG: 'xxx-xx-xx-xx',\n KH: 'xxx-xxx-xxx',\n KY: 'xxx-xxxx',\n KZ: 'xxx-xxx-xx-xx',\n LA: 'xxx xx xxxx',\n LK: 'xx xxx xxxx',\n LR: 'xxx-xxx-xxxx',\n LS: 'xxx xx xxxx',\n LT: 'xxx xxxxx',\n LU: 'xxx xx xxx',\n LV: 'xxxx xxxx',\n MA: 'xxxx-xxxxxx',\n MD: 'xx xxxxxx',\n ME: 'xx xxxxxx',\n MG: 'xx xx xx xx xx',\n MK: 'xx xx xx xx',\n MM: 'xx xxxxxx',\n MN: 'xxx-xx-xxxx',\n MO: 'xxxx xxxx',\n MU: 'xx xxxx xxxx',\n MV: 'xxxxxx',\n MW: 'xx xxxx xxxx',\n MX: 'xxx-xxx-xxxx',\n MZ: 'xx xxxxxxx',\n NA: 'xx xxxx xxxx',\n NG: 'xxx xxx xxxx',\n NI: 'xxxx-xxxx',\n NL: 'xxx-xxxxxxx',\n NO: 'xxxx xxxx',\n NP: 'xxxx-xxxxxxx',\n NZ: 'xxx-xxxxxxx',\n OM: 'xxxx-xxxx',\n PA: 'xxx-xxxx',\n PE: 'xxx-xxx-xxx',\n PG: 'xxx-xxxxxx',\n PH: 'xxx-xxxx',\n PK: 'xxx-xxxxxxx',\n PL: 'xxx xxx xxx',\n PR: 'xxx-xxx-xxxx',\n PS: 'xxxx-xxxxxxx',\n PT: 'xxx xxx xxx',\n PY: 'xxx-xxxxxx',\n QA: 'xxxx xxxx',\n RO: 'xxx xxx xxxx',\n RS: 'xxx xxxxx',\n RU: 'xxx xxx-xx-xx',\n RW: 'xxx xxxxxx',\n SA: 'xxx-xxxxxxx',\n SC: 'xx xxxxx',\n SE: 'xxx-xxx xx xx',\n SG: 'xxxx xxxx',\n SI: 'xx xxxxxx',\n SK: 'xxx xxx xxx',\n SL: 'xxx-xxxxxx',\n SM: 'xxxxx xxxxx',\n SN: 'xx xxx xx xx',\n SO: 'xxx xxxxxxx',\n SR: 'xxx-xxxx',\n SS: 'xxx xxxx xxx',\n SV: 'xxxx-xxxx',\n SZ: 'xxx xx xxxx',\n TG: 'xx xx xx xx',\n TH: 'xxx-xxxxxxx',\n TJ: 'xxx xx xx xx',\n TL: 'xxx-xxxxxxx',\n TN: 'xx xxxxxx',\n TR: 'xxx xxx xx xx',\n TT: 'xxx-xxxx',\n TW: 'xxxx-xxxxxx',\n TZ: 'xxx xxx xxxx',\n UA: 'xx xxx xx xx',\n UG: 'xxx xxxxxxx',\n US: 'xxx-xxx-xxxx',\n UY: 'xxx-xxxxx',\n UZ: 'xxx-xxx-xx-xx',\n VC: 'xxx-xxxx',\n VE: 'xxxx-xxx-xxxx',\n VN: 'xxxx-xxxxxxx',\n YE: 'xxxx-xxxx',\n ZA: 'xxx-xxx-xxxx',\n ZM: 'xxx-xxxxxxx',\n ZW: 'xx xxx xxxx',\n KW: 'xxx xx xxxx',\n BH: 'xxxx xxxx',\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Formats a provided phone number according to the predefined format for a specific country code, or auto-detects the country code and formats the number accordingly.\nconst formatPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_FORMATTER_MAPPER,\n): string => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Convert phoneNumber to string and clean it by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_FORMATTER_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Fetch the pattern for the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern) return phoneNumber;\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n // Extract the phoneNumber without the prefix\n const phoneNumberWithoutPrefix = phoneNumber.slice(diff);\n const formattedNumber: string[] = [];\n let numberIndex = 0;\n\n // Loop through the pattern to format the phoneNumber\n for (let i = 0; i < pattern.length; i++) {\n const patternChar = pattern[i];\n if (patternChar === 'x') {\n // Insert phoneNumber digits at 'x' positions\n if (numberIndex < phoneNumberWithoutPrefix.length) {\n formattedNumber.push(phoneNumberWithoutPrefix[numberIndex]);\n numberIndex++;\n }\n } else {\n // Insert non-digit characters from the pattern\n formattedNumber.push(patternChar);\n }\n }\n\n // Join the formattedNumber array to create the formattedPhoneNumber without prefix\n const formattedPhoneNumberWithoutPrefix = formattedNumber.join('');\n // Combine the prefix and formattedPhoneNumberWithoutPrefix\n const formattedPhoneNumberWithPrefix =\n phoneNumber.slice(0, diff) + ' ' + formattedPhoneNumberWithoutPrefix;\n\n // Return the formattedPhoneNumber with prefix after trimming whitespace\n return formattedPhoneNumberWithPrefix.trim();\n};\n\nexport default withErrorBoundary(formatPhoneNumber);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport formatPhoneNumber from './formatPhoneNumber';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\ninterface PhoneInfo {\n countryCode: string;\n dialCode: string;\n formattedPhoneNumber: string;\n formatTemplate: string;\n}\n\n// Parses a given phone number, identifies its country code (if not provided), and returns an object with details including the country code, formatted phone number, dial code, and format template.\nconst parsePhoneNumber = (phoneNumber: string, country?: string): PhoneInfo => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Clean the phoneNumber by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n const countryCode =\n country && country in PHONE_FORMATTER_MAPPER\n ? country\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Format the phone number using the detected/validated country code\n const formattedPhoneNumber = formatPhoneNumber(phoneNumber, countryCode);\n\n // Fetch the pattern associated with the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern)\n return {\n countryCode: countryCode || '',\n dialCode: '',\n formattedPhoneNumber: phoneNumber,\n formatTemplate: '',\n };\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n\n // Extract the dialCode from the phoneNumber\n const dialCode = phoneNumber.slice(0, diff);\n\n // Obtain the format template associated with the countryCode\n const formatTemplate = PHONE_FORMATTER_MAPPER[countryCode];\n\n // Return the parsed phone number information\n return {\n countryCode,\n formattedPhoneNumber,\n dialCode,\n formatTemplate,\n };\n};\n\nexport default withErrorBoundary(parsePhoneNumber);\n","export const stringToDate = (dateString: string): Date => {\n const supportedDateFormats = [\n // Date formats\n {\n regex: /^(\\d{4})\\/(\\d{2})\\/(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY/MM/DD\n {\n regex: /^(\\d{2})\\/(\\d{2})\\/(\\d{4})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n }, // DD/MM/YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY.MM.DD\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // DD-MM-YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // MM/DD/YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY-MM-DD\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY. MM. DD.\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // DD.MM.YYYY\n\n // Timestamp formats\n {\n regex: /^(\\d{4})\\/(\\d{2})\\/(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY/MM/DD HH:MM:SS\n {\n regex: /^(\\d{2})\\/(\\d{2})\\/(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD/MM/YYYY HH:MM:SS\n {\n regex: /^(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY-MM-DD HH:MM:SS\n {\n regex: /^(\\d{2})-(\\d{2})-(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD-MM-YYYY HH:MM:SS\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY.MM.DD HH:MM:SS\n {\n regex: /^(\\d{2})\\.(\\d{2})\\.(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD.MM.YYYY HH:MM:SS\n ];\n\n for (const format of supportedDateFormats) {\n const match = dateString.match(format.regex);\n if (match) {\n const year = match[format.yearIndex];\n const month = match[format.monthIndex];\n const day = match[format.dayIndex];\n const hour = format.hourIndex ? match[format.hourIndex] : '00';\n const minute = format.minuteIndex ? match[format.minuteIndex] : '00';\n const second = format.secondIndex ? match[format.secondIndex] : '00';\n\n return new Date(`${year}-${month}-${day}T${hour}:${minute}:${second}`);\n }\n }\n\n throw new Error('Date format not recognized');\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Adds a specified amount of time to a date.\n *\n * @param date The original date.\n * @param value The amount to add.\n * @param unit The unit of time to add (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time added.\n */\nconst add = (\n date: DateInput,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n switch (unit) {\n case 'days':\n date.setDate(date.getDate() + value);\n break;\n case 'months':\n date.setMonth(date.getMonth() + value);\n break;\n case 'years':\n date.setFullYear(date.getFullYear() + value);\n break;\n }\n return date;\n};\n\nexport default withErrorBoundary(add);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Formats date and time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional).\n * @returns {string} Formatted date and time string.\n */\nconst formatDateTime = (\n date: DateInput,\n locale: Locale,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n const dateObj: Date = date instanceof Date ? date : new Date(date);\n let formatter;\n\n try {\n formatter = new Intl.DateTimeFormat(locale, intlOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formatter.format(dateObj);\n};\n\nexport default withErrorBoundary(formatDateTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n DateFormatOptions,\n} from './types';\n\n/**\n * Formats date based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional).\n * @returns {string} Formatted date string.\n */\nconst formatDate = (\n date: DateInput,\n locale: Locale,\n options: DateFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n timeStyle: undefined,\n };\n\n let formattedDate;\n\n try {\n formattedDate = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedDate;\n};\n\nexport default withErrorBoundary(formatDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n TimeFormatOptions,\n} from './types';\n\n/**\n * Formats time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional).\n * @returns {string} Formatted time string.\n */\nconst formatTime = (\n date: DateInput,\n locale: Locale,\n options: TimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n dateStyle: undefined,\n };\n\n let formattedTime;\n\n try {\n formattedTime = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedTime;\n};\n\nexport default withErrorBoundary(formatTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\n\n/**\n * Gets the first day of the week for a given locale.\n *\n * @param locale The locale to determine the first day of the week for.\n * @param intlOptions Optional Intl.DateTimeFormatOptions for customization.\n * @returns The first day of the week (0-6, where 0 is Sunday).\n */\nconst getFirstDayOfWeek = (\n locale: string,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n let formatted;\n\n if (!intlOptions.weekday) intlOptions.weekday = 'long';\n\n try {\n const formatter = new Intl.DateTimeFormat(locale, intlOptions);\n /**\n * This date was chosen because January 2, 2000, is a Sunday.\n * In the Gregorian calendar, Sunday is considered the start of the week in some cultures (like in the United States), while in others, it's Monday (like in much of Europe).\n * By using a date that is known to be a Sunday, the function can accurately determine what day of the week is considered the start in the specified locale.\n */\n const sundayDate = new Date(2000, 0, 2); // A known Sunday\n formatted = formatter.format(sundayDate);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n // Generate localized weekdays array starting from Sunday\n const weekdays = Array.from({ length: 7 }, (_, i) =>\n new Intl.DateTimeFormat(locale, intlOptions).format(\n new Date(2000, 0, 2 + i),\n ),\n );\n\n const firstDayIndex = weekdays.indexOf(formatted);\n if (firstDayIndex === -1) {\n throw new Error('Unable to determine the first day of the week');\n }\n\n return weekdays[(firstDayIndex + 1) % 7]; // Adjusting since our reference date is a Sunday\n};\n\nexport default withErrorBoundary(getFirstDayOfWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Determines the quarter of the year for a given date.\n *\n * @param date The date to determine the quarter for.\n * @returns The quarter of the year (1-4).\n */\nconst getQuarter = (date: DateInput): number => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n return Math.ceil((date.getMonth() + 1) / 3);\n};\n\nexport default withErrorBoundary(getQuarter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Provides a relative time string (e.g., '3 hours ago', 'in 2 days').\n * This function calculates the difference between the given date and the base date,\n * then formats it in a locale-sensitive manner. It allows customization of the output\n * through Intl.RelativeTimeFormat options.\n *\n * @param date - The date to compare.\n * @param baseDate - The date to compare against (default: current date).\n * @param locale - The locale to use for formatting.\n * @param options - Options for the Intl.RelativeTimeFormat (optional).\n * @returns The relative time as a string.\n */\nconst getRelativeTime = (\n date: DateInput,\n baseDate: DateInput = new Date(),\n locale: Locale,\n options?: Intl.RelativeTimeFormatOptions,\n): string => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n baseDate =\n typeof baseDate === 'string'\n ? new Date(stringToDate(baseDate))\n : new Date(baseDate);\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000;\n\n // Define time units in seconds\n const minute = 60;\n const hour = minute * 60;\n const day = hour * 24;\n const week = day * 7;\n const month = day * 30;\n const year = day * 365;\n\n let value: number;\n let unit: Intl.RelativeTimeFormatUnit;\n\n if (Math.abs(diffInSeconds) < minute) {\n value = diffInSeconds;\n unit = 'second';\n } else if (Math.abs(diffInSeconds) < hour) {\n value = diffInSeconds / minute;\n unit = 'minute';\n } else if (Math.abs(diffInSeconds) < day) {\n value = diffInSeconds / hour;\n unit = 'hour';\n } else if (Math.abs(diffInSeconds) < week) {\n value = diffInSeconds / day;\n unit = 'day';\n } else if (Math.abs(diffInSeconds) < month) {\n value = diffInSeconds / week;\n unit = 'week';\n } else if (Math.abs(diffInSeconds) < year) {\n value = diffInSeconds / month;\n unit = 'month';\n } else {\n value = diffInSeconds / year;\n unit = 'year';\n }\n\n let relativeTime;\n\n try {\n const rtf = new Intl.RelativeTimeFormat(locale, options);\n relativeTime = rtf.format(Math.round(value), unit);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return relativeTime;\n};\n\nexport default withErrorBoundary(getRelativeTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Calculates the week number of the year for a given date.\n *\n * @param date The date to calculate the week number for.\n * @returns The week number of the year.\n */\nconst getWeek = (date: DateInput): number => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n const firstDayOfYear = new Date(date.getFullYear(), 0, 1);\n const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000;\n return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7);\n};\n\nexport default withErrorBoundary(getWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Returns an array of weekdays according to the specified locale.\n *\n * @param locale The locale to get weekdays for.\n * @param intlOptions Optional Intl.DateTimeFormatOptions for customization.\n * @returns An array of weekday names.\n */\nconst getWeekdays = (\n locale: Locale,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string[] => {\n try {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n if (!intlOptions.weekday) intlOptions.weekday = 'long';\n\n const formatter = new Intl.DateTimeFormat(locale, intlOptions);\n\n /** The date January 1, 1970, is a well-known reference point in computing known as the Unix epoch.\n * It's the date at which time is measured for Unix systems, making it a consistent and reliable choice for date calculations.\n * The choice of the date January 4, 1970, as the starting point is significant.\n * January 4, 1970, was a Sunday.\n * Since weeks typically start on Sunday or Monday in most locales, starting from a known Sunday allows the function to cycle through a complete week, capturing all weekdays in the order they appear for the given locale.\n * */\n return Array.from({ length: 7 }, (_, i) =>\n formatter.format(new Date(1970, 0, 4 + i)),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(getWeekdays);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Compares two dates to determine if the first is after the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is after date2.\n */\nconst isAfter = (date1: DateInput, date2: DateInput): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 > dateObj2;\n};\n\nexport default withErrorBoundary(isAfter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Compares two dates to determine if the first is before the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is before date2.\n */\nconst isBefore = (date1: DateInput, date2: DateInput): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 < dateObj2;\n};\n\nexport default withErrorBoundary(isBefore);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given year is a leap year.\n *\n * @param year The year to check.\n * @returns True if the year is a leap year, false otherwise.\n */\nconst isLeapYear = (year: number): boolean => {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n};\n\nexport default withErrorBoundary(isLeapYear);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { stringToDate } from './utils';\n\n/**\n * Checks if two dates fall on the same day.\n *\n * @param date1 The first date.\n * @param date2 The second date.\n * @returns True if both dates are on the same day, false otherwise.\n */\nconst isSameDay = (date1: Date, date2: Date): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n return (\n date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear()\n );\n};\n\nexport default withErrorBoundary(isSameDay);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { stringToDate } from './utils';\n\n/**\n * Checks if a given object is a valid Date object.\n *\n * @param date The object to check.\n * @returns True if the object is a valid Date, false otherwise.\n */\nconst isValidDate = (date: any): boolean => {\n try {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return date instanceof Date && !isNaN(date.getTime());\n};\n\nexport default withErrorBoundary(isValidDate);\n","export const LOCALE_DATE_FORMATS: { [key: string]: string } = {\n 'ar-AE': 'DD/MM/YYYY', // Arabic (U.A.E.)\n 'sq-AL': 'DD.MM.YYYY', // Albanian (Albania)\n 'hy-AM': 'DD.MM.YYYY', // Armenian (Armenia)\n 'es-AR': 'DD/MM/YYYY', // Spanish (Argentina)\n 'en-AU': 'DD/MM/YYYY', // English (Australia)\n 'nl-AW': 'DD-MM-YYYY', // Dutch (Aruba)\n 'en-BB': 'MM/DD/YYYY', // English (Barbados)\n 'bn-BD': 'DD/MM/YYYY', // Bengali (Bangladesh)\n 'en-BM': 'MM/DD/YYYY', // English (Bermuda)\n 'ms-BN': 'DD/MM/YYYY', // Malay (Brunei)\n 'es-BO': 'DD/MM/YYYY', // Spanish (Bolivia)\n 'en-BS': 'MM/DD/YYYY', // English (Bahamas)\n 'en-BW': 'DD/MM/YYYY', // English (Botswana)\n 'en-BZ': 'MM/DD/YYYY', // English (Belize)\n 'en-CA': 'DD/MM/YYYY', // English (Canada)\n 'de-CH': 'DD.MM.YYYY', // German (Switzerland)\n 'zh-CN': 'YYYY/MM/DD', // Chinese (China)\n 'es-CO': 'DD/MM/YYYY', // Spanish (Colombia)\n 'es-CR': 'DD/MM/YYYY', // Spanish (Costa Rica)\n 'es-CU': 'DD/MM/YYYY', // Spanish (Cuba)\n 'cs-CZ': 'DD.MM.YYYY', // Czech (Czech Republic)\n 'da-DK': 'DD-MM-YYYY', // Danish (Denmark)\n 'es-DO': 'DD/MM/YYYY', // Spanish (Dominican Republic)\n 'ar-DZ': 'DD/MM/YYYY', // Arabic (Algeria)\n 'ar-EG': 'DD/MM/YYYY', // Arabic (Egypt)\n 'am-ET': 'DD/MM/YYYY', // Amharic (Ethiopia)\n 'en-EU': 'DD/MM/YYYY', // English (European Union)\n 'en-FJ': 'DD/MM/YYYY', // English (Fiji)\n 'en-GB': 'DD/MM/YYYY', // English (United Kingdom)\n 'en-GH': 'DD/MM/YYYY', // English (Ghana)\n 'en-GI': 'DD/MM/YYYY', // English (Gibraltar)\n 'en-GM': 'DD/MM/YYYY', // English (Gambia)\n 'es-GT': 'DD/MM/YYYY', // Spanish (Guatemala)\n 'en-GY': 'DD/MM/YYYY', // English (Guyana)\n 'en-HK': 'DD/MM/YYYY', // English (Hong Kong)\n 'es-HN': 'DD/MM/YYYY', // Spanish (Honduras)\n 'hr-HR': 'DD.MM.YYYY', // Croatian (Croatia)\n 'ht-HT': 'MM/DD/YYYY', // Haitian (Haiti)\n 'hu-HU': 'YYYY. MM. DD.', // Hungarian (Hungary)\n 'id-ID': 'DD/MM/YYYY', // Indonesian (Indonesia)\n 'he-IL': 'DD/MM/YYYY', // Hebrew (Israel)\n 'en-IN': 'DD-MM-YYYY', // English (India)\n 'en-JM': 'MM/DD/YYYY', // English (Jamaica)\n 'en-KE': 'DD/MM/YYYY', // English (Kenya)\n 'ky-KG': 'DD.MM.YYYY', // Kyrgyz (Kyrgyzstan)\n 'km-KH': 'DD/MM/YYYY', // Khmer (Cambodia)\n 'en-KY': 'MM/DD/YYYY', // English (Cayman Islands)\n 'kk-KZ': 'DD.MM.YYYY', // Kazakh (Kazakhstan)\n 'lo-LA': 'DD/MM/YYYY', // Lao (Laos)\n 'si-LK': 'YYYY-MM-DD', // Sinhala (Sri Lanka)\n 'en-LR': 'MM/DD/YYYY', // English (Liberia)\n 'en-LS': 'DD/MM/YYYY', // English (Lesotho)\n 'ar-MA': 'DD/MM/YYYY', // Arabic (Morocco)\n 'ro-MD': 'DD.MM.YYYY', // Romanian (Moldova)\n 'mk-MK': 'DD.MM.YYYY', // Macedonian (North Macedonia)\n 'my-MM': 'DD/MM/YYYY', // Burmese (Myanmar)\n 'mn-MN': 'YYYY.MM.DD', // Mongolian (Mongolia)\n 'zh-MO': 'DD/MM/YYYY', // Chinese (Macao)\n 'en-MU': 'DD/MM/YYYY', // English (Mauritius)\n 'dv-MV': 'DD/MM/YYYY', // Divehi (Maldives)\n 'en-MW': 'DD/MM/YYYY', // English (Malawi)\n 'es-MX': 'DD/MM/YYYY', // Spanish (Mexico)\n 'ms-MY': 'DD/MM/YYYY', // Malay (Malaysia)\n 'en-NA': 'DD/MM/YYYY', // English (Namibia)\n 'en-NG': 'DD/MM/YYYY', // English (Nigeria)\n 'es-NI': 'DD/MM/YYYY', // Spanish (Nicaragua)\n 'no-NO': 'DD.MM.YYYY', // Norwegian (Norway)\n 'ne-NP': 'YYYY/MM/DD', // Nepali (Nepal)\n 'en-NZ': 'DD/MM/YYYY', // English (New Zealand)\n 'es-PE': 'DD/MM/YYYY', // Spanish (Peru)\n 'en-PG': 'DD/MM/YYYY', // English (Papua New Guinea)\n 'en-PH': 'MM/DD/YYYY', // English (Philippines)\n 'en-PK': 'DD/MM/YYYY', // English (Pakistan)\n 'ar-QA': 'DD/MM/YYYY', // Arabic (Qatar)\n 'ru-RU': 'DD.MM.YYYY', // Russian (Russia)\n 'ar-SA': 'DD/MM/YYYY', // Arabic (Saudi Arabia)\n 'en-SC': 'DD/MM/YYYY', // English (Seychelles)\n 'sv-SE': 'YYYY-MM-DD', // Swedish (Sweden)\n 'en-SG': 'DD/MM/YYYY', // English (Singapore)\n 'en-SL': 'DD/MM/YYYY', // English (Sierra Leone)\n 'so-SO': 'DD/MM/YYYY', // Somali (Somalia)\n 'en-SS': 'DD/MM/YYYY', // English (South Sudan)\n 'es-SV': 'DD/MM/YYYY', // Spanish (El Salvador)\n 'en-SZ': 'DD/MM/YYYY', // English (Eswatini)\n 'th-TH': 'DD/MM/YYYY', // Thai (Thailand)\n 'en-TT': 'MM/DD/YYYY', // English (Trinidad and Tobago)\n 'sw-TZ': 'DD/MM/YYYY', // Swahili (Tanzania)\n 'en-US': 'MM/DD/YYYY', // English (United States)\n 'es-UY': 'DD/MM/YYYY', // Spanish (Uruguay)\n 'uz-UZ': 'DD/MM/YYYY', // Uzbek (Uzbekistan)\n 'ar-YE': 'DD/MM/YYYY', // Arabic (Yemen)\n 'en-ZA': 'YYYY/MM/DD', // English (South Africa)\n 'ar-KW': 'DD/MM/YYYY', // Arabic (Kuwait)\n 'ar-BH': 'DD/MM/YYYY', // Arabic (Bahrain)\n 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman)\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Parses a date string based on a specific format.\n *\n * @param dateString The date string to parse.\n * @param format The format to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDateWithFormat = (\n dateString: string,\n format: string,\n): Date | null => {\n // Determine the separator based on the format (supports '/', '.', or '-')\n const separator = format.includes('/')\n ? '/'\n : format.includes('.')\n ? '.'\n : '-';\n const formatParts = format.split(separator);\n const dateParts = dateString.split(separator).map((num) => parseInt(num, 10));\n\n let year: number = 0,\n month: number = 0,\n day: number = 0;\n let yearSet: boolean = false,\n monthSet: boolean = false,\n daySet: boolean = false;\n\n // Check for format and date string mismatch\n if (dateParts.length !== formatParts.length) {\n return null; // Mismatch between date string and format\n }\n\n formatParts.forEach((part, index) => {\n // Check for non-numeric values in date string\n if (isNaN(dateParts[index])) {\n return null; // Invalid date part\n }\n\n // Assign year, month, and day based on the format\n switch (part) {\n case 'DD':\n day = dateParts[index];\n daySet = true;\n break;\n case 'MM':\n month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date\n monthSet = true;\n break;\n case 'YYYY':\n year = dateParts[index];\n yearSet = true;\n break;\n }\n });\n\n // Validate and create the date only if all parts are set\n if (yearSet && monthSet && daySet) {\n const parsedDate = new Date(year, month, day);\n // Validate date to catch invalid dates like February 30th\n if (\n parsedDate.getFullYear() === year &&\n parsedDate.getMonth() === month &&\n parsedDate.getDate() === day\n ) {\n return parsedDate;\n }\n }\n return null; // Invalid date or incomplete date information\n};\n\nexport default withErrorBoundary(\n parseDateWithFormat,\n);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { LOCALE_DATE_FORMATS } from './data/localeDateFormats';\nimport parseDateWithFormat from './parseDateWithFormat';\nimport { Locale } from './types';\n\n/**\n * Attempts to parse a string into a date object based on locale.\n * Uses the localeDateFormats mapping for determining the date format.\n *\n * @param dateString - The date string to parse.\n * @param locale - The locale to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDate = (dateString: string, locale: Locale): Date | null => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const format = LOCALE_DATE_FORMATS[locale];\n if (!format) {\n throw new Error(`No date format found for locale: ${locale}`);\n }\n return parseDateWithFormat(dateString, format);\n};\n\nexport default withErrorBoundary(parseDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport add from './add';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Subtracts a specified amount of time from a date.\n *\n * @param date The original date.\n * @param value The amount to subtract.\n * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time subtracted.\n */\nconst subtract = (\n date: DateInput,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n return add(date, -value, unit); // Reuse the add function with negative value\n};\n\nexport default withErrorBoundary(subtract);\n"],"names":["formatPhoneNumber","formatDateTime","parseDateWithFormat","add"],"mappings":"AAAA;AACM,MAAO,YAAa,SAAQ,KAAK,CAAA;AAErC,IAAA,WAAA,CAAY,OAA2B,EAAA;QACr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AAE,CAAC,MAAM,IAAI,SAAS,EAAE,CAAC;AAE7D,IAAA,MAAM,MAAM,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC3C,IAAI,CAAC,MAAM,EAAE;AACX,QAAA,MAAM,IAAI,KAAK,CAAC,oCAAoC,MAAM,CAAA,CAAE,CAAC,CAAC;AAC/D,KAAA;AACD,IAAA,OAAOC,qBAAmB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC,CAAC;AAEF,kBAAe,iBAAiB,CAAmB,SAAS,CAAC;;ACzB7D;;;;;;;AAOG;AACH,MAAM,QAAQ,GAAG,CACf,IAAe,EACf,KAAa,EACb,IAAiC,KACzB;IACR,IAAI;QACF,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;IAE3E,OAAOC,KAAG,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACjC,CAAC,CAAC;AAEF,iBAAe,iBAAiB,CAAkB,QAAQ,CAAC;;;;"} \ No newline at end of file diff --git a/lib/esm/index.min.js b/lib/esm/index.min.js deleted file mode 100644 index 7edbe68c..00000000 --- a/lib/esm/index.min.js +++ /dev/null @@ -1,2 +0,0 @@ -class x extends Error{constructor(x){super(x),this.name="i18nify Error",this.timestamp=new Date}}const e=e=>function(...n){try{return e.call(this,...n)}catch(e){throw console.warn("[I18N Error]: ",e),new x(e)}};class n{constructor(){this.state={locale:"",direction:"",country:""}}static getInstance(){return n.instance||(n.instance=new n),n.instance}static resetInstance(){n.instance=void 0}getState(){return Object.assign({},this.state)}setState(x){this.state=Object.assign(Object.assign({},this.state),x)}resetState(){this.state={locale:"",direction:"",country:""}}}var a=n.getInstance();var r=e((()=>a.getState()));var t=e((x=>{a.setState(x)}));var o=e((()=>{a.resetState()}));const s=()=>{if("undefined"==typeof navigator)return"en-IN";if(window.Intl&&"object"==typeof window.Intl&&(window.navigator.languages||window.navigator.language)){return(window.navigator.languages||[window.navigator.language])[0]}return"en-IN"},d=(x={})=>{let e=(null==x?void 0:x.locale)||a.getState().locale;e||(e=s());const n=(null==x?void 0:x.intlOptions)?Object.assign({},x.intlOptions):{};if(((null==x?void 0:x.currency)||n.currency)&&(n.style="currency",n.currency=x.currency||n.currency),!e)throw new Error("Pass valid locale !");return new Intl.NumberFormat(e||void 0,n)};var Y=e(((x,e={})=>{if(!Number(x)&&0!==Number(x))throw new Error("Parameter `amount` is not a number!");let n="";try{n=d(e).format(Number(x))}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return n}));const D={AED:{symbol:"د.إ",name:"United Arab Emirates Dirham"},ALL:{symbol:"Lek",name:"Albanian Lek"},AMD:{symbol:"֏",name:"Armenian Dram"},ARS:{symbol:"ARS",name:"Argentine Peso"},AUD:{symbol:"A$",name:"Australian Dollar"},AWG:{symbol:"Afl.",name:"Aruban Florin"},BBD:{symbol:"$",name:"Barbadian Dollar"},BDT:{symbol:"৳",name:"Bangladeshi Taka"},BMD:{symbol:"$",name:"Bermudian Dollar"},BND:{symbol:"BND",name:"Brunei Dollar"},BOB:{symbol:"Bs",name:"Bolivian Boliviano"},BSD:{symbol:"B$",name:"Bahamian Dollar"},BWP:{symbol:"P",name:"Botswanan Pula"},BZD:{symbol:"BZ$",name:"Belize Dollar"},CAD:{symbol:"C$",name:"Canadian Dollar"},CHF:{symbol:"CHf",name:"Swiss Franc"},CNY:{symbol:"¥",name:"Chinese Yuan"},COP:{symbol:"COL$",name:"Colombian Peso"},CRC:{symbol:"₡",name:"Costa Rican Colón"},CUP:{symbol:"$MN",name:"Cuban Peso"},CZK:{symbol:"Kč",name:"Czech Koruna"},DKK:{symbol:"DKK",name:"Danish Krone"},DOP:{symbol:"RD$",name:"Dominican Peso"},DZD:{symbol:"د.ج",name:"Algerian Dinar"},EGP:{symbol:"E£",name:"Egyptian Pound"},ETB:{symbol:"ብር",name:"Ethiopian Birr"},EUR:{symbol:"€",name:"Euro"},FJD:{symbol:"FJ$",name:"Fijian Dollar"},GBP:{symbol:"£",name:"British Pound"},GHS:{symbol:"GH₵",name:"Ghanaian Cedi"},GIP:{symbol:"GIP",name:"Gibraltar Pound"},GMD:{symbol:"D",name:"Gambian Dalasi"},GTQ:{symbol:"Q",name:"Guatemalan Quetzal"},GYD:{symbol:"G$",name:"Guyanese Dollar"},HKD:{symbol:"HK$",name:"Hong Kong Dollar"},HNL:{symbol:"HNL",name:"Honduran Lempira"},HRK:{symbol:"kn",name:"Croatian Kuna"},HTG:{symbol:"G",name:"Haitian Gourde"},HUF:{symbol:"Ft",name:"Hungarian Forint"},IDR:{symbol:"Rp",name:"Indonesian Rupiah"},ILS:{symbol:"₪",name:"Israeli New Shekel"},INR:{symbol:"₹",name:"Indian Rupee"},JMD:{symbol:"J$",name:"Jamaican Dollar"},KES:{symbol:"Ksh",name:"Kenyan Shilling"},KGS:{symbol:"Лв",name:"Kyrgystani Som"},KHR:{symbol:"៛",name:"Cambodian Riel"},KYD:{symbol:"CI$",name:"Cayman Islands Dollar"},KZT:{symbol:"₸",name:"Kazakhstani Tenge"},LAK:{symbol:"₭",name:"Laotian Kip"},LKR:{symbol:"රු",name:"Sri Lankan Rupee"},LRD:{symbol:"L$",name:"Liberian Dollar"},LSL:{symbol:"LSL",name:"Lesotho Loti"},MAD:{symbol:"د.م.",name:"Moroccan Dirham"},MDL:{symbol:"MDL",name:"Moldovan Leu"},MKD:{symbol:"ден",name:"Macedonian Denar"},MMK:{symbol:"MMK",name:"Myanmar Kyat"},MNT:{symbol:"₮",name:"Mongolian Tugrik"},MOP:{symbol:"MOP$",name:"Macanese Pataca"},MUR:{symbol:"₨",name:"Mauritian Rupee"},MVR:{symbol:"Rf",name:"Maldivian Rufiyaa"},MWK:{symbol:"MK",name:"Malawian Kwacha"},MXN:{symbol:"Mex$",name:"Mexican Peso"},MYR:{symbol:"RM",name:"Malaysian Ringgit"},NAD:{symbol:"N$",name:"Namibian Dollar"},NGN:{symbol:"₦",name:"Nigerian Naira"},NIO:{symbol:"NIO",name:"Nicaraguan Córdoba"},NOK:{symbol:"NOK",name:"Norwegian Krone"},NPR:{symbol:"रू",name:"Nepalese Rupee"},NZD:{symbol:"NZ$",name:"New Zealand Dollar"},PEN:{symbol:"S/",name:"Peruvian Nuevo Sol"},PGK:{symbol:"PGK",name:"Papua New Guinean Kina"},PHP:{symbol:"₱",name:"Philippine Peso"},PKR:{symbol:"₨",name:"Pakistani Rupee"},QAR:{symbol:"QR",name:"Qatari Riyal"},RUB:{symbol:"₽",name:"Russian Ruble"},SAR:{symbol:"SR",name:"Saudi Riyal"},SCR:{symbol:"SRe",name:"Seychellois Rupee"},SEK:{symbol:"SEK",name:"Swedish Krona"},SGD:{symbol:"S$",name:"Singapore Dollar"},SLL:{symbol:"Le",name:"Sierra Leonean Leone"},SOS:{symbol:"Sh.so.",name:"Somali Shilling"},SSP:{symbol:"SS£",name:"South Sudanese Pound"},SVC:{symbol:"₡",name:"Salvadoran Colón"},SZL:{symbol:"E",name:"Swazi Lilangeni"},THB:{symbol:"฿",name:"Thai Baht"},TTD:{symbol:"TT$",name:"Trinidad and Tobago Dollar"},TZS:{symbol:"Sh",name:"Tanzanian Shilling"},USD:{symbol:"$",name:"United States Dollar"},UYU:{symbol:"$U",name:"Uruguayan Peso"},UZS:{symbol:"so'm",name:"Uzbekistani Som"},YER:{symbol:"﷼",name:"Yemeni Rial"},ZAR:{symbol:"R",name:"South African Rand"},KWD:{symbol:"د.ك",name:"Kuwaiti Dinar"},BHD:{symbol:"د.ب.",name:"Bahraini Dinar"},OMR:{symbol:"ر.ع.",name:"Omani Rial"}};var M=e((()=>D));var i=e((x=>{var e;if(x in D)return null===(e=D[x])||void 0===e?void 0:e.symbol;throw new Error("Invalid currencyCode!")}));const m=["nan","infinity","percent","integer","group","decimal","fraction","plusSign","minusSign","percentSign","currency","code","symbol","name","compact","exponentInteger","exponentMinusSign","exponentSeparator","unit"];var l=e(((x,e={})=>{if(!Number(x)&&0!==Number(x))throw new Error("Parameter `amount` is not a number!");try{const n=d(e).formatToParts(Number(x)),a={};return n.forEach((x=>{"group"===x.type?a.integer=(a.integer||"")+x.value:-1!=m.findIndex((e=>e===x.type))&&(a[x.type]=(a[x.type]||"")+x.value)})),Object.assign(Object.assign({},a),{isPrefixSymbol:"currency"===n[0].type,rawParts:n})}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}}));const c={IN:/^(?:(?:\+|0{0,2})91\s*[-]?\s*|[0]?)?[6789]\d{9}$/,MY:/^(\+?6?0)?(\d{1,3})[-. ]?(\d{7,8})$/,AE:/^(?:\+?971|0)?(?:2|3|4|6|7|9)\d{8}$/,AL:/^(?:\+?355)?(?:[4-9]\d{7}|6\d{8})$/,AM:/^(?:\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/,AR:/^(?:(?:\+|0{0,2})54)?(?:11|[2368]\d)(?:(?=\d{0,2}15)\d{2})??\d{8}$/,AU:/^(?:\+?61|0)4\d{8}$/,AW:/^(?:(?:\+297)?(?!0)\d{7})$/,BB:/^(?:(?:\+1)?246)?(?:\d{3})?\d{7}$/,BD:/^(?:\+?880|0)1[13456789]\d{8}$/,BM:/^(?:(?:\+1)?441)?(?:\d{2})?\d{7}$/,BN:/^(?:\+?673)?(?:\d{3})?\d{4}$/,BO:/^(?:(?:\+|0{0,2})591)?(?:(?:2|3|7|6)\d{7})$/,BS:/^(?:(?:\+1)?242)?(?:\d{3})?\d{7}$/,BW:/^(?:(?:\+267)?\s?)?[74]\d{7}$/,BZ:/^(?:(?:\+501)?\s?)?[622]\d{4}$/,CH:/^(?:(?:\+41|0)(?:\s*\(?0\)?\s*))?(?:\d{2}\s*)?\d{3}\s*\d{2}\s*\d{2}$/,CN:/^(?:(?:\+|00)86)?1\d{10}$/,CO:/^(?:(?:\+57|0057)?)?[1-8]{1}\d{6,7}$/,OM:/^(?:\+?968)?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?:(?:\+232)|(?:0))?\d{9}$/,SO:/^(?:\+252|0)?[567]\d{7}$/,SS:/^(?:\+211|0)?[1-9]\d{7,9}$/,SV:/^(?:(?:\+?503)|(?:0))(?:\d{8})$/,SZ:/^(?:\+?268)?\d{7,8}$/,TH:/^(?:(?:\+66)|0)\d{9}$/,TT:/^(?:(?:\+?1-868)|\(?868\)?)(\d{7})$/,TZ:/^(?:(?:\+?255)|0)?[67]\d{8}$/,US:/^(\+\d{1,2}\s?)?([2-9]{1}\d{2}[2-9]{1}\d{6})$/,CA:/^(\+\d{1,2}\s?)?([2-9]{1}\d{2}[2-9]{1}\d{6})$/,UY:/^(?:(?:\+598|0)\s?(9\d{3}|2\d{2}|[4-9]\d{6}))$/,UZ:/^(?:\+?998)?\s?[3456789]\d{8}$/,YE:/^(?:\+?967)?(?:\d{7,8})$/,ZA:/^(?:(?:\+27)|0)(\d{9})$/,KW:/^(?:\+?965)[569]\d{7}$/,BH:/^(?:\+?973)?[356]\d{7}$/,TL:/^(?:(?:\+670)\s?)?[0-9]{3}\s?[0-9]{3,4}$/,VC:/^(?:(?:\+1)?784)?(?:\d{3})?\d{7}$/,VE:/^(?:(?:\+58)|0)?4\d{9}$/,VN:/^(?:(?:\+84)|0)?[1-9]\d{8}$/,ZM:/^(?:(?:\+260)|0)?[123456789]\d{8,9}$/,ZW:/^(?:(?:\+263)|0)?(?:\d{9,10})$/,LT:/^(?:(?:\+370)|8)\d{8}$/,LU:/^(?:(?:\+352)?(6|2(6|7|8|9))\d{6})$/,LV:/^(?:(?:\+371)?2\d{7})$/,ME:/^(?:(?:\+382)?[67]\d{7,20})$/,MG:/^(?:(?:\+261)?3[234568]\d{7})$/,MZ:/^(?:(?:\+258)|(?:258))?8[234567]\d{7,8}$/,NL:/^(?:(?:\+31)|0(6(?:\d{8})|[1-9](?:(?:\d{8})|(?:\s\d{3}\s\d{4}))|(?:\d{8})))$/,PA:/^(?:(?:\+507)\s?)?[46]\d{6,7}$/,PL:/^(?:(?:\+48)?(?:\s?\d{3}\s?\d{3}\s?\d{3}|(?:\d{2}\s?){4}\d{2}|\d{3}-\d{3}-\d{3}))$/,PR:/^(?:(?:\+1)?787|939)\d{7}$/,PS:/^(?:(?:\+970))(5[2349])\d{7}$/,PT:/^(?:(?:\+351)?9(1\d|2[1-9]|6[12345789]|7[12345789])\d{7})$/,PY:/^(?:(?:\+595|0)9[9876]\d{7})$/,RO:/^(?:(?:\+40|0))(?:7[2-8]\d{7}|21\d{8})$/,RS:/^(?:(?:\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/,RW:/^(?:(?:\+250)|(0))\d{9}$/,SI:/^(?:(?:\+386)|0)?[1-59]\d{7,8}$/,SK:/^(?:(?:\+421))?(0|9[0-8])\d{8}$/,SM:/^(?:(?:\+378)|(0549|6\d{4}))\d{5}$/,SN:/^(?:(?:\+221)|0)?[3679]\d{7}$/,SR:/^(?:(?:\+597))\d{7}$/,TG:/^(?:(?:\+228))\d{8}$/,TJ:/^(?:(?:\+992))(37|55|77)\d{7}$/,TN:/^(?:(?:\+216)|22|9[1-9])\d{7}$/,TR:/^(?:(?:\+90)|(0))\s?5\d{9}$/,TW:/^(?:(?:\+886)|0)?9\d{8}$/,UA:/^(?:(?:\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\d{7}$/,UG:/^(?:(?:\+256)|0)?[39]\d{8}$/},y={1:["US","AG","AI","AS","BB","BM","BS","CA","DM","DO","GD","GU","JM","KN","KY","LC","MP","MS","PR","SX","TC","TT","VC","VG","VI"],7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT","VA"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH","TA"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],380:["UA"],381:["RS"],382:["ME"],383:["XK"],385:["HR"],386:["SI"],387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],691:["FM"],692:["MH"],800:["001"],808:["001"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],870:["001"],878:["001"],880:["BD"],881:["001"],882:["001"],883:["001"],886:["TW"],888:["001"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],979:["001"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},u=x=>{if("+"===x.toString().charAt(0)){const e=x.toString().replace(/\D/g,""),n=[];for(const x in y)e.startsWith(x)&&n.push(...y[x]);return n.find((e=>{const n=c[e];if(n&&n.test(x.toString()))return e}))||""}for(const e in c){if(c[e].test(x.toString()))return e}return""},$=x=>{const e=x.replace(/[^0-9+]|(?!A)\+/g,"");return"+"===x[0]?`+${e}`:e};var S=e(((x,e)=>{const n=$(x.toString());if(e=e&&e in c?e:u(n),!x)return!1;if(e in c){return c[e].test(n)}return!1}));const b={IN:"xxxx xxxxxx",MY:"xx xxxxx xx",AE:"xx xxx xxxx",AL:"xxx xx xxxx",AM:"xx xx xx xx",AR:"xxxx-xxxx",AU:"xxx xxx xxx",AW:"xxx-xxxx",BB:"xxx-xxxx",BD:"xxxx-xxxxxx",BM:"xxx-xxxx",BN:"xxxx-xxxx",BO:"xxxx-xxxx",BS:"xxx-xxxx",BW:"xx xxxx xxxx",BZ:"xxx-xxxx",CA:"xxx-xxx-xxxx",CH:"xxx xxx xxx",CN:"xxxx-xxxxxxx",CO:"xxxx-xxxxxxx",CR:"xxxx-xxxx",CU:"xxxx-xxxx",CZ:"xxx xxx xxx",DK:"xx xx xx xx",DO:"xxx-xxxxxxx",DZ:"xxxx-xxxx-xxx",EG:"xx xxx xxxx",ET:"xx xxx xxxx",EU:"xxx xx xx xx",FJ:"xxxx xxxx",GB:"xxxx xxx xxx",GH:"xxx xxx xxxx",GI:"xxxx xxxx",GM:"xxxx-xxxx",GT:"xxxx-xxxx",GY:"xxx-xxxx",HK:"xxxx xxxx",HN:"xxxx-xxxx",HR:"xxx xxx xxxx",HT:"xxx-xxxx",HU:"xxx xxx xxxx",ID:"xxxx-xxxx-xxxx",IL:"xxxx-xxx-xxx",JM:"xxx-xxxx",KE:"xxx xxxxxx",KG:"xxx-xx-xx-xx",KH:"xxx-xxx-xxx",KY:"xxx-xxxx",KZ:"xxx-xxx-xx-xx",LA:"xxx xx xxxx",LK:"xx xxx xxxx",LR:"xxx-xxx-xxxx",LS:"xxx xx xxxx",LT:"xxx xxxxx",LU:"xxx xx xxx",LV:"xxxx xxxx",MA:"xxxx-xxxxxx",MD:"xx xxxxxx",ME:"xx xxxxxx",MG:"xx xx xx xx xx",MK:"xx xx xx xx",MM:"xx xxxxxx",MN:"xxx-xx-xxxx",MO:"xxxx xxxx",MU:"xx xxxx xxxx",MV:"xxxxxx",MW:"xx xxxx xxxx",MX:"xxx-xxx-xxxx",MZ:"xx xxxxxxx",NA:"xx xxxx xxxx",NG:"xxx xxx xxxx",NI:"xxxx-xxxx",NL:"xxx-xxxxxxx",NO:"xxxx xxxx",NP:"xxxx-xxxxxxx",NZ:"xxx-xxxxxxx",OM:"xxxx-xxxx",PA:"xxx-xxxx",PE:"xxx-xxx-xxx",PG:"xxx-xxxxxx",PH:"xxx-xxxx",PK:"xxx-xxxxxxx",PL:"xxx xxx xxx",PR:"xxx-xxx-xxxx",PS:"xxxx-xxxxxxx",PT:"xxx xxx xxx",PY:"xxx-xxxxxx",QA:"xxxx xxxx",RO:"xxx xxx xxxx",RS:"xxx xxxxx",RU:"xxx xxx-xx-xx",RW:"xxx xxxxxx",SA:"xxx-xxxxxxx",SC:"xx xxxxx",SE:"xxx-xxx xx xx",SG:"xxxx xxxx",SI:"xx xxxxxx",SK:"xxx xxx xxx",SL:"xxx-xxxxxx",SM:"xxxxx xxxxx",SN:"xx xxx xx xx",SO:"xxx xxxxxxx",SR:"xxx-xxxx",SS:"xxx xxxx xxx",SV:"xxxx-xxxx",SZ:"xxx xx xxxx",TG:"xx xx xx xx",TH:"xxx-xxxxxxx",TJ:"xxx xx xx xx",TL:"xxx-xxxxxxx",TN:"xx xxxxxx",TR:"xxx xxx xx xx",TT:"xxx-xxxx",TW:"xxxx-xxxxxx",TZ:"xxx xxx xxxx",UA:"xx xxx xx xx",UG:"xxx xxxxxxx",US:"xxx-xxx-xxxx",UY:"xxx-xxxxx",UZ:"xxx-xxx-xx-xx",VC:"xxx-xxxx",VE:"xxxx-xxx-xxxx",VN:"xxxx-xxxxxxx",YE:"xxxx-xxxx",ZA:"xxx-xxx-xxxx",ZM:"xxx-xxxxxxx",ZW:"xx xxx xxxx",KW:"xxx xx xxxx",BH:"xxxx xxxx"};var g=e(((x,e)=>{if(!x)throw new Error("Parameter `phoneNumber` is invalid!");x=x.toString(),x=$(x),e=e&&e in b?e:u(x);const n=b[e];if(!n)return x;let a=0;for(let x=0;x{if(!x)throw new Error("Parameter `phoneNumber` is invalid!");x=x.toString(),x=$(x);const n=e&&e in b?e:u(x),a=g(x,n),r=b[n];if(!r)return{countryCode:n||"",dialCode:"",formattedPhoneNumber:x,formatTemplate:""};let t=0;for(let x=0;x{const e=[{regex:/^(\d{4})\/(\d{2})\/(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3},{regex:/^(\d{2})\/(\d{2})\/(\d{4})$/,yearIndex:3,monthIndex:2,dayIndex:1},{regex:/^(\d{4})\.(\d{2})\.(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3},{regex:/^(\d{4})\.(\d{2})\.(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3},{regex:/^(\d{4})\.(\d{2})\.(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3},{regex:/^(\d{4})\.(\d{2})\.(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3},{regex:/^(\d{4})\.(\d{2})\.(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3},{regex:/^(\d{4})\.(\d{2})\.(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3},{regex:/^(\d{4})\/(\d{2})\/(\d{2}) (\d{2}):(\d{2}):(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3,hourIndex:4,minuteIndex:5,secondIndex:6},{regex:/^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2}):(\d{2})$/,yearIndex:3,monthIndex:2,dayIndex:1,hourIndex:4,minuteIndex:5,secondIndex:6},{regex:/^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3,hourIndex:4,minuteIndex:5,secondIndex:6},{regex:/^(\d{2})-(\d{2})-(\d{4}) (\d{2}):(\d{2}):(\d{2})$/,yearIndex:3,monthIndex:2,dayIndex:1,hourIndex:4,minuteIndex:5,secondIndex:6},{regex:/^(\d{4})\.(\d{2})\.(\d{2}) (\d{2}):(\d{2}):(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3,hourIndex:4,minuteIndex:5,secondIndex:6},{regex:/^(\d{2})\.(\d{2})\.(\d{4}) (\d{2}):(\d{2}):(\d{2})$/,yearIndex:3,monthIndex:2,dayIndex:1,hourIndex:4,minuteIndex:5,secondIndex:6}];for(const n of e){const e=x.match(n.regex);if(e){const x=e[n.yearIndex],a=e[n.monthIndex],r=e[n.dayIndex],t=n.hourIndex?e[n.hourIndex]:"00",o=n.minuteIndex?e[n.minuteIndex]:"00",s=n.secondIndex?e[n.secondIndex]:"00";return new Date(`${x}-${a}-${r}T${t}:${o}:${s}`)}}throw new Error("Date format not recognized")};var I=e(((x,e,n)=>{switch(x="string"==typeof x?new Date(w(x)):new Date(x),n){case"days":x.setDate(x.getDate()+e);break;case"months":x.setMonth(x.getMonth()+e);break;case"years":x.setFullYear(x.getFullYear()+e)}return x}));var N=e(((x,e,n={})=>{e||(e=a.getState().locale||s());const r=(x="string"==typeof x?new Date(w(x)):new Date(x))instanceof Date?x:new Date(x);let t;try{t=new Intl.DateTimeFormat(e,n)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return t.format(r)}));var A=e(((x,e,n={})=>{e||(e=a.getState().locale||s());const r=Object.assign(Object.assign({},n),{timeStyle:void 0});let t;try{t=N(x,e,r)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return t}));var E=e(((x,e,n={})=>{e||(e=a.getState().locale||s());const r=Object.assign(Object.assign({},n),{dateStyle:void 0});let t;try{t=N(x,e,r)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return t}));var f=e(((x,e={})=>{let n;x||(x=a.getState().locale||s()),e.weekday||(e.weekday="long");try{const a=new Intl.DateTimeFormat(x,e),r=new Date(2e3,0,2);n=a.format(r)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}const r=Array.from({length:7},((n,a)=>new Intl.DateTimeFormat(x,e).format(new Date(2e3,0,2+a)))),t=r.indexOf(n);if(-1===t)throw new Error("Unable to determine the first day of the week");return r[(t+1)%7]}));var T=e((x=>(x="string"==typeof x?new Date(w(x)):new Date(x),Math.ceil((x.getMonth()+1)/3))));var K=e(((x,e=new Date,n,r)=>{x="string"==typeof x?new Date(w(x)):new Date(x),e="string"==typeof e?new Date(w(e)):new Date(e),n||(n=a.getState().locale||s());const t=(x.getTime()-e.getTime())/1e3,o=3600,d=86400,Y=7*d,D=30*d,M=365*d;let i,m,l;Math.abs(t)<60?(i=t,m="second"):Math.abs(t){x="string"==typeof x?new Date(w(x)):new Date(x);const e=new Date(x.getFullYear(),0,1),n=(x.getTime()-e.getTime())/864e5;return Math.ceil((n+e.getDay()+1)/7)}));var G=e(((x,e={})=>{try{x||(x=a.getState().locale||s()),e.weekday||(e.weekday="long");const n=new Intl.DateTimeFormat(x,e);return Array.from({length:7},((x,e)=>n.format(new Date(1970,0,4+e))))}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}}));var P=e(((x,e)=>{x="string"==typeof x?new Date(w(x)):new Date(x),e="string"==typeof e?new Date(w(e)):new Date(e);return(x instanceof Date?x:new Date(x))>(e instanceof Date?e:new Date(e))}));var B=e(((x,e)=>{x="string"==typeof x?new Date(w(x)):new Date(x),e="string"==typeof e?new Date(w(e)):new Date(e);return(x instanceof Date?x:new Date(x))<(e instanceof Date?e:new Date(e))}));var C=e((x=>x%4==0&&x%100!=0||x%400==0));var L=e(((x,e)=>(x="string"==typeof x?new Date(w(x)):new Date(x),e="string"==typeof e?new Date(w(e)):new Date(e),x.getDate()===e.getDate()&&x.getMonth()===e.getMonth()&&x.getFullYear()===e.getFullYear())));var p=e((x=>{try{x="string"==typeof x?new Date(w(x)):new Date(x)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return x instanceof Date&&!isNaN(x.getTime())}));const H={"ar-AE":"DD/MM/YYYY","sq-AL":"DD.MM.YYYY","hy-AM":"DD.MM.YYYY","es-AR":"DD/MM/YYYY","en-AU":"DD/MM/YYYY","nl-AW":"DD-MM-YYYY","en-BB":"MM/DD/YYYY","bn-BD":"DD/MM/YYYY","en-BM":"MM/DD/YYYY","ms-BN":"DD/MM/YYYY","es-BO":"DD/MM/YYYY","en-BS":"MM/DD/YYYY","en-BW":"DD/MM/YYYY","en-BZ":"MM/DD/YYYY","en-CA":"DD/MM/YYYY","de-CH":"DD.MM.YYYY","zh-CN":"YYYY/MM/DD","es-CO":"DD/MM/YYYY","es-CR":"DD/MM/YYYY","es-CU":"DD/MM/YYYY","cs-CZ":"DD.MM.YYYY","da-DK":"DD-MM-YYYY","es-DO":"DD/MM/YYYY","ar-DZ":"DD/MM/YYYY","ar-EG":"DD/MM/YYYY","am-ET":"DD/MM/YYYY","en-EU":"DD/MM/YYYY","en-FJ":"DD/MM/YYYY","en-GB":"DD/MM/YYYY","en-GH":"DD/MM/YYYY","en-GI":"DD/MM/YYYY","en-GM":"DD/MM/YYYY","es-GT":"DD/MM/YYYY","en-GY":"DD/MM/YYYY","en-HK":"DD/MM/YYYY","es-HN":"DD/MM/YYYY","hr-HR":"DD.MM.YYYY","ht-HT":"MM/DD/YYYY","hu-HU":"YYYY. MM. DD.","id-ID":"DD/MM/YYYY","he-IL":"DD/MM/YYYY","en-IN":"DD-MM-YYYY","en-JM":"MM/DD/YYYY","en-KE":"DD/MM/YYYY","ky-KG":"DD.MM.YYYY","km-KH":"DD/MM/YYYY","en-KY":"MM/DD/YYYY","kk-KZ":"DD.MM.YYYY","lo-LA":"DD/MM/YYYY","si-LK":"YYYY-MM-DD","en-LR":"MM/DD/YYYY","en-LS":"DD/MM/YYYY","ar-MA":"DD/MM/YYYY","ro-MD":"DD.MM.YYYY","mk-MK":"DD.MM.YYYY","my-MM":"DD/MM/YYYY","mn-MN":"YYYY.MM.DD","zh-MO":"DD/MM/YYYY","en-MU":"DD/MM/YYYY","dv-MV":"DD/MM/YYYY","en-MW":"DD/MM/YYYY","es-MX":"DD/MM/YYYY","ms-MY":"DD/MM/YYYY","en-NA":"DD/MM/YYYY","en-NG":"DD/MM/YYYY","es-NI":"DD/MM/YYYY","no-NO":"DD.MM.YYYY","ne-NP":"YYYY/MM/DD","en-NZ":"DD/MM/YYYY","es-PE":"DD/MM/YYYY","en-PG":"DD/MM/YYYY","en-PH":"MM/DD/YYYY","en-PK":"DD/MM/YYYY","ar-QA":"DD/MM/YYYY","ru-RU":"DD.MM.YYYY","ar-SA":"DD/MM/YYYY","en-SC":"DD/MM/YYYY","sv-SE":"YYYY-MM-DD","en-SG":"DD/MM/YYYY","en-SL":"DD/MM/YYYY","so-SO":"DD/MM/YYYY","en-SS":"DD/MM/YYYY","es-SV":"DD/MM/YYYY","en-SZ":"DD/MM/YYYY","th-TH":"DD/MM/YYYY","en-TT":"MM/DD/YYYY","sw-TZ":"DD/MM/YYYY","en-US":"MM/DD/YYYY","es-UY":"DD/MM/YYYY","uz-UZ":"DD/MM/YYYY","ar-YE":"DD/MM/YYYY","en-ZA":"YYYY/MM/DD","ar-KW":"DD/MM/YYYY","ar-BH":"DD/MM/YYYY","ar-OM":"DD/MM/YYYY"};var O=e(((x,e)=>{const n=e.includes("/")?"/":e.includes(".")?".":"-",a=e.split(n),r=x.split(n).map((x=>parseInt(x,10)));let t=0,o=0,s=0,d=!1,Y=!1,D=!1;if(r.length!==a.length)return null;if(a.forEach(((x,e)=>{if(isNaN(r[e]))return null;switch(x){case"DD":s=r[e],D=!0;break;case"MM":o=r[e]-1,Y=!0;break;case"YYYY":t=r[e],d=!0}})),d&&Y&&D){const x=new Date(t,o,s);if(x.getFullYear()===t&&x.getMonth()===o&&x.getDate()===s)return x}return null}));var U=e(((x,e)=>{e||(e=a.getState().locale||s());const n=H[e];if(!n)throw new Error(`No date format found for locale: ${e}`);return O(x,n)}));var v=e(((x,e,n)=>(x="string"==typeof x?new Date(w(x)):new Date(x),I(x,-e,n))));export{I as add,A as formatDate,N as formatDateTime,Y as formatNumber,l as formatNumberByParts,g as formatPhoneNumber,E as formatTime,M as getCurrencyList,i as getCurrencySymbol,f as getFirstDayOfWeek,T as getQuarter,K as getRelativeTime,r as getState,R as getWeek,G as getWeekdays,P as isAfter,B as isBefore,C as isLeapYear,L as isSameDay,p as isValidDate,S as isValidPhoneNumber,U as parseDate,h as parsePhoneNumber,o as resetState,t as setState,v as subtract}; -//# sourceMappingURL=index.min.js.map diff --git a/lib/esm/index.min.js.map b/lib/esm/index.min.js.map deleted file mode 100644 index 9d011e82..00000000 --- a/lib/esm/index.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.min.js","sources":["../../src/common/errorBoundary/index.ts","../../src/modules/.internal/state/index.ts","../../src/modules/.internal/utils/getDefaultState.ts","../../src/modules/core/getState.ts","../../src/modules/core/setState.ts","../../src/modules/core/resetState.ts","../../src/modules/.internal/utils/getLocale.ts","../../src/modules/.internal/utils/getIntlInstanceWithOptions.ts","../../src/modules/currency/formatNumber.ts","../../src/modules/currency/data/currencies.ts","../../src/modules/currency/getCurrencyList.ts","../../src/modules/currency/getCurrencySymbol.ts","../../src/modules/currency/constants.ts","../../src/modules/currency/formatNumberByParts.ts","../../src/modules/phoneNumber/data/phoneRegexMapper.ts","../../src/modules/phoneNumber/data/dialCodeMapper.ts","../../src/modules/phoneNumber/utils.ts","../../src/modules/phoneNumber/isValidPhoneNumber.ts","../../src/modules/phoneNumber/data/phoneFormatterMapper.ts","../../src/modules/phoneNumber/formatPhoneNumber.ts","../../src/modules/phoneNumber/parsePhoneNumber.ts","../../src/modules/dateTime/utils.ts","../../src/modules/dateTime/add.ts","../../src/modules/dateTime/formatDateTime.ts","../../src/modules/dateTime/formatDate.ts","../../src/modules/dateTime/formatTime.ts","../../src/modules/dateTime/getFirstDayOfWeek.ts","../../src/modules/dateTime/getQuarter.ts","../../src/modules/dateTime/getRelativeTime.ts","../../src/modules/dateTime/getWeek.ts","../../src/modules/dateTime/getWeekdays.ts","../../src/modules/dateTime/isAfter.ts","../../src/modules/dateTime/isBefore.ts","../../src/modules/dateTime/isLeapYear.ts","../../src/modules/dateTime/isSameDay.ts","../../src/modules/dateTime/isValidDate.ts","../../src/modules/dateTime/data/localeDateFormats.ts","../../src/modules/dateTime/parseDateWithFormat.ts","../../src/modules/dateTime/parseDate.ts","../../src/modules/dateTime/subtract.ts"],"sourcesContent":["// Custom Error class to extend properties to error object\nexport class I18nifyError extends Error {\n timestamp: Date;\n constructor(message: string | undefined) {\n super(message);\n this.name = 'i18nify Error';\n this.timestamp = new Date();\n // more params like type of error/severity can be added in future for better debugging.\n }\n}\n\n/**\n * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block.\n * It appends additional attributes and serves as a centralized error-handling service.\n * Usage =>\n * const wrappedUtilityFn = withErrorBoundary(utilityFn)\n *\n * @param fn utility that is wrapped in error boundary\n * @returns {Function} returns the function wrapped in try/catch block\n */\nexport const withErrorBoundary = any>(\n fn: T,\n): ((...args: Parameters) => ReturnType) => {\n return function (this: unknown, ...rest: Parameters): ReturnType {\n try {\n return fn.call(this, ...rest) as ReturnType;\n } catch (err) {\n console.warn('[I18N Error]: ', err);\n // Currently, we are throwing the error as it is to consumers.\n // In the future, this can be modified as per our requirement, like an error logging service.\n throw new I18nifyError(err as string | undefined);\n }\n };\n};\n","import { I18nState } from './types';\nimport { getDefaultState } from '../utils/getDefaultState';\n\nexport class I18nStateManager {\n private static instance: I18nStateManager | undefined;\n private state: I18nState;\n\n private constructor() {\n this.state = getDefaultState();\n }\n\n public static getInstance(): I18nStateManager {\n if (!I18nStateManager.instance) {\n I18nStateManager.instance = new I18nStateManager();\n }\n\n return I18nStateManager.instance;\n }\n\n public static resetInstance(): void {\n I18nStateManager.instance = undefined;\n }\n\n public getState(): I18nState {\n return { ...this.state };\n }\n\n public setState(newState: Partial): void {\n this.state = { ...this.state, ...newState };\n }\n\n public resetState(): void {\n this.state = getDefaultState();\n }\n}\n\nexport default I18nStateManager.getInstance();\n","import type { I18nState } from '../state/types';\n\nexport function getDefaultState(): I18nState {\n return {\n locale: '',\n direction: '',\n country: '',\n };\n}\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * function to return active i18n state\n *\n * ===== USAGE =====\n * import { getState } from '@razorpay/i18nify-js';\n *\n * console.log(getState())\n *\n * @returns i18n state\n */\nconst getState = (): I18nState => {\n return state.getState();\n};\n\nexport default withErrorBoundary(getState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * Function to set and override the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { setState } from \"@razorpay/i18nify-js\";\n * setState({locale: 'en-US'})\n *\n * @param newState data to set in i18nState instance\n */\nconst setState = (newState: Partial): void => {\n state.setState(newState);\n};\n\nexport default withErrorBoundary(setState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\n\n/**\n * Function to reset the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { resetState } from \"@razorpay/i18nify-js\";\n * resetState()\n *\n * @param newState data to set in i18nState instance\n */\nconst resetState = (): void => {\n state.resetState();\n};\n\nexport default withErrorBoundary(resetState);\n","export const getLocale = (): string => {\n // Check if running in a non-browser environment (e.g., Node.js or older browsers).\n if (typeof navigator === 'undefined') {\n return 'en-IN';\n }\n\n // Check if the browser supports the Intl object and user language preferences.\n if (\n window.Intl &&\n typeof window.Intl === 'object' &&\n (window.navigator.languages || window.navigator.language)\n ) {\n const userLocales = window.navigator.languages || [\n window.navigator.language,\n ];\n return userLocales[0];\n }\n\n // Fallback to a supported locale or the default locale.\n return 'en-IN';\n};\n","import { CURRENCIES } from '../../currency/data/currencies';\nimport state from '../state';\nimport { getLocale } from './getLocale';\n\nexport const getIntlInstanceWithOptions = (\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n) => {\n /** retrieve locale from below areas in order of preference\n * 1. options.locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n let locale = options?.locale || state.getState().locale;\n\n // If a specific locale is provided, use it; otherwise, use the browser's locale\n if (!locale) {\n locale = getLocale();\n }\n\n const intlOptions = options?.intlOptions ? { ...options.intlOptions } : {};\n\n if (options?.currency || intlOptions.currency) {\n intlOptions.style = 'currency';\n intlOptions.currency = (options.currency || intlOptions.currency) as string;\n }\n\n if (!locale) throw new Error('Pass valid locale !');\n\n return new Intl.NumberFormat(locale || undefined, intlOptions);\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\n\n// this function formats number based on different arguments passed\nconst formatNumber = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): string => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n let formattedAmount = '';\n\n try {\n formattedAmount = getIntlInstanceWithOptions(options).format(\n Number(amount),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedAmount;\n};\n\nexport default withErrorBoundary(formatNumber);\n","export const CURRENCIES: { [key: string]: { symbol: string; name: string } } = {\n AED: { symbol: 'د.إ', name: 'United Arab Emirates Dirham' },\n ALL: { symbol: 'Lek', name: 'Albanian Lek' },\n AMD: { symbol: '֏', name: 'Armenian Dram' },\n ARS: { symbol: 'ARS', name: 'Argentine Peso' },\n AUD: { symbol: 'A$', name: 'Australian Dollar' },\n AWG: { symbol: 'Afl.', name: 'Aruban Florin' },\n BBD: { symbol: '$', name: 'Barbadian Dollar' },\n BDT: { symbol: '৳', name: 'Bangladeshi Taka' },\n BMD: { symbol: '$', name: 'Bermudian Dollar' },\n BND: { symbol: 'BND', name: 'Brunei Dollar' },\n BOB: { symbol: 'Bs', name: 'Bolivian Boliviano' },\n BSD: { symbol: 'B$', name: 'Bahamian Dollar' },\n BWP: { symbol: 'P', name: 'Botswanan Pula' },\n BZD: { symbol: 'BZ$', name: 'Belize Dollar' },\n CAD: { symbol: 'C$', name: 'Canadian Dollar' },\n CHF: { symbol: 'CHf', name: 'Swiss Franc' },\n CNY: { symbol: '¥', name: 'Chinese Yuan' },\n COP: { symbol: 'COL$', name: 'Colombian Peso' },\n CRC: { symbol: '₡', name: 'Costa Rican Colón' },\n CUP: { symbol: '$MN', name: 'Cuban Peso' },\n CZK: { symbol: 'Kč', name: 'Czech Koruna' },\n DKK: { symbol: 'DKK', name: 'Danish Krone' },\n DOP: { symbol: 'RD$', name: 'Dominican Peso' },\n DZD: { symbol: 'د.ج', name: 'Algerian Dinar' },\n EGP: { symbol: 'E£', name: 'Egyptian Pound' },\n ETB: { symbol: 'ብር', name: 'Ethiopian Birr' },\n EUR: { symbol: '€', name: 'Euro' },\n FJD: { symbol: 'FJ$', name: 'Fijian Dollar' },\n GBP: { symbol: '£', name: 'British Pound' },\n GHS: { symbol: 'GH₵', name: 'Ghanaian Cedi' },\n GIP: { symbol: 'GIP', name: 'Gibraltar Pound' },\n GMD: { symbol: 'D', name: 'Gambian Dalasi' },\n GTQ: { symbol: 'Q', name: 'Guatemalan Quetzal' },\n GYD: { symbol: 'G$', name: 'Guyanese Dollar' },\n HKD: { symbol: 'HK$', name: 'Hong Kong Dollar' },\n HNL: { symbol: 'HNL', name: 'Honduran Lempira' },\n HRK: { symbol: 'kn', name: 'Croatian Kuna' },\n HTG: { symbol: 'G', name: 'Haitian Gourde' },\n HUF: { symbol: 'Ft', name: 'Hungarian Forint' },\n IDR: { symbol: 'Rp', name: 'Indonesian Rupiah' },\n ILS: { symbol: '₪', name: 'Israeli New Shekel' },\n INR: { symbol: '₹', name: 'Indian Rupee' },\n JMD: { symbol: 'J$', name: 'Jamaican Dollar' },\n KES: { symbol: 'Ksh', name: 'Kenyan Shilling' },\n KGS: { symbol: 'Лв', name: 'Kyrgystani Som' },\n KHR: { symbol: '៛', name: 'Cambodian Riel' },\n KYD: { symbol: 'CI$', name: 'Cayman Islands Dollar' },\n KZT: { symbol: '₸', name: 'Kazakhstani Tenge' },\n LAK: { symbol: '₭', name: 'Laotian Kip' },\n LKR: { symbol: 'රු', name: 'Sri Lankan Rupee' },\n LRD: { symbol: 'L$', name: 'Liberian Dollar' },\n LSL: { symbol: 'LSL', name: 'Lesotho Loti' },\n MAD: { symbol: 'د.م.', name: 'Moroccan Dirham' },\n MDL: { symbol: 'MDL', name: 'Moldovan Leu' },\n MKD: { symbol: 'ден', name: 'Macedonian Denar' },\n MMK: { symbol: 'MMK', name: 'Myanmar Kyat' },\n MNT: { symbol: '₮', name: 'Mongolian Tugrik' },\n MOP: { symbol: 'MOP$', name: 'Macanese Pataca' },\n MUR: { symbol: '₨', name: 'Mauritian Rupee' },\n MVR: { symbol: 'Rf', name: 'Maldivian Rufiyaa' },\n MWK: { symbol: 'MK', name: 'Malawian Kwacha' },\n MXN: { symbol: 'Mex$', name: 'Mexican Peso' },\n MYR: { symbol: 'RM', name: 'Malaysian Ringgit' },\n NAD: { symbol: 'N$', name: 'Namibian Dollar' },\n NGN: { symbol: '₦', name: 'Nigerian Naira' },\n NIO: { symbol: 'NIO', name: 'Nicaraguan Córdoba' },\n NOK: { symbol: 'NOK', name: 'Norwegian Krone' },\n NPR: { symbol: 'रू', name: 'Nepalese Rupee' },\n NZD: { symbol: 'NZ$', name: 'New Zealand Dollar' },\n PEN: { symbol: 'S/', name: 'Peruvian Nuevo Sol' },\n PGK: { symbol: 'PGK', name: 'Papua New Guinean Kina' },\n PHP: { symbol: '₱', name: 'Philippine Peso' },\n PKR: { symbol: '₨', name: 'Pakistani Rupee' },\n QAR: { symbol: 'QR', name: 'Qatari Riyal' },\n RUB: { symbol: '₽', name: 'Russian Ruble' },\n SAR: { symbol: 'SR', name: 'Saudi Riyal' },\n SCR: { symbol: 'SRe', name: 'Seychellois Rupee' },\n SEK: { symbol: 'SEK', name: 'Swedish Krona' },\n SGD: { symbol: 'S$', name: 'Singapore Dollar' },\n SLL: { symbol: 'Le', name: 'Sierra Leonean Leone' },\n SOS: { symbol: 'Sh.so.', name: 'Somali Shilling' },\n SSP: { symbol: 'SS£', name: 'South Sudanese Pound' },\n SVC: { symbol: '₡', name: 'Salvadoran Colón' },\n SZL: { symbol: 'E', name: 'Swazi Lilangeni' },\n THB: { symbol: '฿', name: 'Thai Baht' },\n TTD: { symbol: 'TT$', name: 'Trinidad and Tobago Dollar' },\n TZS: { symbol: 'Sh', name: 'Tanzanian Shilling' },\n USD: { symbol: '$', name: 'United States Dollar' },\n UYU: { symbol: '$U', name: 'Uruguayan Peso' },\n UZS: { symbol: \"so'm\", name: 'Uzbekistani Som' },\n YER: { symbol: '﷼', name: 'Yemeni Rial' },\n ZAR: { symbol: 'R', name: 'South African Rand' },\n KWD: { symbol: 'د.ك', name: 'Kuwaiti Dinar' },\n BHD: { symbol: 'د.ب.', name: 'Bahraini Dinar' },\n OMR: { symbol: 'ر.ع.', name: 'Omani Rial' },\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencyList = () => {\n return CURRENCIES;\n};\n\nexport default withErrorBoundary(getCurrencyList);\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencySymbol = (currencyCode: keyof typeof CURRENCIES): string => {\n if (currencyCode in CURRENCIES) return CURRENCIES[currencyCode]?.symbol;\n else throw new Error('Invalid currencyCode!');\n};\n\nexport default withErrorBoundary(getCurrencySymbol);\n","export const ALLOWED_FORMAT_PARTS_KEYS = [\n 'nan',\n 'infinity',\n 'percent',\n 'integer',\n 'group',\n 'decimal',\n 'fraction',\n 'plusSign',\n 'minusSign',\n 'percentSign',\n 'currency',\n 'code',\n 'symbol',\n 'name',\n 'compact',\n 'exponentInteger',\n 'exponentMinusSign',\n 'exponentSeparator',\n 'unit',\n] as const;\n","import { CURRENCIES } from './data/currencies';\nimport { ByParts, FormattedPartsObject } from './types';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\nimport { ALLOWED_FORMAT_PARTS_KEYS } from './constants';\n\nconst formatNumberByParts = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): ByParts => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n try {\n const formattedAmount = getIntlInstanceWithOptions(options).formatToParts(\n Number(amount),\n );\n\n const parts = formattedAmount;\n\n const formattedObj: FormattedPartsObject = {};\n\n parts.forEach((p) => {\n if (p.type === 'group') {\n formattedObj.integer = (formattedObj.integer || '') + p.value;\n } else if (\n ALLOWED_FORMAT_PARTS_KEYS.findIndex((item) => item === p.type) != -1\n ) {\n // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal' is skipped\n formattedObj[p.type] = (formattedObj[p.type] || '') + p.value;\n }\n });\n\n return {\n ...formattedObj,\n isPrefixSymbol: parts[0].type === 'currency',\n rawParts: parts,\n };\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(\n formatNumberByParts,\n);\n","export const PHONE_REGEX_MAPPER: { [key: string]: RegExp } = {\n IN: /^(?:(?:\\+|0{0,2})91\\s*[-]?\\s*|[0]?)?[6789]\\d{9}$/,\n MY: /^(\\+?6?0)?(\\d{1,3})[-. ]?(\\d{7,8})$/,\n AE: /^(?:\\+?971|0)?(?:2|3|4|6|7|9)\\d{8}$/,\n AL: /^(?:\\+?355)?(?:[4-9]\\d{7}|6\\d{8})$/,\n AM: /^(?:\\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/,\n AR: /^(?:(?:\\+|0{0,2})54)?(?:11|[2368]\\d)(?:(?=\\d{0,2}15)\\d{2})??\\d{8}$/,\n AU: /^(?:\\+?61|0)4\\d{8}$/,\n AW: /^(?:(?:\\+297)?(?!0)\\d{7})$/,\n BB: /^(?:(?:\\+1)?246)?(?:\\d{3})?\\d{7}$/,\n BD: /^(?:\\+?880|0)1[13456789]\\d{8}$/,\n BM: /^(?:(?:\\+1)?441)?(?:\\d{2})?\\d{7}$/,\n BN: /^(?:\\+?673)?(?:\\d{3})?\\d{4}$/,\n BO: /^(?:(?:\\+|0{0,2})591)?(?:(?:2|3|7|6)\\d{7})$/,\n BS: /^(?:(?:\\+1)?242)?(?:\\d{3})?\\d{7}$/,\n BW: /^(?:(?:\\+267)?\\s?)?[74]\\d{7}$/,\n BZ: /^(?:(?:\\+501)?\\s?)?[622]\\d{4}$/,\n CH: /^(?:(?:\\+41|0)(?:\\s*\\(?0\\)?\\s*))?(?:\\d{2}\\s*)?\\d{3}\\s*\\d{2}\\s*\\d{2}$/,\n CN: /^(?:(?:\\+|00)86)?1\\d{10}$/,\n CO: /^(?:(?:\\+57|0057)?)?[1-8]{1}\\d{6,7}$/,\n OM: /^(?:\\+?968)?(?:95|96|97|98)\\d{6}$/,\n CR: /^(?:(?:\\+506)?\\s*|0)?[1-9]\\d{7}$/,\n CU: /^(?:\\+?53)?(?:[5-8]\\d{7})$/,\n CZ: /^(?:\\+?420)?(?:\\d{9})$/,\n DK: /^(?:\\+?45)?(?:\\d{8})$/,\n DO: /^(?:(?:\\+1)?809|1-8(?:00|88|89))(?:\\d{7})$/,\n DZ: /^(?:\\+?213|0)([567]\\d{8})$/,\n EG: /^(?:(?:\\+20|20)?(\\d{10}))$/,\n ET: /^(?:\\+?251)?[1-59]\\d{8}$/,\n EU: /^(?:(?:\\+?3)?8)?\\s*(?:\\d{3}\\s*){3}\\d{2}$/,\n FJ: /^(?:(?:\\+?679)?\\s?\\d{3}\\s?\\d{4})?$/,\n GB: /^(?:(?:\\+44\\s?|0)7\\d{3}(\\s?\\d{4,})?)$/,\n GH: /^(?:(?:\\+233)|0)?(?:\\d{9})$/,\n GI: /^(?:\\+350)?\\d{5}$/,\n GM: /^(?:\\+220)?\\d{5,7}$/,\n GT: /^(?:\\+502)?[2468]\\d{7,8}$/,\n GY: /^(?:(?:\\+592)?(?:(?:\\s)?[2-9])(?:(?:\\s)?\\d))?(?:(?:\\s)?\\d{4})$/,\n HK: /^(?:\\+852\\s?)?[456789]\\d{3}\\s?\\d{4}$/,\n HN: /^(?:\\+504)?[89]\\d{7}$/,\n HR: /^(?:\\+?385)?\\d{8,9}$/,\n HT: /^(?:\\+?509)?\\d{8}$/,\n HU: /^(?:(?:\\+36))(\\s?\\d{2}\\s?\\d{3}\\s?\\d{4})$/,\n ID: /^(?:\\+?62|0[1-9])[\\s-]?\\d{2,4}[\\s-]?\\d{3,4}[\\s-]?\\d{3,4}$/,\n IL: /^(?:(?:\\+972|0)(?:-)?)[23489]\\d{7}$/,\n JM: /^(?:(?:\\+1876))\\d{7,10}$/,\n KE: /^(?:(?:\\+254)|(?:0))(?:\\d{6,7})$/,\n KG: /^(?:\\+996)?\\s?\\d{9}$/,\n KH: /^(?:(?:\\+855)|(?:0))(?:\\s?[1-9]\\d{7,8})$/,\n KY: /^(?:\\+?1\\s?(345))\\d{6}$/,\n KZ: /^(?:\\+?7|8)?7\\d{9}$/,\n LA: /^(?:(?:\\+?856)|0)(20\\d{7,9})$/,\n LK: /^(?:(?:\\+94)|0)(?:\\d{9})$/,\n LR: /^(?:\\+231)[ -\\d]{4}[ -\\d]{4}$/,\n LS: /^(?:(?:\\+?266)|0)?[56]\\d{7}$/,\n MA: /^(?:(?:\\+?212(\\s*[-|\\s*]?\\d{1,9})?)|(?:0))(?:\\d{9})$/,\n MD: /^(?:(?:\\+373)|(?:0))(?:\\d{7,8})$/,\n MK: /^(?:\\+389|0)(?:(?:2[0-4]|[3-9])\\s?)?\\d{6}$/,\n MM: /^(?:(?:\\+?95)|0)?[1-9]\\d{9}$/,\n MN: /^(?:\\+976|0)\\d{8}$/,\n MO: /^(?:(?:\\+?853)|[0-9])?\\d{8}$/,\n MU: /^(?:\\+230|0)?\\d{8}$/,\n MV: /^(?:(?:\\+?960)|0)?\\d{7}$/,\n MW: /^(?:\\+265)[1-9]\\d{6}$/,\n MX: /^(?:(?:\\+?52)?\\s?(?:1|01)?\\s?)?(?:\\d{3}\\s?\\d{3}\\s?\\d{4})$/,\n NA: /^(?:(?:\\+264)|0)?\\d{8}$/,\n NG: /^(?:(?:\\+234)|(?:0))(?:\\d{7,8})$/,\n NI: /^(?:(?:\\+505))?(?:\\d{8})$/,\n NO: /^(?:(?:\\+?47)|\\d{2}|\\d{3})\\s?\\d{2}\\s?\\d{3}$/,\n NP: /^(?:(?:\\+977))?(\\d{9,10})$/,\n NZ: /^(?:\\+?64|0)(\\d{2,5} \\d{4,8}|\\d{3,4} \\d{4})$/,\n PE: /^(?:(?:\\+51)|0)?(?:9\\d{8})$/,\n PG: /^(?:\\+?675)?(?:[7-9]\\d{7})$/,\n PH: /^(?:(?:\\+?63)|0)(?:\\d{10})$/,\n PK: /^(?:(?:\\+92)|0)?[345]\\d{9}$/,\n QA: /^(?:\\+?974)?-?33\\d{5}$/,\n RU: /^(?:\\+?7|8)?[ -]?\\(?9\\d{2}\\)?[ -]?\\d{3}[ -]?\\d{2}[ -]?\\d{2}$/,\n SA: /^(?:\\+?966)?\\s?1?[\\s-]?(?:[45]\\d{2}|5\\d{3})[\\s-]?\\d{4}$/,\n SC: /^(?:(?:\\+248)|\\d{4})\\d{5}$/,\n SE: /^(?:\\+?46|0)\\s?[1-57-9](?:[0-9]\\s?){8}$/,\n SG: /^(?:(?:\\+65)|(?:\\(\\+65\\))|(?:65))\\d{4}\\d{4}$/,\n SL: /^(?:(?:\\+232)|(?:0))?\\d{9}$/,\n SO: /^(?:\\+252|0)?[567]\\d{7}$/,\n SS: /^(?:\\+211|0)?[1-9]\\d{7,9}$/,\n SV: /^(?:(?:\\+?503)|(?:0))(?:\\d{8})$/,\n SZ: /^(?:\\+?268)?\\d{7,8}$/,\n TH: /^(?:(?:\\+66)|0)\\d{9}$/,\n TT: /^(?:(?:\\+?1-868)|\\(?868\\)?)(\\d{7})$/,\n TZ: /^(?:(?:\\+?255)|0)?[67]\\d{8}$/,\n US: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n CA: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n UY: /^(?:(?:\\+598|0)\\s?(9\\d{3}|2\\d{2}|[4-9]\\d{6}))$/,\n UZ: /^(?:\\+?998)?\\s?[3456789]\\d{8}$/,\n YE: /^(?:\\+?967)?(?:\\d{7,8})$/,\n ZA: /^(?:(?:\\+27)|0)(\\d{9})$/,\n KW: /^(?:\\+?965)[569]\\d{7}$/,\n BH: /^(?:\\+?973)?[356]\\d{7}$/,\n TL: /^(?:(?:\\+670)\\s?)?[0-9]{3}\\s?[0-9]{3,4}$/,\n VC: /^(?:(?:\\+1)?784)?(?:\\d{3})?\\d{7}$/,\n VE: /^(?:(?:\\+58)|0)?4\\d{9}$/,\n VN: /^(?:(?:\\+84)|0)?[1-9]\\d{8}$/,\n ZM: /^(?:(?:\\+260)|0)?[123456789]\\d{8,9}$/,\n ZW: /^(?:(?:\\+263)|0)?(?:\\d{9,10})$/,\n LT: /^(?:(?:\\+370)|8)\\d{8}$/,\n LU: /^(?:(?:\\+352)?(6|2(6|7|8|9))\\d{6})$/,\n LV: /^(?:(?:\\+371)?2\\d{7})$/,\n ME: /^(?:(?:\\+382)?[67]\\d{7,20})$/,\n MG: /^(?:(?:\\+261)?3[234568]\\d{7})$/,\n MZ: /^(?:(?:\\+258)|(?:258))?8[234567]\\d{7,8}$/,\n NL: /^(?:(?:\\+31)|0(6(?:\\d{8})|[1-9](?:(?:\\d{8})|(?:\\s\\d{3}\\s\\d{4}))|(?:\\d{8})))$/,\n PA: /^(?:(?:\\+507)\\s?)?[46]\\d{6,7}$/,\n PL: /^(?:(?:\\+48)?(?:\\s?\\d{3}\\s?\\d{3}\\s?\\d{3}|(?:\\d{2}\\s?){4}\\d{2}|\\d{3}-\\d{3}-\\d{3}))$/,\n PR: /^(?:(?:\\+1)?787|939)\\d{7}$/,\n PS: /^(?:(?:\\+970))(5[2349])\\d{7}$/,\n PT: /^(?:(?:\\+351)?9(1\\d|2[1-9]|6[12345789]|7[12345789])\\d{7})$/,\n PY: /^(?:(?:\\+595|0)9[9876]\\d{7})$/,\n RO: /^(?:(?:\\+40|0))(?:7[2-8]\\d{7}|21\\d{8})$/,\n RS: /^(?:(?:\\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/,\n RW: /^(?:(?:\\+250)|(0))\\d{9}$/,\n SI: /^(?:(?:\\+386)|0)?[1-59]\\d{7,8}$/,\n SK: /^(?:(?:\\+421))?(0|9[0-8])\\d{8}$/,\n SM: /^(?:(?:\\+378)|(0549|6\\d{4}))\\d{5}$/,\n SN: /^(?:(?:\\+221)|0)?[3679]\\d{7}$/,\n SR: /^(?:(?:\\+597))\\d{7}$/,\n TG: /^(?:(?:\\+228))\\d{8}$/,\n TJ: /^(?:(?:\\+992))(37|55|77)\\d{7}$/,\n TN: /^(?:(?:\\+216)|22|9[1-9])\\d{7}$/,\n TR: /^(?:(?:\\+90)|(0))\\s?5\\d{9}$/,\n TW: /^(?:(?:\\+886)|0)?9\\d{8}$/,\n UA: /^(?:(?:\\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\\d{7}$/,\n UG: /^(?:(?:\\+256)|0)?[39]\\d{8}$/,\n};\n","/* Source: Google LibPhoneNumber Metadata: https://github.com/google/libphonenumber/blob/master/javascript/i18n/phonenumbers/metadata.js */\n\nexport const DIAL_CODE_MAPPER: { [key: number]: string[] } = {\n 1: [\n 'US',\n 'AG',\n 'AI',\n 'AS',\n 'BB',\n 'BM',\n 'BS',\n 'CA',\n 'DM',\n 'DO',\n 'GD',\n 'GU',\n 'JM',\n 'KN',\n 'KY',\n 'LC',\n 'MP',\n 'MS',\n 'PR',\n 'SX',\n 'TC',\n 'TT',\n 'VC',\n 'VG',\n 'VI',\n ],\n 7: ['RU', 'KZ'],\n 20: ['EG'],\n 27: ['ZA'],\n 30: ['GR'],\n 31: ['NL'],\n 32: ['BE'],\n 33: ['FR'],\n 34: ['ES'],\n 36: ['HU'],\n 39: ['IT', 'VA'],\n 40: ['RO'],\n 41: ['CH'],\n 43: ['AT'],\n 44: ['GB', 'GG', 'IM', 'JE'],\n 45: ['DK'],\n 46: ['SE'],\n 47: ['NO', 'SJ'],\n 48: ['PL'],\n 49: ['DE'],\n 51: ['PE'],\n 52: ['MX'],\n 53: ['CU'],\n 54: ['AR'],\n 55: ['BR'],\n 56: ['CL'],\n 57: ['CO'],\n 58: ['VE'],\n 60: ['MY'],\n 61: ['AU', 'CC', 'CX'],\n 62: ['ID'],\n 63: ['PH'],\n 64: ['NZ'],\n 65: ['SG'],\n 66: ['TH'],\n 81: ['JP'],\n 82: ['KR'],\n 84: ['VN'],\n 86: ['CN'],\n 90: ['TR'],\n 91: ['IN'],\n 92: ['PK'],\n 93: ['AF'],\n 94: ['LK'],\n 95: ['MM'],\n 98: ['IR'],\n 211: ['SS'],\n 212: ['MA', 'EH'],\n 213: ['DZ'],\n 216: ['TN'],\n 218: ['LY'],\n 220: ['GM'],\n 221: ['SN'],\n 222: ['MR'],\n 223: ['ML'],\n 224: ['GN'],\n 225: ['CI'],\n 226: ['BF'],\n 227: ['NE'],\n 228: ['TG'],\n 229: ['BJ'],\n 230: ['MU'],\n 231: ['LR'],\n 232: ['SL'],\n 233: ['GH'],\n 234: ['NG'],\n 235: ['TD'],\n 236: ['CF'],\n 237: ['CM'],\n 238: ['CV'],\n 239: ['ST'],\n 240: ['GQ'],\n 241: ['GA'],\n 242: ['CG'],\n 243: ['CD'],\n 244: ['AO'],\n 245: ['GW'],\n 246: ['IO'],\n 247: ['AC'],\n 248: ['SC'],\n 249: ['SD'],\n 250: ['RW'],\n 251: ['ET'],\n 252: ['SO'],\n 253: ['DJ'],\n 254: ['KE'],\n 255: ['TZ'],\n 256: ['UG'],\n 257: ['BI'],\n 258: ['MZ'],\n 260: ['ZM'],\n 261: ['MG'],\n 262: ['RE', 'YT'],\n 263: ['ZW'],\n 264: ['NA'],\n 265: ['MW'],\n 266: ['LS'],\n 267: ['BW'],\n 268: ['SZ'],\n 269: ['KM'],\n 290: ['SH', 'TA'],\n 291: ['ER'],\n 297: ['AW'],\n 298: ['FO'],\n 299: ['GL'],\n 350: ['GI'],\n 351: ['PT'],\n 352: ['LU'],\n 353: ['IE'],\n 354: ['IS'],\n 355: ['AL'],\n 356: ['MT'],\n 357: ['CY'],\n 358: ['FI', 'AX'],\n 359: ['BG'],\n 370: ['LT'],\n 371: ['LV'],\n 372: ['EE'],\n 373: ['MD'],\n 374: ['AM'],\n 375: ['BY'],\n 376: ['AD'],\n 377: ['MC'],\n 378: ['SM'],\n 380: ['UA'],\n 381: ['RS'],\n 382: ['ME'],\n 383: ['XK'],\n 385: ['HR'],\n 386: ['SI'],\n 387: ['BA'],\n 389: ['MK'],\n 420: ['CZ'],\n 421: ['SK'],\n 423: ['LI'],\n 500: ['FK'],\n 501: ['BZ'],\n 502: ['GT'],\n 503: ['SV'],\n 504: ['HN'],\n 505: ['NI'],\n 506: ['CR'],\n 507: ['PA'],\n 508: ['PM'],\n 509: ['HT'],\n 590: ['GP', 'BL', 'MF'],\n 591: ['BO'],\n 592: ['GY'],\n 593: ['EC'],\n 594: ['GF'],\n 595: ['PY'],\n 596: ['MQ'],\n 597: ['SR'],\n 598: ['UY'],\n 599: ['CW', 'BQ'],\n 670: ['TL'],\n 672: ['NF'],\n 673: ['BN'],\n 674: ['NR'],\n 675: ['PG'],\n 676: ['TO'],\n 677: ['SB'],\n 678: ['VU'],\n 679: ['FJ'],\n 680: ['PW'],\n 681: ['WF'],\n 682: ['CK'],\n 683: ['NU'],\n 685: ['WS'],\n 686: ['KI'],\n 687: ['NC'],\n 688: ['TV'],\n 689: ['PF'],\n 690: ['TK'],\n 691: ['FM'],\n 692: ['MH'],\n 800: ['001'],\n 808: ['001'],\n 850: ['KP'],\n 852: ['HK'],\n 853: ['MO'],\n 855: ['KH'],\n 856: ['LA'],\n 870: ['001'],\n 878: ['001'],\n 880: ['BD'],\n 881: ['001'],\n 882: ['001'],\n 883: ['001'],\n 886: ['TW'],\n 888: ['001'],\n 960: ['MV'],\n 961: ['LB'],\n 962: ['JO'],\n 963: ['SY'],\n 964: ['IQ'],\n 965: ['KW'],\n 966: ['SA'],\n 967: ['YE'],\n 968: ['OM'],\n 970: ['PS'],\n 971: ['AE'],\n 972: ['IL'],\n 973: ['BH'],\n 974: ['QA'],\n 975: ['BT'],\n 976: ['MN'],\n 977: ['NP'],\n 979: ['001'],\n 992: ['TJ'],\n 993: ['TM'],\n 994: ['AZ'],\n 995: ['GE'],\n 996: ['KG'],\n 998: ['UZ'],\n};\n","import { DIAL_CODE_MAPPER } from './data/dialCodeMapper';\nimport { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\n\n/**\n * Determines the country code based on the provided phone number.\n * This function employs a multi-step approach to identify the country code:\n * - If the phone number starts with '+', it extracts the numeric characters\n * and matches the leading digits with known dial codes mapped to countries.\n * - For matched dial codes, it further filters based on country-specific regex patterns\n * to validate the phone number format for those countries.\n * - If the phone number doesn't start with '+', it directly matches the number\n * against regular expressions associated with various countries to identify the code.\n *\n * @param phoneNumber The input phone number (string or number).\n * @returns The detected country code or an empty string if not found.\n */\nexport const detectCountryCodeFromDialCode = (\n phoneNumber: string | number,\n): string => {\n // If the phone number starts with '+', extract numeric characters\n if (phoneNumber.toString().charAt(0) === '+') {\n const cleanedPhoneNumberWithoutPlusPrefix = phoneNumber\n .toString()\n .replace(/\\D/g, '');\n\n const matchingCountries: string[] = [];\n\n // Iterate through dial codes and check for matches with cleaned phone number\n for (const code in DIAL_CODE_MAPPER) {\n if (cleanedPhoneNumberWithoutPlusPrefix.startsWith(code)) {\n matchingCountries.push(...DIAL_CODE_MAPPER[code]);\n }\n }\n\n // Filter matching countries based on phone number validation regex\n const matchedCountryCode = matchingCountries.find((countryCode: string) => {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex && regex.test(phoneNumber.toString())) return countryCode;\n return undefined;\n });\n\n // Return the first matched country code, if any\n return matchedCountryCode || '';\n } else {\n // If phone number doesn't start with '+', directly match against country regexes\n for (const countryCode in PHONE_REGEX_MAPPER) {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex.test(phoneNumber.toString())) {\n return countryCode;\n }\n }\n }\n\n // Return empty string if no country code is detected\n return '';\n};\n\nexport const cleanPhoneNumber = (phoneNumber: string) => {\n // Regular expression to match all characters except numbers and + sign at the start\n const regex = /[^0-9+]|(?!A)\\+/g;\n // Replace matched characters with an empty string\n const cleanedPhoneNumber = phoneNumber.replace(regex, '');\n return phoneNumber[0] === '+' ? `+${cleanedPhoneNumber}` : cleanedPhoneNumber;\n};\n","import { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Validates whether a given phone number is valid based on the provided country code or auto-detects the country code and checks if the number matches the defined regex pattern for that country.\nconst isValidPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_REGEX_MAPPER,\n): boolean => {\n // Clean the provided phoneNumber by removing non-numeric characters\n const cleanedPhoneNumber = cleanPhoneNumber(phoneNumber.toString());\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_REGEX_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(cleanedPhoneNumber);\n\n // Return false if phoneNumber is empty\n if (!phoneNumber) return false;\n\n // Check if the countryCode exists in the PHONE_REGEX_MAPPER\n if (countryCode in PHONE_REGEX_MAPPER) {\n // Fetch the regex pattern for the countryCode\n const regex = PHONE_REGEX_MAPPER[countryCode];\n // Test if the cleanedPhoneNumber matches the regex pattern\n return regex.test(cleanedPhoneNumber as string);\n }\n\n // Return false if the countryCode is not supported\n return false;\n};\n\nexport default withErrorBoundary(isValidPhoneNumber);\n","export const PHONE_FORMATTER_MAPPER: { [key: string]: string } = {\n IN: 'xxxx xxxxxx',\n MY: 'xx xxxxx xx',\n AE: 'xx xxx xxxx',\n AL: 'xxx xx xxxx',\n AM: 'xx xx xx xx',\n AR: 'xxxx-xxxx',\n AU: 'xxx xxx xxx',\n AW: 'xxx-xxxx',\n BB: 'xxx-xxxx',\n BD: 'xxxx-xxxxxx',\n BM: 'xxx-xxxx',\n BN: 'xxxx-xxxx',\n BO: 'xxxx-xxxx',\n BS: 'xxx-xxxx',\n BW: 'xx xxxx xxxx',\n BZ: 'xxx-xxxx',\n CA: 'xxx-xxx-xxxx',\n CH: 'xxx xxx xxx',\n CN: 'xxxx-xxxxxxx',\n CO: 'xxxx-xxxxxxx',\n CR: 'xxxx-xxxx',\n CU: 'xxxx-xxxx',\n CZ: 'xxx xxx xxx',\n DK: 'xx xx xx xx',\n DO: 'xxx-xxxxxxx',\n DZ: 'xxxx-xxxx-xxx',\n EG: 'xx xxx xxxx',\n ET: 'xx xxx xxxx',\n EU: 'xxx xx xx xx',\n FJ: 'xxxx xxxx',\n GB: 'xxxx xxx xxx',\n GH: 'xxx xxx xxxx',\n GI: 'xxxx xxxx',\n GM: 'xxxx-xxxx',\n GT: 'xxxx-xxxx',\n GY: 'xxx-xxxx',\n HK: 'xxxx xxxx',\n HN: 'xxxx-xxxx',\n HR: 'xxx xxx xxxx',\n HT: 'xxx-xxxx',\n HU: 'xxx xxx xxxx',\n ID: 'xxxx-xxxx-xxxx',\n IL: 'xxxx-xxx-xxx',\n JM: 'xxx-xxxx',\n KE: 'xxx xxxxxx',\n KG: 'xxx-xx-xx-xx',\n KH: 'xxx-xxx-xxx',\n KY: 'xxx-xxxx',\n KZ: 'xxx-xxx-xx-xx',\n LA: 'xxx xx xxxx',\n LK: 'xx xxx xxxx',\n LR: 'xxx-xxx-xxxx',\n LS: 'xxx xx xxxx',\n LT: 'xxx xxxxx',\n LU: 'xxx xx xxx',\n LV: 'xxxx xxxx',\n MA: 'xxxx-xxxxxx',\n MD: 'xx xxxxxx',\n ME: 'xx xxxxxx',\n MG: 'xx xx xx xx xx',\n MK: 'xx xx xx xx',\n MM: 'xx xxxxxx',\n MN: 'xxx-xx-xxxx',\n MO: 'xxxx xxxx',\n MU: 'xx xxxx xxxx',\n MV: 'xxxxxx',\n MW: 'xx xxxx xxxx',\n MX: 'xxx-xxx-xxxx',\n MZ: 'xx xxxxxxx',\n NA: 'xx xxxx xxxx',\n NG: 'xxx xxx xxxx',\n NI: 'xxxx-xxxx',\n NL: 'xxx-xxxxxxx',\n NO: 'xxxx xxxx',\n NP: 'xxxx-xxxxxxx',\n NZ: 'xxx-xxxxxxx',\n OM: 'xxxx-xxxx',\n PA: 'xxx-xxxx',\n PE: 'xxx-xxx-xxx',\n PG: 'xxx-xxxxxx',\n PH: 'xxx-xxxx',\n PK: 'xxx-xxxxxxx',\n PL: 'xxx xxx xxx',\n PR: 'xxx-xxx-xxxx',\n PS: 'xxxx-xxxxxxx',\n PT: 'xxx xxx xxx',\n PY: 'xxx-xxxxxx',\n QA: 'xxxx xxxx',\n RO: 'xxx xxx xxxx',\n RS: 'xxx xxxxx',\n RU: 'xxx xxx-xx-xx',\n RW: 'xxx xxxxxx',\n SA: 'xxx-xxxxxxx',\n SC: 'xx xxxxx',\n SE: 'xxx-xxx xx xx',\n SG: 'xxxx xxxx',\n SI: 'xx xxxxxx',\n SK: 'xxx xxx xxx',\n SL: 'xxx-xxxxxx',\n SM: 'xxxxx xxxxx',\n SN: 'xx xxx xx xx',\n SO: 'xxx xxxxxxx',\n SR: 'xxx-xxxx',\n SS: 'xxx xxxx xxx',\n SV: 'xxxx-xxxx',\n SZ: 'xxx xx xxxx',\n TG: 'xx xx xx xx',\n TH: 'xxx-xxxxxxx',\n TJ: 'xxx xx xx xx',\n TL: 'xxx-xxxxxxx',\n TN: 'xx xxxxxx',\n TR: 'xxx xxx xx xx',\n TT: 'xxx-xxxx',\n TW: 'xxxx-xxxxxx',\n TZ: 'xxx xxx xxxx',\n UA: 'xx xxx xx xx',\n UG: 'xxx xxxxxxx',\n US: 'xxx-xxx-xxxx',\n UY: 'xxx-xxxxx',\n UZ: 'xxx-xxx-xx-xx',\n VC: 'xxx-xxxx',\n VE: 'xxxx-xxx-xxxx',\n VN: 'xxxx-xxxxxxx',\n YE: 'xxxx-xxxx',\n ZA: 'xxx-xxx-xxxx',\n ZM: 'xxx-xxxxxxx',\n ZW: 'xx xxx xxxx',\n KW: 'xxx xx xxxx',\n BH: 'xxxx xxxx',\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Formats a provided phone number according to the predefined format for a specific country code, or auto-detects the country code and formats the number accordingly.\nconst formatPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_FORMATTER_MAPPER,\n): string => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Convert phoneNumber to string and clean it by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_FORMATTER_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Fetch the pattern for the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern) return phoneNumber;\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n // Extract the phoneNumber without the prefix\n const phoneNumberWithoutPrefix = phoneNumber.slice(diff);\n const formattedNumber: string[] = [];\n let numberIndex = 0;\n\n // Loop through the pattern to format the phoneNumber\n for (let i = 0; i < pattern.length; i++) {\n const patternChar = pattern[i];\n if (patternChar === 'x') {\n // Insert phoneNumber digits at 'x' positions\n if (numberIndex < phoneNumberWithoutPrefix.length) {\n formattedNumber.push(phoneNumberWithoutPrefix[numberIndex]);\n numberIndex++;\n }\n } else {\n // Insert non-digit characters from the pattern\n formattedNumber.push(patternChar);\n }\n }\n\n // Join the formattedNumber array to create the formattedPhoneNumber without prefix\n const formattedPhoneNumberWithoutPrefix = formattedNumber.join('');\n // Combine the prefix and formattedPhoneNumberWithoutPrefix\n const formattedPhoneNumberWithPrefix =\n phoneNumber.slice(0, diff) + ' ' + formattedPhoneNumberWithoutPrefix;\n\n // Return the formattedPhoneNumber with prefix after trimming whitespace\n return formattedPhoneNumberWithPrefix.trim();\n};\n\nexport default withErrorBoundary(formatPhoneNumber);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport formatPhoneNumber from './formatPhoneNumber';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\ninterface PhoneInfo {\n countryCode: string;\n dialCode: string;\n formattedPhoneNumber: string;\n formatTemplate: string;\n}\n\n// Parses a given phone number, identifies its country code (if not provided), and returns an object with details including the country code, formatted phone number, dial code, and format template.\nconst parsePhoneNumber = (phoneNumber: string, country?: string): PhoneInfo => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Clean the phoneNumber by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n const countryCode =\n country && country in PHONE_FORMATTER_MAPPER\n ? country\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Format the phone number using the detected/validated country code\n const formattedPhoneNumber = formatPhoneNumber(phoneNumber, countryCode);\n\n // Fetch the pattern associated with the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern)\n return {\n countryCode: countryCode || '',\n dialCode: '',\n formattedPhoneNumber: phoneNumber,\n formatTemplate: '',\n };\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n\n // Extract the dialCode from the phoneNumber\n const dialCode = phoneNumber.slice(0, diff);\n\n // Obtain the format template associated with the countryCode\n const formatTemplate = PHONE_FORMATTER_MAPPER[countryCode];\n\n // Return the parsed phone number information\n return {\n countryCode,\n formattedPhoneNumber,\n dialCode,\n formatTemplate,\n };\n};\n\nexport default withErrorBoundary(parsePhoneNumber);\n","export const stringToDate = (dateString: string): Date => {\n const supportedDateFormats = [\n // Date formats\n {\n regex: /^(\\d{4})\\/(\\d{2})\\/(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY/MM/DD\n {\n regex: /^(\\d{2})\\/(\\d{2})\\/(\\d{4})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n }, // DD/MM/YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY.MM.DD\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // DD-MM-YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // MM/DD/YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY-MM-DD\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY. MM. DD.\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // DD.MM.YYYY\n\n // Timestamp formats\n {\n regex: /^(\\d{4})\\/(\\d{2})\\/(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY/MM/DD HH:MM:SS\n {\n regex: /^(\\d{2})\\/(\\d{2})\\/(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD/MM/YYYY HH:MM:SS\n {\n regex: /^(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY-MM-DD HH:MM:SS\n {\n regex: /^(\\d{2})-(\\d{2})-(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD-MM-YYYY HH:MM:SS\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY.MM.DD HH:MM:SS\n {\n regex: /^(\\d{2})\\.(\\d{2})\\.(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD.MM.YYYY HH:MM:SS\n ];\n\n for (const format of supportedDateFormats) {\n const match = dateString.match(format.regex);\n if (match) {\n const year = match[format.yearIndex];\n const month = match[format.monthIndex];\n const day = match[format.dayIndex];\n const hour = format.hourIndex ? match[format.hourIndex] : '00';\n const minute = format.minuteIndex ? match[format.minuteIndex] : '00';\n const second = format.secondIndex ? match[format.secondIndex] : '00';\n\n return new Date(`${year}-${month}-${day}T${hour}:${minute}:${second}`);\n }\n }\n\n throw new Error('Date format not recognized');\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Adds a specified amount of time to a date.\n *\n * @param date The original date.\n * @param value The amount to add.\n * @param unit The unit of time to add (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time added.\n */\nconst add = (\n date: DateInput,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n switch (unit) {\n case 'days':\n date.setDate(date.getDate() + value);\n break;\n case 'months':\n date.setMonth(date.getMonth() + value);\n break;\n case 'years':\n date.setFullYear(date.getFullYear() + value);\n break;\n }\n return date;\n};\n\nexport default withErrorBoundary(add);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Formats date and time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional).\n * @returns {string} Formatted date and time string.\n */\nconst formatDateTime = (\n date: DateInput,\n locale: Locale,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n const dateObj: Date = date instanceof Date ? date : new Date(date);\n let formatter;\n\n try {\n formatter = new Intl.DateTimeFormat(locale, intlOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formatter.format(dateObj);\n};\n\nexport default withErrorBoundary(formatDateTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n DateFormatOptions,\n} from './types';\n\n/**\n * Formats date based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional).\n * @returns {string} Formatted date string.\n */\nconst formatDate = (\n date: DateInput,\n locale: Locale,\n options: DateFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n timeStyle: undefined,\n };\n\n let formattedDate;\n\n try {\n formattedDate = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedDate;\n};\n\nexport default withErrorBoundary(formatDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n TimeFormatOptions,\n} from './types';\n\n/**\n * Formats time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional).\n * @returns {string} Formatted time string.\n */\nconst formatTime = (\n date: DateInput,\n locale: Locale,\n options: TimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n dateStyle: undefined,\n };\n\n let formattedTime;\n\n try {\n formattedTime = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedTime;\n};\n\nexport default withErrorBoundary(formatTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\n\n/**\n * Gets the first day of the week for a given locale.\n *\n * @param locale The locale to determine the first day of the week for.\n * @param intlOptions Optional Intl.DateTimeFormatOptions for customization.\n * @returns The first day of the week (0-6, where 0 is Sunday).\n */\nconst getFirstDayOfWeek = (\n locale: string,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n let formatted;\n\n if (!intlOptions.weekday) intlOptions.weekday = 'long';\n\n try {\n const formatter = new Intl.DateTimeFormat(locale, intlOptions);\n /**\n * This date was chosen because January 2, 2000, is a Sunday.\n * In the Gregorian calendar, Sunday is considered the start of the week in some cultures (like in the United States), while in others, it's Monday (like in much of Europe).\n * By using a date that is known to be a Sunday, the function can accurately determine what day of the week is considered the start in the specified locale.\n */\n const sundayDate = new Date(2000, 0, 2); // A known Sunday\n formatted = formatter.format(sundayDate);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n // Generate localized weekdays array starting from Sunday\n const weekdays = Array.from({ length: 7 }, (_, i) =>\n new Intl.DateTimeFormat(locale, intlOptions).format(\n new Date(2000, 0, 2 + i),\n ),\n );\n\n const firstDayIndex = weekdays.indexOf(formatted);\n if (firstDayIndex === -1) {\n throw new Error('Unable to determine the first day of the week');\n }\n\n return weekdays[(firstDayIndex + 1) % 7]; // Adjusting since our reference date is a Sunday\n};\n\nexport default withErrorBoundary(getFirstDayOfWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Determines the quarter of the year for a given date.\n *\n * @param date The date to determine the quarter for.\n * @returns The quarter of the year (1-4).\n */\nconst getQuarter = (date: DateInput): number => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n return Math.ceil((date.getMonth() + 1) / 3);\n};\n\nexport default withErrorBoundary(getQuarter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Provides a relative time string (e.g., '3 hours ago', 'in 2 days').\n * This function calculates the difference between the given date and the base date,\n * then formats it in a locale-sensitive manner. It allows customization of the output\n * through Intl.RelativeTimeFormat options.\n *\n * @param date - The date to compare.\n * @param baseDate - The date to compare against (default: current date).\n * @param locale - The locale to use for formatting.\n * @param options - Options for the Intl.RelativeTimeFormat (optional).\n * @returns The relative time as a string.\n */\nconst getRelativeTime = (\n date: DateInput,\n baseDate: DateInput = new Date(),\n locale: Locale,\n options?: Intl.RelativeTimeFormatOptions,\n): string => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n baseDate =\n typeof baseDate === 'string'\n ? new Date(stringToDate(baseDate))\n : new Date(baseDate);\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000;\n\n // Define time units in seconds\n const minute = 60;\n const hour = minute * 60;\n const day = hour * 24;\n const week = day * 7;\n const month = day * 30;\n const year = day * 365;\n\n let value: number;\n let unit: Intl.RelativeTimeFormatUnit;\n\n if (Math.abs(diffInSeconds) < minute) {\n value = diffInSeconds;\n unit = 'second';\n } else if (Math.abs(diffInSeconds) < hour) {\n value = diffInSeconds / minute;\n unit = 'minute';\n } else if (Math.abs(diffInSeconds) < day) {\n value = diffInSeconds / hour;\n unit = 'hour';\n } else if (Math.abs(diffInSeconds) < week) {\n value = diffInSeconds / day;\n unit = 'day';\n } else if (Math.abs(diffInSeconds) < month) {\n value = diffInSeconds / week;\n unit = 'week';\n } else if (Math.abs(diffInSeconds) < year) {\n value = diffInSeconds / month;\n unit = 'month';\n } else {\n value = diffInSeconds / year;\n unit = 'year';\n }\n\n let relativeTime;\n\n try {\n const rtf = new Intl.RelativeTimeFormat(locale, options);\n relativeTime = rtf.format(Math.round(value), unit);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return relativeTime;\n};\n\nexport default withErrorBoundary(getRelativeTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Calculates the week number of the year for a given date.\n *\n * @param date The date to calculate the week number for.\n * @returns The week number of the year.\n */\nconst getWeek = (date: DateInput): number => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n const firstDayOfYear = new Date(date.getFullYear(), 0, 1);\n const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000;\n return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7);\n};\n\nexport default withErrorBoundary(getWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Returns an array of weekdays according to the specified locale.\n *\n * @param locale The locale to get weekdays for.\n * @param intlOptions Optional Intl.DateTimeFormatOptions for customization.\n * @returns An array of weekday names.\n */\nconst getWeekdays = (\n locale: Locale,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string[] => {\n try {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n if (!intlOptions.weekday) intlOptions.weekday = 'long';\n\n const formatter = new Intl.DateTimeFormat(locale, intlOptions);\n\n /** The date January 1, 1970, is a well-known reference point in computing known as the Unix epoch.\n * It's the date at which time is measured for Unix systems, making it a consistent and reliable choice for date calculations.\n * The choice of the date January 4, 1970, as the starting point is significant.\n * January 4, 1970, was a Sunday.\n * Since weeks typically start on Sunday or Monday in most locales, starting from a known Sunday allows the function to cycle through a complete week, capturing all weekdays in the order they appear for the given locale.\n * */\n return Array.from({ length: 7 }, (_, i) =>\n formatter.format(new Date(1970, 0, 4 + i)),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(getWeekdays);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Compares two dates to determine if the first is after the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is after date2.\n */\nconst isAfter = (date1: DateInput, date2: DateInput): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 > dateObj2;\n};\n\nexport default withErrorBoundary(isAfter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Compares two dates to determine if the first is before the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is before date2.\n */\nconst isBefore = (date1: DateInput, date2: DateInput): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 < dateObj2;\n};\n\nexport default withErrorBoundary(isBefore);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given year is a leap year.\n *\n * @param year The year to check.\n * @returns True if the year is a leap year, false otherwise.\n */\nconst isLeapYear = (year: number): boolean => {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n};\n\nexport default withErrorBoundary(isLeapYear);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { stringToDate } from './utils';\n\n/**\n * Checks if two dates fall on the same day.\n *\n * @param date1 The first date.\n * @param date2 The second date.\n * @returns True if both dates are on the same day, false otherwise.\n */\nconst isSameDay = (date1: Date, date2: Date): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n return (\n date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear()\n );\n};\n\nexport default withErrorBoundary(isSameDay);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { stringToDate } from './utils';\n\n/**\n * Checks if a given object is a valid Date object.\n *\n * @param date The object to check.\n * @returns True if the object is a valid Date, false otherwise.\n */\nconst isValidDate = (date: any): boolean => {\n try {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return date instanceof Date && !isNaN(date.getTime());\n};\n\nexport default withErrorBoundary(isValidDate);\n","export const LOCALE_DATE_FORMATS: { [key: string]: string } = {\n 'ar-AE': 'DD/MM/YYYY', // Arabic (U.A.E.)\n 'sq-AL': 'DD.MM.YYYY', // Albanian (Albania)\n 'hy-AM': 'DD.MM.YYYY', // Armenian (Armenia)\n 'es-AR': 'DD/MM/YYYY', // Spanish (Argentina)\n 'en-AU': 'DD/MM/YYYY', // English (Australia)\n 'nl-AW': 'DD-MM-YYYY', // Dutch (Aruba)\n 'en-BB': 'MM/DD/YYYY', // English (Barbados)\n 'bn-BD': 'DD/MM/YYYY', // Bengali (Bangladesh)\n 'en-BM': 'MM/DD/YYYY', // English (Bermuda)\n 'ms-BN': 'DD/MM/YYYY', // Malay (Brunei)\n 'es-BO': 'DD/MM/YYYY', // Spanish (Bolivia)\n 'en-BS': 'MM/DD/YYYY', // English (Bahamas)\n 'en-BW': 'DD/MM/YYYY', // English (Botswana)\n 'en-BZ': 'MM/DD/YYYY', // English (Belize)\n 'en-CA': 'DD/MM/YYYY', // English (Canada)\n 'de-CH': 'DD.MM.YYYY', // German (Switzerland)\n 'zh-CN': 'YYYY/MM/DD', // Chinese (China)\n 'es-CO': 'DD/MM/YYYY', // Spanish (Colombia)\n 'es-CR': 'DD/MM/YYYY', // Spanish (Costa Rica)\n 'es-CU': 'DD/MM/YYYY', // Spanish (Cuba)\n 'cs-CZ': 'DD.MM.YYYY', // Czech (Czech Republic)\n 'da-DK': 'DD-MM-YYYY', // Danish (Denmark)\n 'es-DO': 'DD/MM/YYYY', // Spanish (Dominican Republic)\n 'ar-DZ': 'DD/MM/YYYY', // Arabic (Algeria)\n 'ar-EG': 'DD/MM/YYYY', // Arabic (Egypt)\n 'am-ET': 'DD/MM/YYYY', // Amharic (Ethiopia)\n 'en-EU': 'DD/MM/YYYY', // English (European Union)\n 'en-FJ': 'DD/MM/YYYY', // English (Fiji)\n 'en-GB': 'DD/MM/YYYY', // English (United Kingdom)\n 'en-GH': 'DD/MM/YYYY', // English (Ghana)\n 'en-GI': 'DD/MM/YYYY', // English (Gibraltar)\n 'en-GM': 'DD/MM/YYYY', // English (Gambia)\n 'es-GT': 'DD/MM/YYYY', // Spanish (Guatemala)\n 'en-GY': 'DD/MM/YYYY', // English (Guyana)\n 'en-HK': 'DD/MM/YYYY', // English (Hong Kong)\n 'es-HN': 'DD/MM/YYYY', // Spanish (Honduras)\n 'hr-HR': 'DD.MM.YYYY', // Croatian (Croatia)\n 'ht-HT': 'MM/DD/YYYY', // Haitian (Haiti)\n 'hu-HU': 'YYYY. MM. DD.', // Hungarian (Hungary)\n 'id-ID': 'DD/MM/YYYY', // Indonesian (Indonesia)\n 'he-IL': 'DD/MM/YYYY', // Hebrew (Israel)\n 'en-IN': 'DD-MM-YYYY', // English (India)\n 'en-JM': 'MM/DD/YYYY', // English (Jamaica)\n 'en-KE': 'DD/MM/YYYY', // English (Kenya)\n 'ky-KG': 'DD.MM.YYYY', // Kyrgyz (Kyrgyzstan)\n 'km-KH': 'DD/MM/YYYY', // Khmer (Cambodia)\n 'en-KY': 'MM/DD/YYYY', // English (Cayman Islands)\n 'kk-KZ': 'DD.MM.YYYY', // Kazakh (Kazakhstan)\n 'lo-LA': 'DD/MM/YYYY', // Lao (Laos)\n 'si-LK': 'YYYY-MM-DD', // Sinhala (Sri Lanka)\n 'en-LR': 'MM/DD/YYYY', // English (Liberia)\n 'en-LS': 'DD/MM/YYYY', // English (Lesotho)\n 'ar-MA': 'DD/MM/YYYY', // Arabic (Morocco)\n 'ro-MD': 'DD.MM.YYYY', // Romanian (Moldova)\n 'mk-MK': 'DD.MM.YYYY', // Macedonian (North Macedonia)\n 'my-MM': 'DD/MM/YYYY', // Burmese (Myanmar)\n 'mn-MN': 'YYYY.MM.DD', // Mongolian (Mongolia)\n 'zh-MO': 'DD/MM/YYYY', // Chinese (Macao)\n 'en-MU': 'DD/MM/YYYY', // English (Mauritius)\n 'dv-MV': 'DD/MM/YYYY', // Divehi (Maldives)\n 'en-MW': 'DD/MM/YYYY', // English (Malawi)\n 'es-MX': 'DD/MM/YYYY', // Spanish (Mexico)\n 'ms-MY': 'DD/MM/YYYY', // Malay (Malaysia)\n 'en-NA': 'DD/MM/YYYY', // English (Namibia)\n 'en-NG': 'DD/MM/YYYY', // English (Nigeria)\n 'es-NI': 'DD/MM/YYYY', // Spanish (Nicaragua)\n 'no-NO': 'DD.MM.YYYY', // Norwegian (Norway)\n 'ne-NP': 'YYYY/MM/DD', // Nepali (Nepal)\n 'en-NZ': 'DD/MM/YYYY', // English (New Zealand)\n 'es-PE': 'DD/MM/YYYY', // Spanish (Peru)\n 'en-PG': 'DD/MM/YYYY', // English (Papua New Guinea)\n 'en-PH': 'MM/DD/YYYY', // English (Philippines)\n 'en-PK': 'DD/MM/YYYY', // English (Pakistan)\n 'ar-QA': 'DD/MM/YYYY', // Arabic (Qatar)\n 'ru-RU': 'DD.MM.YYYY', // Russian (Russia)\n 'ar-SA': 'DD/MM/YYYY', // Arabic (Saudi Arabia)\n 'en-SC': 'DD/MM/YYYY', // English (Seychelles)\n 'sv-SE': 'YYYY-MM-DD', // Swedish (Sweden)\n 'en-SG': 'DD/MM/YYYY', // English (Singapore)\n 'en-SL': 'DD/MM/YYYY', // English (Sierra Leone)\n 'so-SO': 'DD/MM/YYYY', // Somali (Somalia)\n 'en-SS': 'DD/MM/YYYY', // English (South Sudan)\n 'es-SV': 'DD/MM/YYYY', // Spanish (El Salvador)\n 'en-SZ': 'DD/MM/YYYY', // English (Eswatini)\n 'th-TH': 'DD/MM/YYYY', // Thai (Thailand)\n 'en-TT': 'MM/DD/YYYY', // English (Trinidad and Tobago)\n 'sw-TZ': 'DD/MM/YYYY', // Swahili (Tanzania)\n 'en-US': 'MM/DD/YYYY', // English (United States)\n 'es-UY': 'DD/MM/YYYY', // Spanish (Uruguay)\n 'uz-UZ': 'DD/MM/YYYY', // Uzbek (Uzbekistan)\n 'ar-YE': 'DD/MM/YYYY', // Arabic (Yemen)\n 'en-ZA': 'YYYY/MM/DD', // English (South Africa)\n 'ar-KW': 'DD/MM/YYYY', // Arabic (Kuwait)\n 'ar-BH': 'DD/MM/YYYY', // Arabic (Bahrain)\n 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman)\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Parses a date string based on a specific format.\n *\n * @param dateString The date string to parse.\n * @param format The format to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDateWithFormat = (\n dateString: string,\n format: string,\n): Date | null => {\n // Determine the separator based on the format (supports '/', '.', or '-')\n const separator = format.includes('/')\n ? '/'\n : format.includes('.')\n ? '.'\n : '-';\n const formatParts = format.split(separator);\n const dateParts = dateString.split(separator).map((num) => parseInt(num, 10));\n\n let year: number = 0,\n month: number = 0,\n day: number = 0;\n let yearSet: boolean = false,\n monthSet: boolean = false,\n daySet: boolean = false;\n\n // Check for format and date string mismatch\n if (dateParts.length !== formatParts.length) {\n return null; // Mismatch between date string and format\n }\n\n formatParts.forEach((part, index) => {\n // Check for non-numeric values in date string\n if (isNaN(dateParts[index])) {\n return null; // Invalid date part\n }\n\n // Assign year, month, and day based on the format\n switch (part) {\n case 'DD':\n day = dateParts[index];\n daySet = true;\n break;\n case 'MM':\n month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date\n monthSet = true;\n break;\n case 'YYYY':\n year = dateParts[index];\n yearSet = true;\n break;\n }\n });\n\n // Validate and create the date only if all parts are set\n if (yearSet && monthSet && daySet) {\n const parsedDate = new Date(year, month, day);\n // Validate date to catch invalid dates like February 30th\n if (\n parsedDate.getFullYear() === year &&\n parsedDate.getMonth() === month &&\n parsedDate.getDate() === day\n ) {\n return parsedDate;\n }\n }\n return null; // Invalid date or incomplete date information\n};\n\nexport default withErrorBoundary(\n parseDateWithFormat,\n);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { LOCALE_DATE_FORMATS } from './data/localeDateFormats';\nimport parseDateWithFormat from './parseDateWithFormat';\nimport { Locale } from './types';\n\n/**\n * Attempts to parse a string into a date object based on locale.\n * Uses the localeDateFormats mapping for determining the date format.\n *\n * @param dateString - The date string to parse.\n * @param locale - The locale to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDate = (dateString: string, locale: Locale): Date | null => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const format = LOCALE_DATE_FORMATS[locale];\n if (!format) {\n throw new Error(`No date format found for locale: ${locale}`);\n }\n return parseDateWithFormat(dateString, format);\n};\n\nexport default withErrorBoundary(parseDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport add from './add';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Subtracts a specified amount of time from a date.\n *\n * @param date The original date.\n * @param value The amount to subtract.\n * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time subtracted.\n */\nconst subtract = (\n date: DateInput,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n return add(date, -value, unit); // Reuse the add function with negative value\n};\n\nexport default withErrorBoundary(subtract);\n"],"names":["I18nifyError","Error","constructor","message","super","this","name","timestamp","Date","withErrorBoundary","fn","rest","call","err","console","warn","I18nStateManager","state","locale","direction","country","getInstance","instance","resetInstance","undefined","getState","Object","assign","setState","newState","resetState","getState$1","setState$1","resetState$1","getLocale","navigator","window","Intl","languages","language","getIntlInstanceWithOptions","options","intlOptions","currency","style","NumberFormat","formatNumber$1","amount","Number","formattedAmount","format","CURRENCIES","AED","symbol","ALL","AMD","ARS","AUD","AWG","BBD","BDT","BMD","BND","BOB","BSD","BWP","BZD","CAD","CHF","CNY","COP","CRC","CUP","CZK","DKK","DOP","DZD","EGP","ETB","EUR","FJD","GBP","GHS","GIP","GMD","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","JMD","KES","KGS","KHR","KYD","KZT","LAK","LKR","LRD","LSL","MAD","MDL","MKD","MMK","MNT","MOP","MUR","MVR","MWK","MXN","MYR","NAD","NGN","NIO","NOK","NPR","NZD","PEN","PGK","PHP","PKR","QAR","RUB","SAR","SCR","SEK","SGD","SLL","SOS","SSP","SVC","SZL","THB","TTD","TZS","USD","UYU","UZS","YER","ZAR","KWD","BHD","OMR","getCurrencyList$1","getCurrencySymbol$1","currencyCode","_a","ALLOWED_FORMAT_PARTS_KEYS","formatNumberByParts$1","parts","formatToParts","formattedObj","forEach","p","type","integer","value","findIndex","item","isPrefixSymbol","rawParts","PHONE_REGEX_MAPPER","IN","MY","AE","AL","AM","AR","AU","AW","BB","BD","BM","BN","BO","BS","BW","BZ","CH","CN","CO","OM","CR","CU","CZ","DK","DO","DZ","EG","ET","EU","FJ","GB","GH","GI","GM","GT","GY","HK","HN","HR","HT","HU","ID","IL","JM","KE","KG","KH","KY","KZ","LA","LK","LR","LS","MA","MD","MK","MM","MN","MO","MU","MV","MW","MX","NA","NG","NI","NO","NP","NZ","PE","PG","PH","PK","QA","RU","SA","SC","SE","SG","SL","SO","SS","SV","SZ","TH","TT","TZ","US","CA","UY","UZ","YE","ZA","KW","BH","TL","VC","VE","VN","ZM","ZW","LT","LU","LV","ME","MG","MZ","NL","PA","PL","PR","PS","PT","PY","RO","RS","RW","SI","SK","SM","SN","SR","TG","TJ","TN","TR","TW","UA","UG","DIAL_CODE_MAPPER","detectCountryCodeFromDialCode","phoneNumber","toString","charAt","cleanedPhoneNumberWithoutPlusPrefix","replace","matchingCountries","code","startsWith","push","find","countryCode","regex","test","cleanPhoneNumber","cleanedPhoneNumber","isValidPhoneNumber$1","PHONE_FORMATTER_MAPPER","formatPhoneNumber$1","pattern","charCountInFormatterPattern","i","length","diff","phoneNumberWithoutPrefix","slice","formattedNumber","numberIndex","patternChar","formattedPhoneNumberWithoutPrefix","join","trim","parsePhoneNumber$1","formattedPhoneNumber","formatPhoneNumber","dialCode","formatTemplate","stringToDate","dateString","supportedDateFormats","yearIndex","monthIndex","dayIndex","hourIndex","minuteIndex","secondIndex","match","year","month","day","hour","minute","second","add$1","date","unit","setDate","getDate","setMonth","getMonth","setFullYear","getFullYear","formatDateTime$1","dateObj","formatter","DateTimeFormat","formatDate$1","fullOptions","timeStyle","formattedDate","formatDateTime","formatTime$1","dateStyle","formattedTime","getFirstDayOfWeek$1","formatted","weekday","sundayDate","weekdays","Array","from","_","firstDayIndex","indexOf","getQuarter$1","Math","ceil","getRelativeTime$1","baseDate","diffInSeconds","getTime","week","relativeTime","abs","RelativeTimeFormat","round","getWeek$1","firstDayOfYear","pastDaysOfYear","getDay","getWeekdays$1","isAfter$1","date1","date2","isBefore$1","isLeapYear$1","isSameDay$1","isValidDate$1","isNaN","LOCALE_DATE_FORMATS","parseDateWithFormat$1","separator","includes","formatParts","split","dateParts","map","num","parseInt","yearSet","monthSet","daySet","part","index","parsedDate","parseDate$1","parseDateWithFormat","subtract$1","add"],"mappings":"AACM,MAAOA,UAAqBC,MAEhC,WAAAC,CAAYC,GACVC,MAAMD,GACNE,KAAKC,KAAO,gBACZD,KAAKE,UAAY,IAAIC,IAEtB,EAYI,MAAMC,EACXC,GAEO,YAA4BC,GACjC,IACE,OAAOD,EAAGE,KAAKP,QAASM,EACzB,CAAC,MAAOE,GAIP,MAHAC,QAAQC,KAAK,iBAAkBF,GAGzB,IAAIb,EAAaa,EACxB,CACH,QC7BWG,EAIX,WAAAd,GACEG,KAAKY,MCLA,CACLC,OAAQ,GACRC,UAAW,GACXC,QAAS,GDGV,CAEM,kBAAOC,GAKZ,OAJKL,EAAiBM,WACpBN,EAAiBM,SAAW,IAAIN,GAG3BA,EAAiBM,QACzB,CAEM,oBAAOC,GACZP,EAAiBM,cAAWE,CAC7B,CAEM,QAAAC,GACL,OAAYC,OAAAC,OAAA,CAAA,E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AAI,sBACJC,GAAI,gCACJC,GAAI,4BACJC,GAAI,gCACJC,GAAI,+BACJC,GAAI,uDACJC,GAAI,mCACJC,GAAI,6CACJC,GAAI,+BACJC,GAAI,qBACJC,GAAI,+BACJC,GAAI,sBACJC,GAAI,2BACJC,GAAI,wBACJC,GAAI,4DACJC,GAAI,0BACJC,GAAI,mCACJC,GAAI,4BACJC,GAAI,8CACJC,GAAI,6BACJC,GAAI,+CACJC,GAAI,8BACJC,GAAI,8BACJC,GAAI,8BACJC,GAAI,8BACJC,GAAI,yBACJC,GAAI,+DACJC,GAAI,0DACJC,GAAI,6BACJC,GAAI,0CACJC,GAAI,+CACJC,GAAI,8BACJC,GAAI,2BACJC,GAAI,6BACJC,GAAI,kCACJC,GAAI,uBACJC,GAAI,wBACJC,GAAI,sCACJC,GAAI,+BACJC,GAAI,gDACJC,GAAI,gDACJC,GAAI,iDACJC,GAAI,iCACJC,GAAI,2BACJC,GAAI,0BACJC,GAAI,yBACJC,GAAI,0BACJC,GAAI,2CACJC,GAAI,oCACJC,GAAI,0BACJC,GAAI,8BACJC,GAAI,uCACJC,GAAI,iCACJC,GAAI,yBACJC,GAAI,sCACJC,GAAI,yBACJC,GAAI,+BACJC,GAAI,iCACJC,GAAI,2CACJC,GAAI,+EACJC,GAAI,iCACJC,GAAI,qFACJC,GAAI,6BACJC,GAAI,gCACJC,GAAI,6DACJC,GAAI,gCACJC,GAAI,0CACJC,GAAI,kDACJC,GAAI,2BACJC,GAAI,kCACJC,GAAI,kCACJC,GAAI,qCACJC,GAAI,gCACJC,GAAI,uBACJC,GAAI,uBACJC,GAAI,iCACJC,GAAI,iCACJC,GAAI,8BACJC,GAAI,2BACJC,GAAI,0EACJC,GAAI,+BC/HOC,EAAgD,CAC3D,EAAG,CACD,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,MAEF,EAAG,CAAC,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,EAAMkE,EAAUQ,GAChBF,GAAS,EACT,MACF,IAAK,KACHzE,EAAQmE,EAAUQ,GAAS,EAC3BH,GAAW,EACX,MACF,IAAK,OACHzE,EAAOoE,EAAUQ,GACjBJ,GAAU,EAEb,IAICA,GAAWC,GAAYC,EAAQ,CACjC,MAAMG,EAAa,IAAI7Z,KAAKgV,EAAMC,EAAOC,GAEzC,GACE2E,EAAW/D,gBAAkBd,GAC7B6E,EAAWjE,aAAeX,GAC1B4E,EAAWnE,YAAcR,EAEzB,OAAO2E,CAEV,CACD,OAAO,IAAI,ICvCb,IAAeC,EAAA7Z,GAfG,CAACsU,EAAoB7T,KAMhCA,IAAQA,EAASD,EAAMQ,WAAWP,QAAUgB,KAEjD,MAAMgB,EAASoW,EAAoBpY,GACnC,IAAKgC,EACH,MAAM,IAAIjD,MAAM,oCAAoCiB,KAEtD,OAAOqZ,EAAoBxF,EAAY7R,EAAO,ICHhD,IAAesX,EAAA/Z,GAXE,CACfsV,EACA9L,EACA+L,KAEAD,EACkB,iBAATA,EAAoB,IAAIvV,KAAKsU,EAAaiB,IAAS,IAAIvV,KAAKuV,GAE9D0E,EAAI1E,GAAO9L,EAAO+L"} \ No newline at end of file diff --git a/lib/esm/phoneNumber/index.d.ts b/lib/esm/phoneNumber/index.d.ts deleted file mode 100644 index 07f11fac..00000000 --- a/lib/esm/phoneNumber/index.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -declare const _default$2: (phoneNumber: string | number, countryCode?: string | number | undefined) => boolean; - -declare const _default$1: (phoneNumber: string | number, countryCode?: string | number | undefined) => string; - -interface PhoneInfo { - countryCode: string; - dialCode: string; - formattedPhoneNumber: string; - formatTemplate: string; -} -declare const _default: (phoneNumber: string, country?: string | undefined) => PhoneInfo; - -export { _default$1 as formatPhoneNumber, _default$2 as isValidPhoneNumber, _default as parsePhoneNumber }; diff --git a/lib/esm/phoneNumber/index.js b/lib/esm/phoneNumber/index.js deleted file mode 100644 index f0eb1423..00000000 --- a/lib/esm/phoneNumber/index.js +++ /dev/null @@ -1,723 +0,0 @@ -const PHONE_REGEX_MAPPER = { - IN: /^(?:(?:\+|0{0,2})91\s*[-]?\s*|[0]?)?[6789]\d{9}$/, - MY: /^(\+?6?0)?(\d{1,3})[-. ]?(\d{7,8})$/, - AE: /^(?:\+?971|0)?(?:2|3|4|6|7|9)\d{8}$/, - AL: /^(?:\+?355)?(?:[4-9]\d{7}|6\d{8})$/, - AM: /^(?:\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/, - AR: /^(?:(?:\+|0{0,2})54)?(?:11|[2368]\d)(?:(?=\d{0,2}15)\d{2})??\d{8}$/, - AU: /^(?:\+?61|0)4\d{8}$/, - AW: /^(?:(?:\+297)?(?!0)\d{7})$/, - BB: /^(?:(?:\+1)?246)?(?:\d{3})?\d{7}$/, - BD: /^(?:\+?880|0)1[13456789]\d{8}$/, - BM: /^(?:(?:\+1)?441)?(?:\d{2})?\d{7}$/, - BN: /^(?:\+?673)?(?:\d{3})?\d{4}$/, - BO: /^(?:(?:\+|0{0,2})591)?(?:(?:2|3|7|6)\d{7})$/, - BS: /^(?:(?:\+1)?242)?(?:\d{3})?\d{7}$/, - BW: /^(?:(?:\+267)?\s?)?[74]\d{7}$/, - BZ: /^(?:(?:\+501)?\s?)?[622]\d{4}$/, - CH: /^(?:(?:\+41|0)(?:\s*\(?0\)?\s*))?(?:\d{2}\s*)?\d{3}\s*\d{2}\s*\d{2}$/, - CN: /^(?:(?:\+|00)86)?1\d{10}$/, - CO: /^(?:(?:\+57|0057)?)?[1-8]{1}\d{6,7}$/, - OM: /^(?:\+?968)?(?:95|96|97|98)\d{6}$/, - CR: /^(?:(?:\+506)?\s*|0)?[1-9]\d{7}$/, - CU: /^(?:\+?53)?(?:[5-8]\d{7})$/, - CZ: /^(?:\+?420)?(?:\d{9})$/, - DK: /^(?:\+?45)?(?:\d{8})$/, - DO: /^(?:(?:\+1)?809|1-8(?:00|88|89))(?:\d{7})$/, - DZ: /^(?:\+?213|0)([567]\d{8})$/, - EG: /^(?:(?:\+20|20)?(\d{10}))$/, - ET: /^(?:\+?251)?[1-59]\d{8}$/, - EU: /^(?:(?:\+?3)?8)?\s*(?:\d{3}\s*){3}\d{2}$/, - FJ: /^(?:(?:\+?679)?\s?\d{3}\s?\d{4})?$/, - GB: /^(?:(?:\+44\s?|0)7\d{3}(\s?\d{4,})?)$/, - GH: /^(?:(?:\+233)|0)?(?:\d{9})$/, - GI: /^(?:\+350)?\d{5}$/, - GM: /^(?:\+220)?\d{5,7}$/, - GT: /^(?:\+502)?[2468]\d{7,8}$/, - GY: /^(?:(?:\+592)?(?:(?:\s)?[2-9])(?:(?:\s)?\d))?(?:(?:\s)?\d{4})$/, - HK: /^(?:\+852\s?)?[456789]\d{3}\s?\d{4}$/, - HN: /^(?:\+504)?[89]\d{7}$/, - HR: /^(?:\+?385)?\d{8,9}$/, - HT: /^(?:\+?509)?\d{8}$/, - HU: /^(?:(?:\+36))(\s?\d{2}\s?\d{3}\s?\d{4})$/, - ID: /^(?:\+?62|0[1-9])[\s-]?\d{2,4}[\s-]?\d{3,4}[\s-]?\d{3,4}$/, - IL: /^(?:(?:\+972|0)(?:-)?)[23489]\d{7}$/, - JM: /^(?:(?:\+1876))\d{7,10}$/, - KE: /^(?:(?:\+254)|(?:0))(?:\d{6,7})$/, - KG: /^(?:\+996)?\s?\d{9}$/, - KH: /^(?:(?:\+855)|(?:0))(?:\s?[1-9]\d{7,8})$/, - KY: /^(?:\+?1\s?(345))\d{6}$/, - KZ: /^(?:\+?7|8)?7\d{9}$/, - LA: /^(?:(?:\+?856)|0)(20\d{7,9})$/, - LK: /^(?:(?:\+94)|0)(?:\d{9})$/, - LR: /^(?:\+231)[ -\d]{4}[ -\d]{4}$/, - LS: /^(?:(?:\+?266)|0)?[56]\d{7}$/, - MA: /^(?:(?:\+?212(\s*[-|\s*]?\d{1,9})?)|(?:0))(?:\d{9})$/, - MD: /^(?:(?:\+373)|(?:0))(?:\d{7,8})$/, - MK: /^(?:\+389|0)(?:(?:2[0-4]|[3-9])\s?)?\d{6}$/, - MM: /^(?:(?:\+?95)|0)?[1-9]\d{9}$/, - MN: /^(?:\+976|0)\d{8}$/, - MO: /^(?:(?:\+?853)|[0-9])?\d{8}$/, - MU: /^(?:\+230|0)?\d{8}$/, - MV: /^(?:(?:\+?960)|0)?\d{7}$/, - MW: /^(?:\+265)[1-9]\d{6}$/, - MX: /^(?:(?:\+?52)?\s?(?:1|01)?\s?)?(?:\d{3}\s?\d{3}\s?\d{4})$/, - NA: /^(?:(?:\+264)|0)?\d{8}$/, - NG: /^(?:(?:\+234)|(?:0))(?:\d{7,8})$/, - NI: /^(?:(?:\+505))?(?:\d{8})$/, - NO: /^(?:(?:\+?47)|\d{2}|\d{3})\s?\d{2}\s?\d{3}$/, - NP: /^(?:(?:\+977))?(\d{9,10})$/, - NZ: /^(?:\+?64|0)(\d{2,5} \d{4,8}|\d{3,4} \d{4})$/, - PE: /^(?:(?:\+51)|0)?(?:9\d{8})$/, - PG: /^(?:\+?675)?(?:[7-9]\d{7})$/, - PH: /^(?:(?:\+?63)|0)(?:\d{10})$/, - PK: /^(?:(?:\+92)|0)?[345]\d{9}$/, - QA: /^(?:\+?974)?-?33\d{5}$/, - RU: /^(?:\+?7|8)?[ -]?\(?9\d{2}\)?[ -]?\d{3}[ -]?\d{2}[ -]?\d{2}$/, - SA: /^(?:\+?966)?\s?1?[\s-]?(?:[45]\d{2}|5\d{3})[\s-]?\d{4}$/, - SC: /^(?:(?:\+248)|\d{4})\d{5}$/, - SE: /^(?:\+?46|0)\s?[1-57-9](?:[0-9]\s?){8}$/, - SG: /^(?:(?:\+65)|(?:\(\+65\))|(?:65))\d{4}\d{4}$/, - SL: /^(?:(?:\+232)|(?:0))?\d{9}$/, - SO: /^(?:\+252|0)?[567]\d{7}$/, - SS: /^(?:\+211|0)?[1-9]\d{7,9}$/, - SV: /^(?:(?:\+?503)|(?:0))(?:\d{8})$/, - SZ: /^(?:\+?268)?\d{7,8}$/, - TH: /^(?:(?:\+66)|0)\d{9}$/, - TT: /^(?:(?:\+?1-868)|\(?868\)?)(\d{7})$/, - TZ: /^(?:(?:\+?255)|0)?[67]\d{8}$/, - US: /^(\+\d{1,2}\s?)?([2-9]{1}\d{2}[2-9]{1}\d{6})$/, - CA: /^(\+\d{1,2}\s?)?([2-9]{1}\d{2}[2-9]{1}\d{6})$/, - UY: /^(?:(?:\+598|0)\s?(9\d{3}|2\d{2}|[4-9]\d{6}))$/, - UZ: /^(?:\+?998)?\s?[3456789]\d{8}$/, - YE: /^(?:\+?967)?(?:\d{7,8})$/, - ZA: /^(?:(?:\+27)|0)(\d{9})$/, - KW: /^(?:\+?965)[569]\d{7}$/, - BH: /^(?:\+?973)?[356]\d{7}$/, - TL: /^(?:(?:\+670)\s?)?[0-9]{3}\s?[0-9]{3,4}$/, - VC: /^(?:(?:\+1)?784)?(?:\d{3})?\d{7}$/, - VE: /^(?:(?:\+58)|0)?4\d{9}$/, - VN: /^(?:(?:\+84)|0)?[1-9]\d{8}$/, - ZM: /^(?:(?:\+260)|0)?[123456789]\d{8,9}$/, - ZW: /^(?:(?:\+263)|0)?(?:\d{9,10})$/, - LT: /^(?:(?:\+370)|8)\d{8}$/, - LU: /^(?:(?:\+352)?(6|2(6|7|8|9))\d{6})$/, - LV: /^(?:(?:\+371)?2\d{7})$/, - ME: /^(?:(?:\+382)?[67]\d{7,20})$/, - MG: /^(?:(?:\+261)?3[234568]\d{7})$/, - MZ: /^(?:(?:\+258)|(?:258))?8[234567]\d{7,8}$/, - NL: /^(?:(?:\+31)|0(6(?:\d{8})|[1-9](?:(?:\d{8})|(?:\s\d{3}\s\d{4}))|(?:\d{8})))$/, - PA: /^(?:(?:\+507)\s?)?[46]\d{6,7}$/, - PL: /^(?:(?:\+48)?(?:\s?\d{3}\s?\d{3}\s?\d{3}|(?:\d{2}\s?){4}\d{2}|\d{3}-\d{3}-\d{3}))$/, - PR: /^(?:(?:\+1)?787|939)\d{7}$/, - PS: /^(?:(?:\+970))(5[2349])\d{7}$/, - PT: /^(?:(?:\+351)?9(1\d|2[1-9]|6[12345789]|7[12345789])\d{7})$/, - PY: /^(?:(?:\+595|0)9[9876]\d{7})$/, - RO: /^(?:(?:\+40|0))(?:7[2-8]\d{7}|21\d{8})$/, - RS: /^(?:(?:\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/, - RW: /^(?:(?:\+250)|(0))\d{9}$/, - SI: /^(?:(?:\+386)|0)?[1-59]\d{7,8}$/, - SK: /^(?:(?:\+421))?(0|9[0-8])\d{8}$/, - SM: /^(?:(?:\+378)|(0549|6\d{4}))\d{5}$/, - SN: /^(?:(?:\+221)|0)?[3679]\d{7}$/, - SR: /^(?:(?:\+597))\d{7}$/, - TG: /^(?:(?:\+228))\d{8}$/, - TJ: /^(?:(?:\+992))(37|55|77)\d{7}$/, - TN: /^(?:(?:\+216)|22|9[1-9])\d{7}$/, - TR: /^(?:(?:\+90)|(0))\s?5\d{9}$/, - TW: /^(?:(?:\+886)|0)?9\d{8}$/, - UA: /^(?:(?:\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\d{7}$/, - UG: /^(?:(?:\+256)|0)?[39]\d{8}$/, -}; - -// Custom Error class to extend properties to error object -class I18nifyError extends Error { - constructor(message) { - super(message); - this.name = 'i18nify Error'; - this.timestamp = new Date(); - // more params like type of error/severity can be added in future for better debugging. - } -} -/** - * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block. - * It appends additional attributes and serves as a centralized error-handling service. - * Usage => - * const wrappedUtilityFn = withErrorBoundary(utilityFn) - * - * @param fn utility that is wrapped in error boundary - * @returns {Function} returns the function wrapped in try/catch block - */ -const withErrorBoundary = (fn) => { - return function (...rest) { - try { - return fn.call(this, ...rest); - } - catch (err) { - console.warn('[I18N Error]: ', err); - // Currently, we are throwing the error as it is to consumers. - // In the future, this can be modified as per our requirement, like an error logging service. - throw new I18nifyError(err); - } - }; -}; - -/* Source: Google LibPhoneNumber Metadata: https://github.com/google/libphonenumber/blob/master/javascript/i18n/phonenumbers/metadata.js */ -const DIAL_CODE_MAPPER = { - 1: [ - 'US', - 'AG', - 'AI', - 'AS', - 'BB', - 'BM', - 'BS', - 'CA', - 'DM', - 'DO', - 'GD', - 'GU', - 'JM', - 'KN', - 'KY', - 'LC', - 'MP', - 'MS', - 'PR', - 'SX', - 'TC', - 'TT', - 'VC', - 'VG', - 'VI', - ], - 7: ['RU', 'KZ'], - 20: ['EG'], - 27: ['ZA'], - 30: ['GR'], - 31: ['NL'], - 32: ['BE'], - 33: ['FR'], - 34: ['ES'], - 36: ['HU'], - 39: ['IT', 'VA'], - 40: ['RO'], - 41: ['CH'], - 43: ['AT'], - 44: ['GB', 'GG', 'IM', 'JE'], - 45: ['DK'], - 46: ['SE'], - 47: ['NO', 'SJ'], - 48: ['PL'], - 49: ['DE'], - 51: ['PE'], - 52: ['MX'], - 53: ['CU'], - 54: ['AR'], - 55: ['BR'], - 56: ['CL'], - 57: ['CO'], - 58: ['VE'], - 60: ['MY'], - 61: ['AU', 'CC', 'CX'], - 62: ['ID'], - 63: ['PH'], - 64: ['NZ'], - 65: ['SG'], - 66: ['TH'], - 81: ['JP'], - 82: ['KR'], - 84: ['VN'], - 86: ['CN'], - 90: ['TR'], - 91: ['IN'], - 92: ['PK'], - 93: ['AF'], - 94: ['LK'], - 95: ['MM'], - 98: ['IR'], - 211: ['SS'], - 212: ['MA', 'EH'], - 213: ['DZ'], - 216: ['TN'], - 218: ['LY'], - 220: ['GM'], - 221: ['SN'], - 222: ['MR'], - 223: ['ML'], - 224: ['GN'], - 225: ['CI'], - 226: ['BF'], - 227: ['NE'], - 228: ['TG'], - 229: ['BJ'], - 230: ['MU'], - 231: ['LR'], - 232: ['SL'], - 233: ['GH'], - 234: ['NG'], - 235: ['TD'], - 236: ['CF'], - 237: ['CM'], - 238: ['CV'], - 239: ['ST'], - 240: ['GQ'], - 241: ['GA'], - 242: ['CG'], - 243: ['CD'], - 244: ['AO'], - 245: ['GW'], - 246: ['IO'], - 247: ['AC'], - 248: ['SC'], - 249: ['SD'], - 250: ['RW'], - 251: ['ET'], - 252: ['SO'], - 253: ['DJ'], - 254: ['KE'], - 255: ['TZ'], - 256: ['UG'], - 257: ['BI'], - 258: ['MZ'], - 260: ['ZM'], - 261: ['MG'], - 262: ['RE', 'YT'], - 263: ['ZW'], - 264: ['NA'], - 265: ['MW'], - 266: ['LS'], - 267: ['BW'], - 268: ['SZ'], - 269: ['KM'], - 290: ['SH', 'TA'], - 291: ['ER'], - 297: ['AW'], - 298: ['FO'], - 299: ['GL'], - 350: ['GI'], - 351: ['PT'], - 352: ['LU'], - 353: ['IE'], - 354: ['IS'], - 355: ['AL'], - 356: ['MT'], - 357: ['CY'], - 358: ['FI', 'AX'], - 359: ['BG'], - 370: ['LT'], - 371: ['LV'], - 372: ['EE'], - 373: ['MD'], - 374: ['AM'], - 375: ['BY'], - 376: ['AD'], - 377: ['MC'], - 378: ['SM'], - 380: ['UA'], - 381: ['RS'], - 382: ['ME'], - 383: ['XK'], - 385: ['HR'], - 386: ['SI'], - 387: ['BA'], - 389: ['MK'], - 420: ['CZ'], - 421: ['SK'], - 423: ['LI'], - 500: ['FK'], - 501: ['BZ'], - 502: ['GT'], - 503: ['SV'], - 504: ['HN'], - 505: ['NI'], - 506: ['CR'], - 507: ['PA'], - 508: ['PM'], - 509: ['HT'], - 590: ['GP', 'BL', 'MF'], - 591: ['BO'], - 592: ['GY'], - 593: ['EC'], - 594: ['GF'], - 595: ['PY'], - 596: ['MQ'], - 597: ['SR'], - 598: ['UY'], - 599: ['CW', 'BQ'], - 670: ['TL'], - 672: ['NF'], - 673: ['BN'], - 674: ['NR'], - 675: ['PG'], - 676: ['TO'], - 677: ['SB'], - 678: ['VU'], - 679: ['FJ'], - 680: ['PW'], - 681: ['WF'], - 682: ['CK'], - 683: ['NU'], - 685: ['WS'], - 686: ['KI'], - 687: ['NC'], - 688: ['TV'], - 689: ['PF'], - 690: ['TK'], - 691: ['FM'], - 692: ['MH'], - 800: ['001'], - 808: ['001'], - 850: ['KP'], - 852: ['HK'], - 853: ['MO'], - 855: ['KH'], - 856: ['LA'], - 870: ['001'], - 878: ['001'], - 880: ['BD'], - 881: ['001'], - 882: ['001'], - 883: ['001'], - 886: ['TW'], - 888: ['001'], - 960: ['MV'], - 961: ['LB'], - 962: ['JO'], - 963: ['SY'], - 964: ['IQ'], - 965: ['KW'], - 966: ['SA'], - 967: ['YE'], - 968: ['OM'], - 970: ['PS'], - 971: ['AE'], - 972: ['IL'], - 973: ['BH'], - 974: ['QA'], - 975: ['BT'], - 976: ['MN'], - 977: ['NP'], - 979: ['001'], - 992: ['TJ'], - 993: ['TM'], - 994: ['AZ'], - 995: ['GE'], - 996: ['KG'], - 998: ['UZ'], -}; - -/** - * Determines the country code based on the provided phone number. - * This function employs a multi-step approach to identify the country code: - * - If the phone number starts with '+', it extracts the numeric characters - * and matches the leading digits with known dial codes mapped to countries. - * - For matched dial codes, it further filters based on country-specific regex patterns - * to validate the phone number format for those countries. - * - If the phone number doesn't start with '+', it directly matches the number - * against regular expressions associated with various countries to identify the code. - * - * @param phoneNumber The input phone number (string or number). - * @returns The detected country code or an empty string if not found. - */ -const detectCountryCodeFromDialCode = (phoneNumber) => { - // If the phone number starts with '+', extract numeric characters - if (phoneNumber.toString().charAt(0) === '+') { - const cleanedPhoneNumberWithoutPlusPrefix = phoneNumber - .toString() - .replace(/\D/g, ''); - const matchingCountries = []; - // Iterate through dial codes and check for matches with cleaned phone number - for (const code in DIAL_CODE_MAPPER) { - if (cleanedPhoneNumberWithoutPlusPrefix.startsWith(code)) { - matchingCountries.push(...DIAL_CODE_MAPPER[code]); - } - } - // Filter matching countries based on phone number validation regex - const matchedCountryCode = matchingCountries.find((countryCode) => { - const regex = PHONE_REGEX_MAPPER[countryCode]; - if (regex && regex.test(phoneNumber.toString())) - return countryCode; - return undefined; - }); - // Return the first matched country code, if any - return matchedCountryCode || ''; - } - else { - // If phone number doesn't start with '+', directly match against country regexes - for (const countryCode in PHONE_REGEX_MAPPER) { - const regex = PHONE_REGEX_MAPPER[countryCode]; - if (regex.test(phoneNumber.toString())) { - return countryCode; - } - } - } - // Return empty string if no country code is detected - return ''; -}; -const cleanPhoneNumber = (phoneNumber) => { - // Regular expression to match all characters except numbers and + sign at the start - const regex = /[^0-9+]|(?!A)\+/g; - // Replace matched characters with an empty string - const cleanedPhoneNumber = phoneNumber.replace(regex, ''); - return phoneNumber[0] === '+' ? `+${cleanedPhoneNumber}` : cleanedPhoneNumber; -}; - -// Validates whether a given phone number is valid based on the provided country code or auto-detects the country code and checks if the number matches the defined regex pattern for that country. -const isValidPhoneNumber = (phoneNumber, countryCode) => { - // Clean the provided phoneNumber by removing non-numeric characters - const cleanedPhoneNumber = cleanPhoneNumber(phoneNumber.toString()); - // Detect or validate the country code - countryCode = - countryCode && countryCode in PHONE_REGEX_MAPPER - ? countryCode - : detectCountryCodeFromDialCode(cleanedPhoneNumber); - // Return false if phoneNumber is empty - if (!phoneNumber) - return false; - // Check if the countryCode exists in the PHONE_REGEX_MAPPER - if (countryCode in PHONE_REGEX_MAPPER) { - // Fetch the regex pattern for the countryCode - const regex = PHONE_REGEX_MAPPER[countryCode]; - // Test if the cleanedPhoneNumber matches the regex pattern - return regex.test(cleanedPhoneNumber); - } - // Return false if the countryCode is not supported - return false; -}; -var isValidPhoneNumber$1 = withErrorBoundary(isValidPhoneNumber); - -const PHONE_FORMATTER_MAPPER = { - IN: 'xxxx xxxxxx', - MY: 'xx xxxxx xx', - AE: 'xx xxx xxxx', - AL: 'xxx xx xxxx', - AM: 'xx xx xx xx', - AR: 'xxxx-xxxx', - AU: 'xxx xxx xxx', - AW: 'xxx-xxxx', - BB: 'xxx-xxxx', - BD: 'xxxx-xxxxxx', - BM: 'xxx-xxxx', - BN: 'xxxx-xxxx', - BO: 'xxxx-xxxx', - BS: 'xxx-xxxx', - BW: 'xx xxxx xxxx', - BZ: 'xxx-xxxx', - CA: 'xxx-xxx-xxxx', - CH: 'xxx xxx xxx', - CN: 'xxxx-xxxxxxx', - CO: 'xxxx-xxxxxxx', - CR: 'xxxx-xxxx', - CU: 'xxxx-xxxx', - CZ: 'xxx xxx xxx', - DK: 'xx xx xx xx', - DO: 'xxx-xxxxxxx', - DZ: 'xxxx-xxxx-xxx', - EG: 'xx xxx xxxx', - ET: 'xx xxx xxxx', - EU: 'xxx xx xx xx', - FJ: 'xxxx xxxx', - GB: 'xxxx xxx xxx', - GH: 'xxx xxx xxxx', - GI: 'xxxx xxxx', - GM: 'xxxx-xxxx', - GT: 'xxxx-xxxx', - GY: 'xxx-xxxx', - HK: 'xxxx xxxx', - HN: 'xxxx-xxxx', - HR: 'xxx xxx xxxx', - HT: 'xxx-xxxx', - HU: 'xxx xxx xxxx', - ID: 'xxxx-xxxx-xxxx', - IL: 'xxxx-xxx-xxx', - JM: 'xxx-xxxx', - KE: 'xxx xxxxxx', - KG: 'xxx-xx-xx-xx', - KH: 'xxx-xxx-xxx', - KY: 'xxx-xxxx', - KZ: 'xxx-xxx-xx-xx', - LA: 'xxx xx xxxx', - LK: 'xx xxx xxxx', - LR: 'xxx-xxx-xxxx', - LS: 'xxx xx xxxx', - LT: 'xxx xxxxx', - LU: 'xxx xx xxx', - LV: 'xxxx xxxx', - MA: 'xxxx-xxxxxx', - MD: 'xx xxxxxx', - ME: 'xx xxxxxx', - MG: 'xx xx xx xx xx', - MK: 'xx xx xx xx', - MM: 'xx xxxxxx', - MN: 'xxx-xx-xxxx', - MO: 'xxxx xxxx', - MU: 'xx xxxx xxxx', - MV: 'xxxxxx', - MW: 'xx xxxx xxxx', - MX: 'xxx-xxx-xxxx', - MZ: 'xx xxxxxxx', - NA: 'xx xxxx xxxx', - NG: 'xxx xxx xxxx', - NI: 'xxxx-xxxx', - NL: 'xxx-xxxxxxx', - NO: 'xxxx xxxx', - NP: 'xxxx-xxxxxxx', - NZ: 'xxx-xxxxxxx', - OM: 'xxxx-xxxx', - PA: 'xxx-xxxx', - PE: 'xxx-xxx-xxx', - PG: 'xxx-xxxxxx', - PH: 'xxx-xxxx', - PK: 'xxx-xxxxxxx', - PL: 'xxx xxx xxx', - PR: 'xxx-xxx-xxxx', - PS: 'xxxx-xxxxxxx', - PT: 'xxx xxx xxx', - PY: 'xxx-xxxxxx', - QA: 'xxxx xxxx', - RO: 'xxx xxx xxxx', - RS: 'xxx xxxxx', - RU: 'xxx xxx-xx-xx', - RW: 'xxx xxxxxx', - SA: 'xxx-xxxxxxx', - SC: 'xx xxxxx', - SE: 'xxx-xxx xx xx', - SG: 'xxxx xxxx', - SI: 'xx xxxxxx', - SK: 'xxx xxx xxx', - SL: 'xxx-xxxxxx', - SM: 'xxxxx xxxxx', - SN: 'xx xxx xx xx', - SO: 'xxx xxxxxxx', - SR: 'xxx-xxxx', - SS: 'xxx xxxx xxx', - SV: 'xxxx-xxxx', - SZ: 'xxx xx xxxx', - TG: 'xx xx xx xx', - TH: 'xxx-xxxxxxx', - TJ: 'xxx xx xx xx', - TL: 'xxx-xxxxxxx', - TN: 'xx xxxxxx', - TR: 'xxx xxx xx xx', - TT: 'xxx-xxxx', - TW: 'xxxx-xxxxxx', - TZ: 'xxx xxx xxxx', - UA: 'xx xxx xx xx', - UG: 'xxx xxxxxxx', - US: 'xxx-xxx-xxxx', - UY: 'xxx-xxxxx', - UZ: 'xxx-xxx-xx-xx', - VC: 'xxx-xxxx', - VE: 'xxxx-xxx-xxxx', - VN: 'xxxx-xxxxxxx', - YE: 'xxxx-xxxx', - ZA: 'xxx-xxx-xxxx', - ZM: 'xxx-xxxxxxx', - ZW: 'xx xxx xxxx', - KW: 'xxx xx xxxx', - BH: 'xxxx xxxx', -}; - -// Formats a provided phone number according to the predefined format for a specific country code, or auto-detects the country code and formats the number accordingly. -const formatPhoneNumber = (phoneNumber, countryCode) => { - // Throw errors if phoneNumber is invalid - if (!phoneNumber) - throw new Error('Parameter `phoneNumber` is invalid!'); - // Convert phoneNumber to string and clean it by removing non-numeric characters - phoneNumber = phoneNumber.toString(); - phoneNumber = cleanPhoneNumber(phoneNumber); - // Detect or validate the country code - countryCode = - countryCode && countryCode in PHONE_FORMATTER_MAPPER - ? countryCode - : detectCountryCodeFromDialCode(phoneNumber); - // Fetch the pattern for the countryCode from the PHONE_FORMATTER_MAPPER - const pattern = PHONE_FORMATTER_MAPPER[countryCode]; - if (!pattern) - return phoneNumber; - // Count the number of 'x' characters in the format pattern - let charCountInFormatterPattern = 0; - for (let i = 0; i < pattern.length; i++) { - if (pattern[i] === 'x') { - charCountInFormatterPattern++; - } - } - // Calculate the difference between phoneNumber length and 'x' characters count in pattern - const diff = phoneNumber.length - charCountInFormatterPattern; - // Extract the phoneNumber without the prefix - const phoneNumberWithoutPrefix = phoneNumber.slice(diff); - const formattedNumber = []; - let numberIndex = 0; - // Loop through the pattern to format the phoneNumber - for (let i = 0; i < pattern.length; i++) { - const patternChar = pattern[i]; - if (patternChar === 'x') { - // Insert phoneNumber digits at 'x' positions - if (numberIndex < phoneNumberWithoutPrefix.length) { - formattedNumber.push(phoneNumberWithoutPrefix[numberIndex]); - numberIndex++; - } - } - else { - // Insert non-digit characters from the pattern - formattedNumber.push(patternChar); - } - } - // Join the formattedNumber array to create the formattedPhoneNumber without prefix - const formattedPhoneNumberWithoutPrefix = formattedNumber.join(''); - // Combine the prefix and formattedPhoneNumberWithoutPrefix - const formattedPhoneNumberWithPrefix = phoneNumber.slice(0, diff) + ' ' + formattedPhoneNumberWithoutPrefix; - // Return the formattedPhoneNumber with prefix after trimming whitespace - return formattedPhoneNumberWithPrefix.trim(); -}; -var formatPhoneNumber$1 = withErrorBoundary(formatPhoneNumber); - -// Parses a given phone number, identifies its country code (if not provided), and returns an object with details including the country code, formatted phone number, dial code, and format template. -const parsePhoneNumber = (phoneNumber, country) => { - // Throw errors if phoneNumber is invalid - if (!phoneNumber) - throw new Error('Parameter `phoneNumber` is invalid!'); - // Clean the phoneNumber by removing non-numeric characters - phoneNumber = phoneNumber.toString(); - phoneNumber = cleanPhoneNumber(phoneNumber); - // Detect or validate the country code - const countryCode = country && country in PHONE_FORMATTER_MAPPER - ? country - : detectCountryCodeFromDialCode(phoneNumber); - // Format the phone number using the detected/validated country code - const formattedPhoneNumber = formatPhoneNumber$1(phoneNumber, countryCode); - // Fetch the pattern associated with the countryCode from the PHONE_FORMATTER_MAPPER - const pattern = PHONE_FORMATTER_MAPPER[countryCode]; - if (!pattern) - return { - countryCode: countryCode || '', - dialCode: '', - formattedPhoneNumber: phoneNumber, - formatTemplate: '', - }; - // Count the number of 'x' characters in the format pattern - let charCountInFormatterPattern = 0; - for (let i = 0; i < pattern.length; i++) { - if (pattern[i] === 'x') { - charCountInFormatterPattern++; - } - } - // Calculate the difference between phoneNumber length and 'x' characters count in pattern - const diff = phoneNumber.length - charCountInFormatterPattern; - // Extract the dialCode from the phoneNumber - const dialCode = phoneNumber.slice(0, diff); - // Obtain the format template associated with the countryCode - const formatTemplate = PHONE_FORMATTER_MAPPER[countryCode]; - // Return the parsed phone number information - return { - countryCode, - formattedPhoneNumber, - dialCode, - formatTemplate, - }; -}; -var parsePhoneNumber$1 = withErrorBoundary(parsePhoneNumber); - -export { formatPhoneNumber$1 as formatPhoneNumber, isValidPhoneNumber$1 as isValidPhoneNumber, parsePhoneNumber$1 as parsePhoneNumber }; -//# sourceMappingURL=index.js.map diff --git a/lib/esm/phoneNumber/index.js.map b/lib/esm/phoneNumber/index.js.map deleted file mode 100644 index 2706ad49..00000000 --- a/lib/esm/phoneNumber/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sources":["../../../src/modules/phoneNumber/data/phoneRegexMapper.ts","../../../src/common/errorBoundary/index.ts","../../../src/modules/phoneNumber/data/dialCodeMapper.ts","../../../src/modules/phoneNumber/utils.ts","../../../src/modules/phoneNumber/isValidPhoneNumber.ts","../../../src/modules/phoneNumber/data/phoneFormatterMapper.ts","../../../src/modules/phoneNumber/formatPhoneNumber.ts","../../../src/modules/phoneNumber/parsePhoneNumber.ts"],"sourcesContent":["export const PHONE_REGEX_MAPPER: { [key: string]: RegExp } = {\n IN: /^(?:(?:\\+|0{0,2})91\\s*[-]?\\s*|[0]?)?[6789]\\d{9}$/,\n MY: /^(\\+?6?0)?(\\d{1,3})[-. ]?(\\d{7,8})$/,\n AE: /^(?:\\+?971|0)?(?:2|3|4|6|7|9)\\d{8}$/,\n AL: /^(?:\\+?355)?(?:[4-9]\\d{7}|6\\d{8})$/,\n AM: /^(?:\\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/,\n AR: /^(?:(?:\\+|0{0,2})54)?(?:11|[2368]\\d)(?:(?=\\d{0,2}15)\\d{2})??\\d{8}$/,\n AU: /^(?:\\+?61|0)4\\d{8}$/,\n AW: /^(?:(?:\\+297)?(?!0)\\d{7})$/,\n BB: /^(?:(?:\\+1)?246)?(?:\\d{3})?\\d{7}$/,\n BD: /^(?:\\+?880|0)1[13456789]\\d{8}$/,\n BM: /^(?:(?:\\+1)?441)?(?:\\d{2})?\\d{7}$/,\n BN: /^(?:\\+?673)?(?:\\d{3})?\\d{4}$/,\n BO: /^(?:(?:\\+|0{0,2})591)?(?:(?:2|3|7|6)\\d{7})$/,\n BS: /^(?:(?:\\+1)?242)?(?:\\d{3})?\\d{7}$/,\n BW: /^(?:(?:\\+267)?\\s?)?[74]\\d{7}$/,\n BZ: /^(?:(?:\\+501)?\\s?)?[622]\\d{4}$/,\n CH: /^(?:(?:\\+41|0)(?:\\s*\\(?0\\)?\\s*))?(?:\\d{2}\\s*)?\\d{3}\\s*\\d{2}\\s*\\d{2}$/,\n CN: /^(?:(?:\\+|00)86)?1\\d{10}$/,\n CO: /^(?:(?:\\+57|0057)?)?[1-8]{1}\\d{6,7}$/,\n OM: /^(?:\\+?968)?(?:95|96|97|98)\\d{6}$/,\n CR: /^(?:(?:\\+506)?\\s*|0)?[1-9]\\d{7}$/,\n CU: /^(?:\\+?53)?(?:[5-8]\\d{7})$/,\n CZ: /^(?:\\+?420)?(?:\\d{9})$/,\n DK: /^(?:\\+?45)?(?:\\d{8})$/,\n DO: /^(?:(?:\\+1)?809|1-8(?:00|88|89))(?:\\d{7})$/,\n DZ: /^(?:\\+?213|0)([567]\\d{8})$/,\n EG: /^(?:(?:\\+20|20)?(\\d{10}))$/,\n ET: /^(?:\\+?251)?[1-59]\\d{8}$/,\n EU: /^(?:(?:\\+?3)?8)?\\s*(?:\\d{3}\\s*){3}\\d{2}$/,\n FJ: /^(?:(?:\\+?679)?\\s?\\d{3}\\s?\\d{4})?$/,\n GB: /^(?:(?:\\+44\\s?|0)7\\d{3}(\\s?\\d{4,})?)$/,\n GH: /^(?:(?:\\+233)|0)?(?:\\d{9})$/,\n GI: /^(?:\\+350)?\\d{5}$/,\n GM: /^(?:\\+220)?\\d{5,7}$/,\n GT: /^(?:\\+502)?[2468]\\d{7,8}$/,\n GY: /^(?:(?:\\+592)?(?:(?:\\s)?[2-9])(?:(?:\\s)?\\d))?(?:(?:\\s)?\\d{4})$/,\n HK: /^(?:\\+852\\s?)?[456789]\\d{3}\\s?\\d{4}$/,\n HN: /^(?:\\+504)?[89]\\d{7}$/,\n HR: /^(?:\\+?385)?\\d{8,9}$/,\n HT: /^(?:\\+?509)?\\d{8}$/,\n HU: /^(?:(?:\\+36))(\\s?\\d{2}\\s?\\d{3}\\s?\\d{4})$/,\n ID: /^(?:\\+?62|0[1-9])[\\s-]?\\d{2,4}[\\s-]?\\d{3,4}[\\s-]?\\d{3,4}$/,\n IL: /^(?:(?:\\+972|0)(?:-)?)[23489]\\d{7}$/,\n JM: /^(?:(?:\\+1876))\\d{7,10}$/,\n KE: /^(?:(?:\\+254)|(?:0))(?:\\d{6,7})$/,\n KG: /^(?:\\+996)?\\s?\\d{9}$/,\n KH: /^(?:(?:\\+855)|(?:0))(?:\\s?[1-9]\\d{7,8})$/,\n KY: /^(?:\\+?1\\s?(345))\\d{6}$/,\n KZ: /^(?:\\+?7|8)?7\\d{9}$/,\n LA: /^(?:(?:\\+?856)|0)(20\\d{7,9})$/,\n LK: /^(?:(?:\\+94)|0)(?:\\d{9})$/,\n LR: /^(?:\\+231)[ -\\d]{4}[ -\\d]{4}$/,\n LS: /^(?:(?:\\+?266)|0)?[56]\\d{7}$/,\n MA: /^(?:(?:\\+?212(\\s*[-|\\s*]?\\d{1,9})?)|(?:0))(?:\\d{9})$/,\n MD: /^(?:(?:\\+373)|(?:0))(?:\\d{7,8})$/,\n MK: /^(?:\\+389|0)(?:(?:2[0-4]|[3-9])\\s?)?\\d{6}$/,\n MM: /^(?:(?:\\+?95)|0)?[1-9]\\d{9}$/,\n MN: /^(?:\\+976|0)\\d{8}$/,\n MO: /^(?:(?:\\+?853)|[0-9])?\\d{8}$/,\n MU: /^(?:\\+230|0)?\\d{8}$/,\n MV: /^(?:(?:\\+?960)|0)?\\d{7}$/,\n MW: /^(?:\\+265)[1-9]\\d{6}$/,\n MX: /^(?:(?:\\+?52)?\\s?(?:1|01)?\\s?)?(?:\\d{3}\\s?\\d{3}\\s?\\d{4})$/,\n NA: /^(?:(?:\\+264)|0)?\\d{8}$/,\n NG: /^(?:(?:\\+234)|(?:0))(?:\\d{7,8})$/,\n NI: /^(?:(?:\\+505))?(?:\\d{8})$/,\n NO: /^(?:(?:\\+?47)|\\d{2}|\\d{3})\\s?\\d{2}\\s?\\d{3}$/,\n NP: /^(?:(?:\\+977))?(\\d{9,10})$/,\n NZ: /^(?:\\+?64|0)(\\d{2,5} \\d{4,8}|\\d{3,4} \\d{4})$/,\n PE: /^(?:(?:\\+51)|0)?(?:9\\d{8})$/,\n PG: /^(?:\\+?675)?(?:[7-9]\\d{7})$/,\n PH: /^(?:(?:\\+?63)|0)(?:\\d{10})$/,\n PK: /^(?:(?:\\+92)|0)?[345]\\d{9}$/,\n QA: /^(?:\\+?974)?-?33\\d{5}$/,\n RU: /^(?:\\+?7|8)?[ -]?\\(?9\\d{2}\\)?[ -]?\\d{3}[ -]?\\d{2}[ -]?\\d{2}$/,\n SA: /^(?:\\+?966)?\\s?1?[\\s-]?(?:[45]\\d{2}|5\\d{3})[\\s-]?\\d{4}$/,\n SC: /^(?:(?:\\+248)|\\d{4})\\d{5}$/,\n SE: /^(?:\\+?46|0)\\s?[1-57-9](?:[0-9]\\s?){8}$/,\n SG: /^(?:(?:\\+65)|(?:\\(\\+65\\))|(?:65))\\d{4}\\d{4}$/,\n SL: /^(?:(?:\\+232)|(?:0))?\\d{9}$/,\n SO: /^(?:\\+252|0)?[567]\\d{7}$/,\n SS: /^(?:\\+211|0)?[1-9]\\d{7,9}$/,\n SV: /^(?:(?:\\+?503)|(?:0))(?:\\d{8})$/,\n SZ: /^(?:\\+?268)?\\d{7,8}$/,\n TH: /^(?:(?:\\+66)|0)\\d{9}$/,\n TT: /^(?:(?:\\+?1-868)|\\(?868\\)?)(\\d{7})$/,\n TZ: /^(?:(?:\\+?255)|0)?[67]\\d{8}$/,\n US: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n CA: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n UY: /^(?:(?:\\+598|0)\\s?(9\\d{3}|2\\d{2}|[4-9]\\d{6}))$/,\n UZ: /^(?:\\+?998)?\\s?[3456789]\\d{8}$/,\n YE: /^(?:\\+?967)?(?:\\d{7,8})$/,\n ZA: /^(?:(?:\\+27)|0)(\\d{9})$/,\n KW: /^(?:\\+?965)[569]\\d{7}$/,\n BH: /^(?:\\+?973)?[356]\\d{7}$/,\n TL: /^(?:(?:\\+670)\\s?)?[0-9]{3}\\s?[0-9]{3,4}$/,\n VC: /^(?:(?:\\+1)?784)?(?:\\d{3})?\\d{7}$/,\n VE: /^(?:(?:\\+58)|0)?4\\d{9}$/,\n VN: /^(?:(?:\\+84)|0)?[1-9]\\d{8}$/,\n ZM: /^(?:(?:\\+260)|0)?[123456789]\\d{8,9}$/,\n ZW: /^(?:(?:\\+263)|0)?(?:\\d{9,10})$/,\n LT: /^(?:(?:\\+370)|8)\\d{8}$/,\n LU: /^(?:(?:\\+352)?(6|2(6|7|8|9))\\d{6})$/,\n LV: /^(?:(?:\\+371)?2\\d{7})$/,\n ME: /^(?:(?:\\+382)?[67]\\d{7,20})$/,\n MG: /^(?:(?:\\+261)?3[234568]\\d{7})$/,\n MZ: /^(?:(?:\\+258)|(?:258))?8[234567]\\d{7,8}$/,\n NL: /^(?:(?:\\+31)|0(6(?:\\d{8})|[1-9](?:(?:\\d{8})|(?:\\s\\d{3}\\s\\d{4}))|(?:\\d{8})))$/,\n PA: /^(?:(?:\\+507)\\s?)?[46]\\d{6,7}$/,\n PL: /^(?:(?:\\+48)?(?:\\s?\\d{3}\\s?\\d{3}\\s?\\d{3}|(?:\\d{2}\\s?){4}\\d{2}|\\d{3}-\\d{3}-\\d{3}))$/,\n PR: /^(?:(?:\\+1)?787|939)\\d{7}$/,\n PS: /^(?:(?:\\+970))(5[2349])\\d{7}$/,\n PT: /^(?:(?:\\+351)?9(1\\d|2[1-9]|6[12345789]|7[12345789])\\d{7})$/,\n PY: /^(?:(?:\\+595|0)9[9876]\\d{7})$/,\n RO: /^(?:(?:\\+40|0))(?:7[2-8]\\d{7}|21\\d{8})$/,\n RS: /^(?:(?:\\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/,\n RW: /^(?:(?:\\+250)|(0))\\d{9}$/,\n SI: /^(?:(?:\\+386)|0)?[1-59]\\d{7,8}$/,\n SK: /^(?:(?:\\+421))?(0|9[0-8])\\d{8}$/,\n SM: /^(?:(?:\\+378)|(0549|6\\d{4}))\\d{5}$/,\n SN: /^(?:(?:\\+221)|0)?[3679]\\d{7}$/,\n SR: /^(?:(?:\\+597))\\d{7}$/,\n TG: /^(?:(?:\\+228))\\d{8}$/,\n TJ: /^(?:(?:\\+992))(37|55|77)\\d{7}$/,\n TN: /^(?:(?:\\+216)|22|9[1-9])\\d{7}$/,\n TR: /^(?:(?:\\+90)|(0))\\s?5\\d{9}$/,\n TW: /^(?:(?:\\+886)|0)?9\\d{8}$/,\n UA: /^(?:(?:\\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\\d{7}$/,\n UG: /^(?:(?:\\+256)|0)?[39]\\d{8}$/,\n};\n","// Custom Error class to extend properties to error object\nexport class I18nifyError extends Error {\n timestamp: Date;\n constructor(message: string | undefined) {\n super(message);\n this.name = 'i18nify Error';\n this.timestamp = new Date();\n // more params like type of error/severity can be added in future for better debugging.\n }\n}\n\n/**\n * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block.\n * It appends additional attributes and serves as a centralized error-handling service.\n * Usage =>\n * const wrappedUtilityFn = withErrorBoundary(utilityFn)\n *\n * @param fn utility that is wrapped in error boundary\n * @returns {Function} returns the function wrapped in try/catch block\n */\nexport const withErrorBoundary = any>(\n fn: T,\n): ((...args: Parameters) => ReturnType) => {\n return function (this: unknown, ...rest: Parameters): ReturnType {\n try {\n return fn.call(this, ...rest) as ReturnType;\n } catch (err) {\n console.warn('[I18N Error]: ', err);\n // Currently, we are throwing the error as it is to consumers.\n // In the future, this can be modified as per our requirement, like an error logging service.\n throw new I18nifyError(err as string | undefined);\n }\n };\n};\n","/* Source: Google LibPhoneNumber Metadata: https://github.com/google/libphonenumber/blob/master/javascript/i18n/phonenumbers/metadata.js */\n\nexport const DIAL_CODE_MAPPER: { [key: number]: string[] } = {\n 1: [\n 'US',\n 'AG',\n 'AI',\n 'AS',\n 'BB',\n 'BM',\n 'BS',\n 'CA',\n 'DM',\n 'DO',\n 'GD',\n 'GU',\n 'JM',\n 'KN',\n 'KY',\n 'LC',\n 'MP',\n 'MS',\n 'PR',\n 'SX',\n 'TC',\n 'TT',\n 'VC',\n 'VG',\n 'VI',\n ],\n 7: ['RU', 'KZ'],\n 20: ['EG'],\n 27: ['ZA'],\n 30: ['GR'],\n 31: ['NL'],\n 32: ['BE'],\n 33: ['FR'],\n 34: ['ES'],\n 36: ['HU'],\n 39: ['IT', 'VA'],\n 40: ['RO'],\n 41: ['CH'],\n 43: ['AT'],\n 44: ['GB', 'GG', 'IM', 'JE'],\n 45: ['DK'],\n 46: ['SE'],\n 47: ['NO', 'SJ'],\n 48: ['PL'],\n 49: ['DE'],\n 51: ['PE'],\n 52: ['MX'],\n 53: ['CU'],\n 54: ['AR'],\n 55: ['BR'],\n 56: ['CL'],\n 57: ['CO'],\n 58: ['VE'],\n 60: ['MY'],\n 61: ['AU', 'CC', 'CX'],\n 62: ['ID'],\n 63: ['PH'],\n 64: ['NZ'],\n 65: ['SG'],\n 66: ['TH'],\n 81: ['JP'],\n 82: ['KR'],\n 84: ['VN'],\n 86: ['CN'],\n 90: ['TR'],\n 91: ['IN'],\n 92: ['PK'],\n 93: ['AF'],\n 94: ['LK'],\n 95: ['MM'],\n 98: ['IR'],\n 211: ['SS'],\n 212: ['MA', 'EH'],\n 213: ['DZ'],\n 216: ['TN'],\n 218: ['LY'],\n 220: ['GM'],\n 221: ['SN'],\n 222: ['MR'],\n 223: ['ML'],\n 224: ['GN'],\n 225: ['CI'],\n 226: ['BF'],\n 227: ['NE'],\n 228: ['TG'],\n 229: ['BJ'],\n 230: ['MU'],\n 231: ['LR'],\n 232: ['SL'],\n 233: ['GH'],\n 234: ['NG'],\n 235: ['TD'],\n 236: ['CF'],\n 237: ['CM'],\n 238: ['CV'],\n 239: ['ST'],\n 240: ['GQ'],\n 241: ['GA'],\n 242: ['CG'],\n 243: ['CD'],\n 244: ['AO'],\n 245: ['GW'],\n 246: ['IO'],\n 247: ['AC'],\n 248: ['SC'],\n 249: ['SD'],\n 250: ['RW'],\n 251: ['ET'],\n 252: ['SO'],\n 253: ['DJ'],\n 254: ['KE'],\n 255: ['TZ'],\n 256: ['UG'],\n 257: ['BI'],\n 258: ['MZ'],\n 260: ['ZM'],\n 261: ['MG'],\n 262: ['RE', 'YT'],\n 263: ['ZW'],\n 264: ['NA'],\n 265: ['MW'],\n 266: ['LS'],\n 267: ['BW'],\n 268: ['SZ'],\n 269: ['KM'],\n 290: ['SH', 'TA'],\n 291: ['ER'],\n 297: ['AW'],\n 298: ['FO'],\n 299: ['GL'],\n 350: ['GI'],\n 351: ['PT'],\n 352: ['LU'],\n 353: ['IE'],\n 354: ['IS'],\n 355: ['AL'],\n 356: ['MT'],\n 357: ['CY'],\n 358: ['FI', 'AX'],\n 359: ['BG'],\n 370: ['LT'],\n 371: ['LV'],\n 372: ['EE'],\n 373: ['MD'],\n 374: ['AM'],\n 375: ['BY'],\n 376: ['AD'],\n 377: ['MC'],\n 378: ['SM'],\n 380: ['UA'],\n 381: ['RS'],\n 382: ['ME'],\n 383: ['XK'],\n 385: ['HR'],\n 386: ['SI'],\n 387: ['BA'],\n 389: ['MK'],\n 420: ['CZ'],\n 421: ['SK'],\n 423: ['LI'],\n 500: ['FK'],\n 501: ['BZ'],\n 502: ['GT'],\n 503: ['SV'],\n 504: ['HN'],\n 505: ['NI'],\n 506: ['CR'],\n 507: ['PA'],\n 508: ['PM'],\n 509: ['HT'],\n 590: ['GP', 'BL', 'MF'],\n 591: ['BO'],\n 592: ['GY'],\n 593: ['EC'],\n 594: ['GF'],\n 595: ['PY'],\n 596: ['MQ'],\n 597: ['SR'],\n 598: ['UY'],\n 599: ['CW', 'BQ'],\n 670: ['TL'],\n 672: ['NF'],\n 673: ['BN'],\n 674: ['NR'],\n 675: ['PG'],\n 676: ['TO'],\n 677: ['SB'],\n 678: ['VU'],\n 679: ['FJ'],\n 680: ['PW'],\n 681: ['WF'],\n 682: ['CK'],\n 683: ['NU'],\n 685: ['WS'],\n 686: ['KI'],\n 687: ['NC'],\n 688: ['TV'],\n 689: ['PF'],\n 690: ['TK'],\n 691: ['FM'],\n 692: ['MH'],\n 800: ['001'],\n 808: ['001'],\n 850: ['KP'],\n 852: ['HK'],\n 853: ['MO'],\n 855: ['KH'],\n 856: ['LA'],\n 870: ['001'],\n 878: ['001'],\n 880: ['BD'],\n 881: ['001'],\n 882: ['001'],\n 883: ['001'],\n 886: ['TW'],\n 888: ['001'],\n 960: ['MV'],\n 961: ['LB'],\n 962: ['JO'],\n 963: ['SY'],\n 964: ['IQ'],\n 965: ['KW'],\n 966: ['SA'],\n 967: ['YE'],\n 968: ['OM'],\n 970: ['PS'],\n 971: ['AE'],\n 972: ['IL'],\n 973: ['BH'],\n 974: ['QA'],\n 975: ['BT'],\n 976: ['MN'],\n 977: ['NP'],\n 979: ['001'],\n 992: ['TJ'],\n 993: ['TM'],\n 994: ['AZ'],\n 995: ['GE'],\n 996: ['KG'],\n 998: ['UZ'],\n};\n","import { DIAL_CODE_MAPPER } from './data/dialCodeMapper';\nimport { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\n\n/**\n * Determines the country code based on the provided phone number.\n * This function employs a multi-step approach to identify the country code:\n * - If the phone number starts with '+', it extracts the numeric characters\n * and matches the leading digits with known dial codes mapped to countries.\n * - For matched dial codes, it further filters based on country-specific regex patterns\n * to validate the phone number format for those countries.\n * - If the phone number doesn't start with '+', it directly matches the number\n * against regular expressions associated with various countries to identify the code.\n *\n * @param phoneNumber The input phone number (string or number).\n * @returns The detected country code or an empty string if not found.\n */\nexport const detectCountryCodeFromDialCode = (\n phoneNumber: string | number,\n): string => {\n // If the phone number starts with '+', extract numeric characters\n if (phoneNumber.toString().charAt(0) === '+') {\n const cleanedPhoneNumberWithoutPlusPrefix = phoneNumber\n .toString()\n .replace(/\\D/g, '');\n\n const matchingCountries: string[] = [];\n\n // Iterate through dial codes and check for matches with cleaned phone number\n for (const code in DIAL_CODE_MAPPER) {\n if (cleanedPhoneNumberWithoutPlusPrefix.startsWith(code)) {\n matchingCountries.push(...DIAL_CODE_MAPPER[code]);\n }\n }\n\n // Filter matching countries based on phone number validation regex\n const matchedCountryCode = matchingCountries.find((countryCode: string) => {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex && regex.test(phoneNumber.toString())) return countryCode;\n return undefined;\n });\n\n // Return the first matched country code, if any\n return matchedCountryCode || '';\n } else {\n // If phone number doesn't start with '+', directly match against country regexes\n for (const countryCode in PHONE_REGEX_MAPPER) {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex.test(phoneNumber.toString())) {\n return countryCode;\n }\n }\n }\n\n // Return empty string if no country code is detected\n return '';\n};\n\nexport const cleanPhoneNumber = (phoneNumber: string) => {\n // Regular expression to match all characters except numbers and + sign at the start\n const regex = /[^0-9+]|(?!A)\\+/g;\n // Replace matched characters with an empty string\n const cleanedPhoneNumber = phoneNumber.replace(regex, '');\n return phoneNumber[0] === '+' ? `+${cleanedPhoneNumber}` : cleanedPhoneNumber;\n};\n","import { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Validates whether a given phone number is valid based on the provided country code or auto-detects the country code and checks if the number matches the defined regex pattern for that country.\nconst isValidPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_REGEX_MAPPER,\n): boolean => {\n // Clean the provided phoneNumber by removing non-numeric characters\n const cleanedPhoneNumber = cleanPhoneNumber(phoneNumber.toString());\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_REGEX_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(cleanedPhoneNumber);\n\n // Return false if phoneNumber is empty\n if (!phoneNumber) return false;\n\n // Check if the countryCode exists in the PHONE_REGEX_MAPPER\n if (countryCode in PHONE_REGEX_MAPPER) {\n // Fetch the regex pattern for the countryCode\n const regex = PHONE_REGEX_MAPPER[countryCode];\n // Test if the cleanedPhoneNumber matches the regex pattern\n return regex.test(cleanedPhoneNumber as string);\n }\n\n // Return false if the countryCode is not supported\n return false;\n};\n\nexport default withErrorBoundary(isValidPhoneNumber);\n","export const PHONE_FORMATTER_MAPPER: { [key: string]: string } = {\n IN: 'xxxx xxxxxx',\n MY: 'xx xxxxx xx',\n AE: 'xx xxx xxxx',\n AL: 'xxx xx xxxx',\n AM: 'xx xx xx xx',\n AR: 'xxxx-xxxx',\n AU: 'xxx xxx xxx',\n AW: 'xxx-xxxx',\n BB: 'xxx-xxxx',\n BD: 'xxxx-xxxxxx',\n BM: 'xxx-xxxx',\n BN: 'xxxx-xxxx',\n BO: 'xxxx-xxxx',\n BS: 'xxx-xxxx',\n BW: 'xx xxxx xxxx',\n BZ: 'xxx-xxxx',\n CA: 'xxx-xxx-xxxx',\n CH: 'xxx xxx xxx',\n CN: 'xxxx-xxxxxxx',\n CO: 'xxxx-xxxxxxx',\n CR: 'xxxx-xxxx',\n CU: 'xxxx-xxxx',\n CZ: 'xxx xxx xxx',\n DK: 'xx xx xx xx',\n DO: 'xxx-xxxxxxx',\n DZ: 'xxxx-xxxx-xxx',\n EG: 'xx xxx xxxx',\n ET: 'xx xxx xxxx',\n EU: 'xxx xx xx xx',\n FJ: 'xxxx xxxx',\n GB: 'xxxx xxx xxx',\n GH: 'xxx xxx xxxx',\n GI: 'xxxx xxxx',\n GM: 'xxxx-xxxx',\n GT: 'xxxx-xxxx',\n GY: 'xxx-xxxx',\n HK: 'xxxx xxxx',\n HN: 'xxxx-xxxx',\n HR: 'xxx xxx xxxx',\n HT: 'xxx-xxxx',\n HU: 'xxx xxx xxxx',\n ID: 'xxxx-xxxx-xxxx',\n IL: 'xxxx-xxx-xxx',\n JM: 'xxx-xxxx',\n KE: 'xxx xxxxxx',\n KG: 'xxx-xx-xx-xx',\n KH: 'xxx-xxx-xxx',\n KY: 'xxx-xxxx',\n KZ: 'xxx-xxx-xx-xx',\n LA: 'xxx xx xxxx',\n LK: 'xx xxx xxxx',\n LR: 'xxx-xxx-xxxx',\n LS: 'xxx xx xxxx',\n LT: 'xxx xxxxx',\n LU: 'xxx xx xxx',\n LV: 'xxxx xxxx',\n MA: 'xxxx-xxxxxx',\n MD: 'xx xxxxxx',\n ME: 'xx xxxxxx',\n MG: 'xx xx xx xx xx',\n MK: 'xx xx xx xx',\n MM: 'xx xxxxxx',\n MN: 'xxx-xx-xxxx',\n MO: 'xxxx xxxx',\n MU: 'xx xxxx xxxx',\n MV: 'xxxxxx',\n MW: 'xx xxxx xxxx',\n MX: 'xxx-xxx-xxxx',\n MZ: 'xx xxxxxxx',\n NA: 'xx xxxx xxxx',\n NG: 'xxx xxx xxxx',\n NI: 'xxxx-xxxx',\n NL: 'xxx-xxxxxxx',\n NO: 'xxxx xxxx',\n NP: 'xxxx-xxxxxxx',\n NZ: 'xxx-xxxxxxx',\n OM: 'xxxx-xxxx',\n PA: 'xxx-xxxx',\n PE: 'xxx-xxx-xxx',\n PG: 'xxx-xxxxxx',\n PH: 'xxx-xxxx',\n PK: 'xxx-xxxxxxx',\n PL: 'xxx xxx xxx',\n PR: 'xxx-xxx-xxxx',\n PS: 'xxxx-xxxxxxx',\n PT: 'xxx xxx xxx',\n PY: 'xxx-xxxxxx',\n QA: 'xxxx xxxx',\n RO: 'xxx xxx xxxx',\n RS: 'xxx xxxxx',\n RU: 'xxx xxx-xx-xx',\n RW: 'xxx xxxxxx',\n SA: 'xxx-xxxxxxx',\n SC: 'xx xxxxx',\n SE: 'xxx-xxx xx xx',\n SG: 'xxxx xxxx',\n SI: 'xx xxxxxx',\n SK: 'xxx xxx xxx',\n SL: 'xxx-xxxxxx',\n SM: 'xxxxx xxxxx',\n SN: 'xx xxx xx xx',\n SO: 'xxx xxxxxxx',\n SR: 'xxx-xxxx',\n SS: 'xxx xxxx xxx',\n SV: 'xxxx-xxxx',\n SZ: 'xxx xx xxxx',\n TG: 'xx xx xx xx',\n TH: 'xxx-xxxxxxx',\n TJ: 'xxx xx xx xx',\n TL: 'xxx-xxxxxxx',\n TN: 'xx xxxxxx',\n TR: 'xxx xxx xx xx',\n TT: 'xxx-xxxx',\n TW: 'xxxx-xxxxxx',\n TZ: 'xxx xxx xxxx',\n UA: 'xx xxx xx xx',\n UG: 'xxx xxxxxxx',\n US: 'xxx-xxx-xxxx',\n UY: 'xxx-xxxxx',\n UZ: 'xxx-xxx-xx-xx',\n VC: 'xxx-xxxx',\n VE: 'xxxx-xxx-xxxx',\n VN: 'xxxx-xxxxxxx',\n YE: 'xxxx-xxxx',\n ZA: 'xxx-xxx-xxxx',\n ZM: 'xxx-xxxxxxx',\n ZW: 'xx xxx xxxx',\n KW: 'xxx xx xxxx',\n BH: 'xxxx xxxx',\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Formats a provided phone number according to the predefined format for a specific country code, or auto-detects the country code and formats the number accordingly.\nconst formatPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_FORMATTER_MAPPER,\n): string => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Convert phoneNumber to string and clean it by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_FORMATTER_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Fetch the pattern for the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern) return phoneNumber;\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n // Extract the phoneNumber without the prefix\n const phoneNumberWithoutPrefix = phoneNumber.slice(diff);\n const formattedNumber: string[] = [];\n let numberIndex = 0;\n\n // Loop through the pattern to format the phoneNumber\n for (let i = 0; i < pattern.length; i++) {\n const patternChar = pattern[i];\n if (patternChar === 'x') {\n // Insert phoneNumber digits at 'x' positions\n if (numberIndex < phoneNumberWithoutPrefix.length) {\n formattedNumber.push(phoneNumberWithoutPrefix[numberIndex]);\n numberIndex++;\n }\n } else {\n // Insert non-digit characters from the pattern\n formattedNumber.push(patternChar);\n }\n }\n\n // Join the formattedNumber array to create the formattedPhoneNumber without prefix\n const formattedPhoneNumberWithoutPrefix = formattedNumber.join('');\n // Combine the prefix and formattedPhoneNumberWithoutPrefix\n const formattedPhoneNumberWithPrefix =\n phoneNumber.slice(0, diff) + ' ' + formattedPhoneNumberWithoutPrefix;\n\n // Return the formattedPhoneNumber with prefix after trimming whitespace\n return formattedPhoneNumberWithPrefix.trim();\n};\n\nexport default withErrorBoundary(formatPhoneNumber);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport formatPhoneNumber from './formatPhoneNumber';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\ninterface PhoneInfo {\n countryCode: string;\n dialCode: string;\n formattedPhoneNumber: string;\n formatTemplate: string;\n}\n\n// Parses a given phone number, identifies its country code (if not provided), and returns an object with details including the country code, formatted phone number, dial code, and format template.\nconst parsePhoneNumber = (phoneNumber: string, country?: string): PhoneInfo => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Clean the phoneNumber by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n const countryCode =\n country && country in PHONE_FORMATTER_MAPPER\n ? country\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Format the phone number using the detected/validated country code\n const formattedPhoneNumber = formatPhoneNumber(phoneNumber, countryCode);\n\n // Fetch the pattern associated with the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern)\n return {\n countryCode: countryCode || '',\n dialCode: '',\n formattedPhoneNumber: phoneNumber,\n formatTemplate: '',\n };\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n\n // Extract the dialCode from the phoneNumber\n const dialCode = phoneNumber.slice(0, diff);\n\n // Obtain the format template associated with the countryCode\n const formatTemplate = PHONE_FORMATTER_MAPPER[countryCode];\n\n // Return the parsed phone number information\n return {\n countryCode,\n formattedPhoneNumber,\n dialCode,\n formatTemplate,\n };\n};\n\nexport default withErrorBoundary(parsePhoneNumber);\n"],"names":["formatPhoneNumber"],"mappings":"AAAO,MAAM,kBAAkB,GAA8B;AAC3D,IAAA,EAAE,EAAE,kDAAkD;AACtD,IAAA,EAAE,EAAE,qCAAqC;AACzC,IAAA,EAAE,EAAE,qCAAqC;AACzC,IAAA,EAAE,EAAE,oCAAoC;AACxC,IAAA,EAAE,EAAE,4CAA4C;AAChD,IAAA,EAAE,EAAE,oEAAoE;AACxE,IAAA,EAAE,EAAE,qBAAqB;AACzB,IAAA,EAAE,EAAE,4BAA4B;AAChC,IAAA,EAAE,EAAE,mCAAmC;AACvC,IAAA,EAAE,EAAE,gCAAgC;AACpC,IAAA,EAAE,EAAE,mCAAmC;AACvC,IAAA,EAAE,EAAE,8BAA8B;AAClC,IAAA,EAAE,EAAE,6CAA6C;AACjD,IAAA,EAAE,EAAE,mCAAmC;AACvC,IAAA,EAAE,EAAE,+BAA+B;AACnC,IAAA,EAAE,EAAE,gCAAgC;AACpC,IAAA,EAAE,EAAE,sEAAsE;AAC1E,IAAA,EAAE,EAAE,2BAA2B;AAC/B,IAAA,EAAE,EAAE,sCAAsC;AAC1C,IAAA,EAAE,EAAE,mCAAmC;AACvC,IAAA,EAAE,EAAE,kCAAkC;AACtC,IAAA,EAAE,EAAE,4BAA4B;AAChC,IAAA,EAAE,EAAE,wBAAwB;AAC5B,IAAA,EAAE,EAAE,uBAAuB;AAC3B,IAAA,EAAE,EAAE,4CAA4C;AAChD,I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,2BAA2B,CAAC;;IAG9D,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;;AAG5C,IAAA,MAAM,cAAc,GAAG,sBAAsB,CAAC,WAAW,CAAC,CAAC;;IAG3D,OAAO;QACL,WAAW;QACX,oBAAoB;QACpB,QAAQ;QACR,cAAc;KACf,CAAC;AACJ,CAAC,CAAC;AAEF,yBAAe,iBAAiB,CAA0B,gBAAgB,CAAC;;;;"} \ No newline at end of file diff --git a/lib/types/index.d.ts b/lib/types/index.d.ts deleted file mode 100644 index f5dd6e39..00000000 --- a/lib/types/index.d.ts +++ /dev/null @@ -1,97 +0,0 @@ -interface I18nState { - locale: string; - direction: 'ltr' | 'rtl' | string; - country: string; -} - -declare const _default$p: () => I18nState; - -declare const _default$o: (newState: Partial) => void; - -declare const _default$n: () => void; - -declare const _default$m: (amount: string | number, options?: { - currency?: string | number | undefined; - locale?: string | undefined; - intlOptions?: Intl.NumberFormatOptions | undefined; -} | undefined) => string; - -declare const _default$l: () => { - [key: string]: { - symbol: string; - name: string; - }; -}; - -declare const _default$k: (currencyCode: string | number) => string; - -declare const ALLOWED_FORMAT_PARTS_KEYS: readonly ["nan", "infinity", "percent", "integer", "group", "decimal", "fraction", "plusSign", "minusSign", "percentSign", "currency", "code", "symbol", "name", "compact", "exponentInteger", "exponentMinusSign", "exponentSeparator", "unit"]; - -type FormattedPartsObject = { - [key in (typeof ALLOWED_FORMAT_PARTS_KEYS)[number]]?: string | undefined; -}; -interface ByParts extends FormattedPartsObject { - isPrefixSymbol: boolean; - rawParts: Array<{ - type: string; - value: unknown; - }>; -} - -declare const _default$j: (amount: string | number, options?: { - currency?: string | number | undefined; - locale?: string | undefined; - intlOptions?: Intl.NumberFormatOptions | undefined; -} | undefined) => ByParts; - -declare const _default$i: (phoneNumber: string | number, countryCode?: string | number | undefined) => boolean; - -declare const _default$h: (phoneNumber: string | number, countryCode?: string | number | undefined) => string; - -interface PhoneInfo { - countryCode: string; - dialCode: string; - formattedPhoneNumber: string; - formatTemplate: string; -} -declare const _default$g: (phoneNumber: string, country?: string | undefined) => PhoneInfo; - -type DateInput = Date | string; -interface DateFormatOptions extends Omit { -} -interface TimeFormatOptions extends Omit { -} - -declare const _default$f: (date: DateInput, value: number, unit: "days" | "months" | "years") => Date; - -declare const _default$e: (date: DateInput, locale: string, options?: DateFormatOptions | undefined) => string; - -declare const _default$d: (date: DateInput, locale: string, intlOptions?: Intl.DateTimeFormatOptions | undefined) => string; - -declare const _default$c: (date: DateInput, locale: string, options?: TimeFormatOptions | undefined) => string; - -declare const _default$b: (locale: string, intlOptions?: Intl.DateTimeFormatOptions | undefined) => string; - -declare const _default$a: (date: DateInput) => number; - -declare const _default$9: (date: DateInput, baseDate: DateInput | undefined, locale: string, options?: Intl.RelativeTimeFormatOptions | undefined) => string; - -declare const _default$8: (date: DateInput) => number; - -declare const _default$7: (locale: string, intlOptions?: Intl.DateTimeFormatOptions | undefined) => string[]; - -declare const _default$6: (date1: DateInput, date2: DateInput) => boolean; - -declare const _default$5: (date1: DateInput, date2: DateInput) => boolean; - -declare const _default$4: (year: number) => boolean; - -declare const _default$3: (date1: Date, date2: Date) => boolean; - -declare const _default$2: (date: any) => boolean; - -declare const _default$1: (dateString: string, locale: string) => Date | null; - -declare const _default: (date: DateInput, value: number, unit: "days" | "months" | "years") => Date; - -export { _default$f as add, _default$e as formatDate, _default$d as formatDateTime, _default$m as formatNumber, _default$j as formatNumberByParts, _default$h as formatPhoneNumber, _default$c as formatTime, _default$l as getCurrencyList, _default$k as getCurrencySymbol, _default$b as getFirstDayOfWeek, _default$a as getQuarter, _default$9 as getRelativeTime, _default$p as getState, _default$8 as getWeek, _default$7 as getWeekdays, _default$6 as isAfter, _default$5 as isBefore, _default$4 as isLeapYear, _default$3 as isSameDay, _default$2 as isValidDate, _default$i as isValidPhoneNumber, _default$1 as parseDate, _default$g as parsePhoneNumber, _default$n as resetState, _default$o as setState, _default as subtract }; diff --git a/lib/umd/index.js b/lib/umd/index.js deleted file mode 100644 index 95f78847..00000000 --- a/lib/umd/index.js +++ /dev/null @@ -1,1773 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.i18nify = {})); -})(this, (function (exports) { 'use strict'; - - // Custom Error class to extend properties to error object - class I18nifyError extends Error { - constructor(message) { - super(message); - this.name = 'i18nify Error'; - this.timestamp = new Date(); - // more params like type of error/severity can be added in future for better debugging. - } - } - /** - * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block. - * It appends additional attributes and serves as a centralized error-handling service. - * Usage => - * const wrappedUtilityFn = withErrorBoundary(utilityFn) - * - * @param fn utility that is wrapped in error boundary - * @returns {Function} returns the function wrapped in try/catch block - */ - const withErrorBoundary = (fn) => { - return function (...rest) { - try { - return fn.call(this, ...rest); - } - catch (err) { - console.warn('[I18N Error]: ', err); - // Currently, we are throwing the error as it is to consumers. - // In the future, this can be modified as per our requirement, like an error logging service. - throw new I18nifyError(err); - } - }; - }; - - function getDefaultState() { - return { - locale: '', - direction: '', - country: '', - }; - } - - class I18nStateManager { - constructor() { - this.state = getDefaultState(); - } - static getInstance() { - if (!I18nStateManager.instance) { - I18nStateManager.instance = new I18nStateManager(); - } - return I18nStateManager.instance; - } - static resetInstance() { - I18nStateManager.instance = undefined; - } - getState() { - return Object.assign({}, this.state); - } - setState(newState) { - this.state = Object.assign(Object.assign({}, this.state), newState); - } - resetState() { - this.state = getDefaultState(); - } - } - var state = I18nStateManager.getInstance(); - - /** - * function to return active i18n state - * - * ===== USAGE ===== - * import { getState } from '@razorpay/i18nify-js'; - * - * console.log(getState()) - * - * @returns i18n state - */ - const getState = () => { - return state.getState(); - }; - var getState$1 = withErrorBoundary(getState); - - /** - * Function to set and override the active state in i18nify SDK - * - * ===== USAGE ===== - * import { setState } from "@razorpay/i18nify-js"; - * setState({locale: 'en-US'}) - * - * @param newState data to set in i18nState instance - */ - const setState = (newState) => { - state.setState(newState); - }; - var setState$1 = withErrorBoundary(setState); - - /** - * Function to reset the active state in i18nify SDK - * - * ===== USAGE ===== - * import { resetState } from "@razorpay/i18nify-js"; - * resetState() - * - * @param newState data to set in i18nState instance - */ - const resetState = () => { - state.resetState(); - }; - var resetState$1 = withErrorBoundary(resetState); - - const getLocale = () => { - // Check if running in a non-browser environment (e.g., Node.js or older browsers). - if (typeof navigator === 'undefined') { - return 'en-IN'; - } - // Check if the browser supports the Intl object and user language preferences. - if (window.Intl && - typeof window.Intl === 'object' && - (window.navigator.languages || window.navigator.language)) { - const userLocales = window.navigator.languages || [ - window.navigator.language, - ]; - return userLocales[0]; - } - // Fallback to a supported locale or the default locale. - return 'en-IN'; - }; - - const getIntlInstanceWithOptions = (options = {}) => { - /** retrieve locale from below areas in order of preference - * 1. options.locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - let locale = (options === null || options === void 0 ? void 0 : options.locale) || state.getState().locale; - // If a specific locale is provided, use it; otherwise, use the browser's locale - if (!locale) { - locale = getLocale(); - } - const intlOptions = (options === null || options === void 0 ? void 0 : options.intlOptions) ? Object.assign({}, options.intlOptions) : {}; - if ((options === null || options === void 0 ? void 0 : options.currency) || intlOptions.currency) { - intlOptions.style = 'currency'; - intlOptions.currency = (options.currency || intlOptions.currency); - } - if (!locale) - throw new Error('Pass valid locale !'); - return new Intl.NumberFormat(locale || undefined, intlOptions); - }; - - // this function formats number based on different arguments passed - const formatNumber = (amount, options = {}) => { - if (!Number(amount) && Number(amount) !== 0) - throw new Error('Parameter `amount` is not a number!'); - let formattedAmount = ''; - try { - formattedAmount = getIntlInstanceWithOptions(options).format(Number(amount)); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - return formattedAmount; - }; - var formatNumber$1 = withErrorBoundary(formatNumber); - - const CURRENCIES = { - AED: { symbol: 'د.إ', name: 'United Arab Emirates Dirham' }, - ALL: { symbol: 'Lek', name: 'Albanian Lek' }, - AMD: { symbol: '֏', name: 'Armenian Dram' }, - ARS: { symbol: 'ARS', name: 'Argentine Peso' }, - AUD: { symbol: 'A$', name: 'Australian Dollar' }, - AWG: { symbol: 'Afl.', name: 'Aruban Florin' }, - BBD: { symbol: '$', name: 'Barbadian Dollar' }, - BDT: { symbol: '৳', name: 'Bangladeshi Taka' }, - BMD: { symbol: '$', name: 'Bermudian Dollar' }, - BND: { symbol: 'BND', name: 'Brunei Dollar' }, - BOB: { symbol: 'Bs', name: 'Bolivian Boliviano' }, - BSD: { symbol: 'B$', name: 'Bahamian Dollar' }, - BWP: { symbol: 'P', name: 'Botswanan Pula' }, - BZD: { symbol: 'BZ$', name: 'Belize Dollar' }, - CAD: { symbol: 'C$', name: 'Canadian Dollar' }, - CHF: { symbol: 'CHf', name: 'Swiss Franc' }, - CNY: { symbol: '¥', name: 'Chinese Yuan' }, - COP: { symbol: 'COL$', name: 'Colombian Peso' }, - CRC: { symbol: '₡', name: 'Costa Rican Colón' }, - CUP: { symbol: '$MN', name: 'Cuban Peso' }, - CZK: { symbol: 'Kč', name: 'Czech Koruna' }, - DKK: { symbol: 'DKK', name: 'Danish Krone' }, - DOP: { symbol: 'RD$', name: 'Dominican Peso' }, - DZD: { symbol: 'د.ج', name: 'Algerian Dinar' }, - EGP: { symbol: 'E£', name: 'Egyptian Pound' }, - ETB: { symbol: 'ብር', name: 'Ethiopian Birr' }, - EUR: { symbol: '€', name: 'Euro' }, - FJD: { symbol: 'FJ$', name: 'Fijian Dollar' }, - GBP: { symbol: '£', name: 'British Pound' }, - GHS: { symbol: 'GH₵', name: 'Ghanaian Cedi' }, - GIP: { symbol: 'GIP', name: 'Gibraltar Pound' }, - GMD: { symbol: 'D', name: 'Gambian Dalasi' }, - GTQ: { symbol: 'Q', name: 'Guatemalan Quetzal' }, - GYD: { symbol: 'G$', name: 'Guyanese Dollar' }, - HKD: { symbol: 'HK$', name: 'Hong Kong Dollar' }, - HNL: { symbol: 'HNL', name: 'Honduran Lempira' }, - HRK: { symbol: 'kn', name: 'Croatian Kuna' }, - HTG: { symbol: 'G', name: 'Haitian Gourde' }, - HUF: { symbol: 'Ft', name: 'Hungarian Forint' }, - IDR: { symbol: 'Rp', name: 'Indonesian Rupiah' }, - ILS: { symbol: '₪', name: 'Israeli New Shekel' }, - INR: { symbol: '₹', name: 'Indian Rupee' }, - JMD: { symbol: 'J$', name: 'Jamaican Dollar' }, - KES: { symbol: 'Ksh', name: 'Kenyan Shilling' }, - KGS: { symbol: 'Лв', name: 'Kyrgystani Som' }, - KHR: { symbol: '៛', name: 'Cambodian Riel' }, - KYD: { symbol: 'CI$', name: 'Cayman Islands Dollar' }, - KZT: { symbol: '₸', name: 'Kazakhstani Tenge' }, - LAK: { symbol: '₭', name: 'Laotian Kip' }, - LKR: { symbol: 'රු', name: 'Sri Lankan Rupee' }, - LRD: { symbol: 'L$', name: 'Liberian Dollar' }, - LSL: { symbol: 'LSL', name: 'Lesotho Loti' }, - MAD: { symbol: 'د.م.', name: 'Moroccan Dirham' }, - MDL: { symbol: 'MDL', name: 'Moldovan Leu' }, - MKD: { symbol: 'ден', name: 'Macedonian Denar' }, - MMK: { symbol: 'MMK', name: 'Myanmar Kyat' }, - MNT: { symbol: '₮', name: 'Mongolian Tugrik' }, - MOP: { symbol: 'MOP$', name: 'Macanese Pataca' }, - MUR: { symbol: '₨', name: 'Mauritian Rupee' }, - MVR: { symbol: 'Rf', name: 'Maldivian Rufiyaa' }, - MWK: { symbol: 'MK', name: 'Malawian Kwacha' }, - MXN: { symbol: 'Mex$', name: 'Mexican Peso' }, - MYR: { symbol: 'RM', name: 'Malaysian Ringgit' }, - NAD: { symbol: 'N$', name: 'Namibian Dollar' }, - NGN: { symbol: '₦', name: 'Nigerian Naira' }, - NIO: { symbol: 'NIO', name: 'Nicaraguan Córdoba' }, - NOK: { symbol: 'NOK', name: 'Norwegian Krone' }, - NPR: { symbol: 'रू', name: 'Nepalese Rupee' }, - NZD: { symbol: 'NZ$', name: 'New Zealand Dollar' }, - PEN: { symbol: 'S/', name: 'Peruvian Nuevo Sol' }, - PGK: { symbol: 'PGK', name: 'Papua New Guinean Kina' }, - PHP: { symbol: '₱', name: 'Philippine Peso' }, - PKR: { symbol: '₨', name: 'Pakistani Rupee' }, - QAR: { symbol: 'QR', name: 'Qatari Riyal' }, - RUB: { symbol: '₽', name: 'Russian Ruble' }, - SAR: { symbol: 'SR', name: 'Saudi Riyal' }, - SCR: { symbol: 'SRe', name: 'Seychellois Rupee' }, - SEK: { symbol: 'SEK', name: 'Swedish Krona' }, - SGD: { symbol: 'S$', name: 'Singapore Dollar' }, - SLL: { symbol: 'Le', name: 'Sierra Leonean Leone' }, - SOS: { symbol: 'Sh.so.', name: 'Somali Shilling' }, - SSP: { symbol: 'SS£', name: 'South Sudanese Pound' }, - SVC: { symbol: '₡', name: 'Salvadoran Colón' }, - SZL: { symbol: 'E', name: 'Swazi Lilangeni' }, - THB: { symbol: '฿', name: 'Thai Baht' }, - TTD: { symbol: 'TT$', name: 'Trinidad and Tobago Dollar' }, - TZS: { symbol: 'Sh', name: 'Tanzanian Shilling' }, - USD: { symbol: '$', name: 'United States Dollar' }, - UYU: { symbol: '$U', name: 'Uruguayan Peso' }, - UZS: { symbol: "so'm", name: 'Uzbekistani Som' }, - YER: { symbol: '﷼', name: 'Yemeni Rial' }, - ZAR: { symbol: 'R', name: 'South African Rand' }, - KWD: { symbol: 'د.ك', name: 'Kuwaiti Dinar' }, - BHD: { symbol: 'د.ب.', name: 'Bahraini Dinar' }, - OMR: { symbol: 'ر.ع.', name: 'Omani Rial' }, - }; - - const getCurrencyList = () => { - return CURRENCIES; - }; - var getCurrencyList$1 = withErrorBoundary(getCurrencyList); - - const getCurrencySymbol = (currencyCode) => { - var _a; - if (currencyCode in CURRENCIES) - return (_a = CURRENCIES[currencyCode]) === null || _a === void 0 ? void 0 : _a.symbol; - else - throw new Error('Invalid currencyCode!'); - }; - var getCurrencySymbol$1 = withErrorBoundary(getCurrencySymbol); - - const ALLOWED_FORMAT_PARTS_KEYS = [ - 'nan', - 'infinity', - 'percent', - 'integer', - 'group', - 'decimal', - 'fraction', - 'plusSign', - 'minusSign', - 'percentSign', - 'currency', - 'code', - 'symbol', - 'name', - 'compact', - 'exponentInteger', - 'exponentMinusSign', - 'exponentSeparator', - 'unit', - ]; - - const formatNumberByParts = (amount, options = {}) => { - if (!Number(amount) && Number(amount) !== 0) - throw new Error('Parameter `amount` is not a number!'); - try { - const formattedAmount = getIntlInstanceWithOptions(options).formatToParts(Number(amount)); - const parts = formattedAmount; - const formattedObj = {}; - parts.forEach((p) => { - if (p.type === 'group') { - formattedObj.integer = (formattedObj.integer || '') + p.value; - } - else if (ALLOWED_FORMAT_PARTS_KEYS.findIndex((item) => item === p.type) != -1) { - // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal' is skipped - formattedObj[p.type] = (formattedObj[p.type] || '') + p.value; - } - }); - return Object.assign(Object.assign({}, formattedObj), { isPrefixSymbol: parts[0].type === 'currency', rawParts: parts }); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - }; - var formatNumberByParts$1 = withErrorBoundary(formatNumberByParts); - - const PHONE_REGEX_MAPPER = { - IN: /^(?:(?:\+|0{0,2})91\s*[-]?\s*|[0]?)?[6789]\d{9}$/, - MY: /^(\+?6?0)?(\d{1,3})[-. ]?(\d{7,8})$/, - AE: /^(?:\+?971|0)?(?:2|3|4|6|7|9)\d{8}$/, - AL: /^(?:\+?355)?(?:[4-9]\d{7}|6\d{8})$/, - AM: /^(?:\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/, - AR: /^(?:(?:\+|0{0,2})54)?(?:11|[2368]\d)(?:(?=\d{0,2}15)\d{2})??\d{8}$/, - AU: /^(?:\+?61|0)4\d{8}$/, - AW: /^(?:(?:\+297)?(?!0)\d{7})$/, - BB: /^(?:(?:\+1)?246)?(?:\d{3})?\d{7}$/, - BD: /^(?:\+?880|0)1[13456789]\d{8}$/, - BM: /^(?:(?:\+1)?441)?(?:\d{2})?\d{7}$/, - BN: /^(?:\+?673)?(?:\d{3})?\d{4}$/, - BO: /^(?:(?:\+|0{0,2})591)?(?:(?:2|3|7|6)\d{7})$/, - BS: /^(?:(?:\+1)?242)?(?:\d{3})?\d{7}$/, - BW: /^(?:(?:\+267)?\s?)?[74]\d{7}$/, - BZ: /^(?:(?:\+501)?\s?)?[622]\d{4}$/, - CH: /^(?:(?:\+41|0)(?:\s*\(?0\)?\s*))?(?:\d{2}\s*)?\d{3}\s*\d{2}\s*\d{2}$/, - CN: /^(?:(?:\+|00)86)?1\d{10}$/, - CO: /^(?:(?:\+57|0057)?)?[1-8]{1}\d{6,7}$/, - OM: /^(?:\+?968)?(?:95|96|97|98)\d{6}$/, - CR: /^(?:(?:\+506)?\s*|0)?[1-9]\d{7}$/, - CU: /^(?:\+?53)?(?:[5-8]\d{7})$/, - CZ: /^(?:\+?420)?(?:\d{9})$/, - DK: /^(?:\+?45)?(?:\d{8})$/, - DO: /^(?:(?:\+1)?809|1-8(?:00|88|89))(?:\d{7})$/, - DZ: /^(?:\+?213|0)([567]\d{8})$/, - EG: /^(?:(?:\+20|20)?(\d{10}))$/, - ET: /^(?:\+?251)?[1-59]\d{8}$/, - EU: /^(?:(?:\+?3)?8)?\s*(?:\d{3}\s*){3}\d{2}$/, - FJ: /^(?:(?:\+?679)?\s?\d{3}\s?\d{4})?$/, - GB: /^(?:(?:\+44\s?|0)7\d{3}(\s?\d{4,})?)$/, - GH: /^(?:(?:\+233)|0)?(?:\d{9})$/, - GI: /^(?:\+350)?\d{5}$/, - GM: /^(?:\+220)?\d{5,7}$/, - GT: /^(?:\+502)?[2468]\d{7,8}$/, - GY: /^(?:(?:\+592)?(?:(?:\s)?[2-9])(?:(?:\s)?\d))?(?:(?:\s)?\d{4})$/, - HK: /^(?:\+852\s?)?[456789]\d{3}\s?\d{4}$/, - HN: /^(?:\+504)?[89]\d{7}$/, - HR: /^(?:\+?385)?\d{8,9}$/, - HT: /^(?:\+?509)?\d{8}$/, - HU: /^(?:(?:\+36))(\s?\d{2}\s?\d{3}\s?\d{4})$/, - ID: /^(?:\+?62|0[1-9])[\s-]?\d{2,4}[\s-]?\d{3,4}[\s-]?\d{3,4}$/, - IL: /^(?:(?:\+972|0)(?:-)?)[23489]\d{7}$/, - JM: /^(?:(?:\+1876))\d{7,10}$/, - KE: /^(?:(?:\+254)|(?:0))(?:\d{6,7})$/, - KG: /^(?:\+996)?\s?\d{9}$/, - KH: /^(?:(?:\+855)|(?:0))(?:\s?[1-9]\d{7,8})$/, - KY: /^(?:\+?1\s?(345))\d{6}$/, - KZ: /^(?:\+?7|8)?7\d{9}$/, - LA: /^(?:(?:\+?856)|0)(20\d{7,9})$/, - LK: /^(?:(?:\+94)|0)(?:\d{9})$/, - LR: /^(?:\+231)[ -\d]{4}[ -\d]{4}$/, - LS: /^(?:(?:\+?266)|0)?[56]\d{7}$/, - MA: /^(?:(?:\+?212(\s*[-|\s*]?\d{1,9})?)|(?:0))(?:\d{9})$/, - MD: /^(?:(?:\+373)|(?:0))(?:\d{7,8})$/, - MK: /^(?:\+389|0)(?:(?:2[0-4]|[3-9])\s?)?\d{6}$/, - MM: /^(?:(?:\+?95)|0)?[1-9]\d{9}$/, - MN: /^(?:\+976|0)\d{8}$/, - MO: /^(?:(?:\+?853)|[0-9])?\d{8}$/, - MU: /^(?:\+230|0)?\d{8}$/, - MV: /^(?:(?:\+?960)|0)?\d{7}$/, - MW: /^(?:\+265)[1-9]\d{6}$/, - MX: /^(?:(?:\+?52)?\s?(?:1|01)?\s?)?(?:\d{3}\s?\d{3}\s?\d{4})$/, - NA: /^(?:(?:\+264)|0)?\d{8}$/, - NG: /^(?:(?:\+234)|(?:0))(?:\d{7,8})$/, - NI: /^(?:(?:\+505))?(?:\d{8})$/, - NO: /^(?:(?:\+?47)|\d{2}|\d{3})\s?\d{2}\s?\d{3}$/, - NP: /^(?:(?:\+977))?(\d{9,10})$/, - NZ: /^(?:\+?64|0)(\d{2,5} \d{4,8}|\d{3,4} \d{4})$/, - PE: /^(?:(?:\+51)|0)?(?:9\d{8})$/, - PG: /^(?:\+?675)?(?:[7-9]\d{7})$/, - PH: /^(?:(?:\+?63)|0)(?:\d{10})$/, - PK: /^(?:(?:\+92)|0)?[345]\d{9}$/, - QA: /^(?:\+?974)?-?33\d{5}$/, - RU: /^(?:\+?7|8)?[ -]?\(?9\d{2}\)?[ -]?\d{3}[ -]?\d{2}[ -]?\d{2}$/, - SA: /^(?:\+?966)?\s?1?[\s-]?(?:[45]\d{2}|5\d{3})[\s-]?\d{4}$/, - SC: /^(?:(?:\+248)|\d{4})\d{5}$/, - SE: /^(?:\+?46|0)\s?[1-57-9](?:[0-9]\s?){8}$/, - SG: /^(?:(?:\+65)|(?:\(\+65\))|(?:65))\d{4}\d{4}$/, - SL: /^(?:(?:\+232)|(?:0))?\d{9}$/, - SO: /^(?:\+252|0)?[567]\d{7}$/, - SS: /^(?:\+211|0)?[1-9]\d{7,9}$/, - SV: /^(?:(?:\+?503)|(?:0))(?:\d{8})$/, - SZ: /^(?:\+?268)?\d{7,8}$/, - TH: /^(?:(?:\+66)|0)\d{9}$/, - TT: /^(?:(?:\+?1-868)|\(?868\)?)(\d{7})$/, - TZ: /^(?:(?:\+?255)|0)?[67]\d{8}$/, - US: /^(\+\d{1,2}\s?)?([2-9]{1}\d{2}[2-9]{1}\d{6})$/, - CA: /^(\+\d{1,2}\s?)?([2-9]{1}\d{2}[2-9]{1}\d{6})$/, - UY: /^(?:(?:\+598|0)\s?(9\d{3}|2\d{2}|[4-9]\d{6}))$/, - UZ: /^(?:\+?998)?\s?[3456789]\d{8}$/, - YE: /^(?:\+?967)?(?:\d{7,8})$/, - ZA: /^(?:(?:\+27)|0)(\d{9})$/, - KW: /^(?:\+?965)[569]\d{7}$/, - BH: /^(?:\+?973)?[356]\d{7}$/, - TL: /^(?:(?:\+670)\s?)?[0-9]{3}\s?[0-9]{3,4}$/, - VC: /^(?:(?:\+1)?784)?(?:\d{3})?\d{7}$/, - VE: /^(?:(?:\+58)|0)?4\d{9}$/, - VN: /^(?:(?:\+84)|0)?[1-9]\d{8}$/, - ZM: /^(?:(?:\+260)|0)?[123456789]\d{8,9}$/, - ZW: /^(?:(?:\+263)|0)?(?:\d{9,10})$/, - LT: /^(?:(?:\+370)|8)\d{8}$/, - LU: /^(?:(?:\+352)?(6|2(6|7|8|9))\d{6})$/, - LV: /^(?:(?:\+371)?2\d{7})$/, - ME: /^(?:(?:\+382)?[67]\d{7,20})$/, - MG: /^(?:(?:\+261)?3[234568]\d{7})$/, - MZ: /^(?:(?:\+258)|(?:258))?8[234567]\d{7,8}$/, - NL: /^(?:(?:\+31)|0(6(?:\d{8})|[1-9](?:(?:\d{8})|(?:\s\d{3}\s\d{4}))|(?:\d{8})))$/, - PA: /^(?:(?:\+507)\s?)?[46]\d{6,7}$/, - PL: /^(?:(?:\+48)?(?:\s?\d{3}\s?\d{3}\s?\d{3}|(?:\d{2}\s?){4}\d{2}|\d{3}-\d{3}-\d{3}))$/, - PR: /^(?:(?:\+1)?787|939)\d{7}$/, - PS: /^(?:(?:\+970))(5[2349])\d{7}$/, - PT: /^(?:(?:\+351)?9(1\d|2[1-9]|6[12345789]|7[12345789])\d{7})$/, - PY: /^(?:(?:\+595|0)9[9876]\d{7})$/, - RO: /^(?:(?:\+40|0))(?:7[2-8]\d{7}|21\d{8})$/, - RS: /^(?:(?:\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/, - RW: /^(?:(?:\+250)|(0))\d{9}$/, - SI: /^(?:(?:\+386)|0)?[1-59]\d{7,8}$/, - SK: /^(?:(?:\+421))?(0|9[0-8])\d{8}$/, - SM: /^(?:(?:\+378)|(0549|6\d{4}))\d{5}$/, - SN: /^(?:(?:\+221)|0)?[3679]\d{7}$/, - SR: /^(?:(?:\+597))\d{7}$/, - TG: /^(?:(?:\+228))\d{8}$/, - TJ: /^(?:(?:\+992))(37|55|77)\d{7}$/, - TN: /^(?:(?:\+216)|22|9[1-9])\d{7}$/, - TR: /^(?:(?:\+90)|(0))\s?5\d{9}$/, - TW: /^(?:(?:\+886)|0)?9\d{8}$/, - UA: /^(?:(?:\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\d{7}$/, - UG: /^(?:(?:\+256)|0)?[39]\d{8}$/, - }; - - /* Source: Google LibPhoneNumber Metadata: https://github.com/google/libphonenumber/blob/master/javascript/i18n/phonenumbers/metadata.js */ - const DIAL_CODE_MAPPER = { - 1: [ - 'US', - 'AG', - 'AI', - 'AS', - 'BB', - 'BM', - 'BS', - 'CA', - 'DM', - 'DO', - 'GD', - 'GU', - 'JM', - 'KN', - 'KY', - 'LC', - 'MP', - 'MS', - 'PR', - 'SX', - 'TC', - 'TT', - 'VC', - 'VG', - 'VI', - ], - 7: ['RU', 'KZ'], - 20: ['EG'], - 27: ['ZA'], - 30: ['GR'], - 31: ['NL'], - 32: ['BE'], - 33: ['FR'], - 34: ['ES'], - 36: ['HU'], - 39: ['IT', 'VA'], - 40: ['RO'], - 41: ['CH'], - 43: ['AT'], - 44: ['GB', 'GG', 'IM', 'JE'], - 45: ['DK'], - 46: ['SE'], - 47: ['NO', 'SJ'], - 48: ['PL'], - 49: ['DE'], - 51: ['PE'], - 52: ['MX'], - 53: ['CU'], - 54: ['AR'], - 55: ['BR'], - 56: ['CL'], - 57: ['CO'], - 58: ['VE'], - 60: ['MY'], - 61: ['AU', 'CC', 'CX'], - 62: ['ID'], - 63: ['PH'], - 64: ['NZ'], - 65: ['SG'], - 66: ['TH'], - 81: ['JP'], - 82: ['KR'], - 84: ['VN'], - 86: ['CN'], - 90: ['TR'], - 91: ['IN'], - 92: ['PK'], - 93: ['AF'], - 94: ['LK'], - 95: ['MM'], - 98: ['IR'], - 211: ['SS'], - 212: ['MA', 'EH'], - 213: ['DZ'], - 216: ['TN'], - 218: ['LY'], - 220: ['GM'], - 221: ['SN'], - 222: ['MR'], - 223: ['ML'], - 224: ['GN'], - 225: ['CI'], - 226: ['BF'], - 227: ['NE'], - 228: ['TG'], - 229: ['BJ'], - 230: ['MU'], - 231: ['LR'], - 232: ['SL'], - 233: ['GH'], - 234: ['NG'], - 235: ['TD'], - 236: ['CF'], - 237: ['CM'], - 238: ['CV'], - 239: ['ST'], - 240: ['GQ'], - 241: ['GA'], - 242: ['CG'], - 243: ['CD'], - 244: ['AO'], - 245: ['GW'], - 246: ['IO'], - 247: ['AC'], - 248: ['SC'], - 249: ['SD'], - 250: ['RW'], - 251: ['ET'], - 252: ['SO'], - 253: ['DJ'], - 254: ['KE'], - 255: ['TZ'], - 256: ['UG'], - 257: ['BI'], - 258: ['MZ'], - 260: ['ZM'], - 261: ['MG'], - 262: ['RE', 'YT'], - 263: ['ZW'], - 264: ['NA'], - 265: ['MW'], - 266: ['LS'], - 267: ['BW'], - 268: ['SZ'], - 269: ['KM'], - 290: ['SH', 'TA'], - 291: ['ER'], - 297: ['AW'], - 298: ['FO'], - 299: ['GL'], - 350: ['GI'], - 351: ['PT'], - 352: ['LU'], - 353: ['IE'], - 354: ['IS'], - 355: ['AL'], - 356: ['MT'], - 357: ['CY'], - 358: ['FI', 'AX'], - 359: ['BG'], - 370: ['LT'], - 371: ['LV'], - 372: ['EE'], - 373: ['MD'], - 374: ['AM'], - 375: ['BY'], - 376: ['AD'], - 377: ['MC'], - 378: ['SM'], - 380: ['UA'], - 381: ['RS'], - 382: ['ME'], - 383: ['XK'], - 385: ['HR'], - 386: ['SI'], - 387: ['BA'], - 389: ['MK'], - 420: ['CZ'], - 421: ['SK'], - 423: ['LI'], - 500: ['FK'], - 501: ['BZ'], - 502: ['GT'], - 503: ['SV'], - 504: ['HN'], - 505: ['NI'], - 506: ['CR'], - 507: ['PA'], - 508: ['PM'], - 509: ['HT'], - 590: ['GP', 'BL', 'MF'], - 591: ['BO'], - 592: ['GY'], - 593: ['EC'], - 594: ['GF'], - 595: ['PY'], - 596: ['MQ'], - 597: ['SR'], - 598: ['UY'], - 599: ['CW', 'BQ'], - 670: ['TL'], - 672: ['NF'], - 673: ['BN'], - 674: ['NR'], - 675: ['PG'], - 676: ['TO'], - 677: ['SB'], - 678: ['VU'], - 679: ['FJ'], - 680: ['PW'], - 681: ['WF'], - 682: ['CK'], - 683: ['NU'], - 685: ['WS'], - 686: ['KI'], - 687: ['NC'], - 688: ['TV'], - 689: ['PF'], - 690: ['TK'], - 691: ['FM'], - 692: ['MH'], - 800: ['001'], - 808: ['001'], - 850: ['KP'], - 852: ['HK'], - 853: ['MO'], - 855: ['KH'], - 856: ['LA'], - 870: ['001'], - 878: ['001'], - 880: ['BD'], - 881: ['001'], - 882: ['001'], - 883: ['001'], - 886: ['TW'], - 888: ['001'], - 960: ['MV'], - 961: ['LB'], - 962: ['JO'], - 963: ['SY'], - 964: ['IQ'], - 965: ['KW'], - 966: ['SA'], - 967: ['YE'], - 968: ['OM'], - 970: ['PS'], - 971: ['AE'], - 972: ['IL'], - 973: ['BH'], - 974: ['QA'], - 975: ['BT'], - 976: ['MN'], - 977: ['NP'], - 979: ['001'], - 992: ['TJ'], - 993: ['TM'], - 994: ['AZ'], - 995: ['GE'], - 996: ['KG'], - 998: ['UZ'], - }; - - /** - * Determines the country code based on the provided phone number. - * This function employs a multi-step approach to identify the country code: - * - If the phone number starts with '+', it extracts the numeric characters - * and matches the leading digits with known dial codes mapped to countries. - * - For matched dial codes, it further filters based on country-specific regex patterns - * to validate the phone number format for those countries. - * - If the phone number doesn't start with '+', it directly matches the number - * against regular expressions associated with various countries to identify the code. - * - * @param phoneNumber The input phone number (string or number). - * @returns The detected country code or an empty string if not found. - */ - const detectCountryCodeFromDialCode = (phoneNumber) => { - // If the phone number starts with '+', extract numeric characters - if (phoneNumber.toString().charAt(0) === '+') { - const cleanedPhoneNumberWithoutPlusPrefix = phoneNumber - .toString() - .replace(/\D/g, ''); - const matchingCountries = []; - // Iterate through dial codes and check for matches with cleaned phone number - for (const code in DIAL_CODE_MAPPER) { - if (cleanedPhoneNumberWithoutPlusPrefix.startsWith(code)) { - matchingCountries.push(...DIAL_CODE_MAPPER[code]); - } - } - // Filter matching countries based on phone number validation regex - const matchedCountryCode = matchingCountries.find((countryCode) => { - const regex = PHONE_REGEX_MAPPER[countryCode]; - if (regex && regex.test(phoneNumber.toString())) - return countryCode; - return undefined; - }); - // Return the first matched country code, if any - return matchedCountryCode || ''; - } - else { - // If phone number doesn't start with '+', directly match against country regexes - for (const countryCode in PHONE_REGEX_MAPPER) { - const regex = PHONE_REGEX_MAPPER[countryCode]; - if (regex.test(phoneNumber.toString())) { - return countryCode; - } - } - } - // Return empty string if no country code is detected - return ''; - }; - const cleanPhoneNumber = (phoneNumber) => { - // Regular expression to match all characters except numbers and + sign at the start - const regex = /[^0-9+]|(?!A)\+/g; - // Replace matched characters with an empty string - const cleanedPhoneNumber = phoneNumber.replace(regex, ''); - return phoneNumber[0] === '+' ? `+${cleanedPhoneNumber}` : cleanedPhoneNumber; - }; - - // Validates whether a given phone number is valid based on the provided country code or auto-detects the country code and checks if the number matches the defined regex pattern for that country. - const isValidPhoneNumber = (phoneNumber, countryCode) => { - // Clean the provided phoneNumber by removing non-numeric characters - const cleanedPhoneNumber = cleanPhoneNumber(phoneNumber.toString()); - // Detect or validate the country code - countryCode = - countryCode && countryCode in PHONE_REGEX_MAPPER - ? countryCode - : detectCountryCodeFromDialCode(cleanedPhoneNumber); - // Return false if phoneNumber is empty - if (!phoneNumber) - return false; - // Check if the countryCode exists in the PHONE_REGEX_MAPPER - if (countryCode in PHONE_REGEX_MAPPER) { - // Fetch the regex pattern for the countryCode - const regex = PHONE_REGEX_MAPPER[countryCode]; - // Test if the cleanedPhoneNumber matches the regex pattern - return regex.test(cleanedPhoneNumber); - } - // Return false if the countryCode is not supported - return false; - }; - var isValidPhoneNumber$1 = withErrorBoundary(isValidPhoneNumber); - - const PHONE_FORMATTER_MAPPER = { - IN: 'xxxx xxxxxx', - MY: 'xx xxxxx xx', - AE: 'xx xxx xxxx', - AL: 'xxx xx xxxx', - AM: 'xx xx xx xx', - AR: 'xxxx-xxxx', - AU: 'xxx xxx xxx', - AW: 'xxx-xxxx', - BB: 'xxx-xxxx', - BD: 'xxxx-xxxxxx', - BM: 'xxx-xxxx', - BN: 'xxxx-xxxx', - BO: 'xxxx-xxxx', - BS: 'xxx-xxxx', - BW: 'xx xxxx xxxx', - BZ: 'xxx-xxxx', - CA: 'xxx-xxx-xxxx', - CH: 'xxx xxx xxx', - CN: 'xxxx-xxxxxxx', - CO: 'xxxx-xxxxxxx', - CR: 'xxxx-xxxx', - CU: 'xxxx-xxxx', - CZ: 'xxx xxx xxx', - DK: 'xx xx xx xx', - DO: 'xxx-xxxxxxx', - DZ: 'xxxx-xxxx-xxx', - EG: 'xx xxx xxxx', - ET: 'xx xxx xxxx', - EU: 'xxx xx xx xx', - FJ: 'xxxx xxxx', - GB: 'xxxx xxx xxx', - GH: 'xxx xxx xxxx', - GI: 'xxxx xxxx', - GM: 'xxxx-xxxx', - GT: 'xxxx-xxxx', - GY: 'xxx-xxxx', - HK: 'xxxx xxxx', - HN: 'xxxx-xxxx', - HR: 'xxx xxx xxxx', - HT: 'xxx-xxxx', - HU: 'xxx xxx xxxx', - ID: 'xxxx-xxxx-xxxx', - IL: 'xxxx-xxx-xxx', - JM: 'xxx-xxxx', - KE: 'xxx xxxxxx', - KG: 'xxx-xx-xx-xx', - KH: 'xxx-xxx-xxx', - KY: 'xxx-xxxx', - KZ: 'xxx-xxx-xx-xx', - LA: 'xxx xx xxxx', - LK: 'xx xxx xxxx', - LR: 'xxx-xxx-xxxx', - LS: 'xxx xx xxxx', - LT: 'xxx xxxxx', - LU: 'xxx xx xxx', - LV: 'xxxx xxxx', - MA: 'xxxx-xxxxxx', - MD: 'xx xxxxxx', - ME: 'xx xxxxxx', - MG: 'xx xx xx xx xx', - MK: 'xx xx xx xx', - MM: 'xx xxxxxx', - MN: 'xxx-xx-xxxx', - MO: 'xxxx xxxx', - MU: 'xx xxxx xxxx', - MV: 'xxxxxx', - MW: 'xx xxxx xxxx', - MX: 'xxx-xxx-xxxx', - MZ: 'xx xxxxxxx', - NA: 'xx xxxx xxxx', - NG: 'xxx xxx xxxx', - NI: 'xxxx-xxxx', - NL: 'xxx-xxxxxxx', - NO: 'xxxx xxxx', - NP: 'xxxx-xxxxxxx', - NZ: 'xxx-xxxxxxx', - OM: 'xxxx-xxxx', - PA: 'xxx-xxxx', - PE: 'xxx-xxx-xxx', - PG: 'xxx-xxxxxx', - PH: 'xxx-xxxx', - PK: 'xxx-xxxxxxx', - PL: 'xxx xxx xxx', - PR: 'xxx-xxx-xxxx', - PS: 'xxxx-xxxxxxx', - PT: 'xxx xxx xxx', - PY: 'xxx-xxxxxx', - QA: 'xxxx xxxx', - RO: 'xxx xxx xxxx', - RS: 'xxx xxxxx', - RU: 'xxx xxx-xx-xx', - RW: 'xxx xxxxxx', - SA: 'xxx-xxxxxxx', - SC: 'xx xxxxx', - SE: 'xxx-xxx xx xx', - SG: 'xxxx xxxx', - SI: 'xx xxxxxx', - SK: 'xxx xxx xxx', - SL: 'xxx-xxxxxx', - SM: 'xxxxx xxxxx', - SN: 'xx xxx xx xx', - SO: 'xxx xxxxxxx', - SR: 'xxx-xxxx', - SS: 'xxx xxxx xxx', - SV: 'xxxx-xxxx', - SZ: 'xxx xx xxxx', - TG: 'xx xx xx xx', - TH: 'xxx-xxxxxxx', - TJ: 'xxx xx xx xx', - TL: 'xxx-xxxxxxx', - TN: 'xx xxxxxx', - TR: 'xxx xxx xx xx', - TT: 'xxx-xxxx', - TW: 'xxxx-xxxxxx', - TZ: 'xxx xxx xxxx', - UA: 'xx xxx xx xx', - UG: 'xxx xxxxxxx', - US: 'xxx-xxx-xxxx', - UY: 'xxx-xxxxx', - UZ: 'xxx-xxx-xx-xx', - VC: 'xxx-xxxx', - VE: 'xxxx-xxx-xxxx', - VN: 'xxxx-xxxxxxx', - YE: 'xxxx-xxxx', - ZA: 'xxx-xxx-xxxx', - ZM: 'xxx-xxxxxxx', - ZW: 'xx xxx xxxx', - KW: 'xxx xx xxxx', - BH: 'xxxx xxxx', - }; - - // Formats a provided phone number according to the predefined format for a specific country code, or auto-detects the country code and formats the number accordingly. - const formatPhoneNumber = (phoneNumber, countryCode) => { - // Throw errors if phoneNumber is invalid - if (!phoneNumber) - throw new Error('Parameter `phoneNumber` is invalid!'); - // Convert phoneNumber to string and clean it by removing non-numeric characters - phoneNumber = phoneNumber.toString(); - phoneNumber = cleanPhoneNumber(phoneNumber); - // Detect or validate the country code - countryCode = - countryCode && countryCode in PHONE_FORMATTER_MAPPER - ? countryCode - : detectCountryCodeFromDialCode(phoneNumber); - // Fetch the pattern for the countryCode from the PHONE_FORMATTER_MAPPER - const pattern = PHONE_FORMATTER_MAPPER[countryCode]; - if (!pattern) - return phoneNumber; - // Count the number of 'x' characters in the format pattern - let charCountInFormatterPattern = 0; - for (let i = 0; i < pattern.length; i++) { - if (pattern[i] === 'x') { - charCountInFormatterPattern++; - } - } - // Calculate the difference between phoneNumber length and 'x' characters count in pattern - const diff = phoneNumber.length - charCountInFormatterPattern; - // Extract the phoneNumber without the prefix - const phoneNumberWithoutPrefix = phoneNumber.slice(diff); - const formattedNumber = []; - let numberIndex = 0; - // Loop through the pattern to format the phoneNumber - for (let i = 0; i < pattern.length; i++) { - const patternChar = pattern[i]; - if (patternChar === 'x') { - // Insert phoneNumber digits at 'x' positions - if (numberIndex < phoneNumberWithoutPrefix.length) { - formattedNumber.push(phoneNumberWithoutPrefix[numberIndex]); - numberIndex++; - } - } - else { - // Insert non-digit characters from the pattern - formattedNumber.push(patternChar); - } - } - // Join the formattedNumber array to create the formattedPhoneNumber without prefix - const formattedPhoneNumberWithoutPrefix = formattedNumber.join(''); - // Combine the prefix and formattedPhoneNumberWithoutPrefix - const formattedPhoneNumberWithPrefix = phoneNumber.slice(0, diff) + ' ' + formattedPhoneNumberWithoutPrefix; - // Return the formattedPhoneNumber with prefix after trimming whitespace - return formattedPhoneNumberWithPrefix.trim(); - }; - var formatPhoneNumber$1 = withErrorBoundary(formatPhoneNumber); - - // Parses a given phone number, identifies its country code (if not provided), and returns an object with details including the country code, formatted phone number, dial code, and format template. - const parsePhoneNumber = (phoneNumber, country) => { - // Throw errors if phoneNumber is invalid - if (!phoneNumber) - throw new Error('Parameter `phoneNumber` is invalid!'); - // Clean the phoneNumber by removing non-numeric characters - phoneNumber = phoneNumber.toString(); - phoneNumber = cleanPhoneNumber(phoneNumber); - // Detect or validate the country code - const countryCode = country && country in PHONE_FORMATTER_MAPPER - ? country - : detectCountryCodeFromDialCode(phoneNumber); - // Format the phone number using the detected/validated country code - const formattedPhoneNumber = formatPhoneNumber$1(phoneNumber, countryCode); - // Fetch the pattern associated with the countryCode from the PHONE_FORMATTER_MAPPER - const pattern = PHONE_FORMATTER_MAPPER[countryCode]; - if (!pattern) - return { - countryCode: countryCode || '', - dialCode: '', - formattedPhoneNumber: phoneNumber, - formatTemplate: '', - }; - // Count the number of 'x' characters in the format pattern - let charCountInFormatterPattern = 0; - for (let i = 0; i < pattern.length; i++) { - if (pattern[i] === 'x') { - charCountInFormatterPattern++; - } - } - // Calculate the difference between phoneNumber length and 'x' characters count in pattern - const diff = phoneNumber.length - charCountInFormatterPattern; - // Extract the dialCode from the phoneNumber - const dialCode = phoneNumber.slice(0, diff); - // Obtain the format template associated with the countryCode - const formatTemplate = PHONE_FORMATTER_MAPPER[countryCode]; - // Return the parsed phone number information - return { - countryCode, - formattedPhoneNumber, - dialCode, - formatTemplate, - }; - }; - var parsePhoneNumber$1 = withErrorBoundary(parsePhoneNumber); - - const stringToDate = (dateString) => { - const supportedDateFormats = [ - // Date formats - { - regex: /^(\d{4})\/(\d{2})\/(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, - { - regex: /^(\d{2})\/(\d{2})\/(\d{4})$/, - yearIndex: 3, - monthIndex: 2, - dayIndex: 1, - }, - { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, - { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, - { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, - { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, - { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, - { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, - // Timestamp formats - { - regex: /^(\d{4})\/(\d{2})\/(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, - { - regex: /^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 3, - monthIndex: 2, - dayIndex: 1, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, - { - regex: /^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, - { - regex: /^(\d{2})-(\d{2})-(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 3, - monthIndex: 2, - dayIndex: 1, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, - { - regex: /^(\d{4})\.(\d{2})\.(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, - { - regex: /^(\d{2})\.(\d{2})\.(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 3, - monthIndex: 2, - dayIndex: 1, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, // DD.MM.YYYY HH:MM:SS - ]; - for (const format of supportedDateFormats) { - const match = dateString.match(format.regex); - if (match) { - const year = match[format.yearIndex]; - const month = match[format.monthIndex]; - const day = match[format.dayIndex]; - const hour = format.hourIndex ? match[format.hourIndex] : '00'; - const minute = format.minuteIndex ? match[format.minuteIndex] : '00'; - const second = format.secondIndex ? match[format.secondIndex] : '00'; - return new Date(`${year}-${month}-${day}T${hour}:${minute}:${second}`); - } - } - throw new Error('Date format not recognized'); - }; - - /** - * Adds a specified amount of time to a date. - * - * @param date The original date. - * @param value The amount to add. - * @param unit The unit of time to add (e.g., 'days', 'months', 'years'). - * @returns A new Date object with the time added. - */ - const add = (date, value, unit) => { - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - switch (unit) { - case 'days': - date.setDate(date.getDate() + value); - break; - case 'months': - date.setMonth(date.getMonth() + value); - break; - case 'years': - date.setFullYear(date.getFullYear() + value); - break; - } - return date; - }; - var add$1 = withErrorBoundary(add); - - /** - * Formats date and time based on the locale. - * @param {DateInput} date - Date object or date string. - * @param {Locale} locale - Locale string. - * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional). - * @returns {string} Formatted date and time string. - */ - const formatDateTime = (date, locale, intlOptions = {}) => { - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) - locale = state.getState().locale || getLocale(); - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - const dateObj = date instanceof Date ? date : new Date(date); - let formatter; - try { - formatter = new Intl.DateTimeFormat(locale, intlOptions); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - return formatter.format(dateObj); - }; - var formatDateTime$1 = withErrorBoundary(formatDateTime); - - /** - * Formats date based on the locale. - * @param {DateInput} date - Date object or date string. - * @param {Locale} locale - Locale string. - * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional). - * @returns {string} Formatted date string. - */ - const formatDate = (date, locale, options = {}) => { - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) - locale = state.getState().locale || getLocale(); - const fullOptions = Object.assign(Object.assign({}, options), { timeStyle: undefined }); - let formattedDate; - try { - formattedDate = formatDateTime$1(date, locale, fullOptions); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - return formattedDate; - }; - var formatDate$1 = withErrorBoundary(formatDate); - - /** - * Formats time based on the locale. - * @param {DateInput} date - Date object or date string. - * @param {Locale} locale - Locale string. - * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional). - * @returns {string} Formatted time string. - */ - const formatTime = (date, locale, options = {}) => { - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) - locale = state.getState().locale || getLocale(); - const fullOptions = Object.assign(Object.assign({}, options), { dateStyle: undefined }); - let formattedTime; - try { - formattedTime = formatDateTime$1(date, locale, fullOptions); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - return formattedTime; - }; - var formatTime$1 = withErrorBoundary(formatTime); - - /** - * Gets the first day of the week for a given locale. - * - * @param locale The locale to determine the first day of the week for. - * @param intlOptions Optional Intl.DateTimeFormatOptions for customization. - * @returns The first day of the week (0-6, where 0 is Sunday). - */ - const getFirstDayOfWeek = (locale, intlOptions = {}) => { - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) - locale = state.getState().locale || getLocale(); - let formatted; - if (!intlOptions.weekday) - intlOptions.weekday = 'long'; - try { - const formatter = new Intl.DateTimeFormat(locale, intlOptions); - /** - * This date was chosen because January 2, 2000, is a Sunday. - * In the Gregorian calendar, Sunday is considered the start of the week in some cultures (like in the United States), while in others, it's Monday (like in much of Europe). - * By using a date that is known to be a Sunday, the function can accurately determine what day of the week is considered the start in the specified locale. - */ - const sundayDate = new Date(2000, 0, 2); // A known Sunday - formatted = formatter.format(sundayDate); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - // Generate localized weekdays array starting from Sunday - const weekdays = Array.from({ length: 7 }, (_, i) => new Intl.DateTimeFormat(locale, intlOptions).format(new Date(2000, 0, 2 + i))); - const firstDayIndex = weekdays.indexOf(formatted); - if (firstDayIndex === -1) { - throw new Error('Unable to determine the first day of the week'); - } - return weekdays[(firstDayIndex + 1) % 7]; // Adjusting since our reference date is a Sunday - }; - var getFirstDayOfWeek$1 = withErrorBoundary(getFirstDayOfWeek); - - /** - * Determines the quarter of the year for a given date. - * - * @param date The date to determine the quarter for. - * @returns The quarter of the year (1-4). - */ - const getQuarter = (date) => { - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - return Math.ceil((date.getMonth() + 1) / 3); - }; - var getQuarter$1 = withErrorBoundary(getQuarter); - - /** - * Provides a relative time string (e.g., '3 hours ago', 'in 2 days'). - * This function calculates the difference between the given date and the base date, - * then formats it in a locale-sensitive manner. It allows customization of the output - * through Intl.RelativeTimeFormat options. - * - * @param date - The date to compare. - * @param baseDate - The date to compare against (default: current date). - * @param locale - The locale to use for formatting. - * @param options - Options for the Intl.RelativeTimeFormat (optional). - * @returns The relative time as a string. - */ - const getRelativeTime = (date, baseDate = new Date(), locale, options) => { - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - baseDate = - typeof baseDate === 'string' - ? new Date(stringToDate(baseDate)) - : new Date(baseDate); - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) - locale = state.getState().locale || getLocale(); - const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000; - // Define time units in seconds - const minute = 60; - const hour = minute * 60; - const day = hour * 24; - const week = day * 7; - const month = day * 30; - const year = day * 365; - let value; - let unit; - if (Math.abs(diffInSeconds) < minute) { - value = diffInSeconds; - unit = 'second'; - } - else if (Math.abs(diffInSeconds) < hour) { - value = diffInSeconds / minute; - unit = 'minute'; - } - else if (Math.abs(diffInSeconds) < day) { - value = diffInSeconds / hour; - unit = 'hour'; - } - else if (Math.abs(diffInSeconds) < week) { - value = diffInSeconds / day; - unit = 'day'; - } - else if (Math.abs(diffInSeconds) < month) { - value = diffInSeconds / week; - unit = 'week'; - } - else if (Math.abs(diffInSeconds) < year) { - value = diffInSeconds / month; - unit = 'month'; - } - else { - value = diffInSeconds / year; - unit = 'year'; - } - let relativeTime; - try { - const rtf = new Intl.RelativeTimeFormat(locale, options); - relativeTime = rtf.format(Math.round(value), unit); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - return relativeTime; - }; - var getRelativeTime$1 = withErrorBoundary(getRelativeTime); - - /** - * Calculates the week number of the year for a given date. - * - * @param date The date to calculate the week number for. - * @returns The week number of the year. - */ - const getWeek = (date) => { - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - const firstDayOfYear = new Date(date.getFullYear(), 0, 1); - const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000; - return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7); - }; - var getWeek$1 = withErrorBoundary(getWeek); - - /** - * Returns an array of weekdays according to the specified locale. - * - * @param locale The locale to get weekdays for. - * @param intlOptions Optional Intl.DateTimeFormatOptions for customization. - * @returns An array of weekday names. - */ - const getWeekdays = (locale, intlOptions = {}) => { - try { - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) - locale = state.getState().locale || getLocale(); - if (!intlOptions.weekday) - intlOptions.weekday = 'long'; - const formatter = new Intl.DateTimeFormat(locale, intlOptions); - /** The date January 1, 1970, is a well-known reference point in computing known as the Unix epoch. - * It's the date at which time is measured for Unix systems, making it a consistent and reliable choice for date calculations. - * The choice of the date January 4, 1970, as the starting point is significant. - * January 4, 1970, was a Sunday. - * Since weeks typically start on Sunday or Monday in most locales, starting from a known Sunday allows the function to cycle through a complete week, capturing all weekdays in the order they appear for the given locale. - * */ - return Array.from({ length: 7 }, (_, i) => formatter.format(new Date(1970, 0, 4 + i))); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - }; - var getWeekdays$1 = withErrorBoundary(getWeekdays); - - /** - * Compares two dates to determine if the first is after the second. - * @param {DateInput} date1 - First date object or date string. - * @param {DateInput} date2 - Second date object or date string. - * @returns {boolean} True if date1 is after date2. - */ - const isAfter = (date1, date2) => { - date1 = - typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1); - date2 = - typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2); - const dateObj1 = date1 instanceof Date ? date1 : new Date(date1); - const dateObj2 = date2 instanceof Date ? date2 : new Date(date2); - return dateObj1 > dateObj2; - }; - var isAfter$1 = withErrorBoundary(isAfter); - - /** - * Compares two dates to determine if the first is before the second. - * @param {DateInput} date1 - First date object or date string. - * @param {DateInput} date2 - Second date object or date string. - * @returns {boolean} True if date1 is before date2. - */ - const isBefore = (date1, date2) => { - date1 = - typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1); - date2 = - typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2); - const dateObj1 = date1 instanceof Date ? date1 : new Date(date1); - const dateObj2 = date2 instanceof Date ? date2 : new Date(date2); - return dateObj1 < dateObj2; - }; - var isBefore$1 = withErrorBoundary(isBefore); - - /** - * Checks if a given year is a leap year. - * - * @param year The year to check. - * @returns True if the year is a leap year, false otherwise. - */ - const isLeapYear = (year) => { - return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; - }; - var isLeapYear$1 = withErrorBoundary(isLeapYear); - - /** - * Checks if two dates fall on the same day. - * - * @param date1 The first date. - * @param date2 The second date. - * @returns True if both dates are on the same day, false otherwise. - */ - const isSameDay = (date1, date2) => { - date1 = - typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1); - date2 = - typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2); - return (date1.getDate() === date2.getDate() && - date1.getMonth() === date2.getMonth() && - date1.getFullYear() === date2.getFullYear()); - }; - var isSameDay$1 = withErrorBoundary(isSameDay); - - /** - * Checks if a given object is a valid Date object. - * - * @param date The object to check. - * @returns True if the object is a valid Date, false otherwise. - */ - const isValidDate = (date) => { - try { - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - } - catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } - else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - return date instanceof Date && !isNaN(date.getTime()); - }; - var isValidDate$1 = withErrorBoundary(isValidDate); - - const LOCALE_DATE_FORMATS = { - 'ar-AE': 'DD/MM/YYYY', - 'sq-AL': 'DD.MM.YYYY', - 'hy-AM': 'DD.MM.YYYY', - 'es-AR': 'DD/MM/YYYY', - 'en-AU': 'DD/MM/YYYY', - 'nl-AW': 'DD-MM-YYYY', - 'en-BB': 'MM/DD/YYYY', - 'bn-BD': 'DD/MM/YYYY', - 'en-BM': 'MM/DD/YYYY', - 'ms-BN': 'DD/MM/YYYY', - 'es-BO': 'DD/MM/YYYY', - 'en-BS': 'MM/DD/YYYY', - 'en-BW': 'DD/MM/YYYY', - 'en-BZ': 'MM/DD/YYYY', - 'en-CA': 'DD/MM/YYYY', - 'de-CH': 'DD.MM.YYYY', - 'zh-CN': 'YYYY/MM/DD', - 'es-CO': 'DD/MM/YYYY', - 'es-CR': 'DD/MM/YYYY', - 'es-CU': 'DD/MM/YYYY', - 'cs-CZ': 'DD.MM.YYYY', - 'da-DK': 'DD-MM-YYYY', - 'es-DO': 'DD/MM/YYYY', - 'ar-DZ': 'DD/MM/YYYY', - 'ar-EG': 'DD/MM/YYYY', - 'am-ET': 'DD/MM/YYYY', - 'en-EU': 'DD/MM/YYYY', - 'en-FJ': 'DD/MM/YYYY', - 'en-GB': 'DD/MM/YYYY', - 'en-GH': 'DD/MM/YYYY', - 'en-GI': 'DD/MM/YYYY', - 'en-GM': 'DD/MM/YYYY', - 'es-GT': 'DD/MM/YYYY', - 'en-GY': 'DD/MM/YYYY', - 'en-HK': 'DD/MM/YYYY', - 'es-HN': 'DD/MM/YYYY', - 'hr-HR': 'DD.MM.YYYY', - 'ht-HT': 'MM/DD/YYYY', - 'hu-HU': 'YYYY. MM. DD.', - 'id-ID': 'DD/MM/YYYY', - 'he-IL': 'DD/MM/YYYY', - 'en-IN': 'DD-MM-YYYY', - 'en-JM': 'MM/DD/YYYY', - 'en-KE': 'DD/MM/YYYY', - 'ky-KG': 'DD.MM.YYYY', - 'km-KH': 'DD/MM/YYYY', - 'en-KY': 'MM/DD/YYYY', - 'kk-KZ': 'DD.MM.YYYY', - 'lo-LA': 'DD/MM/YYYY', - 'si-LK': 'YYYY-MM-DD', - 'en-LR': 'MM/DD/YYYY', - 'en-LS': 'DD/MM/YYYY', - 'ar-MA': 'DD/MM/YYYY', - 'ro-MD': 'DD.MM.YYYY', - 'mk-MK': 'DD.MM.YYYY', - 'my-MM': 'DD/MM/YYYY', - 'mn-MN': 'YYYY.MM.DD', - 'zh-MO': 'DD/MM/YYYY', - 'en-MU': 'DD/MM/YYYY', - 'dv-MV': 'DD/MM/YYYY', - 'en-MW': 'DD/MM/YYYY', - 'es-MX': 'DD/MM/YYYY', - 'ms-MY': 'DD/MM/YYYY', - 'en-NA': 'DD/MM/YYYY', - 'en-NG': 'DD/MM/YYYY', - 'es-NI': 'DD/MM/YYYY', - 'no-NO': 'DD.MM.YYYY', - 'ne-NP': 'YYYY/MM/DD', - 'en-NZ': 'DD/MM/YYYY', - 'es-PE': 'DD/MM/YYYY', - 'en-PG': 'DD/MM/YYYY', - 'en-PH': 'MM/DD/YYYY', - 'en-PK': 'DD/MM/YYYY', - 'ar-QA': 'DD/MM/YYYY', - 'ru-RU': 'DD.MM.YYYY', - 'ar-SA': 'DD/MM/YYYY', - 'en-SC': 'DD/MM/YYYY', - 'sv-SE': 'YYYY-MM-DD', - 'en-SG': 'DD/MM/YYYY', - 'en-SL': 'DD/MM/YYYY', - 'so-SO': 'DD/MM/YYYY', - 'en-SS': 'DD/MM/YYYY', - 'es-SV': 'DD/MM/YYYY', - 'en-SZ': 'DD/MM/YYYY', - 'th-TH': 'DD/MM/YYYY', - 'en-TT': 'MM/DD/YYYY', - 'sw-TZ': 'DD/MM/YYYY', - 'en-US': 'MM/DD/YYYY', - 'es-UY': 'DD/MM/YYYY', - 'uz-UZ': 'DD/MM/YYYY', - 'ar-YE': 'DD/MM/YYYY', - 'en-ZA': 'YYYY/MM/DD', - 'ar-KW': 'DD/MM/YYYY', - 'ar-BH': 'DD/MM/YYYY', - 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman) - }; - - /** - * Parses a date string based on a specific format. - * - * @param dateString The date string to parse. - * @param format The format to use for parsing. - * @returns The parsed Date object or null if parsing fails. - */ - const parseDateWithFormat = (dateString, format) => { - // Determine the separator based on the format (supports '/', '.', or '-') - const separator = format.includes('/') - ? '/' - : format.includes('.') - ? '.' - : '-'; - const formatParts = format.split(separator); - const dateParts = dateString.split(separator).map((num) => parseInt(num, 10)); - let year = 0, month = 0, day = 0; - let yearSet = false, monthSet = false, daySet = false; - // Check for format and date string mismatch - if (dateParts.length !== formatParts.length) { - return null; // Mismatch between date string and format - } - formatParts.forEach((part, index) => { - // Check for non-numeric values in date string - if (isNaN(dateParts[index])) { - return null; // Invalid date part - } - // Assign year, month, and day based on the format - switch (part) { - case 'DD': - day = dateParts[index]; - daySet = true; - break; - case 'MM': - month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date - monthSet = true; - break; - case 'YYYY': - year = dateParts[index]; - yearSet = true; - break; - } - }); - // Validate and create the date only if all parts are set - if (yearSet && monthSet && daySet) { - const parsedDate = new Date(year, month, day); - // Validate date to catch invalid dates like February 30th - if (parsedDate.getFullYear() === year && - parsedDate.getMonth() === month && - parsedDate.getDate() === day) { - return parsedDate; - } - } - return null; // Invalid date or incomplete date information - }; - var parseDateWithFormat$1 = withErrorBoundary(parseDateWithFormat); - - /** - * Attempts to parse a string into a date object based on locale. - * Uses the localeDateFormats mapping for determining the date format. - * - * @param dateString - The date string to parse. - * @param locale - The locale to use for parsing. - * @returns The parsed Date object or null if parsing fails. - */ - const parseDate = (dateString, locale) => { - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) - locale = state.getState().locale || getLocale(); - const format = LOCALE_DATE_FORMATS[locale]; - if (!format) { - throw new Error(`No date format found for locale: ${locale}`); - } - return parseDateWithFormat$1(dateString, format); - }; - var parseDate$1 = withErrorBoundary(parseDate); - - /** - * Subtracts a specified amount of time from a date. - * - * @param date The original date. - * @param value The amount to subtract. - * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years'). - * @returns A new Date object with the time subtracted. - */ - const subtract = (date, value, unit) => { - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - return add$1(date, -value, unit); // Reuse the add function with negative value - }; - var subtract$1 = withErrorBoundary(subtract); - - exports.add = add$1; - exports.formatDate = formatDate$1; - exports.formatDateTime = formatDateTime$1; - exports.formatNumber = formatNumber$1; - exports.formatNumberByParts = formatNumberByParts$1; - exports.formatPhoneNumber = formatPhoneNumber$1; - exports.formatTime = formatTime$1; - exports.getCurrencyList = getCurrencyList$1; - exports.getCurrencySymbol = getCurrencySymbol$1; - exports.getFirstDayOfWeek = getFirstDayOfWeek$1; - exports.getQuarter = getQuarter$1; - exports.getRelativeTime = getRelativeTime$1; - exports.getState = getState$1; - exports.getWeek = getWeek$1; - exports.getWeekdays = getWeekdays$1; - exports.isAfter = isAfter$1; - exports.isBefore = isBefore$1; - exports.isLeapYear = isLeapYear$1; - exports.isSameDay = isSameDay$1; - exports.isValidDate = isValidDate$1; - exports.isValidPhoneNumber = isValidPhoneNumber$1; - exports.parseDate = parseDate$1; - exports.parsePhoneNumber = parsePhoneNumber$1; - exports.resetState = resetState$1; - exports.setState = setState$1; - exports.subtract = subtract$1; - -})); -//# sourceMappingURL=index.js.map diff --git a/lib/umd/index.js.map b/lib/umd/index.js.map deleted file mode 100644 index 4f859ab6..00000000 --- a/lib/umd/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sources":["../../src/common/errorBoundary/index.ts","../../src/modules/.internal/utils/getDefaultState.ts","../../src/modules/.internal/state/index.ts","../../src/modules/core/getState.ts","../../src/modules/core/setState.ts","../../src/modules/core/resetState.ts","../../src/modules/.internal/utils/getLocale.ts","../../src/modules/.internal/utils/getIntlInstanceWithOptions.ts","../../src/modules/currency/formatNumber.ts","../../src/modules/currency/data/currencies.ts","../../src/modules/currency/getCurrencyList.ts","../../src/modules/currency/getCurrencySymbol.ts","../../src/modules/currency/constants.ts","../../src/modules/currency/formatNumberByParts.ts","../../src/modules/phoneNumber/data/phoneRegexMapper.ts","../../src/modules/phoneNumber/data/dialCodeMapper.ts","../../src/modules/phoneNumber/utils.ts","../../src/modules/phoneNumber/isValidPhoneNumber.ts","../../src/modules/phoneNumber/data/phoneFormatterMapper.ts","../../src/modules/phoneNumber/formatPhoneNumber.ts","../../src/modules/phoneNumber/parsePhoneNumber.ts","../../src/modules/dateTime/utils.ts","../../src/modules/dateTime/add.ts","../../src/modules/dateTime/formatDateTime.ts","../../src/modules/dateTime/formatDate.ts","../../src/modules/dateTime/formatTime.ts","../../src/modules/dateTime/getFirstDayOfWeek.ts","../../src/modules/dateTime/getQuarter.ts","../../src/modules/dateTime/getRelativeTime.ts","../../src/modules/dateTime/getWeek.ts","../../src/modules/dateTime/getWeekdays.ts","../../src/modules/dateTime/isAfter.ts","../../src/modules/dateTime/isBefore.ts","../../src/modules/dateTime/isLeapYear.ts","../../src/modules/dateTime/isSameDay.ts","../../src/modules/dateTime/isValidDate.ts","../../src/modules/dateTime/data/localeDateFormats.ts","../../src/modules/dateTime/parseDateWithFormat.ts","../../src/modules/dateTime/parseDate.ts","../../src/modules/dateTime/subtract.ts"],"sourcesContent":["// Custom Error class to extend properties to error object\nexport class I18nifyError extends Error {\n timestamp: Date;\n constructor(message: string | undefined) {\n super(message);\n this.name = 'i18nify Error';\n this.timestamp = new Date();\n // more params like type of error/severity can be added in future for better debugging.\n }\n}\n\n/**\n * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block.\n * It appends additional attributes and serves as a centralized error-handling service.\n * Usage =>\n * const wrappedUtilityFn = withErrorBoundary(utilityFn)\n *\n * @param fn utility that is wrapped in error boundary\n * @returns {Function} returns the function wrapped in try/catch block\n */\nexport const withErrorBoundary = any>(\n fn: T,\n): ((...args: Parameters) => ReturnType) => {\n return function (this: unknown, ...rest: Parameters): ReturnType {\n try {\n return fn.call(this, ...rest) as ReturnType;\n } catch (err) {\n console.warn('[I18N Error]: ', err);\n // Currently, we are throwing the error as it is to consumers.\n // In the future, this can be modified as per our requirement, like an error logging service.\n throw new I18nifyError(err as string | undefined);\n }\n };\n};\n","import type { I18nState } from '../state/types';\n\nexport function getDefaultState(): I18nState {\n return {\n locale: '',\n direction: '',\n country: '',\n };\n}\n","import { I18nState } from './types';\nimport { getDefaultState } from '../utils/getDefaultState';\n\nexport class I18nStateManager {\n private static instance: I18nStateManager | undefined;\n private state: I18nState;\n\n private constructor() {\n this.state = getDefaultState();\n }\n\n public static getInstance(): I18nStateManager {\n if (!I18nStateManager.instance) {\n I18nStateManager.instance = new I18nStateManager();\n }\n\n return I18nStateManager.instance;\n }\n\n public static resetInstance(): void {\n I18nStateManager.instance = undefined;\n }\n\n public getState(): I18nState {\n return { ...this.state };\n }\n\n public setState(newState: Partial): void {\n this.state = { ...this.state, ...newState };\n }\n\n public resetState(): void {\n this.state = getDefaultState();\n }\n}\n\nexport default I18nStateManager.getInstance();\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * function to return active i18n state\n *\n * ===== USAGE =====\n * import { getState } from '@razorpay/i18nify-js';\n *\n * console.log(getState())\n *\n * @returns i18n state\n */\nconst getState = (): I18nState => {\n return state.getState();\n};\n\nexport default withErrorBoundary(getState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * Function to set and override the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { setState } from \"@razorpay/i18nify-js\";\n * setState({locale: 'en-US'})\n *\n * @param newState data to set in i18nState instance\n */\nconst setState = (newState: Partial): void => {\n state.setState(newState);\n};\n\nexport default withErrorBoundary(setState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\n\n/**\n * Function to reset the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { resetState } from \"@razorpay/i18nify-js\";\n * resetState()\n *\n * @param newState data to set in i18nState instance\n */\nconst resetState = (): void => {\n state.resetState();\n};\n\nexport default withErrorBoundary(resetState);\n","export const getLocale = (): string => {\n // Check if running in a non-browser environment (e.g., Node.js or older browsers).\n if (typeof navigator === 'undefined') {\n return 'en-IN';\n }\n\n // Check if the browser supports the Intl object and user language preferences.\n if (\n window.Intl &&\n typeof window.Intl === 'object' &&\n (window.navigator.languages || window.navigator.language)\n ) {\n const userLocales = window.navigator.languages || [\n window.navigator.language,\n ];\n return userLocales[0];\n }\n\n // Fallback to a supported locale or the default locale.\n return 'en-IN';\n};\n","import { CURRENCIES } from '../../currency/data/currencies';\nimport state from '../state';\nimport { getLocale } from './getLocale';\n\nexport const getIntlInstanceWithOptions = (\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n) => {\n /** retrieve locale from below areas in order of preference\n * 1. options.locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n let locale = options?.locale || state.getState().locale;\n\n // If a specific locale is provided, use it; otherwise, use the browser's locale\n if (!locale) {\n locale = getLocale();\n }\n\n const intlOptions = options?.intlOptions ? { ...options.intlOptions } : {};\n\n if (options?.currency || intlOptions.currency) {\n intlOptions.style = 'currency';\n intlOptions.currency = (options.currency || intlOptions.currency) as string;\n }\n\n if (!locale) throw new Error('Pass valid locale !');\n\n return new Intl.NumberFormat(locale || undefined, intlOptions);\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\n\n// this function formats number based on different arguments passed\nconst formatNumber = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): string => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n let formattedAmount = '';\n\n try {\n formattedAmount = getIntlInstanceWithOptions(options).format(\n Number(amount),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedAmount;\n};\n\nexport default withErrorBoundary(formatNumber);\n","export const CURRENCIES: { [key: string]: { symbol: string; name: string } } = {\n AED: { symbol: 'د.إ', name: 'United Arab Emirates Dirham' },\n ALL: { symbol: 'Lek', name: 'Albanian Lek' },\n AMD: { symbol: '֏', name: 'Armenian Dram' },\n ARS: { symbol: 'ARS', name: 'Argentine Peso' },\n AUD: { symbol: 'A$', name: 'Australian Dollar' },\n AWG: { symbol: 'Afl.', name: 'Aruban Florin' },\n BBD: { symbol: '$', name: 'Barbadian Dollar' },\n BDT: { symbol: '৳', name: 'Bangladeshi Taka' },\n BMD: { symbol: '$', name: 'Bermudian Dollar' },\n BND: { symbol: 'BND', name: 'Brunei Dollar' },\n BOB: { symbol: 'Bs', name: 'Bolivian Boliviano' },\n BSD: { symbol: 'B$', name: 'Bahamian Dollar' },\n BWP: { symbol: 'P', name: 'Botswanan Pula' },\n BZD: { symbol: 'BZ$', name: 'Belize Dollar' },\n CAD: { symbol: 'C$', name: 'Canadian Dollar' },\n CHF: { symbol: 'CHf', name: 'Swiss Franc' },\n CNY: { symbol: '¥', name: 'Chinese Yuan' },\n COP: { symbol: 'COL$', name: 'Colombian Peso' },\n CRC: { symbol: '₡', name: 'Costa Rican Colón' },\n CUP: { symbol: '$MN', name: 'Cuban Peso' },\n CZK: { symbol: 'Kč', name: 'Czech Koruna' },\n DKK: { symbol: 'DKK', name: 'Danish Krone' },\n DOP: { symbol: 'RD$', name: 'Dominican Peso' },\n DZD: { symbol: 'د.ج', name: 'Algerian Dinar' },\n EGP: { symbol: 'E£', name: 'Egyptian Pound' },\n ETB: { symbol: 'ብር', name: 'Ethiopian Birr' },\n EUR: { symbol: '€', name: 'Euro' },\n FJD: { symbol: 'FJ$', name: 'Fijian Dollar' },\n GBP: { symbol: '£', name: 'British Pound' },\n GHS: { symbol: 'GH₵', name: 'Ghanaian Cedi' },\n GIP: { symbol: 'GIP', name: 'Gibraltar Pound' },\n GMD: { symbol: 'D', name: 'Gambian Dalasi' },\n GTQ: { symbol: 'Q', name: 'Guatemalan Quetzal' },\n GYD: { symbol: 'G$', name: 'Guyanese Dollar' },\n HKD: { symbol: 'HK$', name: 'Hong Kong Dollar' },\n HNL: { symbol: 'HNL', name: 'Honduran Lempira' },\n HRK: { symbol: 'kn', name: 'Croatian Kuna' },\n HTG: { symbol: 'G', name: 'Haitian Gourde' },\n HUF: { symbol: 'Ft', name: 'Hungarian Forint' },\n IDR: { symbol: 'Rp', name: 'Indonesian Rupiah' },\n ILS: { symbol: '₪', name: 'Israeli New Shekel' },\n INR: { symbol: '₹', name: 'Indian Rupee' },\n JMD: { symbol: 'J$', name: 'Jamaican Dollar' },\n KES: { symbol: 'Ksh', name: 'Kenyan Shilling' },\n KGS: { symbol: 'Лв', name: 'Kyrgystani Som' },\n KHR: { symbol: '៛', name: 'Cambodian Riel' },\n KYD: { symbol: 'CI$', name: 'Cayman Islands Dollar' },\n KZT: { symbol: '₸', name: 'Kazakhstani Tenge' },\n LAK: { symbol: '₭', name: 'Laotian Kip' },\n LKR: { symbol: 'රු', name: 'Sri Lankan Rupee' },\n LRD: { symbol: 'L$', name: 'Liberian Dollar' },\n LSL: { symbol: 'LSL', name: 'Lesotho Loti' },\n MAD: { symbol: 'د.م.', name: 'Moroccan Dirham' },\n MDL: { symbol: 'MDL', name: 'Moldovan Leu' },\n MKD: { symbol: 'ден', name: 'Macedonian Denar' },\n MMK: { symbol: 'MMK', name: 'Myanmar Kyat' },\n MNT: { symbol: '₮', name: 'Mongolian Tugrik' },\n MOP: { symbol: 'MOP$', name: 'Macanese Pataca' },\n MUR: { symbol: '₨', name: 'Mauritian Rupee' },\n MVR: { symbol: 'Rf', name: 'Maldivian Rufiyaa' },\n MWK: { symbol: 'MK', name: 'Malawian Kwacha' },\n MXN: { symbol: 'Mex$', name: 'Mexican Peso' },\n MYR: { symbol: 'RM', name: 'Malaysian Ringgit' },\n NAD: { symbol: 'N$', name: 'Namibian Dollar' },\n NGN: { symbol: '₦', name: 'Nigerian Naira' },\n NIO: { symbol: 'NIO', name: 'Nicaraguan Córdoba' },\n NOK: { symbol: 'NOK', name: 'Norwegian Krone' },\n NPR: { symbol: 'रू', name: 'Nepalese Rupee' },\n NZD: { symbol: 'NZ$', name: 'New Zealand Dollar' },\n PEN: { symbol: 'S/', name: 'Peruvian Nuevo Sol' },\n PGK: { symbol: 'PGK', name: 'Papua New Guinean Kina' },\n PHP: { symbol: '₱', name: 'Philippine Peso' },\n PKR: { symbol: '₨', name: 'Pakistani Rupee' },\n QAR: { symbol: 'QR', name: 'Qatari Riyal' },\n RUB: { symbol: '₽', name: 'Russian Ruble' },\n SAR: { symbol: 'SR', name: 'Saudi Riyal' },\n SCR: { symbol: 'SRe', name: 'Seychellois Rupee' },\n SEK: { symbol: 'SEK', name: 'Swedish Krona' },\n SGD: { symbol: 'S$', name: 'Singapore Dollar' },\n SLL: { symbol: 'Le', name: 'Sierra Leonean Leone' },\n SOS: { symbol: 'Sh.so.', name: 'Somali Shilling' },\n SSP: { symbol: 'SS£', name: 'South Sudanese Pound' },\n SVC: { symbol: '₡', name: 'Salvadoran Colón' },\n SZL: { symbol: 'E', name: 'Swazi Lilangeni' },\n THB: { symbol: '฿', name: 'Thai Baht' },\n TTD: { symbol: 'TT$', name: 'Trinidad and Tobago Dollar' },\n TZS: { symbol: 'Sh', name: 'Tanzanian Shilling' },\n USD: { symbol: '$', name: 'United States Dollar' },\n UYU: { symbol: '$U', name: 'Uruguayan Peso' },\n UZS: { symbol: \"so'm\", name: 'Uzbekistani Som' },\n YER: { symbol: '﷼', name: 'Yemeni Rial' },\n ZAR: { symbol: 'R', name: 'South African Rand' },\n KWD: { symbol: 'د.ك', name: 'Kuwaiti Dinar' },\n BHD: { symbol: 'د.ب.', name: 'Bahraini Dinar' },\n OMR: { symbol: 'ر.ع.', name: 'Omani Rial' },\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencyList = () => {\n return CURRENCIES;\n};\n\nexport default withErrorBoundary(getCurrencyList);\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencySymbol = (currencyCode: keyof typeof CURRENCIES): string => {\n if (currencyCode in CURRENCIES) return CURRENCIES[currencyCode]?.symbol;\n else throw new Error('Invalid currencyCode!');\n};\n\nexport default withErrorBoundary(getCurrencySymbol);\n","export const ALLOWED_FORMAT_PARTS_KEYS = [\n 'nan',\n 'infinity',\n 'percent',\n 'integer',\n 'group',\n 'decimal',\n 'fraction',\n 'plusSign',\n 'minusSign',\n 'percentSign',\n 'currency',\n 'code',\n 'symbol',\n 'name',\n 'compact',\n 'exponentInteger',\n 'exponentMinusSign',\n 'exponentSeparator',\n 'unit',\n] as const;\n","import { CURRENCIES } from './data/currencies';\nimport { ByParts, FormattedPartsObject } from './types';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\nimport { ALLOWED_FORMAT_PARTS_KEYS } from './constants';\n\nconst formatNumberByParts = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): ByParts => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n try {\n const formattedAmount = getIntlInstanceWithOptions(options).formatToParts(\n Number(amount),\n );\n\n const parts = formattedAmount;\n\n const formattedObj: FormattedPartsObject = {};\n\n parts.forEach((p) => {\n if (p.type === 'group') {\n formattedObj.integer = (formattedObj.integer || '') + p.value;\n } else if (\n ALLOWED_FORMAT_PARTS_KEYS.findIndex((item) => item === p.type) != -1\n ) {\n // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal' is skipped\n formattedObj[p.type] = (formattedObj[p.type] || '') + p.value;\n }\n });\n\n return {\n ...formattedObj,\n isPrefixSymbol: parts[0].type === 'currency',\n rawParts: parts,\n };\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(\n formatNumberByParts,\n);\n","export const PHONE_REGEX_MAPPER: { [key: string]: RegExp } = {\n IN: /^(?:(?:\\+|0{0,2})91\\s*[-]?\\s*|[0]?)?[6789]\\d{9}$/,\n MY: /^(\\+?6?0)?(\\d{1,3})[-. ]?(\\d{7,8})$/,\n AE: /^(?:\\+?971|0)?(?:2|3|4|6|7|9)\\d{8}$/,\n AL: /^(?:\\+?355)?(?:[4-9]\\d{7}|6\\d{8})$/,\n AM: /^(?:\\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/,\n AR: /^(?:(?:\\+|0{0,2})54)?(?:11|[2368]\\d)(?:(?=\\d{0,2}15)\\d{2})??\\d{8}$/,\n AU: /^(?:\\+?61|0)4\\d{8}$/,\n AW: /^(?:(?:\\+297)?(?!0)\\d{7})$/,\n BB: /^(?:(?:\\+1)?246)?(?:\\d{3})?\\d{7}$/,\n BD: /^(?:\\+?880|0)1[13456789]\\d{8}$/,\n BM: /^(?:(?:\\+1)?441)?(?:\\d{2})?\\d{7}$/,\n BN: /^(?:\\+?673)?(?:\\d{3})?\\d{4}$/,\n BO: /^(?:(?:\\+|0{0,2})591)?(?:(?:2|3|7|6)\\d{7})$/,\n BS: /^(?:(?:\\+1)?242)?(?:\\d{3})?\\d{7}$/,\n BW: /^(?:(?:\\+267)?\\s?)?[74]\\d{7}$/,\n BZ: /^(?:(?:\\+501)?\\s?)?[622]\\d{4}$/,\n CH: /^(?:(?:\\+41|0)(?:\\s*\\(?0\\)?\\s*))?(?:\\d{2}\\s*)?\\d{3}\\s*\\d{2}\\s*\\d{2}$/,\n CN: /^(?:(?:\\+|00)86)?1\\d{10}$/,\n CO: /^(?:(?:\\+57|0057)?)?[1-8]{1}\\d{6,7}$/,\n OM: /^(?:\\+?968)?(?:95|96|97|98)\\d{6}$/,\n CR: /^(?:(?:\\+506)?\\s*|0)?[1-9]\\d{7}$/,\n CU: /^(?:\\+?53)?(?:[5-8]\\d{7})$/,\n CZ: /^(?:\\+?420)?(?:\\d{9})$/,\n DK: /^(?:\\+?45)?(?:\\d{8})$/,\n DO: /^(?:(?:\\+1)?809|1-8(?:00|88|89))(?:\\d{7})$/,\n DZ: /^(?:\\+?213|0)([567]\\d{8})$/,\n EG: /^(?:(?:\\+20|20)?(\\d{10}))$/,\n ET: /^(?:\\+?251)?[1-59]\\d{8}$/,\n EU: /^(?:(?:\\+?3)?8)?\\s*(?:\\d{3}\\s*){3}\\d{2}$/,\n FJ: /^(?:(?:\\+?679)?\\s?\\d{3}\\s?\\d{4})?$/,\n GB: /^(?:(?:\\+44\\s?|0)7\\d{3}(\\s?\\d{4,})?)$/,\n GH: /^(?:(?:\\+233)|0)?(?:\\d{9})$/,\n GI: /^(?:\\+350)?\\d{5}$/,\n GM: /^(?:\\+220)?\\d{5,7}$/,\n GT: /^(?:\\+502)?[2468]\\d{7,8}$/,\n GY: /^(?:(?:\\+592)?(?:(?:\\s)?[2-9])(?:(?:\\s)?\\d))?(?:(?:\\s)?\\d{4})$/,\n HK: /^(?:\\+852\\s?)?[456789]\\d{3}\\s?\\d{4}$/,\n HN: /^(?:\\+504)?[89]\\d{7}$/,\n HR: /^(?:\\+?385)?\\d{8,9}$/,\n HT: /^(?:\\+?509)?\\d{8}$/,\n HU: /^(?:(?:\\+36))(\\s?\\d{2}\\s?\\d{3}\\s?\\d{4})$/,\n ID: /^(?:\\+?62|0[1-9])[\\s-]?\\d{2,4}[\\s-]?\\d{3,4}[\\s-]?\\d{3,4}$/,\n IL: /^(?:(?:\\+972|0)(?:-)?)[23489]\\d{7}$/,\n JM: /^(?:(?:\\+1876))\\d{7,10}$/,\n KE: /^(?:(?:\\+254)|(?:0))(?:\\d{6,7})$/,\n KG: /^(?:\\+996)?\\s?\\d{9}$/,\n KH: /^(?:(?:\\+855)|(?:0))(?:\\s?[1-9]\\d{7,8})$/,\n KY: /^(?:\\+?1\\s?(345))\\d{6}$/,\n KZ: /^(?:\\+?7|8)?7\\d{9}$/,\n LA: /^(?:(?:\\+?856)|0)(20\\d{7,9})$/,\n LK: /^(?:(?:\\+94)|0)(?:\\d{9})$/,\n LR: /^(?:\\+231)[ -\\d]{4}[ -\\d]{4}$/,\n LS: /^(?:(?:\\+?266)|0)?[56]\\d{7}$/,\n MA: /^(?:(?:\\+?212(\\s*[-|\\s*]?\\d{1,9})?)|(?:0))(?:\\d{9})$/,\n MD: /^(?:(?:\\+373)|(?:0))(?:\\d{7,8})$/,\n MK: /^(?:\\+389|0)(?:(?:2[0-4]|[3-9])\\s?)?\\d{6}$/,\n MM: /^(?:(?:\\+?95)|0)?[1-9]\\d{9}$/,\n MN: /^(?:\\+976|0)\\d{8}$/,\n MO: /^(?:(?:\\+?853)|[0-9])?\\d{8}$/,\n MU: /^(?:\\+230|0)?\\d{8}$/,\n MV: /^(?:(?:\\+?960)|0)?\\d{7}$/,\n MW: /^(?:\\+265)[1-9]\\d{6}$/,\n MX: /^(?:(?:\\+?52)?\\s?(?:1|01)?\\s?)?(?:\\d{3}\\s?\\d{3}\\s?\\d{4})$/,\n NA: /^(?:(?:\\+264)|0)?\\d{8}$/,\n NG: /^(?:(?:\\+234)|(?:0))(?:\\d{7,8})$/,\n NI: /^(?:(?:\\+505))?(?:\\d{8})$/,\n NO: /^(?:(?:\\+?47)|\\d{2}|\\d{3})\\s?\\d{2}\\s?\\d{3}$/,\n NP: /^(?:(?:\\+977))?(\\d{9,10})$/,\n NZ: /^(?:\\+?64|0)(\\d{2,5} \\d{4,8}|\\d{3,4} \\d{4})$/,\n PE: /^(?:(?:\\+51)|0)?(?:9\\d{8})$/,\n PG: /^(?:\\+?675)?(?:[7-9]\\d{7})$/,\n PH: /^(?:(?:\\+?63)|0)(?:\\d{10})$/,\n PK: /^(?:(?:\\+92)|0)?[345]\\d{9}$/,\n QA: /^(?:\\+?974)?-?33\\d{5}$/,\n RU: /^(?:\\+?7|8)?[ -]?\\(?9\\d{2}\\)?[ -]?\\d{3}[ -]?\\d{2}[ -]?\\d{2}$/,\n SA: /^(?:\\+?966)?\\s?1?[\\s-]?(?:[45]\\d{2}|5\\d{3})[\\s-]?\\d{4}$/,\n SC: /^(?:(?:\\+248)|\\d{4})\\d{5}$/,\n SE: /^(?:\\+?46|0)\\s?[1-57-9](?:[0-9]\\s?){8}$/,\n SG: /^(?:(?:\\+65)|(?:\\(\\+65\\))|(?:65))\\d{4}\\d{4}$/,\n SL: /^(?:(?:\\+232)|(?:0))?\\d{9}$/,\n SO: /^(?:\\+252|0)?[567]\\d{7}$/,\n SS: /^(?:\\+211|0)?[1-9]\\d{7,9}$/,\n SV: /^(?:(?:\\+?503)|(?:0))(?:\\d{8})$/,\n SZ: /^(?:\\+?268)?\\d{7,8}$/,\n TH: /^(?:(?:\\+66)|0)\\d{9}$/,\n TT: /^(?:(?:\\+?1-868)|\\(?868\\)?)(\\d{7})$/,\n TZ: /^(?:(?:\\+?255)|0)?[67]\\d{8}$/,\n US: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n CA: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n UY: /^(?:(?:\\+598|0)\\s?(9\\d{3}|2\\d{2}|[4-9]\\d{6}))$/,\n UZ: /^(?:\\+?998)?\\s?[3456789]\\d{8}$/,\n YE: /^(?:\\+?967)?(?:\\d{7,8})$/,\n ZA: /^(?:(?:\\+27)|0)(\\d{9})$/,\n KW: /^(?:\\+?965)[569]\\d{7}$/,\n BH: /^(?:\\+?973)?[356]\\d{7}$/,\n TL: /^(?:(?:\\+670)\\s?)?[0-9]{3}\\s?[0-9]{3,4}$/,\n VC: /^(?:(?:\\+1)?784)?(?:\\d{3})?\\d{7}$/,\n VE: /^(?:(?:\\+58)|0)?4\\d{9}$/,\n VN: /^(?:(?:\\+84)|0)?[1-9]\\d{8}$/,\n ZM: /^(?:(?:\\+260)|0)?[123456789]\\d{8,9}$/,\n ZW: /^(?:(?:\\+263)|0)?(?:\\d{9,10})$/,\n LT: /^(?:(?:\\+370)|8)\\d{8}$/,\n LU: /^(?:(?:\\+352)?(6|2(6|7|8|9))\\d{6})$/,\n LV: /^(?:(?:\\+371)?2\\d{7})$/,\n ME: /^(?:(?:\\+382)?[67]\\d{7,20})$/,\n MG: /^(?:(?:\\+261)?3[234568]\\d{7})$/,\n MZ: /^(?:(?:\\+258)|(?:258))?8[234567]\\d{7,8}$/,\n NL: /^(?:(?:\\+31)|0(6(?:\\d{8})|[1-9](?:(?:\\d{8})|(?:\\s\\d{3}\\s\\d{4}))|(?:\\d{8})))$/,\n PA: /^(?:(?:\\+507)\\s?)?[46]\\d{6,7}$/,\n PL: /^(?:(?:\\+48)?(?:\\s?\\d{3}\\s?\\d{3}\\s?\\d{3}|(?:\\d{2}\\s?){4}\\d{2}|\\d{3}-\\d{3}-\\d{3}))$/,\n PR: /^(?:(?:\\+1)?787|939)\\d{7}$/,\n PS: /^(?:(?:\\+970))(5[2349])\\d{7}$/,\n PT: /^(?:(?:\\+351)?9(1\\d|2[1-9]|6[12345789]|7[12345789])\\d{7})$/,\n PY: /^(?:(?:\\+595|0)9[9876]\\d{7})$/,\n RO: /^(?:(?:\\+40|0))(?:7[2-8]\\d{7}|21\\d{8})$/,\n RS: /^(?:(?:\\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/,\n RW: /^(?:(?:\\+250)|(0))\\d{9}$/,\n SI: /^(?:(?:\\+386)|0)?[1-59]\\d{7,8}$/,\n SK: /^(?:(?:\\+421))?(0|9[0-8])\\d{8}$/,\n SM: /^(?:(?:\\+378)|(0549|6\\d{4}))\\d{5}$/,\n SN: /^(?:(?:\\+221)|0)?[3679]\\d{7}$/,\n SR: /^(?:(?:\\+597))\\d{7}$/,\n TG: /^(?:(?:\\+228))\\d{8}$/,\n TJ: /^(?:(?:\\+992))(37|55|77)\\d{7}$/,\n TN: /^(?:(?:\\+216)|22|9[1-9])\\d{7}$/,\n TR: /^(?:(?:\\+90)|(0))\\s?5\\d{9}$/,\n TW: /^(?:(?:\\+886)|0)?9\\d{8}$/,\n UA: /^(?:(?:\\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\\d{7}$/,\n UG: /^(?:(?:\\+256)|0)?[39]\\d{8}$/,\n};\n","/* Source: Google LibPhoneNumber Metadata: https://github.com/google/libphonenumber/blob/master/javascript/i18n/phonenumbers/metadata.js */\n\nexport const DIAL_CODE_MAPPER: { [key: number]: string[] } = {\n 1: [\n 'US',\n 'AG',\n 'AI',\n 'AS',\n 'BB',\n 'BM',\n 'BS',\n 'CA',\n 'DM',\n 'DO',\n 'GD',\n 'GU',\n 'JM',\n 'KN',\n 'KY',\n 'LC',\n 'MP',\n 'MS',\n 'PR',\n 'SX',\n 'TC',\n 'TT',\n 'VC',\n 'VG',\n 'VI',\n ],\n 7: ['RU', 'KZ'],\n 20: ['EG'],\n 27: ['ZA'],\n 30: ['GR'],\n 31: ['NL'],\n 32: ['BE'],\n 33: ['FR'],\n 34: ['ES'],\n 36: ['HU'],\n 39: ['IT', 'VA'],\n 40: ['RO'],\n 41: ['CH'],\n 43: ['AT'],\n 44: ['GB', 'GG', 'IM', 'JE'],\n 45: ['DK'],\n 46: ['SE'],\n 47: ['NO', 'SJ'],\n 48: ['PL'],\n 49: ['DE'],\n 51: ['PE'],\n 52: ['MX'],\n 53: ['CU'],\n 54: ['AR'],\n 55: ['BR'],\n 56: ['CL'],\n 57: ['CO'],\n 58: ['VE'],\n 60: ['MY'],\n 61: ['AU', 'CC', 'CX'],\n 62: ['ID'],\n 63: ['PH'],\n 64: ['NZ'],\n 65: ['SG'],\n 66: ['TH'],\n 81: ['JP'],\n 82: ['KR'],\n 84: ['VN'],\n 86: ['CN'],\n 90: ['TR'],\n 91: ['IN'],\n 92: ['PK'],\n 93: ['AF'],\n 94: ['LK'],\n 95: ['MM'],\n 98: ['IR'],\n 211: ['SS'],\n 212: ['MA', 'EH'],\n 213: ['DZ'],\n 216: ['TN'],\n 218: ['LY'],\n 220: ['GM'],\n 221: ['SN'],\n 222: ['MR'],\n 223: ['ML'],\n 224: ['GN'],\n 225: ['CI'],\n 226: ['BF'],\n 227: ['NE'],\n 228: ['TG'],\n 229: ['BJ'],\n 230: ['MU'],\n 231: ['LR'],\n 232: ['SL'],\n 233: ['GH'],\n 234: ['NG'],\n 235: ['TD'],\n 236: ['CF'],\n 237: ['CM'],\n 238: ['CV'],\n 239: ['ST'],\n 240: ['GQ'],\n 241: ['GA'],\n 242: ['CG'],\n 243: ['CD'],\n 244: ['AO'],\n 245: ['GW'],\n 246: ['IO'],\n 247: ['AC'],\n 248: ['SC'],\n 249: ['SD'],\n 250: ['RW'],\n 251: ['ET'],\n 252: ['SO'],\n 253: ['DJ'],\n 254: ['KE'],\n 255: ['TZ'],\n 256: ['UG'],\n 257: ['BI'],\n 258: ['MZ'],\n 260: ['ZM'],\n 261: ['MG'],\n 262: ['RE', 'YT'],\n 263: ['ZW'],\n 264: ['NA'],\n 265: ['MW'],\n 266: ['LS'],\n 267: ['BW'],\n 268: ['SZ'],\n 269: ['KM'],\n 290: ['SH', 'TA'],\n 291: ['ER'],\n 297: ['AW'],\n 298: ['FO'],\n 299: ['GL'],\n 350: ['GI'],\n 351: ['PT'],\n 352: ['LU'],\n 353: ['IE'],\n 354: ['IS'],\n 355: ['AL'],\n 356: ['MT'],\n 357: ['CY'],\n 358: ['FI', 'AX'],\n 359: ['BG'],\n 370: ['LT'],\n 371: ['LV'],\n 372: ['EE'],\n 373: ['MD'],\n 374: ['AM'],\n 375: ['BY'],\n 376: ['AD'],\n 377: ['MC'],\n 378: ['SM'],\n 380: ['UA'],\n 381: ['RS'],\n 382: ['ME'],\n 383: ['XK'],\n 385: ['HR'],\n 386: ['SI'],\n 387: ['BA'],\n 389: ['MK'],\n 420: ['CZ'],\n 421: ['SK'],\n 423: ['LI'],\n 500: ['FK'],\n 501: ['BZ'],\n 502: ['GT'],\n 503: ['SV'],\n 504: ['HN'],\n 505: ['NI'],\n 506: ['CR'],\n 507: ['PA'],\n 508: ['PM'],\n 509: ['HT'],\n 590: ['GP', 'BL', 'MF'],\n 591: ['BO'],\n 592: ['GY'],\n 593: ['EC'],\n 594: ['GF'],\n 595: ['PY'],\n 596: ['MQ'],\n 597: ['SR'],\n 598: ['UY'],\n 599: ['CW', 'BQ'],\n 670: ['TL'],\n 672: ['NF'],\n 673: ['BN'],\n 674: ['NR'],\n 675: ['PG'],\n 676: ['TO'],\n 677: ['SB'],\n 678: ['VU'],\n 679: ['FJ'],\n 680: ['PW'],\n 681: ['WF'],\n 682: ['CK'],\n 683: ['NU'],\n 685: ['WS'],\n 686: ['KI'],\n 687: ['NC'],\n 688: ['TV'],\n 689: ['PF'],\n 690: ['TK'],\n 691: ['FM'],\n 692: ['MH'],\n 800: ['001'],\n 808: ['001'],\n 850: ['KP'],\n 852: ['HK'],\n 853: ['MO'],\n 855: ['KH'],\n 856: ['LA'],\n 870: ['001'],\n 878: ['001'],\n 880: ['BD'],\n 881: ['001'],\n 882: ['001'],\n 883: ['001'],\n 886: ['TW'],\n 888: ['001'],\n 960: ['MV'],\n 961: ['LB'],\n 962: ['JO'],\n 963: ['SY'],\n 964: ['IQ'],\n 965: ['KW'],\n 966: ['SA'],\n 967: ['YE'],\n 968: ['OM'],\n 970: ['PS'],\n 971: ['AE'],\n 972: ['IL'],\n 973: ['BH'],\n 974: ['QA'],\n 975: ['BT'],\n 976: ['MN'],\n 977: ['NP'],\n 979: ['001'],\n 992: ['TJ'],\n 993: ['TM'],\n 994: ['AZ'],\n 995: ['GE'],\n 996: ['KG'],\n 998: ['UZ'],\n};\n","import { DIAL_CODE_MAPPER } from './data/dialCodeMapper';\nimport { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\n\n/**\n * Determines the country code based on the provided phone number.\n * This function employs a multi-step approach to identify the country code:\n * - If the phone number starts with '+', it extracts the numeric characters\n * and matches the leading digits with known dial codes mapped to countries.\n * - For matched dial codes, it further filters based on country-specific regex patterns\n * to validate the phone number format for those countries.\n * - If the phone number doesn't start with '+', it directly matches the number\n * against regular expressions associated with various countries to identify the code.\n *\n * @param phoneNumber The input phone number (string or number).\n * @returns The detected country code or an empty string if not found.\n */\nexport const detectCountryCodeFromDialCode = (\n phoneNumber: string | number,\n): string => {\n // If the phone number starts with '+', extract numeric characters\n if (phoneNumber.toString().charAt(0) === '+') {\n const cleanedPhoneNumberWithoutPlusPrefix = phoneNumber\n .toString()\n .replace(/\\D/g, '');\n\n const matchingCountries: string[] = [];\n\n // Iterate through dial codes and check for matches with cleaned phone number\n for (const code in DIAL_CODE_MAPPER) {\n if (cleanedPhoneNumberWithoutPlusPrefix.startsWith(code)) {\n matchingCountries.push(...DIAL_CODE_MAPPER[code]);\n }\n }\n\n // Filter matching countries based on phone number validation regex\n const matchedCountryCode = matchingCountries.find((countryCode: string) => {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex && regex.test(phoneNumber.toString())) return countryCode;\n return undefined;\n });\n\n // Return the first matched country code, if any\n return matchedCountryCode || '';\n } else {\n // If phone number doesn't start with '+', directly match against country regexes\n for (const countryCode in PHONE_REGEX_MAPPER) {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex.test(phoneNumber.toString())) {\n return countryCode;\n }\n }\n }\n\n // Return empty string if no country code is detected\n return '';\n};\n\nexport const cleanPhoneNumber = (phoneNumber: string) => {\n // Regular expression to match all characters except numbers and + sign at the start\n const regex = /[^0-9+]|(?!A)\\+/g;\n // Replace matched characters with an empty string\n const cleanedPhoneNumber = phoneNumber.replace(regex, '');\n return phoneNumber[0] === '+' ? `+${cleanedPhoneNumber}` : cleanedPhoneNumber;\n};\n","import { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Validates whether a given phone number is valid based on the provided country code or auto-detects the country code and checks if the number matches the defined regex pattern for that country.\nconst isValidPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_REGEX_MAPPER,\n): boolean => {\n // Clean the provided phoneNumber by removing non-numeric characters\n const cleanedPhoneNumber = cleanPhoneNumber(phoneNumber.toString());\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_REGEX_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(cleanedPhoneNumber);\n\n // Return false if phoneNumber is empty\n if (!phoneNumber) return false;\n\n // Check if the countryCode exists in the PHONE_REGEX_MAPPER\n if (countryCode in PHONE_REGEX_MAPPER) {\n // Fetch the regex pattern for the countryCode\n const regex = PHONE_REGEX_MAPPER[countryCode];\n // Test if the cleanedPhoneNumber matches the regex pattern\n return regex.test(cleanedPhoneNumber as string);\n }\n\n // Return false if the countryCode is not supported\n return false;\n};\n\nexport default withErrorBoundary(isValidPhoneNumber);\n","export const PHONE_FORMATTER_MAPPER: { [key: string]: string } = {\n IN: 'xxxx xxxxxx',\n MY: 'xx xxxxx xx',\n AE: 'xx xxx xxxx',\n AL: 'xxx xx xxxx',\n AM: 'xx xx xx xx',\n AR: 'xxxx-xxxx',\n AU: 'xxx xxx xxx',\n AW: 'xxx-xxxx',\n BB: 'xxx-xxxx',\n BD: 'xxxx-xxxxxx',\n BM: 'xxx-xxxx',\n BN: 'xxxx-xxxx',\n BO: 'xxxx-xxxx',\n BS: 'xxx-xxxx',\n BW: 'xx xxxx xxxx',\n BZ: 'xxx-xxxx',\n CA: 'xxx-xxx-xxxx',\n CH: 'xxx xxx xxx',\n CN: 'xxxx-xxxxxxx',\n CO: 'xxxx-xxxxxxx',\n CR: 'xxxx-xxxx',\n CU: 'xxxx-xxxx',\n CZ: 'xxx xxx xxx',\n DK: 'xx xx xx xx',\n DO: 'xxx-xxxxxxx',\n DZ: 'xxxx-xxxx-xxx',\n EG: 'xx xxx xxxx',\n ET: 'xx xxx xxxx',\n EU: 'xxx xx xx xx',\n FJ: 'xxxx xxxx',\n GB: 'xxxx xxx xxx',\n GH: 'xxx xxx xxxx',\n GI: 'xxxx xxxx',\n GM: 'xxxx-xxxx',\n GT: 'xxxx-xxxx',\n GY: 'xxx-xxxx',\n HK: 'xxxx xxxx',\n HN: 'xxxx-xxxx',\n HR: 'xxx xxx xxxx',\n HT: 'xxx-xxxx',\n HU: 'xxx xxx xxxx',\n ID: 'xxxx-xxxx-xxxx',\n IL: 'xxxx-xxx-xxx',\n JM: 'xxx-xxxx',\n KE: 'xxx xxxxxx',\n KG: 'xxx-xx-xx-xx',\n KH: 'xxx-xxx-xxx',\n KY: 'xxx-xxxx',\n KZ: 'xxx-xxx-xx-xx',\n LA: 'xxx xx xxxx',\n LK: 'xx xxx xxxx',\n LR: 'xxx-xxx-xxxx',\n LS: 'xxx xx xxxx',\n LT: 'xxx xxxxx',\n LU: 'xxx xx xxx',\n LV: 'xxxx xxxx',\n MA: 'xxxx-xxxxxx',\n MD: 'xx xxxxxx',\n ME: 'xx xxxxxx',\n MG: 'xx xx xx xx xx',\n MK: 'xx xx xx xx',\n MM: 'xx xxxxxx',\n MN: 'xxx-xx-xxxx',\n MO: 'xxxx xxxx',\n MU: 'xx xxxx xxxx',\n MV: 'xxxxxx',\n MW: 'xx xxxx xxxx',\n MX: 'xxx-xxx-xxxx',\n MZ: 'xx xxxxxxx',\n NA: 'xx xxxx xxxx',\n NG: 'xxx xxx xxxx',\n NI: 'xxxx-xxxx',\n NL: 'xxx-xxxxxxx',\n NO: 'xxxx xxxx',\n NP: 'xxxx-xxxxxxx',\n NZ: 'xxx-xxxxxxx',\n OM: 'xxxx-xxxx',\n PA: 'xxx-xxxx',\n PE: 'xxx-xxx-xxx',\n PG: 'xxx-xxxxxx',\n PH: 'xxx-xxxx',\n PK: 'xxx-xxxxxxx',\n PL: 'xxx xxx xxx',\n PR: 'xxx-xxx-xxxx',\n PS: 'xxxx-xxxxxxx',\n PT: 'xxx xxx xxx',\n PY: 'xxx-xxxxxx',\n QA: 'xxxx xxxx',\n RO: 'xxx xxx xxxx',\n RS: 'xxx xxxxx',\n RU: 'xxx xxx-xx-xx',\n RW: 'xxx xxxxxx',\n SA: 'xxx-xxxxxxx',\n SC: 'xx xxxxx',\n SE: 'xxx-xxx xx xx',\n SG: 'xxxx xxxx',\n SI: 'xx xxxxxx',\n SK: 'xxx xxx xxx',\n SL: 'xxx-xxxxxx',\n SM: 'xxxxx xxxxx',\n SN: 'xx xxx xx xx',\n SO: 'xxx xxxxxxx',\n SR: 'xxx-xxxx',\n SS: 'xxx xxxx xxx',\n SV: 'xxxx-xxxx',\n SZ: 'xxx xx xxxx',\n TG: 'xx xx xx xx',\n TH: 'xxx-xxxxxxx',\n TJ: 'xxx xx xx xx',\n TL: 'xxx-xxxxxxx',\n TN: 'xx xxxxxx',\n TR: 'xxx xxx xx xx',\n TT: 'xxx-xxxx',\n TW: 'xxxx-xxxxxx',\n TZ: 'xxx xxx xxxx',\n UA: 'xx xxx xx xx',\n UG: 'xxx xxxxxxx',\n US: 'xxx-xxx-xxxx',\n UY: 'xxx-xxxxx',\n UZ: 'xxx-xxx-xx-xx',\n VC: 'xxx-xxxx',\n VE: 'xxxx-xxx-xxxx',\n VN: 'xxxx-xxxxxxx',\n YE: 'xxxx-xxxx',\n ZA: 'xxx-xxx-xxxx',\n ZM: 'xxx-xxxxxxx',\n ZW: 'xx xxx xxxx',\n KW: 'xxx xx xxxx',\n BH: 'xxxx xxxx',\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Formats a provided phone number according to the predefined format for a specific country code, or auto-detects the country code and formats the number accordingly.\nconst formatPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_FORMATTER_MAPPER,\n): string => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Convert phoneNumber to string and clean it by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_FORMATTER_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Fetch the pattern for the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern) return phoneNumber;\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n // Extract the phoneNumber without the prefix\n const phoneNumberWithoutPrefix = phoneNumber.slice(diff);\n const formattedNumber: string[] = [];\n let numberIndex = 0;\n\n // Loop through the pattern to format the phoneNumber\n for (let i = 0; i < pattern.length; i++) {\n const patternChar = pattern[i];\n if (patternChar === 'x') {\n // Insert phoneNumber digits at 'x' positions\n if (numberIndex < phoneNumberWithoutPrefix.length) {\n formattedNumber.push(phoneNumberWithoutPrefix[numberIndex]);\n numberIndex++;\n }\n } else {\n // Insert non-digit characters from the pattern\n formattedNumber.push(patternChar);\n }\n }\n\n // Join the formattedNumber array to create the formattedPhoneNumber without prefix\n const formattedPhoneNumberWithoutPrefix = formattedNumber.join('');\n // Combine the prefix and formattedPhoneNumberWithoutPrefix\n const formattedPhoneNumberWithPrefix =\n phoneNumber.slice(0, diff) + ' ' + formattedPhoneNumberWithoutPrefix;\n\n // Return the formattedPhoneNumber with prefix after trimming whitespace\n return formattedPhoneNumberWithPrefix.trim();\n};\n\nexport default withErrorBoundary(formatPhoneNumber);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport formatPhoneNumber from './formatPhoneNumber';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\ninterface PhoneInfo {\n countryCode: string;\n dialCode: string;\n formattedPhoneNumber: string;\n formatTemplate: string;\n}\n\n// Parses a given phone number, identifies its country code (if not provided), and returns an object with details including the country code, formatted phone number, dial code, and format template.\nconst parsePhoneNumber = (phoneNumber: string, country?: string): PhoneInfo => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Clean the phoneNumber by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n const countryCode =\n country && country in PHONE_FORMATTER_MAPPER\n ? country\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Format the phone number using the detected/validated country code\n const formattedPhoneNumber = formatPhoneNumber(phoneNumber, countryCode);\n\n // Fetch the pattern associated with the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern)\n return {\n countryCode: countryCode || '',\n dialCode: '',\n formattedPhoneNumber: phoneNumber,\n formatTemplate: '',\n };\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n\n // Extract the dialCode from the phoneNumber\n const dialCode = phoneNumber.slice(0, diff);\n\n // Obtain the format template associated with the countryCode\n const formatTemplate = PHONE_FORMATTER_MAPPER[countryCode];\n\n // Return the parsed phone number information\n return {\n countryCode,\n formattedPhoneNumber,\n dialCode,\n formatTemplate,\n };\n};\n\nexport default withErrorBoundary(parsePhoneNumber);\n","export const stringToDate = (dateString: string): Date => {\n const supportedDateFormats = [\n // Date formats\n {\n regex: /^(\\d{4})\\/(\\d{2})\\/(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY/MM/DD\n {\n regex: /^(\\d{2})\\/(\\d{2})\\/(\\d{4})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n }, // DD/MM/YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY.MM.DD\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // DD-MM-YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // MM/DD/YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY-MM-DD\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY. MM. DD.\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // DD.MM.YYYY\n\n // Timestamp formats\n {\n regex: /^(\\d{4})\\/(\\d{2})\\/(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY/MM/DD HH:MM:SS\n {\n regex: /^(\\d{2})\\/(\\d{2})\\/(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD/MM/YYYY HH:MM:SS\n {\n regex: /^(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY-MM-DD HH:MM:SS\n {\n regex: /^(\\d{2})-(\\d{2})-(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD-MM-YYYY HH:MM:SS\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY.MM.DD HH:MM:SS\n {\n regex: /^(\\d{2})\\.(\\d{2})\\.(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD.MM.YYYY HH:MM:SS\n ];\n\n for (const format of supportedDateFormats) {\n const match = dateString.match(format.regex);\n if (match) {\n const year = match[format.yearIndex];\n const month = match[format.monthIndex];\n const day = match[format.dayIndex];\n const hour = format.hourIndex ? match[format.hourIndex] : '00';\n const minute = format.minuteIndex ? match[format.minuteIndex] : '00';\n const second = format.secondIndex ? match[format.secondIndex] : '00';\n\n return new Date(`${year}-${month}-${day}T${hour}:${minute}:${second}`);\n }\n }\n\n throw new Error('Date format not recognized');\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Adds a specified amount of time to a date.\n *\n * @param date The original date.\n * @param value The amount to add.\n * @param unit The unit of time to add (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time added.\n */\nconst add = (\n date: DateInput,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n switch (unit) {\n case 'days':\n date.setDate(date.getDate() + value);\n break;\n case 'months':\n date.setMonth(date.getMonth() + value);\n break;\n case 'years':\n date.setFullYear(date.getFullYear() + value);\n break;\n }\n return date;\n};\n\nexport default withErrorBoundary(add);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Formats date and time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional).\n * @returns {string} Formatted date and time string.\n */\nconst formatDateTime = (\n date: DateInput,\n locale: Locale,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n const dateObj: Date = date instanceof Date ? date : new Date(date);\n let formatter;\n\n try {\n formatter = new Intl.DateTimeFormat(locale, intlOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formatter.format(dateObj);\n};\n\nexport default withErrorBoundary(formatDateTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n DateFormatOptions,\n} from './types';\n\n/**\n * Formats date based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional).\n * @returns {string} Formatted date string.\n */\nconst formatDate = (\n date: DateInput,\n locale: Locale,\n options: DateFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n timeStyle: undefined,\n };\n\n let formattedDate;\n\n try {\n formattedDate = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedDate;\n};\n\nexport default withErrorBoundary(formatDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n TimeFormatOptions,\n} from './types';\n\n/**\n * Formats time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional).\n * @returns {string} Formatted time string.\n */\nconst formatTime = (\n date: DateInput,\n locale: Locale,\n options: TimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n dateStyle: undefined,\n };\n\n let formattedTime;\n\n try {\n formattedTime = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedTime;\n};\n\nexport default withErrorBoundary(formatTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\n\n/**\n * Gets the first day of the week for a given locale.\n *\n * @param locale The locale to determine the first day of the week for.\n * @param intlOptions Optional Intl.DateTimeFormatOptions for customization.\n * @returns The first day of the week (0-6, where 0 is Sunday).\n */\nconst getFirstDayOfWeek = (\n locale: string,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n let formatted;\n\n if (!intlOptions.weekday) intlOptions.weekday = 'long';\n\n try {\n const formatter = new Intl.DateTimeFormat(locale, intlOptions);\n /**\n * This date was chosen because January 2, 2000, is a Sunday.\n * In the Gregorian calendar, Sunday is considered the start of the week in some cultures (like in the United States), while in others, it's Monday (like in much of Europe).\n * By using a date that is known to be a Sunday, the function can accurately determine what day of the week is considered the start in the specified locale.\n */\n const sundayDate = new Date(2000, 0, 2); // A known Sunday\n formatted = formatter.format(sundayDate);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n // Generate localized weekdays array starting from Sunday\n const weekdays = Array.from({ length: 7 }, (_, i) =>\n new Intl.DateTimeFormat(locale, intlOptions).format(\n new Date(2000, 0, 2 + i),\n ),\n );\n\n const firstDayIndex = weekdays.indexOf(formatted);\n if (firstDayIndex === -1) {\n throw new Error('Unable to determine the first day of the week');\n }\n\n return weekdays[(firstDayIndex + 1) % 7]; // Adjusting since our reference date is a Sunday\n};\n\nexport default withErrorBoundary(getFirstDayOfWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Determines the quarter of the year for a given date.\n *\n * @param date The date to determine the quarter for.\n * @returns The quarter of the year (1-4).\n */\nconst getQuarter = (date: DateInput): number => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n return Math.ceil((date.getMonth() + 1) / 3);\n};\n\nexport default withErrorBoundary(getQuarter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Provides a relative time string (e.g., '3 hours ago', 'in 2 days').\n * This function calculates the difference between the given date and the base date,\n * then formats it in a locale-sensitive manner. It allows customization of the output\n * through Intl.RelativeTimeFormat options.\n *\n * @param date - The date to compare.\n * @param baseDate - The date to compare against (default: current date).\n * @param locale - The locale to use for formatting.\n * @param options - Options for the Intl.RelativeTimeFormat (optional).\n * @returns The relative time as a string.\n */\nconst getRelativeTime = (\n date: DateInput,\n baseDate: DateInput = new Date(),\n locale: Locale,\n options?: Intl.RelativeTimeFormatOptions,\n): string => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n baseDate =\n typeof baseDate === 'string'\n ? new Date(stringToDate(baseDate))\n : new Date(baseDate);\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000;\n\n // Define time units in seconds\n const minute = 60;\n const hour = minute * 60;\n const day = hour * 24;\n const week = day * 7;\n const month = day * 30;\n const year = day * 365;\n\n let value: number;\n let unit: Intl.RelativeTimeFormatUnit;\n\n if (Math.abs(diffInSeconds) < minute) {\n value = diffInSeconds;\n unit = 'second';\n } else if (Math.abs(diffInSeconds) < hour) {\n value = diffInSeconds / minute;\n unit = 'minute';\n } else if (Math.abs(diffInSeconds) < day) {\n value = diffInSeconds / hour;\n unit = 'hour';\n } else if (Math.abs(diffInSeconds) < week) {\n value = diffInSeconds / day;\n unit = 'day';\n } else if (Math.abs(diffInSeconds) < month) {\n value = diffInSeconds / week;\n unit = 'week';\n } else if (Math.abs(diffInSeconds) < year) {\n value = diffInSeconds / month;\n unit = 'month';\n } else {\n value = diffInSeconds / year;\n unit = 'year';\n }\n\n let relativeTime;\n\n try {\n const rtf = new Intl.RelativeTimeFormat(locale, options);\n relativeTime = rtf.format(Math.round(value), unit);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return relativeTime;\n};\n\nexport default withErrorBoundary(getRelativeTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Calculates the week number of the year for a given date.\n *\n * @param date The date to calculate the week number for.\n * @returns The week number of the year.\n */\nconst getWeek = (date: DateInput): number => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n const firstDayOfYear = new Date(date.getFullYear(), 0, 1);\n const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000;\n return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7);\n};\n\nexport default withErrorBoundary(getWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Returns an array of weekdays according to the specified locale.\n *\n * @param locale The locale to get weekdays for.\n * @param intlOptions Optional Intl.DateTimeFormatOptions for customization.\n * @returns An array of weekday names.\n */\nconst getWeekdays = (\n locale: Locale,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string[] => {\n try {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n if (!intlOptions.weekday) intlOptions.weekday = 'long';\n\n const formatter = new Intl.DateTimeFormat(locale, intlOptions);\n\n /** The date January 1, 1970, is a well-known reference point in computing known as the Unix epoch.\n * It's the date at which time is measured for Unix systems, making it a consistent and reliable choice for date calculations.\n * The choice of the date January 4, 1970, as the starting point is significant.\n * January 4, 1970, was a Sunday.\n * Since weeks typically start on Sunday or Monday in most locales, starting from a known Sunday allows the function to cycle through a complete week, capturing all weekdays in the order they appear for the given locale.\n * */\n return Array.from({ length: 7 }, (_, i) =>\n formatter.format(new Date(1970, 0, 4 + i)),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(getWeekdays);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Compares two dates to determine if the first is after the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is after date2.\n */\nconst isAfter = (date1: DateInput, date2: DateInput): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 > dateObj2;\n};\n\nexport default withErrorBoundary(isAfter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Compares two dates to determine if the first is before the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is before date2.\n */\nconst isBefore = (date1: DateInput, date2: DateInput): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 < dateObj2;\n};\n\nexport default withErrorBoundary(isBefore);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given year is a leap year.\n *\n * @param year The year to check.\n * @returns True if the year is a leap year, false otherwise.\n */\nconst isLeapYear = (year: number): boolean => {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n};\n\nexport default withErrorBoundary(isLeapYear);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { stringToDate } from './utils';\n\n/**\n * Checks if two dates fall on the same day.\n *\n * @param date1 The first date.\n * @param date2 The second date.\n * @returns True if both dates are on the same day, false otherwise.\n */\nconst isSameDay = (date1: Date, date2: Date): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n return (\n date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear()\n );\n};\n\nexport default withErrorBoundary(isSameDay);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { stringToDate } from './utils';\n\n/**\n * Checks if a given object is a valid Date object.\n *\n * @param date The object to check.\n * @returns True if the object is a valid Date, false otherwise.\n */\nconst isValidDate = (date: any): boolean => {\n try {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return date instanceof Date && !isNaN(date.getTime());\n};\n\nexport default withErrorBoundary(isValidDate);\n","export const LOCALE_DATE_FORMATS: { [key: string]: string } = {\n 'ar-AE': 'DD/MM/YYYY', // Arabic (U.A.E.)\n 'sq-AL': 'DD.MM.YYYY', // Albanian (Albania)\n 'hy-AM': 'DD.MM.YYYY', // Armenian (Armenia)\n 'es-AR': 'DD/MM/YYYY', // Spanish (Argentina)\n 'en-AU': 'DD/MM/YYYY', // English (Australia)\n 'nl-AW': 'DD-MM-YYYY', // Dutch (Aruba)\n 'en-BB': 'MM/DD/YYYY', // English (Barbados)\n 'bn-BD': 'DD/MM/YYYY', // Bengali (Bangladesh)\n 'en-BM': 'MM/DD/YYYY', // English (Bermuda)\n 'ms-BN': 'DD/MM/YYYY', // Malay (Brunei)\n 'es-BO': 'DD/MM/YYYY', // Spanish (Bolivia)\n 'en-BS': 'MM/DD/YYYY', // English (Bahamas)\n 'en-BW': 'DD/MM/YYYY', // English (Botswana)\n 'en-BZ': 'MM/DD/YYYY', // English (Belize)\n 'en-CA': 'DD/MM/YYYY', // English (Canada)\n 'de-CH': 'DD.MM.YYYY', // German (Switzerland)\n 'zh-CN': 'YYYY/MM/DD', // Chinese (China)\n 'es-CO': 'DD/MM/YYYY', // Spanish (Colombia)\n 'es-CR': 'DD/MM/YYYY', // Spanish (Costa Rica)\n 'es-CU': 'DD/MM/YYYY', // Spanish (Cuba)\n 'cs-CZ': 'DD.MM.YYYY', // Czech (Czech Republic)\n 'da-DK': 'DD-MM-YYYY', // Danish (Denmark)\n 'es-DO': 'DD/MM/YYYY', // Spanish (Dominican Republic)\n 'ar-DZ': 'DD/MM/YYYY', // Arabic (Algeria)\n 'ar-EG': 'DD/MM/YYYY', // Arabic (Egypt)\n 'am-ET': 'DD/MM/YYYY', // Amharic (Ethiopia)\n 'en-EU': 'DD/MM/YYYY', // English (European Union)\n 'en-FJ': 'DD/MM/YYYY', // English (Fiji)\n 'en-GB': 'DD/MM/YYYY', // English (United Kingdom)\n 'en-GH': 'DD/MM/YYYY', // English (Ghana)\n 'en-GI': 'DD/MM/YYYY', // English (Gibraltar)\n 'en-GM': 'DD/MM/YYYY', // English (Gambia)\n 'es-GT': 'DD/MM/YYYY', // Spanish (Guatemala)\n 'en-GY': 'DD/MM/YYYY', // English (Guyana)\n 'en-HK': 'DD/MM/YYYY', // English (Hong Kong)\n 'es-HN': 'DD/MM/YYYY', // Spanish (Honduras)\n 'hr-HR': 'DD.MM.YYYY', // Croatian (Croatia)\n 'ht-HT': 'MM/DD/YYYY', // Haitian (Haiti)\n 'hu-HU': 'YYYY. MM. DD.', // Hungarian (Hungary)\n 'id-ID': 'DD/MM/YYYY', // Indonesian (Indonesia)\n 'he-IL': 'DD/MM/YYYY', // Hebrew (Israel)\n 'en-IN': 'DD-MM-YYYY', // English (India)\n 'en-JM': 'MM/DD/YYYY', // English (Jamaica)\n 'en-KE': 'DD/MM/YYYY', // English (Kenya)\n 'ky-KG': 'DD.MM.YYYY', // Kyrgyz (Kyrgyzstan)\n 'km-KH': 'DD/MM/YYYY', // Khmer (Cambodia)\n 'en-KY': 'MM/DD/YYYY', // English (Cayman Islands)\n 'kk-KZ': 'DD.MM.YYYY', // Kazakh (Kazakhstan)\n 'lo-LA': 'DD/MM/YYYY', // Lao (Laos)\n 'si-LK': 'YYYY-MM-DD', // Sinhala (Sri Lanka)\n 'en-LR': 'MM/DD/YYYY', // English (Liberia)\n 'en-LS': 'DD/MM/YYYY', // English (Lesotho)\n 'ar-MA': 'DD/MM/YYYY', // Arabic (Morocco)\n 'ro-MD': 'DD.MM.YYYY', // Romanian (Moldova)\n 'mk-MK': 'DD.MM.YYYY', // Macedonian (North Macedonia)\n 'my-MM': 'DD/MM/YYYY', // Burmese (Myanmar)\n 'mn-MN': 'YYYY.MM.DD', // Mongolian (Mongolia)\n 'zh-MO': 'DD/MM/YYYY', // Chinese (Macao)\n 'en-MU': 'DD/MM/YYYY', // English (Mauritius)\n 'dv-MV': 'DD/MM/YYYY', // Divehi (Maldives)\n 'en-MW': 'DD/MM/YYYY', // English (Malawi)\n 'es-MX': 'DD/MM/YYYY', // Spanish (Mexico)\n 'ms-MY': 'DD/MM/YYYY', // Malay (Malaysia)\n 'en-NA': 'DD/MM/YYYY', // English (Namibia)\n 'en-NG': 'DD/MM/YYYY', // English (Nigeria)\n 'es-NI': 'DD/MM/YYYY', // Spanish (Nicaragua)\n 'no-NO': 'DD.MM.YYYY', // Norwegian (Norway)\n 'ne-NP': 'YYYY/MM/DD', // Nepali (Nepal)\n 'en-NZ': 'DD/MM/YYYY', // English (New Zealand)\n 'es-PE': 'DD/MM/YYYY', // Spanish (Peru)\n 'en-PG': 'DD/MM/YYYY', // English (Papua New Guinea)\n 'en-PH': 'MM/DD/YYYY', // English (Philippines)\n 'en-PK': 'DD/MM/YYYY', // English (Pakistan)\n 'ar-QA': 'DD/MM/YYYY', // Arabic (Qatar)\n 'ru-RU': 'DD.MM.YYYY', // Russian (Russia)\n 'ar-SA': 'DD/MM/YYYY', // Arabic (Saudi Arabia)\n 'en-SC': 'DD/MM/YYYY', // English (Seychelles)\n 'sv-SE': 'YYYY-MM-DD', // Swedish (Sweden)\n 'en-SG': 'DD/MM/YYYY', // English (Singapore)\n 'en-SL': 'DD/MM/YYYY', // English (Sierra Leone)\n 'so-SO': 'DD/MM/YYYY', // Somali (Somalia)\n 'en-SS': 'DD/MM/YYYY', // English (South Sudan)\n 'es-SV': 'DD/MM/YYYY', // Spanish (El Salvador)\n 'en-SZ': 'DD/MM/YYYY', // English (Eswatini)\n 'th-TH': 'DD/MM/YYYY', // Thai (Thailand)\n 'en-TT': 'MM/DD/YYYY', // English (Trinidad and Tobago)\n 'sw-TZ': 'DD/MM/YYYY', // Swahili (Tanzania)\n 'en-US': 'MM/DD/YYYY', // English (United States)\n 'es-UY': 'DD/MM/YYYY', // Spanish (Uruguay)\n 'uz-UZ': 'DD/MM/YYYY', // Uzbek (Uzbekistan)\n 'ar-YE': 'DD/MM/YYYY', // Arabic (Yemen)\n 'en-ZA': 'YYYY/MM/DD', // English (South Africa)\n 'ar-KW': 'DD/MM/YYYY', // Arabic (Kuwait)\n 'ar-BH': 'DD/MM/YYYY', // Arabic (Bahrain)\n 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman)\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Parses a date string based on a specific format.\n *\n * @param dateString The date string to parse.\n * @param format The format to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDateWithFormat = (\n dateString: string,\n format: string,\n): Date | null => {\n // Determine the separator based on the format (supports '/', '.', or '-')\n const separator = format.includes('/')\n ? '/'\n : format.includes('.')\n ? '.'\n : '-';\n const formatParts = format.split(separator);\n const dateParts = dateString.split(separator).map((num) => parseInt(num, 10));\n\n let year: number = 0,\n month: number = 0,\n day: number = 0;\n let yearSet: boolean = false,\n monthSet: boolean = false,\n daySet: boolean = false;\n\n // Check for format and date string mismatch\n if (dateParts.length !== formatParts.length) {\n return null; // Mismatch between date string and format\n }\n\n formatParts.forEach((part, index) => {\n // Check for non-numeric values in date string\n if (isNaN(dateParts[index])) {\n return null; // Invalid date part\n }\n\n // Assign year, month, and day based on the format\n switch (part) {\n case 'DD':\n day = dateParts[index];\n daySet = true;\n break;\n case 'MM':\n month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date\n monthSet = true;\n break;\n case 'YYYY':\n year = dateParts[index];\n yearSet = true;\n break;\n }\n });\n\n // Validate and create the date only if all parts are set\n if (yearSet && monthSet && daySet) {\n const parsedDate = new Date(year, month, day);\n // Validate date to catch invalid dates like February 30th\n if (\n parsedDate.getFullYear() === year &&\n parsedDate.getMonth() === month &&\n parsedDate.getDate() === day\n ) {\n return parsedDate;\n }\n }\n return null; // Invalid date or incomplete date information\n};\n\nexport default withErrorBoundary(\n parseDateWithFormat,\n);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { LOCALE_DATE_FORMATS } from './data/localeDateFormats';\nimport parseDateWithFormat from './parseDateWithFormat';\nimport { Locale } from './types';\n\n/**\n * Attempts to parse a string into a date object based on locale.\n * Uses the localeDateFormats mapping for determining the date format.\n *\n * @param dateString - The date string to parse.\n * @param locale - The locale to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDate = (dateString: string, locale: Locale): Date | null => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const format = LOCALE_DATE_FORMATS[locale];\n if (!format) {\n throw new Error(`No date format found for locale: ${locale}`);\n }\n return parseDateWithFormat(dateString, format);\n};\n\nexport default withErrorBoundary(parseDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport add from './add';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Subtracts a specified amount of time from a date.\n *\n * @param date The original date.\n * @param value The amount to subtract.\n * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time subtracted.\n */\nconst subtract = (\n date: DateInput,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n return add(date, -value, unit); // Reuse the add function with negative value\n};\n\nexport default withErrorBoundary(subtract);\n"],"names":["formatPhoneNumber","formatDateTime","parseDateWithFormat","add"],"mappings":";;;;;;IAAA;IACM,MAAO,YAAa,SAAQ,KAAK,CAAA;IAErC,IAAA,WAAA,CAAY,OAA2B,EAAA;YACrC,KAAK,CAAC,OAAO,CAAC,CAAC;IACf,QAAA,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC5B,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;;SAE7B;IACF,CAAA;IAED;;;;;;;;IAQG;IACI,MAAM,iBAAiB,GAAG,CAC/B,EAAK,KAC0C;QAC/C,OAAO,UAAyB,GAAG,IAAmB,EAAA;YACpD,IAAI;gBACF,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAkB,CAAC;IAChD,SAAA;IAAC,QAAA,OAAO,GAAG,EAAE;IACZ,YAA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,QAAQ,GAAG,CACf,IAAe,EACf,KAAa,EACb,IAAiC,KACzB;QACR,IAAI;YACF,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;QAE3E,OAAOC,KAAG,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC,CAAC;AAEF,qBAAe,iBAAiB,CAAkB,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/lib/umd/index.min.js b/lib/umd/index.min.js deleted file mode 100644 index 2209db13..00000000 --- a/lib/umd/index.min.js +++ /dev/null @@ -1,2 +0,0 @@ -!function(x,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((x="undefined"!=typeof globalThis?globalThis:x||self).i18nify={})}(this,(function(x){"use strict";class e extends Error{constructor(x){super(x),this.name="i18nify Error",this.timestamp=new Date}}const n=x=>function(...n){try{return x.call(this,...n)}catch(x){throw console.warn("[I18N Error]: ",x),new e(x)}};class a{constructor(){this.state={locale:"",direction:"",country:""}}static getInstance(){return a.instance||(a.instance=new a),a.instance}static resetInstance(){a.instance=void 0}getState(){return Object.assign({},this.state)}setState(x){this.state=Object.assign(Object.assign({},this.state),x)}resetState(){this.state={locale:"",direction:"",country:""}}}var r=a.getInstance();var t=n((()=>r.getState()));var o=n((x=>{r.setState(x)}));var d=n((()=>{r.resetState()}));const s=()=>{if("undefined"==typeof navigator)return"en-IN";if(window.Intl&&"object"==typeof window.Intl&&(window.navigator.languages||window.navigator.language)){return(window.navigator.languages||[window.navigator.language])[0]}return"en-IN"},Y=(x={})=>{let e=(null==x?void 0:x.locale)||r.getState().locale;e||(e=s());const n=(null==x?void 0:x.intlOptions)?Object.assign({},x.intlOptions):{};if(((null==x?void 0:x.currency)||n.currency)&&(n.style="currency",n.currency=x.currency||n.currency),!e)throw new Error("Pass valid locale !");return new Intl.NumberFormat(e||void 0,n)};var D=n(((x,e={})=>{if(!Number(x)&&0!==Number(x))throw new Error("Parameter `amount` is not a number!");let n="";try{n=Y(e).format(Number(x))}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return n}));const i={AED:{symbol:"د.إ",name:"United Arab Emirates Dirham"},ALL:{symbol:"Lek",name:"Albanian Lek"},AMD:{symbol:"֏",name:"Armenian Dram"},ARS:{symbol:"ARS",name:"Argentine Peso"},AUD:{symbol:"A$",name:"Australian Dollar"},AWG:{symbol:"Afl.",name:"Aruban Florin"},BBD:{symbol:"$",name:"Barbadian Dollar"},BDT:{symbol:"৳",name:"Bangladeshi Taka"},BMD:{symbol:"$",name:"Bermudian Dollar"},BND:{symbol:"BND",name:"Brunei Dollar"},BOB:{symbol:"Bs",name:"Bolivian Boliviano"},BSD:{symbol:"B$",name:"Bahamian Dollar"},BWP:{symbol:"P",name:"Botswanan Pula"},BZD:{symbol:"BZ$",name:"Belize Dollar"},CAD:{symbol:"C$",name:"Canadian Dollar"},CHF:{symbol:"CHf",name:"Swiss Franc"},CNY:{symbol:"¥",name:"Chinese Yuan"},COP:{symbol:"COL$",name:"Colombian Peso"},CRC:{symbol:"₡",name:"Costa Rican Colón"},CUP:{symbol:"$MN",name:"Cuban Peso"},CZK:{symbol:"Kč",name:"Czech Koruna"},DKK:{symbol:"DKK",name:"Danish Krone"},DOP:{symbol:"RD$",name:"Dominican Peso"},DZD:{symbol:"د.ج",name:"Algerian Dinar"},EGP:{symbol:"E£",name:"Egyptian Pound"},ETB:{symbol:"ብር",name:"Ethiopian Birr"},EUR:{symbol:"€",name:"Euro"},FJD:{symbol:"FJ$",name:"Fijian Dollar"},GBP:{symbol:"£",name:"British Pound"},GHS:{symbol:"GH₵",name:"Ghanaian Cedi"},GIP:{symbol:"GIP",name:"Gibraltar Pound"},GMD:{symbol:"D",name:"Gambian Dalasi"},GTQ:{symbol:"Q",name:"Guatemalan Quetzal"},GYD:{symbol:"G$",name:"Guyanese Dollar"},HKD:{symbol:"HK$",name:"Hong Kong Dollar"},HNL:{symbol:"HNL",name:"Honduran Lempira"},HRK:{symbol:"kn",name:"Croatian Kuna"},HTG:{symbol:"G",name:"Haitian Gourde"},HUF:{symbol:"Ft",name:"Hungarian Forint"},IDR:{symbol:"Rp",name:"Indonesian Rupiah"},ILS:{symbol:"₪",name:"Israeli New Shekel"},INR:{symbol:"₹",name:"Indian Rupee"},JMD:{symbol:"J$",name:"Jamaican Dollar"},KES:{symbol:"Ksh",name:"Kenyan Shilling"},KGS:{symbol:"Лв",name:"Kyrgystani Som"},KHR:{symbol:"៛",name:"Cambodian Riel"},KYD:{symbol:"CI$",name:"Cayman Islands Dollar"},KZT:{symbol:"₸",name:"Kazakhstani Tenge"},LAK:{symbol:"₭",name:"Laotian Kip"},LKR:{symbol:"රු",name:"Sri Lankan Rupee"},LRD:{symbol:"L$",name:"Liberian Dollar"},LSL:{symbol:"LSL",name:"Lesotho Loti"},MAD:{symbol:"د.م.",name:"Moroccan Dirham"},MDL:{symbol:"MDL",name:"Moldovan Leu"},MKD:{symbol:"ден",name:"Macedonian Denar"},MMK:{symbol:"MMK",name:"Myanmar Kyat"},MNT:{symbol:"₮",name:"Mongolian Tugrik"},MOP:{symbol:"MOP$",name:"Macanese Pataca"},MUR:{symbol:"₨",name:"Mauritian Rupee"},MVR:{symbol:"Rf",name:"Maldivian Rufiyaa"},MWK:{symbol:"MK",name:"Malawian Kwacha"},MXN:{symbol:"Mex$",name:"Mexican Peso"},MYR:{symbol:"RM",name:"Malaysian Ringgit"},NAD:{symbol:"N$",name:"Namibian Dollar"},NGN:{symbol:"₦",name:"Nigerian Naira"},NIO:{symbol:"NIO",name:"Nicaraguan Córdoba"},NOK:{symbol:"NOK",name:"Norwegian Krone"},NPR:{symbol:"रू",name:"Nepalese Rupee"},NZD:{symbol:"NZ$",name:"New Zealand Dollar"},PEN:{symbol:"S/",name:"Peruvian Nuevo Sol"},PGK:{symbol:"PGK",name:"Papua New Guinean Kina"},PHP:{symbol:"₱",name:"Philippine Peso"},PKR:{symbol:"₨",name:"Pakistani Rupee"},QAR:{symbol:"QR",name:"Qatari Riyal"},RUB:{symbol:"₽",name:"Russian Ruble"},SAR:{symbol:"SR",name:"Saudi Riyal"},SCR:{symbol:"SRe",name:"Seychellois Rupee"},SEK:{symbol:"SEK",name:"Swedish Krona"},SGD:{symbol:"S$",name:"Singapore Dollar"},SLL:{symbol:"Le",name:"Sierra Leonean Leone"},SOS:{symbol:"Sh.so.",name:"Somali Shilling"},SSP:{symbol:"SS£",name:"South Sudanese Pound"},SVC:{symbol:"₡",name:"Salvadoran Colón"},SZL:{symbol:"E",name:"Swazi Lilangeni"},THB:{symbol:"฿",name:"Thai Baht"},TTD:{symbol:"TT$",name:"Trinidad and Tobago Dollar"},TZS:{symbol:"Sh",name:"Tanzanian Shilling"},USD:{symbol:"$",name:"United States Dollar"},UYU:{symbol:"$U",name:"Uruguayan Peso"},UZS:{symbol:"so'm",name:"Uzbekistani Som"},YER:{symbol:"﷼",name:"Yemeni Rial"},ZAR:{symbol:"R",name:"South African Rand"},KWD:{symbol:"د.ك",name:"Kuwaiti Dinar"},BHD:{symbol:"د.ب.",name:"Bahraini Dinar"},OMR:{symbol:"ر.ع.",name:"Omani Rial"}};var M=n((()=>i));var m=n((x=>{var e;if(x in i)return null===(e=i[x])||void 0===e?void 0:e.symbol;throw new Error("Invalid currencyCode!")}));const l=["nan","infinity","percent","integer","group","decimal","fraction","plusSign","minusSign","percentSign","currency","code","symbol","name","compact","exponentInteger","exponentMinusSign","exponentSeparator","unit"];var c=n(((x,e={})=>{if(!Number(x)&&0!==Number(x))throw new Error("Parameter `amount` is not a number!");try{const n=Y(e).formatToParts(Number(x)),a={};return n.forEach((x=>{"group"===x.type?a.integer=(a.integer||"")+x.value:-1!=l.findIndex((e=>e===x.type))&&(a[x.type]=(a[x.type]||"")+x.value)})),Object.assign(Object.assign({},a),{isPrefixSymbol:"currency"===n[0].type,rawParts:n})}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}}));const y={IN:/^(?:(?:\+|0{0,2})91\s*[-]?\s*|[0]?)?[6789]\d{9}$/,MY:/^(\+?6?0)?(\d{1,3})[-. ]?(\d{7,8})$/,AE:/^(?:\+?971|0)?(?:2|3|4|6|7|9)\d{8}$/,AL:/^(?:\+?355)?(?:[4-9]\d{7}|6\d{8})$/,AM:/^(?:\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/,AR:/^(?:(?:\+|0{0,2})54)?(?:11|[2368]\d)(?:(?=\d{0,2}15)\d{2})??\d{8}$/,AU:/^(?:\+?61|0)4\d{8}$/,AW:/^(?:(?:\+297)?(?!0)\d{7})$/,BB:/^(?:(?:\+1)?246)?(?:\d{3})?\d{7}$/,BD:/^(?:\+?880|0)1[13456789]\d{8}$/,BM:/^(?:(?:\+1)?441)?(?:\d{2})?\d{7}$/,BN:/^(?:\+?673)?(?:\d{3})?\d{4}$/,BO:/^(?:(?:\+|0{0,2})591)?(?:(?:2|3|7|6)\d{7})$/,BS:/^(?:(?:\+1)?242)?(?:\d{3})?\d{7}$/,BW:/^(?:(?:\+267)?\s?)?[74]\d{7}$/,BZ:/^(?:(?:\+501)?\s?)?[622]\d{4}$/,CH:/^(?:(?:\+41|0)(?:\s*\(?0\)?\s*))?(?:\d{2}\s*)?\d{3}\s*\d{2}\s*\d{2}$/,CN:/^(?:(?:\+|00)86)?1\d{10}$/,CO:/^(?:(?:\+57|0057)?)?[1-8]{1}\d{6,7}$/,OM:/^(?:\+?968)?(?:95|96|97|98)\d{6}$/,CR:/^(?:(?:\+506)?\s*|0)?[1-9]\d{7}$/,CU:/^(?:\+?53)?(?:[5-8]\d{7})$/,CZ:/^(?:\+?420)?(?:\d{9})$/,DK:/^(?:\+?45)?(?:\d{8})$/,DO:/^(?:(?:\+1)?809|1-8(?:00|88|89))(?:\d{7})$/,D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1-868)|\(?868\)?)(\d{7})$/,TZ:/^(?:(?:\+?255)|0)?[67]\d{8}$/,US:/^(\+\d{1,2}\s?)?([2-9]{1}\d{2}[2-9]{1}\d{6})$/,CA:/^(\+\d{1,2}\s?)?([2-9]{1}\d{2}[2-9]{1}\d{6})$/,UY:/^(?:(?:\+598|0)\s?(9\d{3}|2\d{2}|[4-9]\d{6}))$/,UZ:/^(?:\+?998)?\s?[3456789]\d{8}$/,YE:/^(?:\+?967)?(?:\d{7,8})$/,ZA:/^(?:(?:\+27)|0)(\d{9})$/,KW:/^(?:\+?965)[569]\d{7}$/,BH:/^(?:\+?973)?[356]\d{7}$/,TL:/^(?:(?:\+670)\s?)?[0-9]{3}\s?[0-9]{3,4}$/,VC:/^(?:(?:\+1)?784)?(?:\d{3})?\d{7}$/,VE:/^(?:(?:\+58)|0)?4\d{9}$/,VN:/^(?:(?:\+84)|0)?[1-9]\d{8}$/,ZM:/^(?:(?:\+260)|0)?[123456789]\d{8,9}$/,ZW:/^(?:(?:\+263)|0)?(?:\d{9,10})$/,LT:/^(?:(?:\+370)|8)\d{8}$/,LU:/^(?:(?:\+352)?(6|2(6|7|8|9))\d{6})$/,LV:/^(?:(?:\+371)?2\d{7})$/,ME:/^(?:(?:\+382)?[67]\d{7,20})$/,MG:/^(?:(?:\+261)?3[234568]\d{7})$/,MZ:/^(?:(?:\+258)|(?:258))?8[234567]\d{7,8}$/,NL:/^(?:(?:\+31)|0(6(?:\d{8})|[1-9](?:(?:\d{8})|(?:\s\d{3}\s\d{4}))|(?:\d{8})))$/,PA:/^(?:(?:\+507)\s?)?[46]\d{6,7}$/,PL:/^(?:(?:\+48)?(?:\s?\d{3}\s?\d{3}\s?\d{3}|(?:\d{2}\s?){4}\d{2}|\d{3}-\d{3}-\d{3}))$/,PR:/^(?:(?:\+1)?787|939)\d{7}$/,PS:/^(?:(?:\+970))(5[2349])\d{7}$/,PT:/^(?:(?:\+351)?9(1\d|2[1-9]|6[12345789]|7[12345789])\d{7})$/,PY:/^(?:(?:\+595|0)9[9876]\d{7})$/,RO:/^(?:(?:\+40|0))(?:7[2-8]\d{7}|21\d{8})$/,RS:/^(?:(?:\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/,RW:/^(?:(?:\+250)|(0))\d{9}$/,SI:/^(?:(?:\+386)|0)?[1-59]\d{7,8}$/,SK:/^(?:(?:\+421))?(0|9[0-8])\d{8}$/,SM:/^(?:(?:\+378)|(0549|6\d{4}))\d{5}$/,SN:/^(?:(?:\+221)|0)?[3679]\d{7}$/,SR:/^(?:(?:\+597))\d{7}$/,TG:/^(?:(?:\+228))\d{8}$/,TJ:/^(?:(?:\+992))(37|55|77)\d{7}$/,TN:/^(?:(?:\+216)|22|9[1-9])\d{7}$/,TR:/^(?:(?:\+90)|(0))\s?5\d{9}$/,TW:/^(?:(?:\+886)|0)?9\d{8}$/,UA:/^(?:(?:\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\d{7}$/,UG:/^(?:(?:\+256)|0)?[39]\d{8}$/},u={1:["US","AG","AI","AS","BB","BM","BS","CA","DM","DO","GD","GU","JM","KN","KY","LC","MP","MS","PR","SX","TC","TT","VC","VG","VI"],7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT","VA"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH","TA"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],380:["UA"],381:["RS"],382:["ME"],383:["XK"],385:["HR"],386:["SI"],387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],691:["FM"],692:["MH"],800:["001"],808:["001"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],870:["001"],878:["001"],880:["BD"],881:["001"],882:["001"],883:["001"],886:["TW"],888:["001"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],979:["001"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},$=x=>{if("+"===x.toString().charAt(0)){const e=x.toString().replace(/\D/g,""),n=[];for(const x in u)e.startsWith(x)&&n.push(...u[x]);return n.find((e=>{const n=y[e];if(n&&n.test(x.toString()))return e}))||""}for(const e in y){if(y[e].test(x.toString()))return e}return""},S=x=>{const e=x.replace(/[^0-9+]|(?!A)\+/g,"");return"+"===x[0]?`+${e}`:e};var b=n(((x,e)=>{const n=S(x.toString());if(e=e&&e in y?e:$(n),!x)return!1;if(e in y){return y[e].test(n)}return!1}));const g={IN:"xxxx xxxxxx",MY:"xx xxxxx xx",AE:"xx xxx xxxx",AL:"xxx xx xxxx",AM:"xx xx xx xx",AR:"xxxx-xxxx",AU:"xxx xxx xxx",AW:"xxx-xxxx",BB:"xxx-xxxx",BD:"xxxx-xxxxxx",BM:"xxx-xxxx",BN:"xxxx-xxxx",BO:"xxxx-xxxx",BS:"xxx-xxxx",BW:"xx xxxx xxxx",BZ:"xxx-xxxx",CA:"xxx-xxx-xxxx",CH:"xxx xxx xxx",CN:"xxxx-xxxxxxx",CO:"xxxx-xxxxxxx",CR:"xxxx-xxxx",CU:"xxxx-xxxx",CZ:"xxx xxx xxx",DK:"xx xx xx xx",DO:"xxx-xxxxxxx",DZ:"xxxx-xxxx-xxx",EG:"xx xxx xxxx",ET:"xx xxx xxxx",EU:"xxx xx xx xx",FJ:"xxxx xxxx",GB:"xxxx xxx xxx",GH:"xxx xxx xxxx",GI:"xxxx xxxx",GM:"xxxx-xxxx",GT:"xxxx-xxxx",GY:"xxx-xxxx",HK:"xxxx xxxx",HN:"xxxx-xxxx",HR:"xxx xxx xxxx",HT:"xxx-xxxx",HU:"xxx xxx xxxx",ID:"xxxx-xxxx-xxxx",IL:"xxxx-xxx-xxx",JM:"xxx-xxxx",KE:"xxx xxxxxx",KG:"xxx-xx-xx-xx",KH:"xxx-xxx-xxx",KY:"xxx-xxxx",KZ:"xxx-xxx-xx-xx",LA:"xxx xx xxxx",LK:"xx xxx xxxx",LR:"xxx-xxx-xxxx",LS:"xxx xx xxxx",LT:"xxx xxxxx",LU:"xxx xx xxx",LV:"xxxx xxxx",MA:"xxxx-xxxxxx",MD:"xx xxxxxx",ME:"xx xxxxxx",MG:"xx xx xx xx xx",MK:"xx xx xx xx",MM:"xx xxxxxx",MN:"xxx-xx-xxxx",MO:"xxxx xxxx",MU:"xx xxxx xxxx",MV:"xxxxxx",MW:"xx xxxx xxxx",MX:"xxx-xxx-xxxx",MZ:"xx xxxxxxx",NA:"xx xxxx xxxx",NG:"xxx xxx xxxx",NI:"xxxx-xxxx",NL:"xxx-xxxxxxx",NO:"xxxx xxxx",NP:"xxxx-xxxxxxx",NZ:"xxx-xxxxxxx",OM:"xxxx-xxxx",PA:"xxx-xxxx",PE:"xxx-xxx-xxx",PG:"xxx-xxxxxx",PH:"xxx-xxxx",PK:"xxx-xxxxxxx",PL:"xxx xxx xxx",PR:"xxx-xxx-xxxx",PS:"xxxx-xxxxxxx",PT:"xxx xxx xxx",PY:"xxx-xxxxxx",QA:"xxxx xxxx",RO:"xxx xxx xxxx",RS:"xxx xxxxx",RU:"xxx xxx-xx-xx",RW:"xxx xxxxxx",SA:"xxx-xxxxxxx",SC:"xx xxxxx",SE:"xxx-xxx xx xx",SG:"xxxx xxxx",SI:"xx xxxxxx",SK:"xxx xxx xxx",SL:"xxx-xxxxxx",SM:"xxxxx xxxxx",SN:"xx xxx xx xx",SO:"xxx xxxxxxx",SR:"xxx-xxxx",SS:"xxx xxxx xxx",SV:"xxxx-xxxx",SZ:"xxx xx xxxx",TG:"xx xx xx xx",TH:"xxx-xxxxxxx",TJ:"xxx xx xx xx",TL:"xxx-xxxxxxx",TN:"xx xxxxxx",TR:"xxx xxx xx xx",TT:"xxx-xxxx",TW:"xxxx-xxxxxx",TZ:"xxx xxx xxxx",UA:"xx xxx xx xx",UG:"xxx xxxxxxx",US:"xxx-xxx-xxxx",UY:"xxx-xxxxx",UZ:"xxx-xxx-xx-xx",VC:"xxx-xxxx",VE:"xxxx-xxx-xxxx",VN:"xxxx-xxxxxxx",YE:"xxxx-xxxx",ZA:"xxx-xxx-xxxx",ZM:"xxx-xxxxxxx",ZW:"xx xxx xxxx",KW:"xxx xx xxxx",BH:"xxxx xxxx"};var h=n(((x,e)=>{if(!x)throw new Error("Parameter `phoneNumber` is invalid!");x=x.toString(),x=S(x),e=e&&e in g?e:$(x);const n=g[e];if(!n)return x;let a=0;for(let x=0;x{if(!x)throw new Error("Parameter `phoneNumber` is invalid!");x=x.toString(),x=S(x);const n=e&&e in g?e:$(x),a=h(x,n),r=g[n];if(!r)return{countryCode:n||"",dialCode:"",formattedPhoneNumber:x,formatTemplate:""};let t=0;for(let x=0;x{const e=[{regex:/^(\d{4})\/(\d{2})\/(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3},{regex:/^(\d{2})\/(\d{2})\/(\d{4})$/,yearIndex:3,monthIndex:2,dayIndex:1},{regex:/^(\d{4})\.(\d{2})\.(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3},{regex:/^(\d{4})\.(\d{2})\.(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3},{regex:/^(\d{4})\.(\d{2})\.(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3},{regex:/^(\d{4})\.(\d{2})\.(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3},{regex:/^(\d{4})\.(\d{2})\.(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3},{regex:/^(\d{4})\.(\d{2})\.(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3},{regex:/^(\d{4})\/(\d{2})\/(\d{2}) (\d{2}):(\d{2}):(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3,hourIndex:4,minuteIndex:5,secondIndex:6},{regex:/^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2}):(\d{2})$/,yearIndex:3,monthIndex:2,dayIndex:1,hourIndex:4,minuteIndex:5,secondIndex:6},{regex:/^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3,hourIndex:4,minuteIndex:5,secondIndex:6},{regex:/^(\d{2})-(\d{2})-(\d{4}) (\d{2}):(\d{2}):(\d{2})$/,yearIndex:3,monthIndex:2,dayIndex:1,hourIndex:4,minuteIndex:5,secondIndex:6},{regex:/^(\d{4})\.(\d{2})\.(\d{2}) (\d{2}):(\d{2}):(\d{2})$/,yearIndex:1,monthIndex:2,dayIndex:3,hourIndex:4,minuteIndex:5,secondIndex:6},{regex:/^(\d{2})\.(\d{2})\.(\d{4}) (\d{2}):(\d{2}):(\d{2})$/,yearIndex:3,monthIndex:2,dayIndex:1,hourIndex:4,minuteIndex:5,secondIndex:6}];for(const n of e){const e=x.match(n.regex);if(e){const x=e[n.yearIndex],a=e[n.monthIndex],r=e[n.dayIndex],t=n.hourIndex?e[n.hourIndex]:"00",o=n.minuteIndex?e[n.minuteIndex]:"00",d=n.secondIndex?e[n.secondIndex]:"00";return new Date(`${x}-${a}-${r}T${t}:${o}:${d}`)}}throw new Error("Date format not recognized")};var f=n(((x,e,n)=>{switch(x="string"==typeof x?new Date(I(x)):new Date(x),n){case"days":x.setDate(x.getDate()+e);break;case"months":x.setMonth(x.getMonth()+e);break;case"years":x.setFullYear(x.getFullYear()+e)}return x}));var N=n(((x,e,n={})=>{e||(e=r.getState().locale||s());const a=(x="string"==typeof x?new Date(I(x)):new Date(x))instanceof Date?x:new Date(x);let t;try{t=new Intl.DateTimeFormat(e,n)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return t.format(a)}));var A=n(((x,e,n={})=>{e||(e=r.getState().locale||s());const a=Object.assign(Object.assign({},n),{timeStyle:void 0});let t;try{t=N(x,e,a)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return t}));var E=n(((x,e,n={})=>{e||(e=r.getState().locale||s());const a=Object.assign(Object.assign({},n),{dateStyle:void 0});let t;try{t=N(x,e,a)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return t}));var T=n(((x,e={})=>{let n;x||(x=r.getState().locale||s()),e.weekday||(e.weekday="long");try{const a=new Intl.DateTimeFormat(x,e),r=new Date(2e3,0,2);n=a.format(r)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}const a=Array.from({length:7},((n,a)=>new Intl.DateTimeFormat(x,e).format(new Date(2e3,0,2+a)))),t=a.indexOf(n);if(-1===t)throw new Error("Unable to determine the first day of the week");return a[(t+1)%7]}));var K=n((x=>(x="string"==typeof x?new Date(I(x)):new Date(x),Math.ceil((x.getMonth()+1)/3))));var R=n(((x,e=new Date,n,a)=>{x="string"==typeof x?new Date(I(x)):new Date(x),e="string"==typeof e?new Date(I(e)):new Date(e),n||(n=r.getState().locale||s());const t=(x.getTime()-e.getTime())/1e3,o=3600,d=86400,Y=7*d,D=30*d,i=365*d;let M,m,l;Math.abs(t)<60?(M=t,m="second"):Math.abs(t){x="string"==typeof x?new Date(I(x)):new Date(x);const e=new Date(x.getFullYear(),0,1),n=(x.getTime()-e.getTime())/864e5;return Math.ceil((n+e.getDay()+1)/7)}));var P=n(((x,e={})=>{try{x||(x=r.getState().locale||s()),e.weekday||(e.weekday="long");const n=new Intl.DateTimeFormat(x,e);return Array.from({length:7},((x,e)=>n.format(new Date(1970,0,4+e))))}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}}));var B=n(((x,e)=>{x="string"==typeof x?new Date(I(x)):new Date(x),e="string"==typeof e?new Date(I(e)):new Date(e);return(x instanceof Date?x:new Date(x))>(e instanceof Date?e:new Date(e))}));var C=n(((x,e)=>{x="string"==typeof x?new Date(I(x)):new Date(x),e="string"==typeof e?new Date(I(e)):new Date(e);return(x instanceof Date?x:new Date(x))<(e instanceof Date?e:new Date(e))}));var L=n((x=>x%4==0&&x%100!=0||x%400==0));var p=n(((x,e)=>(x="string"==typeof x?new Date(I(x)):new Date(x),e="string"==typeof e?new Date(I(e)):new Date(e),x.getDate()===e.getDate()&&x.getMonth()===e.getMonth()&&x.getFullYear()===e.getFullYear())));var H=n((x=>{try{x="string"==typeof x?new Date(I(x)):new Date(x)}catch(x){throw x instanceof Error?new Error(x.message):new Error(`An unknown error occurred = ${x}`)}return x instanceof Date&&!isNaN(x.getTime())}));const O={"ar-AE":"DD/MM/YYYY","sq-AL":"DD.MM.YYYY","hy-AM":"DD.MM.YYYY","es-AR":"DD/MM/YYYY","en-AU":"DD/MM/YYYY","nl-AW":"DD-MM-YYYY","en-BB":"MM/DD/YYYY","bn-BD":"DD/MM/YYYY","en-BM":"MM/DD/YYYY","ms-BN":"DD/MM/YYYY","es-BO":"DD/MM/YYYY","en-BS":"MM/DD/YYYY","en-BW":"DD/MM/YYYY","en-BZ":"MM/DD/YYYY","en-CA":"DD/MM/YYYY","de-CH":"DD.MM.YYYY","zh-CN":"YYYY/MM/DD","es-CO":"DD/MM/YYYY","es-CR":"DD/MM/YYYY","es-CU":"DD/MM/YYYY","cs-CZ":"DD.MM.YYYY","da-DK":"DD-MM-YYYY","es-DO":"DD/MM/YYYY","ar-DZ":"DD/MM/YYYY","ar-EG":"DD/MM/YYYY","am-ET":"DD/MM/YYYY","en-EU":"DD/MM/YYYY","en-FJ":"DD/MM/YYYY","en-GB":"DD/MM/YYYY","en-GH":"DD/MM/YYYY","en-GI":"DD/MM/YYYY","en-GM":"DD/MM/YYYY","es-GT":"DD/MM/YYYY","en-GY":"DD/MM/YYYY","en-HK":"DD/MM/YYYY","es-HN":"DD/MM/YYYY","hr-HR":"DD.MM.YYYY","ht-HT":"MM/DD/YYYY","hu-HU":"YYYY. MM. DD.","id-ID":"DD/MM/YYYY","he-IL":"DD/MM/YYYY","en-IN":"DD-MM-YYYY","en-JM":"MM/DD/YYYY","en-KE":"DD/MM/YYYY","ky-KG":"DD.MM.YYYY","km-KH":"DD/MM/YYYY","en-KY":"MM/DD/YYYY","kk-KZ":"DD.MM.YYYY","lo-LA":"DD/MM/YYYY","si-LK":"YYYY-MM-DD","en-LR":"MM/DD/YYYY","en-LS":"DD/MM/YYYY","ar-MA":"DD/MM/YYYY","ro-MD":"DD.MM.YYYY","mk-MK":"DD.MM.YYYY","my-MM":"DD/MM/YYYY","mn-MN":"YYYY.MM.DD","zh-MO":"DD/MM/YYYY","en-MU":"DD/MM/YYYY","dv-MV":"DD/MM/YYYY","en-MW":"DD/MM/YYYY","es-MX":"DD/MM/YYYY","ms-MY":"DD/MM/YYYY","en-NA":"DD/MM/YYYY","en-NG":"DD/MM/YYYY","es-NI":"DD/MM/YYYY","no-NO":"DD.MM.YYYY","ne-NP":"YYYY/MM/DD","en-NZ":"DD/MM/YYYY","es-PE":"DD/MM/YYYY","en-PG":"DD/MM/YYYY","en-PH":"MM/DD/YYYY","en-PK":"DD/MM/YYYY","ar-QA":"DD/MM/YYYY","ru-RU":"DD.MM.YYYY","ar-SA":"DD/MM/YYYY","en-SC":"DD/MM/YYYY","sv-SE":"YYYY-MM-DD","en-SG":"DD/MM/YYYY","en-SL":"DD/MM/YYYY","so-SO":"DD/MM/YYYY","en-SS":"DD/MM/YYYY","es-SV":"DD/MM/YYYY","en-SZ":"DD/MM/YYYY","th-TH":"DD/MM/YYYY","en-TT":"MM/DD/YYYY","sw-TZ":"DD/MM/YYYY","en-US":"MM/DD/YYYY","es-UY":"DD/MM/YYYY","uz-UZ":"DD/MM/YYYY","ar-YE":"DD/MM/YYYY","en-ZA":"YYYY/MM/DD","ar-KW":"DD/MM/YYYY","ar-BH":"DD/MM/YYYY","ar-OM":"DD/MM/YYYY"};var U=n(((x,e)=>{const n=e.includes("/")?"/":e.includes(".")?".":"-",a=e.split(n),r=x.split(n).map((x=>parseInt(x,10)));let t=0,o=0,d=0,s=!1,Y=!1,D=!1;if(r.length!==a.length)return null;if(a.forEach(((x,e)=>{if(isNaN(r[e]))return null;switch(x){case"DD":d=r[e],D=!0;break;case"MM":o=r[e]-1,Y=!0;break;case"YYYY":t=r[e],s=!0}})),s&&Y&&D){const x=new Date(t,o,d);if(x.getFullYear()===t&&x.getMonth()===o&&x.getDate()===d)return x}return null}));var v=n(((x,e)=>{e||(e=r.getState().locale||s());const n=O[e];if(!n)throw new Error(`No date format found for locale: ${e}`);return U(x,n)}));var Z=n(((x,e,n)=>(x="string"==typeof x?new Date(I(x)):new Date(x),f(x,-e,n))));x.add=f,x.formatDate=A,x.formatDateTime=N,x.formatNumber=D,x.formatNumberByParts=c,x.formatPhoneNumber=h,x.formatTime=E,x.getCurrencyList=M,x.getCurrencySymbol=m,x.getFirstDayOfWeek=T,x.getQuarter=K,x.getRelativeTime=R,x.getState=t,x.getWeek=G,x.getWeekdays=P,x.isAfter=B,x.isBefore=C,x.isLeapYear=L,x.isSameDay=p,x.isValidDate=H,x.isValidPhoneNumber=b,x.parseDate=v,x.parsePhoneNumber=w,x.resetState=d,x.setState=o,x.subtract=Z})); -//# sourceMappingURL=index.min.js.map diff --git a/lib/umd/index.min.js.map b/lib/umd/index.min.js.map deleted file mode 100644 index 828fead7..00000000 --- a/lib/umd/index.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.min.js","sources":["../../src/common/errorBoundary/index.ts","../../src/modules/.internal/state/index.ts","../../src/modules/.internal/utils/getDefaultState.ts","../../src/modules/core/getState.ts","../../src/modules/core/setState.ts","../../src/modules/core/resetState.ts","../../src/modules/.internal/utils/getLocale.ts","../../src/modules/.internal/utils/getIntlInstanceWithOptions.ts","../../src/modules/currency/formatNumber.ts","../../src/modules/currency/data/currencies.ts","../../src/modules/currency/getCurrencyList.ts","../../src/modules/currency/getCurrencySymbol.ts","../../src/modules/currency/constants.ts","../../src/modules/currency/formatNumberByParts.ts","../../src/modules/phoneNumber/data/phoneRegexMapper.ts","../../src/modules/phoneNumber/data/dialCodeMapper.ts","../../src/modules/phoneNumber/utils.ts","../../src/modules/phoneNumber/isValidPhoneNumber.ts","../../src/modules/phoneNumber/data/phoneFormatterMapper.ts","../../src/modules/phoneNumber/formatPhoneNumber.ts","../../src/modules/phoneNumber/parsePhoneNumber.ts","../../src/modules/dateTime/utils.ts","../../src/modules/dateTime/add.ts","../../src/modules/dateTime/formatDateTime.ts","../../src/modules/dateTime/formatDate.ts","../../src/modules/dateTime/formatTime.ts","../../src/modules/dateTime/getFirstDayOfWeek.ts","../../src/modules/dateTime/getQuarter.ts","../../src/modules/dateTime/getRelativeTime.ts","../../src/modules/dateTime/getWeek.ts","../../src/modules/dateTime/getWeekdays.ts","../../src/modules/dateTime/isAfter.ts","../../src/modules/dateTime/isBefore.ts","../../src/modules/dateTime/isLeapYear.ts","../../src/modules/dateTime/isSameDay.ts","../../src/modules/dateTime/isValidDate.ts","../../src/modules/dateTime/data/localeDateFormats.ts","../../src/modules/dateTime/parseDateWithFormat.ts","../../src/modules/dateTime/parseDate.ts","../../src/modules/dateTime/subtract.ts"],"sourcesContent":["// Custom Error class to extend properties to error object\nexport class I18nifyError extends Error {\n timestamp: Date;\n constructor(message: string | undefined) {\n super(message);\n this.name = 'i18nify Error';\n this.timestamp = new Date();\n // more params like type of error/severity can be added in future for better debugging.\n }\n}\n\n/**\n * withErrorBoundary is a higher order function that takes function as parameter and wraps it in try/catch block.\n * It appends additional attributes and serves as a centralized error-handling service.\n * Usage =>\n * const wrappedUtilityFn = withErrorBoundary(utilityFn)\n *\n * @param fn utility that is wrapped in error boundary\n * @returns {Function} returns the function wrapped in try/catch block\n */\nexport const withErrorBoundary = any>(\n fn: T,\n): ((...args: Parameters) => ReturnType) => {\n return function (this: unknown, ...rest: Parameters): ReturnType {\n try {\n return fn.call(this, ...rest) as ReturnType;\n } catch (err) {\n console.warn('[I18N Error]: ', err);\n // Currently, we are throwing the error as it is to consumers.\n // In the future, this can be modified as per our requirement, like an error logging service.\n throw new I18nifyError(err as string | undefined);\n }\n };\n};\n","import { I18nState } from './types';\nimport { getDefaultState } from '../utils/getDefaultState';\n\nexport class I18nStateManager {\n private static instance: I18nStateManager | undefined;\n private state: I18nState;\n\n private constructor() {\n this.state = getDefaultState();\n }\n\n public static getInstance(): I18nStateManager {\n if (!I18nStateManager.instance) {\n I18nStateManager.instance = new I18nStateManager();\n }\n\n return I18nStateManager.instance;\n }\n\n public static resetInstance(): void {\n I18nStateManager.instance = undefined;\n }\n\n public getState(): I18nState {\n return { ...this.state };\n }\n\n public setState(newState: Partial): void {\n this.state = { ...this.state, ...newState };\n }\n\n public resetState(): void {\n this.state = getDefaultState();\n }\n}\n\nexport default I18nStateManager.getInstance();\n","import type { I18nState } from '../state/types';\n\nexport function getDefaultState(): I18nState {\n return {\n locale: '',\n direction: '',\n country: '',\n };\n}\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * function to return active i18n state\n *\n * ===== USAGE =====\n * import { getState } from '@razorpay/i18nify-js';\n *\n * console.log(getState())\n *\n * @returns i18n state\n */\nconst getState = (): I18nState => {\n return state.getState();\n};\n\nexport default withErrorBoundary(getState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { I18nState } from '../.internal/state/types';\n\n/**\n * Function to set and override the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { setState } from \"@razorpay/i18nify-js\";\n * setState({locale: 'en-US'})\n *\n * @param newState data to set in i18nState instance\n */\nconst setState = (newState: Partial): void => {\n state.setState(newState);\n};\n\nexport default withErrorBoundary(setState);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\n\n/**\n * Function to reset the active state in i18nify SDK\n *\n * ===== USAGE =====\n * import { resetState } from \"@razorpay/i18nify-js\";\n * resetState()\n *\n * @param newState data to set in i18nState instance\n */\nconst resetState = (): void => {\n state.resetState();\n};\n\nexport default withErrorBoundary(resetState);\n","export const getLocale = (): string => {\n // Check if running in a non-browser environment (e.g., Node.js or older browsers).\n if (typeof navigator === 'undefined') {\n return 'en-IN';\n }\n\n // Check if the browser supports the Intl object and user language preferences.\n if (\n window.Intl &&\n typeof window.Intl === 'object' &&\n (window.navigator.languages || window.navigator.language)\n ) {\n const userLocales = window.navigator.languages || [\n window.navigator.language,\n ];\n return userLocales[0];\n }\n\n // Fallback to a supported locale or the default locale.\n return 'en-IN';\n};\n","import { CURRENCIES } from '../../currency/data/currencies';\nimport state from '../state';\nimport { getLocale } from './getLocale';\n\nexport const getIntlInstanceWithOptions = (\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n) => {\n /** retrieve locale from below areas in order of preference\n * 1. options.locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n let locale = options?.locale || state.getState().locale;\n\n // If a specific locale is provided, use it; otherwise, use the browser's locale\n if (!locale) {\n locale = getLocale();\n }\n\n const intlOptions = options?.intlOptions ? { ...options.intlOptions } : {};\n\n if (options?.currency || intlOptions.currency) {\n intlOptions.style = 'currency';\n intlOptions.currency = (options.currency || intlOptions.currency) as string;\n }\n\n if (!locale) throw new Error('Pass valid locale !');\n\n return new Intl.NumberFormat(locale || undefined, intlOptions);\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\n\n// this function formats number based on different arguments passed\nconst formatNumber = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): string => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n let formattedAmount = '';\n\n try {\n formattedAmount = getIntlInstanceWithOptions(options).format(\n Number(amount),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedAmount;\n};\n\nexport default withErrorBoundary(formatNumber);\n","export const CURRENCIES: { [key: string]: { symbol: string; name: string } } = {\n AED: { symbol: 'د.إ', name: 'United Arab Emirates Dirham' },\n ALL: { symbol: 'Lek', name: 'Albanian Lek' },\n AMD: { symbol: '֏', name: 'Armenian Dram' },\n ARS: { symbol: 'ARS', name: 'Argentine Peso' },\n AUD: { symbol: 'A$', name: 'Australian Dollar' },\n AWG: { symbol: 'Afl.', name: 'Aruban Florin' },\n BBD: { symbol: '$', name: 'Barbadian Dollar' },\n BDT: { symbol: '৳', name: 'Bangladeshi Taka' },\n BMD: { symbol: '$', name: 'Bermudian Dollar' },\n BND: { symbol: 'BND', name: 'Brunei Dollar' },\n BOB: { symbol: 'Bs', name: 'Bolivian Boliviano' },\n BSD: { symbol: 'B$', name: 'Bahamian Dollar' },\n BWP: { symbol: 'P', name: 'Botswanan Pula' },\n BZD: { symbol: 'BZ$', name: 'Belize Dollar' },\n CAD: { symbol: 'C$', name: 'Canadian Dollar' },\n CHF: { symbol: 'CHf', name: 'Swiss Franc' },\n CNY: { symbol: '¥', name: 'Chinese Yuan' },\n COP: { symbol: 'COL$', name: 'Colombian Peso' },\n CRC: { symbol: '₡', name: 'Costa Rican Colón' },\n CUP: { symbol: '$MN', name: 'Cuban Peso' },\n CZK: { symbol: 'Kč', name: 'Czech Koruna' },\n DKK: { symbol: 'DKK', name: 'Danish Krone' },\n DOP: { symbol: 'RD$', name: 'Dominican Peso' },\n DZD: { symbol: 'د.ج', name: 'Algerian Dinar' },\n EGP: { symbol: 'E£', name: 'Egyptian Pound' },\n ETB: { symbol: 'ብር', name: 'Ethiopian Birr' },\n EUR: { symbol: '€', name: 'Euro' },\n FJD: { symbol: 'FJ$', name: 'Fijian Dollar' },\n GBP: { symbol: '£', name: 'British Pound' },\n GHS: { symbol: 'GH₵', name: 'Ghanaian Cedi' },\n GIP: { symbol: 'GIP', name: 'Gibraltar Pound' },\n GMD: { symbol: 'D', name: 'Gambian Dalasi' },\n GTQ: { symbol: 'Q', name: 'Guatemalan Quetzal' },\n GYD: { symbol: 'G$', name: 'Guyanese Dollar' },\n HKD: { symbol: 'HK$', name: 'Hong Kong Dollar' },\n HNL: { symbol: 'HNL', name: 'Honduran Lempira' },\n HRK: { symbol: 'kn', name: 'Croatian Kuna' },\n HTG: { symbol: 'G', name: 'Haitian Gourde' },\n HUF: { symbol: 'Ft', name: 'Hungarian Forint' },\n IDR: { symbol: 'Rp', name: 'Indonesian Rupiah' },\n ILS: { symbol: '₪', name: 'Israeli New Shekel' },\n INR: { symbol: '₹', name: 'Indian Rupee' },\n JMD: { symbol: 'J$', name: 'Jamaican Dollar' },\n KES: { symbol: 'Ksh', name: 'Kenyan Shilling' },\n KGS: { symbol: 'Лв', name: 'Kyrgystani Som' },\n KHR: { symbol: '៛', name: 'Cambodian Riel' },\n KYD: { symbol: 'CI$', name: 'Cayman Islands Dollar' },\n KZT: { symbol: '₸', name: 'Kazakhstani Tenge' },\n LAK: { symbol: '₭', name: 'Laotian Kip' },\n LKR: { symbol: 'රු', name: 'Sri Lankan Rupee' },\n LRD: { symbol: 'L$', name: 'Liberian Dollar' },\n LSL: { symbol: 'LSL', name: 'Lesotho Loti' },\n MAD: { symbol: 'د.م.', name: 'Moroccan Dirham' },\n MDL: { symbol: 'MDL', name: 'Moldovan Leu' },\n MKD: { symbol: 'ден', name: 'Macedonian Denar' },\n MMK: { symbol: 'MMK', name: 'Myanmar Kyat' },\n MNT: { symbol: '₮', name: 'Mongolian Tugrik' },\n MOP: { symbol: 'MOP$', name: 'Macanese Pataca' },\n MUR: { symbol: '₨', name: 'Mauritian Rupee' },\n MVR: { symbol: 'Rf', name: 'Maldivian Rufiyaa' },\n MWK: { symbol: 'MK', name: 'Malawian Kwacha' },\n MXN: { symbol: 'Mex$', name: 'Mexican Peso' },\n MYR: { symbol: 'RM', name: 'Malaysian Ringgit' },\n NAD: { symbol: 'N$', name: 'Namibian Dollar' },\n NGN: { symbol: '₦', name: 'Nigerian Naira' },\n NIO: { symbol: 'NIO', name: 'Nicaraguan Córdoba' },\n NOK: { symbol: 'NOK', name: 'Norwegian Krone' },\n NPR: { symbol: 'रू', name: 'Nepalese Rupee' },\n NZD: { symbol: 'NZ$', name: 'New Zealand Dollar' },\n PEN: { symbol: 'S/', name: 'Peruvian Nuevo Sol' },\n PGK: { symbol: 'PGK', name: 'Papua New Guinean Kina' },\n PHP: { symbol: '₱', name: 'Philippine Peso' },\n PKR: { symbol: '₨', name: 'Pakistani Rupee' },\n QAR: { symbol: 'QR', name: 'Qatari Riyal' },\n RUB: { symbol: '₽', name: 'Russian Ruble' },\n SAR: { symbol: 'SR', name: 'Saudi Riyal' },\n SCR: { symbol: 'SRe', name: 'Seychellois Rupee' },\n SEK: { symbol: 'SEK', name: 'Swedish Krona' },\n SGD: { symbol: 'S$', name: 'Singapore Dollar' },\n SLL: { symbol: 'Le', name: 'Sierra Leonean Leone' },\n SOS: { symbol: 'Sh.so.', name: 'Somali Shilling' },\n SSP: { symbol: 'SS£', name: 'South Sudanese Pound' },\n SVC: { symbol: '₡', name: 'Salvadoran Colón' },\n SZL: { symbol: 'E', name: 'Swazi Lilangeni' },\n THB: { symbol: '฿', name: 'Thai Baht' },\n TTD: { symbol: 'TT$', name: 'Trinidad and Tobago Dollar' },\n TZS: { symbol: 'Sh', name: 'Tanzanian Shilling' },\n USD: { symbol: '$', name: 'United States Dollar' },\n UYU: { symbol: '$U', name: 'Uruguayan Peso' },\n UZS: { symbol: \"so'm\", name: 'Uzbekistani Som' },\n YER: { symbol: '﷼', name: 'Yemeni Rial' },\n ZAR: { symbol: 'R', name: 'South African Rand' },\n KWD: { symbol: 'د.ك', name: 'Kuwaiti Dinar' },\n BHD: { symbol: 'د.ب.', name: 'Bahraini Dinar' },\n OMR: { symbol: 'ر.ع.', name: 'Omani Rial' },\n};\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencyList = () => {\n return CURRENCIES;\n};\n\nexport default withErrorBoundary(getCurrencyList);\n","import { CURRENCIES } from './data/currencies';\nimport { withErrorBoundary } from '../../common/errorBoundary';\n\nconst getCurrencySymbol = (currencyCode: keyof typeof CURRENCIES): string => {\n if (currencyCode in CURRENCIES) return CURRENCIES[currencyCode]?.symbol;\n else throw new Error('Invalid currencyCode!');\n};\n\nexport default withErrorBoundary(getCurrencySymbol);\n","export const ALLOWED_FORMAT_PARTS_KEYS = [\n 'nan',\n 'infinity',\n 'percent',\n 'integer',\n 'group',\n 'decimal',\n 'fraction',\n 'plusSign',\n 'minusSign',\n 'percentSign',\n 'currency',\n 'code',\n 'symbol',\n 'name',\n 'compact',\n 'exponentInteger',\n 'exponentMinusSign',\n 'exponentSeparator',\n 'unit',\n] as const;\n","import { CURRENCIES } from './data/currencies';\nimport { ByParts, FormattedPartsObject } from './types';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { getIntlInstanceWithOptions } from '../.internal/utils';\nimport { ALLOWED_FORMAT_PARTS_KEYS } from './constants';\n\nconst formatNumberByParts = (\n amount: string | number,\n options: {\n currency?: keyof typeof CURRENCIES;\n locale?: string;\n intlOptions?: Intl.NumberFormatOptions;\n } = {},\n): ByParts => {\n if (!Number(amount) && Number(amount) !== 0)\n throw new Error('Parameter `amount` is not a number!');\n\n try {\n const formattedAmount = getIntlInstanceWithOptions(options).formatToParts(\n Number(amount),\n );\n\n const parts = formattedAmount;\n\n const formattedObj: FormattedPartsObject = {};\n\n parts.forEach((p) => {\n if (p.type === 'group') {\n formattedObj.integer = (formattedObj.integer || '') + p.value;\n } else if (\n ALLOWED_FORMAT_PARTS_KEYS.findIndex((item) => item === p.type) != -1\n ) {\n // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal' is skipped\n formattedObj[p.type] = (formattedObj[p.type] || '') + p.value;\n }\n });\n\n return {\n ...formattedObj,\n isPrefixSymbol: parts[0].type === 'currency',\n rawParts: parts,\n };\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(\n formatNumberByParts,\n);\n","export const PHONE_REGEX_MAPPER: { [key: string]: RegExp } = {\n IN: /^(?:(?:\\+|0{0,2})91\\s*[-]?\\s*|[0]?)?[6789]\\d{9}$/,\n MY: /^(\\+?6?0)?(\\d{1,3})[-. ]?(\\d{7,8})$/,\n AE: /^(?:\\+?971|0)?(?:2|3|4|6|7|9)\\d{8}$/,\n AL: /^(?:\\+?355)?(?:[4-9]\\d{7}|6\\d{8})$/,\n AM: /^(?:\\+?374)?(?:[0-9]{8}|[0-9]{6}[0-9]{2})$/,\n AR: /^(?:(?:\\+|0{0,2})54)?(?:11|[2368]\\d)(?:(?=\\d{0,2}15)\\d{2})??\\d{8}$/,\n AU: /^(?:\\+?61|0)4\\d{8}$/,\n AW: /^(?:(?:\\+297)?(?!0)\\d{7})$/,\n BB: /^(?:(?:\\+1)?246)?(?:\\d{3})?\\d{7}$/,\n BD: /^(?:\\+?880|0)1[13456789]\\d{8}$/,\n BM: /^(?:(?:\\+1)?441)?(?:\\d{2})?\\d{7}$/,\n BN: /^(?:\\+?673)?(?:\\d{3})?\\d{4}$/,\n BO: /^(?:(?:\\+|0{0,2})591)?(?:(?:2|3|7|6)\\d{7})$/,\n BS: /^(?:(?:\\+1)?242)?(?:\\d{3})?\\d{7}$/,\n BW: /^(?:(?:\\+267)?\\s?)?[74]\\d{7}$/,\n BZ: /^(?:(?:\\+501)?\\s?)?[622]\\d{4}$/,\n CH: /^(?:(?:\\+41|0)(?:\\s*\\(?0\\)?\\s*))?(?:\\d{2}\\s*)?\\d{3}\\s*\\d{2}\\s*\\d{2}$/,\n CN: /^(?:(?:\\+|00)86)?1\\d{10}$/,\n CO: /^(?:(?:\\+57|0057)?)?[1-8]{1}\\d{6,7}$/,\n OM: /^(?:\\+?968)?(?:95|96|97|98)\\d{6}$/,\n CR: /^(?:(?:\\+506)?\\s*|0)?[1-9]\\d{7}$/,\n CU: /^(?:\\+?53)?(?:[5-8]\\d{7})$/,\n CZ: /^(?:\\+?420)?(?:\\d{9})$/,\n DK: /^(?:\\+?45)?(?:\\d{8})$/,\n DO: /^(?:(?:\\+1)?809|1-8(?:00|88|89))(?:\\d{7})$/,\n DZ: /^(?:\\+?213|0)([567]\\d{8})$/,\n EG: /^(?:(?:\\+20|20)?(\\d{10}))$/,\n ET: /^(?:\\+?251)?[1-59]\\d{8}$/,\n EU: /^(?:(?:\\+?3)?8)?\\s*(?:\\d{3}\\s*){3}\\d{2}$/,\n FJ: /^(?:(?:\\+?679)?\\s?\\d{3}\\s?\\d{4})?$/,\n GB: /^(?:(?:\\+44\\s?|0)7\\d{3}(\\s?\\d{4,})?)$/,\n GH: /^(?:(?:\\+233)|0)?(?:\\d{9})$/,\n GI: /^(?:\\+350)?\\d{5}$/,\n GM: /^(?:\\+220)?\\d{5,7}$/,\n GT: /^(?:\\+502)?[2468]\\d{7,8}$/,\n GY: /^(?:(?:\\+592)?(?:(?:\\s)?[2-9])(?:(?:\\s)?\\d))?(?:(?:\\s)?\\d{4})$/,\n HK: /^(?:\\+852\\s?)?[456789]\\d{3}\\s?\\d{4}$/,\n HN: /^(?:\\+504)?[89]\\d{7}$/,\n HR: /^(?:\\+?385)?\\d{8,9}$/,\n HT: /^(?:\\+?509)?\\d{8}$/,\n HU: /^(?:(?:\\+36))(\\s?\\d{2}\\s?\\d{3}\\s?\\d{4})$/,\n ID: /^(?:\\+?62|0[1-9])[\\s-]?\\d{2,4}[\\s-]?\\d{3,4}[\\s-]?\\d{3,4}$/,\n IL: /^(?:(?:\\+972|0)(?:-)?)[23489]\\d{7}$/,\n JM: /^(?:(?:\\+1876))\\d{7,10}$/,\n KE: /^(?:(?:\\+254)|(?:0))(?:\\d{6,7})$/,\n KG: /^(?:\\+996)?\\s?\\d{9}$/,\n KH: /^(?:(?:\\+855)|(?:0))(?:\\s?[1-9]\\d{7,8})$/,\n KY: /^(?:\\+?1\\s?(345))\\d{6}$/,\n KZ: /^(?:\\+?7|8)?7\\d{9}$/,\n LA: /^(?:(?:\\+?856)|0)(20\\d{7,9})$/,\n LK: /^(?:(?:\\+94)|0)(?:\\d{9})$/,\n LR: /^(?:\\+231)[ -\\d]{4}[ -\\d]{4}$/,\n LS: /^(?:(?:\\+?266)|0)?[56]\\d{7}$/,\n MA: /^(?:(?:\\+?212(\\s*[-|\\s*]?\\d{1,9})?)|(?:0))(?:\\d{9})$/,\n MD: /^(?:(?:\\+373)|(?:0))(?:\\d{7,8})$/,\n MK: /^(?:\\+389|0)(?:(?:2[0-4]|[3-9])\\s?)?\\d{6}$/,\n MM: /^(?:(?:\\+?95)|0)?[1-9]\\d{9}$/,\n MN: /^(?:\\+976|0)\\d{8}$/,\n MO: /^(?:(?:\\+?853)|[0-9])?\\d{8}$/,\n MU: /^(?:\\+230|0)?\\d{8}$/,\n MV: /^(?:(?:\\+?960)|0)?\\d{7}$/,\n MW: /^(?:\\+265)[1-9]\\d{6}$/,\n MX: /^(?:(?:\\+?52)?\\s?(?:1|01)?\\s?)?(?:\\d{3}\\s?\\d{3}\\s?\\d{4})$/,\n NA: /^(?:(?:\\+264)|0)?\\d{8}$/,\n NG: /^(?:(?:\\+234)|(?:0))(?:\\d{7,8})$/,\n NI: /^(?:(?:\\+505))?(?:\\d{8})$/,\n NO: /^(?:(?:\\+?47)|\\d{2}|\\d{3})\\s?\\d{2}\\s?\\d{3}$/,\n NP: /^(?:(?:\\+977))?(\\d{9,10})$/,\n NZ: /^(?:\\+?64|0)(\\d{2,5} \\d{4,8}|\\d{3,4} \\d{4})$/,\n PE: /^(?:(?:\\+51)|0)?(?:9\\d{8})$/,\n PG: /^(?:\\+?675)?(?:[7-9]\\d{7})$/,\n PH: /^(?:(?:\\+?63)|0)(?:\\d{10})$/,\n PK: /^(?:(?:\\+92)|0)?[345]\\d{9}$/,\n QA: /^(?:\\+?974)?-?33\\d{5}$/,\n RU: /^(?:\\+?7|8)?[ -]?\\(?9\\d{2}\\)?[ -]?\\d{3}[ -]?\\d{2}[ -]?\\d{2}$/,\n SA: /^(?:\\+?966)?\\s?1?[\\s-]?(?:[45]\\d{2}|5\\d{3})[\\s-]?\\d{4}$/,\n SC: /^(?:(?:\\+248)|\\d{4})\\d{5}$/,\n SE: /^(?:\\+?46|0)\\s?[1-57-9](?:[0-9]\\s?){8}$/,\n SG: /^(?:(?:\\+65)|(?:\\(\\+65\\))|(?:65))\\d{4}\\d{4}$/,\n SL: /^(?:(?:\\+232)|(?:0))?\\d{9}$/,\n SO: /^(?:\\+252|0)?[567]\\d{7}$/,\n SS: /^(?:\\+211|0)?[1-9]\\d{7,9}$/,\n SV: /^(?:(?:\\+?503)|(?:0))(?:\\d{8})$/,\n SZ: /^(?:\\+?268)?\\d{7,8}$/,\n TH: /^(?:(?:\\+66)|0)\\d{9}$/,\n TT: /^(?:(?:\\+?1-868)|\\(?868\\)?)(\\d{7})$/,\n TZ: /^(?:(?:\\+?255)|0)?[67]\\d{8}$/,\n US: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n CA: /^(\\+\\d{1,2}\\s?)?([2-9]{1}\\d{2}[2-9]{1}\\d{6})$/,\n UY: /^(?:(?:\\+598|0)\\s?(9\\d{3}|2\\d{2}|[4-9]\\d{6}))$/,\n UZ: /^(?:\\+?998)?\\s?[3456789]\\d{8}$/,\n YE: /^(?:\\+?967)?(?:\\d{7,8})$/,\n ZA: /^(?:(?:\\+27)|0)(\\d{9})$/,\n KW: /^(?:\\+?965)[569]\\d{7}$/,\n BH: /^(?:\\+?973)?[356]\\d{7}$/,\n TL: /^(?:(?:\\+670)\\s?)?[0-9]{3}\\s?[0-9]{3,4}$/,\n VC: /^(?:(?:\\+1)?784)?(?:\\d{3})?\\d{7}$/,\n VE: /^(?:(?:\\+58)|0)?4\\d{9}$/,\n VN: /^(?:(?:\\+84)|0)?[1-9]\\d{8}$/,\n ZM: /^(?:(?:\\+260)|0)?[123456789]\\d{8,9}$/,\n ZW: /^(?:(?:\\+263)|0)?(?:\\d{9,10})$/,\n LT: /^(?:(?:\\+370)|8)\\d{8}$/,\n LU: /^(?:(?:\\+352)?(6|2(6|7|8|9))\\d{6})$/,\n LV: /^(?:(?:\\+371)?2\\d{7})$/,\n ME: /^(?:(?:\\+382)?[67]\\d{7,20})$/,\n MG: /^(?:(?:\\+261)?3[234568]\\d{7})$/,\n MZ: /^(?:(?:\\+258)|(?:258))?8[234567]\\d{7,8}$/,\n NL: /^(?:(?:\\+31)|0(6(?:\\d{8})|[1-9](?:(?:\\d{8})|(?:\\s\\d{3}\\s\\d{4}))|(?:\\d{8})))$/,\n PA: /^(?:(?:\\+507)\\s?)?[46]\\d{6,7}$/,\n PL: /^(?:(?:\\+48)?(?:\\s?\\d{3}\\s?\\d{3}\\s?\\d{3}|(?:\\d{2}\\s?){4}\\d{2}|\\d{3}-\\d{3}-\\d{3}))$/,\n PR: /^(?:(?:\\+1)?787|939)\\d{7}$/,\n PS: /^(?:(?:\\+970))(5[2349])\\d{7}$/,\n PT: /^(?:(?:\\+351)?9(1\\d|2[1-9]|6[12345789]|7[12345789])\\d{7})$/,\n PY: /^(?:(?:\\+595|0)9[9876]\\d{7})$/,\n RO: /^(?:(?:\\+40|0))(?:7[2-8]\\d{7}|21\\d{8})$/,\n RS: /^(?:(?:\\+381)|0)([0-6]|[7][012345])[0-9]{5,10}$/,\n RW: /^(?:(?:\\+250)|(0))\\d{9}$/,\n SI: /^(?:(?:\\+386)|0)?[1-59]\\d{7,8}$/,\n SK: /^(?:(?:\\+421))?(0|9[0-8])\\d{8}$/,\n SM: /^(?:(?:\\+378)|(0549|6\\d{4}))\\d{5}$/,\n SN: /^(?:(?:\\+221)|0)?[3679]\\d{7}$/,\n SR: /^(?:(?:\\+597))\\d{7}$/,\n TG: /^(?:(?:\\+228))\\d{8}$/,\n TJ: /^(?:(?:\\+992))(37|55|77)\\d{7}$/,\n TN: /^(?:(?:\\+216)|22|9[1-9])\\d{7}$/,\n TR: /^(?:(?:\\+90)|(0))\\s?5\\d{9}$/,\n TW: /^(?:(?:\\+886)|0)?9\\d{8}$/,\n UA: /^(?:(?:\\+380)|(0))?(39|50|63|66|67|68|91|92|93|94|95|96|97|98|99)\\d{7}$/,\n UG: /^(?:(?:\\+256)|0)?[39]\\d{8}$/,\n};\n","/* Source: Google LibPhoneNumber Metadata: https://github.com/google/libphonenumber/blob/master/javascript/i18n/phonenumbers/metadata.js */\n\nexport const DIAL_CODE_MAPPER: { [key: number]: string[] } = {\n 1: [\n 'US',\n 'AG',\n 'AI',\n 'AS',\n 'BB',\n 'BM',\n 'BS',\n 'CA',\n 'DM',\n 'DO',\n 'GD',\n 'GU',\n 'JM',\n 'KN',\n 'KY',\n 'LC',\n 'MP',\n 'MS',\n 'PR',\n 'SX',\n 'TC',\n 'TT',\n 'VC',\n 'VG',\n 'VI',\n ],\n 7: ['RU', 'KZ'],\n 20: ['EG'],\n 27: ['ZA'],\n 30: ['GR'],\n 31: ['NL'],\n 32: ['BE'],\n 33: ['FR'],\n 34: ['ES'],\n 36: ['HU'],\n 39: ['IT', 'VA'],\n 40: ['RO'],\n 41: ['CH'],\n 43: ['AT'],\n 44: ['GB', 'GG', 'IM', 'JE'],\n 45: ['DK'],\n 46: ['SE'],\n 47: ['NO', 'SJ'],\n 48: ['PL'],\n 49: ['DE'],\n 51: ['PE'],\n 52: ['MX'],\n 53: ['CU'],\n 54: ['AR'],\n 55: ['BR'],\n 56: ['CL'],\n 57: ['CO'],\n 58: ['VE'],\n 60: ['MY'],\n 61: ['AU', 'CC', 'CX'],\n 62: ['ID'],\n 63: ['PH'],\n 64: ['NZ'],\n 65: ['SG'],\n 66: ['TH'],\n 81: ['JP'],\n 82: ['KR'],\n 84: ['VN'],\n 86: ['CN'],\n 90: ['TR'],\n 91: ['IN'],\n 92: ['PK'],\n 93: ['AF'],\n 94: ['LK'],\n 95: ['MM'],\n 98: ['IR'],\n 211: ['SS'],\n 212: ['MA', 'EH'],\n 213: ['DZ'],\n 216: ['TN'],\n 218: ['LY'],\n 220: ['GM'],\n 221: ['SN'],\n 222: ['MR'],\n 223: ['ML'],\n 224: ['GN'],\n 225: ['CI'],\n 226: ['BF'],\n 227: ['NE'],\n 228: ['TG'],\n 229: ['BJ'],\n 230: ['MU'],\n 231: ['LR'],\n 232: ['SL'],\n 233: ['GH'],\n 234: ['NG'],\n 235: ['TD'],\n 236: ['CF'],\n 237: ['CM'],\n 238: ['CV'],\n 239: ['ST'],\n 240: ['GQ'],\n 241: ['GA'],\n 242: ['CG'],\n 243: ['CD'],\n 244: ['AO'],\n 245: ['GW'],\n 246: ['IO'],\n 247: ['AC'],\n 248: ['SC'],\n 249: ['SD'],\n 250: ['RW'],\n 251: ['ET'],\n 252: ['SO'],\n 253: ['DJ'],\n 254: ['KE'],\n 255: ['TZ'],\n 256: ['UG'],\n 257: ['BI'],\n 258: ['MZ'],\n 260: ['ZM'],\n 261: ['MG'],\n 262: ['RE', 'YT'],\n 263: ['ZW'],\n 264: ['NA'],\n 265: ['MW'],\n 266: ['LS'],\n 267: ['BW'],\n 268: ['SZ'],\n 269: ['KM'],\n 290: ['SH', 'TA'],\n 291: ['ER'],\n 297: ['AW'],\n 298: ['FO'],\n 299: ['GL'],\n 350: ['GI'],\n 351: ['PT'],\n 352: ['LU'],\n 353: ['IE'],\n 354: ['IS'],\n 355: ['AL'],\n 356: ['MT'],\n 357: ['CY'],\n 358: ['FI', 'AX'],\n 359: ['BG'],\n 370: ['LT'],\n 371: ['LV'],\n 372: ['EE'],\n 373: ['MD'],\n 374: ['AM'],\n 375: ['BY'],\n 376: ['AD'],\n 377: ['MC'],\n 378: ['SM'],\n 380: ['UA'],\n 381: ['RS'],\n 382: ['ME'],\n 383: ['XK'],\n 385: ['HR'],\n 386: ['SI'],\n 387: ['BA'],\n 389: ['MK'],\n 420: ['CZ'],\n 421: ['SK'],\n 423: ['LI'],\n 500: ['FK'],\n 501: ['BZ'],\n 502: ['GT'],\n 503: ['SV'],\n 504: ['HN'],\n 505: ['NI'],\n 506: ['CR'],\n 507: ['PA'],\n 508: ['PM'],\n 509: ['HT'],\n 590: ['GP', 'BL', 'MF'],\n 591: ['BO'],\n 592: ['GY'],\n 593: ['EC'],\n 594: ['GF'],\n 595: ['PY'],\n 596: ['MQ'],\n 597: ['SR'],\n 598: ['UY'],\n 599: ['CW', 'BQ'],\n 670: ['TL'],\n 672: ['NF'],\n 673: ['BN'],\n 674: ['NR'],\n 675: ['PG'],\n 676: ['TO'],\n 677: ['SB'],\n 678: ['VU'],\n 679: ['FJ'],\n 680: ['PW'],\n 681: ['WF'],\n 682: ['CK'],\n 683: ['NU'],\n 685: ['WS'],\n 686: ['KI'],\n 687: ['NC'],\n 688: ['TV'],\n 689: ['PF'],\n 690: ['TK'],\n 691: ['FM'],\n 692: ['MH'],\n 800: ['001'],\n 808: ['001'],\n 850: ['KP'],\n 852: ['HK'],\n 853: ['MO'],\n 855: ['KH'],\n 856: ['LA'],\n 870: ['001'],\n 878: ['001'],\n 880: ['BD'],\n 881: ['001'],\n 882: ['001'],\n 883: ['001'],\n 886: ['TW'],\n 888: ['001'],\n 960: ['MV'],\n 961: ['LB'],\n 962: ['JO'],\n 963: ['SY'],\n 964: ['IQ'],\n 965: ['KW'],\n 966: ['SA'],\n 967: ['YE'],\n 968: ['OM'],\n 970: ['PS'],\n 971: ['AE'],\n 972: ['IL'],\n 973: ['BH'],\n 974: ['QA'],\n 975: ['BT'],\n 976: ['MN'],\n 977: ['NP'],\n 979: ['001'],\n 992: ['TJ'],\n 993: ['TM'],\n 994: ['AZ'],\n 995: ['GE'],\n 996: ['KG'],\n 998: ['UZ'],\n};\n","import { DIAL_CODE_MAPPER } from './data/dialCodeMapper';\nimport { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\n\n/**\n * Determines the country code based on the provided phone number.\n * This function employs a multi-step approach to identify the country code:\n * - If the phone number starts with '+', it extracts the numeric characters\n * and matches the leading digits with known dial codes mapped to countries.\n * - For matched dial codes, it further filters based on country-specific regex patterns\n * to validate the phone number format for those countries.\n * - If the phone number doesn't start with '+', it directly matches the number\n * against regular expressions associated with various countries to identify the code.\n *\n * @param phoneNumber The input phone number (string or number).\n * @returns The detected country code or an empty string if not found.\n */\nexport const detectCountryCodeFromDialCode = (\n phoneNumber: string | number,\n): string => {\n // If the phone number starts with '+', extract numeric characters\n if (phoneNumber.toString().charAt(0) === '+') {\n const cleanedPhoneNumberWithoutPlusPrefix = phoneNumber\n .toString()\n .replace(/\\D/g, '');\n\n const matchingCountries: string[] = [];\n\n // Iterate through dial codes and check for matches with cleaned phone number\n for (const code in DIAL_CODE_MAPPER) {\n if (cleanedPhoneNumberWithoutPlusPrefix.startsWith(code)) {\n matchingCountries.push(...DIAL_CODE_MAPPER[code]);\n }\n }\n\n // Filter matching countries based on phone number validation regex\n const matchedCountryCode = matchingCountries.find((countryCode: string) => {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex && regex.test(phoneNumber.toString())) return countryCode;\n return undefined;\n });\n\n // Return the first matched country code, if any\n return matchedCountryCode || '';\n } else {\n // If phone number doesn't start with '+', directly match against country regexes\n for (const countryCode in PHONE_REGEX_MAPPER) {\n const regex = PHONE_REGEX_MAPPER[countryCode];\n if (regex.test(phoneNumber.toString())) {\n return countryCode;\n }\n }\n }\n\n // Return empty string if no country code is detected\n return '';\n};\n\nexport const cleanPhoneNumber = (phoneNumber: string) => {\n // Regular expression to match all characters except numbers and + sign at the start\n const regex = /[^0-9+]|(?!A)\\+/g;\n // Replace matched characters with an empty string\n const cleanedPhoneNumber = phoneNumber.replace(regex, '');\n return phoneNumber[0] === '+' ? `+${cleanedPhoneNumber}` : cleanedPhoneNumber;\n};\n","import { PHONE_REGEX_MAPPER } from './data/phoneRegexMapper';\nimport { withErrorBoundary } from '../../common/errorBoundary';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Validates whether a given phone number is valid based on the provided country code or auto-detects the country code and checks if the number matches the defined regex pattern for that country.\nconst isValidPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_REGEX_MAPPER,\n): boolean => {\n // Clean the provided phoneNumber by removing non-numeric characters\n const cleanedPhoneNumber = cleanPhoneNumber(phoneNumber.toString());\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_REGEX_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(cleanedPhoneNumber);\n\n // Return false if phoneNumber is empty\n if (!phoneNumber) return false;\n\n // Check if the countryCode exists in the PHONE_REGEX_MAPPER\n if (countryCode in PHONE_REGEX_MAPPER) {\n // Fetch the regex pattern for the countryCode\n const regex = PHONE_REGEX_MAPPER[countryCode];\n // Test if the cleanedPhoneNumber matches the regex pattern\n return regex.test(cleanedPhoneNumber as string);\n }\n\n // Return false if the countryCode is not supported\n return false;\n};\n\nexport default withErrorBoundary(isValidPhoneNumber);\n","export const PHONE_FORMATTER_MAPPER: { [key: string]: string } = {\n IN: 'xxxx xxxxxx',\n MY: 'xx xxxxx xx',\n AE: 'xx xxx xxxx',\n AL: 'xxx xx xxxx',\n AM: 'xx xx xx xx',\n AR: 'xxxx-xxxx',\n AU: 'xxx xxx xxx',\n AW: 'xxx-xxxx',\n BB: 'xxx-xxxx',\n BD: 'xxxx-xxxxxx',\n BM: 'xxx-xxxx',\n BN: 'xxxx-xxxx',\n BO: 'xxxx-xxxx',\n BS: 'xxx-xxxx',\n BW: 'xx xxxx xxxx',\n BZ: 'xxx-xxxx',\n CA: 'xxx-xxx-xxxx',\n CH: 'xxx xxx xxx',\n CN: 'xxxx-xxxxxxx',\n CO: 'xxxx-xxxxxxx',\n CR: 'xxxx-xxxx',\n CU: 'xxxx-xxxx',\n CZ: 'xxx xxx xxx',\n DK: 'xx xx xx xx',\n DO: 'xxx-xxxxxxx',\n DZ: 'xxxx-xxxx-xxx',\n EG: 'xx xxx xxxx',\n ET: 'xx xxx xxxx',\n EU: 'xxx xx xx xx',\n FJ: 'xxxx xxxx',\n GB: 'xxxx xxx xxx',\n GH: 'xxx xxx xxxx',\n GI: 'xxxx xxxx',\n GM: 'xxxx-xxxx',\n GT: 'xxxx-xxxx',\n GY: 'xxx-xxxx',\n HK: 'xxxx xxxx',\n HN: 'xxxx-xxxx',\n HR: 'xxx xxx xxxx',\n HT: 'xxx-xxxx',\n HU: 'xxx xxx xxxx',\n ID: 'xxxx-xxxx-xxxx',\n IL: 'xxxx-xxx-xxx',\n JM: 'xxx-xxxx',\n KE: 'xxx xxxxxx',\n KG: 'xxx-xx-xx-xx',\n KH: 'xxx-xxx-xxx',\n KY: 'xxx-xxxx',\n KZ: 'xxx-xxx-xx-xx',\n LA: 'xxx xx xxxx',\n LK: 'xx xxx xxxx',\n LR: 'xxx-xxx-xxxx',\n LS: 'xxx xx xxxx',\n LT: 'xxx xxxxx',\n LU: 'xxx xx xxx',\n LV: 'xxxx xxxx',\n MA: 'xxxx-xxxxxx',\n MD: 'xx xxxxxx',\n ME: 'xx xxxxxx',\n MG: 'xx xx xx xx xx',\n MK: 'xx xx xx xx',\n MM: 'xx xxxxxx',\n MN: 'xxx-xx-xxxx',\n MO: 'xxxx xxxx',\n MU: 'xx xxxx xxxx',\n MV: 'xxxxxx',\n MW: 'xx xxxx xxxx',\n MX: 'xxx-xxx-xxxx',\n MZ: 'xx xxxxxxx',\n NA: 'xx xxxx xxxx',\n NG: 'xxx xxx xxxx',\n NI: 'xxxx-xxxx',\n NL: 'xxx-xxxxxxx',\n NO: 'xxxx xxxx',\n NP: 'xxxx-xxxxxxx',\n NZ: 'xxx-xxxxxxx',\n OM: 'xxxx-xxxx',\n PA: 'xxx-xxxx',\n PE: 'xxx-xxx-xxx',\n PG: 'xxx-xxxxxx',\n PH: 'xxx-xxxx',\n PK: 'xxx-xxxxxxx',\n PL: 'xxx xxx xxx',\n PR: 'xxx-xxx-xxxx',\n PS: 'xxxx-xxxxxxx',\n PT: 'xxx xxx xxx',\n PY: 'xxx-xxxxxx',\n QA: 'xxxx xxxx',\n RO: 'xxx xxx xxxx',\n RS: 'xxx xxxxx',\n RU: 'xxx xxx-xx-xx',\n RW: 'xxx xxxxxx',\n SA: 'xxx-xxxxxxx',\n SC: 'xx xxxxx',\n SE: 'xxx-xxx xx xx',\n SG: 'xxxx xxxx',\n SI: 'xx xxxxxx',\n SK: 'xxx xxx xxx',\n SL: 'xxx-xxxxxx',\n SM: 'xxxxx xxxxx',\n SN: 'xx xxx xx xx',\n SO: 'xxx xxxxxxx',\n SR: 'xxx-xxxx',\n SS: 'xxx xxxx xxx',\n SV: 'xxxx-xxxx',\n SZ: 'xxx xx xxxx',\n TG: 'xx xx xx xx',\n TH: 'xxx-xxxxxxx',\n TJ: 'xxx xx xx xx',\n TL: 'xxx-xxxxxxx',\n TN: 'xx xxxxxx',\n TR: 'xxx xxx xx xx',\n TT: 'xxx-xxxx',\n TW: 'xxxx-xxxxxx',\n TZ: 'xxx xxx xxxx',\n UA: 'xx xxx xx xx',\n UG: 'xxx xxxxxxx',\n US: 'xxx-xxx-xxxx',\n UY: 'xxx-xxxxx',\n UZ: 'xxx-xxx-xx-xx',\n VC: 'xxx-xxxx',\n VE: 'xxxx-xxx-xxxx',\n VN: 'xxxx-xxxxxxx',\n YE: 'xxxx-xxxx',\n ZA: 'xxx-xxx-xxxx',\n ZM: 'xxx-xxxxxxx',\n ZW: 'xx xxx xxxx',\n KW: 'xxx xx xxxx',\n BH: 'xxxx xxxx',\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\n// Formats a provided phone number according to the predefined format for a specific country code, or auto-detects the country code and formats the number accordingly.\nconst formatPhoneNumber = (\n phoneNumber: string | number,\n countryCode?: keyof typeof PHONE_FORMATTER_MAPPER,\n): string => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Convert phoneNumber to string and clean it by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n countryCode =\n countryCode && countryCode in PHONE_FORMATTER_MAPPER\n ? countryCode\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Fetch the pattern for the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern) return phoneNumber;\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n // Extract the phoneNumber without the prefix\n const phoneNumberWithoutPrefix = phoneNumber.slice(diff);\n const formattedNumber: string[] = [];\n let numberIndex = 0;\n\n // Loop through the pattern to format the phoneNumber\n for (let i = 0; i < pattern.length; i++) {\n const patternChar = pattern[i];\n if (patternChar === 'x') {\n // Insert phoneNumber digits at 'x' positions\n if (numberIndex < phoneNumberWithoutPrefix.length) {\n formattedNumber.push(phoneNumberWithoutPrefix[numberIndex]);\n numberIndex++;\n }\n } else {\n // Insert non-digit characters from the pattern\n formattedNumber.push(patternChar);\n }\n }\n\n // Join the formattedNumber array to create the formattedPhoneNumber without prefix\n const formattedPhoneNumberWithoutPrefix = formattedNumber.join('');\n // Combine the prefix and formattedPhoneNumberWithoutPrefix\n const formattedPhoneNumberWithPrefix =\n phoneNumber.slice(0, diff) + ' ' + formattedPhoneNumberWithoutPrefix;\n\n // Return the formattedPhoneNumber with prefix after trimming whitespace\n return formattedPhoneNumberWithPrefix.trim();\n};\n\nexport default withErrorBoundary(formatPhoneNumber);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { PHONE_FORMATTER_MAPPER } from './data/phoneFormatterMapper';\nimport formatPhoneNumber from './formatPhoneNumber';\nimport { detectCountryCodeFromDialCode, cleanPhoneNumber } from './utils';\n\ninterface PhoneInfo {\n countryCode: string;\n dialCode: string;\n formattedPhoneNumber: string;\n formatTemplate: string;\n}\n\n// Parses a given phone number, identifies its country code (if not provided), and returns an object with details including the country code, formatted phone number, dial code, and format template.\nconst parsePhoneNumber = (phoneNumber: string, country?: string): PhoneInfo => {\n // Throw errors if phoneNumber is invalid\n if (!phoneNumber) throw new Error('Parameter `phoneNumber` is invalid!');\n\n // Clean the phoneNumber by removing non-numeric characters\n phoneNumber = phoneNumber.toString();\n phoneNumber = cleanPhoneNumber(phoneNumber);\n\n // Detect or validate the country code\n const countryCode =\n country && country in PHONE_FORMATTER_MAPPER\n ? country\n : detectCountryCodeFromDialCode(phoneNumber);\n\n // Format the phone number using the detected/validated country code\n const formattedPhoneNumber = formatPhoneNumber(phoneNumber, countryCode);\n\n // Fetch the pattern associated with the countryCode from the PHONE_FORMATTER_MAPPER\n const pattern = PHONE_FORMATTER_MAPPER[countryCode];\n\n if (!pattern)\n return {\n countryCode: countryCode || '',\n dialCode: '',\n formattedPhoneNumber: phoneNumber,\n formatTemplate: '',\n };\n\n // Count the number of 'x' characters in the format pattern\n let charCountInFormatterPattern = 0;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === 'x') {\n charCountInFormatterPattern++;\n }\n }\n\n // Calculate the difference between phoneNumber length and 'x' characters count in pattern\n const diff = phoneNumber.length - charCountInFormatterPattern;\n\n // Extract the dialCode from the phoneNumber\n const dialCode = phoneNumber.slice(0, diff);\n\n // Obtain the format template associated with the countryCode\n const formatTemplate = PHONE_FORMATTER_MAPPER[countryCode];\n\n // Return the parsed phone number information\n return {\n countryCode,\n formattedPhoneNumber,\n dialCode,\n formatTemplate,\n };\n};\n\nexport default withErrorBoundary(parsePhoneNumber);\n","export const stringToDate = (dateString: string): Date => {\n const supportedDateFormats = [\n // Date formats\n {\n regex: /^(\\d{4})\\/(\\d{2})\\/(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY/MM/DD\n {\n regex: /^(\\d{2})\\/(\\d{2})\\/(\\d{4})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n }, // DD/MM/YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY.MM.DD\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // DD-MM-YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // MM/DD/YYYY\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY-MM-DD\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // YYYY. MM. DD.\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n }, // DD.MM.YYYY\n\n // Timestamp formats\n {\n regex: /^(\\d{4})\\/(\\d{2})\\/(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY/MM/DD HH:MM:SS\n {\n regex: /^(\\d{2})\\/(\\d{2})\\/(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD/MM/YYYY HH:MM:SS\n {\n regex: /^(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY-MM-DD HH:MM:SS\n {\n regex: /^(\\d{2})-(\\d{2})-(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD-MM-YYYY HH:MM:SS\n {\n regex: /^(\\d{4})\\.(\\d{2})\\.(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 1,\n monthIndex: 2,\n dayIndex: 3,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // YYYY.MM.DD HH:MM:SS\n {\n regex: /^(\\d{2})\\.(\\d{2})\\.(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/,\n yearIndex: 3,\n monthIndex: 2,\n dayIndex: 1,\n hourIndex: 4,\n minuteIndex: 5,\n secondIndex: 6,\n }, // DD.MM.YYYY HH:MM:SS\n ];\n\n for (const format of supportedDateFormats) {\n const match = dateString.match(format.regex);\n if (match) {\n const year = match[format.yearIndex];\n const month = match[format.monthIndex];\n const day = match[format.dayIndex];\n const hour = format.hourIndex ? match[format.hourIndex] : '00';\n const minute = format.minuteIndex ? match[format.minuteIndex] : '00';\n const second = format.secondIndex ? match[format.secondIndex] : '00';\n\n return new Date(`${year}-${month}-${day}T${hour}:${minute}:${second}`);\n }\n }\n\n throw new Error('Date format not recognized');\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Adds a specified amount of time to a date.\n *\n * @param date The original date.\n * @param value The amount to add.\n * @param unit The unit of time to add (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time added.\n */\nconst add = (\n date: DateInput,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n switch (unit) {\n case 'days':\n date.setDate(date.getDate() + value);\n break;\n case 'months':\n date.setMonth(date.getMonth() + value);\n break;\n case 'years':\n date.setFullYear(date.getFullYear() + value);\n break;\n }\n return date;\n};\n\nexport default withErrorBoundary(add);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Formats date and time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional).\n * @returns {string} Formatted date and time string.\n */\nconst formatDateTime = (\n date: DateInput,\n locale: Locale,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n const dateObj: Date = date instanceof Date ? date : new Date(date);\n let formatter;\n\n try {\n formatter = new Intl.DateTimeFormat(locale, intlOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formatter.format(dateObj);\n};\n\nexport default withErrorBoundary(formatDateTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n DateFormatOptions,\n} from './types';\n\n/**\n * Formats date based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional).\n * @returns {string} Formatted date string.\n */\nconst formatDate = (\n date: DateInput,\n locale: Locale,\n options: DateFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n timeStyle: undefined,\n };\n\n let formattedDate;\n\n try {\n formattedDate = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedDate;\n};\n\nexport default withErrorBoundary(formatDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport formatDateTime from './formatDateTime';\nimport {\n DateInput,\n Locale,\n DateTimeFormatOptions,\n TimeFormatOptions,\n} from './types';\n\n/**\n * Formats time based on the locale.\n * @param {DateInput} date - Date object or date string.\n * @param {Locale} locale - Locale string.\n * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional).\n * @returns {string} Formatted time string.\n */\nconst formatTime = (\n date: DateInput,\n locale: Locale,\n options: TimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const fullOptions: DateTimeFormatOptions = {\n ...options,\n dateStyle: undefined,\n };\n\n let formattedTime;\n\n try {\n formattedTime = formatDateTime(date, locale, fullOptions);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return formattedTime;\n};\n\nexport default withErrorBoundary(formatTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\n\n/**\n * Gets the first day of the week for a given locale.\n *\n * @param locale The locale to determine the first day of the week for.\n * @param intlOptions Optional Intl.DateTimeFormatOptions for customization.\n * @returns The first day of the week (0-6, where 0 is Sunday).\n */\nconst getFirstDayOfWeek = (\n locale: string,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n let formatted;\n\n if (!intlOptions.weekday) intlOptions.weekday = 'long';\n\n try {\n const formatter = new Intl.DateTimeFormat(locale, intlOptions);\n /**\n * This date was chosen because January 2, 2000, is a Sunday.\n * In the Gregorian calendar, Sunday is considered the start of the week in some cultures (like in the United States), while in others, it's Monday (like in much of Europe).\n * By using a date that is known to be a Sunday, the function can accurately determine what day of the week is considered the start in the specified locale.\n */\n const sundayDate = new Date(2000, 0, 2); // A known Sunday\n formatted = formatter.format(sundayDate);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n // Generate localized weekdays array starting from Sunday\n const weekdays = Array.from({ length: 7 }, (_, i) =>\n new Intl.DateTimeFormat(locale, intlOptions).format(\n new Date(2000, 0, 2 + i),\n ),\n );\n\n const firstDayIndex = weekdays.indexOf(formatted);\n if (firstDayIndex === -1) {\n throw new Error('Unable to determine the first day of the week');\n }\n\n return weekdays[(firstDayIndex + 1) % 7]; // Adjusting since our reference date is a Sunday\n};\n\nexport default withErrorBoundary(getFirstDayOfWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Determines the quarter of the year for a given date.\n *\n * @param date The date to determine the quarter for.\n * @returns The quarter of the year (1-4).\n */\nconst getQuarter = (date: DateInput): number => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n return Math.ceil((date.getMonth() + 1) / 3);\n};\n\nexport default withErrorBoundary(getQuarter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { DateInput, Locale } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Provides a relative time string (e.g., '3 hours ago', 'in 2 days').\n * This function calculates the difference between the given date and the base date,\n * then formats it in a locale-sensitive manner. It allows customization of the output\n * through Intl.RelativeTimeFormat options.\n *\n * @param date - The date to compare.\n * @param baseDate - The date to compare against (default: current date).\n * @param locale - The locale to use for formatting.\n * @param options - Options for the Intl.RelativeTimeFormat (optional).\n * @returns The relative time as a string.\n */\nconst getRelativeTime = (\n date: DateInput,\n baseDate: DateInput = new Date(),\n locale: Locale,\n options?: Intl.RelativeTimeFormatOptions,\n): string => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n baseDate =\n typeof baseDate === 'string'\n ? new Date(stringToDate(baseDate))\n : new Date(baseDate);\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000;\n\n // Define time units in seconds\n const minute = 60;\n const hour = minute * 60;\n const day = hour * 24;\n const week = day * 7;\n const month = day * 30;\n const year = day * 365;\n\n let value: number;\n let unit: Intl.RelativeTimeFormatUnit;\n\n if (Math.abs(diffInSeconds) < minute) {\n value = diffInSeconds;\n unit = 'second';\n } else if (Math.abs(diffInSeconds) < hour) {\n value = diffInSeconds / minute;\n unit = 'minute';\n } else if (Math.abs(diffInSeconds) < day) {\n value = diffInSeconds / hour;\n unit = 'hour';\n } else if (Math.abs(diffInSeconds) < week) {\n value = diffInSeconds / day;\n unit = 'day';\n } else if (Math.abs(diffInSeconds) < month) {\n value = diffInSeconds / week;\n unit = 'week';\n } else if (Math.abs(diffInSeconds) < year) {\n value = diffInSeconds / month;\n unit = 'month';\n } else {\n value = diffInSeconds / year;\n unit = 'year';\n }\n\n let relativeTime;\n\n try {\n const rtf = new Intl.RelativeTimeFormat(locale, options);\n relativeTime = rtf.format(Math.round(value), unit);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return relativeTime;\n};\n\nexport default withErrorBoundary(getRelativeTime);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Calculates the week number of the year for a given date.\n *\n * @param date The date to calculate the week number for.\n * @returns The week number of the year.\n */\nconst getWeek = (date: DateInput): number => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n const firstDayOfYear = new Date(date.getFullYear(), 0, 1);\n const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000;\n return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7);\n};\n\nexport default withErrorBoundary(getWeek);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { Locale } from './types';\n\n/**\n * Returns an array of weekdays according to the specified locale.\n *\n * @param locale The locale to get weekdays for.\n * @param intlOptions Optional Intl.DateTimeFormatOptions for customization.\n * @returns An array of weekday names.\n */\nconst getWeekdays = (\n locale: Locale,\n intlOptions: Intl.DateTimeFormatOptions = {},\n): string[] => {\n try {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n if (!intlOptions.weekday) intlOptions.weekday = 'long';\n\n const formatter = new Intl.DateTimeFormat(locale, intlOptions);\n\n /** The date January 1, 1970, is a well-known reference point in computing known as the Unix epoch.\n * It's the date at which time is measured for Unix systems, making it a consistent and reliable choice for date calculations.\n * The choice of the date January 4, 1970, as the starting point is significant.\n * January 4, 1970, was a Sunday.\n * Since weeks typically start on Sunday or Monday in most locales, starting from a known Sunday allows the function to cycle through a complete week, capturing all weekdays in the order they appear for the given locale.\n * */\n return Array.from({ length: 7 }, (_, i) =>\n formatter.format(new Date(1970, 0, 4 + i)),\n );\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n};\n\nexport default withErrorBoundary(getWeekdays);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Compares two dates to determine if the first is after the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is after date2.\n */\nconst isAfter = (date1: DateInput, date2: DateInput): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 > dateObj2;\n};\n\nexport default withErrorBoundary(isAfter);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Compares two dates to determine if the first is before the second.\n * @param {DateInput} date1 - First date object or date string.\n * @param {DateInput} date2 - Second date object or date string.\n * @returns {boolean} True if date1 is before date2.\n */\nconst isBefore = (date1: DateInput, date2: DateInput): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n const dateObj1: Date = date1 instanceof Date ? date1 : new Date(date1);\n const dateObj2: Date = date2 instanceof Date ? date2 : new Date(date2);\n return dateObj1 < dateObj2;\n};\n\nexport default withErrorBoundary(isBefore);\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Checks if a given year is a leap year.\n *\n * @param year The year to check.\n * @returns True if the year is a leap year, false otherwise.\n */\nconst isLeapYear = (year: number): boolean => {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n};\n\nexport default withErrorBoundary(isLeapYear);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { stringToDate } from './utils';\n\n/**\n * Checks if two dates fall on the same day.\n *\n * @param date1 The first date.\n * @param date2 The second date.\n * @returns True if both dates are on the same day, false otherwise.\n */\nconst isSameDay = (date1: Date, date2: Date): boolean => {\n date1 =\n typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1);\n date2 =\n typeof date2 === 'string' ? new Date(stringToDate(date2)) : new Date(date2);\n\n return (\n date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear()\n );\n};\n\nexport default withErrorBoundary(isSameDay);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport { stringToDate } from './utils';\n\n/**\n * Checks if a given object is a valid Date object.\n *\n * @param date The object to check.\n * @returns True if the object is a valid Date, false otherwise.\n */\nconst isValidDate = (date: any): boolean => {\n try {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n } else {\n throw new Error(`An unknown error occurred = ${err}`);\n }\n }\n\n return date instanceof Date && !isNaN(date.getTime());\n};\n\nexport default withErrorBoundary(isValidDate);\n","export const LOCALE_DATE_FORMATS: { [key: string]: string } = {\n 'ar-AE': 'DD/MM/YYYY', // Arabic (U.A.E.)\n 'sq-AL': 'DD.MM.YYYY', // Albanian (Albania)\n 'hy-AM': 'DD.MM.YYYY', // Armenian (Armenia)\n 'es-AR': 'DD/MM/YYYY', // Spanish (Argentina)\n 'en-AU': 'DD/MM/YYYY', // English (Australia)\n 'nl-AW': 'DD-MM-YYYY', // Dutch (Aruba)\n 'en-BB': 'MM/DD/YYYY', // English (Barbados)\n 'bn-BD': 'DD/MM/YYYY', // Bengali (Bangladesh)\n 'en-BM': 'MM/DD/YYYY', // English (Bermuda)\n 'ms-BN': 'DD/MM/YYYY', // Malay (Brunei)\n 'es-BO': 'DD/MM/YYYY', // Spanish (Bolivia)\n 'en-BS': 'MM/DD/YYYY', // English (Bahamas)\n 'en-BW': 'DD/MM/YYYY', // English (Botswana)\n 'en-BZ': 'MM/DD/YYYY', // English (Belize)\n 'en-CA': 'DD/MM/YYYY', // English (Canada)\n 'de-CH': 'DD.MM.YYYY', // German (Switzerland)\n 'zh-CN': 'YYYY/MM/DD', // Chinese (China)\n 'es-CO': 'DD/MM/YYYY', // Spanish (Colombia)\n 'es-CR': 'DD/MM/YYYY', // Spanish (Costa Rica)\n 'es-CU': 'DD/MM/YYYY', // Spanish (Cuba)\n 'cs-CZ': 'DD.MM.YYYY', // Czech (Czech Republic)\n 'da-DK': 'DD-MM-YYYY', // Danish (Denmark)\n 'es-DO': 'DD/MM/YYYY', // Spanish (Dominican Republic)\n 'ar-DZ': 'DD/MM/YYYY', // Arabic (Algeria)\n 'ar-EG': 'DD/MM/YYYY', // Arabic (Egypt)\n 'am-ET': 'DD/MM/YYYY', // Amharic (Ethiopia)\n 'en-EU': 'DD/MM/YYYY', // English (European Union)\n 'en-FJ': 'DD/MM/YYYY', // English (Fiji)\n 'en-GB': 'DD/MM/YYYY', // English (United Kingdom)\n 'en-GH': 'DD/MM/YYYY', // English (Ghana)\n 'en-GI': 'DD/MM/YYYY', // English (Gibraltar)\n 'en-GM': 'DD/MM/YYYY', // English (Gambia)\n 'es-GT': 'DD/MM/YYYY', // Spanish (Guatemala)\n 'en-GY': 'DD/MM/YYYY', // English (Guyana)\n 'en-HK': 'DD/MM/YYYY', // English (Hong Kong)\n 'es-HN': 'DD/MM/YYYY', // Spanish (Honduras)\n 'hr-HR': 'DD.MM.YYYY', // Croatian (Croatia)\n 'ht-HT': 'MM/DD/YYYY', // Haitian (Haiti)\n 'hu-HU': 'YYYY. MM. DD.', // Hungarian (Hungary)\n 'id-ID': 'DD/MM/YYYY', // Indonesian (Indonesia)\n 'he-IL': 'DD/MM/YYYY', // Hebrew (Israel)\n 'en-IN': 'DD-MM-YYYY', // English (India)\n 'en-JM': 'MM/DD/YYYY', // English (Jamaica)\n 'en-KE': 'DD/MM/YYYY', // English (Kenya)\n 'ky-KG': 'DD.MM.YYYY', // Kyrgyz (Kyrgyzstan)\n 'km-KH': 'DD/MM/YYYY', // Khmer (Cambodia)\n 'en-KY': 'MM/DD/YYYY', // English (Cayman Islands)\n 'kk-KZ': 'DD.MM.YYYY', // Kazakh (Kazakhstan)\n 'lo-LA': 'DD/MM/YYYY', // Lao (Laos)\n 'si-LK': 'YYYY-MM-DD', // Sinhala (Sri Lanka)\n 'en-LR': 'MM/DD/YYYY', // English (Liberia)\n 'en-LS': 'DD/MM/YYYY', // English (Lesotho)\n 'ar-MA': 'DD/MM/YYYY', // Arabic (Morocco)\n 'ro-MD': 'DD.MM.YYYY', // Romanian (Moldova)\n 'mk-MK': 'DD.MM.YYYY', // Macedonian (North Macedonia)\n 'my-MM': 'DD/MM/YYYY', // Burmese (Myanmar)\n 'mn-MN': 'YYYY.MM.DD', // Mongolian (Mongolia)\n 'zh-MO': 'DD/MM/YYYY', // Chinese (Macao)\n 'en-MU': 'DD/MM/YYYY', // English (Mauritius)\n 'dv-MV': 'DD/MM/YYYY', // Divehi (Maldives)\n 'en-MW': 'DD/MM/YYYY', // English (Malawi)\n 'es-MX': 'DD/MM/YYYY', // Spanish (Mexico)\n 'ms-MY': 'DD/MM/YYYY', // Malay (Malaysia)\n 'en-NA': 'DD/MM/YYYY', // English (Namibia)\n 'en-NG': 'DD/MM/YYYY', // English (Nigeria)\n 'es-NI': 'DD/MM/YYYY', // Spanish (Nicaragua)\n 'no-NO': 'DD.MM.YYYY', // Norwegian (Norway)\n 'ne-NP': 'YYYY/MM/DD', // Nepali (Nepal)\n 'en-NZ': 'DD/MM/YYYY', // English (New Zealand)\n 'es-PE': 'DD/MM/YYYY', // Spanish (Peru)\n 'en-PG': 'DD/MM/YYYY', // English (Papua New Guinea)\n 'en-PH': 'MM/DD/YYYY', // English (Philippines)\n 'en-PK': 'DD/MM/YYYY', // English (Pakistan)\n 'ar-QA': 'DD/MM/YYYY', // Arabic (Qatar)\n 'ru-RU': 'DD.MM.YYYY', // Russian (Russia)\n 'ar-SA': 'DD/MM/YYYY', // Arabic (Saudi Arabia)\n 'en-SC': 'DD/MM/YYYY', // English (Seychelles)\n 'sv-SE': 'YYYY-MM-DD', // Swedish (Sweden)\n 'en-SG': 'DD/MM/YYYY', // English (Singapore)\n 'en-SL': 'DD/MM/YYYY', // English (Sierra Leone)\n 'so-SO': 'DD/MM/YYYY', // Somali (Somalia)\n 'en-SS': 'DD/MM/YYYY', // English (South Sudan)\n 'es-SV': 'DD/MM/YYYY', // Spanish (El Salvador)\n 'en-SZ': 'DD/MM/YYYY', // English (Eswatini)\n 'th-TH': 'DD/MM/YYYY', // Thai (Thailand)\n 'en-TT': 'MM/DD/YYYY', // English (Trinidad and Tobago)\n 'sw-TZ': 'DD/MM/YYYY', // Swahili (Tanzania)\n 'en-US': 'MM/DD/YYYY', // English (United States)\n 'es-UY': 'DD/MM/YYYY', // Spanish (Uruguay)\n 'uz-UZ': 'DD/MM/YYYY', // Uzbek (Uzbekistan)\n 'ar-YE': 'DD/MM/YYYY', // Arabic (Yemen)\n 'en-ZA': 'YYYY/MM/DD', // English (South Africa)\n 'ar-KW': 'DD/MM/YYYY', // Arabic (Kuwait)\n 'ar-BH': 'DD/MM/YYYY', // Arabic (Bahrain)\n 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman)\n};\n","import { withErrorBoundary } from '../../common/errorBoundary';\n\n/**\n * Parses a date string based on a specific format.\n *\n * @param dateString The date string to parse.\n * @param format The format to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDateWithFormat = (\n dateString: string,\n format: string,\n): Date | null => {\n // Determine the separator based on the format (supports '/', '.', or '-')\n const separator = format.includes('/')\n ? '/'\n : format.includes('.')\n ? '.'\n : '-';\n const formatParts = format.split(separator);\n const dateParts = dateString.split(separator).map((num) => parseInt(num, 10));\n\n let year: number = 0,\n month: number = 0,\n day: number = 0;\n let yearSet: boolean = false,\n monthSet: boolean = false,\n daySet: boolean = false;\n\n // Check for format and date string mismatch\n if (dateParts.length !== formatParts.length) {\n return null; // Mismatch between date string and format\n }\n\n formatParts.forEach((part, index) => {\n // Check for non-numeric values in date string\n if (isNaN(dateParts[index])) {\n return null; // Invalid date part\n }\n\n // Assign year, month, and day based on the format\n switch (part) {\n case 'DD':\n day = dateParts[index];\n daySet = true;\n break;\n case 'MM':\n month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date\n monthSet = true;\n break;\n case 'YYYY':\n year = dateParts[index];\n yearSet = true;\n break;\n }\n });\n\n // Validate and create the date only if all parts are set\n if (yearSet && monthSet && daySet) {\n const parsedDate = new Date(year, month, day);\n // Validate date to catch invalid dates like February 30th\n if (\n parsedDate.getFullYear() === year &&\n parsedDate.getMonth() === month &&\n parsedDate.getDate() === day\n ) {\n return parsedDate;\n }\n }\n return null; // Invalid date or incomplete date information\n};\n\nexport default withErrorBoundary(\n parseDateWithFormat,\n);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport state from '../.internal/state';\nimport { getLocale } from '../.internal/utils';\nimport { LOCALE_DATE_FORMATS } from './data/localeDateFormats';\nimport parseDateWithFormat from './parseDateWithFormat';\nimport { Locale } from './types';\n\n/**\n * Attempts to parse a string into a date object based on locale.\n * Uses the localeDateFormats mapping for determining the date format.\n *\n * @param dateString - The date string to parse.\n * @param locale - The locale to use for parsing.\n * @returns The parsed Date object or null if parsing fails.\n */\nconst parseDate = (dateString: string, locale: Locale): Date | null => {\n /** retrieve locale from below areas in order of preference\n * 1. locale (used in case if someone wants to override locale just for a specific area and not globally)\n * 2. i18nState.locale (uses locale set globally)\n * 3. navigator (in case locale is not passed or set, use it from browser's navigator)\n * */\n if (!locale) locale = state.getState().locale || getLocale();\n\n const format = LOCALE_DATE_FORMATS[locale];\n if (!format) {\n throw new Error(`No date format found for locale: ${locale}`);\n }\n return parseDateWithFormat(dateString, format);\n};\n\nexport default withErrorBoundary(parseDate);\n","import { withErrorBoundary } from '../../common/errorBoundary';\nimport add from './add';\nimport { DateInput } from './types';\nimport { stringToDate } from './utils';\n\n/**\n * Subtracts a specified amount of time from a date.\n *\n * @param date The original date.\n * @param value The amount to subtract.\n * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years').\n * @returns A new Date object with the time subtracted.\n */\nconst subtract = (\n date: DateInput,\n value: number,\n unit: 'days' | 'months' | 'years',\n): Date => {\n date =\n typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date);\n\n return add(date, -value, unit); // Reuse the add function with negative value\n};\n\nexport default withErrorBoundary(subtract);\n"],"names":["I18nifyError","Error","constructor","message","super","this","name","timestamp","Date","withErrorBoundary","fn","rest","call","err","console","warn","I18nStateManager","state","locale","direction","country","getInstance","instance","resetInstance","undefined","getState","Object","assign","setState","newState","resetState","getState$1","setState$1","resetState$1","getLocale","navigator","window","Intl","languages","language","getIntlInstanceWithOptions","options","intlOptions","currency","style","NumberFormat","formatNumber$1","amount","Number","formattedAmount","format","CURRENCIES","AED","symbol","ALL","AMD","ARS","AUD","AWG","BBD","BDT","BMD","BND","BOB","BSD","BWP","BZD","CAD","CHF","CNY","COP","CRC","CUP","CZK","DKK","DOP","DZD","EGP","ETB","EUR","FJD","GBP","GHS","GIP","GMD","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","JMD","KES","KGS","KHR","KYD","KZT","LAK","LKR","LRD","LSL","MAD","MDL","MKD","MMK","MNT","MOP","MUR","MVR","MWK","MXN","MYR","NAD","NGN","NIO","NOK","NPR","NZD","PEN","PGK","PHP","PKR","QAR","RUB","SAR","SCR","SEK","SGD","SLL","SOS","SSP","SVC","SZL","THB","TTD","TZS","USD","UYU","UZS","YER","ZAR","KWD","BHD","OMR","getCurrencyList$1","getCurrencySymbol$1","currencyCode","_a","ALLOWED_FORMAT_PARTS_KEYS","formatNumberByParts$1","parts","formatToParts","formattedObj","forEach","p","type","integer","value","findIndex","item","isPrefixSymbol","rawParts","PHONE_REGEX_MAPPER","IN","MY","AE","AL","AM","AR","AU","AW","BB","BD","BM","BN","BO","BS","BW","BZ","CH","CN","CO","OM","CR","CU","CZ","DK","DO","DZ","EG","ET","EU","FJ","GB","GH","GI","GM","GT","GY","HK","HN","HR","HT","HU","ID","IL","JM","KE","KG","KH","KY","KZ","LA","LK","LR","LS","MA","MD","MK","MM","MN","MO","MU","MV","MW","MX","NA","NG","NI","NO","NP","NZ","PE","PG","PH","PK","QA","RU","SA","SC","SE","SG","SL","SO","SS","SV","SZ","TH","TT","TZ","US","CA","UY","UZ","YE","ZA","KW","BH","TL","VC","VE","VN","ZM","ZW","LT","LU","LV","ME","MG","MZ","NL","PA","PL","PR","PS","PT","PY","RO","RS","RW","SI","SK","SM","SN","SR","TG","TJ","TN","TR","TW","UA","UG","DIAL_CODE_MAPPER","detectCountryCodeFromDialCode","phoneNumber","toString","charAt","cleanedPhoneNumberWithoutPlusPrefix","replace","matchingCountries","code","startsWith","push","find","countryCode","regex","test","cleanPhoneNumber","cleanedPhoneNumber","isValidPhoneNumber$1","PHONE_FORMATTER_MAPPER","formatPhoneNumber$1","pattern","charCountInFormatterPattern","i","length","diff","phoneNumberWithoutPrefix","slice","formattedNumber","numberIndex","patternChar","formattedPhoneNumberWithoutPrefix","join","trim","parsePhoneNumber$1","formattedPhoneNumber","formatPhoneNumber","dialCode","formatTemplate","stringToDate","dateString","supportedDateFormats","yearIndex","monthIndex","dayIndex","hourIndex","minuteIndex","secondIndex","match","year","month","day","hour","minute","second","add$1","date","unit","setDate","getDate","setMonth","getMonth","setFullYear","getFullYear","formatDateTime$1","dateObj","formatter","DateTimeFormat","formatDate$1","fullOptions","timeStyle","formattedDate","formatDateTime","formatTime$1","dateStyle","formattedTime","getFirstDayOfWeek$1","formatted","weekday","sundayDate","weekdays","Array","from","_","firstDayIndex","indexOf","getQuarter$1","Math","ceil","getRelativeTime$1","baseDate","diffInSeconds","getTime","week","relativeTime","abs","RelativeTimeFormat","round","getWeek$1","firstDayOfYear","pastDaysOfYear","getDay","getWeekdays$1","isAfter$1","date1","date2","isBefore$1","isLeapYear$1","isSameDay$1","isValidDate$1","isNaN","LOCALE_DATE_FORMATS","parseDateWithFormat$1","separator","includes","formatParts","split","dateParts","map","num","parseInt","yearSet","monthSet","daySet","part","index","parsedDate","parseDate$1","parseDateWithFormat","subtract$1","add"],"mappings":"+OACM,MAAOA,UAAqBC,MAEhC,WAAAC,CAAYC,GACVC,MAAMD,GACNE,KAAKC,KAAO,gBACZD,KAAKE,UAAY,IAAIC,IAEtB,EAYI,MAAMC,EACXC,GAEO,YAA4BC,GACjC,IACE,OAAOD,EAAGE,KAAKP,QAASM,EACzB,CAAC,MAAOE,GAIP,MAHAC,QAAQC,KAAK,iBAAkBF,GAGzB,IAAIb,EAAaa,EACxB,CACH,QC7BWG,EAIX,WAAAd,GACEG,KAAKY,MCLA,CACLC,OAAQ,GACRC,UAAW,GACXC,QAAS,GDGV,CAEM,kBAAOC,GAKZ,OAJKL,EAAiBM,WACpBN,EAAiBM,SAAW,IAAIN,GAG3BA,EAAiBM,QACzB,CAEM,oBAAOC,GACZP,EAAiBM,cAAWE,CAC7B,CAEM,QAAAC,GACL,OAAYC,OAAAC,OAAA,CAAA,EAAAtB,KAAKY,MAClB,CAEM,QAAAW,CAASC,GACdxB,KAAKY,MAAaS,OAAAC,OAAAD,OAAAC,OAAA,CAAA,EAAAtB,KAAKY,OAAUY,EAClC,CAEM,UAAAC,GACLzB,KAAKY,M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BACJC,GAAI,2BACJC,GAAI,wBACJC,GAAI,4DACJC,GAAI,0BACJC,GAAI,mCACJC,GAAI,4BACJC,GAAI,8CACJC,GAAI,6BACJC,GAAI,+CACJC,GAAI,8BACJC,GAAI,8BACJC,GAAI,8BACJC,GAAI,8BACJC,GAAI,yBACJC,GAAI,+DACJC,GAAI,0DACJC,GAAI,6BACJC,GAAI,0CACJC,GAAI,+CACJC,GAAI,8BACJC,GAAI,2BACJC,GAAI,6BACJC,GAAI,kCACJC,GAAI,uBACJC,GAAI,wBACJC,GAAI,sCACJC,GAAI,+BACJC,GAAI,gDACJC,GAAI,gDACJC,GAAI,iDACJC,GAAI,iCACJC,GAAI,2BACJC,GAAI,0BACJC,GAAI,yBACJC,GAAI,0BACJC,GAAI,2CACJC,GAAI,oCACJC,GAAI,0BACJC,GAAI,8BACJC,GAAI,uCACJC,GAAI,iCACJC,GAAI,yBACJC,GAAI,sCACJC,GAAI,yBACJC,GAAI,+BACJC,GAAI,iCACJC,GAAI,2CACJC,GAAI,+EACJC,GAAI,iCACJC,GAAI,qFACJC,GAAI,6BACJC,GAAI,gCACJC,GAAI,6DACJC,GAAI,gCACJC,GAAI,0CACJC,GAAI,kDACJC,GAAI,2BACJC,GAAI,kCACJC,GAAI,kCACJC,GAAI,qCACJC,GAAI,gCACJC,GAAI,uBACJC,GAAI,uBACJC,GAAI,iCACJC,GAAI,iCACJC,GAAI,8BACJC,GAAI,2BACJC,GAAI,0EACJC,GAAI,+BC/HOC,EAAgD,CAC3D,EAAG,CACD,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,MAEF,EAAG,CAAC,KAAM,MACV,GAAI,CAAC,MACL,GAAI,CAAC,MACL,GAAI,CAAC,MACL,GAAI,CAAC,MACL,GAAI,CAAC,MACL,GAAI,CAAC,MACL,GAAI,CAAC,MACL,GAAI,CAAC,MACL,GAAI,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AICA,GAAWC,GAAYC,EAAQ,CACjC,MAAMG,EAAa,IAAI7Z,KAAKgV,EAAMC,EAAOC,GAEzC,GACE2E,EAAW/D,gBAAkBd,GAC7B6E,EAAWjE,aAAeX,GAC1B4E,EAAWnE,YAAcR,EAEzB,OAAO2E,CAEV,CACD,OAAO,IAAI,ICvCE,IAAAC,EAAA7Z,GAfG,CAACsU,EAAoB7T,KAMhCA,IAAQA,EAASD,EAAMQ,WAAWP,QAAUgB,KAEjD,MAAMgB,EAASoW,EAAoBpY,GACnC,IAAKgC,EACH,MAAM,IAAIjD,MAAM,oCAAoCiB,KAEtD,OAAOqZ,EAAoBxF,EAAY7R,EAAO,ICHjC,IAAAsX,EAAA/Z,GAXE,CACfsV,EACA9L,EACA+L,KAEAD,EACkB,iBAATA,EAAoB,IAAIvV,KAAKsU,EAAaiB,IAAS,IAAIvV,KAAKuV,GAE9D0E,EAAI1E,GAAO9L,EAAO+L"} \ No newline at end of file From 14cdb799c97df5c9cecdda68d3fa04b3d240287a Mon Sep 17 00:00:00 2001 From: RgnDunes Date: Thu, 18 Jan 2024 16:41:06 +0530 Subject: [PATCH 16/28] add support for intlOptions --- src/modules/dateTime/formatDate.ts | 8 ++++---- src/modules/dateTime/formatDateTime.ts | 4 ++-- src/modules/dateTime/formatTime.ts | 8 ++++---- src/modules/dateTime/getRelativeTime.ts | 8 ++++---- src/modules/dateTime/getWeek.ts | 2 +- src/modules/dateTime/getWeekdays.ts | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/modules/dateTime/formatDate.ts b/src/modules/dateTime/formatDate.ts index 1b1905f2..11671c00 100644 --- a/src/modules/dateTime/formatDate.ts +++ b/src/modules/dateTime/formatDate.ts @@ -13,13 +13,13 @@ import { * Formats date based on the locale. * @param {DateInput} date - Date object or date string. * @param {Locale} locale - Locale string. - * @param {DateFormatOptions} options - Intl.DateTimeFormat options for date formatting (optional). + * @param {DateFormatOptions} intlOptions - Intl.DateTimeFormat options for date formatting (optional). * @returns {string} Formatted date string. */ const formatDate = ( date: DateInput, - locale: Locale, - options: DateFormatOptions = {}, + locale?: Locale, + intlOptions: DateFormatOptions = {}, ): string => { /** retrieve locale from below areas in order of preference * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) @@ -29,7 +29,7 @@ const formatDate = ( if (!locale) locale = state.getState().locale || getLocale(); const fullOptions: DateTimeFormatOptions = { - ...options, + ...intlOptions, timeStyle: undefined, }; diff --git a/src/modules/dateTime/formatDateTime.ts b/src/modules/dateTime/formatDateTime.ts index d11eda08..8e2781f8 100644 --- a/src/modules/dateTime/formatDateTime.ts +++ b/src/modules/dateTime/formatDateTime.ts @@ -8,12 +8,12 @@ import { stringToDate } from './utils'; * Formats date and time based on the locale. * @param {DateInput} date - Date object or date string. * @param {Locale} locale - Locale string. - * @param {DateTimeFormatOptions} options - Intl.DateTimeFormat options (optional). + * @param {Intl.DateTimeFormatOptions} intlOptions - Intl.DateTimeFormat options (optional). * @returns {string} Formatted date and time string. */ const formatDateTime = ( date: DateInput, - locale: Locale, + locale?: Locale, intlOptions: Intl.DateTimeFormatOptions = {}, ): string => { /** retrieve locale from below areas in order of preference diff --git a/src/modules/dateTime/formatTime.ts b/src/modules/dateTime/formatTime.ts index 12d45ef9..f70ba5cb 100644 --- a/src/modules/dateTime/formatTime.ts +++ b/src/modules/dateTime/formatTime.ts @@ -13,13 +13,13 @@ import { * Formats time based on the locale. * @param {DateInput} date - Date object or date string. * @param {Locale} locale - Locale string. - * @param {TimeFormatOptions} options - Intl.DateTimeFormat options for time formatting (optional). + * @param {TimeFormatOptions} intlOptions - Intl.DateTimeFormat options for time formatting (optional). * @returns {string} Formatted time string. */ const formatTime = ( date: DateInput, - locale: Locale, - options: TimeFormatOptions = {}, + locale?: Locale, + intlOptions: TimeFormatOptions = {}, ): string => { /** retrieve locale from below areas in order of preference * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) @@ -29,7 +29,7 @@ const formatTime = ( if (!locale) locale = state.getState().locale || getLocale(); const fullOptions: DateTimeFormatOptions = { - ...options, + ...intlOptions, dateStyle: undefined, }; diff --git a/src/modules/dateTime/getRelativeTime.ts b/src/modules/dateTime/getRelativeTime.ts index 6c161820..4d7bb577 100644 --- a/src/modules/dateTime/getRelativeTime.ts +++ b/src/modules/dateTime/getRelativeTime.ts @@ -13,14 +13,14 @@ import { stringToDate } from './utils'; * @param date - The date to compare. * @param baseDate - The date to compare against (default: current date). * @param locale - The locale to use for formatting. - * @param options - Options for the Intl.RelativeTimeFormat (optional). + * @param intlOptions - Options for the Intl.RelativeTimeFormat (optional). * @returns The relative time as a string. */ const getRelativeTime = ( date: DateInput, baseDate: DateInput = new Date(), - locale: Locale, - options?: Intl.RelativeTimeFormatOptions, + locale?: Locale, + intlOptions?: Intl.RelativeTimeFormatOptions, ): string => { date = typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); @@ -75,7 +75,7 @@ const getRelativeTime = ( let relativeTime; try { - const rtf = new Intl.RelativeTimeFormat(locale, options); + const rtf = new Intl.RelativeTimeFormat(locale, intlOptions); relativeTime = rtf.format(Math.round(value), unit); } catch (err) { if (err instanceof Error) { diff --git a/src/modules/dateTime/getWeek.ts b/src/modules/dateTime/getWeek.ts index 1973c9f2..761efd15 100644 --- a/src/modules/dateTime/getWeek.ts +++ b/src/modules/dateTime/getWeek.ts @@ -12,7 +12,7 @@ const getWeek = (date: DateInput): number => { date = typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); const firstDayOfYear = new Date(date.getFullYear(), 0, 1); - const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000; + const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000; // 86400000 represents the number of milliseconds in a day return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7); }; diff --git a/src/modules/dateTime/getWeekdays.ts b/src/modules/dateTime/getWeekdays.ts index 633a7452..10985227 100644 --- a/src/modules/dateTime/getWeekdays.ts +++ b/src/modules/dateTime/getWeekdays.ts @@ -11,7 +11,7 @@ import { Locale } from './types'; * @returns An array of weekday names. */ const getWeekdays = ( - locale: Locale, + locale?: Locale, intlOptions: Intl.DateTimeFormatOptions = {}, ): string[] => { try { From 8df37a818fb5eef1e4319ad357ea0c7c3ead7ada Mon Sep 17 00:00:00 2001 From: RgnDunes Date: Thu, 18 Jan 2024 16:43:20 +0530 Subject: [PATCH 17/28] [fix]: eslint errors --- src/modules/dateTime/parseDateWithFormat.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/dateTime/parseDateWithFormat.ts b/src/modules/dateTime/parseDateWithFormat.ts index 33bc0b1d..f3f86ce3 100644 --- a/src/modules/dateTime/parseDateWithFormat.ts +++ b/src/modules/dateTime/parseDateWithFormat.ts @@ -15,8 +15,8 @@ const parseDateWithFormat = ( const separator = format.includes('/') ? '/' : format.includes('.') - ? '.' - : '-'; + ? `.` + : `-`; const formatParts = format.split(separator); const dateParts = dateString.split(separator).map((num) => parseInt(num, 10)); From b819ee511c39168e05aa6974004216b168252673 Mon Sep 17 00:00:00 2001 From: RgnDunes Date: Tue, 23 Jan 2024 04:52:28 +0530 Subject: [PATCH 18/28] add parseDateTime --- src/modules/dateTime/constants.ts | 15 +++ src/modules/dateTime/index.ts | 2 +- src/modules/dateTime/parseDate.ts | 31 ------ src/modules/dateTime/parseDateTime.ts | 111 ++++++++++++++++++++ src/modules/dateTime/parseDateWithFormat.ts | 75 ------------- src/modules/dateTime/types.ts | 13 +++ src/modules/dateTime/utils.ts | 10 +- 7 files changed, 145 insertions(+), 112 deletions(-) create mode 100644 src/modules/dateTime/constants.ts delete mode 100644 src/modules/dateTime/parseDate.ts create mode 100644 src/modules/dateTime/parseDateTime.ts delete mode 100644 src/modules/dateTime/parseDateWithFormat.ts diff --git a/src/modules/dateTime/constants.ts b/src/modules/dateTime/constants.ts new file mode 100644 index 00000000..32def42c --- /dev/null +++ b/src/modules/dateTime/constants.ts @@ -0,0 +1,15 @@ +export const ALLOWED_FORMAT_PARTS_KEYS = [ + 'day', + 'dayPeriod', + 'era', + 'fractionalSecond', + 'hour', + 'minute', + 'month', + 'relatedYear', + 'second', + 'timeZone', + 'weekday', + 'year', + 'yearName', +] as const; diff --git a/src/modules/dateTime/index.ts b/src/modules/dateTime/index.ts index 7edf62be..842d8eab 100644 --- a/src/modules/dateTime/index.ts +++ b/src/modules/dateTime/index.ts @@ -17,5 +17,5 @@ export { default as isBefore } from './isBefore'; export { default as isLeapYear } from './isLeapYear'; export { default as isSameDay } from './isSameDay'; export { default as isValidDate } from './isValidDate'; -export { default as parseDate } from './parseDate'; +export { default as parseDateTime } from './parseDateTime'; export { default as subtract } from './subtract'; diff --git a/src/modules/dateTime/parseDate.ts b/src/modules/dateTime/parseDate.ts deleted file mode 100644 index 90c211d8..00000000 --- a/src/modules/dateTime/parseDate.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { withErrorBoundary } from '../../common/errorBoundary'; -import state from '../.internal/state'; -import { getLocale } from '../.internal/utils'; -import { LOCALE_DATE_FORMATS } from './data/localeDateFormats'; -import parseDateWithFormat from './parseDateWithFormat'; -import { Locale } from './types'; - -/** - * Attempts to parse a string into a date object based on locale. - * Uses the localeDateFormats mapping for determining the date format. - * - * @param dateString - The date string to parse. - * @param locale - The locale to use for parsing. - * @returns The parsed Date object or null if parsing fails. - */ -const parseDate = (dateString: string, locale: Locale): Date | null => { - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) locale = state.getState().locale || getLocale(); - - const format = LOCALE_DATE_FORMATS[locale]; - if (!format) { - throw new Error(`No date format found for locale: ${locale}`); - } - return parseDateWithFormat(dateString, format); -}; - -export default withErrorBoundary(parseDate); diff --git a/src/modules/dateTime/parseDateTime.ts b/src/modules/dateTime/parseDateTime.ts new file mode 100644 index 00000000..93ba15c8 --- /dev/null +++ b/src/modules/dateTime/parseDateTime.ts @@ -0,0 +1,111 @@ +import { withErrorBoundary } from '../../common/errorBoundary'; +import state from '../.internal/state'; +import { getLocale } from '../.internal/utils'; +import { + DateInput, + FormattedPartsObject, + Locale, + ParsedDateTime, +} from './types'; +import { ALLOWED_FORMAT_PARTS_KEYS } from './constants'; +import { stringToDate } from './utils'; + +/** + * Parses a date input and returns a detailed object containing various date components + * and their formatted representations. + * + * @param {DateInput} dateInput - The date input, can be a string or a Date object. + * @param {Intl.DateTimeFormatOptions} [intlOptions={}] - Internationalization options for date formatting. + * @param {Locale} [locale] - The locale to use for formatting. Defaults to system locale if not provided. + * @returns {ParsedDateTime} An object containing the parsed date and its components. + */ +const parseDateTime = ( + dateInput: DateInput, + intlOptions: Intl.DateTimeFormatOptions = {}, + locale?: Locale, +): ParsedDateTime => { + // Parse the input date, converting strings to Date objects if necessary + const date = + typeof dateInput === 'string' + ? new Date(stringToDate(dateInput)) + : new Date(dateInput); + + // Use the provided locale or fallback to the system's default locale + locale = locale || state.getState().locale || getLocale(); + + try { + // Create an Intl.DateTimeFormat instance for formatting + const dateTimeFormat = new Intl.DateTimeFormat(locale, intlOptions); + const formattedParts = dateTimeFormat.formatToParts(date); + const formattedObj: FormattedPartsObject = {}; + + // Initialize date components with default or zero values + let year = 0, + month = 1, // Default to January + day = 1, // Default to the 1st day of the month + hours = 0, + minutes = 0, + seconds = 0; + + // Iterate over each part of the formatted date + formattedParts.forEach((part) => { + // If the part is allowed, add it to the formatted object + // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal', 'unknown' is skipped + if (ALLOWED_FORMAT_PARTS_KEYS.includes(part.type)) { + // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal', 'unknown' is skipped + formattedObj[part.type] = (formattedObj[part.type] || '') + part.value; + } + + // For other components, parse and assign them to the respective variables + const value = parseInt(part.value, 10); + switch (part.type) { + case 'year': + year = value; + break; + case 'month': + month = value; // Keep month 1-indexed (January = 1) + break; + case 'day': + day = value; + break; + case 'hour': + hours = value; + break; + case 'minute': + minutes = value; + break; + case 'second': + seconds = value; + break; + default: + // Ignore other parts + break; + } + }); + + // Construct the parsed date + const parsedDate = new Date(year, month - 1, day, hours, minutes, seconds); + + // If the constructed date is invalid, throw an error + if (isNaN(parsedDate.getTime())) { + throw new Error('Invalid date'); + } + + // Return the detailed parsed date object + return { + ...formattedObj, + rawParts: formattedParts, + formattedDate: formattedParts.map((p) => p.value).join(''), + dateObj: parsedDate, + }; + } catch (err) { + // Handle any errors that occur during parsing + if (err instanceof Error) { + throw err; + } else { + throw new Error(`An unknown error occurred: ${err}`); + } + } +}; + +export default withErrorBoundary(parseDateTime); diff --git a/src/modules/dateTime/parseDateWithFormat.ts b/src/modules/dateTime/parseDateWithFormat.ts deleted file mode 100644 index f3f86ce3..00000000 --- a/src/modules/dateTime/parseDateWithFormat.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { withErrorBoundary } from '../../common/errorBoundary'; - -/** - * Parses a date string based on a specific format. - * - * @param dateString The date string to parse. - * @param format The format to use for parsing. - * @returns The parsed Date object or null if parsing fails. - */ -const parseDateWithFormat = ( - dateString: string, - format: string, -): Date | null => { - // Determine the separator based on the format (supports '/', '.', or '-') - const separator = format.includes('/') - ? '/' - : format.includes('.') - ? `.` - : `-`; - const formatParts = format.split(separator); - const dateParts = dateString.split(separator).map((num) => parseInt(num, 10)); - - let year: number = 0, - month: number = 0, - day: number = 0; - let yearSet: boolean = false, - monthSet: boolean = false, - daySet: boolean = false; - - // Check for format and date string mismatch - if (dateParts.length !== formatParts.length) { - return null; // Mismatch between date string and format - } - - formatParts.forEach((part, index) => { - // Check for non-numeric values in date string - if (isNaN(dateParts[index])) { - return null; // Invalid date part - } - - // Assign year, month, and day based on the format - switch (part) { - case 'DD': - day = dateParts[index]; - daySet = true; - break; - case 'MM': - month = dateParts[index] - 1; // Adjust for zero-indexed months in JavaScript Date - monthSet = true; - break; - case 'YYYY': - year = dateParts[index]; - yearSet = true; - break; - } - }); - - // Validate and create the date only if all parts are set - if (yearSet && monthSet && daySet) { - const parsedDate = new Date(year, month, day); - // Validate date to catch invalid dates like February 30th - if ( - parsedDate.getFullYear() === year && - parsedDate.getMonth() === month && - parsedDate.getDate() === day - ) { - return parsedDate; - } - } - return null; // Invalid date or incomplete date information -}; - -export default withErrorBoundary( - parseDateWithFormat, -); diff --git a/src/modules/dateTime/types.ts b/src/modules/dateTime/types.ts index 2a8e1dec..0c8a30ef 100644 --- a/src/modules/dateTime/types.ts +++ b/src/modules/dateTime/types.ts @@ -1,3 +1,5 @@ +import { ALLOWED_FORMAT_PARTS_KEYS } from './constants'; + export type DateInput = Date | string; export type Locale = string; @@ -8,3 +10,14 @@ export interface DateFormatOptions export interface TimeFormatOptions extends Omit {} + +export type FormattedPartsObject = { + [key in (typeof ALLOWED_FORMAT_PARTS_KEYS)[number]]?: string | undefined; +}; + +export interface ParsedDateTime extends FormattedPartsObject { + rawParts: Array<{ type: string; value: unknown }>; + formattedDate: string; + dateObj: Date | null; +}; + diff --git a/src/modules/dateTime/utils.ts b/src/modules/dateTime/utils.ts index 4d270e00..6904c0d7 100644 --- a/src/modules/dateTime/utils.ts +++ b/src/modules/dateTime/utils.ts @@ -20,31 +20,31 @@ export const stringToDate = (dateString: string): Date => { dayIndex: 3, }, // YYYY.MM.DD { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + regex: /^(\d{2})-(\d{2})-(\d{4})$/, yearIndex: 1, monthIndex: 2, dayIndex: 3, }, // DD-MM-YYYY { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + regex: /^(\d{2})\/(\d{2})\/(\d{4})$/, yearIndex: 1, monthIndex: 2, dayIndex: 3, }, // MM/DD/YYYY { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + regex: /^(\d{4})-(\d{2})-(\d{2})$/, yearIndex: 1, monthIndex: 2, dayIndex: 3, }, // YYYY-MM-DD { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + regex: /^(\d{4})\.\s*(\d{2})\.\s*(\d{2})\.\s*$/, yearIndex: 1, monthIndex: 2, dayIndex: 3, }, // YYYY. MM. DD. { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, + regex: /^(\d{2})\.(\d{2})\.(\d{4})$/, yearIndex: 1, monthIndex: 2, dayIndex: 3, From f2f36d0fb7125d2f08c75866e0cef38ce8da4112 Mon Sep 17 00:00:00 2001 From: RgnDunes Date: Tue, 23 Jan 2024 04:57:33 +0530 Subject: [PATCH 19/28] add stringToDate desc in utils --- src/modules/dateTime/utils.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/modules/dateTime/utils.ts b/src/modules/dateTime/utils.ts index 6904c0d7..49ac248b 100644 --- a/src/modules/dateTime/utils.ts +++ b/src/modules/dateTime/utils.ts @@ -1,4 +1,16 @@ +/** + * Converts a string representation of a date into a Date object. + * The function supports various date and timestamp formats, + * including both American and European styles, with or without time components. + * If the provided string doesn't match any of the supported formats, + * the function throws an error. + * + * @param {string} dateString - The date string to be converted to a Date object. + * @returns {Date} A Date object representing the date and time specified in the dateString. + * @throws {Error} If the date format is not recognized. + */ export const stringToDate = (dateString: string): Date => { + // List of supported date and timestamp formats. const supportedDateFormats = [ // Date formats { @@ -107,19 +119,25 @@ export const stringToDate = (dateString: string): Date => { }, // DD.MM.YYYY HH:MM:SS ]; + // Iterate through each supported date format. for (const format of supportedDateFormats) { const match = dateString.match(format.regex); if (match) { + // Extract year, month, and day from the matched groups. const year = match[format.yearIndex]; const month = match[format.monthIndex]; const day = match[format.dayIndex]; + + // Extract time components if available, defaulting to '00' if not present. const hour = format.hourIndex ? match[format.hourIndex] : '00'; const minute = format.minuteIndex ? match[format.minuteIndex] : '00'; const second = format.secondIndex ? match[format.secondIndex] : '00'; + // Construct and return the Date object. return new Date(`${year}-${month}-${day}T${hour}:${minute}:${second}`); } } + // If no format matches, throw an error. throw new Error('Date format not recognized'); }; From 1374936aeaf839a1b81e9ae716032300a5931ed3 Mon Sep 17 00:00:00 2001 From: RgnDunes Date: Tue, 23 Jan 2024 05:05:30 +0530 Subject: [PATCH 20/28] migrated dateTime module to i18nify-js package --- {src => packages/i18nify-js/src}/modules/dateTime/add.ts | 0 {src => packages/i18nify-js/src}/modules/dateTime/constants.ts | 0 .../i18nify-js/src}/modules/dateTime/data/localeDateFormats.ts | 0 {src => packages/i18nify-js/src}/modules/dateTime/formatDate.ts | 0 .../i18nify-js/src}/modules/dateTime/formatDateTime.ts | 0 {src => packages/i18nify-js/src}/modules/dateTime/formatTime.ts | 0 .../i18nify-js/src}/modules/dateTime/getFirstDayOfWeek.ts | 0 {src => packages/i18nify-js/src}/modules/dateTime/getQuarter.ts | 0 .../i18nify-js/src}/modules/dateTime/getRelativeTime.ts | 0 {src => packages/i18nify-js/src}/modules/dateTime/getWeek.ts | 0 {src => packages/i18nify-js/src}/modules/dateTime/getWeekdays.ts | 0 {src => packages/i18nify-js/src}/modules/dateTime/index.ts | 0 {src => packages/i18nify-js/src}/modules/dateTime/isAfter.ts | 0 {src => packages/i18nify-js/src}/modules/dateTime/isBefore.ts | 0 {src => packages/i18nify-js/src}/modules/dateTime/isLeapYear.ts | 0 {src => packages/i18nify-js/src}/modules/dateTime/isSameDay.ts | 0 {src => packages/i18nify-js/src}/modules/dateTime/isValidDate.ts | 0 .../i18nify-js/src}/modules/dateTime/parseDateTime.ts | 0 {src => packages/i18nify-js/src}/modules/dateTime/subtract.ts | 0 {src => packages/i18nify-js/src}/modules/dateTime/types.ts | 0 {src => packages/i18nify-js/src}/modules/dateTime/utils.ts | 0 21 files changed, 0 insertions(+), 0 deletions(-) rename {src => packages/i18nify-js/src}/modules/dateTime/add.ts (100%) rename {src => packages/i18nify-js/src}/modules/dateTime/constants.ts (100%) rename {src => packages/i18nify-js/src}/modules/dateTime/data/localeDateFormats.ts (100%) rename {src => packages/i18nify-js/src}/modules/dateTime/formatDate.ts (100%) rename {src => packages/i18nify-js/src}/modules/dateTime/formatDateTime.ts (100%) rename {src => packages/i18nify-js/src}/modules/dateTime/formatTime.ts (100%) rename {src => packages/i18nify-js/src}/modules/dateTime/getFirstDayOfWeek.ts (100%) rename {src => packages/i18nify-js/src}/modules/dateTime/getQuarter.ts (100%) rename {src => packages/i18nify-js/src}/modules/dateTime/getRelativeTime.ts (100%) rename {src => packages/i18nify-js/src}/modules/dateTime/getWeek.ts (100%) rename {src => packages/i18nify-js/src}/modules/dateTime/getWeekdays.ts (100%) rename {src => packages/i18nify-js/src}/modules/dateTime/index.ts (100%) rename {src => packages/i18nify-js/src}/modules/dateTime/isAfter.ts (100%) rename {src => packages/i18nify-js/src}/modules/dateTime/isBefore.ts (100%) rename {src => packages/i18nify-js/src}/modules/dateTime/isLeapYear.ts (100%) rename {src => packages/i18nify-js/src}/modules/dateTime/isSameDay.ts (100%) rename {src => packages/i18nify-js/src}/modules/dateTime/isValidDate.ts (100%) rename {src => packages/i18nify-js/src}/modules/dateTime/parseDateTime.ts (100%) rename {src => packages/i18nify-js/src}/modules/dateTime/subtract.ts (100%) rename {src => packages/i18nify-js/src}/modules/dateTime/types.ts (100%) rename {src => packages/i18nify-js/src}/modules/dateTime/utils.ts (100%) diff --git a/src/modules/dateTime/add.ts b/packages/i18nify-js/src/modules/dateTime/add.ts similarity index 100% rename from src/modules/dateTime/add.ts rename to packages/i18nify-js/src/modules/dateTime/add.ts diff --git a/src/modules/dateTime/constants.ts b/packages/i18nify-js/src/modules/dateTime/constants.ts similarity index 100% rename from src/modules/dateTime/constants.ts rename to packages/i18nify-js/src/modules/dateTime/constants.ts diff --git a/src/modules/dateTime/data/localeDateFormats.ts b/packages/i18nify-js/src/modules/dateTime/data/localeDateFormats.ts similarity index 100% rename from src/modules/dateTime/data/localeDateFormats.ts rename to packages/i18nify-js/src/modules/dateTime/data/localeDateFormats.ts diff --git a/src/modules/dateTime/formatDate.ts b/packages/i18nify-js/src/modules/dateTime/formatDate.ts similarity index 100% rename from src/modules/dateTime/formatDate.ts rename to packages/i18nify-js/src/modules/dateTime/formatDate.ts diff --git a/src/modules/dateTime/formatDateTime.ts b/packages/i18nify-js/src/modules/dateTime/formatDateTime.ts similarity index 100% rename from src/modules/dateTime/formatDateTime.ts rename to packages/i18nify-js/src/modules/dateTime/formatDateTime.ts diff --git a/src/modules/dateTime/formatTime.ts b/packages/i18nify-js/src/modules/dateTime/formatTime.ts similarity index 100% rename from src/modules/dateTime/formatTime.ts rename to packages/i18nify-js/src/modules/dateTime/formatTime.ts diff --git a/src/modules/dateTime/getFirstDayOfWeek.ts b/packages/i18nify-js/src/modules/dateTime/getFirstDayOfWeek.ts similarity index 100% rename from src/modules/dateTime/getFirstDayOfWeek.ts rename to packages/i18nify-js/src/modules/dateTime/getFirstDayOfWeek.ts diff --git a/src/modules/dateTime/getQuarter.ts b/packages/i18nify-js/src/modules/dateTime/getQuarter.ts similarity index 100% rename from src/modules/dateTime/getQuarter.ts rename to packages/i18nify-js/src/modules/dateTime/getQuarter.ts diff --git a/src/modules/dateTime/getRelativeTime.ts b/packages/i18nify-js/src/modules/dateTime/getRelativeTime.ts similarity index 100% rename from src/modules/dateTime/getRelativeTime.ts rename to packages/i18nify-js/src/modules/dateTime/getRelativeTime.ts diff --git a/src/modules/dateTime/getWeek.ts b/packages/i18nify-js/src/modules/dateTime/getWeek.ts similarity index 100% rename from src/modules/dateTime/getWeek.ts rename to packages/i18nify-js/src/modules/dateTime/getWeek.ts diff --git a/src/modules/dateTime/getWeekdays.ts b/packages/i18nify-js/src/modules/dateTime/getWeekdays.ts similarity index 100% rename from src/modules/dateTime/getWeekdays.ts rename to packages/i18nify-js/src/modules/dateTime/getWeekdays.ts diff --git a/src/modules/dateTime/index.ts b/packages/i18nify-js/src/modules/dateTime/index.ts similarity index 100% rename from src/modules/dateTime/index.ts rename to packages/i18nify-js/src/modules/dateTime/index.ts diff --git a/src/modules/dateTime/isAfter.ts b/packages/i18nify-js/src/modules/dateTime/isAfter.ts similarity index 100% rename from src/modules/dateTime/isAfter.ts rename to packages/i18nify-js/src/modules/dateTime/isAfter.ts diff --git a/src/modules/dateTime/isBefore.ts b/packages/i18nify-js/src/modules/dateTime/isBefore.ts similarity index 100% rename from src/modules/dateTime/isBefore.ts rename to packages/i18nify-js/src/modules/dateTime/isBefore.ts diff --git a/src/modules/dateTime/isLeapYear.ts b/packages/i18nify-js/src/modules/dateTime/isLeapYear.ts similarity index 100% rename from src/modules/dateTime/isLeapYear.ts rename to packages/i18nify-js/src/modules/dateTime/isLeapYear.ts diff --git a/src/modules/dateTime/isSameDay.ts b/packages/i18nify-js/src/modules/dateTime/isSameDay.ts similarity index 100% rename from src/modules/dateTime/isSameDay.ts rename to packages/i18nify-js/src/modules/dateTime/isSameDay.ts diff --git a/src/modules/dateTime/isValidDate.ts b/packages/i18nify-js/src/modules/dateTime/isValidDate.ts similarity index 100% rename from src/modules/dateTime/isValidDate.ts rename to packages/i18nify-js/src/modules/dateTime/isValidDate.ts diff --git a/src/modules/dateTime/parseDateTime.ts b/packages/i18nify-js/src/modules/dateTime/parseDateTime.ts similarity index 100% rename from src/modules/dateTime/parseDateTime.ts rename to packages/i18nify-js/src/modules/dateTime/parseDateTime.ts diff --git a/src/modules/dateTime/subtract.ts b/packages/i18nify-js/src/modules/dateTime/subtract.ts similarity index 100% rename from src/modules/dateTime/subtract.ts rename to packages/i18nify-js/src/modules/dateTime/subtract.ts diff --git a/src/modules/dateTime/types.ts b/packages/i18nify-js/src/modules/dateTime/types.ts similarity index 100% rename from src/modules/dateTime/types.ts rename to packages/i18nify-js/src/modules/dateTime/types.ts diff --git a/src/modules/dateTime/utils.ts b/packages/i18nify-js/src/modules/dateTime/utils.ts similarity index 100% rename from src/modules/dateTime/utils.ts rename to packages/i18nify-js/src/modules/dateTime/utils.ts From 00ebcc6fe6a8053f0d0fdf11f463b97e3ab4ac78 Mon Sep 17 00:00:00 2001 From: RgnDunes Date: Tue, 23 Jan 2024 12:23:10 +0530 Subject: [PATCH 21/28] refactor parseDateTime module --- .../dateTime/data/localeDateFormats.ts | 1 + .../src/modules/dateTime/parseDateTime.ts | 44 +------------------ 2 files changed, 2 insertions(+), 43 deletions(-) diff --git a/packages/i18nify-js/src/modules/dateTime/data/localeDateFormats.ts b/packages/i18nify-js/src/modules/dateTime/data/localeDateFormats.ts index 93fa70cb..607812fa 100644 --- a/packages/i18nify-js/src/modules/dateTime/data/localeDateFormats.ts +++ b/packages/i18nify-js/src/modules/dateTime/data/localeDateFormats.ts @@ -94,4 +94,5 @@ export const LOCALE_DATE_FORMATS: { [key: string]: string } = { 'ar-KW': 'DD/MM/YYYY', // Arabic (Kuwait) 'ar-BH': 'DD/MM/YYYY', // Arabic (Bahrain) 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman) + 'fr-FR': 'DD/MM/YYYY', // French (France) }; diff --git a/packages/i18nify-js/src/modules/dateTime/parseDateTime.ts b/packages/i18nify-js/src/modules/dateTime/parseDateTime.ts index 93ba15c8..b1e3d7e9 100644 --- a/packages/i18nify-js/src/modules/dateTime/parseDateTime.ts +++ b/packages/i18nify-js/src/modules/dateTime/parseDateTime.ts @@ -39,14 +39,6 @@ const parseDateTime = ( const formattedParts = dateTimeFormat.formatToParts(date); const formattedObj: FormattedPartsObject = {}; - // Initialize date components with default or zero values - let year = 0, - month = 1, // Default to January - day = 1, // Default to the 1st day of the month - hours = 0, - minutes = 0, - seconds = 0; - // Iterate over each part of the formatted date formattedParts.forEach((part) => { // If the part is allowed, add it to the formatted object @@ -55,48 +47,14 @@ const parseDateTime = ( // @ts-expect-error only allowed keys are added to the formattedObj. For eg, key 'literal', 'unknown' is skipped formattedObj[part.type] = (formattedObj[part.type] || '') + part.value; } - - // For other components, parse and assign them to the respective variables - const value = parseInt(part.value, 10); - switch (part.type) { - case 'year': - year = value; - break; - case 'month': - month = value; // Keep month 1-indexed (January = 1) - break; - case 'day': - day = value; - break; - case 'hour': - hours = value; - break; - case 'minute': - minutes = value; - break; - case 'second': - seconds = value; - break; - default: - // Ignore other parts - break; - } }); - // Construct the parsed date - const parsedDate = new Date(year, month - 1, day, hours, minutes, seconds); - - // If the constructed date is invalid, throw an error - if (isNaN(parsedDate.getTime())) { - throw new Error('Invalid date'); - } - // Return the detailed parsed date object return { ...formattedObj, rawParts: formattedParts, formattedDate: formattedParts.map((p) => p.value).join(''), - dateObj: parsedDate, + dateObj: date, }; } catch (err) { // Handle any errors that occur during parsing From 34f49b010daab50e4ddc7ca28d210050418ca912 Mon Sep 17 00:00:00 2001 From: RgnDunes Date: Wed, 24 Jan 2024 18:24:04 +0530 Subject: [PATCH 22/28] minor fixes --- .../src/modules/.internal/constants.ts | 97 ++++++++++++ .../i18nify-js/src/modules/dateTime/add.ts | 29 +++- .../dateTime/data/localeDateFormats.ts | 4 +- .../dateTime/data/supportedDateFormats.ts | 142 ++++++++++++++++++ .../src/modules/dateTime/formatDate.ts | 2 +- .../src/modules/dateTime/formatDateTime.ts | 17 ++- .../src/modules/dateTime/formatTime.ts | 4 +- .../src/modules/dateTime/getWeek.ts | 1 + .../src/modules/dateTime/isSameDay.ts | 3 +- .../src/modules/dateTime/isValidDate.ts | 71 +++++++-- .../i18nify-js/src/modules/dateTime/types.ts | 12 +- .../i18nify-js/src/modules/dateTime/utils.ts | 126 ++-------------- 12 files changed, 374 insertions(+), 134 deletions(-) create mode 100644 packages/i18nify-js/src/modules/.internal/constants.ts create mode 100644 packages/i18nify-js/src/modules/dateTime/data/supportedDateFormats.ts diff --git a/packages/i18nify-js/src/modules/.internal/constants.ts b/packages/i18nify-js/src/modules/.internal/constants.ts new file mode 100644 index 00000000..b915afeb --- /dev/null +++ b/packages/i18nify-js/src/modules/.internal/constants.ts @@ -0,0 +1,97 @@ +export const COUNTRY_CODES_TO_LOCALE: { [key: string]: string } = { + AE: 'ar-AE', + AL: 'sq-AL', + AM: 'hy-AM', + AR: 'es-AR', + AU: 'en-AU', + AW: 'nl-AW', + BB: 'en-BB', + BD: 'bn-BD', + BM: 'en-BM', + BN: 'ms-BN', + BO: 'es-BO', + BS: 'en-BS', + BW: 'en-BW', + BZ: 'en-BZ', + CA: 'en-CA', + CH: 'de-CH', + CN: 'zh-CN', + CO: 'es-CO', + CR: 'es-CR', + CU: 'es-CU', + CZ: 'cs-CZ', + DK: 'da-DK', + DO: 'es-DO', + DZ: 'ar-DZ', + EG: 'ar-EG', + ET: 'am-ET', + EU: 'en-EU', + FJ: 'en-FJ', + GB: 'en-GB', + GH: 'en-GH', + GI: 'en-GI', + GM: 'en-GM', + GT: 'es-GT', + GY: 'en-GY', + HK: 'en-HK', + HN: 'es-HN', + HR: 'hr-HR', + HT: 'ht-HT', + HU: 'hu-HU', + ID: 'id-ID', + IL: 'he-IL', + IN: 'en-IN', + JM: 'en-JM', + KE: 'en-KE', + KG: 'ky-KG', + KH: 'km-KH', + KY: 'en-KY', + KZ: 'kk-KZ', + LA: 'lo-LA', + LK: 'si-LK', + LR: 'en-LR', + LS: 'en-LS', + MA: 'ar-MA', + MD: 'ro-MD', + MK: 'mk-MK', + MM: 'my-MM', + MN: 'mn-MN', + MO: 'zh-MO', + MU: 'en-MU', + MV: 'dv-MV', + MW: 'en-MW', + MX: 'es-MX', + MY: 'ms-MY', + NA: 'en-NA', + NG: 'en-NG', + NI: 'es-NI', + NO: 'no-NO', + NP: 'ne-NP', + NZ: 'en-NZ', + PE: 'es-PE', + PG: 'en-PG', + PH: 'en-PH', + PK: 'en-PK', + QA: 'ar-QA', + RU: 'ru-RU', + SA: 'ar-SA', + SC: 'en-SC', + SE: 'sv-SE', + SG: 'en-SG', + SL: 'en-SL', + SO: 'so-SO', + SS: 'en-SS', + SV: 'es-SV', + SZ: 'en-SZ', + TH: 'th-TH', + TT: 'en-TT', + TZ: 'sw-TZ', + US: 'en-US', + UY: 'es-UY', + UZ: 'uz-UZ', + YE: 'ar-YE', + ZA: 'en-ZA', + KW: 'ar-KW', + BH: 'ar-BH', + OM: 'ar-OM' + } \ No newline at end of file diff --git a/packages/i18nify-js/src/modules/dateTime/add.ts b/packages/i18nify-js/src/modules/dateTime/add.ts index 06d5ae79..416f5885 100644 --- a/packages/i18nify-js/src/modules/dateTime/add.ts +++ b/packages/i18nify-js/src/modules/dateTime/add.ts @@ -15,18 +15,45 @@ const add = ( value: number, unit: 'days' | 'months' | 'years', ): Date => { + if ( + (value !== 0 && !Number(value)) || + value === Infinity || + value === -Infinity + ) + throw new Error('Invalid value passed!'); + date = typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); + let initialDay; + switch (unit) { case 'days': date.setDate(date.getDate() + value); break; case 'months': + initialDay = date.getDate(); date.setMonth(date.getMonth() + value); + // Adjust for month-end dates + if (date.getDate() !== initialDay) { + date.setDate(0); // Set to the last day of the previous month + } break; case 'years': - date.setFullYear(date.getFullYear() + value); + // Special handling for leap years + if (date.getMonth() === 1 && date.getDate() === 29) { + // February 29 + const year = date.getFullYear() + value; + if (new Date(year, 1, 29).getMonth() === 1) { + // If the new year is a leap year, set to February 29 + date.setFullYear(year); + } else { + // If the new year is not a leap year, set to February 28 + date.setFullYear(year, 1, 28); + } + } else { + date.setFullYear(date.getFullYear() + value); + } break; } return date; diff --git a/packages/i18nify-js/src/modules/dateTime/data/localeDateFormats.ts b/packages/i18nify-js/src/modules/dateTime/data/localeDateFormats.ts index 607812fa..5a082a96 100644 --- a/packages/i18nify-js/src/modules/dateTime/data/localeDateFormats.ts +++ b/packages/i18nify-js/src/modules/dateTime/data/localeDateFormats.ts @@ -86,7 +86,7 @@ export const LOCALE_DATE_FORMATS: { [key: string]: string } = { 'th-TH': 'DD/MM/YYYY', // Thai (Thailand) 'en-TT': 'MM/DD/YYYY', // English (Trinidad and Tobago) 'sw-TZ': 'DD/MM/YYYY', // Swahili (Tanzania) - 'en-US': 'MM/DD/YYYY', // English (United States) + 'en-US': 'MM-DD-YYYY', // English (United States) 'es-UY': 'DD/MM/YYYY', // Spanish (Uruguay) 'uz-UZ': 'DD/MM/YYYY', // Uzbek (Uzbekistan) 'ar-YE': 'DD/MM/YYYY', // Arabic (Yemen) @@ -95,4 +95,6 @@ export const LOCALE_DATE_FORMATS: { [key: string]: string } = { 'ar-BH': 'DD/MM/YYYY', // Arabic (Bahrain) 'ar-OM': 'DD/MM/YYYY', // Arabic (Oman) 'fr-FR': 'DD/MM/YYYY', // French (France) + 'it-IT': 'DD/MM/YYYY', // Italian (Italy) + 'es-ES': 'DD/MM/YYYY', // Spanish (Spain) }; diff --git a/packages/i18nify-js/src/modules/dateTime/data/supportedDateFormats.ts b/packages/i18nify-js/src/modules/dateTime/data/supportedDateFormats.ts new file mode 100644 index 00000000..cebd516c --- /dev/null +++ b/packages/i18nify-js/src/modules/dateTime/data/supportedDateFormats.ts @@ -0,0 +1,142 @@ +import { SupportedDateFormats } from '../types'; + +export const supportedDateFormats: SupportedDateFormats[] = [ + // Date formats + { + regex: /^(\d{4})\/(0[1-9]|1[0-2])\/(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + format: 'YYYY/MM/DD', + }, + { + regex: /^(\d{2})\/(0[1-9]|1[0-2])\/(\d{4})$/, + yearIndex: 3, + monthIndex: 2, + dayIndex: 1, + format: 'DD/MM/YYYY', + }, + { + regex: /^(\d{4})\.(0[1-9]|1[0-2])\.(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + format: 'YYYY.MM.DD', + }, + { + regex: /^(\d{2})-(0[1-9]|1[0-2])-(\d{4})$/, + yearIndex: 3, + monthIndex: 2, + dayIndex: 1, + format: 'DD-MM-YYYY', + }, + { + regex: /^(0[1-9]|1[0-2])\/(\d{2})\/(\d{4})$/, + yearIndex: 3, + monthIndex: 1, + dayIndex: 2, + format: 'MM/DD/YYYY', + }, + { + regex: /^(\d{4})-(0[1-9]|1[0-2])-(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + format: 'YYYY-MM-DD', + }, + { + regex: /^(\d{4})\.\s*(0[1-9]|1[0-2])\.\s*(\d{2})\.\s*$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + format: 'YYYY. MM. DD.', + }, + { + regex: /^(\d{2})\.(0[1-9]|1[0-2])\.(\d{4})$/, + yearIndex: 3, + monthIndex: 2, + dayIndex: 1, + format: 'DD.MM.YYYY', + }, + { + regex: /^(0[1-9]|1[0-2])\.(\d{2})\.(\d{4})$/, + yearIndex: 3, + monthIndex: 1, + dayIndex: 2, + format: 'MM.DD.YYYY', + }, + + // Timestamp formats + { + regex: /^(\d{4})\/(0[1-9]|1[0-2])\/(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + format: 'YYYY/MM/DD HH:MM:SS', + }, + { + regex: /^(\d{2})\/(0[1-9]|1[0-2])\/(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 3, + monthIndex: 2, + dayIndex: 1, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + format: 'DD/MM/YYYY HH:MM:SS', + }, + { + regex: /^(\d{4})-(0[1-9]|1[0-2])-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + format: 'YYYY-MM-DD HH:MM:SS', + }, + { + regex: /^(\d{2})-(0[1-9]|1[0-2])-(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 3, + monthIndex: 2, + dayIndex: 1, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + format: 'DD-MM-YYYY HH:MM:SS', + }, + { + regex: /^(\d{4})\.(0[1-9]|1[0-2])\.(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + format: 'YYYY.MM.DD HH:MM:SS', + }, + { + regex: /^(\d{2})\.(0[1-9]|1[0-2])\.(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 3, + monthIndex: 2, + dayIndex: 1, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + format: 'DD.MM.YYYY HH:MM:SS', + }, + + // ISO 8601 Timestamp format + { + regex: /^(\d{4})-(0[1-9]|1[0-2])-(\d{2})T(\d{2}):(\d{2}):(\d{2})$/, + yearIndex: 1, + monthIndex: 2, + dayIndex: 3, + hourIndex: 4, + minuteIndex: 5, + secondIndex: 6, + format: 'YYYY-MM-DDTHH:MM:SS', + }, +]; diff --git a/packages/i18nify-js/src/modules/dateTime/formatDate.ts b/packages/i18nify-js/src/modules/dateTime/formatDate.ts index 11671c00..b1a506d1 100644 --- a/packages/i18nify-js/src/modules/dateTime/formatDate.ts +++ b/packages/i18nify-js/src/modules/dateTime/formatDate.ts @@ -36,7 +36,7 @@ const formatDate = ( let formattedDate; try { - formattedDate = formatDateTime(date, locale, fullOptions); + formattedDate = formatDateTime(date, locale, fullOptions).split(',')[0]; } catch (err) { if (err instanceof Error) { throw new Error(err.message); diff --git a/packages/i18nify-js/src/modules/dateTime/formatDateTime.ts b/packages/i18nify-js/src/modules/dateTime/formatDateTime.ts index 8e2781f8..9cf21ab2 100644 --- a/packages/i18nify-js/src/modules/dateTime/formatDateTime.ts +++ b/packages/i18nify-js/src/modules/dateTime/formatDateTime.ts @@ -26,11 +26,22 @@ const formatDateTime = ( date = typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - const dateObj: Date = date instanceof Date ? date : new Date(date); + // Ensure default options include date and time components + const defaultOptions: Intl.DateTimeFormatOptions = { + year: 'numeric', + month: 'numeric', + day: 'numeric', + hour: '2-digit', + minute: '2-digit', + second: '2-digit', + hour12: true, // Use 12-hour format by default, can be overridden by intlOptions + ...intlOptions, + }; + let formatter; try { - formatter = new Intl.DateTimeFormat(locale, intlOptions); + formatter = new Intl.DateTimeFormat(locale, defaultOptions); } catch (err) { if (err instanceof Error) { throw new Error(err.message); @@ -39,7 +50,7 @@ const formatDateTime = ( } } - return formatter.format(dateObj); + return formatter.format(date); }; export default withErrorBoundary(formatDateTime); diff --git a/packages/i18nify-js/src/modules/dateTime/formatTime.ts b/packages/i18nify-js/src/modules/dateTime/formatTime.ts index f70ba5cb..957c2ab4 100644 --- a/packages/i18nify-js/src/modules/dateTime/formatTime.ts +++ b/packages/i18nify-js/src/modules/dateTime/formatTime.ts @@ -36,7 +36,9 @@ const formatTime = ( let formattedTime; try { - formattedTime = formatDateTime(date, locale, fullOptions); + formattedTime = formatDateTime(date, locale, fullOptions) + .split(',')[1] + .trim(); } catch (err) { if (err instanceof Error) { throw new Error(err.message); diff --git a/packages/i18nify-js/src/modules/dateTime/getWeek.ts b/packages/i18nify-js/src/modules/dateTime/getWeek.ts index 761efd15..d4310510 100644 --- a/packages/i18nify-js/src/modules/dateTime/getWeek.ts +++ b/packages/i18nify-js/src/modules/dateTime/getWeek.ts @@ -8,6 +8,7 @@ import { stringToDate } from './utils'; * @param date The date to calculate the week number for. * @returns The week number of the year. */ +// [TODO:] Recheck the logic here for Last day of a non-leap year (2023-12-31) const getWeek = (date: DateInput): number => { date = typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); diff --git a/packages/i18nify-js/src/modules/dateTime/isSameDay.ts b/packages/i18nify-js/src/modules/dateTime/isSameDay.ts index 952424a0..658a1d46 100644 --- a/packages/i18nify-js/src/modules/dateTime/isSameDay.ts +++ b/packages/i18nify-js/src/modules/dateTime/isSameDay.ts @@ -1,4 +1,5 @@ import { withErrorBoundary } from '../../common/errorBoundary'; +import { DateInput } from './types'; import { stringToDate } from './utils'; /** @@ -8,7 +9,7 @@ import { stringToDate } from './utils'; * @param date2 The second date. * @returns True if both dates are on the same day, false otherwise. */ -const isSameDay = (date1: Date, date2: Date): boolean => { +const isSameDay = (date1: DateInput, date2: DateInput): boolean => { date1 = typeof date1 === 'string' ? new Date(stringToDate(date1)) : new Date(date1); date2 = diff --git a/packages/i18nify-js/src/modules/dateTime/isValidDate.ts b/packages/i18nify-js/src/modules/dateTime/isValidDate.ts index 652f9bc2..6cc32bb1 100644 --- a/packages/i18nify-js/src/modules/dateTime/isValidDate.ts +++ b/packages/i18nify-js/src/modules/dateTime/isValidDate.ts @@ -1,25 +1,66 @@ import { withErrorBoundary } from '../../common/errorBoundary'; -import { stringToDate } from './utils'; +import { COUNTRY_CODES_TO_LOCALE } from '../.internal/constants'; +import { LOCALE_DATE_FORMATS } from './data/localeDateFormats'; /** - * Checks if a given object is a valid Date object. + * Checks if a given string is a valid date according to a specific locale's date format. * - * @param date The object to check. - * @returns True if the object is a valid Date, false otherwise. + * @param dateString The date string to validate. + * @param countryCode The countryCode to use for the date format. + * @returns True if the dateString is a valid date according to the locale's format, false otherwise. */ -const isValidDate = (date: any): boolean => { - try { - date = - typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - } catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } else { - throw new Error(`An unknown error occurred = ${err}`); - } +const isValidDate = (dateString: string, countryCode: string): boolean => { + const locale = COUNTRY_CODES_TO_LOCALE[countryCode]; + + // Type guard to ensure dateString is a string + if (typeof dateString !== 'string') { + return false; } - return date instanceof Date && !isNaN(date.getTime()); + // Determine the date format based on the given locale + const dateFormat = LOCALE_DATE_FORMATS[locale]; + const delimiter = /[-/.]/; + const [part1, part2, part3] = dateString.split(delimiter); + + let year: string, month: string, day: string; + switch (dateFormat) { + case 'DD/MM/YYYY': + case 'DD.MM.YYYY': + case 'DD-MM-YYYY': + // Extract day, month, and year for formats where the day comes first + [day, month, year] = [part1, part2, part3]; + break; + case 'YYYY/MM/DD': + case 'YYYY-MM-DD': + case 'YYYY.MM.DD': + // Extract year, month, and day for formats where the year comes first + [year, month, day] = [part1, part2, part3]; + break; + case 'MM-DD-YYYY': + // Extract month, day and year for formats where the year comes first + [month, day, year] = [part1, part2, part3]; + break; + default: + // Return false for unrecognized formats + return false; + } + + try { + // Parsing and validating the date components + const parsedDate = new Date( + parseInt(year), + parseInt(month) - 1, + parseInt(day), + ); + return ( + parsedDate.getFullYear() === parseInt(year) && + parsedDate.getMonth() === parseInt(month) - 1 && + parsedDate.getDate() === parseInt(day) + ); + } catch (e) { + // Return false in case of any parsing errors + return false; + } }; export default withErrorBoundary(isValidDate); diff --git a/packages/i18nify-js/src/modules/dateTime/types.ts b/packages/i18nify-js/src/modules/dateTime/types.ts index 0c8a30ef..217bf4a5 100644 --- a/packages/i18nify-js/src/modules/dateTime/types.ts +++ b/packages/i18nify-js/src/modules/dateTime/types.ts @@ -19,5 +19,15 @@ export interface ParsedDateTime extends FormattedPartsObject { rawParts: Array<{ type: string; value: unknown }>; formattedDate: string; dateObj: Date | null; -}; +} +export interface SupportedDateFormats { + regex: RegExp; + yearIndex: number; + monthIndex: number; + dayIndex: number; + hourIndex?: number; + minuteIndex?: number; + secondIndex?: number; + format: string; +} diff --git a/packages/i18nify-js/src/modules/dateTime/utils.ts b/packages/i18nify-js/src/modules/dateTime/utils.ts index 49ac248b..89128e3c 100644 --- a/packages/i18nify-js/src/modules/dateTime/utils.ts +++ b/packages/i18nify-js/src/modules/dateTime/utils.ts @@ -1,3 +1,5 @@ +import { supportedDateFormats } from './data/supportedDateFormats'; + /** * Converts a string representation of a date into a Date object. * The function supports various date and timestamp formats, @@ -10,115 +12,6 @@ * @throws {Error} If the date format is not recognized. */ export const stringToDate = (dateString: string): Date => { - // List of supported date and timestamp formats. - const supportedDateFormats = [ - // Date formats - { - regex: /^(\d{4})\/(\d{2})\/(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, // YYYY/MM/DD - { - regex: /^(\d{2})\/(\d{2})\/(\d{4})$/, - yearIndex: 3, - monthIndex: 2, - dayIndex: 1, - }, // DD/MM/YYYY - { - regex: /^(\d{4})\.(\d{2})\.(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, // YYYY.MM.DD - { - regex: /^(\d{2})-(\d{2})-(\d{4})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, // DD-MM-YYYY - { - regex: /^(\d{2})\/(\d{2})\/(\d{4})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, // MM/DD/YYYY - { - regex: /^(\d{4})-(\d{2})-(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, // YYYY-MM-DD - { - regex: /^(\d{4})\.\s*(\d{2})\.\s*(\d{2})\.\s*$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, // YYYY. MM. DD. - { - regex: /^(\d{2})\.(\d{2})\.(\d{4})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - }, // DD.MM.YYYY - - // Timestamp formats - { - regex: /^(\d{4})\/(\d{2})\/(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, // YYYY/MM/DD HH:MM:SS - { - regex: /^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 3, - monthIndex: 2, - dayIndex: 1, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, // DD/MM/YYYY HH:MM:SS - { - regex: /^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, // YYYY-MM-DD HH:MM:SS - { - regex: /^(\d{2})-(\d{2})-(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 3, - monthIndex: 2, - dayIndex: 1, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, // DD-MM-YYYY HH:MM:SS - { - regex: /^(\d{4})\.(\d{2})\.(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 1, - monthIndex: 2, - dayIndex: 3, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, // YYYY.MM.DD HH:MM:SS - { - regex: /^(\d{2})\.(\d{2})\.(\d{4}) (\d{2}):(\d{2}):(\d{2})$/, - yearIndex: 3, - monthIndex: 2, - dayIndex: 1, - hourIndex: 4, - minuteIndex: 5, - secondIndex: 6, - }, // DD.MM.YYYY HH:MM:SS - ]; - // Iterate through each supported date format. for (const format of supportedDateFormats) { const match = dateString.match(format.regex); @@ -134,7 +27,20 @@ export const stringToDate = (dateString: string): Date => { const second = format.secondIndex ? match[format.secondIndex] : '00'; // Construct and return the Date object. - return new Date(`${year}-${month}-${day}T${hour}:${minute}:${second}`); + try { + const dateObj = new Date( + `${year}-${month}-${day}T${hour}:${minute}:${second}`, + ); + + if (dateObj.getTime()) return dateObj; + else throw new Error('Invalid Date!'); + } catch (err) { + if (err instanceof Error) { + throw new Error(err.message); + } else { + throw new Error(`An unknown error occurred = ${err}`); + } + } } } From ce8f59ad777f2e238a7b3e7b700501e1c606bc2b Mon Sep 17 00:00:00 2001 From: RgnDunes Date: Mon, 29 Jan 2024 13:55:04 +0530 Subject: [PATCH 23/28] remove extra files --- .../src/modules/dateTime/getFirstDayOfWeek.ts | 59 ------------------- .../i18nify-js/src/modules/dateTime/index.ts | 1 - 2 files changed, 60 deletions(-) delete mode 100644 packages/i18nify-js/src/modules/dateTime/getFirstDayOfWeek.ts diff --git a/packages/i18nify-js/src/modules/dateTime/getFirstDayOfWeek.ts b/packages/i18nify-js/src/modules/dateTime/getFirstDayOfWeek.ts deleted file mode 100644 index 101436c1..00000000 --- a/packages/i18nify-js/src/modules/dateTime/getFirstDayOfWeek.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { withErrorBoundary } from '../../common/errorBoundary'; -import state from '../.internal/state'; -import { getLocale } from '../.internal/utils'; - -/** - * Gets the first day of the week for a given locale. - * - * @param locale The locale to determine the first day of the week for. - * @param intlOptions Optional Intl.DateTimeFormatOptions for customization. - * @returns The first day of the week (0-6, where 0 is Sunday). - */ -const getFirstDayOfWeek = ( - locale: string, - intlOptions: Intl.DateTimeFormatOptions = {}, -): string => { - /** retrieve locale from below areas in order of preference - * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) - * 2. i18nState.locale (uses locale set globally) - * 3. navigator (in case locale is not passed or set, use it from browser's navigator) - * */ - if (!locale) locale = state.getState().locale || getLocale(); - - let formatted; - - if (!intlOptions.weekday) intlOptions.weekday = 'long'; - - try { - const formatter = new Intl.DateTimeFormat(locale, intlOptions); - /** - * This date was chosen because January 2, 2000, is a Sunday. - * In the Gregorian calendar, Sunday is considered the start of the week in some cultures (like in the United States), while in others, it's Monday (like in much of Europe). - * By using a date that is known to be a Sunday, the function can accurately determine what day of the week is considered the start in the specified locale. - */ - const sundayDate = new Date(2000, 0, 2); // A known Sunday - formatted = formatter.format(sundayDate); - } catch (err) { - if (err instanceof Error) { - throw new Error(err.message); - } else { - throw new Error(`An unknown error occurred = ${err}`); - } - } - - // Generate localized weekdays array starting from Sunday - const weekdays = Array.from({ length: 7 }, (_, i) => - new Intl.DateTimeFormat(locale, intlOptions).format( - new Date(2000, 0, 2 + i), - ), - ); - - const firstDayIndex = weekdays.indexOf(formatted); - if (firstDayIndex === -1) { - throw new Error('Unable to determine the first day of the week'); - } - - return weekdays[(firstDayIndex + 1) % 7]; // Adjusting since our reference date is a Sunday -}; - -export default withErrorBoundary(getFirstDayOfWeek); diff --git a/packages/i18nify-js/src/modules/dateTime/index.ts b/packages/i18nify-js/src/modules/dateTime/index.ts index 842d8eab..4f6b7f9f 100644 --- a/packages/i18nify-js/src/modules/dateTime/index.ts +++ b/packages/i18nify-js/src/modules/dateTime/index.ts @@ -7,7 +7,6 @@ export { default as add } from './add'; export { default as formatDate } from './formatDate'; export { default as formatDateTime } from './formatDateTime'; export { default as formatTime } from './formatTime'; -export { default as getFirstDayOfWeek } from './getFirstDayOfWeek'; export { default as getQuarter } from './getQuarter'; export { default as getRelativeTime } from './getRelativeTime'; export { default as getWeek } from './getWeek'; From 10fd174a71aaa4e8a58383d31d3bf3a30a24b384 Mon Sep 17 00:00:00 2001 From: RgnDunes Date: Wed, 14 Feb 2024 11:33:08 +0530 Subject: [PATCH 24/28] [chore]: update date module api contracts --- packages/i18nify-js/package.json | 3 +++ packages/i18nify-js/src/modules/dateTime/add.ts | 10 ++++++---- .../i18nify-js/src/modules/dateTime/formatDate.ts | 15 ++++++++------- .../src/modules/dateTime/formatDateTime.ts | 15 ++++++++------- .../i18nify-js/src/modules/dateTime/formatTime.ts | 15 ++++++++------- .../src/modules/dateTime/getRelativeTime.ts | 13 +++++++------ .../i18nify-js/src/modules/dateTime/getWeek.ts | 1 - .../src/modules/dateTime/getWeekdays.ts | 15 ++++++++------- .../src/modules/dateTime/parseDateTime.ts | 13 +++++++------ .../i18nify-js/src/modules/dateTime/subtract.ts | 12 +++++++----- 10 files changed, 62 insertions(+), 50 deletions(-) diff --git a/packages/i18nify-js/package.json b/packages/i18nify-js/package.json index 9eb27e3e..944fb6fd 100644 --- a/packages/i18nify-js/package.json +++ b/packages/i18nify-js/package.json @@ -41,6 +41,9 @@ ], "phoneNumber": [ "./lib/esm/phoneNumber/index.d.ts" + ], + "dateTime": [ + "./lib/esm/dateTime/index.d.ts" ] } }, diff --git a/packages/i18nify-js/src/modules/dateTime/add.ts b/packages/i18nify-js/src/modules/dateTime/add.ts index 416f5885..4fa3ea49 100644 --- a/packages/i18nify-js/src/modules/dateTime/add.ts +++ b/packages/i18nify-js/src/modules/dateTime/add.ts @@ -6,15 +6,17 @@ import { stringToDate } from './utils'; * Adds a specified amount of time to a date. * * @param date The original date. - * @param value The amount to add. - * @param unit The unit of time to add (e.g., 'days', 'months', 'years'). + * @param options config object. * @returns A new Date object with the time added. */ const add = ( date: DateInput, - value: number, - unit: 'days' | 'months' | 'years', + options: { + value: number, + unit: 'days' | 'months' | 'years', + }, ): Date => { + const {value, unit} = options; if ( (value !== 0 && !Number(value)) || value === Infinity || diff --git a/packages/i18nify-js/src/modules/dateTime/formatDate.ts b/packages/i18nify-js/src/modules/dateTime/formatDate.ts index b1a506d1..ee8e7cf1 100644 --- a/packages/i18nify-js/src/modules/dateTime/formatDate.ts +++ b/packages/i18nify-js/src/modules/dateTime/formatDate.ts @@ -12,31 +12,32 @@ import { /** * Formats date based on the locale. * @param {DateInput} date - Date object or date string. - * @param {Locale} locale - Locale string. - * @param {DateFormatOptions} intlOptions - Intl.DateTimeFormat options for date formatting (optional). + * @param options - config object. * @returns {string} Formatted date string. */ const formatDate = ( date: DateInput, - locale?: Locale, - intlOptions: DateFormatOptions = {}, + options: { + locale?: Locale, + intlOptions?: DateFormatOptions, + } = {}, ): string => { /** retrieve locale from below areas in order of preference * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) * 2. i18nState.locale (uses locale set globally) * 3. navigator (in case locale is not passed or set, use it from browser's navigator) * */ - if (!locale) locale = state.getState().locale || getLocale(); + if (!options.locale) options.locale = state.getState().locale || getLocale(); const fullOptions: DateTimeFormatOptions = { - ...intlOptions, + ...options.intlOptions, timeStyle: undefined, }; let formattedDate; try { - formattedDate = formatDateTime(date, locale, fullOptions).split(',')[0]; + formattedDate = formatDateTime(date, options.locale, fullOptions).split(',')[0]; } catch (err) { if (err instanceof Error) { throw new Error(err.message); diff --git a/packages/i18nify-js/src/modules/dateTime/formatDateTime.ts b/packages/i18nify-js/src/modules/dateTime/formatDateTime.ts index 9cf21ab2..17d5fb4f 100644 --- a/packages/i18nify-js/src/modules/dateTime/formatDateTime.ts +++ b/packages/i18nify-js/src/modules/dateTime/formatDateTime.ts @@ -7,21 +7,22 @@ import { stringToDate } from './utils'; /** * Formats date and time based on the locale. * @param {DateInput} date - Date object or date string. - * @param {Locale} locale - Locale string. - * @param {Intl.DateTimeFormatOptions} intlOptions - Intl.DateTimeFormat options (optional). + * @param options - Config object. * @returns {string} Formatted date and time string. */ const formatDateTime = ( date: DateInput, - locale?: Locale, - intlOptions: Intl.DateTimeFormatOptions = {}, + options: { + locale?: Locale, + intlOptions?: Intl.DateTimeFormatOptions, + } = {}, ): string => { /** retrieve locale from below areas in order of preference * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) * 2. i18nState.locale (uses locale set globally) * 3. navigator (in case locale is not passed or set, use it from browser's navigator) * */ - if (!locale) locale = state.getState().locale || getLocale(); + if (!options.locale) options.locale = state.getState().locale || getLocale(); date = typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); @@ -35,13 +36,13 @@ const formatDateTime = ( minute: '2-digit', second: '2-digit', hour12: true, // Use 12-hour format by default, can be overridden by intlOptions - ...intlOptions, + ...options.intlOptions, }; let formatter; try { - formatter = new Intl.DateTimeFormat(locale, defaultOptions); + formatter = new Intl.DateTimeFormat(options.locale, defaultOptions); } catch (err) { if (err instanceof Error) { throw new Error(err.message); diff --git a/packages/i18nify-js/src/modules/dateTime/formatTime.ts b/packages/i18nify-js/src/modules/dateTime/formatTime.ts index 957c2ab4..4e5b71c9 100644 --- a/packages/i18nify-js/src/modules/dateTime/formatTime.ts +++ b/packages/i18nify-js/src/modules/dateTime/formatTime.ts @@ -12,31 +12,32 @@ import { /** * Formats time based on the locale. * @param {DateInput} date - Date object or date string. - * @param {Locale} locale - Locale string. - * @param {TimeFormatOptions} intlOptions - Intl.DateTimeFormat options for time formatting (optional). + * @param options - Config object * @returns {string} Formatted time string. */ const formatTime = ( date: DateInput, - locale?: Locale, - intlOptions: TimeFormatOptions = {}, + options: { + locale?: Locale, + intlOptions?: TimeFormatOptions, + } = {}, ): string => { /** retrieve locale from below areas in order of preference * 1. locale (used in case if someone wants to override locale just for a specific area and not globally) * 2. i18nState.locale (uses locale set globally) * 3. navigator (in case locale is not passed or set, use it from browser's navigator) * */ - if (!locale) locale = state.getState().locale || getLocale(); + if (!options.locale) options.locale = state.getState().locale || getLocale(); const fullOptions: DateTimeFormatOptions = { - ...intlOptions, + ...options.intlOptions, dateStyle: undefined, }; let formattedTime; try { - formattedTime = formatDateTime(date, locale, fullOptions) + formattedTime = formatDateTime(date, {locale: options.locale, intlOptions: fullOptions}) .split(',')[1] .trim(); } catch (err) { diff --git a/packages/i18nify-js/src/modules/dateTime/getRelativeTime.ts b/packages/i18nify-js/src/modules/dateTime/getRelativeTime.ts index 4d7bb577..1e46663c 100644 --- a/packages/i18nify-js/src/modules/dateTime/getRelativeTime.ts +++ b/packages/i18nify-js/src/modules/dateTime/getRelativeTime.ts @@ -12,15 +12,16 @@ import { stringToDate } from './utils'; * * @param date - The date to compare. * @param baseDate - The date to compare against (default: current date). - * @param locale - The locale to use for formatting. - * @param intlOptions - Options for the Intl.RelativeTimeFormat (optional). + * @param options - Config object. * @returns The relative time as a string. */ const getRelativeTime = ( date: DateInput, baseDate: DateInput = new Date(), - locale?: Locale, - intlOptions?: Intl.RelativeTimeFormatOptions, + options: { + locale?: Locale, + intlOptions?: Intl.RelativeTimeFormatOptions, + } = {}, ): string => { date = typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); @@ -34,7 +35,7 @@ const getRelativeTime = ( * 2. i18nState.locale (uses locale set globally) * 3. navigator (in case locale is not passed or set, use it from browser's navigator) * */ - if (!locale) locale = state.getState().locale || getLocale(); + if (!options.locale) options.locale = state.getState().locale || getLocale(); const diffInSeconds = (date.getTime() - baseDate.getTime()) / 1000; @@ -75,7 +76,7 @@ const getRelativeTime = ( let relativeTime; try { - const rtf = new Intl.RelativeTimeFormat(locale, intlOptions); + const rtf = new Intl.RelativeTimeFormat(options.locale, options.intlOptions); relativeTime = rtf.format(Math.round(value), unit); } catch (err) { if (err instanceof Error) { diff --git a/packages/i18nify-js/src/modules/dateTime/getWeek.ts b/packages/i18nify-js/src/modules/dateTime/getWeek.ts index d4310510..761efd15 100644 --- a/packages/i18nify-js/src/modules/dateTime/getWeek.ts +++ b/packages/i18nify-js/src/modules/dateTime/getWeek.ts @@ -8,7 +8,6 @@ import { stringToDate } from './utils'; * @param date The date to calculate the week number for. * @returns The week number of the year. */ -// [TODO:] Recheck the logic here for Last day of a non-leap year (2023-12-31) const getWeek = (date: DateInput): number => { date = typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); diff --git a/packages/i18nify-js/src/modules/dateTime/getWeekdays.ts b/packages/i18nify-js/src/modules/dateTime/getWeekdays.ts index 10985227..ba50581e 100644 --- a/packages/i18nify-js/src/modules/dateTime/getWeekdays.ts +++ b/packages/i18nify-js/src/modules/dateTime/getWeekdays.ts @@ -6,13 +6,14 @@ import { Locale } from './types'; /** * Returns an array of weekdays according to the specified locale. * - * @param locale The locale to get weekdays for. - * @param intlOptions Optional Intl.DateTimeFormatOptions for customization. + * @param options Config object * @returns An array of weekday names. */ const getWeekdays = ( - locale?: Locale, - intlOptions: Intl.DateTimeFormatOptions = {}, + options: { + locale?: Locale, + intlOptions: Intl.DateTimeFormatOptions, + }, ): string[] => { try { /** retrieve locale from below areas in order of preference @@ -20,10 +21,10 @@ const getWeekdays = ( * 2. i18nState.locale (uses locale set globally) * 3. navigator (in case locale is not passed or set, use it from browser's navigator) * */ - if (!locale) locale = state.getState().locale || getLocale(); - if (!intlOptions.weekday) intlOptions.weekday = 'long'; + if (!options.locale) options.locale = state.getState().locale || getLocale(); + if (!options.intlOptions.weekday) options.intlOptions.weekday = 'long'; - const formatter = new Intl.DateTimeFormat(locale, intlOptions); + const formatter = new Intl.DateTimeFormat(options.locale, options.intlOptions); /** The date January 1, 1970, is a well-known reference point in computing known as the Unix epoch. * It's the date at which time is measured for Unix systems, making it a consistent and reliable choice for date calculations. diff --git a/packages/i18nify-js/src/modules/dateTime/parseDateTime.ts b/packages/i18nify-js/src/modules/dateTime/parseDateTime.ts index b1e3d7e9..0c0c9447 100644 --- a/packages/i18nify-js/src/modules/dateTime/parseDateTime.ts +++ b/packages/i18nify-js/src/modules/dateTime/parseDateTime.ts @@ -15,14 +15,15 @@ import { stringToDate } from './utils'; * and their formatted representations. * * @param {DateInput} dateInput - The date input, can be a string or a Date object. - * @param {Intl.DateTimeFormatOptions} [intlOptions={}] - Internationalization options for date formatting. - * @param {Locale} [locale] - The locale to use for formatting. Defaults to system locale if not provided. + * @param options - Config object. * @returns {ParsedDateTime} An object containing the parsed date and its components. */ const parseDateTime = ( dateInput: DateInput, - intlOptions: Intl.DateTimeFormatOptions = {}, - locale?: Locale, + options: { + locale?: Locale, + intlOptions?: Intl.DateTimeFormatOptions, + }, ): ParsedDateTime => { // Parse the input date, converting strings to Date objects if necessary const date = @@ -31,11 +32,11 @@ const parseDateTime = ( : new Date(dateInput); // Use the provided locale or fallback to the system's default locale - locale = locale || state.getState().locale || getLocale(); + options.locale = options.locale || state.getState().locale || getLocale(); try { // Create an Intl.DateTimeFormat instance for formatting - const dateTimeFormat = new Intl.DateTimeFormat(locale, intlOptions); + const dateTimeFormat = new Intl.DateTimeFormat(options.locale, options.intlOptions); const formattedParts = dateTimeFormat.formatToParts(date); const formattedObj: FormattedPartsObject = {}; diff --git a/packages/i18nify-js/src/modules/dateTime/subtract.ts b/packages/i18nify-js/src/modules/dateTime/subtract.ts index 6bb3ea7f..645405db 100644 --- a/packages/i18nify-js/src/modules/dateTime/subtract.ts +++ b/packages/i18nify-js/src/modules/dateTime/subtract.ts @@ -7,19 +7,21 @@ import { stringToDate } from './utils'; * Subtracts a specified amount of time from a date. * * @param date The original date. - * @param value The amount to subtract. - * @param unit The unit of time to subtract (e.g., 'days', 'months', 'years'). + * @param options config object. * @returns A new Date object with the time subtracted. */ const subtract = ( date: DateInput, - value: number, - unit: 'days' | 'months' | 'years', + options:{ + value: number, + unit: 'days' | 'months' | 'years', + } ): Date => { + const {value, unit} = options; date = typeof date === 'string' ? new Date(stringToDate(date)) : new Date(date); - return add(date, -value, unit); // Reuse the add function with negative value + return add(date, {value: -value, unit: unit}); // Reuse the add function with negative value }; export default withErrorBoundary(subtract); From da36410fe9bd0ade534d0c4429c945e43d5a3006 Mon Sep 17 00:00:00 2001 From: RgnDunes Date: Wed, 14 Feb 2024 11:43:49 +0530 Subject: [PATCH 25/28] [fix]: fix invalid parameter in formatDate --- packages/i18nify-js/src/modules/dateTime/formatDate.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/i18nify-js/src/modules/dateTime/formatDate.ts b/packages/i18nify-js/src/modules/dateTime/formatDate.ts index ee8e7cf1..0171c56f 100644 --- a/packages/i18nify-js/src/modules/dateTime/formatDate.ts +++ b/packages/i18nify-js/src/modules/dateTime/formatDate.ts @@ -37,7 +37,7 @@ const formatDate = ( let formattedDate; try { - formattedDate = formatDateTime(date, options.locale, fullOptions).split(',')[0]; + formattedDate = formatDateTime(date, {locale: options.locale, intlOptions: fullOptions}).split(',')[0]; } catch (err) { if (err instanceof Error) { throw new Error(err.message); From 727a19f4e123c8d9af725739536db7f6806c768d Mon Sep 17 00:00:00 2001 From: RgnDunes Date: Wed, 14 Feb 2024 11:59:01 +0530 Subject: [PATCH 26/28] [chore]: assign default empty object to intlOptions in parseDateTime --- packages/i18nify-js/src/modules/dateTime/parseDateTime.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/i18nify-js/src/modules/dateTime/parseDateTime.ts b/packages/i18nify-js/src/modules/dateTime/parseDateTime.ts index 0c0c9447..5c5399d4 100644 --- a/packages/i18nify-js/src/modules/dateTime/parseDateTime.ts +++ b/packages/i18nify-js/src/modules/dateTime/parseDateTime.ts @@ -23,7 +23,7 @@ const parseDateTime = ( options: { locale?: Locale, intlOptions?: Intl.DateTimeFormatOptions, - }, + } = {}, ): ParsedDateTime => { // Parse the input date, converting strings to Date objects if necessary const date = From 140f42e96e8a76f874f24958a3456b7a4e7955ae Mon Sep 17 00:00:00 2001 From: Divyansh Singh Date: Wed, 14 Feb 2024 15:38:34 +0530 Subject: [PATCH 27/28] docs[ATLAS-104]: Adding Documentation for Date & Time Module (#56) * refactor parseDateTime module * add readme docs for dateTime module * restructure README * updated isValidDate docs * replace i18nify with i18nify-js * update README * [docs]: update README as per the changes in api contracts in dev PR --- packages/i18nify-js/README.md | 440 ++++++++++++++++++++++++++++++++++ 1 file changed, 440 insertions(+) diff --git a/packages/i18nify-js/README.md b/packages/i18nify-js/README.md index 8ad5a4f3..2b7b7210 100644 --- a/packages/i18nify-js/README.md +++ b/packages/i18nify-js/README.md @@ -488,3 +488,443 @@ const parsedInfo = parsePhoneNumber('', countryCode); console.log('Country Code:', parsedInfo.countryCode); // 'JP' console.log('Format Template:', parsedInfo.formatTemplate); // 'xxx-xxxx-xxxx' ``` + +### Module 03: Date & Time Module + +This module provides functions for formatting and manipulating dates and times in a locale-sensitive manner using the JavaScript Intl API & Date object. + +#### add(date, options:) + +🕒🚀 This nifty time traveler lets you leap through the calendar with ease! Whether you're planning future events or reminiscing the past, it swiftly adds days, months, or years to any given date. No more manual date calculations; this function uses JavaScript's Date object to fast-forward or rewind your dates seamlessly. 🗓️⏭️ + +##### Examples + +```javascript +// Adding 10 days to today +console.log(add(new Date(), {value: 10, unit: 'days'})); // Outputs a date 10 days from now + +// Fast-forwarding 5 months from a specific date +console.log(add('2024-01-23', {value: 5, unit: 'months'})); // Outputs a date 5 months after January 23, 2024 + +// Jumping 3 years into the future from a date object +console.log(add(new Date(2024, 0, 23), {value: 3, unit: 'years'})); // Outputs a date 3 years after January 23, 2024 +``` + +💡 No matter the format of your starting date—a string or a Date object—this function handles it. Just make sure your date string matches one of the recognized formats, or else you'll be time-traveling to the era of error messages! 🛑📅 + +#### formatDate(date, options:) + +🌍📆 This global time stylist effortlessly turns your dates into beautifully formatted strings, tailored to different locales. Whether you're dealing with international clients or just love the beauty of diverse date formats, `formatDate` is your go-to function. It leverages the power of the Intl.DateTimeFormat API, ensuring that your dates always dress to impress, no matter where they're displayed. 🎩🌟 + +##### Examples + +```javascript +// Basic date formatting +console.log(formatDate(new Date(), {locale: 'en-US'})); // Outputs today's date in 'MM/DD/YYYY' format + +// Formatting with different locale +console.log(formatDate('2024-05-20', {locale: 'de-DE'})); // Outputs '20.05.2024' + +// Using Intl.DateTimeFormat options +console.log( + formatDate('2024-05-20', {locale: 'en-GB', intlOptions: { + weekday: 'long', + year: 'numeric', + month: 'long', + day: 'numeric', + }}), +); // Outputs 'Monday, 20 May 2024' +``` + +💡 Remember, if the date string doesn't match any supported formats, the function raises the curtain on an error message! 🛑🎭 + +#### formatDateTime(date, options:) + +🕰️🌍 This savvy time tailor is your go-to for dressing up dates and times in locale-specific styles. Whether you're marking milestones, scheduling global meetings, or just need that perfect date-time format, `formatDateTime` uses the Internationalization API (Intl) to translate your dates and times into the local lingo. It's like having a linguistic time machine at your fingertips! 🌟🗓️ + +##### Examples + +```javascript +// Standard date-time formatting +console.log(formatDateTime(new Date(), {locale: 'en-US'})); // Outputs something like '1/23/2024, 10:00 AM' + +// Custom date-time formatting in French +console.log( + formatDateTime('2024-05-20 15:00', {locale: 'fr-FR', intlOptions: { + weekday: 'long', + hour: '2-digit', + minute: '2-digit', + }}), +); // Outputs 'lundi, 15:00' + +// Locale-specific date-time formatting with extended options +console.log( + formatDateTime('2024-12-31 23:59', {locale: 'ja-JP', intlOptions: { + year: 'numeric', + month: 'long', + day: 'numeric', + hour: '2-digit', + minute: '2-digit', + second: '2-digit', + }}), +); // Outputs '2024年12月31日 23:59:00' +``` + +💡 Remember, it's not just about translating the date and time; it's about presenting them in a way that feels natural and familiar to the user, no matter where they are in the world. 🌐⌚ + +#### formatTime(date, options:) + +⏰🌐 This timely charmer is your key to unlocking the secrets of time presentation across different cultures. Using the wizardry of the Internationalization API (Intl), `formatTime` translates your time into a format that resonates with local customs and practices. Whether it's for scheduling international calls or just making sure you're in sync with the world's timezones, this function is your trusty sidekick in the realm of time formatting! 🌟⌚ + +##### Examples + +```javascript +// Simple time formatting +console.log(formatTime(new Date(), {locale: 'en-US'})); // Outputs something like '10:00 AM' + +// Time formatting with extended options in French +console.log( + formatTime('2024-05-20 15:00', {locale: 'fr-FR', intlOptions: { + hour: '2-digit', + minute: '2-digit', + second: '2-digit', + }}), +); // Outputs '15:00:00' + +// Custom time formatting in Japanese +console.log( + formatTime('2024-05-20 23:59', {locale: 'ja-JP', intlOptions: { + hour: '2-digit', + minute: '2-digit', + hour12: true, + }}), +); // Outputs '11:59 午後' +``` + +💡 Pro Tip: `formatTime` isn't just about showing the time; it's about presenting it in a way that's intuitive and familiar to your audience, wherever they may be. 🌍🕒 + +#### getQuarter(date) + +🗓️🌷🍂 This calendar connoisseur takes any date and magically determines its quarter, effortlessly dividing the year into four distinct parts. Whether you're tracking financial quarters, academic periods, or just curious about the season, `getQuarter` is your key to easily navigating through the year's chapters. A handy tool for anyone dealing with dates, from accountants to students! 🌟📚 + +##### Examples + +```javascript +// Determining the quarter for a date in April +console.log(getQuarter('2024-04-15')); // Outputs 2 (Q2) + +// Finding out the quarter for a date in November +console.log(getQuarter(new Date(2024, 10, 25))); // Outputs 4 (Q4) + +// Identifying the quarter for a date in January +console.log(getQuarter('2024-01-01')); // Outputs 1 (Q1) +``` + +💡 Fun Fact: Did you know that quarters are not only useful in business and academia, but also in various forms of planning and analysis? With `getQuarter`, you'll always know where you stand in the rhythm of the year! 📈🍁 + +#### getRelativeTime(date, baseDate, options:) + +⏳🌏 This time-traveling virtuoso effortlessly bridges the gap between dates, offering a glimpse into the past or a peek into the future. With the help of the Internationalization API (Intl), `getRelativeTime` transforms absolute dates into relatable, human-friendly phrases like '3 hours ago' or 'in 2 days'. Whether you're reminiscing the past or anticipating the future, this function keeps you connected to time in the most intuitive way! 🚀🕰️ + +##### Examples + +```javascript +// How long ago was a past date? +console.log(getRelativeTime('2024-01-20', new Date())); // Outputs something like '3 days ago' + +// How much time until a future date? +console.log(getRelativeTime('2024-01-26', new Date())); // Outputs 'in 3 days' + +// Customizing output for different locales +console.log(getRelativeTime('2024-01-26', '2024-01-23', {locale: 'fr-FR'})); // Outputs 'dans 3 jours' (in 3 days in French) +``` + +💡 Pro Tip: `getRelativeTime` is not just a way to express time differences; it's a bridge that connects your users to the temporal context in a way that's both meaningful and culturally aware. Time is more than seconds and minutes; it's a story, and this function helps you tell it! 📖⌚ + +#### getWeek(date) + +📅🔢 This clever calendar companion swiftly calculates the week number for any given date, placing you precisely within the tapestry of the year. It's like having a bird's-eye view of the calendar, helping you navigate through the weeks with ease. Whether you're planning projects, tracking milestones, or simply curious about where you stand in the year, `getWeek` is your reliable guide through the annual journey! 🌟🗓️ + +##### Examples + +```javascript +// Finding the week number for a date in January +console.log(getWeek('2024-01-15')); // Outputs the week number in January 2024 + +// Determining the week number for a date in mid-year +console.log(getWeek(new Date(2024, 5, 20))); // Outputs the week number in June 2024 + +// Calculating the week number for a date towards the end of the year +console.log(getWeek('2024-12-31')); // Outputs the week number at the end of December 2024 +``` + +💡 Did You Know? The concept of week numbers is especially popular in business and academia for organizing schedules and events. With `getWeek`, staying on top of your plans becomes a breeze, giving you a clear view of your year at a glance! 🌍📊 + +#### getWeekdays(options:) + +📅🌐 This global day-namer is your trusty guide through the week, no matter where you are in the world. Using the power of the Internationalization API (Intl), `getWeekdays` serves up the names of all seven days tailored to your chosen locale. From planning international meetings to creating a multilingual planner, this function provides the perfect blend of cultural awareness and practical utility, keeping you in sync with the local rhythm of life, one day at a time! 🌟🗓️ + +##### Examples + +```javascript +// Getting weekdays in English +console.log(getWeekdays({locale: 'en-US'})); // Outputs ['Sunday', 'Monday', ..., 'Saturday'] + +// Discovering weekdays in French +console.log(getWeekdays({locale: 'fr-FR'})); // Outputs ['dimanche', 'lundi', ..., 'samedi'] + +// Exploring weekdays in Japanese +console.log(getWeekdays({locale: 'ja-JP'})); // Outputs ['日曜日', '月曜日', ..., '土曜日'] +``` + +💡 Did You Know? The order and names of weekdays vary across cultures and languages. With `getWeekdays`, you can easily cater to a global audience, ensuring that your application speaks their language, quite literally! 🌍🗣️ + +#### isAfter(date1, date2) + +⏱️🔍 This temporal detective is your go-to for solving date mysteries! `isAfter` takes two dates and cleverly reveals whether the first is indeed later than the second. It's like having a time-traveling magnifying glass, making it super easy to compare dates in your applications. Whether you're scheduling deadlines, organizing events, or just curious about the order of things, `isAfter` is your trusty sidekick in the world of time! 🌟📅 + +##### Examples + +```javascript +// Checking if one date is after another +console.log(isAfter('2024-01-25', '2024-01-20')); // Outputs true (Jan 25, 2024 is after Jan 20, 2024) + +// Comparing today with a future date +console.log(isAfter(new Date(), '2024-12-31')); // Outputs false if today is before Dec 31, 2024 + +// Comparing dates in different years +console.log(isAfter('2025-01-01', '2024-12-31')); // Outputs true (Jan 1, 2025 is after Dec 31, 2024) +``` + +💡 Pro Tip: `isAfter` isn't just a function; it's a time machine in your coding toolbox! Use it to prevent past dates in booking systems, validate deadlines, or even in time-sensitive games and activities. Time is in your hands now, code it wisely! 🎩⏳ + +#### isBefore(date1, date2) + +⏳🔎 This is your chronological compass, guiding you through the timelines with ease! `isBefore` is the function that answers one of time's classic questions: Is this date before that one? It's an essential tool for applications dealing with deadlines, scheduling, and historical data. With `isBefore`, you can effortlessly determine the sequence of events, plan ahead, and ensure that you're not mixing up your yesterdays and tomorrows. 🌟📆 + +##### Examples + +```javascript +// Checking if a date is before another +console.log(isBefore('2024-01-10', '2024-01-15')); // Outputs true if Jan 10, 2024 is before Jan 15, 2024 + +// Verifying if today is before a specific date +console.log(isBefore(new Date(), '2024-12-31')); // Outputs true if today is before Dec 31, 2024 + +// Comparing two dates in different years +console.log(isBefore('2023-12-31', '2024-01-01')); // Outputs true since Dec 31, 2023 is before Jan 1, 2024 +``` + +💡 Pro Tip: `isBefore` is not just about past and future. It's about making informed decisions, managing timelines efficiently, and ensuring that everything happens at the right moment. Use it to navigate through the complexities of time with confidence and precision! 🎩⌛ + +#### isLeapYear(year) + +🌌📅 Leap into the fascinating world of calendars with `isLeapYear`! This function is your trusty sidekick in unraveling the mysteries of the Gregorian calendar. It answers the question: Is this year a leap year? Leap years, with their extra day in February, keep our calendars aligned with Earth's orbit around the Sun. Whether you're scheduling events, programming a calendar application, or just satisfying your curiosity, `isLeapYear` is an essential tool. 🚀🗓️ + +##### Examples + +```javascript +// Check if 2020 is a leap year +console.log(isLeapYear(2020)); // Outputs true, as 2020 is a leap year + +// Verify if 2023 is a leap year +console.log(isLeapYear(2023)); // Outputs false, as 2023 is not a leap year + +// Determine if 1900 is a leap year (it's not, despite being divisible by 4!) +console.log(isLeapYear(1900)); // Outputs false, as 1900 is not a leap year by Gregorian rules +``` + +💡 Pro Tip: `isLeapYear` not only simplifies date calculations but also serves as a fun fact generator! Impress your friends and colleagues with your knowledge about leap years and why they exist. Remember, every four years, we get that extra day, thanks to the quirks of our solar system and the way we track time! 🌍⏰🎉 + +#### isSameDay(date1, date2) + +🌞📅 The `isSameDay` function is a calendar wizard's dream! It’s like having an eagle-eye view of your calendar, helping you pinpoint if two dates fall on the same glorious day. Whether you're organizing events, tracking special occasions, or coding up the next great scheduling app, `isSameDay` is your go-to for aligning dates with cosmic precision. 🌌🔍 + +##### Examples + +```javascript +// Compare two dates for the same day +const firstDate = new Date(2022, 3, 15); // April 15, 2022 +const secondDate = new Date(2022, 3, 15); // April 15, 2022 +console.log(isSameDay(firstDate, secondDate)); // Outputs true, both dates are April 15, 2022 + +// Checking different days +const anotherDate = new Date(2022, 3, 16); // April 16, 2022 +console.log(isSameDay(firstDate, anotherDate)); // Outputs false, different days! + +// Works with string inputs too! +console.log(isSameDay('2022-04-15', '2022-04-15')); // Outputs true, both represent April 15, 2022 +``` + +💡 Handy Tip: Use `isSameDay` to avoid double-booking, remember anniversaries, or even to trigger daily reminders. It's your silent guardian in the realm of dates, ensuring you're always on top of your day-to-day adventures. 🎯📆🚀 + +#### isValidDate(dateString, options:) + +🕵️‍♂️🗓️ The `isValidDate` function now comes with an international flair! It's a robust date validator that not only checks if a date is valid but also ensures it aligns with the date format of a specific locale. Perfect for applications catering to a global audience, it scrutinizes dates against various international formats, making it a versatile tool in your date validation arsenal. 🌍⏳ + +##### Examples + +```javascript +// Validating a date string against a specific locale +console.log(isValidDate('15/04/2022', {countryCode: 'GB'})); // Outputs true for DD/MM/YYYY format (UK) + +// Checking a date string in American format +console.log(isValidDate('04-15-2022', {countryCode: 'US'})); // Outputs true for MM-DD-YYYY format (USA) + +// Testing an invalid date string for a given locale +console.log(isValidDate('2022-15-04', {countryCode: 'US'})); // Outputs false, incorrect format for USA + +// Attempting to validate a date with an unsupported country code +console.log(isValidDate('15.04.2022', {countryCode: 'ZZ'})); // Outputs false, 'ZZ' is not a recognized country code +``` + +💡 Pro Tip: Employ `isValidDate` for validating user inputs in internationalized applications, ensuring compatibility with locale-specific date formats. It’s your trusty guardian, assuring that dates align with regional norms. 🚦🔍🌐 + +#### parseDateTime(dateInput, options:) + +🔍🗓️ The `parseDateTime` function is like a time-traveler's best friend, expertly navigating the complex world of dates and times. Whether it's a string or a Date object you're dealing with, this function seamlessly transforms it into a comprehensive, easy-to-digest package of date information, tailored to any locale you desire. 🌍⏲️ + +##### Examples + +```javascript +// Parsing a date string with default locale and options +const parsed1 = parseDateTime('18/01/2024'); +console.log(parsed1); // Outputs object with detailed date components +/* + { + "day": "18", + "month": "01", + "year": "2024", + "rawParts": [ + { + "type": "day", + "value": "18" + }, + { + "type": "literal", + "value": "/" + }, + { + "type": "month", + "value": "01" + }, + { + "type": "literal", + "value": "/" + }, + { + "type": "year", + "value": "2024" + } + ], + "formattedDate": "18/01/2024", + "dateObj": "2024-01-17T18:30:00.000Z" + } +*/ + +// Parsing with specific locale and formatting options +const parsed2 = parseDateTime( + '2024-01-23', + { + intlOptions: { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }, + locale: 'fr-FR', + } +); +console.log(parsed2); // Outputs object with formatted date in French +/* + { + "weekday": "mardi", + "day": "23", + "month": "janvier", + "year": "2024", + "rawParts": [ + { + "type": "weekday", + "value": "mardi" + }, + { + "type": "literal", + "value": " " + }, + { + "type": "day", + "value": "23" + }, + { + "type": "literal", + "value": " " + }, + { + "type": "month", + "value": "janvier" + }, + { + "type": "literal", + "value": " " + }, + { + "type": "year", + "value": "2024" + } + ], + "formattedDate": "mardi 23 janvier 2024", + "dateObj": "2024-01-22T18:30:00.000Z" + } +*/ + +// Parsing a Date object +const parsed3 = parseDateTime(new Date(2024, 0, 23)); +console.log(parsed3); // Outputs object with date components for January 23, 2024 +/* + { + "day": "23", + "month": "01", + "year": "2024", + "rawParts": [ + { + "type": "day", + "value": "23" + }, + { + "type": "literal", + "value": "/" + }, + { + "type": "month", + "value": "01" + }, + { + "type": "literal", + "value": "/" + }, + { + "type": "year", + "value": "2024" + } + ], + "formattedDate": "23/01/2024", + "dateObj": "2024-01-22T18:30:00.000Z" + } +*/ +``` + +💡 Pro Tip: Leverage `parseDateTime` in applications where detailed date analysis and manipulation are key, such as in calendar apps, scheduling tools, or date-sensitive data processing. It's like having a Swiss Army knife for all things related to dates and times! 📅🛠️ + +#### subtract(date, options:) + +🕒🔙 The `subtract` function is like your personal time machine, allowing you to step back in time with ease. It's perfect for those moments when you need to calculate past dates, like figuring out what day it was 'x' days, months, or years ago. Simply tell it the time unit and how far back you want to go, and voilà! You're traveling back in time! 🚀🗓️ + +##### Examples + +```javascript +// Subtracting days +console.log(subtract(new Date(2024, 0, 23), {value: 10, unit: 'days'})); // Go back 10 days from Jan 23, 2024 + +// Subtracting months +console.log(subtract('2024-01-23', {value: 2, unit: 'months'})); // Go back 2 months from Jan 23, 2024 + +// Subtracting years +console.log(subtract(new Date(2024, 0, 23), {value: 5, unit: 'years'})); // Go back 5 years from Jan 23, 2024 +``` + +💡 Pro Tip: Use the `subtract` function in applications like reminder services, historical data analysis, or anywhere you need to calculate past dates. It's a handy tool to have in your developer toolkit for managing date-based logic! 📅⏮️ From e591663f8a3900bfe5eea4a1914828567e6b8494 Mon Sep 17 00:00:00 2001 From: Divyansh Singh Date: Wed, 14 Feb 2024 15:38:46 +0530 Subject: [PATCH 28/28] test[ATLAS-104]: Adding Unit Tests for Date & Time Module (#55) * add test fils * add UT for add - dateTime module * migrate test files * add UT for formatDate - dateTime module * add UT for formatDateTime - dateTime module * fix formatDate * add UT for formatTime - dateTime module * add leftout locales date format * add UT for getQuarter - dateTime module * add UT for getQuarter - dateTime module * add UT for getRelativeTime - dateTime module * add UT for getWeek - dateTime * add UT for getWeekdays - dateTime * add UT for isAfter - dateTime * add UT for isBefore - dateTime * add UT for isLeapYear - dateTime * add UT for isSameDay - dateTime * fix numerals test case * add date format in stringToDate * add UT for parseDateTime - dateTime * add UT for subtract - dateTime * add UT for stringToDate - utils - dateTime * comment failing test cases * remove extra files * [fix]: fix failing UT * [fix]: fix failing UT --- .../modules/dateTime/__tests__/add.test.ts | 63 +++++++++++ .../dateTime/__tests__/formatDate.test.ts | 58 ++++++++++ .../dateTime/__tests__/formatDateTime.test.ts | 53 +++++++++ .../dateTime/__tests__/formatTime.test.ts | 43 ++++++++ .../dateTime/__tests__/getQuarter.test.ts | 38 +++++++ .../__tests__/getRelativeTime.test.ts | 45 ++++++++ .../dateTime/__tests__/getWeek.test.ts | 29 +++++ .../dateTime/__tests__/getWeekdays.test.ts | 63 +++++++++++ .../dateTime/__tests__/isAfter.test.ts | 33 ++++++ .../dateTime/__tests__/isBefore.test.ts | 33 ++++++ .../dateTime/__tests__/isLeapYear.test.ts | 24 ++++ .../dateTime/__tests__/isSameDay.test.ts | 30 +++++ .../dateTime/__tests__/isValidDate.test.ts | 34 ++++++ .../dateTime/__tests__/parseDateTime.test.ts | 103 ++++++++++++++++++ .../dateTime/__tests__/subtract.test.ts | 53 +++++++++ .../modules/dateTime/__tests__/utils.test.ts | 59 ++++++++++ .../src/modules/dateTime/isValidDate.ts | 6 +- 17 files changed, 764 insertions(+), 3 deletions(-) create mode 100644 packages/i18nify-js/src/modules/dateTime/__tests__/add.test.ts create mode 100644 packages/i18nify-js/src/modules/dateTime/__tests__/formatDate.test.ts create mode 100644 packages/i18nify-js/src/modules/dateTime/__tests__/formatDateTime.test.ts create mode 100644 packages/i18nify-js/src/modules/dateTime/__tests__/formatTime.test.ts create mode 100644 packages/i18nify-js/src/modules/dateTime/__tests__/getQuarter.test.ts create mode 100644 packages/i18nify-js/src/modules/dateTime/__tests__/getRelativeTime.test.ts create mode 100644 packages/i18nify-js/src/modules/dateTime/__tests__/getWeek.test.ts create mode 100644 packages/i18nify-js/src/modules/dateTime/__tests__/getWeekdays.test.ts create mode 100644 packages/i18nify-js/src/modules/dateTime/__tests__/isAfter.test.ts create mode 100644 packages/i18nify-js/src/modules/dateTime/__tests__/isBefore.test.ts create mode 100644 packages/i18nify-js/src/modules/dateTime/__tests__/isLeapYear.test.ts create mode 100644 packages/i18nify-js/src/modules/dateTime/__tests__/isSameDay.test.ts create mode 100644 packages/i18nify-js/src/modules/dateTime/__tests__/isValidDate.test.ts create mode 100644 packages/i18nify-js/src/modules/dateTime/__tests__/parseDateTime.test.ts create mode 100644 packages/i18nify-js/src/modules/dateTime/__tests__/subtract.test.ts create mode 100644 packages/i18nify-js/src/modules/dateTime/__tests__/utils.test.ts diff --git a/packages/i18nify-js/src/modules/dateTime/__tests__/add.test.ts b/packages/i18nify-js/src/modules/dateTime/__tests__/add.test.ts new file mode 100644 index 00000000..7e59cf93 --- /dev/null +++ b/packages/i18nify-js/src/modules/dateTime/__tests__/add.test.ts @@ -0,0 +1,63 @@ +import add from '../add'; + +describe('dateTime - add', () => { + // Basic Functionality Tests + test('adds days to a date', () => { + const startDate = new Date(2024, 0, 1); // Jan 1, 2024 + expect(add(startDate, {value: 10, unit: 'days'})).toEqual(new Date(2024, 0, 11)); + }); + + test('adds months to a date', () => { + const startDate = new Date(2024, 0, 1); // Jan 1, 2024 + expect(add(startDate,{value: 2, unit: 'months'})).toEqual(new Date(2024, 2, 1)); + }); + + test('adds years to a date', () => { + const startDate = new Date(2024, 0, 1); // Jan 1, 2024 + expect(add(startDate, {value: 1, unit: 'years'})).toEqual(new Date(2025, 0, 1)); + }); + + test('handles negative values', () => { + const startDate = new Date(2024, 0, 10); + expect(add(startDate, {value: -5, unit: 'days'})).toEqual(new Date(2024, 0, 5)); + }); + + test('handles adding zero', () => { + const startDate = new Date(2024, 1, 13); + expect(add(startDate, {value: 0, unit: 'months'})).toEqual(startDate); + }); + + test('handles leap years', () => { + const startDate = new Date(2024, 1, 29); // Feb 29, 2024 + expect(add(startDate, {value: 1, unit: 'years'})).toEqual(new Date(2025, 1, 28)); // Feb 28, 2025 + }); + + test('handles month-end dates', () => { + const startDate = new Date(2024, 0, 31); // Jan 31, 2024 + expect(add(startDate, {value: 1, unit: 'months'})).toEqual(new Date(2024, 1, 29)); // Feb 29, 2024 + }); + + // Invalid Inputs + test('throws error for invalid date string', () => { + expect(() => add('invalid-date', {value: 1, unit: 'days'})).toThrow( + 'Error: Date format not recognized', + ); + }); + + test('throws error for invalid value', () => { + const startDate = new Date(2024, 0, 1); + expect(() => add(startDate, {value: NaN, unit: 'days'})).toThrow( + 'Error: Invalid value passed!', + ); + expect(() => add(startDate, {value: Infinity, unit: 'days'})).toThrow( + 'Error: Invalid value passed!', + ); + }); + + // Type Checking + test('handles Date object and date string inputs', () => { + const startDate = new Date(2024, 0, 1); + const startDateString = '2024-01-01'; + expect(add(startDate, {value: 1, unit: 'days'})).toEqual(add(startDateString, {value: 1, unit: 'days'})); + }); +}); diff --git a/packages/i18nify-js/src/modules/dateTime/__tests__/formatDate.test.ts b/packages/i18nify-js/src/modules/dateTime/__tests__/formatDate.test.ts new file mode 100644 index 00000000..69a66629 --- /dev/null +++ b/packages/i18nify-js/src/modules/dateTime/__tests__/formatDate.test.ts @@ -0,0 +1,58 @@ +import formatDate from '../formatDate'; +import { DateFormatOptions } from '../types'; + +describe('dateTime - formatDate', () => { + // Basic Functionality Tests + test.each([ + ['2024-01-01', 'en-US', undefined, '1/1/2024'], // US format + ['2024-01-01', 'en-GB', undefined, '01/01/2024'], // UK format + [ + '2024-02-29', + 'en-US', + { + day: '2-digit', + month: '2-digit', + year: 'numeric', + } as DateFormatOptions, + '02/29/2024', + ], // Leap year with specific format + ])( + 'formats date "%s" with locale "%s" and options %o to "%s"', + (date, locale, options, expected) => { + expect(formatDate(date, {locale: locale, intlOptions: options})).toBe(expected); + }, + ); + + test('formats end of year date', () => { + expect(formatDate('2024-12-31', {locale: 'en-US'})).toBe('12/31/2024'); + }); + + test('handles invalid date strings', () => { + expect(() => formatDate('invalid-date', {locale: 'en-US'})).toThrow(); + }); + + // Locale and Option Variations + test('formats date with different locales', () => { + const date = '2024-03-01'; + expect(formatDate(date, {locale: 'fr-FR'})).not.toBe(formatDate(date, {locale: 'de-DE'})); + }); + + test('formats date with different options', () => { + const date = '2024-03-01'; + const options1 = { + weekday: 'long', + year: 'numeric', + month: 'long', + day: 'numeric', + } as DateFormatOptions; + const options2 = { + year: '2-digit', + month: 'numeric', + day: 'numeric', + } as DateFormatOptions; + + expect(formatDate(date, {locale: 'en-US', intlOptions: options1})).not.toBe( + formatDate(date, {locale: 'en-US', intlOptions: options2}), + ); + }); +}); diff --git a/packages/i18nify-js/src/modules/dateTime/__tests__/formatDateTime.test.ts b/packages/i18nify-js/src/modules/dateTime/__tests__/formatDateTime.test.ts new file mode 100644 index 00000000..a565410e --- /dev/null +++ b/packages/i18nify-js/src/modules/dateTime/__tests__/formatDateTime.test.ts @@ -0,0 +1,53 @@ +import formatDateTime from '../formatDateTime'; +import { DateTimeFormatOptions } from '../types'; + +describe('dateTime - formatDateTime', () => { + // Basic Functionality Tests + test.each([ + ['2024-01-01T12:00:00', 'en-US', undefined, '1/1/2024, 12:00:00 PM'], // US format with time + ['2024-01-01T00:00:00', 'en-GB', { hour12: false }, '01/01/2024, 00:00:00'], // UK format with midnight time + ['2024-02-29T15:30:00', 'en-US', { hour12: false }, '2/29/2024, 15:30:00'], // Leap year with 24-hour format + ])( + 'formats date "%s" with locale "%s" and options %o to "%s"', + (date, locale, options, expected) => { + expect(formatDateTime(date, {locale: locale, intlOptions :options})).toBe(expected); + }, + ); + + test('formats end of year date with time', () => { + expect(formatDateTime('2024-12-31T23:59:59', {locale: 'en-US'})).toBe( + '12/31/2024, 11:59:59 PM', + ); + }); + + test('handles invalid date strings', () => { + expect(() => formatDateTime('invalid-date', {locale: 'en-US'})).toThrow(); + }); + + // Locale and Option Variations + test('formats date and time with different locales', () => { + const date = '2024-03-01T20:00:00'; + expect(formatDateTime(date, {locale: 'fr-FR'})).not.toBe( + formatDateTime(date, {locale: 'de-DE'}), + ); + }); + + test('formats date and time with different options', () => { + const date = '2024-03-01T20:00:00'; + const options1 = { + hour: '2-digit', + minute: '2-digit', + second: '2-digit', + hour12: true, + } as DateTimeFormatOptions; + const options2 = { + hour: '2-digit', + minute: '2-digit', + second: '2-digit', + hour12: false, + } as DateTimeFormatOptions; + expect(formatDateTime(date, {locale: 'en-US', intlOptions :options1})).not.toBe( + formatDateTime(date, {locale: 'en-US', intlOptions: options2}), + ); + }); +}); diff --git a/packages/i18nify-js/src/modules/dateTime/__tests__/formatTime.test.ts b/packages/i18nify-js/src/modules/dateTime/__tests__/formatTime.test.ts new file mode 100644 index 00000000..bbc4ebae --- /dev/null +++ b/packages/i18nify-js/src/modules/dateTime/__tests__/formatTime.test.ts @@ -0,0 +1,43 @@ +import formatTime from '../formatTime'; +import { DateTimeFormatOptions } from '../types'; + +describe('formatTime function', () => { + // Basic Functionality Tests + test.each([ + ['2024-01-01T12:00:00', 'en-US', undefined, '12:00:00 PM'], // US format 12-hour clock + ['2024-01-01T00:00:00', 'en-GB', { hour12: false }, '00:00:00'], // UK format 24-hour clock + ['2024-01-01T15:30:00', 'en-US', { hour12: false }, '15:30:00'], // US format 24-hour clock + ])( + 'formats time "%s" with locale "%s" and options %o to "%s"', + (date, locale, options, expected) => { + expect(formatTime(date, {locale, intlOptions :options})).toBe(expected); + }, + ); + + test('formats midnight time', () => { + expect(formatTime('2024-01-01T00:00:00', {locale: 'en-US'})).toBe('12:00:00 AM'); + }); + + test('formats end of day time', () => { + expect(formatTime('2024-01-01T23:59:59', {locale: 'en-US'})).toBe('11:59:59 PM'); + }); + + test('formats time with different options', () => { + const date = '2024-03-01T20:00:00'; + const options1 = { + hour: '2-digit', + minute: '2-digit', + second: '2-digit', + hour12: true, + } as Omit; + const options2 = { + hour: '2-digit', + minute: '2-digit', + second: '2-digit', + hour12: false, + } as Omit; + expect(formatTime(date, {locale: 'en-US', intlOptions :options1})).not.toBe( + formatTime(date, {locale: 'en-US', intlOptions: options2}), + ); + }); +}); diff --git a/packages/i18nify-js/src/modules/dateTime/__tests__/getQuarter.test.ts b/packages/i18nify-js/src/modules/dateTime/__tests__/getQuarter.test.ts new file mode 100644 index 00000000..99b473a2 --- /dev/null +++ b/packages/i18nify-js/src/modules/dateTime/__tests__/getQuarter.test.ts @@ -0,0 +1,38 @@ +import getQuarter from '../getQuarter'; + +describe('dateTime - getQuarter', () => { + test('returns 1 for dates in the first quarter', () => { + expect(getQuarter('2024-01-01')).toBe(1); // Beginning of Q1 + expect(getQuarter('2024-02-15')).toBe(1); // Middle of Q1 + expect(getQuarter('2024-03-31')).toBe(1); // End of Q1 + }); + + test('returns 2 for dates in the second quarter', () => { + expect(getQuarter('2024-04-01')).toBe(2); // Beginning of Q2 + expect(getQuarter('2024-05-15')).toBe(2); // Middle of Q2 + expect(getQuarter('2024-06-30')).toBe(2); // End of Q2 + }); + + test('returns 3 for dates in the third quarter', () => { + expect(getQuarter('2024-07-01')).toBe(3); // Beginning of Q3 + expect(getQuarter('2024-08-15')).toBe(3); // Middle of Q3 + expect(getQuarter('2024-09-30')).toBe(3); // End of Q3 + }); + + test('returns 4 for dates in the fourth quarter', () => { + expect(getQuarter('2024-10-01')).toBe(4); // Beginning of Q4 + expect(getQuarter('2024-11-15')).toBe(4); // Middle of Q4 + expect(getQuarter('2024-12-31')).toBe(4); // End of Q4 + }); + + test('handles string and Date inputs', () => { + expect(getQuarter('2024-04-15')).toBe(2); // String input + expect(getQuarter(new Date('2024-04-15'))).toBe(2); // Date object input + }); + + test('throws an error for invalid date inputs', () => { + expect(() => getQuarter('invalid-date')).toThrow( + 'Date format not recognized', + ); + }); +}); diff --git a/packages/i18nify-js/src/modules/dateTime/__tests__/getRelativeTime.test.ts b/packages/i18nify-js/src/modules/dateTime/__tests__/getRelativeTime.test.ts new file mode 100644 index 00000000..11963a8f --- /dev/null +++ b/packages/i18nify-js/src/modules/dateTime/__tests__/getRelativeTime.test.ts @@ -0,0 +1,45 @@ +import getRelativeTime from '../getRelativeTime'; + +describe('dateTime - getRelativeTime', () => { + const now = new Date(); + + test('returns correct relative time for seconds', () => { + const thirtySecondsAgo = new Date(now.getTime() - 30 * 1000); + expect(getRelativeTime(thirtySecondsAgo, now)).toBe('30 seconds ago'); + const inThirtySeconds = new Date(now.getTime() + 30 * 1000); + expect(getRelativeTime(inThirtySeconds, now)).toBe('in 30 seconds'); + }); + + test('returns correct relative time for minutes', () => { + const fiveMinutesAgo = new Date(now.getTime() - 5 * 60 * 1000); + expect(getRelativeTime(fiveMinutesAgo, now)).toBe('5 minutes ago'); + const inFiveMinutes = new Date(now.getTime() + 5 * 60 * 1000); + expect(getRelativeTime(inFiveMinutes, now)).toBe('in 5 minutes'); + }); + + test('returns correct relative time for hours', () => { + const twoHoursAgo = new Date(now.getTime() - 2 * 60 * 60 * 1000); + expect(getRelativeTime(twoHoursAgo, now)).toBe('2 hours ago'); + const inTwoHours = new Date(now.getTime() + 2 * 60 * 60 * 1000); + expect(getRelativeTime(inTwoHours, now)).toBe('in 2 hours'); + }); + + test('returns correct relative time for days', () => { + const threeDaysAgo = new Date(now.getTime() - 3 * 24 * 60 * 60 * 1000); + expect(getRelativeTime(threeDaysAgo, now)).toBe('3 days ago'); + const inThreeDays = new Date(now.getTime() + 3 * 24 * 60 * 60 * 1000); + expect(getRelativeTime(inThreeDays, now)).toBe('in 3 days'); + }); + + test('handles different locales', () => { + const oneDayAgo = new Date(now.getTime() - 24 * 60 * 60 * 1000); + expect(getRelativeTime(oneDayAgo, now, {locale: 'en-US'})).toBe('1 day ago'); + expect(getRelativeTime(oneDayAgo, now, {locale: 'fr-FR'})).toBe('il y a 1 jour'); + }); + + test('throws an error for invalid date inputs', () => { + expect(() => getRelativeTime('invalid-date', now)).toThrow( + 'Date format not recognized', + ); + }); +}); diff --git a/packages/i18nify-js/src/modules/dateTime/__tests__/getWeek.test.ts b/packages/i18nify-js/src/modules/dateTime/__tests__/getWeek.test.ts new file mode 100644 index 00000000..930e116d --- /dev/null +++ b/packages/i18nify-js/src/modules/dateTime/__tests__/getWeek.test.ts @@ -0,0 +1,29 @@ +import getWeek from '../getWeek'; + +describe('dateTime - getWeek', () => { + test('returns correct week number at the beginning of the year', () => { + expect(getWeek('2024-01-01')).toBe(1); // First day of the year + expect(getWeek('2024-01-07')).toBe(2); // Seventh day of the year + }); + + test('returns correct week number at the end of the year', () => { + expect(getWeek('2024-12-31')).toBe(53); // Last day of a leap year + }); + + test('returns correct week number for a leap year', () => { + expect(getWeek('2024-02-29')).toBe(9); // Leap day + }); + + test('returns correct week number for a date in the middle of the year', () => { + expect(getWeek('2024-06-15')).toBe(24); // A date in mid-June + }); + + test('handles string and Date inputs', () => { + expect(getWeek('2024-04-15')).toBe(16); // String input + expect(getWeek(new Date('2024-04-15'))).toBe(16); // Date object input + }); + + test('throws an error for invalid date inputs', () => { + expect(() => getWeek('invalid-date')).toThrow('Date format not recognized'); + }); +}); diff --git a/packages/i18nify-js/src/modules/dateTime/__tests__/getWeekdays.test.ts b/packages/i18nify-js/src/modules/dateTime/__tests__/getWeekdays.test.ts new file mode 100644 index 00000000..c546ac16 --- /dev/null +++ b/packages/i18nify-js/src/modules/dateTime/__tests__/getWeekdays.test.ts @@ -0,0 +1,63 @@ +import getWeekdays from '../getWeekdays'; +import { DateTimeFormatOptions } from '../types'; + +describe('dateTime - getWeekdays', () => { + const testCases = [ + { + locale: 'en-US', + expected: [ + 'Sunday', + 'Monday', + 'Tuesday', + 'Wednesday', + 'Thursday', + 'Friday', + 'Saturday', + ], + options: {}, + }, + { + locale: 'de-DE', + expected: [ + 'Sonntag', + 'Montag', + 'Dienstag', + 'Mittwoch', + 'Donnerstag', + 'Freitag', + 'Samstag', + ], + options: {}, + }, + { + locale: 'fr-FR', + expected: [ + 'dimanche', + 'lundi', + 'mardi', + 'mercredi', + 'jeudi', + 'vendredi', + 'samedi', + ], + options: {}, + }, + { + locale: 'en-US', + expected: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], + options: { weekday: 'short' }, + }, + ]; + + testCases.forEach(({ locale, expected, options }) => { + test(`returns correct weekdays for ${locale} locale`, () => { + const weekdays = getWeekdays({ + locale, + intlOptions :options as DateTimeFormatOptions, + } + ); + expect(weekdays).toHaveLength(7); + expect(weekdays).toEqual(expected); + }); + }); +}); diff --git a/packages/i18nify-js/src/modules/dateTime/__tests__/isAfter.test.ts b/packages/i18nify-js/src/modules/dateTime/__tests__/isAfter.test.ts new file mode 100644 index 00000000..a4dd26c5 --- /dev/null +++ b/packages/i18nify-js/src/modules/dateTime/__tests__/isAfter.test.ts @@ -0,0 +1,33 @@ +import isAfter from '../isAfter'; + +describe('dateTime - isAfter', () => { + test('returns true when the first date is after the second date', () => { + expect(isAfter('2024-01-02', '2024-01-01')).toBe(true); + expect(isAfter(new Date(2024, 0, 2), new Date(2024, 0, 1))).toBe(true); + }); + + test('returns false when the first date is before the second date', () => { + expect(isAfter('2024-01-01', '2024-01-02')).toBe(false); + expect(isAfter(new Date(2024, 0, 1), new Date(2024, 0, 2))).toBe(false); + }); + + test('returns false when the dates are the same', () => { + expect(isAfter('2024-01-01', '2024-01-01')).toBe(false); + expect(isAfter(new Date(2024, 0, 1), new Date(2024, 0, 1))).toBe(false); + }); + + test('handles different time units correctly', () => { + expect(isAfter('2024-01-01T01:00:00', '2024-01-01T00:59:59')).toBe(true); + expect(isAfter('2024-01-01T00:00:01', '2024-01-01T00:00:00')).toBe(true); + }); + + test('handles different date formats', () => { + expect(isAfter('01/02/2024', '01/01/2024')).toBe(true); // MM/DD/YYYY format + expect(isAfter('2024.01.02', '2024.01.01')).toBe(true); // YYYY.MM.DD format + }); + + test('throws an error for invalid date formats', () => { + expect(() => isAfter('invalid-date', '2024-01-01')).toThrow(Error); + expect(() => isAfter('2024-01-01', 'invalid-date')).toThrow(Error); + }); +}); diff --git a/packages/i18nify-js/src/modules/dateTime/__tests__/isBefore.test.ts b/packages/i18nify-js/src/modules/dateTime/__tests__/isBefore.test.ts new file mode 100644 index 00000000..68522cfd --- /dev/null +++ b/packages/i18nify-js/src/modules/dateTime/__tests__/isBefore.test.ts @@ -0,0 +1,33 @@ +import isBefore from '../isBefore'; + +describe('dateTime - isBefore', () => { + test('returns true when the first date is before the second date', () => { + expect(isBefore('2024-01-01', '2024-01-02')).toBe(true); + expect(isBefore(new Date(2024, 0, 1), new Date(2024, 0, 2))).toBe(true); + }); + + test('returns false when the first date is after the second date', () => { + expect(isBefore('2024-01-02', '2024-01-01')).toBe(false); + expect(isBefore(new Date(2024, 0, 2), new Date(2024, 0, 1))).toBe(false); + }); + + test('returns false when the dates are the same', () => { + expect(isBefore('2024-01-01', '2024-01-01')).toBe(false); + expect(isBefore(new Date(2024, 0, 1), new Date(2024, 0, 1))).toBe(false); + }); + + test('handles different time units correctly', () => { + expect(isBefore('2024-01-01T00:00:00', '2024-01-01T00:00:01')).toBe(true); + expect(isBefore('2024-01-01T23:59:59', '2024-01-02T00:00:00')).toBe(true); + }); + + test('handles different date formats', () => { + expect(isBefore('01/01/2024', '01/02/2024')).toBe(true); // MM/DD/YYYY format + expect(isBefore('2024.01.01', '2024.01.02')).toBe(true); // YYYY.MM.DD format + }); + + test('throws an error for invalid date formats', () => { + expect(() => isBefore('invalid-date', '2024-01-01')).toThrow(Error); + expect(() => isBefore('2024-01-01', 'invalid-date')).toThrow(Error); + }); +}); diff --git a/packages/i18nify-js/src/modules/dateTime/__tests__/isLeapYear.test.ts b/packages/i18nify-js/src/modules/dateTime/__tests__/isLeapYear.test.ts new file mode 100644 index 00000000..d8b4e50a --- /dev/null +++ b/packages/i18nify-js/src/modules/dateTime/__tests__/isLeapYear.test.ts @@ -0,0 +1,24 @@ +import isLeapYear from '../isLeapYear'; + +describe('dateTime - isLeapYear', () => { + test('returns true for leap years', () => { + expect(isLeapYear(2024)).toBe(true); // Divisible by 4 + expect(isLeapYear(2000)).toBe(true); // Divisible by 100 and 400 + }); + + test('returns false for non-leap years', () => { + expect(isLeapYear(2023)).toBe(false); // Not divisible by 4 + expect(isLeapYear(2100)).toBe(false); // Divisible by 100 but not by 400 + }); + + test('works correctly for century years', () => { + expect(isLeapYear(1900)).toBe(false); // Century year, divisible by 100 but not 400 + expect(isLeapYear(2000)).toBe(true); // Century year, divisible by 100 and 400 + }); + + test('handles cases like Year 0 is considered a leap year, Negative leap year, Negative non-leap century year', () => { + expect(isLeapYear(0)).toBe(true); // Year 0 is considered a leap year + expect(isLeapYear(-4)).toBe(true); // Negative leap year + expect(isLeapYear(-100)).toBe(false); // Negative non-leap century year + }); +}); diff --git a/packages/i18nify-js/src/modules/dateTime/__tests__/isSameDay.test.ts b/packages/i18nify-js/src/modules/dateTime/__tests__/isSameDay.test.ts new file mode 100644 index 00000000..8a013510 --- /dev/null +++ b/packages/i18nify-js/src/modules/dateTime/__tests__/isSameDay.test.ts @@ -0,0 +1,30 @@ +import isSameDay from '../isSameDay'; + +describe('isSameDay function', () => { + test('returns true for the same dates', () => { + expect(isSameDay('2024-01-01', '2024-01-01')).toBe(true); + expect(isSameDay(new Date(2024, 0, 1), new Date(2024, 0, 1))).toBe(true); + }); + + test('returns true for dates with different times but the same day', () => { + expect(isSameDay('2024-01-01T08:30:00', '2024-01-01T17:45:00')).toBe(true); + expect( + isSameDay(new Date(2024, 0, 1, 8, 30), new Date(2024, 0, 1, 17, 45)), + ).toBe(true); + }); + + test('returns false for different dates', () => { + expect(isSameDay('2024-01-01', '2024-01-02')).toBe(false); + expect(isSameDay(new Date(2024, 0, 1), new Date(2024, 0, 2))).toBe(false); + }); + + test('handles cases around month and year transitions', () => { + expect(isSameDay('2024-01-01', '2023-12-31')).toBe(false); // Year transition + expect(isSameDay('2024-01-31', '2024-02-01')).toBe(false); // Month transition + }); + + test('throws an error for invalid date formats', () => { + expect(() => isSameDay('invalid-date', '2024-01-01')).toThrow(Error); + expect(() => isSameDay('2024-01-01', 'invalid-date')).toThrow(Error); + }); +}); diff --git a/packages/i18nify-js/src/modules/dateTime/__tests__/isValidDate.test.ts b/packages/i18nify-js/src/modules/dateTime/__tests__/isValidDate.test.ts new file mode 100644 index 00000000..86be071d --- /dev/null +++ b/packages/i18nify-js/src/modules/dateTime/__tests__/isValidDate.test.ts @@ -0,0 +1,34 @@ +import isValidDate from '../isValidDate'; + +describe('dateTime - isValidDate', () => { + test.each([ + // Valid dates for different locales + ['31/12/2020', 'GB', true], // Valid date in British format (DD/MM/YYYY) + ['2020-12-31', 'SE', true], // Valid date in Swedish format (YYYY-MM-DD) + ['12-31-2020', 'US', true], // Valid date in US format (MM-DD-YYYY) + + // Invalid dates + ['31/02/2020', 'GB', false], // Invalid date, February doesn't have 31 days + ['2020-13-01', 'SE', false], // Invalid month + ['02/29/2019', 'US', false], // 2019 is not a leap year + + // Leap year dates + ['29/02/2020', 'GB', true], // Leap year date in British format + ['2020-02-29', 'SE', true], // Leap year date in Swedish format + + // Invalid inputs + ['invalid-date', 'GB', false], // Non-date string + ['2020/02/31', 'SE', false], // Incorrectly formatted date + ['12-31-2020', 'GB', false], // Format mismatch for British + ])( + 'validates date "%s" for countryCode "%s"', + (dateString, countryCode, expected) => { + expect(isValidDate(dateString, {countryCode})).toBe(expected); + }, + ); + + test('handles non-string inputs gracefully', () => { + expect(isValidDate(null as unknown as string, {countryCode: 'GB'})).toBe(false); + expect(isValidDate(12345 as unknown as string, {countryCode: 'GB'})).toBe(false); + }); +}); diff --git a/packages/i18nify-js/src/modules/dateTime/__tests__/parseDateTime.test.ts b/packages/i18nify-js/src/modules/dateTime/__tests__/parseDateTime.test.ts new file mode 100644 index 00000000..caccdf81 --- /dev/null +++ b/packages/i18nify-js/src/modules/dateTime/__tests__/parseDateTime.test.ts @@ -0,0 +1,103 @@ +import parseDateTime from '../parseDateTime'; +import { DateTimeFormatOptions } from '../types'; + +describe('dateTime - parseDateTime', () => { + test('parses standard date input correctly', () => { + const date = '2024-01-01'; + const result = parseDateTime(date, {intlOptions: { + year: 'numeric', + month: 'long', + day: 'numeric', + }}); + expect(result.dateObj).toBeDefined(); + expect(result.formattedDate).toBe('January 1, 2024'); + expect(result.year).toBe('2024'); + expect(result.month).toBe('January'); + expect(result.day).toBe('1'); + }); + + test('formats date according to specified locale', () => { + const date = '2024-01-01'; + const locale = 'de-DE'; // German locale + const result = parseDateTime( + date, + { + intlOptions: { + year: 'numeric', + month: 'long', + day: 'numeric', + }, + locale, + } + ); + expect(result.formattedDate).toBe('1. Januar 2024'); // Format in German + }); + + test('throws error for invalid date input', () => { + const date = 'invalid-date'; + expect(() => parseDateTime(date)).toThrow(Error); + }); + + test('handles leap year correctly', () => { + const date = '2024-02-29'; + const result = parseDateTime(date); + if (result.dateObj) { + expect(result.dateObj.getFullYear()).toBe(2024); + expect(result.dateObj.getMonth()).toBe(1); // Month is 0-indexed + expect(result.dateObj.getDate()).toBe(29); + } + }); + + test('parses time components correctly', () => { + const dateTime = '2024-01-01 23:59:59'; + const result = parseDateTime(dateTime, {intlOptions: { + hour: 'numeric', + minute: 'numeric', + second: 'numeric', + hour12: false, + }}); + expect(result.hour).toBe('23'); + expect(result.minute).toBe('59'); + expect(result.second).toBe('59'); + }); + + test('verifies each date component', () => { + const date = '2024-01-01'; + const result = parseDateTime(date, {intlOptions: { + year: 'numeric', + month: 'long', + day: 'numeric', + }}); + expect(result.year).toBe('2024'); + expect(result.month).toBe('January'); + expect(result.day).toBe('1'); + }); + + test('respects intlOptions settings', () => { + const date = '2024-01-01'; + const intlOptions = { year: '2-digit', month: '2-digit', day: '2-digit' }; + const result = parseDateTime(date, {intlOptions: intlOptions as DateTimeFormatOptions}); + expect(result.formattedDate).toBe('01/01/24'); + }); + + test('falls back to system locale if none provided', () => { + const date = '2024-01-01'; + const result = parseDateTime(date); + // This test's outcome may vary based on the system's locale + expect(result.month).toBeDefined(); + }); + + test('handles different date formats', () => { + const dates = ['2024-01-01', '01/01/2024', '01.01.2024']; + dates.forEach((date) => { + const result = parseDateTime(date, {intlOptions: { + year: 'numeric', + month: 'long', + day: 'numeric', + }}); + expect(result.year).toBe('2024'); + expect(result.month).toBe('January'); + expect(result.day).toBe('1'); + }); + }); +}); diff --git a/packages/i18nify-js/src/modules/dateTime/__tests__/subtract.test.ts b/packages/i18nify-js/src/modules/dateTime/__tests__/subtract.test.ts new file mode 100644 index 00000000..51f24f2c --- /dev/null +++ b/packages/i18nify-js/src/modules/dateTime/__tests__/subtract.test.ts @@ -0,0 +1,53 @@ +import subtract from '../subtract'; + +describe('dateTime - subtract', () => { + // Test subtracting days + test('subtracts days correctly', () => { + const date = new Date(2024, 0, 31); // January 31, 2024 + const result = subtract(date, {value: 10, unit: 'days'}); + expect(result).toEqual(new Date(2024, 0, 21)); // January 21, 2024 + }); + + // Test subtracting months + test('subtracts months correctly', () => { + const date = new Date(2024, 5, 15); // June 15, 2024 + const result = subtract(date, {value: 2, unit: 'months'}); + expect(result).toEqual(new Date(2024, 3, 15)); // April 15, 2024 + }); + + // Test subtracting years + test('subtracts years correctly', () => { + const date = new Date(2024, 0, 1); // January 1, 2024 + const result = subtract(date, {value: 2, unit: 'years'}); + expect(result).toEqual(new Date(2022, 0, 1)); // January 1, 2022 + }); + + // Test leap year + test('handles leap year correctly when subtracting years', () => { + const date = new Date(2024, 1, 29); // February 29, 2024 + const result = subtract(date, {value: 1, unit: 'years'}); + expect(result).toEqual(new Date(2023, 1, 28)); // February 28, 2023 + }); + + // Test month end + test('handles month-end correctly when subtracting months', () => { + const date = new Date(2024, 2, 31); // March 31, 2024 + const result = subtract(date, {value: 1, unit: 'months'}); + expect(result).toEqual(new Date(2024, 1, 29)); // February 29, 2024 + }); + + // Test invalid value + test('throws error for invalid value', () => { + const date = new Date(2024, 0, 1); + expect(() => subtract(date, {value: Infinity, unit: 'days'})).toThrow( + 'Invalid value passed!', + ); + }); + + // Test invalid date + test('throws error for invalid date', () => { + expect(() => subtract('invalid-date', {value: 1, unit: 'days'})).toThrow( + 'Date format not recognized', + ); + }); +}); diff --git a/packages/i18nify-js/src/modules/dateTime/__tests__/utils.test.ts b/packages/i18nify-js/src/modules/dateTime/__tests__/utils.test.ts new file mode 100644 index 00000000..018b4d4a --- /dev/null +++ b/packages/i18nify-js/src/modules/dateTime/__tests__/utils.test.ts @@ -0,0 +1,59 @@ +import { stringToDate } from '../utils'; + +describe('dateTime - utils - stringToDate', () => { + // Test valid date formats + const validDates = [ + { input: '2024/02/29', expected: new Date(2024, 1, 29) }, + { input: '29/02/2024', expected: new Date(2024, 1, 29) }, + { input: '2024.02.29', expected: new Date(2024, 1, 29) }, + { input: '29-02-2024', expected: new Date(2024, 1, 29) }, + { input: '02/29/2024', expected: new Date(2024, 1, 29) }, + { input: '2024-02-29', expected: new Date(2024, 1, 29) }, + { input: '2024. 02. 29.', expected: new Date(2024, 1, 29) }, + { input: '02.29.2024', expected: new Date(2024, 1, 29) }, + { input: '2024-02-29T12:00:00', expected: new Date(2024, 1, 29, 12, 0, 0) }, + { input: '13/01/2024', expected: new Date('01/13/2024') }, + ]; + + validDates.forEach(({ input, expected }) => { + test(`correctly converts '${input}' to a Date object`, () => { + expect(stringToDate(input)).toEqual(expected); + }); + }); + + // Test invalid date formats + const invalidDateFormats = [ + '2024/13/01', + '2024.13.01', + '01-32-2024', + '2024-13-01', + '2024. 13. 01.', + ]; + + invalidDateFormats.forEach((input) => { + test(`throws an error for invalid date format string '${input}'`, () => { + expect(() => stringToDate(input)).toThrow('Date format not recognized'); + }); + }); + + // Test invalid dates + const invalidDates = ['32/01/2024', '2024-02-29T25:00:00']; + + invalidDates.forEach((input) => { + test(`throws an error for invalid date string '${input}'`, () => { + expect(() => stringToDate(input)).toThrow('Invalid Date!'); + }); + }); + + // Test valid leap year date + test('correctly identifies leap year dates', () => { + expect(stringToDate('2024/02/29')).toEqual(new Date(2024, 1, 29)); + }); + + // Test for timestamps + test('correctly converts timestamps', () => { + expect(stringToDate('2024-02-29T23:59:59')).toEqual( + new Date(2024, 1, 29, 23, 59, 59), + ); + }); +}); diff --git a/packages/i18nify-js/src/modules/dateTime/isValidDate.ts b/packages/i18nify-js/src/modules/dateTime/isValidDate.ts index 6cc32bb1..ab059722 100644 --- a/packages/i18nify-js/src/modules/dateTime/isValidDate.ts +++ b/packages/i18nify-js/src/modules/dateTime/isValidDate.ts @@ -6,11 +6,11 @@ import { LOCALE_DATE_FORMATS } from './data/localeDateFormats'; * Checks if a given string is a valid date according to a specific locale's date format. * * @param dateString The date string to validate. - * @param countryCode The countryCode to use for the date format. + * @param options Config object * @returns True if the dateString is a valid date according to the locale's format, false otherwise. */ -const isValidDate = (dateString: string, countryCode: string): boolean => { - const locale = COUNTRY_CODES_TO_LOCALE[countryCode]; +const isValidDate = (dateString: string, options: {countryCode: string}): boolean => { + const locale = COUNTRY_CODES_TO_LOCALE[options.countryCode]; // Type guard to ensure dateString is a string if (typeof dateString !== 'string') {