utilitify-core 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +338 -0
- package/dist/async.cjs +25 -0
- package/dist/async.cjs.map +1 -0
- package/dist/async.d.cts +104 -0
- package/dist/async.d.ts +104 -0
- package/dist/async.js +4 -0
- package/dist/async.js.map +1 -0
- package/dist/chunk-2ICNRTSN.cjs +346 -0
- package/dist/chunk-2ICNRTSN.cjs.map +1 -0
- package/dist/chunk-3DPF72DY.js +170 -0
- package/dist/chunk-3DPF72DY.js.map +1 -0
- package/dist/chunk-4CV4JOE5.js +24 -0
- package/dist/chunk-4CV4JOE5.js.map +1 -0
- package/dist/chunk-4SLYNSLH.cjs +783 -0
- package/dist/chunk-4SLYNSLH.cjs.map +1 -0
- package/dist/chunk-5WP7DWCG.js +1285 -0
- package/dist/chunk-5WP7DWCG.js.map +1 -0
- package/dist/chunk-BMQ6YPKV.js +876 -0
- package/dist/chunk-BMQ6YPKV.js.map +1 -0
- package/dist/chunk-BZCMWUKS.cjs +479 -0
- package/dist/chunk-BZCMWUKS.cjs.map +1 -0
- package/dist/chunk-C5R744DY.cjs +173 -0
- package/dist/chunk-C5R744DY.cjs.map +1 -0
- package/dist/chunk-C75J62CV.cjs +913 -0
- package/dist/chunk-C75J62CV.cjs.map +1 -0
- package/dist/chunk-CZLDE2OZ.cjs +28 -0
- package/dist/chunk-CZLDE2OZ.cjs.map +1 -0
- package/dist/chunk-DSMB6AF6.cjs +193 -0
- package/dist/chunk-DSMB6AF6.cjs.map +1 -0
- package/dist/chunk-ETWGPOPY.js +426 -0
- package/dist/chunk-ETWGPOPY.js.map +1 -0
- package/dist/chunk-FQBPVN63.cjs +403 -0
- package/dist/chunk-FQBPVN63.cjs.map +1 -0
- package/dist/chunk-G4GYQGTW.cjs +178 -0
- package/dist/chunk-G4GYQGTW.cjs.map +1 -0
- package/dist/chunk-GFDMZDMI.js +486 -0
- package/dist/chunk-GFDMZDMI.js.map +1 -0
- package/dist/chunk-HOTOYIPB.js +171 -0
- package/dist/chunk-HOTOYIPB.js.map +1 -0
- package/dist/chunk-HYADH4ZX.js +176 -0
- package/dist/chunk-HYADH4ZX.js.map +1 -0
- package/dist/chunk-JBN7C5WE.js +255 -0
- package/dist/chunk-JBN7C5WE.js.map +1 -0
- package/dist/chunk-JNCTPFTD.cjs +25 -0
- package/dist/chunk-JNCTPFTD.cjs.map +1 -0
- package/dist/chunk-N3BH3BV7.js +21 -0
- package/dist/chunk-N3BH3BV7.js.map +1 -0
- package/dist/chunk-NFPGAVRQ.js +749 -0
- package/dist/chunk-NFPGAVRQ.js.map +1 -0
- package/dist/chunk-OFFRGRBN.cjs +1332 -0
- package/dist/chunk-OFFRGRBN.cjs.map +1 -0
- package/dist/chunk-OZLKYIZL.cjs +490 -0
- package/dist/chunk-OZLKYIZL.cjs.map +1 -0
- package/dist/chunk-P3NUK46X.js +145 -0
- package/dist/chunk-P3NUK46X.js.map +1 -0
- package/dist/chunk-P7P2B7ZI.cjs +429 -0
- package/dist/chunk-P7P2B7ZI.cjs.map +1 -0
- package/dist/chunk-PB6SKSJN.cjs +150 -0
- package/dist/chunk-PB6SKSJN.cjs.map +1 -0
- package/dist/chunk-R3IXCJR7.js +378 -0
- package/dist/chunk-R3IXCJR7.js.map +1 -0
- package/dist/chunk-SD6P3WEJ.js +324 -0
- package/dist/chunk-SD6P3WEJ.js.map +1 -0
- package/dist/chunk-YSCHP26P.js +451 -0
- package/dist/chunk-YSCHP26P.js.map +1 -0
- package/dist/chunk-ZLMPRPCY.cjs +274 -0
- package/dist/chunk-ZLMPRPCY.cjs.map +1 -0
- package/dist/common-CBDYNJeh.d.cts +48 -0
- package/dist/common-CBDYNJeh.d.ts +48 -0
- package/dist/constants.cjs +42 -0
- package/dist/constants.cjs.map +1 -0
- package/dist/constants.d.cts +60 -0
- package/dist/constants.d.ts +60 -0
- package/dist/constants.js +5 -0
- package/dist/constants.js.map +1 -0
- package/dist/country/index.cjs +154 -0
- package/dist/country/index.cjs.map +1 -0
- package/dist/country/index.d.cts +1 -0
- package/dist/country/index.d.ts +1 -0
- package/dist/country/index.js +5 -0
- package/dist/country/index.js.map +1 -0
- package/dist/date/index.cjs +117 -0
- package/dist/date/index.cjs.map +1 -0
- package/dist/date/index.d.cts +283 -0
- package/dist/date/index.d.ts +283 -0
- package/dist/date/index.js +4 -0
- package/dist/date/index.js.map +1 -0
- package/dist/environment/index.cjs +73 -0
- package/dist/environment/index.cjs.map +1 -0
- package/dist/environment/index.d.cts +127 -0
- package/dist/environment/index.d.ts +127 -0
- package/dist/environment/index.js +4 -0
- package/dist/environment/index.js.map +1 -0
- package/dist/form/index.cjs +81 -0
- package/dist/form/index.cjs.map +1 -0
- package/dist/form/index.d.cts +227 -0
- package/dist/form/index.d.ts +227 -0
- package/dist/form/index.js +4 -0
- package/dist/form/index.js.map +1 -0
- package/dist/i18n.cjs +37 -0
- package/dist/i18n.cjs.map +1 -0
- package/dist/i18n.d.cts +102 -0
- package/dist/i18n.d.ts +102 -0
- package/dist/i18n.js +4 -0
- package/dist/i18n.js.map +1 -0
- package/dist/index-BXBmBHyL.d.ts +718 -0
- package/dist/index-BYsUCP3u.d.cts +718 -0
- package/dist/index-Cl26FrAZ.d.cts +362 -0
- package/dist/index-Cl26FrAZ.d.ts +362 -0
- package/dist/index.cjs +1265 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +205 -0
- package/dist/index.d.ts +205 -0
- package/dist/index.js +277 -0
- package/dist/index.js.map +1 -0
- package/dist/schema.cjs +13 -0
- package/dist/schema.cjs.map +1 -0
- package/dist/schema.d.cts +84 -0
- package/dist/schema.d.ts +84 -0
- package/dist/schema.js +4 -0
- package/dist/schema.js.map +1 -0
- package/dist/security/index.cjs +94 -0
- package/dist/security/index.cjs.map +1 -0
- package/dist/security/index.d.cts +216 -0
- package/dist/security/index.d.ts +216 -0
- package/dist/security/index.js +5 -0
- package/dist/security/index.js.map +1 -0
- package/dist/string/index.cjs +153 -0
- package/dist/string/index.cjs.map +1 -0
- package/dist/string/index.d.cts +471 -0
- package/dist/string/index.d.ts +471 -0
- package/dist/string/index.js +4 -0
- package/dist/string/index.js.map +1 -0
- package/dist/transform/index.cjs +105 -0
- package/dist/transform/index.cjs.map +1 -0
- package/dist/transform/index.d.cts +271 -0
- package/dist/transform/index.d.ts +271 -0
- package/dist/transform/index.js +4 -0
- package/dist/transform/index.js.map +1 -0
- package/dist/validators/index.cjs +195 -0
- package/dist/validators/index.cjs.map +1 -0
- package/dist/validators/index.d.cts +2 -0
- package/dist/validators/index.d.ts +2 -0
- package/dist/validators/index.js +6 -0
- package/dist/validators/index.js.map +1 -0
- package/package.json +229 -0
|
@@ -0,0 +1,783 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkOZLKYIZL_cjs = require('./chunk-OZLKYIZL.cjs');
|
|
4
|
+
|
|
5
|
+
// src/country/data/countries.ts
|
|
6
|
+
var COUNTRIES = [
|
|
7
|
+
// North America (3)
|
|
8
|
+
{ name: "United States", officialName: "United States of America", alpha2: "US", alpha3: "USA", numeric: "840", continent: "North America", capital: "Washington, D.C.", languages: ["en"], currency: "USD", dialCode: "+1", flag: "🇺🇸" },
|
|
9
|
+
{ name: "Canada", alpha2: "CA", alpha3: "CAN", numeric: "124", continent: "North America", capital: "Ottawa", languages: ["en", "fr"], currency: "CAD", dialCode: "+1", flag: "🇨🇦" },
|
|
10
|
+
{ name: "Mexico", officialName: "United Mexican States", alpha2: "MX", alpha3: "MEX", numeric: "484", continent: "North America", capital: "Mexico City", languages: ["es"], currency: "MXN", dialCode: "+52", flag: "🇲🇽" },
|
|
11
|
+
// Central America (7)
|
|
12
|
+
{ name: "Guatemala", alpha2: "GT", alpha3: "GTM", numeric: "320", continent: "North America", capital: "Guatemala City", languages: ["es"], currency: "GTQ", dialCode: "+502", flag: "🇬🇹" },
|
|
13
|
+
{ name: "Honduras", alpha2: "HN", alpha3: "HND", numeric: "340", continent: "North America", capital: "Tegucigalpa", languages: ["es"], currency: "HNL", dialCode: "+504", flag: "🇭🇳" },
|
|
14
|
+
{ name: "El Salvador", alpha2: "SV", alpha3: "SLV", numeric: "222", continent: "North America", capital: "San Salvador", languages: ["es"], currency: "USD", dialCode: "+503", flag: "🇸🇻" },
|
|
15
|
+
{ name: "Nicaragua", alpha2: "NI", alpha3: "NIC", numeric: "558", continent: "North America", capital: "Managua", languages: ["es"], currency: "NIO", dialCode: "+505", flag: "🇳🇮" },
|
|
16
|
+
{ name: "Costa Rica", alpha2: "CR", alpha3: "CRI", numeric: "188", continent: "North America", capital: "San José", languages: ["es"], currency: "CRC", dialCode: "+506", flag: "🇨🇷" },
|
|
17
|
+
{ name: "Panama", alpha2: "PA", alpha3: "PAN", numeric: "591", continent: "North America", capital: "Panama City", languages: ["es"], currency: "PAB", dialCode: "+507", flag: "🇵🇦" },
|
|
18
|
+
{ name: "Belize", alpha2: "BZ", alpha3: "BLZ", numeric: "084", continent: "North America", capital: "Belmopan", languages: ["en"], currency: "BZD", dialCode: "+501", flag: "🇧🇿" },
|
|
19
|
+
// Caribbean (15)
|
|
20
|
+
{ name: "Jamaica", alpha2: "JM", alpha3: "JAM", numeric: "388", continent: "North America", capital: "Kingston", languages: ["en"], currency: "JMD", dialCode: "+1", flag: "🇯🇲" },
|
|
21
|
+
{ name: "Cuba", alpha2: "CU", alpha3: "CUB", numeric: "192", continent: "North America", capital: "Havana", languages: ["es"], currency: "CUP", dialCode: "+53", flag: "🇨🇺" },
|
|
22
|
+
{ name: "Haiti", alpha2: "HT", alpha3: "HTI", numeric: "332", continent: "North America", capital: "Port-au-Prince", languages: ["fr", "ht"], currency: "HTG", dialCode: "+509", flag: "🇭🇹" },
|
|
23
|
+
{ name: "Dominican Republic", alpha2: "DO", alpha3: "DOM", numeric: "214", continent: "North America", capital: "Santo Domingo", languages: ["es"], currency: "DOP", dialCode: "+1", flag: "🇩🇴" },
|
|
24
|
+
{ name: "Puerto Rico", alpha2: "PR", alpha3: "PRI", numeric: "630", continent: "North America", capital: "San Juan", languages: ["es", "en"], currency: "USD", dialCode: "+1", flag: "🇵🇷" },
|
|
25
|
+
{ name: "Trinidad and Tobago", alpha2: "TT", alpha3: "TTO", numeric: "780", continent: "North America", capital: "Port of Spain", languages: ["en"], currency: "TTD", dialCode: "+1", flag: "🇹🇹" },
|
|
26
|
+
{ name: "Bahamas", alpha2: "BS", alpha3: "BHS", numeric: "044", continent: "North America", capital: "Nassau", languages: ["en"], currency: "BSD", dialCode: "+1", flag: "🇧🇸" },
|
|
27
|
+
{ name: "Barbados", alpha2: "BB", alpha3: "BRB", numeric: "052", continent: "North America", capital: "Bridgetown", languages: ["en"], currency: "BBD", dialCode: "+1", flag: "🇧🇧" },
|
|
28
|
+
// Europe (35)
|
|
29
|
+
{ name: "United Kingdom", officialName: "United Kingdom of Great Britain and Northern Ireland", alpha2: "GB", alpha3: "GBR", numeric: "826", continent: "Europe", capital: "London", languages: ["en"], currency: "GBP", dialCode: "+44", flag: "🇬🇧" },
|
|
30
|
+
{ name: "Germany", officialName: "Federal Republic of Germany", alpha2: "DE", alpha3: "DEU", numeric: "276", continent: "Europe", capital: "Berlin", languages: ["de"], currency: "EUR", dialCode: "+49", flag: "🇩🇪" },
|
|
31
|
+
{ name: "France", officialName: "French Republic", alpha2: "FR", alpha3: "FRA", numeric: "250", continent: "Europe", capital: "Paris", languages: ["fr"], currency: "EUR", dialCode: "+33", flag: "🇫🇷" },
|
|
32
|
+
{ name: "Italy", officialName: "Italian Republic", alpha2: "IT", alpha3: "ITA", numeric: "380", continent: "Europe", capital: "Rome", languages: ["it"], currency: "EUR", dialCode: "+39", flag: "🇮🇹" },
|
|
33
|
+
{ name: "Spain", officialName: "Kingdom of Spain", alpha2: "ES", alpha3: "ESP", numeric: "724", continent: "Europe", capital: "Madrid", languages: ["es"], currency: "EUR", dialCode: "+34", flag: "🇪🇸" },
|
|
34
|
+
{ name: "Netherlands", officialName: "Kingdom of the Netherlands", alpha2: "NL", alpha3: "NLD", numeric: "528", continent: "Europe", capital: "Amsterdam", languages: ["nl"], currency: "EUR", dialCode: "+31", flag: "🇳🇱" },
|
|
35
|
+
{ name: "Belgium", officialName: "Kingdom of Belgium", alpha2: "BE", alpha3: "BEL", numeric: "056", continent: "Europe", capital: "Brussels", languages: ["nl", "fr", "de"], currency: "EUR", dialCode: "+32", flag: "🇧🇪" },
|
|
36
|
+
{ name: "Switzerland", officialName: "Swiss Confederation", alpha2: "CH", alpha3: "CHE", numeric: "756", continent: "Europe", capital: "Bern", languages: ["de", "fr", "it", "rm"], currency: "CHF", dialCode: "+41", flag: "🇨🇭" },
|
|
37
|
+
{ name: "Austria", officialName: "Republic of Austria", alpha2: "AT", alpha3: "AUT", numeric: "040", continent: "Europe", capital: "Vienna", languages: ["de"], currency: "EUR", dialCode: "+43", flag: "🇦🇹" },
|
|
38
|
+
{ name: "Sweden", officialName: "Kingdom of Sweden", alpha2: "SE", alpha3: "SWE", numeric: "752", continent: "Europe", capital: "Stockholm", languages: ["sv"], currency: "SEK", dialCode: "+46", flag: "🇸🇪" },
|
|
39
|
+
{ name: "Norway", officialName: "Kingdom of Norway", alpha2: "NO", alpha3: "NOR", numeric: "578", continent: "Europe", capital: "Oslo", languages: ["no"], currency: "NOK", dialCode: "+47", flag: "🇳🇴" },
|
|
40
|
+
{ name: "Denmark", officialName: "Kingdom of Denmark", alpha2: "DK", alpha3: "DNK", numeric: "208", continent: "Europe", capital: "Copenhagen", languages: ["da"], currency: "DKK", dialCode: "+45", flag: "🇩🇰" },
|
|
41
|
+
{ name: "Finland", officialName: "Republic of Finland", alpha2: "FI", alpha3: "FIN", numeric: "246", continent: "Europe", capital: "Helsinki", languages: ["fi", "sv"], currency: "EUR", dialCode: "+358", flag: "🇫🇮" },
|
|
42
|
+
{ name: "Poland", officialName: "Republic of Poland", alpha2: "PL", alpha3: "POL", numeric: "616", continent: "Europe", capital: "Warsaw", languages: ["pl"], currency: "PLN", dialCode: "+48", flag: "🇵🇱" },
|
|
43
|
+
{ name: "Portugal", officialName: "Portuguese Republic", alpha2: "PT", alpha3: "PRT", numeric: "620", continent: "Europe", capital: "Lisbon", languages: ["pt"], currency: "EUR", dialCode: "+351", flag: "🇵🇹" },
|
|
44
|
+
{ name: "Ireland", alpha2: "IE", alpha3: "IRL", numeric: "372", continent: "Europe", capital: "Dublin", languages: ["en", "ga"], currency: "EUR", dialCode: "+353", flag: "🇮🇪" },
|
|
45
|
+
{ name: "Greece", officialName: "Hellenic Republic", alpha2: "GR", alpha3: "GRC", numeric: "300", continent: "Europe", capital: "Athens", languages: ["el"], currency: "EUR", dialCode: "+30", flag: "🇬🇷" },
|
|
46
|
+
{ name: "Czech Republic", alpha2: "CZ", alpha3: "CZE", numeric: "203", continent: "Europe", capital: "Prague", languages: ["cs"], currency: "CZK", dialCode: "+420", flag: "🇨🇿" },
|
|
47
|
+
{ name: "Hungary", alpha2: "HU", alpha3: "HUN", numeric: "348", continent: "Europe", capital: "Budapest", languages: ["hu"], currency: "HUF", dialCode: "+36", flag: "🇭🇺" },
|
|
48
|
+
{ name: "Romania", alpha2: "RO", alpha3: "ROU", numeric: "642", continent: "Europe", capital: "Bucharest", languages: ["ro"], currency: "RON", dialCode: "+40", flag: "🇷🇴" },
|
|
49
|
+
{ name: "Bulgaria", alpha2: "BG", alpha3: "BGR", numeric: "100", continent: "Europe", capital: "Sofia", languages: ["bg"], currency: "BGN", dialCode: "+359", flag: "🇧🇬" },
|
|
50
|
+
{ name: "Croatia", alpha2: "HR", alpha3: "HRV", numeric: "191", continent: "Europe", capital: "Zagreb", languages: ["hr"], currency: "EUR", dialCode: "+385", flag: "🇭🇷" },
|
|
51
|
+
{ name: "Slovakia", alpha2: "SK", alpha3: "SVK", numeric: "703", continent: "Europe", capital: "Bratislava", languages: ["sk"], currency: "EUR", dialCode: "+421", flag: "🇸🇰" },
|
|
52
|
+
{ name: "Slovenia", alpha2: "SI", alpha3: "SVN", numeric: "705", continent: "Europe", capital: "Ljubljana", languages: ["sl"], currency: "EUR", dialCode: "+386", flag: "🇸🇮" },
|
|
53
|
+
{ name: "Serbia", alpha2: "RS", alpha3: "SRB", numeric: "688", continent: "Europe", capital: "Belgrade", languages: ["sr"], currency: "RSD", dialCode: "+381", flag: "🇷🇸" },
|
|
54
|
+
{ name: "Lithuania", alpha2: "LT", alpha3: "LTU", numeric: "440", continent: "Europe", capital: "Vilnius", languages: ["lt"], currency: "EUR", dialCode: "+370", flag: "🇱🇹" },
|
|
55
|
+
{ name: "Latvia", alpha2: "LV", alpha3: "LVA", numeric: "428", continent: "Europe", capital: "Riga", languages: ["lv"], currency: "EUR", dialCode: "+371", flag: "🇱🇻" },
|
|
56
|
+
{ name: "Estonia", alpha2: "EE", alpha3: "EST", numeric: "233", continent: "Europe", capital: "Tallinn", languages: ["et"], currency: "EUR", dialCode: "+372", flag: "🇪🇪" },
|
|
57
|
+
{ name: "Luxembourg", alpha2: "LU", alpha3: "LUX", numeric: "442", continent: "Europe", capital: "Luxembourg", languages: ["lb", "fr", "de"], currency: "EUR", dialCode: "+352", flag: "🇱🇺" },
|
|
58
|
+
{ name: "Iceland", alpha2: "IS", alpha3: "ISL", numeric: "352", continent: "Europe", capital: "Reykjavik", languages: ["is"], currency: "ISK", dialCode: "+354", flag: "🇮🇸" },
|
|
59
|
+
{ name: "Cyprus", alpha2: "CY", alpha3: "CYP", numeric: "196", continent: "Europe", capital: "Nicosia", languages: ["el", "tr"], currency: "EUR", dialCode: "+357", flag: "🇨🇾" },
|
|
60
|
+
{ name: "Malta", alpha2: "MT", alpha3: "MLT", numeric: "470", continent: "Europe", capital: "Valletta", languages: ["mt", "en"], currency: "EUR", dialCode: "+356", flag: "🇲🇹" },
|
|
61
|
+
{ name: "Russia", officialName: "Russian Federation", alpha2: "RU", alpha3: "RUS", numeric: "643", continent: "Europe", capital: "Moscow", languages: ["ru"], currency: "RUB", dialCode: "+7", flag: "🇷🇺" },
|
|
62
|
+
{ name: "Ukraine", alpha2: "UA", alpha3: "UKR", numeric: "804", continent: "Europe", capital: "Kyiv", languages: ["uk"], currency: "UAH", dialCode: "+380", flag: "🇺🇦" },
|
|
63
|
+
{ name: "Belarus", alpha2: "BY", alpha3: "BLR", numeric: "112", continent: "Europe", capital: "Minsk", languages: ["be", "ru"], currency: "BYN", dialCode: "+375", flag: "🇧🇾" },
|
|
64
|
+
// Asia (35)
|
|
65
|
+
{ name: "China", officialName: "People's Republic of China", alpha2: "CN", alpha3: "CHN", numeric: "156", continent: "Asia", capital: "Beijing", languages: ["zh"], currency: "CNY", dialCode: "+86", flag: "🇨🇳" },
|
|
66
|
+
{ name: "Japan", alpha2: "JP", alpha3: "JPN", numeric: "392", continent: "Asia", capital: "Tokyo", languages: ["ja"], currency: "JPY", dialCode: "+81", flag: "🇯🇵" },
|
|
67
|
+
{ name: "South Korea", officialName: "Republic of Korea", alpha2: "KR", alpha3: "KOR", numeric: "410", continent: "Asia", capital: "Seoul", languages: ["ko"], currency: "KRW", dialCode: "+82", flag: "🇰🇷" },
|
|
68
|
+
{ name: "India", officialName: "Republic of India", alpha2: "IN", alpha3: "IND", numeric: "356", continent: "Asia", capital: "New Delhi", languages: ["hi", "en"], currency: "INR", dialCode: "+91", flag: "🇮🇳" },
|
|
69
|
+
{ name: "Pakistan", officialName: "Islamic Republic of Pakistan", alpha2: "PK", alpha3: "PAK", numeric: "586", continent: "Asia", capital: "Islamabad", languages: ["ur", "en"], currency: "PKR", dialCode: "+92", flag: "🇵🇰" },
|
|
70
|
+
{ name: "Bangladesh", officialName: "People's Republic of Bangladesh", alpha2: "BD", alpha3: "BGD", numeric: "050", continent: "Asia", capital: "Dhaka", languages: ["bn"], currency: "BDT", dialCode: "+880", flag: "🇧🇩" },
|
|
71
|
+
{ name: "Indonesia", officialName: "Republic of Indonesia", alpha2: "ID", alpha3: "IDN", numeric: "360", continent: "Asia", capital: "Jakarta", languages: ["id"], currency: "IDR", dialCode: "+62", flag: "🇮🇩" },
|
|
72
|
+
{ name: "Thailand", officialName: "Kingdom of Thailand", alpha2: "TH", alpha3: "THA", numeric: "764", continent: "Asia", capital: "Bangkok", languages: ["th"], currency: "THB", dialCode: "+66", flag: "🇹🇭" },
|
|
73
|
+
{ name: "Vietnam", officialName: "Socialist Republic of Vietnam", alpha2: "VN", alpha3: "VNM", numeric: "704", continent: "Asia", capital: "Hanoi", languages: ["vi"], currency: "VND", dialCode: "+84", flag: "🇻🇳" },
|
|
74
|
+
{ name: "Philippines", officialName: "Republic of the Philippines", alpha2: "PH", alpha3: "PHL", numeric: "608", continent: "Asia", capital: "Manila", languages: ["tl", "en"], currency: "PHP", dialCode: "+63", flag: "🇵🇭" },
|
|
75
|
+
{ name: "Malaysia", alpha2: "MY", alpha3: "MYS", numeric: "458", continent: "Asia", capital: "Kuala Lumpur", languages: ["ms"], currency: "MYR", dialCode: "+60", flag: "🇲🇾" },
|
|
76
|
+
{ name: "Singapore", officialName: "Republic of Singapore", alpha2: "SG", alpha3: "SGP", numeric: "702", continent: "Asia", capital: "Singapore", languages: ["en", "zh", "ms", "ta"], currency: "SGD", dialCode: "+65", flag: "🇸🇬" },
|
|
77
|
+
{ name: "Myanmar", alpha2: "MM", alpha3: "MMR", numeric: "104", continent: "Asia", capital: "Naypyidaw", languages: ["my"], currency: "MMK", dialCode: "+95", flag: "🇲🇲" },
|
|
78
|
+
{ name: "Cambodia", alpha2: "KH", alpha3: "KHM", numeric: "116", continent: "Asia", capital: "Phnom Penh", languages: ["km"], currency: "KHR", dialCode: "+855", flag: "🇰🇭" },
|
|
79
|
+
{ name: "Laos", alpha2: "LA", alpha3: "LAO", numeric: "418", continent: "Asia", capital: "Vientiane", languages: ["lo"], currency: "LAK", dialCode: "+856", flag: "🇱🇦" },
|
|
80
|
+
{ name: "Nepal", alpha2: "NP", alpha3: "NPL", numeric: "524", continent: "Asia", capital: "Kathmandu", languages: ["ne"], currency: "NPR", dialCode: "+977", flag: "🇳🇵" },
|
|
81
|
+
{ name: "Sri Lanka", alpha2: "LK", alpha3: "LKA", numeric: "144", continent: "Asia", capital: "Colombo", languages: ["si", "ta"], currency: "LKR", dialCode: "+94", flag: "🇱🇰" },
|
|
82
|
+
{ name: "Mongolia", alpha2: "MN", alpha3: "MNG", numeric: "496", continent: "Asia", capital: "Ulaanbaatar", languages: ["mn"], currency: "MNT", dialCode: "+976", flag: "🇲🇳" },
|
|
83
|
+
{ name: "North Korea", alpha2: "KP", alpha3: "PRK", numeric: "408", continent: "Asia", capital: "Pyongyang", languages: ["ko"], currency: "KPW", dialCode: "+850", flag: "🇰🇵" },
|
|
84
|
+
{ name: "Taiwan", alpha2: "TW", alpha3: "TWN", numeric: "158", continent: "Asia", capital: "Taipei", languages: ["zh"], currency: "TWD", dialCode: "+886", flag: "🇹🇼" },
|
|
85
|
+
{ name: "Hong Kong", alpha2: "HK", alpha3: "HKG", numeric: "344", continent: "Asia", capital: "Hong Kong", languages: ["zh", "en"], currency: "HKD", dialCode: "+852", flag: "🇭🇰" },
|
|
86
|
+
// Central Asia (5)
|
|
87
|
+
{ name: "Kazakhstan", alpha2: "KZ", alpha3: "KAZ", numeric: "398", continent: "Asia", capital: "Astana", languages: ["kk", "ru"], currency: "KZT", dialCode: "+7", flag: "🇰🇿" },
|
|
88
|
+
{ name: "Uzbekistan", alpha2: "UZ", alpha3: "UZB", numeric: "860", continent: "Asia", capital: "Tashkent", languages: ["uz"], currency: "UZS", dialCode: "+998", flag: "🇺🇿" },
|
|
89
|
+
{ name: "Turkmenistan", alpha2: "TM", alpha3: "TKM", numeric: "795", continent: "Asia", capital: "Ashgabat", languages: ["tk"], currency: "TMT", dialCode: "+993", flag: "🇹🇲" },
|
|
90
|
+
{ name: "Kyrgyzstan", alpha2: "KG", alpha3: "KGZ", numeric: "417", continent: "Asia", capital: "Bishkek", languages: ["ky", "ru"], currency: "KGS", dialCode: "+996", flag: "🇰🇬" },
|
|
91
|
+
{ name: "Tajikistan", alpha2: "TJ", alpha3: "TJK", numeric: "762", continent: "Asia", capital: "Dushanbe", languages: ["tg"], currency: "TJS", dialCode: "+992", flag: "🇹🇯" },
|
|
92
|
+
// Middle East (15)
|
|
93
|
+
{ name: "United Arab Emirates", alpha2: "AE", alpha3: "ARE", numeric: "784", continent: "Asia", capital: "Abu Dhabi", languages: ["ar"], currency: "AED", dialCode: "+971", flag: "🇦🇪" },
|
|
94
|
+
{ name: "Saudi Arabia", officialName: "Kingdom of Saudi Arabia", alpha2: "SA", alpha3: "SAU", numeric: "682", continent: "Asia", capital: "Riyadh", languages: ["ar"], currency: "SAR", dialCode: "+966", flag: "🇸🇦" },
|
|
95
|
+
{ name: "Turkey", officialName: "Republic of Turkey", alpha2: "TR", alpha3: "TUR", numeric: "792", continent: "Asia", capital: "Ankara", languages: ["tr"], currency: "TRY", dialCode: "+90", flag: "🇹🇷" },
|
|
96
|
+
{ name: "Iran", officialName: "Islamic Republic of Iran", alpha2: "IR", alpha3: "IRN", numeric: "364", continent: "Asia", capital: "Tehran", languages: ["fa"], currency: "IRR", dialCode: "+98", flag: "🇮🇷" },
|
|
97
|
+
{ name: "Israel", officialName: "State of Israel", alpha2: "IL", alpha3: "ISR", numeric: "376", continent: "Asia", capital: "Jerusalem", languages: ["he", "ar"], currency: "ILS", dialCode: "+972", flag: "🇮🇱" },
|
|
98
|
+
{ name: "Qatar", officialName: "State of Qatar", alpha2: "QA", alpha3: "QAT", numeric: "634", continent: "Asia", capital: "Doha", languages: ["ar"], currency: "QAR", dialCode: "+974", flag: "🇶🇦" },
|
|
99
|
+
{ name: "Kuwait", officialName: "State of Kuwait", alpha2: "KW", alpha3: "KWT", numeric: "414", continent: "Asia", capital: "Kuwait City", languages: ["ar"], currency: "KWD", dialCode: "+965", flag: "🇰🇼" },
|
|
100
|
+
{ name: "Bahrain", alpha2: "BH", alpha3: "BHR", numeric: "048", continent: "Asia", capital: "Manama", languages: ["ar"], currency: "BHD", dialCode: "+973", flag: "🇧🇭" },
|
|
101
|
+
{ name: "Oman", alpha2: "OM", alpha3: "OMN", numeric: "512", continent: "Asia", capital: "Muscat", languages: ["ar"], currency: "OMR", dialCode: "+968", flag: "🇴🇲" },
|
|
102
|
+
{ name: "Jordan", alpha2: "JO", alpha3: "JOR", numeric: "400", continent: "Asia", capital: "Amman", languages: ["ar"], currency: "JOD", dialCode: "+962", flag: "🇯🇴" },
|
|
103
|
+
{ name: "Lebanon", alpha2: "LB", alpha3: "LBN", numeric: "422", continent: "Asia", capital: "Beirut", languages: ["ar"], currency: "LBP", dialCode: "+961", flag: "🇱🇧" },
|
|
104
|
+
{ name: "Iraq", alpha2: "IQ", alpha3: "IRQ", numeric: "368", continent: "Asia", capital: "Baghdad", languages: ["ar", "ku"], currency: "IQD", dialCode: "+964", flag: "🇮🇶" },
|
|
105
|
+
{ name: "Syria", alpha2: "SY", alpha3: "SYR", numeric: "760", continent: "Asia", capital: "Damascus", languages: ["ar"], currency: "SYP", dialCode: "+963", flag: "🇸🇾" },
|
|
106
|
+
{ name: "Yemen", alpha2: "YE", alpha3: "YEM", numeric: "887", continent: "Asia", capital: "Sana'a", languages: ["ar"], currency: "YER", dialCode: "+967", flag: "🇾🇪" },
|
|
107
|
+
{ name: "Afghanistan", alpha2: "AF", alpha3: "AFG", numeric: "004", continent: "Asia", capital: "Kabul", languages: ["ps", "fa"], currency: "AFN", dialCode: "+93", flag: "🇦🇫" },
|
|
108
|
+
// Africa (35)
|
|
109
|
+
{ name: "Egypt", officialName: "Arab Republic of Egypt", alpha2: "EG", alpha3: "EGY", numeric: "818", continent: "Africa", capital: "Cairo", languages: ["ar"], currency: "EGP", dialCode: "+20", flag: "🇪🇬" },
|
|
110
|
+
{ name: "Nigeria", officialName: "Federal Republic of Nigeria", alpha2: "NG", alpha3: "NGA", numeric: "566", continent: "Africa", capital: "Abuja", languages: ["en"], currency: "NGN", dialCode: "+234", flag: "🇳🇬" },
|
|
111
|
+
{ name: "South Africa", officialName: "Republic of South Africa", alpha2: "ZA", alpha3: "ZAF", numeric: "710", continent: "Africa", capital: "Pretoria", languages: ["af", "en", "zu", "xh"], currency: "ZAR", dialCode: "+27", flag: "🇿🇦" },
|
|
112
|
+
{ name: "Kenya", officialName: "Republic of Kenya", alpha2: "KE", alpha3: "KEN", numeric: "404", continent: "Africa", capital: "Nairobi", languages: ["en", "sw"], currency: "KES", dialCode: "+254", flag: "🇰🇪" },
|
|
113
|
+
{ name: "Morocco", officialName: "Kingdom of Morocco", alpha2: "MA", alpha3: "MAR", numeric: "504", continent: "Africa", capital: "Rabat", languages: ["ar", "fr"], currency: "MAD", dialCode: "+212", flag: "🇲🇦" },
|
|
114
|
+
{ name: "Algeria", officialName: "People's Democratic Republic of Algeria", alpha2: "DZ", alpha3: "DZA", numeric: "012", continent: "Africa", capital: "Algiers", languages: ["ar", "fr"], currency: "DZD", dialCode: "+213", flag: "🇩🇿" },
|
|
115
|
+
{ name: "Tunisia", alpha2: "TN", alpha3: "TUN", numeric: "788", continent: "Africa", capital: "Tunis", languages: ["ar", "fr"], currency: "TND", dialCode: "+216", flag: "🇹🇳" },
|
|
116
|
+
{ name: "Libya", alpha2: "LY", alpha3: "LBY", numeric: "434", continent: "Africa", capital: "Tripoli", languages: ["ar"], currency: "LYD", dialCode: "+218", flag: "🇱🇾" },
|
|
117
|
+
{ name: "Ghana", alpha2: "GH", alpha3: "GHA", numeric: "288", continent: "Africa", capital: "Accra", languages: ["en"], currency: "GHS", dialCode: "+233", flag: "🇬🇭" },
|
|
118
|
+
{ name: "Tanzania", alpha2: "TZ", alpha3: "TZA", numeric: "834", continent: "Africa", capital: "Dodoma", languages: ["sw", "en"], currency: "TZS", dialCode: "+255", flag: "🇹🇿" },
|
|
119
|
+
{ name: "Ethiopia", alpha2: "ET", alpha3: "ETH", numeric: "231", continent: "Africa", capital: "Addis Ababa", languages: ["am"], currency: "ETB", dialCode: "+251", flag: "🇪🇹" },
|
|
120
|
+
{ name: "Uganda", alpha2: "UG", alpha3: "UGA", numeric: "800", continent: "Africa", capital: "Kampala", languages: ["en", "sw"], currency: "UGX", dialCode: "+256", flag: "🇺🇬" },
|
|
121
|
+
{ name: "Rwanda", alpha2: "RW", alpha3: "RWA", numeric: "646", continent: "Africa", capital: "Kigali", languages: ["rw", "en", "fr"], currency: "RWF", dialCode: "+250", flag: "🇷🇼" },
|
|
122
|
+
{ name: "Senegal", alpha2: "SN", alpha3: "SEN", numeric: "686", continent: "Africa", capital: "Dakar", languages: ["fr"], currency: "XOF", dialCode: "+221", flag: "🇸🇳" },
|
|
123
|
+
{ name: "Ivory Coast", alpha2: "CI", alpha3: "CIV", numeric: "384", continent: "Africa", capital: "Yamoussoukro", languages: ["fr"], currency: "XOF", dialCode: "+225", flag: "🇨🇮" },
|
|
124
|
+
{ name: "Cameroon", alpha2: "CM", alpha3: "CMR", numeric: "120", continent: "Africa", capital: "Yaoundé", languages: ["fr", "en"], currency: "XAF", dialCode: "+237", flag: "🇨🇲" },
|
|
125
|
+
{ name: "Angola", alpha2: "AO", alpha3: "AGO", numeric: "024", continent: "Africa", capital: "Luanda", languages: ["pt"], currency: "AOA", dialCode: "+244", flag: "🇦🇴" },
|
|
126
|
+
{ name: "Mozambique", alpha2: "MZ", alpha3: "MOZ", numeric: "508", continent: "Africa", capital: "Maputo", languages: ["pt"], currency: "MZN", dialCode: "+258", flag: "🇲🇿" },
|
|
127
|
+
{ name: "Zimbabwe", alpha2: "ZW", alpha3: "ZWE", numeric: "716", continent: "Africa", capital: "Harare", languages: ["en", "sn", "nd"], currency: "ZWL", dialCode: "+263", flag: "🇿🇼" },
|
|
128
|
+
{ name: "Zambia", alpha2: "ZM", alpha3: "ZMB", numeric: "894", continent: "Africa", capital: "Lusaka", languages: ["en"], currency: "ZMW", dialCode: "+260", flag: "🇿🇲" },
|
|
129
|
+
{ name: "Botswana", alpha2: "BW", alpha3: "BWA", numeric: "072", continent: "Africa", capital: "Gaborone", languages: ["en", "tn"], currency: "BWP", dialCode: "+267", flag: "🇧🇼" },
|
|
130
|
+
{ name: "Namibia", alpha2: "NA", alpha3: "NAM", numeric: "516", continent: "Africa", capital: "Windhoek", languages: ["en"], currency: "NAD", dialCode: "+264", flag: "🇳🇦" },
|
|
131
|
+
{ name: "Mauritius", alpha2: "MU", alpha3: "MUS", numeric: "480", continent: "Africa", capital: "Port Louis", languages: ["en", "fr"], currency: "MUR", dialCode: "+230", flag: "🇲🇺" },
|
|
132
|
+
{ name: "Madagascar", alpha2: "MG", alpha3: "MDG", numeric: "450", continent: "Africa", capital: "Antananarivo", languages: ["mg", "fr"], currency: "MGA", dialCode: "+261", flag: "🇲🇬" },
|
|
133
|
+
{ name: "Sudan", alpha2: "SD", alpha3: "SDN", numeric: "729", continent: "Africa", capital: "Khartoum", languages: ["ar", "en"], currency: "SDG", dialCode: "+249", flag: "🇸🇩" },
|
|
134
|
+
// South America (12)
|
|
135
|
+
{ name: "Brazil", officialName: "Federative Republic of Brazil", alpha2: "BR", alpha3: "BRA", numeric: "076", continent: "South America", capital: "Brasília", languages: ["pt"], currency: "BRL", dialCode: "+55", flag: "🇧🇷" },
|
|
136
|
+
{ name: "Argentina", officialName: "Argentine Republic", alpha2: "AR", alpha3: "ARG", numeric: "032", continent: "South America", capital: "Buenos Aires", languages: ["es"], currency: "ARS", dialCode: "+54", flag: "🇦🇷" },
|
|
137
|
+
{ name: "Colombia", officialName: "Republic of Colombia", alpha2: "CO", alpha3: "COL", numeric: "170", continent: "South America", capital: "Bogotá", languages: ["es"], currency: "COP", dialCode: "+57", flag: "🇨🇴" },
|
|
138
|
+
{ name: "Chile", officialName: "Republic of Chile", alpha2: "CL", alpha3: "CHL", numeric: "152", continent: "South America", capital: "Santiago", languages: ["es"], currency: "CLP", dialCode: "+56", flag: "🇨🇱" },
|
|
139
|
+
{ name: "Peru", officialName: "Republic of Peru", alpha2: "PE", alpha3: "PER", numeric: "604", continent: "South America", capital: "Lima", languages: ["es"], currency: "PEN", dialCode: "+51", flag: "🇵🇪" },
|
|
140
|
+
{ name: "Venezuela", alpha2: "VE", alpha3: "VEN", numeric: "862", continent: "South America", capital: "Caracas", languages: ["es"], currency: "VES", dialCode: "+58", flag: "🇻🇪" },
|
|
141
|
+
{ name: "Ecuador", alpha2: "EC", alpha3: "ECU", numeric: "218", continent: "South America", capital: "Quito", languages: ["es"], currency: "USD", dialCode: "+593", flag: "🇪🇨" },
|
|
142
|
+
{ name: "Bolivia", alpha2: "BO", alpha3: "BOL", numeric: "068", continent: "South America", capital: "Sucre", languages: ["es"], currency: "BOB", dialCode: "+591", flag: "🇧🇴" },
|
|
143
|
+
{ name: "Paraguay", alpha2: "PY", alpha3: "PRY", numeric: "600", continent: "South America", capital: "Asunción", languages: ["es", "gn"], currency: "PYG", dialCode: "+595", flag: "🇵🇾" },
|
|
144
|
+
{ name: "Uruguay", alpha2: "UY", alpha3: "URY", numeric: "858", continent: "South America", capital: "Montevideo", languages: ["es"], currency: "UYU", dialCode: "+598", flag: "🇺🇾" },
|
|
145
|
+
{ name: "Guyana", alpha2: "GY", alpha3: "GUY", numeric: "328", continent: "South America", capital: "Georgetown", languages: ["en"], currency: "GYD", dialCode: "+592", flag: "🇬🇾" },
|
|
146
|
+
{ name: "Suriname", alpha2: "SR", alpha3: "SUR", numeric: "740", continent: "South America", capital: "Paramaribo", languages: ["nl"], currency: "SRD", dialCode: "+597", flag: "🇸🇷" },
|
|
147
|
+
// Oceania (8)
|
|
148
|
+
{ name: "Australia", officialName: "Commonwealth of Australia", alpha2: "AU", alpha3: "AUS", numeric: "036", continent: "Oceania", capital: "Canberra", languages: ["en"], currency: "AUD", dialCode: "+61", flag: "🇦🇺" },
|
|
149
|
+
{ name: "New Zealand", alpha2: "NZ", alpha3: "NZL", numeric: "554", continent: "Oceania", capital: "Wellington", languages: ["en", "mi"], currency: "NZD", dialCode: "+64", flag: "🇳🇿" },
|
|
150
|
+
{ name: "Papua New Guinea", alpha2: "PG", alpha3: "PNG", numeric: "598", continent: "Oceania", capital: "Port Moresby", languages: ["en", "tpi", "ho"], currency: "PGK", dialCode: "+675", flag: "🇵🇬" },
|
|
151
|
+
{ name: "Fiji", alpha2: "FJ", alpha3: "FJI", numeric: "242", continent: "Oceania", capital: "Suva", languages: ["en", "fj", "hi"], currency: "FJD", dialCode: "+679", flag: "🇫🇯" },
|
|
152
|
+
{ name: "Samoa", alpha2: "WS", alpha3: "WSM", numeric: "882", continent: "Oceania", capital: "Apia", languages: ["sm", "en"], currency: "WST", dialCode: "+685", flag: "🇼🇸" },
|
|
153
|
+
{ name: "Tonga", alpha2: "TO", alpha3: "TON", numeric: "776", continent: "Oceania", capital: "Nuku'alofa", languages: ["to", "en"], currency: "TOP", dialCode: "+676", flag: "🇹🇴" },
|
|
154
|
+
{ name: "Vanuatu", alpha2: "VU", alpha3: "VUT", numeric: "548", continent: "Oceania", capital: "Port Vila", languages: ["bi", "en", "fr"], currency: "VUV", dialCode: "+678", flag: "🇻🇺" },
|
|
155
|
+
{ name: "Solomon Islands", alpha2: "SB", alpha3: "SLB", numeric: "090", continent: "Oceania", capital: "Honiara", languages: ["en"], currency: "SBD", dialCode: "+677", flag: "🇸🇧" }
|
|
156
|
+
];
|
|
157
|
+
var COUNTRY_BY_ALPHA2 = new Map(
|
|
158
|
+
COUNTRIES.map((c) => [c.alpha2.toUpperCase(), c])
|
|
159
|
+
);
|
|
160
|
+
var COUNTRY_BY_ALPHA3 = new Map(
|
|
161
|
+
COUNTRIES.map((c) => [c.alpha3.toUpperCase(), c])
|
|
162
|
+
);
|
|
163
|
+
var COUNTRY_BY_NUMERIC = new Map(
|
|
164
|
+
COUNTRIES.map((c) => [c.numeric, c])
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
// src/country/codes.ts
|
|
168
|
+
function getCountryByAlpha2(code) {
|
|
169
|
+
if (!code || typeof code !== "string") return null;
|
|
170
|
+
return COUNTRY_BY_ALPHA2.get(code.toUpperCase()) || null;
|
|
171
|
+
}
|
|
172
|
+
function getCountryByAlpha3(code) {
|
|
173
|
+
if (!code || typeof code !== "string") return null;
|
|
174
|
+
return COUNTRY_BY_ALPHA3.get(code.toUpperCase()) || null;
|
|
175
|
+
}
|
|
176
|
+
function getCountryByNumeric(code) {
|
|
177
|
+
if (code === null || code === void 0) return null;
|
|
178
|
+
const numericStr = String(code).padStart(3, "0");
|
|
179
|
+
return COUNTRY_BY_NUMERIC.get(numericStr) || null;
|
|
180
|
+
}
|
|
181
|
+
function getCountry(code) {
|
|
182
|
+
if (code === null || code === void 0) return null;
|
|
183
|
+
const codeStr = String(code).toUpperCase();
|
|
184
|
+
if (codeStr.length === 2) {
|
|
185
|
+
return getCountryByAlpha2(codeStr);
|
|
186
|
+
}
|
|
187
|
+
if (codeStr.length === 3 && /^[A-Z]+$/.test(codeStr)) {
|
|
188
|
+
return getCountryByAlpha3(codeStr);
|
|
189
|
+
}
|
|
190
|
+
if (/^\d+$/.test(codeStr)) {
|
|
191
|
+
return getCountryByNumeric(codeStr);
|
|
192
|
+
}
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
function convertCountryCode(code, to) {
|
|
196
|
+
const country = getCountry(code);
|
|
197
|
+
if (!country) return null;
|
|
198
|
+
switch (to) {
|
|
199
|
+
case "alpha2":
|
|
200
|
+
return country.alpha2;
|
|
201
|
+
case "alpha3":
|
|
202
|
+
return country.alpha3;
|
|
203
|
+
case "numeric":
|
|
204
|
+
return country.numeric;
|
|
205
|
+
default:
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
function getAllCountries() {
|
|
210
|
+
return [...COUNTRIES];
|
|
211
|
+
}
|
|
212
|
+
function getCountriesByContinent(continent) {
|
|
213
|
+
return COUNTRIES.filter((c) => c.continent.toLowerCase() === continent.toLowerCase());
|
|
214
|
+
}
|
|
215
|
+
function getCountriesByLanguage(language) {
|
|
216
|
+
const lang = language.toLowerCase();
|
|
217
|
+
return COUNTRIES.filter((c) => c.languages.some((l) => l.toLowerCase() === lang));
|
|
218
|
+
}
|
|
219
|
+
function searchCountries(query) {
|
|
220
|
+
if (!query || typeof query !== "string") return [];
|
|
221
|
+
const q = query.toLowerCase().trim();
|
|
222
|
+
if (!q) return [];
|
|
223
|
+
return COUNTRIES.filter(
|
|
224
|
+
(c) => c.name.toLowerCase().includes(q) || c.officialName?.toLowerCase().includes(q) || c.alpha2.toLowerCase() === q || c.alpha3.toLowerCase() === q
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
function isValidCountryCode(code) {
|
|
228
|
+
return getCountry(code) !== null;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// src/country/data/timezones.ts
|
|
232
|
+
var TIMEZONES_BY_COUNTRY = {
|
|
233
|
+
// North America
|
|
234
|
+
US: ["America/New_York", "America/Chicago", "America/Denver", "America/Los_Angeles", "America/Anchorage", "Pacific/Honolulu"],
|
|
235
|
+
CA: ["America/Toronto", "America/Vancouver", "America/Edmonton", "America/Winnipeg", "America/Halifax"],
|
|
236
|
+
MX: ["America/Mexico_City", "America/Tijuana", "America/Cancun"],
|
|
237
|
+
// Europe
|
|
238
|
+
GB: ["Europe/London"],
|
|
239
|
+
DE: ["Europe/Berlin"],
|
|
240
|
+
FR: ["Europe/Paris"],
|
|
241
|
+
IT: ["Europe/Rome"],
|
|
242
|
+
ES: ["Europe/Madrid"],
|
|
243
|
+
NL: ["Europe/Amsterdam"],
|
|
244
|
+
BE: ["Europe/Brussels"],
|
|
245
|
+
CH: ["Europe/Zurich"],
|
|
246
|
+
AT: ["Europe/Vienna"],
|
|
247
|
+
SE: ["Europe/Stockholm"],
|
|
248
|
+
NO: ["Europe/Oslo"],
|
|
249
|
+
DK: ["Europe/Copenhagen"],
|
|
250
|
+
FI: ["Europe/Helsinki"],
|
|
251
|
+
PL: ["Europe/Warsaw"],
|
|
252
|
+
PT: ["Europe/Lisbon"],
|
|
253
|
+
IE: ["Europe/Dublin"],
|
|
254
|
+
GR: ["Europe/Athens"],
|
|
255
|
+
CZ: ["Europe/Prague"],
|
|
256
|
+
HU: ["Europe/Budapest"],
|
|
257
|
+
RO: ["Europe/Bucharest"],
|
|
258
|
+
// Asia
|
|
259
|
+
CN: ["Asia/Shanghai", "Asia/Hong_Kong"],
|
|
260
|
+
JP: ["Asia/Tokyo"],
|
|
261
|
+
KR: ["Asia/Seoul"],
|
|
262
|
+
IN: ["Asia/Kolkata"],
|
|
263
|
+
PK: ["Asia/Karachi"],
|
|
264
|
+
BD: ["Asia/Dhaka"],
|
|
265
|
+
ID: ["Asia/Jakarta", "Asia/Makassar", "Asia/Jayapura"],
|
|
266
|
+
TH: ["Asia/Bangkok"],
|
|
267
|
+
VN: ["Asia/Ho_Chi_Minh"],
|
|
268
|
+
PH: ["Asia/Manila"],
|
|
269
|
+
MY: ["Asia/Kuala_Lumpur"],
|
|
270
|
+
SG: ["Asia/Singapore"],
|
|
271
|
+
// Middle East
|
|
272
|
+
AE: ["Asia/Dubai"],
|
|
273
|
+
SA: ["Asia/Riyadh"],
|
|
274
|
+
EG: ["Africa/Cairo"],
|
|
275
|
+
TR: ["Europe/Istanbul"],
|
|
276
|
+
IR: ["Asia/Tehran"],
|
|
277
|
+
IL: ["Asia/Jerusalem"],
|
|
278
|
+
QA: ["Asia/Qatar"],
|
|
279
|
+
KW: ["Asia/Kuwait"],
|
|
280
|
+
// Africa
|
|
281
|
+
NG: ["Africa/Lagos"],
|
|
282
|
+
ZA: ["Africa/Johannesburg"],
|
|
283
|
+
KE: ["Africa/Nairobi"],
|
|
284
|
+
MA: ["Africa/Casablanca"],
|
|
285
|
+
DZ: ["Africa/Algiers"],
|
|
286
|
+
// South America
|
|
287
|
+
BR: ["America/Sao_Paulo", "America/Manaus", "America/Recife"],
|
|
288
|
+
AR: ["America/Buenos_Aires"],
|
|
289
|
+
CO: ["America/Bogota"],
|
|
290
|
+
CL: ["America/Santiago"],
|
|
291
|
+
PE: ["America/Lima"],
|
|
292
|
+
// Oceania
|
|
293
|
+
AU: ["Australia/Sydney", "Australia/Melbourne", "Australia/Brisbane", "Australia/Perth", "Australia/Adelaide"],
|
|
294
|
+
NZ: ["Pacific/Auckland"],
|
|
295
|
+
// Russia & CIS
|
|
296
|
+
RU: ["Europe/Moscow", "Asia/Yekaterinburg", "Asia/Novosibirsk", "Asia/Vladivostok"],
|
|
297
|
+
UA: ["Europe/Kiev"]
|
|
298
|
+
};
|
|
299
|
+
var DEFAULT_TIMEZONE = {
|
|
300
|
+
US: "America/New_York",
|
|
301
|
+
CA: "America/Toronto",
|
|
302
|
+
MX: "America/Mexico_City",
|
|
303
|
+
GB: "Europe/London",
|
|
304
|
+
DE: "Europe/Berlin",
|
|
305
|
+
FR: "Europe/Paris",
|
|
306
|
+
IT: "Europe/Rome",
|
|
307
|
+
ES: "Europe/Madrid",
|
|
308
|
+
NL: "Europe/Amsterdam",
|
|
309
|
+
BE: "Europe/Brussels",
|
|
310
|
+
CH: "Europe/Zurich",
|
|
311
|
+
AT: "Europe/Vienna",
|
|
312
|
+
SE: "Europe/Stockholm",
|
|
313
|
+
NO: "Europe/Oslo",
|
|
314
|
+
DK: "Europe/Copenhagen",
|
|
315
|
+
FI: "Europe/Helsinki",
|
|
316
|
+
PL: "Europe/Warsaw",
|
|
317
|
+
PT: "Europe/Lisbon",
|
|
318
|
+
IE: "Europe/Dublin",
|
|
319
|
+
GR: "Europe/Athens",
|
|
320
|
+
CZ: "Europe/Prague",
|
|
321
|
+
HU: "Europe/Budapest",
|
|
322
|
+
RO: "Europe/Bucharest",
|
|
323
|
+
CN: "Asia/Shanghai",
|
|
324
|
+
JP: "Asia/Tokyo",
|
|
325
|
+
KR: "Asia/Seoul",
|
|
326
|
+
IN: "Asia/Kolkata",
|
|
327
|
+
PK: "Asia/Karachi",
|
|
328
|
+
BD: "Asia/Dhaka",
|
|
329
|
+
ID: "Asia/Jakarta",
|
|
330
|
+
TH: "Asia/Bangkok",
|
|
331
|
+
VN: "Asia/Ho_Chi_Minh",
|
|
332
|
+
PH: "Asia/Manila",
|
|
333
|
+
MY: "Asia/Kuala_Lumpur",
|
|
334
|
+
SG: "Asia/Singapore",
|
|
335
|
+
AE: "Asia/Dubai",
|
|
336
|
+
SA: "Asia/Riyadh",
|
|
337
|
+
EG: "Africa/Cairo",
|
|
338
|
+
TR: "Europe/Istanbul",
|
|
339
|
+
IR: "Asia/Tehran",
|
|
340
|
+
IL: "Asia/Jerusalem",
|
|
341
|
+
QA: "Asia/Qatar",
|
|
342
|
+
KW: "Asia/Kuwait",
|
|
343
|
+
NG: "Africa/Lagos",
|
|
344
|
+
ZA: "Africa/Johannesburg",
|
|
345
|
+
KE: "Africa/Nairobi",
|
|
346
|
+
MA: "Africa/Casablanca",
|
|
347
|
+
DZ: "Africa/Algiers",
|
|
348
|
+
BR: "America/Sao_Paulo",
|
|
349
|
+
AR: "America/Buenos_Aires",
|
|
350
|
+
CO: "America/Bogota",
|
|
351
|
+
CL: "America/Santiago",
|
|
352
|
+
PE: "America/Lima",
|
|
353
|
+
AU: "Australia/Sydney",
|
|
354
|
+
NZ: "Pacific/Auckland",
|
|
355
|
+
RU: "Europe/Moscow",
|
|
356
|
+
UA: "Europe/Kiev"
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
// src/country/timezone.ts
|
|
360
|
+
function getTimezonesByCountry(countryCode) {
|
|
361
|
+
if (!countryCode || typeof countryCode !== "string") return [];
|
|
362
|
+
return TIMEZONES_BY_COUNTRY[countryCode.toUpperCase()] || [];
|
|
363
|
+
}
|
|
364
|
+
function getDefaultTimezone(countryCode) {
|
|
365
|
+
if (!countryCode || typeof countryCode !== "string") return null;
|
|
366
|
+
return DEFAULT_TIMEZONE[countryCode.toUpperCase()] || null;
|
|
367
|
+
}
|
|
368
|
+
function getCurrentTimeInCountry(countryCode) {
|
|
369
|
+
const timezone = getDefaultTimezone(countryCode);
|
|
370
|
+
if (!timezone) return null;
|
|
371
|
+
try {
|
|
372
|
+
const now = /* @__PURE__ */ new Date();
|
|
373
|
+
const options = {
|
|
374
|
+
timeZone: timezone,
|
|
375
|
+
year: "numeric",
|
|
376
|
+
month: "2-digit",
|
|
377
|
+
day: "2-digit",
|
|
378
|
+
hour: "2-digit",
|
|
379
|
+
minute: "2-digit",
|
|
380
|
+
second: "2-digit",
|
|
381
|
+
hour12: false
|
|
382
|
+
};
|
|
383
|
+
const formatter = new Intl.DateTimeFormat("en-CA", options);
|
|
384
|
+
const parts = formatter.formatToParts(now);
|
|
385
|
+
const getPart = (type) => parts.find((p) => p.type === type)?.value || "0";
|
|
386
|
+
return new Date(
|
|
387
|
+
parseInt(getPart("year")),
|
|
388
|
+
parseInt(getPart("month")) - 1,
|
|
389
|
+
parseInt(getPart("day")),
|
|
390
|
+
parseInt(getPart("hour")),
|
|
391
|
+
parseInt(getPart("minute")),
|
|
392
|
+
parseInt(getPart("second"))
|
|
393
|
+
);
|
|
394
|
+
} catch {
|
|
395
|
+
return null;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
function getTimezoneOffset(countryCode) {
|
|
399
|
+
const timezone = getDefaultTimezone(countryCode);
|
|
400
|
+
if (!timezone) return null;
|
|
401
|
+
try {
|
|
402
|
+
const now = /* @__PURE__ */ new Date();
|
|
403
|
+
const options = {
|
|
404
|
+
timeZone: timezone,
|
|
405
|
+
timeZoneName: "shortOffset"
|
|
406
|
+
};
|
|
407
|
+
const formatter = new Intl.DateTimeFormat("en-US", options);
|
|
408
|
+
const parts = formatter.formatToParts(now);
|
|
409
|
+
const tzPart = parts.find((p) => p.type === "timeZoneName");
|
|
410
|
+
if (tzPart?.value) {
|
|
411
|
+
const match = tzPart.value.match(/GMT([+-])(\d+)(?::(\d+))?/);
|
|
412
|
+
if (match) {
|
|
413
|
+
const sign = match[1];
|
|
414
|
+
const hours = match[2].padStart(2, "0");
|
|
415
|
+
const minutes = (match[3] || "00").padStart(2, "0");
|
|
416
|
+
return `${sign}${hours}:${minutes}`;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
return null;
|
|
420
|
+
} catch {
|
|
421
|
+
return null;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
function convertTimeBetweenCountries(date, _fromCountry, toCountry) {
|
|
425
|
+
const toTimezone = getDefaultTimezone(toCountry);
|
|
426
|
+
if (!toTimezone) return null;
|
|
427
|
+
try {
|
|
428
|
+
const options = {
|
|
429
|
+
timeZone: toTimezone,
|
|
430
|
+
year: "numeric",
|
|
431
|
+
month: "2-digit",
|
|
432
|
+
day: "2-digit",
|
|
433
|
+
hour: "2-digit",
|
|
434
|
+
minute: "2-digit",
|
|
435
|
+
second: "2-digit",
|
|
436
|
+
hour12: false
|
|
437
|
+
};
|
|
438
|
+
const formatter = new Intl.DateTimeFormat("en-CA", options);
|
|
439
|
+
const parts = formatter.formatToParts(date);
|
|
440
|
+
const getPart = (type) => parts.find((p) => p.type === type)?.value || "0";
|
|
441
|
+
return new Date(
|
|
442
|
+
parseInt(getPart("year")),
|
|
443
|
+
parseInt(getPart("month")) - 1,
|
|
444
|
+
parseInt(getPart("day")),
|
|
445
|
+
parseInt(getPart("hour")),
|
|
446
|
+
parseInt(getPart("minute")),
|
|
447
|
+
parseInt(getPart("second"))
|
|
448
|
+
);
|
|
449
|
+
} catch {
|
|
450
|
+
return null;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
function formatTimeForCountry(date, countryCode, options = {}) {
|
|
454
|
+
const timezone = getDefaultTimezone(countryCode);
|
|
455
|
+
if (!timezone) return date.toISOString();
|
|
456
|
+
try {
|
|
457
|
+
const formatOptions = {
|
|
458
|
+
timeZone: timezone,
|
|
459
|
+
...options
|
|
460
|
+
};
|
|
461
|
+
return new Intl.DateTimeFormat("en-US", formatOptions).format(date);
|
|
462
|
+
} catch {
|
|
463
|
+
return date.toISOString();
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
// src/country/data/currencies.ts
|
|
468
|
+
var CURRENCIES = {
|
|
469
|
+
USD: { code: "USD", symbol: "$", name: "US Dollar", decimals: 2, symbolPosition: "before", thousandsSeparator: ",", decimalSeparator: "." },
|
|
470
|
+
EUR: { code: "EUR", symbol: "€", name: "Euro", decimals: 2, symbolPosition: "before", thousandsSeparator: ".", decimalSeparator: "," },
|
|
471
|
+
GBP: { code: "GBP", symbol: "£", name: "British Pound", decimals: 2, symbolPosition: "before", thousandsSeparator: ",", decimalSeparator: "." },
|
|
472
|
+
JPY: { code: "JPY", symbol: "¥", name: "Japanese Yen", decimals: 0, symbolPosition: "before", thousandsSeparator: ",", decimalSeparator: "." },
|
|
473
|
+
CNY: { code: "CNY", symbol: "¥", name: "Chinese Yuan", decimals: 2, symbolPosition: "before", thousandsSeparator: ",", decimalSeparator: "." },
|
|
474
|
+
INR: { code: "INR", symbol: "₹", name: "Indian Rupee", decimals: 2, symbolPosition: "before", thousandsSeparator: ",", decimalSeparator: "." },
|
|
475
|
+
PKR: { code: "PKR", symbol: "Rs", name: "Pakistani Rupee", decimals: 2, symbolPosition: "before", thousandsSeparator: ",", decimalSeparator: "." },
|
|
476
|
+
BDT: { code: "BDT", symbol: "৳", name: "Bangladeshi Taka", decimals: 2, symbolPosition: "before", thousandsSeparator: ",", decimalSeparator: "." },
|
|
477
|
+
AUD: { code: "AUD", symbol: "A$", name: "Australian Dollar", decimals: 2, symbolPosition: "before", thousandsSeparator: ",", decimalSeparator: "." },
|
|
478
|
+
CAD: { code: "CAD", symbol: "C$", name: "Canadian Dollar", decimals: 2, symbolPosition: "before", thousandsSeparator: ",", decimalSeparator: "." },
|
|
479
|
+
CHF: { code: "CHF", symbol: "CHF", name: "Swiss Franc", decimals: 2, symbolPosition: "before", thousandsSeparator: "'", decimalSeparator: "." },
|
|
480
|
+
HKD: { code: "HKD", symbol: "HK$", name: "Hong Kong Dollar", decimals: 2, symbolPosition: "before", thousandsSeparator: ",", decimalSeparator: "." },
|
|
481
|
+
SGD: { code: "SGD", symbol: "S$", name: "Singapore Dollar", decimals: 2, symbolPosition: "before", thousandsSeparator: ",", decimalSeparator: "." },
|
|
482
|
+
NZD: { code: "NZD", symbol: "NZ$", name: "New Zealand Dollar", decimals: 2, symbolPosition: "before", thousandsSeparator: ",", decimalSeparator: "." },
|
|
483
|
+
KRW: { code: "KRW", symbol: "₩", name: "South Korean Won", decimals: 0, symbolPosition: "before", thousandsSeparator: ",", decimalSeparator: "." },
|
|
484
|
+
MXN: { code: "MXN", symbol: "$", name: "Mexican Peso", decimals: 2, symbolPosition: "before", thousandsSeparator: ",", decimalSeparator: "." },
|
|
485
|
+
BRL: { code: "BRL", symbol: "R$", name: "Brazilian Real", decimals: 2, symbolPosition: "before", thousandsSeparator: ".", decimalSeparator: "," },
|
|
486
|
+
RUB: { code: "RUB", symbol: "₽", name: "Russian Ruble", decimals: 2, symbolPosition: "after", thousandsSeparator: " ", decimalSeparator: "," },
|
|
487
|
+
ZAR: { code: "ZAR", symbol: "R", name: "South African Rand", decimals: 2, symbolPosition: "before", thousandsSeparator: " ", decimalSeparator: "." },
|
|
488
|
+
TRY: { code: "TRY", symbol: "₺", name: "Turkish Lira", decimals: 2, symbolPosition: "before", thousandsSeparator: ".", decimalSeparator: "," },
|
|
489
|
+
AED: { code: "AED", symbol: "د.إ", name: "UAE Dirham", decimals: 2, symbolPosition: "before", thousandsSeparator: ",", decimalSeparator: "." },
|
|
490
|
+
SAR: { code: "SAR", symbol: "﷼", name: "Saudi Riyal", decimals: 2, symbolPosition: "before", thousandsSeparator: ",", decimalSeparator: "." },
|
|
491
|
+
QAR: { code: "QAR", symbol: "﷼", name: "Qatari Riyal", decimals: 2, symbolPosition: "before", thousandsSeparator: ",", decimalSeparator: "." },
|
|
492
|
+
KWD: { code: "KWD", symbol: "د.ك", name: "Kuwaiti Dinar", decimals: 3, symbolPosition: "before", thousandsSeparator: ",", decimalSeparator: "." },
|
|
493
|
+
EGP: { code: "EGP", symbol: "E£", name: "Egyptian Pound", decimals: 2, symbolPosition: "before", thousandsSeparator: ",", decimalSeparator: "." },
|
|
494
|
+
NGN: { code: "NGN", symbol: "₦", name: "Nigerian Naira", decimals: 2, symbolPosition: "before", thousandsSeparator: ",", decimalSeparator: "." },
|
|
495
|
+
KES: { code: "KES", symbol: "KSh", name: "Kenyan Shilling", decimals: 2, symbolPosition: "before", thousandsSeparator: ",", decimalSeparator: "." },
|
|
496
|
+
THB: { code: "THB", symbol: "฿", name: "Thai Baht", decimals: 2, symbolPosition: "before", thousandsSeparator: ",", decimalSeparator: "." },
|
|
497
|
+
MYR: { code: "MYR", symbol: "RM", name: "Malaysian Ringgit", decimals: 2, symbolPosition: "before", thousandsSeparator: ",", decimalSeparator: "." },
|
|
498
|
+
IDR: { code: "IDR", symbol: "Rp", name: "Indonesian Rupiah", decimals: 0, symbolPosition: "before", thousandsSeparator: ".", decimalSeparator: "," },
|
|
499
|
+
PHP: { code: "PHP", symbol: "₱", name: "Philippine Peso", decimals: 2, symbolPosition: "before", thousandsSeparator: ",", decimalSeparator: "." },
|
|
500
|
+
VND: { code: "VND", symbol: "₫", name: "Vietnamese Dong", decimals: 0, symbolPosition: "after", thousandsSeparator: ".", decimalSeparator: "," },
|
|
501
|
+
PLN: { code: "PLN", symbol: "zł", name: "Polish Zloty", decimals: 2, symbolPosition: "after", thousandsSeparator: " ", decimalSeparator: "," },
|
|
502
|
+
SEK: { code: "SEK", symbol: "kr", name: "Swedish Krona", decimals: 2, symbolPosition: "after", thousandsSeparator: " ", decimalSeparator: "," },
|
|
503
|
+
NOK: { code: "NOK", symbol: "kr", name: "Norwegian Krone", decimals: 2, symbolPosition: "after", thousandsSeparator: " ", decimalSeparator: "," },
|
|
504
|
+
DKK: { code: "DKK", symbol: "kr", name: "Danish Krone", decimals: 2, symbolPosition: "after", thousandsSeparator: ".", decimalSeparator: "," },
|
|
505
|
+
CZK: { code: "CZK", symbol: "Kč", name: "Czech Koruna", decimals: 2, symbolPosition: "after", thousandsSeparator: " ", decimalSeparator: "," },
|
|
506
|
+
HUF: { code: "HUF", symbol: "Ft", name: "Hungarian Forint", decimals: 0, symbolPosition: "after", thousandsSeparator: " ", decimalSeparator: "," },
|
|
507
|
+
RON: { code: "RON", symbol: "lei", name: "Romanian Leu", decimals: 2, symbolPosition: "after", thousandsSeparator: ".", decimalSeparator: "," },
|
|
508
|
+
UAH: { code: "UAH", symbol: "₴", name: "Ukrainian Hryvnia", decimals: 2, symbolPosition: "after", thousandsSeparator: " ", decimalSeparator: "," },
|
|
509
|
+
ILS: { code: "ILS", symbol: "₪", name: "Israeli Shekel", decimals: 2, symbolPosition: "before", thousandsSeparator: ",", decimalSeparator: "." },
|
|
510
|
+
IRR: { code: "IRR", symbol: "﷼", name: "Iranian Rial", decimals: 0, symbolPosition: "before", thousandsSeparator: ",", decimalSeparator: "." },
|
|
511
|
+
ARS: { code: "ARS", symbol: "$", name: "Argentine Peso", decimals: 2, symbolPosition: "before", thousandsSeparator: ".", decimalSeparator: "," },
|
|
512
|
+
COP: { code: "COP", symbol: "$", name: "Colombian Peso", decimals: 0, symbolPosition: "before", thousandsSeparator: ".", decimalSeparator: "," },
|
|
513
|
+
CLP: { code: "CLP", symbol: "$", name: "Chilean Peso", decimals: 0, symbolPosition: "before", thousandsSeparator: ".", decimalSeparator: "," },
|
|
514
|
+
PEN: { code: "PEN", symbol: "S/", name: "Peruvian Sol", decimals: 2, symbolPosition: "before", thousandsSeparator: ",", decimalSeparator: "." },
|
|
515
|
+
MAD: { code: "MAD", symbol: "د.م.", name: "Moroccan Dirham", decimals: 2, symbolPosition: "after", thousandsSeparator: " ", decimalSeparator: "," },
|
|
516
|
+
DZD: { code: "DZD", symbol: "د.ج", name: "Algerian Dinar", decimals: 2, symbolPosition: "after", thousandsSeparator: " ", decimalSeparator: "," }
|
|
517
|
+
};
|
|
518
|
+
var CURRENCY_BY_COUNTRY = {
|
|
519
|
+
US: "USD",
|
|
520
|
+
CA: "CAD",
|
|
521
|
+
MX: "MXN",
|
|
522
|
+
GB: "GBP",
|
|
523
|
+
DE: "EUR",
|
|
524
|
+
FR: "EUR",
|
|
525
|
+
IT: "EUR",
|
|
526
|
+
ES: "EUR",
|
|
527
|
+
NL: "EUR",
|
|
528
|
+
BE: "EUR",
|
|
529
|
+
AT: "EUR",
|
|
530
|
+
PT: "EUR",
|
|
531
|
+
IE: "EUR",
|
|
532
|
+
GR: "EUR",
|
|
533
|
+
FI: "EUR",
|
|
534
|
+
CH: "CHF",
|
|
535
|
+
SE: "SEK",
|
|
536
|
+
NO: "NOK",
|
|
537
|
+
DK: "DKK",
|
|
538
|
+
PL: "PLN",
|
|
539
|
+
CZ: "CZK",
|
|
540
|
+
HU: "HUF",
|
|
541
|
+
RO: "RON",
|
|
542
|
+
CN: "CNY",
|
|
543
|
+
JP: "JPY",
|
|
544
|
+
KR: "KRW",
|
|
545
|
+
IN: "INR",
|
|
546
|
+
PK: "PKR",
|
|
547
|
+
BD: "BDT",
|
|
548
|
+
ID: "IDR",
|
|
549
|
+
TH: "THB",
|
|
550
|
+
VN: "VND",
|
|
551
|
+
PH: "PHP",
|
|
552
|
+
MY: "MYR",
|
|
553
|
+
SG: "SGD",
|
|
554
|
+
AE: "AED",
|
|
555
|
+
SA: "SAR",
|
|
556
|
+
EG: "EGP",
|
|
557
|
+
TR: "TRY",
|
|
558
|
+
IR: "IRR",
|
|
559
|
+
IL: "ILS",
|
|
560
|
+
QA: "QAR",
|
|
561
|
+
KW: "KWD",
|
|
562
|
+
NG: "NGN",
|
|
563
|
+
ZA: "ZAR",
|
|
564
|
+
KE: "KES",
|
|
565
|
+
MA: "MAD",
|
|
566
|
+
DZ: "DZD",
|
|
567
|
+
BR: "BRL",
|
|
568
|
+
AR: "ARS",
|
|
569
|
+
CO: "COP",
|
|
570
|
+
CL: "CLP",
|
|
571
|
+
PE: "PEN",
|
|
572
|
+
AU: "AUD",
|
|
573
|
+
NZ: "NZD",
|
|
574
|
+
RU: "RUB",
|
|
575
|
+
UA: "UAH"
|
|
576
|
+
};
|
|
577
|
+
|
|
578
|
+
// src/country/currency.ts
|
|
579
|
+
function getCurrency(currencyCode) {
|
|
580
|
+
if (!currencyCode || typeof currencyCode !== "string") return null;
|
|
581
|
+
return CURRENCIES[currencyCode.toUpperCase()] || null;
|
|
582
|
+
}
|
|
583
|
+
function getCurrencyByCountry(countryCode) {
|
|
584
|
+
if (!countryCode || typeof countryCode !== "string") return null;
|
|
585
|
+
const currencyCode = CURRENCY_BY_COUNTRY[countryCode.toUpperCase()];
|
|
586
|
+
if (!currencyCode) return null;
|
|
587
|
+
return getCurrency(currencyCode);
|
|
588
|
+
}
|
|
589
|
+
function formatCurrency(amount, currencyCode) {
|
|
590
|
+
if (typeof amount !== "number" || isNaN(amount)) return "";
|
|
591
|
+
let currency = getCurrency(currencyCode);
|
|
592
|
+
if (!currency) {
|
|
593
|
+
currency = getCurrencyByCountry(currencyCode);
|
|
594
|
+
}
|
|
595
|
+
if (!currency) {
|
|
596
|
+
return amount.toFixed(2);
|
|
597
|
+
}
|
|
598
|
+
const absoluteAmount = Math.abs(amount);
|
|
599
|
+
const fixedAmount = absoluteAmount.toFixed(currency.decimals);
|
|
600
|
+
const [integerPart, decimalPart] = fixedAmount.split(".");
|
|
601
|
+
const formattedInteger = integerPart.replace(
|
|
602
|
+
/\B(?=(\d{3})+(?!\d))/g,
|
|
603
|
+
currency.thousandsSeparator
|
|
604
|
+
);
|
|
605
|
+
let formattedAmount = formattedInteger;
|
|
606
|
+
if (currency.decimals > 0 && decimalPart) {
|
|
607
|
+
formattedAmount += currency.decimalSeparator + decimalPart;
|
|
608
|
+
}
|
|
609
|
+
if (currency.symbolPosition === "before") {
|
|
610
|
+
formattedAmount = currency.symbol + formattedAmount;
|
|
611
|
+
} else {
|
|
612
|
+
formattedAmount = formattedAmount + " " + currency.symbol;
|
|
613
|
+
}
|
|
614
|
+
if (amount < 0) {
|
|
615
|
+
formattedAmount = "-" + formattedAmount;
|
|
616
|
+
}
|
|
617
|
+
return formattedAmount;
|
|
618
|
+
}
|
|
619
|
+
function parseCurrency(value, currencyCode) {
|
|
620
|
+
if (!value || typeof value !== "string") return NaN;
|
|
621
|
+
const currency = getCurrency(currencyCode);
|
|
622
|
+
if (!currency) {
|
|
623
|
+
return parseFloat(value.replace(/[^\d.-]/g, ""));
|
|
624
|
+
}
|
|
625
|
+
let cleaned = value.replace(currency.symbol, "").trim();
|
|
626
|
+
cleaned = cleaned.split(currency.thousandsSeparator).join("");
|
|
627
|
+
if (currency.decimalSeparator !== ".") {
|
|
628
|
+
cleaned = cleaned.replace(currency.decimalSeparator, ".");
|
|
629
|
+
}
|
|
630
|
+
cleaned = cleaned.replace(/[^\d.-]/g, "");
|
|
631
|
+
return parseFloat(cleaned);
|
|
632
|
+
}
|
|
633
|
+
function getAllCurrencies() {
|
|
634
|
+
return Object.values(CURRENCIES);
|
|
635
|
+
}
|
|
636
|
+
function getCurrencySymbol(currencyCode) {
|
|
637
|
+
const currency = getCurrency(currencyCode);
|
|
638
|
+
return currency?.symbol || null;
|
|
639
|
+
}
|
|
640
|
+
function convertCurrency(amount, _fromCurrency, toCurrency, exchangeRate) {
|
|
641
|
+
if (typeof amount !== "number" || isNaN(amount)) return NaN;
|
|
642
|
+
if (typeof exchangeRate !== "number" || isNaN(exchangeRate)) return NaN;
|
|
643
|
+
const toCurrencyInfo = getCurrency(toCurrency);
|
|
644
|
+
const converted = amount * exchangeRate;
|
|
645
|
+
if (toCurrencyInfo) {
|
|
646
|
+
const multiplier = Math.pow(10, toCurrencyInfo.decimals);
|
|
647
|
+
return Math.round(converted * multiplier) / multiplier;
|
|
648
|
+
}
|
|
649
|
+
return converted;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
// src/country/flags.ts
|
|
653
|
+
function getFlagEmoji(countryCode) {
|
|
654
|
+
if (!countryCode || typeof countryCode !== "string") return null;
|
|
655
|
+
const code = countryCode.toUpperCase().trim();
|
|
656
|
+
if (code.length !== 2) return null;
|
|
657
|
+
const country = getCountryByAlpha2(code);
|
|
658
|
+
if (country) {
|
|
659
|
+
return country.flag;
|
|
660
|
+
}
|
|
661
|
+
return null;
|
|
662
|
+
}
|
|
663
|
+
function getCountryFromEmoji(emoji) {
|
|
664
|
+
if (!emoji || typeof emoji !== "string") return null;
|
|
665
|
+
try {
|
|
666
|
+
const codePoints = [...emoji].map((char) => char.codePointAt(0) || 0);
|
|
667
|
+
if (codePoints.length !== 2) return null;
|
|
668
|
+
const chars = codePoints.map((cp) => {
|
|
669
|
+
if (cp >= 127462 && cp <= 127487) {
|
|
670
|
+
return String.fromCharCode(65 + (cp - 127462));
|
|
671
|
+
}
|
|
672
|
+
return null;
|
|
673
|
+
});
|
|
674
|
+
if (chars.some((c) => c === null)) return null;
|
|
675
|
+
return chars.join("");
|
|
676
|
+
} catch {
|
|
677
|
+
return null;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
function isFlagEmoji(str) {
|
|
681
|
+
if (!str || typeof str !== "string") return false;
|
|
682
|
+
const countryCode = getCountryFromEmoji(str);
|
|
683
|
+
if (!countryCode) return false;
|
|
684
|
+
return getCountryByAlpha2(countryCode) !== null;
|
|
685
|
+
}
|
|
686
|
+
function getAllFlags() {
|
|
687
|
+
const flags = {};
|
|
688
|
+
for (let i = 65; i <= 90; i++) {
|
|
689
|
+
for (let j = 65; j <= 90; j++) {
|
|
690
|
+
const code = String.fromCharCode(i, j);
|
|
691
|
+
const country = getCountryByAlpha2(code);
|
|
692
|
+
if (country) {
|
|
693
|
+
flags[code] = country.flag;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
return flags;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
// src/country/dialCode.ts
|
|
701
|
+
function getDialingCode(countryCode) {
|
|
702
|
+
if (!countryCode || typeof countryCode !== "string") return null;
|
|
703
|
+
const country = getCountryByAlpha2(countryCode);
|
|
704
|
+
if (country) {
|
|
705
|
+
return country.dialCode;
|
|
706
|
+
}
|
|
707
|
+
const phoneFormat = chunkOZLKYIZL_cjs.getPhoneFormat(countryCode);
|
|
708
|
+
return phoneFormat?.dialCode || null;
|
|
709
|
+
}
|
|
710
|
+
function getCountriesByDialingCode(dialCode) {
|
|
711
|
+
if (!dialCode || typeof dialCode !== "string") return [];
|
|
712
|
+
let normalized = dialCode.trim();
|
|
713
|
+
if (!normalized.startsWith("+")) {
|
|
714
|
+
normalized = "+" + normalized;
|
|
715
|
+
}
|
|
716
|
+
const countries = [];
|
|
717
|
+
const allCountries = getAllCountries();
|
|
718
|
+
for (const country of allCountries) {
|
|
719
|
+
if (country.dialCode === normalized) {
|
|
720
|
+
countries.push(country.alpha2);
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
return countries;
|
|
724
|
+
}
|
|
725
|
+
function formatWithDialingCode(nationalNumber, countryCode) {
|
|
726
|
+
const dialCode = getDialingCode(countryCode);
|
|
727
|
+
if (!dialCode) return nationalNumber;
|
|
728
|
+
let cleaned = nationalNumber.replace(/\D/g, "");
|
|
729
|
+
if (cleaned.startsWith("0")) {
|
|
730
|
+
cleaned = cleaned.slice(1);
|
|
731
|
+
}
|
|
732
|
+
return `${dialCode} ${cleaned}`;
|
|
733
|
+
}
|
|
734
|
+
function hasValidDialingCode(phone) {
|
|
735
|
+
if (!phone || typeof phone !== "string") return false;
|
|
736
|
+
const cleaned = phone.trim();
|
|
737
|
+
if (!cleaned.startsWith("+")) return false;
|
|
738
|
+
const allCountries = getAllCountries();
|
|
739
|
+
for (const country of allCountries) {
|
|
740
|
+
const dialDigits = country.dialCode.replace(/\D/g, "");
|
|
741
|
+
const phoneDigits = cleaned.replace(/\D/g, "");
|
|
742
|
+
if (phoneDigits.startsWith(dialDigits)) {
|
|
743
|
+
return true;
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
return false;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
exports.COUNTRIES = COUNTRIES;
|
|
750
|
+
exports.CURRENCIES = CURRENCIES;
|
|
751
|
+
exports.convertCountryCode = convertCountryCode;
|
|
752
|
+
exports.convertCurrency = convertCurrency;
|
|
753
|
+
exports.convertTimeBetweenCountries = convertTimeBetweenCountries;
|
|
754
|
+
exports.formatCurrency = formatCurrency;
|
|
755
|
+
exports.formatTimeForCountry = formatTimeForCountry;
|
|
756
|
+
exports.formatWithDialingCode = formatWithDialingCode;
|
|
757
|
+
exports.getAllCountries = getAllCountries;
|
|
758
|
+
exports.getAllCurrencies = getAllCurrencies;
|
|
759
|
+
exports.getAllFlags = getAllFlags;
|
|
760
|
+
exports.getCountriesByContinent = getCountriesByContinent;
|
|
761
|
+
exports.getCountriesByDialingCode = getCountriesByDialingCode;
|
|
762
|
+
exports.getCountriesByLanguage = getCountriesByLanguage;
|
|
763
|
+
exports.getCountry = getCountry;
|
|
764
|
+
exports.getCountryByAlpha2 = getCountryByAlpha2;
|
|
765
|
+
exports.getCountryByAlpha3 = getCountryByAlpha3;
|
|
766
|
+
exports.getCountryByNumeric = getCountryByNumeric;
|
|
767
|
+
exports.getCountryFromEmoji = getCountryFromEmoji;
|
|
768
|
+
exports.getCurrency = getCurrency;
|
|
769
|
+
exports.getCurrencyByCountry = getCurrencyByCountry;
|
|
770
|
+
exports.getCurrencySymbol = getCurrencySymbol;
|
|
771
|
+
exports.getCurrentTimeInCountry = getCurrentTimeInCountry;
|
|
772
|
+
exports.getDefaultTimezone = getDefaultTimezone;
|
|
773
|
+
exports.getDialingCode = getDialingCode;
|
|
774
|
+
exports.getFlagEmoji = getFlagEmoji;
|
|
775
|
+
exports.getTimezoneOffset = getTimezoneOffset;
|
|
776
|
+
exports.getTimezonesByCountry = getTimezonesByCountry;
|
|
777
|
+
exports.hasValidDialingCode = hasValidDialingCode;
|
|
778
|
+
exports.isFlagEmoji = isFlagEmoji;
|
|
779
|
+
exports.isValidCountryCode = isValidCountryCode;
|
|
780
|
+
exports.parseCurrency = parseCurrency;
|
|
781
|
+
exports.searchCountries = searchCountries;
|
|
782
|
+
//# sourceMappingURL=chunk-4SLYNSLH.cjs.map
|
|
783
|
+
//# sourceMappingURL=chunk-4SLYNSLH.cjs.map
|