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