p-intl-input-tel-gg
Version:
Forked project with improvements
1 lines • 99.6 kB
Source Map (JSON)
{"version":3,"file":"p-intl-input-tel-gg.mjs","sources":["../../../projects/p-intl-input-tel/src/model/search-country-field.ts","../../../projects/p-intl-input-tel/src/model/country.model.ts","../../../projects/p-intl-input-tel/src/model/country-iso.enum.ts","../../../projects/p-intl-input-tel/src/data/country-code.ts","../../../projects/p-intl-input-tel/src/pipe/dialCode.pipe.ts","../../../projects/p-intl-input-tel/src/directives/favorite-element-injector.directive.ts","../../../projects/p-intl-input-tel/src/directives/native-element-injector.directive.ts","../../../projects/p-intl-input-tel/src/component/p-intl-input-tel.component.ts","../../../projects/p-intl-input-tel/src/model/change-data.ts","../../../projects/p-intl-input-tel/src/utils/local-phone-utils.ts","../../../projects/p-intl-input-tel/p-intl-input-tel-gg.ts"],"sourcesContent":["export enum SearchCountryField {\n DIALCODE = 'dialCode',\n ISO2 = 'iso2',\n NAME = 'name',\n};\n","export class Country {\n name: string;\n iso2: string;\n dialCode: string;\n priority: number;\n areaCodes?: string[];\n htmlId: string;\n flagClass: string;\n placeHolder: string;\n isFavorite: boolean;\n\n constructor() {\n this.name = '';\n this.iso2 = '';\n this.dialCode = '';\n this.priority = 0;\n this.areaCodes = undefined;\n this.htmlId = '';\n this.flagClass = '';\n this.placeHolder = '';\n }\n}\n","export enum CountryISO {\n\tAfghanistan = 'af',\n\tAlbania = 'al',\n\tAlgeria = 'dz',\n\tAmericanSamoa = 'as',\n\tAndorra = 'ad',\n\tAngola = 'ao',\n\tAnguilla = 'ai',\n\tAntiguaAndBarbuda = 'ag',\n\tArgentina = 'ar',\n\tArmenia = 'am',\n\tAruba = 'aw',\n\tAustralia = 'au',\n\tAustria = 'at',\n\tAzerbaijan = 'az',\n\tBahamas = 'bs',\n\tBahrain = 'bh',\n\tBangladesh = 'bd',\n\tBarbados = 'bb',\n\tBelarus = 'by',\n\tBelgium = 'be',\n\tBelize = 'bz',\n\tBenin = 'bj',\n\tBermuda = 'bm',\n\tBhutan = 'bt',\n\tBolivia = 'bo',\n\tBosniaAndHerzegovina = 'ba',\n\tBotswana = 'bw',\n\tBrazil = 'br',\n\tBritishIndianOceanTerritory = 'io',\n\tBritishVirginIslands = 'vg',\n\tBrunei = 'bn',\n\tBulgaria = 'bg',\n\tBurkinaFaso = 'bf',\n\tBurundi = 'bi',\n\tCambodia = 'kh',\n\tCameroon = 'cm',\n\tCanada = 'ca',\n\tCapeVerde = 'cv',\n\tCaribbeanNetherlands = 'bq',\n\tCaymanIslands = 'ky',\n\tCentralAfricanRepublic = 'cf',\n\tChad = 'td',\n\tChile = 'cl',\n\tChina = 'cn',\n\tChristmasIsland = 'cx',\n\tCocos = 'cc',\n\tColombia = 'co',\n\tComoros = 'km',\n\tCongoDRCJamhuriYaKidemokrasiaYaKongo = 'cd',\n\tCongoRepublicCongoBrazzaville = 'cg',\n\tCookIslands = 'ck',\n\tCostaRica = 'cr',\n\tCôteDIvoire = 'ci',\n\tCroatia = 'hr',\n\tCuba = 'cu',\n\tCuraçao = 'cw',\n\tCyprus = 'cy',\n\tCzechRepublic = 'cz',\n\tDenmark = 'dk',\n\tDjibouti = 'dj',\n\tDominica = 'dm',\n\tDominicanRepublic = 'do',\n\tEcuador = 'ec',\n\tEgypt = 'eg',\n\tElSalvador = 'sv',\n\tEquatorialGuinea = 'gq',\n\tEritrea = 'er',\n\tEstonia = 'ee',\n\tEthiopia = 'et',\n\tFalklandIslands = 'fk',\n\tFaroeIslands = 'fo',\n\tFiji = 'fj',\n\tFinland = 'fi',\n\tFrance = 'fr',\n\tFrenchGuiana = 'gf',\n\tFrenchPolynesia = 'pf',\n\tGabon = 'ga',\n\tGambia = 'gm',\n\tGeorgia = 'ge',\n\tGermany = 'de',\n\tGhana = 'gh',\n\tGibraltar = 'gi',\n\tGreece = 'gr',\n\tGreenland = 'gl',\n\tGrenada = 'gd',\n\tGuadeloupe = 'gp',\n\tGuam = 'gu',\n\tGuatemala = 'gt',\n\tGuernsey = 'gg',\n\tGuinea = 'gn',\n\tGuineaBissau = 'gw',\n\tGuyana = 'gy',\n\tHaiti = 'ht',\n\tHonduras = 'hn',\n\tHongKong = 'hk',\n\tHungary = 'hu',\n\tIceland = 'is',\n\tIndia = 'in',\n\tIndonesia = 'id',\n\tIran = 'ir',\n\tIraq = 'iq',\n\tIreland = 'ie',\n\tIsleOfMan = 'im',\n\tIsrael = 'il',\n\tItaly = 'it',\n\tJamaica = 'jm',\n\tJapan = 'jp',\n\tJersey = 'je',\n\tJordan = 'jo',\n\tKazakhstan = 'kz',\n\tKenya = 'ke',\n\tKiribati = 'ki',\n\tKosovo = 'xk',\n\tKuwait = 'kw',\n\tKyrgyzstan = 'kg',\n\tLaos = 'la',\n\tLatvia = 'lv',\n\tLebanon = 'lb',\n\tLesotho = 'ls',\n\tLiberia = 'lr',\n\tLibya = 'ly',\n\tLiechtenstein = 'li',\n\tLithuania = 'lt',\n\tLuxembourg = 'lu',\n\tMacau = 'mo',\n\tMacedonia = 'mk',\n\tMadagascar = 'mg',\n\tMalawi = 'mw',\n\tMalaysia = 'my',\n\tMaldives = 'mv',\n\tMali = 'ml',\n\tMalta = 'mt',\n\tMarshallIslands = 'mh',\n\tMartinique = 'mq',\n\tMauritania = 'mr',\n\tMauritius = 'mu',\n\tMayotte = 'yt',\n\tMexico = 'mx',\n\tMicronesia = 'fm',\n\tMoldova = 'md',\n\tMonaco = 'mc',\n\tMongolia = 'mn',\n\tMontenegro = 'me',\n\tMontserrat = 'ms',\n\tMorocco = 'ma',\n\tMozambique = 'mz',\n\tMyanmar = 'mm',\n\tNamibia = 'na',\n\tNauru = 'nr',\n\tNepal = 'np',\n\tNetherlands = 'nl',\n\tNewCaledonia = 'nc',\n\tNewZealand = 'nz',\n\tNicaragua = 'ni',\n\tNiger = 'ne',\n\tNigeria = 'ng',\n\tNiue = 'nu',\n\tNorfolkIsland = 'nf',\n\tNorthKorea = 'kp',\n\tNorthernMarianaIslands = 'mp',\n\tNorway = 'no',\n\tOman = 'om',\n\tPakistan = 'pk',\n\tPalau = 'pw',\n\tPalestine = 'ps',\n\tPanama = 'pa',\n\tPapuaNewGuinea = 'pg',\n\tParaguay = 'py',\n\tPeru = 'pe',\n\tPhilippines = 'ph',\n\tPoland = 'pl',\n\tPortugal = 'pt',\n\tPuertoRico = 'pr',\n\tQatar = 'qa',\n\tRéunion = 're',\n\tRomania = 'ro',\n\tRussia = 'ru',\n\tRwanda = 'rw',\n\tSaintBarthélemy = 'bl',\n\tSaintHelena = 'sh',\n\tSaintKittsAndNevis = 'kn',\n\tSaintLucia = 'lc',\n\tSaintMartin = 'mf',\n\tSaintPierreAndMiquelon = 'pm',\n\tSaintVincentAndTheGrenadines = 'vc',\n\tSamoa = 'ws',\n\tSanMarino = 'sm',\n\tSãoToméAndPríncipe = 'st',\n\tSaudiArabia = 'sa',\n\tSenegal = 'sn',\n\tSerbia = 'rs',\n\tSeychelles = 'sc',\n\tSierraLeone = 'sl',\n\tSingapore = 'sg',\n\tSintMaarten = 'sx',\n\tSlovakia = 'sk',\n\tSlovenia = 'si',\n\tSolomonIslands = 'sb',\n\tSomalia = 'so',\n\tSouthAfrica = 'za',\n\tSouthKorea = 'kr',\n\tSouthSudan = 'ss',\n\tSpain = 'es',\n\tSriLanka = 'lk',\n\tSudan = 'sd',\n\tSuriname = 'sr',\n\tSvalbardAndJanMayen = 'sj',\n\tSwaziland = 'sz',\n\tSweden = 'se',\n\tSwitzerland = 'ch',\n\tSyria = 'sy',\n\tTaiwan = 'tw',\n\tTajikistan = 'tj',\n\tTanzania = 'tz',\n\tThailand = 'th',\n\tTimorLeste = 'tl',\n\tTogo = 'tg',\n\tTokelau = 'tk',\n\tTonga = 'to',\n\tTrinidadAndTobago = 'tt',\n\tTunisia = 'tn',\n\tTurkey = 'tr',\n\tTurkmenistan = 'tm',\n\tTurksAndCaicosIslands = 'tc',\n\tTuvalu = 'tv',\n\tUSVirginIslands = 'vi',\n\tUganda = 'ug',\n\tUkraine = 'ua',\n\tUnitedArabEmirates = 'ae',\n\tUnitedKingdom = 'gb',\n\tUnitedStates = 'us',\n\tUruguay = 'uy',\n\tUzbekistan = 'uz',\n\tVanuatu = 'vu',\n\tVaticanCity = 'va',\n\tVenezuela = 've',\n\tVietnam = 'vn',\n\tWallisAndFutuna = 'wf',\n\tWesternSahara = 'eh',\n\tYemen = 'ye',\n\tZambia = 'zm',\n\tZimbabwe = 'zw',\n\tÅlandIslands = 'ax',\n}\n","import { CountryISO } from '../model/country-iso.enum';\n\nexport const ALL_COUNTRIES = [\n [\n 'Afghanistan (افغانستان)',\n CountryISO.Afghanistan,\n '93'\n ],\n [\n 'Albania (Shqipëri)',\n CountryISO.Albania,\n '355'\n ],\n [\n 'Algeria (الجزائر)',\n CountryISO.Algeria,\n '213'\n ],\n [\n 'American Samoa',\n 'as',\n '1',\n 1,\n [\n '684',\n ]\n ],\n [\n 'Andorra',\n CountryISO.Andorra,\n '376'\n ],\n [\n 'Angola',\n CountryISO.Angola,\n '244'\n ],\n [\n 'Anguilla',\n 'ai',\n '1',\n 1,\n [\n '264',\n ]\n ],\n [\n 'Antigua and Barbuda',\n 'ag',\n '1',\n 1,\n [\n '268',\n ]\n ],\n [\n 'Argentina',\n CountryISO.Argentina,\n '54'\n ],\n [\n 'Armenia (Հայաստան)',\n CountryISO.Armenia,\n '374'\n ],\n [\n 'Aruba',\n CountryISO.Aruba,\n '297'\n ],\n [\n 'Australia',\n CountryISO.Australia,\n '61',\n 0\n ],\n [\n 'Austria (Österreich)',\n CountryISO.Austria,\n '43'\n ],\n [\n 'Azerbaijan (Azərbaycan)',\n CountryISO.Azerbaijan,\n '994'\n ],\n [\n 'Bahamas',\n 'bs',\n '1',\n 1,\n [\n '242',\n ]\n ],\n [\n 'Bahrain (البحرين)',\n CountryISO.Bahrain,\n '973'\n ],\n [\n 'Bangladesh (বাংলাদেশ)',\n CountryISO.Bangladesh,\n '880'\n ],\n [\n 'Barbados',\n 'bb',\n '1',\n 1,\n [\n '246',\n ]\n ],\n [\n 'Belarus (Беларусь)',\n CountryISO.Belarus,\n '375'\n ],\n [\n 'Belgium (België)',\n CountryISO.Belgium,\n '32'\n ],\n [\n 'Belize',\n CountryISO.Belize,\n '501'\n ],\n [\n 'Benin (Bénin)',\n CountryISO.Benin,\n '229'\n ],\n [\n 'Bermuda',\n 'bm',\n '1',\n 1,\n [\n '441',\n ]\n ],\n [\n 'Bhutan (འབྲུག)',\n CountryISO.Bhutan,\n '975'\n ],\n [\n 'Bolivia',\n CountryISO.Bolivia,\n '591'\n ],\n [\n 'Bosnia and Herzegovina (Босна и Херцеговина)',\n CountryISO.BosniaAndHerzegovina,\n '387'\n ],\n [\n 'Botswana',\n CountryISO.Botswana,\n '267'\n ],\n [\n 'Brazil (Brasil)',\n CountryISO.Brazil,\n '55'\n ],\n [\n 'British Indian Ocean Territory',\n CountryISO.BritishIndianOceanTerritory,\n '246'\n ],\n [\n 'British Virgin Islands',\n 'vg',\n '1',\n 1,\n [\n '284',\n ]\n ],\n [\n 'Brunei',\n CountryISO.Brunei,\n '673'\n ],\n [\n 'Bulgaria (България)',\n CountryISO.Bulgaria,\n '359'\n ],\n [\n 'Burkina Faso',\n CountryISO.BurkinaFaso,\n '226'\n ],\n [\n 'Burundi (Uburundi)',\n CountryISO.Burundi,\n '257'\n ],\n [\n 'Cambodia (កម្ពុជា)',\n CountryISO.Cambodia,\n '855'\n ],\n [\n 'Cameroon (Cameroun)',\n CountryISO.Cameroon,\n '237'\n ],\n [\n 'Canada',\n CountryISO.Canada,\n '1',\n 1,\n [\n '204', '226', '236', '249', '250', '289', '306', '343', '365', '387', '403', '416',\n '418', '431', '437', '438', '450', '506', '514', '519', '548', '579', '581', '587',\n '604', '613', '639', '647', '672', '705', '709', '742', '778', '780', '782', '807',\n '819', '825', '867', '873', '902', '905'\n ]\n ],\n [\n 'Cape Verde (Kabu Verdi)',\n CountryISO.CapeVerde,\n '238'\n ],\n [\n 'Caribbean Netherlands',\n CountryISO.CaribbeanNetherlands,\n '599',\n 1\n ],\n [\n 'Cayman Islands',\n 'ky',\n '1',\n 1,\n [\n '345',\n ]\n ],\n [\n 'Central African Republic (République centrafricaine)',\n CountryISO.CentralAfricanRepublic,\n '236'\n ],\n [\n 'Chad (Tchad)',\n CountryISO.Chad,\n '235'\n ],\n [\n 'Chile',\n CountryISO.Chile,\n '56'\n ],\n [\n 'China (中国)',\n CountryISO.China,\n '86'\n ],\n [\n 'Christmas Island',\n CountryISO.ChristmasIsland,\n '61',\n 2\n ],\n [\n 'Cocos (Keeling) Islands',\n CountryISO.Cocos,\n '61',\n 1\n ],\n [\n 'Colombia',\n CountryISO.Colombia,\n '57'\n ],\n [\n 'Comoros (جزر القمر)',\n CountryISO.Comoros,\n '269'\n ],\n [\n 'Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)',\n CountryISO.CongoDRCJamhuriYaKidemokrasiaYaKongo,\n '243'\n ],\n [\n 'Congo (Republic) (Congo-Brazzaville)',\n CountryISO.CongoRepublicCongoBrazzaville,\n '242'\n ],\n [\n 'Cook Islands',\n CountryISO.CookIslands,\n '682'\n ],\n [\n 'Costa Rica',\n CountryISO.CostaRica,\n '506'\n ],\n [\n 'Côte d’Ivoire',\n CountryISO.CôteDIvoire,\n '225'\n ],\n [\n 'Croatia (Hrvatska)',\n CountryISO.Croatia,\n '385'\n ],\n [\n 'Cuba',\n CountryISO.Cuba,\n '53'\n ],\n [\n 'Curaçao',\n CountryISO.Curaçao,\n '599',\n 0\n ],\n [\n 'Cyprus (Κύπρος)',\n CountryISO.Cyprus,\n '357'\n ],\n [\n 'Czech Republic (Česká republika)',\n CountryISO.CzechRepublic,\n '420'\n ],\n [\n 'Denmark (Danmark)',\n CountryISO.Denmark,\n '45'\n ],\n [\n 'Djibouti',\n CountryISO.Djibouti,\n '253'\n ],\n [\n 'Dominica',\n CountryISO.Dominica,\n '1767'\n ],\n [\n 'Dominican Republic (República Dominicana)',\n CountryISO.DominicanRepublic,\n '1',\n 2,\n [ '809', '829', '849' ]\n ],\n [\n 'Ecuador',\n CountryISO.Ecuador,\n '593'\n ],\n [\n 'Egypt (مصر)',\n CountryISO.Egypt,\n '20'\n ],\n [\n 'El Salvador',\n CountryISO.ElSalvador,\n '503'\n ],\n [\n 'Equatorial Guinea (Guinea Ecuatorial)',\n CountryISO.EquatorialGuinea,\n '240'\n ],\n [\n 'Eritrea',\n CountryISO.Eritrea,\n '291'\n ],\n [\n 'Estonia (Eesti)',\n CountryISO.Estonia,\n '372'\n ],\n [\n 'Ethiopia',\n CountryISO.Ethiopia,\n '251'\n ],\n [\n 'Falkland Islands (Islas Malvinas)',\n CountryISO.FalklandIslands,\n '500'\n ],\n [\n 'Faroe Islands (Føroyar)',\n CountryISO.FaroeIslands,\n '298'\n ],\n [\n 'Fiji',\n CountryISO.Fiji,\n '679'\n ],\n [\n 'Finland (Suomi)',\n CountryISO.Finland,\n '358',\n 0\n ],\n [\n 'France',\n CountryISO.France,\n '33'\n ],\n [\n 'French Guiana (Guyane française)',\n CountryISO.FrenchGuiana,\n '594'\n ],\n [\n 'French Polynesia (Polynésie française)',\n CountryISO.FrenchPolynesia,\n '689'\n ],\n [\n 'Gabon',\n CountryISO.Gabon,\n '241'\n ],\n [\n 'Gambia',\n CountryISO.Gambia,\n '220'\n ],\n [\n 'Georgia (საქართველო)',\n CountryISO.Georgia,\n '995'\n ],\n [\n 'Germany (Deutschland)',\n CountryISO.Germany,\n '49'\n ],\n [\n 'Ghana (Gaana)',\n CountryISO.Ghana,\n '233'\n ],\n [\n 'Gibraltar',\n CountryISO.Gibraltar,\n '350'\n ],\n [\n 'Greece (Ελλάδα)',\n CountryISO.Greece,\n '30'\n ],\n [\n 'Greenland (Kalaallit Nunaat)',\n CountryISO.Greenland,\n '299'\n ],\n [\n 'Grenada',\n CountryISO.Grenada,\n '1473'\n ],\n [\n 'Guadeloupe',\n CountryISO.Guadeloupe,\n '590',\n 0\n ],\n [\n 'Guam',\n 'gu',\n '1',\n 1,\n [\n '671',\n ]\n ],\n [\n 'Guatemala',\n CountryISO.Guatemala,\n '502'\n ],\n [\n 'Guernsey',\n CountryISO.Guernsey,\n '44',\n 1,\n [ 1481 ]\n ],\n [\n 'Guinea (Guinée)',\n CountryISO.Guinea,\n '224'\n ],\n [\n 'Guinea-Bissau (Guiné Bissau)',\n CountryISO.GuineaBissau,\n '245'\n ],\n [\n 'Guyana',\n CountryISO.Guyana,\n '592'\n ],\n [\n 'Haiti',\n CountryISO.Haiti,\n '509'\n ],\n [\n 'Honduras',\n CountryISO.Honduras,\n '504'\n ],\n [\n 'Hong Kong (香港)',\n CountryISO.HongKong,\n '852'\n ],\n [\n 'Hungary (Magyarország)',\n CountryISO.Hungary,\n '36'\n ],\n [\n 'Iceland (Ísland)',\n CountryISO.Iceland,\n '354'\n ],\n [\n 'India (भारत)',\n CountryISO.India,\n '91'\n ],\n [\n 'Indonesia',\n CountryISO.Indonesia,\n '62'\n ],\n [\n 'Iran (ایران)',\n CountryISO.Iran,\n '98'\n ],\n [\n 'Iraq (العراق)',\n CountryISO.Iraq,\n '964'\n ],\n [\n 'Ireland',\n CountryISO.Ireland,\n '353'\n ],\n [\n 'Isle of Man',\n CountryISO.IsleOfMan,\n '44',\n 2,\n [ 1624 ]\n ],\n [\n 'Israel (ישראל)',\n CountryISO.Israel,\n '972'\n ],\n [\n 'Italy (Italia)',\n CountryISO.Italy,\n '39',\n 0\n ],\n [\n 'Jamaica',\n 'jm',\n '1',\n 1,\n [\n '876',\n ]\n ],\n [\n 'Japan (日本)',\n CountryISO.Japan,\n '81'\n ],\n [\n 'Jersey',\n CountryISO.Jersey,\n '44',\n 3,\n [ 1534 ]\n ],\n [\n 'Jordan (الأردن)',\n CountryISO.Jordan,\n '962'\n ],\n [\n 'Kazakhstan (Казахстан)',\n CountryISO.Kazakhstan,\n '7',\n 1\n ],\n [\n 'Kenya',\n CountryISO.Kenya,\n '254'\n ],\n [\n 'Kiribati',\n CountryISO.Kiribati,\n '686'\n ],\n [\n 'Kosovo',\n CountryISO.Kosovo,\n '383'\n ],\n [\n 'Kuwait (الكويت)',\n CountryISO.Kuwait,\n '965'\n ],\n [\n 'Kyrgyzstan (Кыргызстан)',\n CountryISO.Kyrgyzstan,\n '996'\n ],\n [\n 'Laos (ລາວ)',\n CountryISO.Laos,\n '856'\n ],\n [\n 'Latvia (Latvija)',\n CountryISO.Latvia,\n '371'\n ],\n [\n 'Lebanon (لبنان)',\n CountryISO.Lebanon,\n '961'\n ],\n [\n 'Lesotho',\n CountryISO.Lesotho,\n '266'\n ],\n [\n 'Liberia',\n CountryISO.Liberia,\n '231'\n ],\n [\n 'Libya (ليبيا)',\n CountryISO.Libya,\n '218'\n ],\n [\n 'Liechtenstein',\n CountryISO.Liechtenstein,\n '423'\n ],\n [\n 'Lithuania (Lietuva)',\n CountryISO.Lithuania,\n '370'\n ],\n [\n 'Luxembourg',\n CountryISO.Luxembourg,\n '352'\n ],\n [\n 'Macau (澳門)',\n CountryISO.Macau,\n '853'\n ],\n [\n 'Macedonia (FYROM) (Македонија)',\n CountryISO.Macedonia,\n '389'\n ],\n [\n 'Madagascar (Madagasikara)',\n CountryISO.Madagascar,\n '261'\n ],\n [\n 'Malawi',\n CountryISO.Malawi,\n '265'\n ],\n [\n 'Malaysia',\n CountryISO.Malaysia,\n '60'\n ],\n [\n 'Maldives',\n CountryISO.Maldives,\n '960'\n ],\n [\n 'Mali',\n CountryISO.Mali,\n '223'\n ],\n [\n 'Malta',\n CountryISO.Malta,\n '356'\n ],\n [\n 'Marshall Islands',\n CountryISO.MarshallIslands,\n '692'\n ],\n [\n 'Martinique',\n CountryISO.Martinique,\n '596'\n ],\n [\n 'Mauritania (موريتانيا)',\n CountryISO.Mauritania,\n '222'\n ],\n [\n 'Mauritius (Moris)',\n CountryISO.Mauritius,\n '230'\n ],\n [\n 'Mayotte',\n CountryISO.Mayotte,\n '262',\n 1\n ],\n [\n 'Mexico (México)',\n CountryISO.Mexico,\n '52'\n ],\n [\n 'Micronesia',\n CountryISO.Micronesia,\n '691'\n ],\n [\n 'Moldova (Republica Moldova)',\n CountryISO.Moldova,\n '373'\n ],\n [\n 'Monaco',\n CountryISO.Monaco,\n '377'\n ],\n [\n 'Mongolia (Монгол)',\n CountryISO.Mongolia,\n '976'\n ],\n [\n 'Montenegro (Crna Gora)',\n CountryISO.Montenegro,\n '382'\n ],\n [\n 'Montserrat',\n 'ms',\n '1',\n 1,\n [\n '664',\n ]\n ],\n [\n 'Morocco (المغرب)',\n CountryISO.Morocco,\n '212',\n 0\n ],\n [\n 'Mozambique (Moçambique)',\n CountryISO.Mozambique,\n '258'\n ],\n [\n 'Myanmar (Burma) (မြန်မာ)',\n CountryISO.Myanmar,\n '95'\n ],\n [\n 'Namibia (Namibië)',\n CountryISO.Namibia,\n '264'\n ],\n [\n 'Nauru',\n CountryISO.Nauru,\n '674'\n ],\n [\n 'Nepal (नेपाल)',\n CountryISO.Nepal,\n '977'\n ],\n [\n 'Netherlands (Nederland)',\n CountryISO.Netherlands,\n '31'\n ],\n [\n 'New Caledonia (Nouvelle-Calédonie)',\n CountryISO.NewCaledonia,\n '687'\n ],\n [\n 'New Zealand',\n CountryISO.NewZealand,\n '64'\n ],\n [\n 'Nicaragua',\n CountryISO.Nicaragua,\n '505'\n ],\n [\n 'Niger (Nijar)',\n CountryISO.Niger,\n '227'\n ],\n [\n 'Nigeria',\n CountryISO.Nigeria,\n '234'\n ],\n [\n 'Niue',\n CountryISO.Niue,\n '683'\n ],\n [\n 'Norfolk Island',\n CountryISO.NorfolkIsland,\n '672'\n ],\n [\n 'North Korea (조선 민주주의 인민 공화국)',\n CountryISO.NorthKorea,\n '850'\n ],\n [\n 'Northern Mariana Islands',\n CountryISO.NorthernMarianaIslands,\n '1670'\n ],\n [\n 'Norway (Norge)',\n CountryISO.Norway,\n '47',\n 0\n ],\n [\n 'Oman (عُمان)',\n CountryISO.Oman,\n '968'\n ],\n [\n 'Pakistan (پاکستان)',\n CountryISO.Pakistan,\n '92'\n ],\n [\n 'Palau',\n CountryISO.Palau,\n '680'\n ],\n [\n 'Palestine (فلسطين)',\n CountryISO.Palestine,\n '970'\n ],\n [\n 'Panama (Panamá)',\n CountryISO.Panama,\n '507'\n ],\n [\n 'Papua New Guinea',\n CountryISO.PapuaNewGuinea,\n '675'\n ],\n [\n 'Paraguay',\n CountryISO.Paraguay,\n '595'\n ],\n [\n 'Peru (Perú)',\n CountryISO.Peru,\n '51'\n ],\n [\n 'Philippines',\n CountryISO.Philippines,\n '63'\n ],\n [\n 'Poland (Polska)',\n CountryISO.Poland,\n '48'\n ],\n [\n 'Portugal',\n CountryISO.Portugal,\n '351'\n ],\n [\n 'Puerto Rico',\n CountryISO.PuertoRico,\n '1',\n 3,\n [ '787', '939' ]\n ],\n [\n 'Qatar (قطر)',\n CountryISO.Qatar,\n '974'\n ],\n [\n 'Réunion (La Réunion)',\n CountryISO.Réunion,\n '262',\n 0\n ],\n [\n 'Romania (România)',\n CountryISO.Romania,\n '40'\n ],\n [\n 'Russia (Россия)',\n CountryISO.Russia,\n '7',\n 0\n ],\n [\n 'Rwanda',\n CountryISO.Rwanda,\n '250'\n ],\n [\n 'Saint Barthélemy (Saint-Barthélemy)',\n CountryISO.SaintBarthélemy,\n '590',\n 1\n ],\n [\n 'Saint Helena',\n CountryISO.SaintHelena,\n '290'\n ],\n [\n 'Saint Kitts and Nevis',\n CountryISO.SaintKittsAndNevis,\n '1869'\n ],\n [\n 'Saint Lucia',\n 'lc',\n '1',\n 1,\n [\n '758',\n ]\n ],\n [\n 'Saint Martin (Saint-Martin (partie française))',\n CountryISO.SaintMartin,\n '590',\n 2\n ],\n [\n 'Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)',\n CountryISO.SaintPierreAndMiquelon,\n '508'\n ],\n [\n 'Saint Vincent and the Grenadines',\n 'vc',\n '1',\n 1,\n [\n '784',\n ]\n ],\n [\n 'Samoa',\n CountryISO.Samoa,\n '685'\n ],\n [\n 'San Marino',\n CountryISO.SanMarino,\n '378'\n ],\n [\n 'São Tomé and Príncipe (São Tomé e Príncipe)',\n CountryISO.SãoToméAndPríncipe,\n '239'\n ],\n [\n 'Saudi Arabia (المملكة العربية السعودية)',\n CountryISO.SaudiArabia,\n '966'\n ],\n [\n 'Senegal (Sénégal)',\n CountryISO.Senegal,\n '221'\n ],\n [\n 'Serbia (Србија)',\n CountryISO.Serbia,\n '381'\n ],\n [\n 'Seychelles',\n CountryISO.Seychelles,\n '248'\n ],\n [\n 'Sierra Leone',\n CountryISO.SierraLeone,\n '232'\n ],\n [\n 'Singapore',\n CountryISO.Singapore,\n '65'\n ],\n [\n 'Sint Maarten',\n 'sx',\n '1',\n 1,\n [\n '721',\n ]\n ],\n [\n 'Slovakia (Slovensko)',\n CountryISO.Slovakia,\n '421'\n ],\n [\n 'Slovenia (Slovenija)',\n CountryISO.Slovenia,\n '386'\n ],\n [\n 'Solomon Islands',\n CountryISO.SolomonIslands,\n '677'\n ],\n [\n 'Somalia (Soomaaliya)',\n CountryISO.Somalia,\n '252'\n ],\n [\n 'South Africa',\n CountryISO.SouthAfrica,\n '27'\n ],\n [\n 'South Korea (대한민국)',\n CountryISO.SouthKorea,\n '82'\n ],\n [\n 'South Sudan (جنوب السودان)',\n CountryISO.SouthSudan,\n '211'\n ],\n [\n 'Spain (España)',\n CountryISO.Spain,\n '34'\n ],\n [\n 'Sri Lanka (ශ්රී ලංකාව)',\n CountryISO.SriLanka,\n '94'\n ],\n [\n 'Sudan (السودان)',\n CountryISO.Sudan,\n '249'\n ],\n [\n 'Suriname',\n CountryISO.Suriname,\n '597'\n ],\n [\n 'Svalbard and Jan Mayen',\n CountryISO.SvalbardAndJanMayen,\n '47',\n 1\n ],\n [\n 'Swaziland',\n CountryISO.Swaziland,\n '268'\n ],\n [\n 'Sweden (Sverige)',\n CountryISO.Sweden,\n '46'\n ],\n [\n 'Switzerland (Schweiz)',\n CountryISO.Switzerland,\n '41'\n ],\n [\n 'Syria (سوريا)',\n CountryISO.Syria,\n '963'\n ],\n [\n 'Taiwan (台灣)',\n CountryISO.Taiwan,\n '886'\n ],\n [\n 'Tajikistan',\n CountryISO.Tajikistan,\n '992'\n ],\n [\n 'Tanzania',\n CountryISO.Tanzania,\n '255'\n ],\n [\n 'Thailand (ไทย)',\n CountryISO.Thailand,\n '66'\n ],\n [\n 'Timor-Leste',\n CountryISO.TimorLeste,\n '670'\n ],\n [\n 'Togo',\n CountryISO.Togo,\n '228'\n ],\n [\n 'Tokelau',\n CountryISO.Tokelau,\n '690'\n ],\n [\n 'Tonga',\n CountryISO.Tonga,\n '676'\n ],\n [\n 'Trinidad and Tobago',\n 'tt',\n '1',\n 1,\n [\n '868',\n ]\n ],\n [\n 'Tunisia (تونس)',\n CountryISO.Tunisia,\n '216'\n ],\n [\n 'Turkey (Türkiye)',\n CountryISO.Turkey,\n '90'\n ],\n [\n 'Turkmenistan',\n CountryISO.Turkmenistan,\n '993'\n ],\n [\n 'Turks and Caicos Islands',\n CountryISO.TurksAndCaicosIslands,\n '1649'\n ],\n [\n 'Tuvalu',\n CountryISO.Tuvalu,\n '688'\n ],\n [\n 'U.S. Virgin Islands',\n 'vi',\n '1',\n 1,\n [\n '340',\n ]\n ],\n [\n 'Uganda',\n CountryISO.Uganda,\n '256'\n ],\n [\n 'Ukraine (Україна)',\n CountryISO.Ukraine,\n '380'\n ],\n [\n 'United Arab Emirates (الإمارات العربية المتحدة)',\n CountryISO.UnitedArabEmirates,\n '971'\n ],\n [\n 'United Kingdom',\n CountryISO.UnitedKingdom,\n '44',\n 0\n ],\n [\n 'United States',\n CountryISO.UnitedStates,\n '1',\n 0\n ],\n [\n 'Uruguay',\n CountryISO.Uruguay,\n '598'\n ],\n [\n 'Uzbekistan (Oʻzbekiston)',\n CountryISO.Uzbekistan,\n '998'\n ],\n [\n 'Vanuatu',\n CountryISO.Vanuatu,\n '678'\n ],\n [\n 'Vatican City (Città del Vaticano)',\n CountryISO.VaticanCity,\n '39',\n 1\n ],\n [\n 'Venezuela',\n CountryISO.Venezuela,\n '58'\n ],\n [\n 'Vietnam (Việt Nam)',\n CountryISO.Vietnam,\n '84'\n ],\n [\n 'Wallis and Futuna',\n CountryISO.WallisAndFutuna,\n '681'\n ],\n [\n 'Western Sahara (الصحراء الغربية)',\n CountryISO.WesternSahara,\n '212',\n 1\n ],\n [\n 'Yemen (اليمن)',\n CountryISO.Yemen,\n '967'\n ],\n [\n 'Zambia',\n CountryISO.Zambia,\n '260'\n ],\n [\n 'Zimbabwe',\n CountryISO.Zimbabwe,\n '263'\n ],\n [\n 'Åland Islands',\n CountryISO.ÅlandIslands,\n '358',\n 1\n ]\n];\n","import { Pipe, PipeTransform } from '@angular/core';\n\n@Pipe({\n name: 'dialCode',\n standalone: true\n})\nexport class DialCodePipe implements PipeTransform {\n transform(dialoCode: string): string {\n if (!dialoCode) return '';\n return `+${ dialoCode }`;\n }\n}\n","import { Directive, ElementRef, OnInit } from '@angular/core';\n\n@Directive({\n selector: '[favorite]',\n standalone: true\n})\nexport class FavoriteElementInjectorDirective implements OnInit {\n private el;\n\n constructor(el: ElementRef) {\n this.el = el;\n }\n\n ngOnInit() {\n if (this.el.nativeElement.classList.contains('favorite')) {\n this.el.nativeElement.parentNode.parentNode.classList.add('favoriteItem')\n }\n }\n}\n","import { Directive, ElementRef, OnInit } from '@angular/core';\nimport { NgControl } from '@angular/forms';\n\n/*\n\"Property 'nativeElement' does not exist on type 'FormControl'\".\n'NativeElementInjectorDirective' injects nativeElement to each control,\nso we can access it from inside validator for example.\nMore about this approach and reasons for this:\nhttps://github.com/angular/angular/issues/18025\nhttps://stackoverflow.com/a/54075119/1617590\n*/\n@Directive({\n selector: '[ngModel], [formControl], [formControlName]',\n standalone: true\n})\nexport class NativeElementInjectorDirective implements OnInit {\n constructor(private controlDir: NgControl, private host: ElementRef<HTMLFormElement>) {\n }\n\n ngOnInit() {\n //@ts-ignore\n if( this.controlDir.control ) this.controlDir.control['nativeElement'] = this.host.nativeElement\n }\n}\n","/* eslint-disable prefer-const */\n/* eslint-disable @typescript-eslint/no-empty-function */\n/* eslint-disable @angular-eslint/component-selector */\nimport * as lpn from \"google-libphonenumber\";\nimport { PhoneNumberFormat, PhoneNumberUtil, PhoneNumberType } from \"google-libphonenumber\";\nimport { Component, computed, EventEmitter, forwardRef, Input, linkedSignal, OnChanges, OnDestroy, Output, signal, SimpleChanges } from \"@angular/core\";\nimport {\n FormControl,\n FormsModule,\n NG_VALUE_ACCESSOR,\n NG_VALIDATORS,\n ReactiveFormsModule,\n ValidationErrors,\n Validator,\n ControlValueAccessor,\n} from \"@angular/forms\";\nimport { CountryISO } from \"../model/country-iso.enum\";\nimport { SearchCountryField } from \"../model/search-country-field\";\nimport { Country } from \"../model/country.model\";\nimport { Subject } from \"rxjs\";\nimport { debounceTime, distinctUntilChanged } from \"rxjs/operators\";\nimport { ALL_COUNTRIES } from \"../data/country-code\";\nimport { DialCodePipe } from \"../pipe/dialCode.pipe\";\nimport { InputTextModule } from \"primeng/inputtext\";\nimport { FavoriteElementInjectorDirective } from \"../directives/favorite-element-injector.directive\";\nimport { NativeElementInjectorDirective } from \"../directives/native-element-injector.directive\";\nimport { CommonModule } from \"@angular/common\";\nimport { Select } from \"primeng/select\";\n// Type definitions\n\n// Phone state management\ntype PhoneState = {\n number: lpn.PhoneNumber | null;\n country: CountryISO | null;\n valid: boolean;\n formatted: string;\n};\n@Component({\n selector: \"p-intl-tel-input-gg\",\n template: `\n <div class=\"flex items-center gap-2 phone-input-component\">\n <p-select\n [options]=\"countriesSignal()\"\n [filter]=\"true\"\n [filterFields]=\"searchCountryField\"\n appendTo=\"body\"\n [resetFilterOnHide]=\"true\"\n [disabled]=\"phoneNumberControl.disabled\"\n [(ngModel)]=\"selectedCountrySignal\"\n (onChange)=\"onCountrySelect($event.value)\"\n optionLabel=\"name\"\n [showClear]=\"false\"\n >\n <ng-template #selectedItem let-selectedOption>\n @if (selectedOption) {\n <div class=\"flex items-center\" [ngClass]=\"separateDialCode ? 'gap-0' : 'w-12 px-2'\">\n <div [ngClass]=\"selectedOption.flagClass\"></div>\n @if (separateDialCode) {\n <span>+{{ selectedOption.dialCode }}</span>\n }\n </div>\n }\n </ng-template>\n\n <ng-template #item let-country>\n <div class=\"flex items-center gap-3 w-full px-1\" [ngClass]=\"{ favorite: country.isFavorite }\">\n <div [ngClass]=\"country.flagClass\"></div>\n <div class=\"flex flex-col\">\n <span class=\"text-sm\">{{ country.name }}</span>\n <span class=\"text-xs text-gray-500\">{{ country.dialCode | dialCode }}</span>\n </div>\n </div>\n </ng-template>\n </p-select>\n\n <input\n pInputText\n #input\n class=\"border rounded-lg p-2\"\n [ngClass]=\"{ 'ng-invalid': phoneNumberControl.invalid && phoneNumberControl.touched }\"\n type=\"tel\"\n [id]=\"inputId\"\n autocomplete=\"off\"\n (blur)=\"onInputBlur()\"\n (paste)=\"onPaste($event)\"\n [placeholder]=\"selectedCountrySignal().placeHolder\"\n [formControl]=\"phoneNumberControl\"\n (keydown)=\"onInputKeyPress($event)\"\n [attr.maxLength]=\"getCurrentMaxLength()\"\n [attr.validation]=\"phoneValidation\"\n aria-describedby=\"phone-error\"\n />\n </div>\n @if (showExamplePlaceholder && examplePlaceholder()) {\n <div class=\"example-placeholder\">\n <small class=\"text-gray-500\">Example: {{ examplePlaceholder() }}</small>\n </div>\n }\n `,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => IntlInputTelComponent),\n multi: true,\n },\n {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => IntlInputTelComponent),\n multi: true,\n },\n ],\n standalone: true,\n imports: [\n InputTextModule,\n FormsModule,\n ReactiveFormsModule,\n CommonModule,\n DialCodePipe,\n FavoriteElementInjectorDirective,\n NativeElementInjectorDirective,\n Select,\n ],\n styleUrls: [\"./p-intl-input-tel.component.scss\"],\n})\nexport class IntlInputTelComponent implements OnChanges, OnDestroy, ControlValueAccessor, Validator {\n @Input() cssClass = \"form-control\";\n @Input() favoriteCountries: string[] = [];\n @Input() onlyCountries: string[] = [];\n @Input() enableAutoCountrySelect = true;\n @Input() displayPlaceholder = true;\n @Input() customPlaceholder: string;\n @Input() numberFormat: PhoneNumberFormat = PhoneNumberFormat.INTERNATIONAL;\n @Input() searchCountryField: SearchCountryField[] = [SearchCountryField.NAME];\n @Input() selectFirstCountry = true;\n @Input() inputId = \"phone\";\n @Input() selectedCountryISO?: CountryISO;\n @Input() separateDialCode = false;\n @Input() showExamplePlaceholder: boolean = false;\n @Input() phoneValidation = true;\n\n private _lang = signal(\"en\");\n\n @Input() set lang(value: string) {\n if (value && value !== this._lang()) {\n this._lang.set(value);\n if (this.countriesSignal().length > 0) {\n this.fetchCountryData();\n }\n }\n }\n\n get lang(): string {\n return this._lang();\n }\n\n @Input() set disabled(value: boolean) {\n this.setDisabledState(value);\n }\n\n @Output() readonly countryChange = new EventEmitter<Country>();\n\n public readonly SearchCountryField = SearchCountryField;\n public phoneUtil: PhoneNumberUtil = lpn.PhoneNumberUtil.getInstance();\n public phoneNumberControl = new FormControl(\"\");\n private destroy$ = new Subject<void>();\n\n // Base signals\n public countriesSignal = signal<Country[]>([]);\n public selectedCountrySignal = signal<Country>(new Country());\n public phoneState = linkedSignal(() => {\n const value = this.phoneNumberControl.value ?? \"\";\n\n // If user only typed \"+\" or it's purely whitespace, skip any fancy logic\n if (!value.trim() || value.trim() === \"+\") {\n return {\n number: null,\n country: null,\n valid: false,\n formatted: value, // just keep the plus or empty\n };\n }\n\n try {\n const shouldKeepInternational = value.startsWith(\"+\");\n const currentCountry = this.selectedCountrySignal();\n const number = this.phoneUtil.parseAndKeepRawInput(value, shouldKeepInternational ? \"ZZ\" : currentCountry.iso2);\n\n const expectedLength = this.getCurrentMaxLength();\n const nationalNumber = number.getNationalNumber()?.toString() ?? \"\";\n const isComplete = nationalNumber.length >= expectedLength;\n const isValid = this.phoneUtil.isValidNumber(number) && this.phoneUtil.isValidNumberForRegion(number, currentCountry.iso2);\n\n return {\n number,\n country: currentCountry.iso2,\n valid: isValid,\n formatted: isValid && isComplete ? this.phoneUtil.format(number, this.numberFormat) : value,\n };\n } catch {\n return {\n number: null,\n country: this.selectedCountrySignal().iso2,\n valid: false,\n formatted: value,\n };\n }\n });\n\n // Computed values\n public examplePlaceholder = computed(() => {\n if (!this.showExamplePlaceholder) return \"\";\n\n try {\n const country = this.selectedCountrySignal();\n const example = this.phoneUtil.getExampleNumberForType(country.iso2, PhoneNumberType.MOBILE);\n return example ? this.phoneUtil.format(example, this.numberFormat) : \"\";\n } catch {\n return \"\";\n }\n });\n\n private get favorites(): Country[] {\n return this.countriesSignal().filter((c) => c.isFavorite);\n }\n\n private propagateChange: any = () => {};\n private onTouched: () => void = () => {};\n private onValidatorChange: () => void = () => {};\n\n constructor() {\n this.phoneNumberControl.valueChanges.pipe(debounceTime(300), distinctUntilChanged()).subscribe((value: string | null) => {\n if (!value?.trim()) {\n this.phoneNumberControl.setErrors(null);\n this.propagateChange(\"\");\n return;\n }\n\n // Always parse for region detection\n try {\n const parsedNumber = this.phoneUtil.parseAndKeepRawInput(value, \"ZZ\");\n const regionCode = this.phoneUtil.getRegionCodeForNumber(parsedNumber);\n\n // Switch country if recognized\n const currentCountry = this.selectedCountrySignal();\n if (regionCode && regionCode.toLowerCase() !== currentCountry.iso2.toLowerCase()) {\n const found = this.countriesSignal().find((c) => c.iso2.toLowerCase() === regionCode.toLowerCase());\n if (found) {\n this.selectedCountrySignal.set(found);\n }\n }\n } catch {\n // ignore parse error\n }\n\n // No auto-format here, just propagate\n this.propagateChange(value);\n });\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (!this.countriesSignal().length) {\n this.init();\n }\n\n if (changes[\"selectedCountryISO\"]) {\n this.updateSelectedCountry();\n }\n\n if (changes[\"favoriteCountries\"]) {\n this.fetchCountryData();\n }\n }\n\n ngOnDestroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n }\n\n public init(): void {\n this.fetchCountryData();\n if (this.onlyCountries.length) {\n this.countriesSignal.update((countries) => countries.filter((c) => this.onlyCountries.includes(c.iso2)));\n }\n this.updateSelectedCountry();\n }\n\n public getCurrentMaxLength(): number {\n const country = this.selectedCountrySignal();\n if (!country.iso2) return 15;\n\n try {\n const example = this.phoneUtil.getExampleNumberForType(country.iso2, PhoneNumberType.MOBILE);\n if (!example) return 15;\n\n const currentValue = this.phoneNumberControl.value || \"\";\n const nationalNumber = example.getNationalNumber()?.toString() || \"\";\n return currentValue.startsWith(\"+\") ? nationalNumber.length + country.dialCode.length + 1 : nationalNumber.length;\n } catch {\n return 15;\n }\n }\n public onInputKeyPress(event: KeyboardEvent): void {\n const allowedKeys = [\"ArrowLeft\", \"ArrowRight\", \"Backspace\", \"Delete\", \"Tab\", \"Home\", \"End\"];\n if (allowedKeys.includes(event.key)) return;\n\n if ((event.ctrlKey || event.metaKey) && [\"a\", \"c\", \"v\", \"x\"].includes(event.key.toLowerCase())) return;\n\n const input = event.target as HTMLInputElement;\n const currentValue = input.value;\n const selectionStart = input.selectionStart || 0;\n\n if (event.key === \"+\" && selectionStart === 0) return;\n\n if (!/^\\d$/.test(event.key)) {\n event.preventDefault();\n return;\n }\n\n const numericValue = currentValue.replace(/\\D/g, \"\");\n const maxLength = this.getCurrentMaxLength();\n const currentLength = currentValue.startsWith(\"+\") ? numericValue.length : numericValue.length;\n\n if (!event.ctrlKey && !event.metaKey && currentLength >= maxLength && input.selectionStart === input.selectionEnd) {\n event.preventDefault();\n }\n }\n\n public onInputBlur(): void {\n this.phoneNumberControl.markAsTouched();\n this.onTouched();\n // Force state update on blur\n this.phoneState.update((state) => state);\n }\n\n public onCountrySelect(country: Country): void {\n this.selectedCountrySignal.set(country);\n this.countryChange.emit(country);\n // Force state update when country changes\n this.phoneState.update((state) => state);\n }\n\n public onPaste(event: ClipboardEvent): void {\n event.preventDefault();\n const pastedInput = event.clipboardData?.getData(\"text\") || \"\";\n if (!pastedInput) return;\n this.phoneNumberControl.setValue(pastedInput);\n }\n\n protected fetchCountryData(): void {\n const regionsNames = new Intl.DisplayNames([this._lang()], { type: \"region\" });\n const countries = ALL_COUNTRIES.map((countryArray) => {\n const iso2 = countryArray[1].toString().toUpperCase();\n return {\n name: regionsNames.of(iso2) || \"\",\n iso2: iso2,\n dialCode: countryArray[2].toString(),\n priority: +countryArray[3] || 0,\n areaCodes: (countryArray[4] as string[]) || undefined,\n htmlId: `item-${iso2}`,\n flagClass: `iti__flag iti__${iso2.toLowerCase()}`,\n placeHolder: this.getPlaceholder(iso2),\n isFavorite: this.favoriteCountries.includes(iso2),\n };\n }).sort((a, b) => Number(b.isFavorite) - Number(a.isFavorite));\n\n this.countriesSignal.set(countries);\n\n if (this.selectFirstCountry && !this.selectedCountrySignal().iso2) {\n const firstCountry = this.favoriteCountries.length ? countries.find((c) => c.isFavorite) : countries[0];\n if (firstCountry) {\n this.selectedCountrySignal.set(firstCountry);\n }\n }\n }\n\n private updateSelectedCountry(): void {\n if (!this.selectedCountryISO) return;\n const country = this.countriesSignal().find((c) => c.iso2.toLowerCase() === this.selectedCountryISO?.toLowerCase());\n if (country) {\n this.selectedCountrySignal.set(country);\n }\n }\n\n private getPlaceholder(countryCode: string): string {\n if (!this.displayPlaceholder) return \"\";\n if (this.customPlaceholder) return this.customPlaceholder;\n try {\n const example = this.phoneUtil.getExampleNumberForType(countryCode, PhoneNumberType.MOBILE);\n return example ? this.phoneUtil.format(example, this.numberFormat) : \"\";\n } catch {\n return \"\";\n }\n }\n\n // ControlValueAccessor implementation\n writeValue(obj: string): void {\n if (!obj) {\n this.phoneNumberControl.setValue(\"\");\n return;\n }\n\n try {\n const number = this.phoneUtil.parse(obj, \"ZZ\");\n const countryCode = this.phoneUtil.getRegionCodeForNumber(number);\n if (countryCode) {\n const country = this.countriesSignal().find((c) => c.iso2.toLowerCase() === countryCode.toLowerCase());\n if (country) {\n this.selectedCountrySignal.set(country);\n }\n }\n const formatted = this.phoneUtil.format(number, this.numberFormat);\n this.phoneNumberControl.setValue(formatted, { emitEvent: false });\n } catch {\n this.phoneNumberControl.setValue(\"\");\n }\n }\n\n registerOnChange(fn: any): void {\n this.propagateChange = fn;\n }\n\n registerOnTouched(fn: any): void {\n this.onTouched = fn;\n }\n\n registerOnValidatorChange(fn: () => void): void {\n this.onValidatorChange = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n isDisabled ? this.phoneNumberControl.disable() : this.phoneNumberControl.enable();\n }\n\n // Validator implementation\n validate(): ValidationErrors | null {\n return this.phoneNumberControl.errors;\n }\n\n getErrorMessage(): string {\n const errors = this.phoneNumberControl.errors;\n if (!errors) return \"\";\n\n if (errors[\"parseError\"]) return \"Please enter a valid phone number.\";\n if (errors[\"invalidCountry\"]) return \"Selected country is invalid.\";\n if (errors[\"invalidNumber\"]) return \"Invalid phone number for the selected region.\";\n if (errors[\"formatError\"]) return \"Error formatting phone number.\";\n\n return \"Please enter a valid phone number.\";\n }\n}\n","import { PhoneNumber, PhoneNumberFormat, PhoneNumberUtil } from 'google-libphonenumber';\n\nexport class ChangeData {\n number: string;\n internationalNumber: string;\n nationalNumber: string;\n e164Number: string;\n countryCode: string | undefined;\n dialCode: string;\n\n constructor(phoneNumber?: PhoneNumber) {\n const utils = PhoneNumberUtil.getInstance();\n this.countryCode = phoneNumber && utils.getRegionCodeForNumber(phoneNumber) ? utils.getRegionCodeForNumber(phoneNumber) : '';\n this.dialCode = phoneNumber?.getCountryCode() ? `+${phoneNumber.getCountryCode()}` : '';\n this.e164Number = phoneNumber && utils.format(phoneNumber, PhoneNumberFormat.E164) !== '+0' ? utils.format(phoneNumber, PhoneNumberFormat.E164) : '';\n this.internationalNumber = phoneNumber ? utils.format(phoneNumber, PhoneNumberFormat.INTERNATIONAL) : '';\n this.national