device-passport 1.0.0 → 1.2.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.
Files changed (61) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +110 -2
  3. package/assets/ego-profile-manager.png +0 -0
  4. package/dist/adapters/index.cjs +19 -0
  5. package/dist/adapters/index.d.cts +66 -0
  6. package/dist/adapters/index.d.mts +66 -0
  7. package/dist/adapters/index.d.ts +66 -0
  8. package/dist/adapters/index.mjs +3 -0
  9. package/dist/ego/index.cjs +22 -0
  10. package/dist/ego/index.d.cts +5 -0
  11. package/dist/ego/index.d.mts +5 -0
  12. package/dist/ego/index.d.ts +5 -0
  13. package/dist/ego/index.mjs +8 -0
  14. package/dist/evaluator/index.cjs +140 -0
  15. package/dist/evaluator/index.d.cts +204 -0
  16. package/dist/evaluator/index.d.mts +204 -0
  17. package/dist/evaluator/index.d.ts +204 -0
  18. package/dist/evaluator/index.mjs +119 -0
  19. package/dist/geo/index.cjs +50 -0
  20. package/dist/geo/index.d.cts +213 -0
  21. package/dist/geo/index.d.mts +213 -0
  22. package/dist/geo/index.d.ts +213 -0
  23. package/dist/geo/index.mjs +18 -0
  24. package/dist/index.cjs +110 -3940
  25. package/dist/index.d.cts +45 -1091
  26. package/dist/index.d.mts +45 -1091
  27. package/dist/index.d.ts +45 -1091
  28. package/dist/index.mjs +11 -3849
  29. package/dist/shared/device-passport.BGfRcQNh.mjs +565 -0
  30. package/dist/shared/device-passport.BKtmLzPt.cjs +1266 -0
  31. package/dist/shared/device-passport.BPQj0qdT.mjs +1238 -0
  32. package/dist/shared/device-passport.CDS7xrj8.d.ts +469 -0
  33. package/dist/shared/device-passport.C_F1vBE8.d.cts +79 -0
  34. package/dist/shared/device-passport.C_F1vBE8.d.mts +79 -0
  35. package/dist/shared/device-passport.C_F1vBE8.d.ts +79 -0
  36. package/dist/shared/device-passport.CfLes-lq.d.cts +469 -0
  37. package/dist/shared/device-passport.Cjxlv8xI.cjs +245 -0
  38. package/dist/shared/device-passport.CsOWqPIr.d.cts +77 -0
  39. package/dist/shared/device-passport.CyQtcZeD.mjs +237 -0
  40. package/dist/shared/device-passport.D7pEnyp2.d.ts +77 -0
  41. package/dist/shared/device-passport.D9xW6R0B.cjs +1571 -0
  42. package/dist/shared/device-passport.DirQmSd4.d.cts +47 -0
  43. package/dist/shared/device-passport.DirQmSd4.d.mts +47 -0
  44. package/dist/shared/device-passport.DirQmSd4.d.ts +47 -0
  45. package/dist/shared/device-passport.EK4RX7Xd.cjs +584 -0
  46. package/dist/shared/device-passport.ZBspe4ZW.d.mts +77 -0
  47. package/dist/shared/device-passport.dVEqzSEb.d.mts +469 -0
  48. package/dist/shared/device-passport.gNo82fQ5.mjs +1537 -0
  49. package/dist/shared/device-passport.kekU28UM.mjs +705 -0
  50. package/dist/shared/device-passport.qL4tjwc0.cjs +718 -0
  51. package/dist/storage/index.cjs +10 -0
  52. package/dist/storage/index.d.cts +97 -0
  53. package/dist/storage/index.d.mts +97 -0
  54. package/dist/storage/index.d.ts +97 -0
  55. package/dist/storage/index.mjs +3 -0
  56. package/dist/types/index.cjs +2 -0
  57. package/dist/types/index.d.cts +397 -0
  58. package/dist/types/index.d.mts +397 -0
  59. package/dist/types/index.d.ts +397 -0
  60. package/dist/types/index.mjs +1 -0
  61. package/package.json +32 -2
@@ -0,0 +1,1266 @@
1
+ 'use strict';
2
+
3
+ const DEFAULT_COUNTRY = "US";
4
+ const DEFAULT_LOCALE = "en-US";
5
+ const DEFAULT_TIMEZONE = "America/New_York";
6
+ const DEFAULT_ACCEPT_LANGUAGE = "en-US,en;q=0.9";
7
+ const COUNTRY_LOCALES = {
8
+ US: {
9
+ country: "US",
10
+ countryName: "United States",
11
+ primaryLocale: "en-US",
12
+ languages: ["en-US", "en"],
13
+ acceptLanguage: "en-US,en;q=0.9",
14
+ timezones: [
15
+ "America/New_York",
16
+ "America/Los_Angeles",
17
+ "America/Chicago",
18
+ "America/Denver",
19
+ "America/Phoenix",
20
+ "America/Anchorage",
21
+ "America/Honolulu",
22
+ "America/Detroit",
23
+ "America/Indiana/Indianapolis"
24
+ ],
25
+ defaultTimezone: "America/New_York",
26
+ currency: "USD",
27
+ coordinates: { latitude: 37.7749, longitude: -122.4194, accuracy: 1e3 }
28
+ },
29
+ GB: {
30
+ country: "GB",
31
+ countryName: "United Kingdom",
32
+ primaryLocale: "en-GB",
33
+ languages: ["en-GB", "en-US", "en"],
34
+ acceptLanguage: "en-GB,en-US;q=0.9,en;q=0.8",
35
+ timezones: ["Europe/London"],
36
+ defaultTimezone: "Europe/London",
37
+ currency: "GBP",
38
+ coordinates: { latitude: 51.5074, longitude: -0.1278, accuracy: 1e3 }
39
+ },
40
+ DE: {
41
+ country: "DE",
42
+ countryName: "Germany",
43
+ primaryLocale: "de-DE",
44
+ languages: ["de-DE", "de", "en-US", "en"],
45
+ acceptLanguage: "de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7",
46
+ timezones: ["Europe/Berlin"],
47
+ defaultTimezone: "Europe/Berlin",
48
+ currency: "EUR",
49
+ coordinates: { latitude: 52.52, longitude: 13.405, accuracy: 1e3 }
50
+ },
51
+ FR: {
52
+ country: "FR",
53
+ countryName: "France",
54
+ primaryLocale: "fr-FR",
55
+ languages: ["fr-FR", "fr", "en-US", "en"],
56
+ acceptLanguage: "fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7",
57
+ timezones: ["Europe/Paris"],
58
+ defaultTimezone: "Europe/Paris",
59
+ currency: "EUR",
60
+ coordinates: { latitude: 48.8566, longitude: 2.3522, accuracy: 1e3 }
61
+ },
62
+ JP: {
63
+ country: "JP",
64
+ countryName: "Japan",
65
+ primaryLocale: "ja-JP",
66
+ languages: ["ja-JP", "ja", "en-US"],
67
+ acceptLanguage: "ja-JP,ja;q=0.9,en-US;q=0.8",
68
+ timezones: ["Asia/Tokyo"],
69
+ defaultTimezone: "Asia/Tokyo",
70
+ currency: "JPY",
71
+ coordinates: { latitude: 35.6762, longitude: 139.6503, accuracy: 1e3 }
72
+ },
73
+ SG: {
74
+ country: "SG",
75
+ countryName: "Singapore",
76
+ primaryLocale: "en-SG",
77
+ languages: ["en-SG", "en-US", "en", "zh-CN"],
78
+ acceptLanguage: "en-SG,en-US;q=0.9,en;q=0.8,zh-CN;q=0.7",
79
+ timezones: ["Asia/Singapore"],
80
+ defaultTimezone: "Asia/Singapore",
81
+ currency: "SGD",
82
+ coordinates: { latitude: 1.3521, longitude: 103.8198, accuracy: 1e3 }
83
+ },
84
+ HK: {
85
+ country: "HK",
86
+ countryName: "Hong Kong",
87
+ primaryLocale: "zh-HK",
88
+ languages: ["zh-HK", "zh-TW", "zh", "en-US"],
89
+ acceptLanguage: "zh-HK,zh-TW;q=0.9,zh;q=0.8,en-US;q=0.7",
90
+ timezones: ["Asia/Hong_Kong"],
91
+ defaultTimezone: "Asia/Hong_Kong",
92
+ currency: "HKD",
93
+ coordinates: { latitude: 22.3193, longitude: 114.1694, accuracy: 1e3 }
94
+ },
95
+ TW: {
96
+ country: "TW",
97
+ countryName: "Taiwan",
98
+ primaryLocale: "zh-TW",
99
+ languages: ["zh-TW", "zh", "en-US"],
100
+ acceptLanguage: "zh-TW,zh;q=0.9,en-US;q=0.8",
101
+ timezones: ["Asia/Taipei"],
102
+ defaultTimezone: "Asia/Taipei",
103
+ currency: "TWD",
104
+ coordinates: { latitude: 25.033, longitude: 121.5654, accuracy: 1e3 }
105
+ },
106
+ CN: {
107
+ country: "CN",
108
+ countryName: "China",
109
+ primaryLocale: "zh-CN",
110
+ languages: ["zh-CN", "zh", "en-US", "en"],
111
+ acceptLanguage: "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
112
+ timezones: ["Asia/Shanghai", "Asia/Urumqi"],
113
+ defaultTimezone: "Asia/Shanghai",
114
+ currency: "CNY",
115
+ coordinates: { latitude: 31.2304, longitude: 121.4737, accuracy: 1e3 }
116
+ },
117
+ KR: {
118
+ country: "KR",
119
+ countryName: "South Korea",
120
+ primaryLocale: "ko-KR",
121
+ languages: ["ko-KR", "ko", "en-US", "en"],
122
+ acceptLanguage: "ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7",
123
+ timezones: ["Asia/Seoul"],
124
+ defaultTimezone: "Asia/Seoul",
125
+ currency: "KRW",
126
+ coordinates: { latitude: 37.5665, longitude: 126.978, accuracy: 1e3 }
127
+ },
128
+ AU: {
129
+ country: "AU",
130
+ countryName: "Australia",
131
+ primaryLocale: "en-AU",
132
+ languages: ["en-AU", "en-GB", "en-US", "en"],
133
+ acceptLanguage: "en-AU,en-GB;q=0.9,en-US;q=0.8,en;q=0.7",
134
+ timezones: [
135
+ "Australia/Sydney",
136
+ "Australia/Melbourne",
137
+ "Australia/Brisbane",
138
+ "Australia/Perth",
139
+ "Australia/Adelaide",
140
+ "Australia/Hobart",
141
+ "Australia/Darwin"
142
+ ],
143
+ defaultTimezone: "Australia/Sydney",
144
+ currency: "AUD",
145
+ coordinates: { latitude: -33.8688, longitude: 151.2093, accuracy: 1e3 }
146
+ },
147
+ CA: {
148
+ country: "CA",
149
+ countryName: "Canada",
150
+ primaryLocale: "en-CA",
151
+ languages: ["en-CA", "en-US", "en", "fr-CA"],
152
+ acceptLanguage: "en-CA,en-US;q=0.9,en;q=0.8,fr-CA;q=0.7",
153
+ timezones: [
154
+ "America/Toronto",
155
+ "America/Vancouver",
156
+ "America/Montreal",
157
+ "America/Edmonton",
158
+ "America/Winnipeg",
159
+ "America/Halifax",
160
+ "America/St_Johns"
161
+ ],
162
+ defaultTimezone: "America/Toronto",
163
+ currency: "CAD",
164
+ coordinates: { latitude: 43.6532, longitude: -79.3832, accuracy: 1e3 }
165
+ },
166
+ NL: {
167
+ country: "NL",
168
+ countryName: "Netherlands",
169
+ primaryLocale: "nl-NL",
170
+ languages: ["nl-NL", "nl", "en-US", "en"],
171
+ acceptLanguage: "nl-NL,nl;q=0.9,en-US;q=0.8,en;q=0.7",
172
+ timezones: ["Europe/Amsterdam"],
173
+ defaultTimezone: "Europe/Amsterdam",
174
+ currency: "EUR",
175
+ coordinates: { latitude: 52.3676, longitude: 4.9041, accuracy: 1e3 }
176
+ },
177
+ IN: {
178
+ country: "IN",
179
+ countryName: "India",
180
+ primaryLocale: "en-IN",
181
+ languages: ["en-IN", "en-GB", "en-US", "en", "hi"],
182
+ acceptLanguage: "en-IN,en-GB;q=0.9,en-US;q=0.8,en;q=0.7,hi;q=0.6",
183
+ timezones: ["Asia/Kolkata"],
184
+ defaultTimezone: "Asia/Kolkata",
185
+ currency: "INR",
186
+ coordinates: { latitude: 28.6139, longitude: 77.209, accuracy: 1e3 }
187
+ },
188
+ BR: {
189
+ country: "BR",
190
+ countryName: "Brazil",
191
+ primaryLocale: "pt-BR",
192
+ languages: ["pt-BR", "pt", "en-US", "en"],
193
+ acceptLanguage: "pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7",
194
+ timezones: [
195
+ "America/Sao_Paulo",
196
+ "America/Fortaleza",
197
+ "America/Manaus",
198
+ "America/Recife",
199
+ "America/Belem",
200
+ "America/Cuiaba"
201
+ ],
202
+ defaultTimezone: "America/Sao_Paulo",
203
+ currency: "BRL",
204
+ coordinates: { latitude: -23.5505, longitude: -46.6333, accuracy: 1e3 }
205
+ },
206
+ IT: {
207
+ country: "IT",
208
+ countryName: "Italy",
209
+ primaryLocale: "it-IT",
210
+ languages: ["it-IT", "it", "en-US", "en"],
211
+ acceptLanguage: "it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7",
212
+ timezones: ["Europe/Rome"],
213
+ defaultTimezone: "Europe/Rome",
214
+ currency: "EUR",
215
+ coordinates: { latitude: 41.9028, longitude: 12.4964, accuracy: 1e3 }
216
+ },
217
+ ES: {
218
+ country: "ES",
219
+ countryName: "Spain",
220
+ primaryLocale: "es-ES",
221
+ languages: ["es-ES", "es", "en-US", "en"],
222
+ acceptLanguage: "es-ES,es;q=0.9,en-US;q=0.8,en;q=0.7",
223
+ timezones: ["Europe/Madrid", "Atlantic/Canary"],
224
+ defaultTimezone: "Europe/Madrid",
225
+ currency: "EUR",
226
+ coordinates: { latitude: 40.4168, longitude: -3.7038, accuracy: 1e3 }
227
+ },
228
+ RU: {
229
+ country: "RU",
230
+ countryName: "Russia",
231
+ primaryLocale: "ru-RU",
232
+ languages: ["ru-RU", "ru", "en-US", "en"],
233
+ acceptLanguage: "ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7",
234
+ timezones: ["Europe/Moscow", "Europe/Samara", "Asia/Yekaterinburg", "Asia/Novosibirsk", "Asia/Vladivostok"],
235
+ defaultTimezone: "Europe/Moscow",
236
+ currency: "RUB",
237
+ coordinates: { latitude: 55.7558, longitude: 37.6173, accuracy: 1e3 }
238
+ },
239
+ MX: {
240
+ country: "MX",
241
+ countryName: "Mexico",
242
+ primaryLocale: "es-MX",
243
+ languages: ["es-MX", "es", "en-US", "en"],
244
+ acceptLanguage: "es-MX,es;q=0.9,en-US;q=0.8,en;q=0.7",
245
+ timezones: ["America/Mexico_City", "America/Cancun", "America/Monterrey", "America/Tijuana"],
246
+ defaultTimezone: "America/Mexico_City",
247
+ currency: "MXN",
248
+ coordinates: { latitude: 19.4326, longitude: -99.1332, accuracy: 1e3 }
249
+ },
250
+ ID: {
251
+ country: "ID",
252
+ countryName: "Indonesia",
253
+ primaryLocale: "id-ID",
254
+ languages: ["id-ID", "id", "en-US", "en"],
255
+ acceptLanguage: "id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7",
256
+ timezones: ["Asia/Jakarta", "Asia/Makassar", "Asia/Jayapura"],
257
+ defaultTimezone: "Asia/Jakarta",
258
+ currency: "IDR",
259
+ coordinates: { latitude: -6.2088, longitude: 106.8456, accuracy: 1e3 }
260
+ },
261
+ MY: {
262
+ country: "MY",
263
+ countryName: "Malaysia",
264
+ primaryLocale: "ms-MY",
265
+ languages: ["ms-MY", "ms", "en-US", "en"],
266
+ acceptLanguage: "ms-MY,ms;q=0.9,en-US;q=0.8,en;q=0.7",
267
+ timezones: ["Asia/Kuala_Lumpur", "Asia/Kuching"],
268
+ defaultTimezone: "Asia/Kuala_Lumpur",
269
+ currency: "MYR",
270
+ coordinates: { latitude: 3.139, longitude: 101.6869, accuracy: 1e3 }
271
+ },
272
+ TH: {
273
+ country: "TH",
274
+ countryName: "Thailand",
275
+ primaryLocale: "th-TH",
276
+ languages: ["th-TH", "th", "en-US", "en"],
277
+ acceptLanguage: "th-TH,th;q=0.9,en-US;q=0.8,en;q=0.7",
278
+ timezones: ["Asia/Bangkok"],
279
+ defaultTimezone: "Asia/Bangkok",
280
+ currency: "THB",
281
+ coordinates: { latitude: 13.7563, longitude: 100.5018, accuracy: 1e3 }
282
+ },
283
+ VN: {
284
+ country: "VN",
285
+ countryName: "Vietnam",
286
+ primaryLocale: "vi-VN",
287
+ languages: ["vi-VN", "vi", "en-US", "en"],
288
+ acceptLanguage: "vi-VN,vi;q=0.9,en-US;q=0.8,en;q=0.7",
289
+ timezones: ["Asia/Ho_Chi_Minh"],
290
+ defaultTimezone: "Asia/Ho_Chi_Minh",
291
+ currency: "VND",
292
+ coordinates: { latitude: 10.8231, longitude: 106.6297, accuracy: 1e3 }
293
+ },
294
+ PH: {
295
+ country: "PH",
296
+ countryName: "Philippines",
297
+ primaryLocale: "en-PH",
298
+ languages: ["en-PH", "en-US", "en", "fil"],
299
+ acceptLanguage: "en-PH,en-US;q=0.9,en;q=0.8,fil;q=0.7",
300
+ timezones: ["Asia/Manila"],
301
+ defaultTimezone: "Asia/Manila",
302
+ currency: "PHP",
303
+ coordinates: { latitude: 14.5995, longitude: 120.9842, accuracy: 1e3 }
304
+ },
305
+ SE: {
306
+ country: "SE",
307
+ countryName: "Sweden",
308
+ primaryLocale: "sv-SE",
309
+ languages: ["sv-SE", "sv", "en-US", "en"],
310
+ acceptLanguage: "sv-SE,sv;q=0.9,en-US;q=0.8,en;q=0.7",
311
+ timezones: ["Europe/Stockholm"],
312
+ defaultTimezone: "Europe/Stockholm",
313
+ currency: "SEK",
314
+ coordinates: { latitude: 59.3293, longitude: 18.0686, accuracy: 1e3 }
315
+ },
316
+ NO: {
317
+ country: "NO",
318
+ countryName: "Norway",
319
+ primaryLocale: "nb-NO",
320
+ languages: ["nb-NO", "nb", "nn", "en-US", "en"],
321
+ acceptLanguage: "nb-NO,nb;q=0.9,nn;q=0.8,en-US;q=0.7,en;q=0.6",
322
+ timezones: ["Europe/Oslo"],
323
+ defaultTimezone: "Europe/Oslo",
324
+ currency: "NOK",
325
+ coordinates: { latitude: 59.9139, longitude: 10.7522, accuracy: 1e3 }
326
+ },
327
+ DK: {
328
+ country: "DK",
329
+ countryName: "Denmark",
330
+ primaryLocale: "da-DK",
331
+ languages: ["da-DK", "da", "en-US", "en"],
332
+ acceptLanguage: "da-DK,da;q=0.9,en-US;q=0.8,en;q=0.7",
333
+ timezones: ["Europe/Copenhagen"],
334
+ defaultTimezone: "Europe/Copenhagen",
335
+ currency: "DKK",
336
+ coordinates: { latitude: 55.6761, longitude: 12.5683, accuracy: 1e3 }
337
+ },
338
+ FI: {
339
+ country: "FI",
340
+ countryName: "Finland",
341
+ primaryLocale: "fi-FI",
342
+ languages: ["fi-FI", "fi", "sv-FI", "en-US", "en"],
343
+ acceptLanguage: "fi-FI,fi;q=0.9,sv-FI;q=0.8,en-US;q=0.7,en;q=0.6",
344
+ timezones: ["Europe/Helsinki"],
345
+ defaultTimezone: "Europe/Helsinki",
346
+ currency: "EUR",
347
+ coordinates: { latitude: 60.1699, longitude: 24.9384, accuracy: 1e3 }
348
+ },
349
+ PL: {
350
+ country: "PL",
351
+ countryName: "Poland",
352
+ primaryLocale: "pl-PL",
353
+ languages: ["pl-PL", "pl", "en-US", "en"],
354
+ acceptLanguage: "pl-PL,pl;q=0.9,en-US;q=0.8,en;q=0.7",
355
+ timezones: ["Europe/Warsaw"],
356
+ defaultTimezone: "Europe/Warsaw",
357
+ currency: "PLN",
358
+ coordinates: { latitude: 52.2297, longitude: 21.0122, accuracy: 1e3 }
359
+ },
360
+ CH: {
361
+ country: "CH",
362
+ countryName: "Switzerland",
363
+ primaryLocale: "de-CH",
364
+ languages: ["de-CH", "fr-CH", "it-CH", "en-US", "en"],
365
+ acceptLanguage: "de-CH,fr-CH;q=0.9,it-CH;q=0.8,en-US;q=0.7,en;q=0.6",
366
+ timezones: ["Europe/Zurich"],
367
+ defaultTimezone: "Europe/Zurich",
368
+ currency: "CHF",
369
+ coordinates: { latitude: 47.3769, longitude: 8.5417, accuracy: 1e3 }
370
+ },
371
+ AT: {
372
+ country: "AT",
373
+ countryName: "Austria",
374
+ primaryLocale: "de-AT",
375
+ languages: ["de-AT", "de", "en-US", "en"],
376
+ acceptLanguage: "de-AT,de;q=0.9,en-US;q=0.8,en;q=0.7",
377
+ timezones: ["Europe/Vienna"],
378
+ defaultTimezone: "Europe/Vienna",
379
+ currency: "EUR",
380
+ coordinates: { latitude: 48.2082, longitude: 16.3738, accuracy: 1e3 }
381
+ },
382
+ BE: {
383
+ country: "BE",
384
+ countryName: "Belgium",
385
+ primaryLocale: "nl-BE",
386
+ languages: ["nl-BE", "fr-BE", "en-US", "en"],
387
+ acceptLanguage: "nl-BE,fr-BE;q=0.9,en-US;q=0.8,en;q=0.7",
388
+ timezones: ["Europe/Brussels"],
389
+ defaultTimezone: "Europe/Brussels",
390
+ currency: "EUR",
391
+ coordinates: { latitude: 50.8503, longitude: 4.3517, accuracy: 1e3 }
392
+ },
393
+ IE: {
394
+ country: "IE",
395
+ countryName: "Ireland",
396
+ primaryLocale: "en-IE",
397
+ languages: ["en-IE", "en-GB", "en-US", "en", "ga"],
398
+ acceptLanguage: "en-IE,en-GB;q=0.9,en-US;q=0.8,en;q=0.7,ga;q=0.6",
399
+ timezones: ["Europe/Dublin"],
400
+ defaultTimezone: "Europe/Dublin",
401
+ currency: "EUR",
402
+ coordinates: { latitude: 53.3498, longitude: -6.2603, accuracy: 1e3 }
403
+ },
404
+ NZ: {
405
+ country: "NZ",
406
+ countryName: "New Zealand",
407
+ primaryLocale: "en-NZ",
408
+ languages: ["en-NZ", "en-GB", "en-US", "en"],
409
+ acceptLanguage: "en-NZ,en-GB;q=0.9,en-US;q=0.8,en;q=0.7",
410
+ timezones: ["Pacific/Auckland", "Pacific/Chatham"],
411
+ defaultTimezone: "Pacific/Auckland",
412
+ currency: "NZD",
413
+ coordinates: { latitude: -36.8485, longitude: 174.7633, accuracy: 1e3 }
414
+ },
415
+ TR: {
416
+ country: "TR",
417
+ countryName: "Turkey",
418
+ primaryLocale: "tr-TR",
419
+ languages: ["tr-TR", "tr", "en-US", "en"],
420
+ acceptLanguage: "tr-TR,tr;q=0.9,en-US;q=0.8,en;q=0.7",
421
+ timezones: ["Europe/Istanbul"],
422
+ defaultTimezone: "Europe/Istanbul",
423
+ currency: "TRY",
424
+ coordinates: { latitude: 41.0082, longitude: 28.9784, accuracy: 1e3 }
425
+ },
426
+ SA: {
427
+ country: "SA",
428
+ countryName: "Saudi Arabia",
429
+ primaryLocale: "ar-SA",
430
+ languages: ["ar-SA", "ar", "en-US", "en"],
431
+ acceptLanguage: "ar-SA,ar;q=0.9,en-US;q=0.8,en;q=0.7",
432
+ timezones: ["Asia/Riyadh"],
433
+ defaultTimezone: "Asia/Riyadh",
434
+ currency: "SAR",
435
+ coordinates: { latitude: 24.7136, longitude: 46.6753, accuracy: 1e3 }
436
+ },
437
+ AE: {
438
+ country: "AE",
439
+ countryName: "United Arab Emirates",
440
+ primaryLocale: "ar-AE",
441
+ languages: ["ar-AE", "ar", "en-US", "en"],
442
+ acceptLanguage: "ar-AE,ar;q=0.9,en-US;q=0.8,en;q=0.7",
443
+ timezones: ["Asia/Dubai"],
444
+ defaultTimezone: "Asia/Dubai",
445
+ currency: "AED",
446
+ coordinates: { latitude: 25.2048, longitude: 55.2708, accuracy: 1e3 }
447
+ },
448
+ ZA: {
449
+ country: "ZA",
450
+ countryName: "South Africa",
451
+ primaryLocale: "en-ZA",
452
+ languages: ["en-ZA", "en-GB", "en-US", "en", "af"],
453
+ acceptLanguage: "en-ZA,en-GB;q=0.9,en-US;q=0.8,en;q=0.7,af;q=0.6",
454
+ timezones: ["Africa/Johannesburg"],
455
+ defaultTimezone: "Africa/Johannesburg",
456
+ currency: "ZAR",
457
+ coordinates: { latitude: -26.2041, longitude: 28.0473, accuracy: 1e3 }
458
+ },
459
+ AR: {
460
+ country: "AR",
461
+ countryName: "Argentina",
462
+ primaryLocale: "es-AR",
463
+ languages: ["es-AR", "es", "en-US", "en"],
464
+ acceptLanguage: "es-AR,es;q=0.9,en-US;q=0.8,en;q=0.7",
465
+ timezones: ["America/Argentina/Buenos_Aires", "America/Argentina/Cordoba"],
466
+ defaultTimezone: "America/Argentina/Buenos_Aires",
467
+ currency: "ARS",
468
+ coordinates: { latitude: -34.6037, longitude: -58.3816, accuracy: 1e3 }
469
+ },
470
+ CL: {
471
+ country: "CL",
472
+ countryName: "Chile",
473
+ primaryLocale: "es-CL",
474
+ languages: ["es-CL", "es", "en-US", "en"],
475
+ acceptLanguage: "es-CL,es;q=0.9,en-US;q=0.8,en;q=0.7",
476
+ timezones: ["America/Santiago", "Pacific/Easter"],
477
+ defaultTimezone: "America/Santiago",
478
+ currency: "CLP",
479
+ coordinates: { latitude: -33.4489, longitude: -70.6693, accuracy: 1e3 }
480
+ },
481
+ CO: {
482
+ country: "CO",
483
+ countryName: "Colombia",
484
+ primaryLocale: "es-CO",
485
+ languages: ["es-CO", "es", "en-US", "en"],
486
+ acceptLanguage: "es-CO,es;q=0.9,en-US;q=0.8,en;q=0.7",
487
+ timezones: ["America/Bogota"],
488
+ defaultTimezone: "America/Bogota",
489
+ currency: "COP",
490
+ coordinates: { latitude: 4.711, longitude: -74.0721, accuracy: 1e3 }
491
+ },
492
+ IL: {
493
+ country: "IL",
494
+ countryName: "Israel",
495
+ primaryLocale: "he-IL",
496
+ languages: ["he-IL", "he", "en-US", "en"],
497
+ acceptLanguage: "he-IL,he;q=0.9,en-US;q=0.8,en;q=0.7",
498
+ timezones: ["Asia/Jerusalem"],
499
+ defaultTimezone: "Asia/Jerusalem",
500
+ currency: "ILS",
501
+ coordinates: { latitude: 31.7683, longitude: 35.2137, accuracy: 1e3 }
502
+ },
503
+ UA: {
504
+ country: "UA",
505
+ countryName: "Ukraine",
506
+ primaryLocale: "uk-UA",
507
+ languages: ["uk-UA", "uk", "en-US", "en"],
508
+ acceptLanguage: "uk-UA,uk;q=0.9,en-US;q=0.8,en;q=0.7",
509
+ timezones: ["Europe/Kyiv"],
510
+ defaultTimezone: "Europe/Kyiv",
511
+ currency: "UAH",
512
+ coordinates: { latitude: 50.4501, longitude: 30.5234, accuracy: 1e3 }
513
+ },
514
+ PT: {
515
+ country: "PT",
516
+ countryName: "Portugal",
517
+ primaryLocale: "pt-PT",
518
+ languages: ["pt-PT", "pt", "en-US", "en"],
519
+ acceptLanguage: "pt-PT,pt;q=0.9,en-US;q=0.8,en;q=0.7",
520
+ timezones: ["Europe/Lisbon", "Atlantic/Madeira", "Atlantic/Azores"],
521
+ defaultTimezone: "Europe/Lisbon",
522
+ currency: "EUR",
523
+ coordinates: { latitude: 38.7223, longitude: -9.1393, accuracy: 1e3 }
524
+ },
525
+ CZ: {
526
+ country: "CZ",
527
+ countryName: "Czech Republic",
528
+ primaryLocale: "cs-CZ",
529
+ languages: ["cs-CZ", "cs", "en-US", "en"],
530
+ acceptLanguage: "cs-CZ,cs;q=0.9,en-US;q=0.8,en;q=0.7",
531
+ timezones: ["Europe/Prague"],
532
+ defaultTimezone: "Europe/Prague",
533
+ currency: "CZK",
534
+ coordinates: { latitude: 50.0755, longitude: 14.4378, accuracy: 1e3 }
535
+ },
536
+ RO: {
537
+ country: "RO",
538
+ countryName: "Romania",
539
+ primaryLocale: "ro-RO",
540
+ languages: ["ro-RO", "ro", "en-US", "en"],
541
+ acceptLanguage: "ro-RO,ro;q=0.9,en-US;q=0.8,en;q=0.7",
542
+ timezones: ["Europe/Bucharest"],
543
+ defaultTimezone: "Europe/Bucharest",
544
+ currency: "RON",
545
+ coordinates: { latitude: 44.4268, longitude: 26.1025, accuracy: 1e3 }
546
+ },
547
+ GR: {
548
+ country: "GR",
549
+ countryName: "Greece",
550
+ primaryLocale: "el-GR",
551
+ languages: ["el-GR", "el", "en-US", "en"],
552
+ acceptLanguage: "el-GR,el;q=0.9,en-US;q=0.8,en;q=0.7",
553
+ timezones: ["Europe/Athens"],
554
+ defaultTimezone: "Europe/Athens",
555
+ currency: "EUR",
556
+ coordinates: { latitude: 37.9838, longitude: 23.7275, accuracy: 1e3 }
557
+ },
558
+ HU: {
559
+ country: "HU",
560
+ countryName: "Hungary",
561
+ primaryLocale: "hu-HU",
562
+ languages: ["hu-HU", "hu", "en-US", "en"],
563
+ acceptLanguage: "hu-HU,hu;q=0.9,en-US;q=0.8,en;q=0.7",
564
+ timezones: ["Europe/Budapest"],
565
+ defaultTimezone: "Europe/Budapest",
566
+ currency: "HUF",
567
+ coordinates: { latitude: 47.4979, longitude: 19.0402, accuracy: 1e3 }
568
+ }
569
+ };
570
+ function getCountryConfig(countryCode) {
571
+ if (!countryCode) {
572
+ return COUNTRY_LOCALES[DEFAULT_COUNTRY];
573
+ }
574
+ const normalized = countryCode.trim().toUpperCase();
575
+ return COUNTRY_LOCALES[normalized] || COUNTRY_LOCALES[DEFAULT_COUNTRY];
576
+ }
577
+ function hasCountryConfig(countryCode) {
578
+ if (!countryCode) return false;
579
+ return Object.prototype.hasOwnProperty.call(COUNTRY_LOCALES, countryCode.trim().toUpperCase());
580
+ }
581
+ function getAllSupportedCountries() {
582
+ return Object.keys(COUNTRY_LOCALES);
583
+ }
584
+ function formatAcceptLanguage(languages) {
585
+ if (!languages || languages.length === 0) {
586
+ return DEFAULT_ACCEPT_LANGUAGE;
587
+ }
588
+ const uniqueLangs = [];
589
+ for (const lang of languages) {
590
+ const trimmed = lang.trim();
591
+ if (trimmed && !uniqueLangs.includes(trimmed)) {
592
+ uniqueLangs.push(trimmed);
593
+ }
594
+ }
595
+ if (uniqueLangs.length === 0) {
596
+ return DEFAULT_ACCEPT_LANGUAGE;
597
+ }
598
+ return uniqueLangs.map((lang, index) => {
599
+ if (index === 0) return lang;
600
+ const weight = Math.max(0.1, Number((1 - index * 0.1).toFixed(1)));
601
+ return `${lang};q=${weight}`;
602
+ }).join(",");
603
+ }
604
+ function parseAcceptLanguage(header) {
605
+ if (!header || typeof header !== "string") return [];
606
+ return header.split(",").map((part) => {
607
+ const [localePart, ...params] = part.trim().split(";");
608
+ const locale = localePart.trim();
609
+ let q = 1;
610
+ for (const param of params) {
611
+ const [key, val] = param.trim().split("=");
612
+ if (key && key.trim() === "q" && val) {
613
+ const parsed = parseFloat(val.trim());
614
+ if (!isNaN(parsed)) {
615
+ q = parsed;
616
+ }
617
+ }
618
+ }
619
+ return { locale, q };
620
+ }).filter((item) => item.locale.length > 0).sort((a, b) => b.q - a.q);
621
+ }
622
+
623
+ const TIMEZONE_TO_COUNTRY = {
624
+ // United States
625
+ "America/New_York": "US",
626
+ "America/Los_Angeles": "US",
627
+ "America/Chicago": "US",
628
+ "America/Denver": "US",
629
+ "America/Phoenix": "US",
630
+ "America/Anchorage": "US",
631
+ "America/Honolulu": "US",
632
+ "America/Detroit": "US",
633
+ "America/Indiana/Indianapolis": "US",
634
+ "America/Boise": "US",
635
+ "America/Juneau": "US",
636
+ "America/Adak": "US",
637
+ "America/Nome": "US",
638
+ "America/Sitka": "US",
639
+ "America/Yakutat": "US",
640
+ "America/Metlakatla": "US",
641
+ "America/Menominee": "US",
642
+ "America/Kentucky/Louisville": "US",
643
+ "America/Kentucky/Monticello": "US",
644
+ "America/Indiana/Marengo": "US",
645
+ "America/Indiana/Vincennes": "US",
646
+ "America/Indiana/Tell_City": "US",
647
+ "America/Indiana/Petersburg": "US",
648
+ "America/Indiana/Knox": "US",
649
+ "America/Indiana/Winamac": "US",
650
+ "America/Indiana/Vevay": "US",
651
+ "America/North_Dakota/Center": "US",
652
+ "America/North_Dakota/New_Salem": "US",
653
+ "America/North_Dakota/Beulah": "US",
654
+ // United Kingdom
655
+ "Europe/London": "GB",
656
+ // Germany
657
+ "Europe/Berlin": "DE",
658
+ "Europe/Busingen": "DE",
659
+ // France
660
+ "Europe/Paris": "FR",
661
+ // Japan
662
+ "Asia/Tokyo": "JP",
663
+ // Singapore
664
+ "Asia/Singapore": "SG",
665
+ // Hong Kong
666
+ "Asia/Hong_Kong": "HK",
667
+ // Taiwan
668
+ "Asia/Taipei": "TW",
669
+ // China
670
+ "Asia/Shanghai": "CN",
671
+ "Asia/Urumqi": "CN",
672
+ "Asia/Chongqing": "CN",
673
+ "Asia/Harbin": "CN",
674
+ "Asia/Kashgar": "CN",
675
+ // South Korea
676
+ "Asia/Seoul": "KR",
677
+ // Australia
678
+ "Australia/Sydney": "AU",
679
+ "Australia/Melbourne": "AU",
680
+ "Australia/Brisbane": "AU",
681
+ "Australia/Perth": "AU",
682
+ "Australia/Adelaide": "AU",
683
+ "Australia/Hobart": "AU",
684
+ "Australia/Darwin": "AU",
685
+ "Australia/Broken_Hill": "AU",
686
+ "Australia/Lord_Howe": "AU",
687
+ "Australia/Lindeman": "AU",
688
+ "Australia/Eucla": "AU",
689
+ // Canada
690
+ "America/Toronto": "CA",
691
+ "America/Vancouver": "CA",
692
+ "America/Montreal": "CA",
693
+ "America/Edmonton": "CA",
694
+ "America/Winnipeg": "CA",
695
+ "America/Halifax": "CA",
696
+ "America/St_Johns": "CA",
697
+ "America/Regina": "CA",
698
+ "America/Calgary": "CA",
699
+ "America/Whitehorse": "CA",
700
+ "America/Dawson": "CA",
701
+ "America/Yellowknife": "CA",
702
+ "America/Iqaluit": "CA",
703
+ // Netherlands
704
+ "Europe/Amsterdam": "NL",
705
+ // India
706
+ "Asia/Kolkata": "IN",
707
+ "Asia/Calcutta": "IN",
708
+ // Brazil
709
+ "America/Sao_Paulo": "BR",
710
+ "America/Fortaleza": "BR",
711
+ "America/Manaus": "BR",
712
+ "America/Recife": "BR",
713
+ "America/Belem": "BR",
714
+ "America/Cuiaba": "BR",
715
+ "America/Porto_Velho": "BR",
716
+ "America/Boa_Vista": "BR",
717
+ "America/Rio_Branco": "BR",
718
+ "America/Campo_Grande": "BR",
719
+ "America/Maceio": "BR",
720
+ "America/Araguaina": "BR",
721
+ "America/Santarem": "BR",
722
+ "America/Noronha": "BR",
723
+ // Italy
724
+ "Europe/Rome": "IT",
725
+ // Spain
726
+ "Europe/Madrid": "ES",
727
+ "Atlantic/Canary": "ES",
728
+ "Africa/Ceuta": "ES",
729
+ // Russia
730
+ "Europe/Moscow": "RU",
731
+ "Europe/Samara": "RU",
732
+ "Europe/Kaliningrad": "RU",
733
+ "Asia/Yekaterinburg": "RU",
734
+ "Asia/Novosibirsk": "RU",
735
+ "Asia/Krasnoyarsk": "RU",
736
+ "Asia/Irkutsk": "RU",
737
+ "Asia/Yakutsk": "RU",
738
+ "Asia/Vladivostok": "RU",
739
+ "Asia/Magadan": "RU",
740
+ "Asia/Kamchatka": "RU",
741
+ // Mexico
742
+ "America/Mexico_City": "MX",
743
+ "America/Cancun": "MX",
744
+ "America/Monterrey": "MX",
745
+ "America/Tijuana": "MX",
746
+ "America/Hermosillo": "MX",
747
+ "America/Chihuahua": "MX",
748
+ "America/Mazatlan": "MX",
749
+ "America/Merida": "MX",
750
+ // Indonesia
751
+ "Asia/Jakarta": "ID",
752
+ "Asia/Makassar": "ID",
753
+ "Asia/Jayapura": "ID",
754
+ "Asia/Pontianak": "ID",
755
+ // Malaysia
756
+ "Asia/Kuala_Lumpur": "MY",
757
+ "Asia/Kuching": "MY",
758
+ // Thailand
759
+ "Asia/Bangkok": "TH",
760
+ // Vietnam
761
+ "Asia/Ho_Chi_Minh": "VN",
762
+ // Philippines
763
+ "Asia/Manila": "PH",
764
+ // Sweden
765
+ "Europe/Stockholm": "SE",
766
+ // Norway
767
+ "Europe/Oslo": "NO",
768
+ // Denmark
769
+ "Europe/Copenhagen": "DK",
770
+ // Finland
771
+ "Europe/Helsinki": "FI",
772
+ // Poland
773
+ "Europe/Warsaw": "PL",
774
+ // Switzerland
775
+ "Europe/Zurich": "CH",
776
+ // Austria
777
+ "Europe/Vienna": "AT",
778
+ // Belgium
779
+ "Europe/Brussels": "BE",
780
+ // Ireland
781
+ "Europe/Dublin": "IE",
782
+ // New Zealand
783
+ "Pacific/Auckland": "NZ",
784
+ "Pacific/Chatham": "NZ",
785
+ // Turkey
786
+ "Europe/Istanbul": "TR",
787
+ // Saudi Arabia
788
+ "Asia/Riyadh": "SA",
789
+ // United Arab Emirates
790
+ "Asia/Dubai": "AE",
791
+ // South Africa
792
+ "Africa/Johannesburg": "ZA",
793
+ // Argentina
794
+ "America/Argentina/Buenos_Aires": "AR",
795
+ "America/Argentina/Cordoba": "AR",
796
+ "America/Argentina/Salta": "AR",
797
+ "America/Argentina/Jujuy": "AR",
798
+ "America/Argentina/Tucuman": "AR",
799
+ "America/Argentina/Catamarca": "AR",
800
+ "America/Argentina/La_Rioja": "AR",
801
+ "America/Argentina/San_Juan": "AR",
802
+ "America/Argentina/Mendoza": "AR",
803
+ "America/Argentina/San_Luis": "AR",
804
+ "America/Argentina/Rio_Gallegos": "AR",
805
+ "America/Argentina/Ushuaia": "AR",
806
+ // Chile
807
+ "America/Santiago": "CL",
808
+ "America/Punta_Arenas": "CL",
809
+ "Pacific/Easter": "CL",
810
+ // Colombia
811
+ "America/Bogota": "CO",
812
+ // Israel
813
+ "Asia/Jerusalem": "IL",
814
+ // Ukraine
815
+ "Europe/Kyiv": "UA",
816
+ // Portugal
817
+ "Europe/Lisbon": "PT",
818
+ "Atlantic/Madeira": "PT",
819
+ "Atlantic/Azores": "PT",
820
+ // Czech Republic
821
+ "Europe/Prague": "CZ",
822
+ // Romania
823
+ "Europe/Bucharest": "RO",
824
+ // Greece
825
+ "Europe/Athens": "GR",
826
+ // Hungary
827
+ "Europe/Budapest": "HU"
828
+ };
829
+ function isValidTimezone(timezone) {
830
+ if (!timezone || typeof timezone !== "string") {
831
+ return false;
832
+ }
833
+ const trimmed = timezone.trim();
834
+ if (trimmed.length === 0) {
835
+ return false;
836
+ }
837
+ if (TIMEZONE_TO_COUNTRY[trimmed]) {
838
+ return true;
839
+ }
840
+ try {
841
+ Intl.DateTimeFormat(void 0, { timeZone: trimmed });
842
+ return true;
843
+ } catch {
844
+ return false;
845
+ }
846
+ }
847
+ function getTimezonesForCountry(countryCode) {
848
+ if (!countryCode) return [DEFAULT_TIMEZONE];
849
+ const normalized = countryCode.trim().toUpperCase();
850
+ const config = COUNTRY_LOCALES[normalized];
851
+ if (config && config.timezones && config.timezones.length > 0) {
852
+ return [...config.timezones];
853
+ }
854
+ const matched = Object.entries(TIMEZONE_TO_COUNTRY).filter(([_, cc]) => cc === normalized).map(([tz]) => tz);
855
+ return matched.length > 0 ? matched : [DEFAULT_TIMEZONE];
856
+ }
857
+ function getCountryForTimezone(timezone) {
858
+ if (!timezone) return void 0;
859
+ const trimmed = timezone.trim();
860
+ return TIMEZONE_TO_COUNTRY[trimmed];
861
+ }
862
+ function getDefaultTimezoneForCountry(countryCode) {
863
+ if (!countryCode) return DEFAULT_TIMEZONE;
864
+ const normalized = countryCode.trim().toUpperCase();
865
+ const config = COUNTRY_LOCALES[normalized];
866
+ if (config && config.defaultTimezone) {
867
+ return config.defaultTimezone;
868
+ }
869
+ const countryTzs = getTimezonesForCountry(normalized);
870
+ return countryTzs[0] || DEFAULT_TIMEZONE;
871
+ }
872
+ function isTimezoneAlignedWithCountry(timezone, countryCode) {
873
+ if (!timezone || !countryCode) return false;
874
+ const normalized = countryCode.trim().toUpperCase();
875
+ const mappedCountry = getCountryForTimezone(timezone);
876
+ if (mappedCountry === normalized) {
877
+ return true;
878
+ }
879
+ const countryTzs = getTimezonesForCountry(normalized);
880
+ return countryTzs.includes(timezone.trim());
881
+ }
882
+ function getTimezoneOffsetMinutes(timezone, date = /* @__PURE__ */ new Date()) {
883
+ if (!timezone || !isValidTimezone(timezone)) {
884
+ return 0;
885
+ }
886
+ try {
887
+ const utcDate = new Date(date.toLocaleString("en-US", { timeZone: "UTC" }));
888
+ const tzDate = new Date(date.toLocaleString("en-US", { timeZone: timezone }));
889
+ return Math.round((tzDate.getTime() - utcDate.getTime()) / 6e4);
890
+ } catch {
891
+ return 0;
892
+ }
893
+ }
894
+ function listAllTimezones() {
895
+ return Object.keys(TIMEZONE_TO_COUNTRY);
896
+ }
897
+
898
+ const ALPHA3_TO_ALPHA2 = {
899
+ USA: "US",
900
+ GBR: "GB",
901
+ DEU: "DE",
902
+ FRA: "FR",
903
+ JPN: "JP",
904
+ SGP: "SG",
905
+ HKG: "HK",
906
+ TWN: "TW",
907
+ CHN: "CN",
908
+ KOR: "KR",
909
+ AUS: "AU",
910
+ CAN: "CA",
911
+ NLD: "NL",
912
+ IND: "IN",
913
+ BRA: "BR",
914
+ ITA: "IT",
915
+ ESP: "ES",
916
+ RUS: "RU",
917
+ MEX: "MX",
918
+ IDN: "ID",
919
+ MYS: "MY",
920
+ THA: "TH",
921
+ VNM: "VN",
922
+ PHL: "PH",
923
+ SWE: "SE",
924
+ NOR: "NO",
925
+ DNK: "DK",
926
+ FIN: "FI",
927
+ POL: "PL",
928
+ CHE: "CH",
929
+ AUT: "AT",
930
+ BEL: "BE",
931
+ IRL: "IE",
932
+ NZL: "NZ",
933
+ TUR: "TR",
934
+ SAU: "SA",
935
+ ARE: "AE",
936
+ ZAF: "ZA",
937
+ ARG: "AR",
938
+ CHL: "CL",
939
+ COL: "CO",
940
+ ISR: "IL",
941
+ UKR: "UA",
942
+ PRT: "PT",
943
+ CZE: "CZ",
944
+ ROU: "RO",
945
+ GRC: "GR",
946
+ HUN: "HU"
947
+ };
948
+ const COUNTRY_NAME_TO_CODE = {
949
+ "united states": "US",
950
+ "united states of america": "US",
951
+ "great britain": "GB",
952
+ "united kingdom": "GB",
953
+ england: "GB",
954
+ uk: "GB",
955
+ germany: "DE",
956
+ deutschland: "DE",
957
+ france: "FR",
958
+ japan: "JP",
959
+ singapore: "SG",
960
+ "hong kong": "HK",
961
+ taiwan: "TW",
962
+ china: "CN",
963
+ "south korea": "KR",
964
+ korea: "KR",
965
+ australia: "AU",
966
+ canada: "CA",
967
+ netherlands: "NL",
968
+ holland: "NL",
969
+ india: "IN",
970
+ brazil: "BR",
971
+ brasil: "BR",
972
+ italy: "IT",
973
+ spain: "ES",
974
+ russia: "RU",
975
+ mexico: "MX",
976
+ indonesia: "ID",
977
+ malaysia: "MY",
978
+ thailand: "TH",
979
+ vietnam: "VN",
980
+ philippines: "PH",
981
+ sweden: "SE",
982
+ norway: "NO",
983
+ denmark: "DK",
984
+ finland: "FI",
985
+ poland: "PL",
986
+ switzerland: "CH",
987
+ austria: "AT",
988
+ belgium: "BE",
989
+ ireland: "IE",
990
+ "new zealand": "NZ",
991
+ turkey: "TR",
992
+ t\u00FCrkiye: "TR",
993
+ "saudi arabia": "SA",
994
+ "united arab emirates": "AE",
995
+ uae: "AE",
996
+ "south africa": "ZA",
997
+ argentina: "AR",
998
+ chile: "CL",
999
+ colombia: "CO",
1000
+ israel: "IL",
1001
+ ukraine: "UA",
1002
+ portugal: "PT",
1003
+ "czech republic": "CZ",
1004
+ czechia: "CZ",
1005
+ romania: "RO",
1006
+ greece: "GR",
1007
+ hungary: "HU"
1008
+ };
1009
+ function normalizeCountryCode(code) {
1010
+ if (!code || typeof code !== "string") return null;
1011
+ const trimmed = code.trim();
1012
+ if (!trimmed) return null;
1013
+ const upper = trimmed.toUpperCase();
1014
+ if (upper === "UK") return "GB";
1015
+ if (/^[A-Z]{2}$/.test(upper)) {
1016
+ return upper;
1017
+ }
1018
+ if (/^[A-Z]{3}$/.test(upper) && ALPHA3_TO_ALPHA2[upper]) {
1019
+ return ALPHA3_TO_ALPHA2[upper];
1020
+ }
1021
+ const lower = trimmed.toLowerCase();
1022
+ if (COUNTRY_NAME_TO_CODE[lower]) {
1023
+ return COUNTRY_NAME_TO_CODE[lower];
1024
+ }
1025
+ return null;
1026
+ }
1027
+ function extractCountryFromProxyUrl(url) {
1028
+ if (!url || typeof url !== "string") return null;
1029
+ const trimmed = url.trim();
1030
+ if (!trimmed) return null;
1031
+ let parsedUrl = null;
1032
+ try {
1033
+ const hasScheme = /^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(trimmed);
1034
+ parsedUrl = new URL(hasScheme ? trimmed : `http://${trimmed}`);
1035
+ } catch {
1036
+ parsedUrl = null;
1037
+ }
1038
+ if (parsedUrl) {
1039
+ const paramNames = ["country", "country_code", "countrycode", "cc", "geo", "region"];
1040
+ for (const param of paramNames) {
1041
+ const val = parsedUrl.searchParams.get(param);
1042
+ if (val) {
1043
+ const normalized = normalizeCountryCode(val);
1044
+ if (normalized) return normalized;
1045
+ }
1046
+ }
1047
+ const localeVal = parsedUrl.searchParams.get("locale");
1048
+ if (localeVal) {
1049
+ const parts = localeVal.split(/[-_]/);
1050
+ const possibleCc = parts[parts.length - 1];
1051
+ const normalized = normalizeCountryCode(possibleCc);
1052
+ if (normalized) return normalized;
1053
+ }
1054
+ if (parsedUrl.username) {
1055
+ const username = decodeURIComponent(parsedUrl.username);
1056
+ const userPatterns = [
1057
+ /(?:^|[-_.:=])country[-_.:=]([a-zA-Z]{2,3})(?:[-_.:=]|$)/i,
1058
+ /(?:^|[-_.:=])cc[-_.:=]([a-zA-Z]{2,3})(?:[-_.:=]|$)/i,
1059
+ /(?:^|[-_.:=])geo[-_.:=]([a-zA-Z]{2,3})(?:[-_.:=]|$)/i,
1060
+ /(?:^|[-_.:=])region[-_.:=]([a-zA-Z]{2,3})(?:[-_.:=]|$)/i,
1061
+ /(?:^|[-_.:=])zone[-_][a-zA-Z0-9]+[-_]([a-zA-Z]{2,3})(?:[-_.:=]|$)/i
1062
+ ];
1063
+ for (const pattern of userPatterns) {
1064
+ const match = username.match(pattern);
1065
+ if (match && match[1]) {
1066
+ const normalized = normalizeCountryCode(match[1]);
1067
+ if (normalized) return normalized;
1068
+ }
1069
+ }
1070
+ }
1071
+ const hostname = parsedUrl.hostname.toLowerCase();
1072
+ const hostParts = hostname.split(".");
1073
+ if (hostParts.length >= 3) {
1074
+ const firstPart = hostParts[0];
1075
+ const subParts = firstPart.split(/[-_]/);
1076
+ for (const part of subParts) {
1077
+ if (/^[a-zA-Z]{2}$/.test(part)) {
1078
+ const normalized = normalizeCountryCode(part);
1079
+ if (normalized && hasCountryConfig(normalized)) {
1080
+ return normalized;
1081
+ }
1082
+ }
1083
+ }
1084
+ }
1085
+ }
1086
+ const rawPatterns = [
1087
+ /(?:^|[-_.:=?&])country[-_.:=]([a-zA-Z]{2,3})(?:[-_.:=?&]|$)/i,
1088
+ /(?:^|[-_.:=?&])country_code=([a-zA-Z]{2,3})/i,
1089
+ /(?:^|[-_.:=?&])cc[-_.:=]([a-zA-Z]{2,3})(?:[-_.:=?&]|$)/i,
1090
+ /(?:^|[-_.:=?&])geo[-_.:=]([a-zA-Z]{2,3})(?:[-_.:=?&]|$)/i,
1091
+ /(?:^|[-_.:=?&])region[-_.:=]([a-zA-Z]{2,3})(?:[-_.:=?&]|$)/i
1092
+ ];
1093
+ for (const pattern of rawPatterns) {
1094
+ const match = trimmed.match(pattern);
1095
+ if (match && match[1]) {
1096
+ const normalized = normalizeCountryCode(match[1]);
1097
+ if (normalized) return normalized;
1098
+ }
1099
+ }
1100
+ return null;
1101
+ }
1102
+ function detectCountry(input, options) {
1103
+ const fallback = options?.fallbackCountry && normalizeCountryCode(options.fallbackCountry) || DEFAULT_COUNTRY;
1104
+ if (!input || typeof input !== "string") {
1105
+ return fallback;
1106
+ }
1107
+ const trimmed = input.trim();
1108
+ if (!trimmed) {
1109
+ return fallback;
1110
+ }
1111
+ const directCode = normalizeCountryCode(trimmed);
1112
+ if (directCode && hasCountryConfig(directCode)) {
1113
+ return directCode;
1114
+ }
1115
+ const tzCountry = getCountryForTimezone(trimmed);
1116
+ if (tzCountry) {
1117
+ return tzCountry;
1118
+ }
1119
+ const proxyCountry = extractCountryFromProxyUrl(trimmed);
1120
+ if (proxyCountry && hasCountryConfig(proxyCountry)) {
1121
+ return proxyCountry;
1122
+ }
1123
+ return directCode || fallback;
1124
+ }
1125
+
1126
+ function alignGeoContext(geoInput) {
1127
+ let countryInput;
1128
+ let proxyUrlInput;
1129
+ let explicitTimezone;
1130
+ let explicitLocale;
1131
+ let explicitLanguages;
1132
+ let explicitAcceptLanguage;
1133
+ let fallbackCountry = DEFAULT_COUNTRY;
1134
+ let explicitCoordinates;
1135
+ if (typeof geoInput === "string") {
1136
+ const trimmed = geoInput.trim();
1137
+ if (isValidTimezone(trimmed) && trimmed.includes("/")) {
1138
+ explicitTimezone = trimmed;
1139
+ countryInput = trimmed;
1140
+ } else if (trimmed.includes("://") || trimmed.includes("@") || trimmed.includes("?")) {
1141
+ proxyUrlInput = trimmed;
1142
+ } else {
1143
+ countryInput = trimmed;
1144
+ }
1145
+ } else if (geoInput && typeof geoInput === "object") {
1146
+ countryInput = geoInput.country;
1147
+ proxyUrlInput = geoInput.proxyUrl;
1148
+ explicitTimezone = geoInput.timezone;
1149
+ explicitLocale = geoInput.locale;
1150
+ explicitLanguages = geoInput.languages;
1151
+ explicitAcceptLanguage = geoInput.acceptLanguage;
1152
+ fallbackCountry = geoInput.fallbackCountry || DEFAULT_COUNTRY;
1153
+ explicitCoordinates = geoInput.coordinates;
1154
+ }
1155
+ const detectedTarget = proxyUrlInput || countryInput;
1156
+ const country = detectCountry(detectedTarget, { fallbackCountry });
1157
+ const config = getCountryConfig(country);
1158
+ let timezone;
1159
+ if (explicitTimezone && isValidTimezone(explicitTimezone)) {
1160
+ timezone = explicitTimezone;
1161
+ } else {
1162
+ timezone = config.defaultTimezone || getDefaultTimezoneForCountry(country);
1163
+ }
1164
+ const locale = explicitLocale || config.primaryLocale || DEFAULT_LOCALE;
1165
+ const languages = explicitLanguages && explicitLanguages.length > 0 ? explicitLanguages : [...config.languages];
1166
+ let acceptLanguage;
1167
+ if (explicitAcceptLanguage) {
1168
+ acceptLanguage = explicitAcceptLanguage;
1169
+ } else if (explicitLanguages && explicitLanguages.length > 0) {
1170
+ acceptLanguage = formatAcceptLanguage(explicitLanguages);
1171
+ } else {
1172
+ acceptLanguage = config.acceptLanguage || DEFAULT_ACCEPT_LANGUAGE;
1173
+ }
1174
+ const timezoneOffset = getTimezoneOffsetMinutes(timezone);
1175
+ const coordinates = explicitCoordinates || config.coordinates;
1176
+ const currency = config.currency || "USD";
1177
+ return {
1178
+ country,
1179
+ timezone,
1180
+ locale,
1181
+ acceptLanguage,
1182
+ languages,
1183
+ timezoneOffset,
1184
+ currency,
1185
+ coordinates,
1186
+ language: locale
1187
+ };
1188
+ }
1189
+ function isGeoAligned(context) {
1190
+ if (!context || !context.country) {
1191
+ return false;
1192
+ }
1193
+ const country = context.country.toUpperCase();
1194
+ if (context.timezone) {
1195
+ if (!isValidTimezone(context.timezone)) {
1196
+ return false;
1197
+ }
1198
+ if (!isTimezoneAlignedWithCountry(context.timezone, country)) {
1199
+ return false;
1200
+ }
1201
+ }
1202
+ if (context.locale) {
1203
+ const config = getCountryConfig(country);
1204
+ const localeNorm = context.locale.toLowerCase();
1205
+ const configLocaleNorm = config.primaryLocale.toLowerCase();
1206
+ const countryNorm = country.toLowerCase();
1207
+ const matchesCountry = localeNorm.endsWith(`-${countryNorm}`) || localeNorm.endsWith(`_${countryNorm}`);
1208
+ const matchesPrimary = localeNorm === configLocaleNorm;
1209
+ const matchesLanguages = config.languages.some((l) => l.toLowerCase() === localeNorm);
1210
+ if (!matchesCountry && !matchesPrimary && !matchesLanguages) {
1211
+ return false;
1212
+ }
1213
+ }
1214
+ return true;
1215
+ }
1216
+ function toLocaleProfile(geo) {
1217
+ return {
1218
+ language: geo.locale,
1219
+ languages: [...geo.languages],
1220
+ timezone: geo.timezone,
1221
+ timezoneOffset: geo.timezoneOffset,
1222
+ country: geo.country,
1223
+ currency: geo.currency
1224
+ };
1225
+ }
1226
+ function toGeoLocation(geo) {
1227
+ const coordinates = geo.coordinates ?? getCountryConfig(geo.country).coordinates;
1228
+ return {
1229
+ latitude: coordinates.latitude,
1230
+ longitude: coordinates.longitude,
1231
+ accuracy: coordinates.accuracy ?? 1e3,
1232
+ country: geo.country,
1233
+ countryCode: geo.country,
1234
+ timezone: geo.timezone,
1235
+ locale: geo.locale,
1236
+ languages: [...geo.languages]
1237
+ };
1238
+ }
1239
+
1240
+ exports.ALPHA3_TO_ALPHA2 = ALPHA3_TO_ALPHA2;
1241
+ exports.COUNTRY_LOCALES = COUNTRY_LOCALES;
1242
+ exports.COUNTRY_NAME_TO_CODE = COUNTRY_NAME_TO_CODE;
1243
+ exports.DEFAULT_ACCEPT_LANGUAGE = DEFAULT_ACCEPT_LANGUAGE;
1244
+ exports.DEFAULT_COUNTRY = DEFAULT_COUNTRY;
1245
+ exports.DEFAULT_LOCALE = DEFAULT_LOCALE;
1246
+ exports.DEFAULT_TIMEZONE = DEFAULT_TIMEZONE;
1247
+ exports.TIMEZONE_TO_COUNTRY = TIMEZONE_TO_COUNTRY;
1248
+ exports.alignGeoContext = alignGeoContext;
1249
+ exports.detectCountry = detectCountry;
1250
+ exports.extractCountryFromProxyUrl = extractCountryFromProxyUrl;
1251
+ exports.formatAcceptLanguage = formatAcceptLanguage;
1252
+ exports.getAllSupportedCountries = getAllSupportedCountries;
1253
+ exports.getCountryConfig = getCountryConfig;
1254
+ exports.getCountryForTimezone = getCountryForTimezone;
1255
+ exports.getDefaultTimezoneForCountry = getDefaultTimezoneForCountry;
1256
+ exports.getTimezoneOffsetMinutes = getTimezoneOffsetMinutes;
1257
+ exports.getTimezonesForCountry = getTimezonesForCountry;
1258
+ exports.hasCountryConfig = hasCountryConfig;
1259
+ exports.isGeoAligned = isGeoAligned;
1260
+ exports.isTimezoneAlignedWithCountry = isTimezoneAlignedWithCountry;
1261
+ exports.isValidTimezone = isValidTimezone;
1262
+ exports.listAllTimezones = listAllTimezones;
1263
+ exports.normalizeCountryCode = normalizeCountryCode;
1264
+ exports.parseAcceptLanguage = parseAcceptLanguage;
1265
+ exports.toGeoLocation = toGeoLocation;
1266
+ exports.toLocaleProfile = toLocaleProfile;