UNPKG

@malga-checkout-full/core

Version:
2,464 lines (2,439 loc) 464 kB
import { r as registerInstance, c as createEvent, h as h$1, H as Host, F as Fragment } from './index-637110af.js'; import { Q, Y } from './i18n.es-65ae201e.js'; import { f as formatCurrency } from './currency-22f5cec5.js'; import { c as cleanUnicode, s as splitAt, I as InvalidLength, i as isalpha, a as InvalidFormat, b as isdigits, d as InvalidComponent, w as weightedSum, e as InvalidChecksum, l as luhnChecksumValue, f as isValidDateCompactDDMMYY, j as jmbg, g as luhnChecksumValidate, r as run, h as rut$1, k as isValidDateCompactYYYYMMDD, v as validate$2i, m as rc, n as stnr, o as luhnChecksumDigit, p as isValidDateCompactYYMMDD, q as verhoeffValidate, t as jmbg$1, u as jmbg$2, x as banksMap, y as cities, z as curp, A as mod97base10Validate, B as isValidDate, C as nif$2, D as nipc, E as onrc, F as mod11mod10Validate, G as jmbg$3, H as jmbg$4, J as rc$1 } from './index-dfda0b92.js'; import { s as state } from './settings-b083bd16.js'; import { s as state$1, a as state$2, b as axios, c as create, d as create$1 } from './index-3c0a57b9.js'; import { B as BaseProvider, C as Charges, v as v4, A as Api, f as formatPayload$1, a as CustomerCards, s as state$3, M as MalgaPaymentsPixService, c as cleanTextSpecialCharacters } from './malga-payments-pix.service-10810724.js'; import { h as handleSubmitValidation } from './credit.utils-cc838e77.js'; import { c as cleanTextOnlyNumbers } from './clean-text-only-numbers-8dcdf6bd.js'; import './_commonjsHelpers-ba3f0406.js'; const countriesEnglish = [ { value: 'AF', label: 'Afghanistan', }, { value: 'AL', label: 'Albania', }, { value: 'DZ', label: 'Algeria', }, { value: 'AS', label: 'American Samoa', }, { value: 'AD', label: 'Andorra', }, { value: 'AO', label: 'Angola', }, { value: 'AI', label: 'Anguilla', }, { value: 'AG', label: 'Antigua and Barbuda', }, { value: 'AR', label: 'Argentina', }, { value: 'AM', label: 'Armenia', }, { value: 'AW', label: 'Aruba', }, { value: 'AU', label: 'Australia', }, { value: 'AT', label: 'Austria', }, { value: 'AZ', label: 'Azerbaijan', }, { value: 'BS', label: 'Bahamas', }, { value: 'BH', label: 'Bahrain', }, { value: 'BD', label: 'Bangladesh', }, { value: 'BB', label: 'Barbados', }, { value: 'BY', label: 'Belarus', }, { value: 'BE', label: 'Belgium', }, { value: 'BZ', label: 'Belize', }, { value: 'BJ', label: 'Benin', }, { value: 'BM', label: 'Bermuda', }, { value: 'BT', label: 'Bhutan', }, { value: 'BO', label: 'Bolivia', }, { value: 'BA', label: 'Bosnia and Herzegovina', }, { value: 'BW', label: 'Botswana', }, { value: 'BR', label: 'Brazil', }, { value: 'IO', label: 'British Indian Ocean Territory', }, { value: 'BG', label: 'Bulgaria', }, { value: 'BF', label: 'Burkina Faso', }, { value: 'BI', label: 'Burundi', }, { value: 'KH', label: 'Cambodia', }, { value: 'CM', label: 'Cameroon', }, { value: 'CA', label: 'Canada', }, { value: 'CV', label: 'Cape Verde', }, { value: 'KY', label: 'Cayman Islands', }, { value: 'CF', label: 'Central African Republic', }, { value: 'TD', label: 'Chad', }, { value: 'CL', label: 'Chile', }, { value: 'CN', label: 'China', }, { value: 'CO', label: 'Colombia', }, { value: 'KM', label: 'Comoros', }, { value: 'CG', label: 'Congo', }, { value: 'CK', label: 'Cook Islands', }, { value: 'CR', label: 'Costa Rica', }, { value: 'CI', label: "Côte d'Ivoire", }, { value: 'HR', label: 'Croatia', }, { value: 'CU', label: 'Cuba', }, { value: 'CW', label: 'Curaçao', }, { value: 'CY', label: 'Cyprus', }, { value: 'CZ', label: 'Czech Republic', }, { value: 'CD', label: 'Democratic Republic of the Congo', }, { value: 'DK', label: 'Denmark', }, { value: 'DJ', label: 'Djibouti', }, { value: 'DM', label: 'Dominica', }, { value: 'DO', label: 'Dominican Republic', }, { value: 'EC', label: 'Ecuador', }, { value: 'EG', label: 'Egypt', }, { value: 'SV', label: 'El Salvador', }, { value: 'GQ', label: 'Equatorial Guinea', }, { value: 'ER', label: 'Eritrea', }, { value: 'EE', label: 'Estonia', }, { value: 'ET', label: 'Ethiopia', }, { value: 'FK', label: 'Falkland Islands (Malvinas)', }, { value: 'FO', label: 'Faroe Islands', }, { value: 'FJ', label: 'Fiji', }, { value: 'FI', label: 'Finland', }, { value: 'FR', label: 'France', }, { value: 'PF', label: 'French Polynesia', }, { value: 'GA', label: 'Gabon', }, { value: 'GM', label: 'Gambia', }, { value: 'GE', label: 'Georgia', }, { value: 'DE', label: 'Germany', }, { value: 'GH', label: 'Ghana', }, { value: 'GI', label: 'Gibraltar', }, { value: 'GR', label: 'Greece', }, { value: 'GL', label: 'Greenland', }, { value: 'GD', label: 'Grenada', }, { value: 'GU', label: 'Guam', }, { value: 'GT', label: 'Guatemala', }, { value: 'GG', label: 'Guernsey', }, { value: 'GN', label: 'Guinea', }, { value: 'GW', label: 'Guinea-Bissau', }, { value: 'HT', label: 'Haiti', }, { value: 'HN', label: 'Honduras', }, { value: 'HK', label: 'Hong Kong', }, { value: 'HU', label: 'Hungary', }, { value: 'IS', label: 'Iceland', }, { value: 'IN', label: 'India', }, { value: 'ID', label: 'Indonesia', }, { value: 'IR', label: 'Iran', }, { value: 'IQ', label: 'Iraq', }, { value: 'IE', label: 'Ireland', }, { value: 'IM', label: 'Isle of Man', }, { value: 'IL', label: 'Israel', }, { value: 'IT', label: 'Italy', }, { value: 'JM', label: 'Jamaica', }, { value: 'JP', label: 'Japan', }, { value: 'JE', label: 'Jersey', }, { value: 'JO', label: 'Jordan', }, { value: 'KZ', label: 'Kazakhstan', }, { value: 'KE', label: 'Kenya', }, { value: 'KI', label: 'Kiribati', }, { value: 'KW', label: 'Kuwait', }, { value: 'KG', label: 'Kyrgyzstan', }, { value: 'LA', label: "Lao People's Democratic Republic", }, { value: 'LV', label: 'Latvia', }, { value: 'LB', label: 'Lebanon', }, { value: 'LS', label: 'Lesotho', }, { value: 'LR', label: 'Liberia', }, { value: 'LY', label: 'Libya', }, { value: 'LI', label: 'Liechtenstein', }, { value: 'LT', label: 'Lithuania', }, { value: 'LU', label: 'Luxembourg', }, { value: 'MO', label: 'Macao', }, { value: 'MG', label: 'Madagascar', }, { value: 'MW', label: 'Malawi', }, { value: 'MY', label: 'Malaysia', }, { value: 'MV', label: 'Maldives', }, { value: 'ML', label: 'Mali', }, { value: 'MT', label: 'Malta', }, { value: 'MH', label: 'Marshall Islands', }, { value: 'MQ', label: 'Martinique', }, { value: 'MR', label: 'Mauritania', }, { value: 'MU', label: 'Mauritius', }, { value: 'MX', label: 'Mexico', }, { value: 'FM', label: 'Micronesia', }, { value: 'MC', label: 'Monaco', }, { value: 'MN', label: 'Mongolia', }, { value: 'ME', label: 'Montenegro', }, { value: 'MS', label: 'Montserrat', }, { value: 'MA', label: 'Morocco', }, { value: 'MZ', label: 'Mozambique', }, { value: 'MM', label: 'Myanmar', }, { value: 'NA', label: 'Namibia', }, { value: 'NR', label: 'Nauru', }, { value: 'NP', label: 'Nepal', }, { value: 'NL', label: 'Netherlands', }, { value: 'NZ', label: 'New Zealand', }, { value: 'NI', label: 'Nicaragua', }, { value: 'NE', label: 'Niger', }, { value: 'NG', label: 'Nigeria', }, { value: 'NU', label: 'Niue', }, { value: 'NF', label: 'Norfolk Island', }, { value: 'KP', label: 'North Korea', }, { value: 'MP', label: 'Northern Mariana Islands', }, { value: 'NO', label: 'Norway', }, { value: 'OM', label: 'Oman', }, { value: 'PK', label: 'Pakistan', }, { value: 'PW', label: 'Palau', }, { value: 'PS', label: 'Palestinian Territory', }, { value: 'PA', label: 'Panama', }, { value: 'PG', label: 'Papua New Guinea', }, { value: 'PY', label: 'Paraguay', }, { value: 'PE', label: 'Peru', }, { value: 'PH', label: 'Philippines', }, { value: 'PN', label: 'Pitcairn', }, { value: 'PL', label: 'Poland', }, { value: 'PT', label: 'Portugal', }, { value: 'PR', label: 'Puerto Rico', }, { value: 'QA', label: 'Qatar', }, { value: 'MK', label: 'Republic of Macedonia', }, { value: 'MD', label: 'Republic of Moldova', }, { value: 'RO', label: 'Romania', }, { value: 'RU', label: 'Russian', }, { value: 'RW', label: 'Rwanda', }, { value: 'KN', label: 'Saint Kitts and Nevis', }, { value: 'LC', label: 'Saint Lucia', }, { value: 'WS', label: 'Samoa', }, { value: 'SM', label: 'San Marino', }, { value: 'ST', label: 'Sao Tome and Principe', }, { value: 'SA', label: 'Saudi Arabia', }, { value: 'SN', label: 'Senegal', }, { value: 'RS', label: 'Serbia', }, { value: 'SC', label: 'Seychelles', }, { value: 'SL', label: 'Sierra Leone', }, { value: 'SG', label: 'Singapore', }, { value: 'SX', label: 'Sint Maarten', }, { value: 'SK', label: 'Slovakia', }, { value: 'SI', label: 'Slovenia', }, { value: 'SB', label: 'Solomon Islands', }, { value: 'SO', label: 'Somalia', }, { value: 'ZA', label: 'South Africa', }, { value: 'KR', label: 'South Korea', }, { value: 'SS', label: 'South Sudan', }, { value: 'ES', label: 'Spain', }, { value: 'LK', label: 'Sri Lanka', }, { value: 'SD', label: 'Sudan', }, { value: 'SR', label: 'Suriname', }, { value: 'SZ', label: 'Swaziland', }, { value: 'SE', label: 'Sweden', }, { value: 'CH', label: 'Switzerland', }, { value: 'SY', label: 'Syria', }, { value: 'TW', label: 'Taiwan', }, { value: 'TJ', label: 'Tajikistan', }, { value: 'TZ', label: 'Tanzania', }, { value: 'TH', label: 'Thailand', }, { value: 'TG', label: 'Togo', }, { value: 'TK', label: 'Tokelau', }, { value: 'TO', label: 'Tonga', }, { value: 'TT', label: 'Trinidad and Tobago', }, { value: 'TN', label: 'Tunisia', }, { value: 'TR', label: 'Turkey', }, { value: 'TM', label: 'Turkmenistan', }, { value: 'TC', label: 'Turks and Caicos Islands', }, { value: 'TV', label: 'Tuvalu', }, { value: 'UG', label: 'Uganda', }, { value: 'UA', label: 'Ukraine', }, { value: 'AE', label: 'United Arab Emirates', }, { value: 'GB', label: 'United Kingdom', }, { value: 'US', label: 'United States', }, { value: 'UY', label: 'Uruguay', }, { value: 'UZ', label: 'Uzbekistan', }, { value: 'VU', label: 'Vanuatu', }, { value: 'VE', label: 'Venezuela', }, { value: 'VN', label: 'Viet Nam', }, { value: 'VI', label: 'Virgin Islands', }, { value: 'YE', label: 'Yemen', }, { value: 'ZM', label: 'Zambia', }, { value: 'ZW', label: 'Zimbabwe', }, ]; const countriesPortuguese = [ { value: 'AF', label: 'Afeganistão', }, { value: 'ZA', label: 'África do Sul', }, { value: 'AL', label: 'Albânia', }, { value: 'DE', label: 'Alemanha', }, { value: 'DZ', label: 'Algéria', }, { value: 'AD', label: 'Andorra', }, { value: 'AO', label: 'Angola', }, { value: 'AI', label: 'Anguilla', }, { value: 'AG', label: 'Antigua e Barbuda', }, { value: 'SA', label: 'Arábia Saudita', }, { value: 'AR', label: 'Argentina', }, { value: 'AM', label: 'Armênia', }, { value: 'AW', label: 'Aruba', }, { value: 'AU', label: 'Austrália', }, { value: 'AT', label: 'Áustria', }, { value: 'AZ', label: 'Azerbaijão', }, { value: 'BS', label: 'Bahamas', }, { value: 'BH', label: 'Bahrein', }, { value: 'BD', label: 'Bangladesh', }, { value: 'BB', label: 'Barbados', }, { value: 'BE', label: 'Bélgica', }, { value: 'BZ', label: 'Belize', }, { value: 'BJ', label: 'Benin', }, { value: 'BM', label: 'Bermuda', }, { value: 'BY', label: 'Bielorrússia', }, { value: 'MM', label: 'Birmânia', }, { value: 'BO', label: 'Bolívia', }, { value: 'BA', label: 'Bósnia e Herzegovina', }, { value: 'BW', label: 'Botswana', }, { value: 'BR', label: 'Brasil', }, { value: 'BG', label: 'Bulgária', }, { value: 'BF', label: 'Burkina Faso', }, { value: 'BI', label: 'Burundi', }, { value: 'BT', label: 'Butão', }, { value: 'CV', label: 'Cabo Verde', }, { value: 'CM', label: 'Camarões', }, { value: 'KH', label: 'Camboja', }, { value: 'CA', label: 'Canadá', }, { value: 'QA', label: 'Catar', }, { value: 'KZ', label: 'Cazaquistão', }, { value: 'TD', label: 'Chade', }, { value: 'CL', label: 'Chile', }, { value: 'CN', label: 'China', }, { value: 'CY', label: 'Chipre', }, { value: 'CO', label: 'Colômbia', }, { value: 'KM', label: 'Comores', }, { value: 'CG', label: 'Congo', }, { value: 'CD', label: 'Congo (DR)', }, { value: 'KP', label: 'Coreia do Norte', }, { value: 'KR', label: 'Coreia do Sul', }, { value: 'CI', label: 'Costa do Marfim', }, { value: 'CR', label: 'Costa Rica', }, { value: 'HR', label: 'Croácia', }, { value: 'CU', label: 'Cuba', }, { value: 'CW', label: 'Curaçao', }, { value: 'DK', label: 'Dinamarca', }, { value: 'DJ', label: 'Djibuti', }, { value: 'DM', label: 'Dominica', }, { value: 'EG', label: 'Egito', }, { value: 'SV', label: 'El Salvador', }, { value: 'AE', label: 'Emirados Árabes', }, { value: 'EC', label: 'Equador', }, { value: 'ER', label: 'Eritreia', }, { value: 'SK', label: 'Eslováquia', }, { value: 'SI', label: 'Eslovênia', }, { value: 'ES', label: 'Espanha', }, { value: 'US', label: 'Estados Unidos', }, { value: 'EE', label: 'Estônia', }, { value: 'ET', label: 'Etiópia', }, { value: 'FJ', label: 'Fiji', }, { value: 'PH', label: 'Filipinas', }, { value: 'FI', label: 'Finlândia', }, { value: 'FR', label: 'França', }, { value: 'GA', label: 'Gabão', }, { value: 'GM', label: 'Gâmbia', }, { value: 'GH', label: 'Gana', }, { value: 'GE', label: 'Geórgia', }, { value: 'GI', label: 'Gibraltar', }, { value: 'GD', label: 'Granada', }, { value: 'GR', label: 'Grécia', }, { value: 'GL', label: 'Groelândia', }, { value: 'GU', label: 'Guão', }, { value: 'GT', label: 'Guatemala', }, { value: 'GG', label: 'Guernsey', }, { value: 'GN', label: 'Guiné', }, { value: 'GQ', label: 'Guiné Equatorial', }, { value: 'GW', label: 'Guiné-Bissau', }, { value: 'HT', label: 'Haiti', }, { value: 'NL', label: 'Holanda', }, { value: 'HN', label: 'Honduras', }, { value: 'HK', label: 'Hong Kong', }, { value: 'HU', label: 'Hungria', }, { value: 'YE', label: 'Iêmen', }, { value: 'IM', label: 'Ilha de Man', }, { value: 'NF', label: 'Ilha Norfolk', }, { value: 'KY', label: 'Ilhas Cayman', }, { value: 'CK', label: 'Ilhas Cook', }, { value: 'FO', label: 'Ilhas Faroe', }, { value: 'FK', label: 'Ilhas Malvinas', }, { value: 'MP', label: 'Ilhas Marianas do Norte', }, { value: 'MH', label: 'Ilhas Marshall', }, { value: 'PN', label: 'Ilhas Picárnia', }, { value: 'SB', label: 'Ilhas Salomão', }, { value: 'TC', label: 'Ilhas Turks e Caicos', }, { value: 'VI', label: 'Ilhas Virgens (USA)', }, { value: 'IN', label: 'Índia', }, { value: 'ID', label: 'Indonésia', }, { value: 'IR', label: 'Iran', }, { value: 'IQ', label: 'Iraque', }, { value: 'IE', label: 'Irlanda', }, { value: 'IS', label: 'Islândia', }, { value: 'IL', label: 'Israel', }, { value: 'IT', label: 'Itália', }, { value: 'JM', label: 'Jamaica', }, { value: 'JP', label: 'Japão', }, { value: 'JE', label: 'Jersey', }, { value: 'JO', label: 'Jordânia', }, { value: 'KI', label: 'Kiribati', }, { value: 'KW', label: 'Kuwait', }, { value: 'LA', label: 'Laos', }, { value: 'LS', label: 'Lesoto', }, { value: 'LV', label: 'Letônia', }, { value: 'LB', label: 'Líbano', }, { value: 'LR', label: 'Libéria', }, { value: 'LY', label: 'Líbia', }, { value: 'LI', label: 'Liechtenstein', }, { value: 'LT', label: 'Lituânia', }, { value: 'LU', label: 'Luxemburgo', }, { value: 'MO', label: 'Macao', }, { value: 'MK', label: 'Macedônia', }, { value: 'MG', label: 'Madagascar', }, { value: 'MY', label: 'Malásia', }, { value: 'MW', label: 'Malawi', }, { value: 'MV', label: 'Maldivas', }, { value: 'ML', label: 'Mali', }, { value: 'MT', label: 'Malta', }, { value: 'MA', label: 'Marrocos', }, { value: 'MQ', label: 'Martinica', }, { value: 'MU', label: 'Maurício', }, { value: 'MR', label: 'Mauritânia', }, { value: 'MX', label: 'México', }, { value: 'FM', label: 'Micronésia', }, { value: 'MZ', label: 'Moçambique', }, { value: 'MD', label: 'Moldova', }, { value: 'MC', label: 'Mônaco', }, { value: 'MN', label: 'Mongólia', }, { value: 'ME', label: 'Montenegro', }, { value: 'MS', label: 'Montserrat', }, { value: 'NA', label: 'Namíbia', }, { value: 'NR', label: 'Nauru', }, { value: 'NP', label: 'Nepal', }, { value: 'NI', label: 'Nicarágua', }, { value: 'NE', label: 'Niger', }, { value: 'NG', label: 'Nigéria', }, { value: 'NU', label: 'Niue', }, { value: 'NO', label: 'Noruega', }, { value: 'NZ', label: 'Nova Zelândia', }, { value: 'OM', label: 'Omã', }, { value: 'PW', label: 'Palau', }, { value: 'PS', label: 'Palestina', }, { value: 'PA', label: 'Panamá', }, { value: 'PG', label: 'Papua-Nova Guiné', }, { value: 'PK', label: 'Paquistão', }, { value: 'PY', label: 'Paraguai', }, { value: 'PE', label: 'Peru', }, { value: 'PF', label: 'Polinésia Francesa', }, { value: 'PL', label: 'Polônia', }, { value: 'PR', label: 'Porto Rico', }, { value: 'PT', label: 'Portugal', }, { value: 'KE', label: 'Quênia', }, { value: 'KG', label: 'Quirguistão', }, { value: 'GB', label: 'Reino Unido', }, { value: 'CF', label: 'República Centro-Africana', }, { value: 'SL', label: 'República da Serra Leoa', }, { value: 'DO', label: 'República Dominicana', }, { value: 'CZ', label: 'República Tcheca', }, { value: 'RO', label: 'Romênia', }, { value: 'RW', label: 'Ruanda', }, { value: 'RU', label: 'Rússia', }, { value: 'WS', label: 'Samoa', }, { value: 'AS', label: 'Samoa Americana', }, { value: 'LC', label: 'Santa Lúcia', }, { value: 'KN', label: 'São Cristóvão', }, { value: 'SM', label: 'São Marino', }, { value: 'SX', label: 'São Martinho', }, { value: 'ST', label: 'Sao Tomé e Príncipe', }, { value: 'SC', label: 'Seicheles', }, { value: 'SN', label: 'Senegal', }, { value: 'RS', label: 'Sérvia', }, { value: 'SG', label: 'Singapura', }, { value: 'SY', label: 'Síria', }, { value: 'SO', label: 'Somália', }, { value: 'LK', label: 'Sri Lanka', }, { value: 'SZ', label: 'Suazilândia', }, { value: 'SD', label: 'Sudão', }, { value: 'SS', label: 'Sudão do Sul', }, { value: 'SE', label: 'Suécia', }, { value: 'CH', label: 'Suiça', }, { value: 'SR', label: 'Suriname', }, { value: 'TH', label: 'Tailândia', }, { value: 'TW', label: 'Taiwan', }, { value: 'TJ', label: 'Tajiquistão', }, { value: 'TZ', label: 'Tanzânia', }, { value: 'IO', label: 'Território Britânico do Oceano Índico', }, { value: 'TG', label: 'Togo', }, { value: 'TO', label: 'Tonga', }, { value: 'TK', label: 'Toquelau', }, { value: 'TT', label: 'Trinidad e Tobago', }, { value: 'TN', label: 'Tunísia', }, { value: 'TM', label: 'Turcomenistão', }, { value: 'TR', label: 'Turquia', }, { value: 'TV', label: 'Tuvalu', }, { value: 'UA', label: 'Ucrânia', }, { value: 'UG', label: 'Uganda', }, { value: 'UY', label: 'Uruguai', }, { value: 'UZ', label: 'Uzbequistão', }, { value: 'VU', label: 'Vanuatu', }, { value: 'VE', label: 'Venezuela', }, { value: 'VN', label: 'Vietnam', }, { value: 'ZM', label: 'Zâmbia', }, { value: 'ZW', label: 'Zimbábue', }, ]; const countries = (locale) => { const currentLocale = Q(locale); const locales = { default: countriesPortuguese, pt: countriesPortuguese, en: countriesEnglish, pt_BR: countriesPortuguese, en_US: countriesEnglish, 'pt-BR': countriesPortuguese, 'en-US': countriesEnglish, }; return locales[currentLocale]; }; function clean$2h(input) { return cleanUnicode(input, ' -.'); } const impl$2h = { name: 'Andorra Tax Register Number', localName: 'Número de Registre Tributari', abbreviation: 'NRT', compact(input) { const [value, err] = clean$2h(input); if (err) { throw err; } return value.toLocaleUpperCase(); }, format(input) { const [value] = clean$2h(input); return splitAt(value, 1, 7).join('-'); }, validate(value) { const [v, error] = clean$2h(value); if (error) { return { isValid: false, error }; } if (v.length !== 8) { return { isValid: false, error: new InvalidLength() }; } const mid = v.substr(1, v.length - 2); if (!isalpha(v[0]) || !isalpha(v[v.length - 1])) { return { isValid: false, error: new InvalidFormat() }; } if (!isdigits(mid)) { return { isValid: false, error: new InvalidFormat() }; } if (!'ACDEFGLOPU'.includes(v[0])) { return { isValid: false, error: new InvalidComponent() }; } if (v[0] === 'F' && mid > '699999') { return { isValid: false, error: new InvalidComponent() }; } if ('AL'.includes(v[0]) && mid > '699999' && mid < '800000') { return { isValid: false, error: new InvalidComponent() }; } return { isValid: true, compact: v, isIndividual: 'FE'.includes(v[0]), isCompany: !'FE'.includes(v[0]), }; }, }; const { name: name$2h, localName: localName$2h, abbreviation: abbreviation$2h, validate: validate$2h, format: format$2h, compact: compact$2h, } = impl$2h; const nrt = /*#__PURE__*/Object.freeze({ __proto__: null, name: name$2h, localName: localName$2h, abbreviation: abbreviation$2h, validate: validate$2h, format: format$2h, compact: compact$2h }); const AD = /*#__PURE__*/Object.freeze({ __proto__: null, nrt: nrt }); function clean$2g(input) { let [value, err] = cleanUnicode(input, ' '); if (err) { return [value, err]; } if (value.startsWith('AL')) { value = value.substring(2); } else if (value.startsWith('(AL)')) { value = value.substring(4); } return [value, null]; } const impl$2g = { name: 'Albanian VAT Number', localName: 'Numri i Identifikimit për Personin e Tatueshëm', abbreviation: 'NIPT', compact(input) { const [value, err] = clean$2g(input); if (err) { throw err; } return value; }, format(input) { const [value] = clean$2g(input); return value; }, validate(input) { const [value, error] = clean$2g(input); if (error) { return { isValid: false, error }; } if (value.length !== 10) { return { isValid: false, error: new InvalidLength() }; } if (!/^[JKL]\d{8}[A-Z]$/.test(value)) { return { isValid: false, error: new InvalidFormat() }; } return { isValid: true, compact: value, isIndividual: true, isCompany: true, }; }, }; const { name: name$2g, localName: localName$2g, abbreviation: abbreviation$2g, validate: validate$2g, format: format$2g, compact: compact$2g, } = impl$2g; const nipt = /*#__PURE__*/Object.freeze({ __proto__: null, name: name$2g, localName: localName$2g, abbreviation: abbreviation$2g, validate: validate$2g, format: format$2g, compact: compact$2g }); const AL = /*#__PURE__*/Object.freeze({ __proto__: null, nipt: nipt }); function clean$2f(input) { return cleanUnicode(input, ' -'); } const impl$2f = { name: 'Single Banking Code', localName: 'Clave Bancaria Uniforme', abbreviation: 'CBU', compact(input) { const [value, err] = clean$2f(input); if (err) { throw err; } return value; }, format(input) { const [value] = clean$2f(input); const [a, b] = splitAt(value, 8); return `${a} ${b}`; }, validate(input) { const [value, error] = clean$2f(input); if (error) { return { isValid: false, error }; } if (value.length !== 22) { return { isValid: false, error: new InvalidLength() }; } if (!isdigits(value)) { return { isValid: false, error: new InvalidComponent() }; } const [front, c1, back, c2] = splitAt(value, 7, 8, 21); const s1 = String(10 - weightedSum(front, { reverse: true, weights: [3, 1, 7, 9, 3, 1, 7], modulus: 10, })); const s2 = String(10 - weightedSum(back, { reverse: true, weights: [3, 1, 7, 9, 3, 1, 7, 9, 3, 1, 7, 9, 3, 1], modulus: 10, })); if (s1 !== c1 || s2 !== c2) { return { isValid: false, error: new InvalidChecksum() }; } return { isValid: true, compact: value, isIndividual: false, isCompany: false, }; }, }; const { name: name$2f, localName: localName$2f, abbreviation: abbreviation$2f, validate: validate$2f, format: format$2f, compact: compact$2f, } = impl$2f; const cbu = /*#__PURE__*/Object.freeze({ __proto__: null, name: name$2f, localName: localName$2f, abbreviation: abbreviation$2f, validate: validate$2f, format: format$2f, compact: compact$2f }); const cuitTypes = [ '20', '23', '24', '27', '30', '33', '34', '50', '51', '55', ]; function clean$2e(input) { return cleanUnicode(input, ' -'); } const impl$2e = { name: 'Argentinian VAT Number', localName: 'Código Único de Identificación Tributaria', abbreviation: 'CUIT', compact(input) { const [value, err] = clean$2e(input); if (err) { throw err; } return value; }, format(input) { const [value] = clean$2e(input); return splitAt(value, 2, 10).join('-'); }, validate(input) { const [value, error] = clean$2e(input); if (error) { return { isValid: false, error }; } if (value.length !== 11) { return { isValid: false, error: new InvalidLength() }; } if (!isdigits(value)) { return { isValid: false, error: new InvalidFormat() }; } const [front, body, check] = splitAt(value, 2, 10); if (!cuitTypes.includes(front)) { return { isValid: false, error: new InvalidComponent() }; } const cs = weightedSum(front + body, { weights: [5, 4, 3, 2, 7, 6, 5, 4, 3, 2], modulus: 11, }); const digit = '012345678990'[11 - cs]; if (digit !== check) { return { isValid: false, error: new InvalidChecksum() }; } return { isValid: true, compact: value, isIndividual: front[0] === '2', isCompany: front[0] === '3', }; }, }; const { name: name$2e, localName: localName$2e, abbreviation: abbreviation$2e, validate: validate$2e, format: format$2e, compact: compact$2e, } = impl$2e; const cuit = /*#__PURE__*/Object.freeze({ __proto__: null, name: name$2e, localName: localName$2e, abbreviation: abbreviation$2e, validate: validate$2e, format: format$2e, compact: compact$2e }); function clean$2d(input) { return cleanUnicode(input, ' .'); } const impl$2d = { name: 'Argentinian National Identity Document', localName: 'Documento Nacional de Identidad', abbreviation: 'DNI', compact(input) { const [value, err] = clean$2d(input); if (err) { throw err; } return value; }, format(input) { const [value] = clean$2d(input); return splitAt(value, value.length - 6, value.length - 3).join('.'); }, validate(input) { const [value, error] = clean$2d(input); if (error) { return { isValid: false, error }; } if (value.length !== 7 && value.length !== 8) { return { isValid: false, error: new InvalidLength() }; } if (!isdigits(value)) { return { isValid: false, error: new InvalidComponent() }; } return { isValid: true, compact: value, isIndividual: true, isCompany: false, }; }, }; const { name: name$2d, localName: localName$2d, abbreviation: abbreviation$2d, validate: validate$2d, format: format$2d, compact: compact$2d, } = impl$2d; const dni$1 = /*#__PURE__*/Object.freeze({ __proto__: null, name: name$2d, localName: localName$2d, abbreviation: abbreviation$2d, validate: validate$2d, format: format$2d, compact: compact$2d }); const AR = /*#__PURE__*/Object.freeze({ __proto__: null, cbu: cbu, cuit: cuit, dni: dni$1 }); function clean$2c(input) { const [value, err] = cleanUnicode(input, ' -./'); if (err) { return [value, err]; } if (value.startsWith('FN')) { return [value.substring(2), null]; } return [value, null]; } const impl$2c = { name: 'Austrian Company Register Number', localName: 'Company Register Number', compact(input) { const [value, err] = clean$2c(input); if (err) { throw err; } return value; }, format(input) { const [value] = clean$2c(input); return value; }, validate(input) { const [value, error] = clean$2c(input); if (error) { return { isValid: false, error }; } if (!/^\d+[A-Z]$/.test(value)) { return { isValid: false, error: new InvalidFormat() }; } return { isValid: true, compact: value, isIndividual: false, isCompany: true, }; }, }; const { name: name$2c, localName: localName$2c, abbreviation: abbreviation$2c, validate: validate$2c, format: format$2c, compact: compact$2c, } = impl$2c; const businessid = /*#__PURE__*/Object.freeze({ __proto__: null, name: name$2c, localName: localName$2c, abbreviation: abbreviation$2c, validate: validate$2c, format: format$2c, compact: compact$2c }); const faOffices = { '03': { office: 'Wien 3/6/7/11/15 Schwechat Gerasdorf', region: 'Wien' }, '04': { office: 'Wien 4/5/10', region: 'Wien' }, '06': { office: 'Wien 8/16/17', region: 'Wien' }, '07': { office: 'Wien 9/18/19 Klosterneuburg', region: 'Wien' }, '08': { office: 'Wien 12/13/14 Purkersdorf', region: 'Wien' }, '09': { office: 'Wien 1/23', region: 'Wien' }, '10': { office: 'für Gebühren, Verkehrsteuern und Glücksspiel', region: '' }, '12': { office: 'Wien 2/20/21/22', region: 'Wien' }, '15': { office: 'Amstetten Melk Scheibbs', region: 'Niederösterreich' }, '16': { office: 'Baden Mödling', region: 'Niederösterreich' }, '18': { office: 'Gänserndorf Mistelbach', region: 'Niederösterreich' }, '22': { office: 'Hollabrunn Korneuburg Tulln', region: 'Niederösterreich' }, '23': { office: 'Waldviertel', region: 'Niederösterreich' }, '29': { office: 'Lilienfeld St. Pölten', region: 'Niederösterreich' }, '33': { office: 'Neunkirchen Wr. Neustadt', region: 'Niederösterreich' }, '38': { office: 'Bruck Eisenstadt Oberwart', region: 'Burgenland, Niederösterreich', }, '41': { office: 'Braunau Ried Schärding', region: 'Oberösterreich' }, '46': { office: 'Linz', region: 'Oberösterreich' }, '51': { office: 'Kirchdorf Perg Steyr', region: 'Oberösterreich' }, '52': { office: 'Freistadt Rohrbach Urfahr', region: 'Oberösterreich' }, '53': { office: 'Gmunden Vöcklabruck', region: 'Oberösterreich' }, '54': { office: 'Grieskirchen Wels', region: 'Oberösterreich' }, '57': { office: 'Klagenfurt', region: 'Kärnten' }, '59': { office: 'St. Veit Wolfsberg', region: 'Kärnten' }, '61': { office: 'Spittal Villach', region: 'Kärnten' }, '65': { office: 'Bruck Leoben Mürzzuschlag', region: 'Steiermark' }, '67': { office: 'Oststeiermark', region: 'Steiermark' }, '68': { office: 'Graz-Stadt', region: 'Steiermark' }, '69': { office: 'Graz-Umgebung', region: 'Steiermark' }, '71': { office: 'Judenburg Liezen', region: 'Steiermark' }, '72': { office: 'Deutschlandsberg Leibnitz Voitsberg', region: 'Steiermark' }, '81': { office: 'Innsbruck', region: 'Tirol' }, '82': { office: 'Kitzbühel Lienz', region: 'Tirol' }, '83': { office: 'Kufstein Schwaz', region: 'Tirol' }, '84': { office: 'Landeck Reutte', region: 'Tirol' }, '90': { office: 'St. Johann Tamsweg Zell am See', region: 'Salzburg' }, '91': { office: 'Salzburg-Stadt', region: 'Salzburg' }, '93': { office: 'Salzburg-Land', region: 'Salzburg' }, '97': { office: 'Bregenz', region: 'Vorarlberg' }, '98': { office: 'Feldkirch', region: 'Vorarlberg' }, }; function clean$2b(input) { return cleanUnicode(input, ' -./,'); } const impl$2b = { name: 'Austrian Tax Identification Number', localName: 'Abgabenkontonummer', abbreviation: 'TIN', compact(input) { const [value, err] = clean$2b(input); if (err) { throw err; } return value; }, format(input) { const [value] = clean$2b(input); const [a, b, c] = splitAt(value, 2, 5); return `${a}-${b}/${c}`; }, validate(input) { const [value, error] = clean$2b(input); if (error) { return { isValid: false, error }; } if (value.length !== 9) { return { isValid: false, error: new InvalidLength() }; } if (!isdigits(value)) { return { isValid: false, error: new InvalidComponent() }; } const [office, front, check] = splitAt(value, 2, 8); if (faOffices[office] === undefined) { return { isValid: false, error: new InvalidComponent() }; } const sum = `${office}${front}` .split('') .map(x => parseInt(x, 10)) .reduce((acc, digit, idx) => acc + (idx % 2 === 1 ? [0, 2, 4, 6, 8, 1, 3, 5, 7, 9][digit] : digit), 0); const digit = String(10 - (sum % 10)); if (check !== digit) { return { isValid: false, error: new InvalidChecksum() }; } return { isValid: true, compact: value, isIndividual: false, isCompany: true, }; }, }; const { name: name$2b, localName: localName$2b, abbreviation: abbreviation$2b, validate: validate$2b, format: format$2b, compact: compact$2b, } = impl$2b; const tin$3 = /*#__PURE__*/Object.freeze({ __proto__: null, name: name$2b, localName: localName$2b, abbreviation: abbreviation$2b, validate: validate$2b, format: format$2b, compact: compact$2b }); function clean$2a(input) { const [value, err] = cleanUnicode(input, ' -./'); if (err) { return [value, err]; } if (value.startsWith('AT')) { return [value.substr(2), null]; } return [value, null]; } const impl$2a = { name: 'Austrian VAT Number', localName: 'Umsatzsteuer-Identifikationsnummer', abbreviation: 'UID', compact(input) { const [value, err] = clean$2a(input); if (err) { throw err; } return value; }, format(input) { const [value] = clean$2a(input); return value; }, validate(input) { const [value, error] = clean$2a(input); if (error) { return { isValid: false, error }; } if (value.length !== 9) { return { isValid: false, error: new InvalidLength() }; } if (!value.startsWith('U') || !isdigits(value.substr(1))) { return { isValid: false, error: new InvalidComponent() }; } const [, front, check] = splitAt(value, 1, 8); const digit = String((16 - luhnChecksumValue(front)) % 10); if (check !== digit) { return { isValid: false, error: new InvalidChecksum() }; } return { isValid: true, compact: value, isIndividual: false, isCompany: true, }; }, }; const { name: name$2a, localName: localName$2a, abbreviation: abbreviation$2a, validate: validate$2a, format: format$2a, compact: compact$2a, } = impl$2a; const uid$1 = /*#__PURE__*/Object.freeze({ __proto__: null, name: name$2a, localName: localName$2a, abbreviation: abbreviation$2a, validate: validate$2a, format: format$2a, compact: compact$2a }); function clean$29(input) { return cleanUnicode(input, ' -'); } const impl$29 = { name: 'Austrian Social Security Number', localName: 'Versicherungsnummer', abbreviation: 'VSNR', compact(input) { const [value, err] = clean$29(input); if (err) { throw err; } return value; }, format(input) { const [value] = clean$29(input); return splitAt(value, 4).join(' '); }, validate(input) { const [value, error] = clean$29(input); if (error) { return { isValid: false, error }; } if (value.length !== 10) { return { isValid: false, error: new InvalidLength() }; } if (!isdigits(value)) { return { isValid: false, error: new InvalidComponent() }; } const [front, check, dob] = splitAt(value, 3, 4); if (!isValidDateCompactDDMMYY(dob)) { return { isValid: false, error: new InvalidComponent() }; } const sum = weightedSum(`${front}${dob}`, { weights: [3, 7, 9, 5, 8, 4, 2, 1, 6], modulus: 11, }); const digit = String(sum % 11); if (check !== digit) { return { isValid: false, error: new InvalidChecksum() }; } return { isValid: true, compact: value, isIndividual: parseInt(front, 10) < 80000000, isCompany: front.length === 8 && parseInt(front, 10) > 80000000, }; }, }; const { name: name$29, localName: localName$29, abbreviation: abbreviation$29, validate: validate$29, format: format$29, compact: compact$29, } = impl$29; const vnr = /*#__PURE__*/Object.freeze({ __proto__: null, name: name$29, localName: localName$29, abbreviation: abbreviation$29, validate: validate$29, format: format$29, compact: compact$29 }); const AT = /*#__PURE__*/Object.freeze({ __proto__: null, businessid: businessid, tin: tin$3, uid: uid$1, vnr: vnr }); function clean$28(input) { return cleanUnicode(input, ' '); } const impl$28 = { name: 'Australian Business Number', localName: 'Business Number', abbreviation: 'ABN', compact(input) { const [value, err] = clean$28(input); if (err) { throw err; } return value; }, format(input) { const [value] = clean$28(input); return splitAt(value, 2, 5, 8).join(' '); }, validate(input) { const [value, error] = clean$28(input); if (error) { return { isValid: false, error }; } if (value.length !== 11) { return { isValid: false, error: new InvalidLength() }; } if (!isdigits(value)) { return { isValid: false, error: new InvalidFormat() }; } const [check, rest] = splitAt(value, 2); const sum = weightedSum(rest, { weights: [3, 5, 7, 9, 11, 13, 15, 17, 19], modulus: 89, }); if (check !== String(11 + ((177 - sum) % 89))) { return { isValid: false, error: new InvalidChecksum() }; } return { isValid: true, compact: value, isIndividual: false, isCompany: true, }; }, }; const { name: name$28, localName: localName$28, abbreviation: abbreviation$28, validate: validate$28, format: format$28, compact: compact$28, } = impl$28; const abn = /*#__PURE__*/Object.freeze({ __proto__: null, name: name$28, localName: localName$28, abb