pakdatakit 2.1.2 → 2.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 (68) hide show
  1. package/DATA.md +104 -0
  2. package/README.md +85 -3
  3. package/dist/address.cjs +4 -4
  4. package/dist/address.js +2 -2
  5. package/dist/{chunk-PHHKIMO2.cjs → chunk-33FXHM2E.cjs} +5 -5
  6. package/dist/chunk-3IARSCO6.cjs +317 -0
  7. package/dist/{chunk-BSS4Z7NI.cjs → chunk-3ZA265SK.cjs} +2 -2
  8. package/dist/{chunk-Q7XHVR3U.cjs → chunk-4VSGCQ6K.cjs} +86 -15
  9. package/dist/{chunk-Y6BUGLXU.js → chunk-6IPPANNX.js} +4 -1
  10. package/dist/{chunk-L45UXUWX.js → chunk-AZV45DMG.js} +1 -1
  11. package/dist/{chunk-QQQKISXT.js → chunk-BR4QLZPX.js} +11 -2
  12. package/dist/{chunk-AUATLZA5.cjs → chunk-CLL6VDPO.cjs} +4 -4
  13. package/dist/{chunk-P4CGOJEM.js → chunk-EMH4IP2U.js} +1 -1
  14. package/dist/{chunk-JNP27XW2.cjs → chunk-GJENL6VK.cjs} +6 -6
  15. package/dist/{chunk-APXP7OK7.cjs → chunk-HIZQBWNW.cjs} +11 -2
  16. package/dist/{chunk-YS7MOLK2.cjs → chunk-HTERSQGF.cjs} +3 -3
  17. package/dist/{chunk-E7GAK72W.js → chunk-HUQY2WR5.js} +3 -3
  18. package/dist/{chunk-L2BDDM2W.js → chunk-I664KOWP.js} +1 -1
  19. package/dist/{chunk-K6CZFCX6.js → chunk-J272OMDL.js} +51 -6
  20. package/dist/{chunk-KQKW2ZEK.cjs → chunk-NAJGGUAM.cjs} +2 -2
  21. package/dist/{chunk-YLWZGSFY.cjs → chunk-NTD4JLDW.cjs} +4 -0
  22. package/dist/{chunk-R7UTY3SY.js → chunk-NZQ47NWD.js} +84 -14
  23. package/dist/{chunk-432ZYMYV.js → chunk-PLDVGOKZ.js} +2 -2
  24. package/dist/{chunk-T3E4B5MJ.js → chunk-RXNYY5K5.js} +1 -1
  25. package/dist/{chunk-3COX5FSL.cjs → chunk-SBS2GHM3.cjs} +51 -6
  26. package/dist/chunk-TTARJWGT.js +82 -0
  27. package/dist/chunk-U7MWHXMF.cjs +89 -0
  28. package/dist/chunk-YPPKY5XZ.js +312 -0
  29. package/dist/cli.js +1 -1
  30. package/dist/geo.cjs +6 -6
  31. package/dist/geo.js +1 -1
  32. package/dist/holidays.d.cts +2 -1
  33. package/dist/holidays.d.ts +2 -1
  34. package/dist/iban.cjs +11 -3
  35. package/dist/iban.d.cts +45 -1
  36. package/dist/iban.d.ts +45 -1
  37. package/dist/iban.js +1 -1
  38. package/dist/index.cjs +76 -37
  39. package/dist/index.d.cts +11 -2
  40. package/dist/index.d.ts +11 -2
  41. package/dist/index.js +16 -10
  42. package/dist/input.cjs +34 -0
  43. package/dist/input.d.cts +67 -0
  44. package/dist/input.d.ts +67 -0
  45. package/dist/input.js +5 -0
  46. package/dist/networks.cjs +3 -3
  47. package/dist/networks.js +2 -2
  48. package/dist/numbers.cjs +6 -6
  49. package/dist/numbers.js +2 -2
  50. package/dist/phone.cjs +8 -8
  51. package/dist/phone.js +3 -3
  52. package/dist/raast.cjs +9 -5
  53. package/dist/raast.d.cts +53 -8
  54. package/dist/raast.d.ts +53 -8
  55. package/dist/raast.js +2 -2
  56. package/dist/valibot.cjs +7 -7
  57. package/dist/valibot.js +6 -6
  58. package/dist/whatsapp.cjs +3 -3
  59. package/dist/whatsapp.js +2 -2
  60. package/dist/words.cjs +3 -3
  61. package/dist/words.js +1 -1
  62. package/dist/yup.cjs +7 -7
  63. package/dist/yup.js +6 -6
  64. package/dist/zod.cjs +7 -7
  65. package/dist/zod.js +6 -6
  66. package/package.json +16 -3
  67. package/dist/chunk-4EUKCSLW.js +0 -221
  68. package/dist/chunk-E47SNBWQ.cjs +0 -224
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkE47SNBWQ_cjs = require('./chunk-E47SNBWQ.cjs');
3
+ var chunk3IARSCO6_cjs = require('./chunk-3IARSCO6.cjs');
4
4
  var chunkVPBMIYO2_cjs = require('./chunk-VPBMIYO2.cjs');
5
5
 
6
6
  // src/internal/emv.ts
@@ -57,12 +57,35 @@ function withCrc(payload) {
57
57
  // src/raast.ts
58
58
  var PK_IBAN_PATTERN = /^PK\d{2}[A-Z]{4}[A-Z0-9]{16}$/;
59
59
  var DEFAULT_P2P_SCHEME = "00";
60
+ var DURATION_UNITS = { m: 6e4, h: 36e5, d: 864e5 };
61
+ function resolveExpiry(expiresAt, expiresIn, now) {
62
+ if (expiresAt !== void 0 && expiresIn !== void 0) {
63
+ throw new RangeError("Use either expiresAt or expiresIn, not both");
64
+ }
65
+ if (expiresIn === void 0) return expiresAt;
66
+ let ms;
67
+ if (typeof expiresIn === "number") {
68
+ ms = expiresIn;
69
+ } else {
70
+ const match = /^(\d+(?:\.\d+)?)([mhd])$/.exec(expiresIn);
71
+ if (!match) {
72
+ throw new RangeError(
73
+ `expiresIn must be milliseconds or like '30m', '12h' or '7d', received ${expiresIn}`
74
+ );
75
+ }
76
+ ms = Number(match[1]) * DURATION_UNITS[match[2]];
77
+ }
78
+ if (!Number.isFinite(ms) || ms <= 0) {
79
+ throw new RangeError("expiresIn must be a positive duration");
80
+ }
81
+ return new Date(now.getTime() + ms);
82
+ }
60
83
  function formatAmount(amount, maxLength, label) {
61
84
  if (!Number.isFinite(amount) || amount <= 0) {
62
85
  throw new RangeError(`${label} must be a positive number`);
63
86
  }
64
87
  const text = amount.toFixed(2);
65
- if (text.length > maxLength) {
88
+ if (text.length > maxLength || !/^\d+\.\d{2}$/.test(text)) {
66
89
  throw new RangeError(`${label} is too large for a Raast QR code`);
67
90
  }
68
91
  return text;
@@ -72,7 +95,7 @@ function formatP2PAmount(amount) {
72
95
  throw new RangeError("amount must be a positive number");
73
96
  }
74
97
  const text = Number.isInteger(amount) ? String(amount) : amount.toFixed(2);
75
- if (text.length > 10) {
98
+ if (text.length > 10 || !/^\d+(\.\d+)?$/.test(text)) {
76
99
  throw new RangeError("amount is too large for a Raast QR code");
77
100
  }
78
101
  return text;
@@ -92,12 +115,17 @@ function checkLength(value, max, label) {
92
115
  }
93
116
  function normalizeIban(iban) {
94
117
  const normalized = chunkVPBMIYO2_cjs.stripSeparators(iban).toUpperCase();
95
- if (!chunkE47SNBWQ_cjs.validateIBAN(normalized)) {
118
+ if (!chunk3IARSCO6_cjs.validateIBAN(normalized)) {
96
119
  throw new RangeError(`Invalid Pakistani IBAN: ${iban}`);
97
120
  }
98
121
  return normalized;
99
122
  }
100
123
  function createRaastP2PQr(options) {
124
+ const expiresAt = resolveExpiry(
125
+ options.expiresAt,
126
+ options.expiresIn,
127
+ /* @__PURE__ */ new Date()
128
+ );
101
129
  const iban = normalizeIban(options.iban);
102
130
  let payload = encodeField("00", "02") + encodeField("01", options.amount === void 0 ? "11" : "12") + encodeField("02", options.scheme ?? DEFAULT_P2P_SCHEME);
103
131
  if (options.bankName) {
@@ -114,10 +142,10 @@ function createRaastP2PQr(options) {
114
142
  );
115
143
  }
116
144
  if (options.amount !== void 0) {
117
- if (options.expiresAt === void 0) {
118
- throw new RangeError("A QR with an amount needs expiresAt");
145
+ if (expiresAt === void 0) {
146
+ throw new RangeError("A QR with an amount needs expiresAt or expiresIn");
119
147
  }
120
- payload += encodeField("07", formatExpiry(options.expiresAt));
148
+ payload += encodeField("07", formatExpiry(expiresAt));
121
149
  }
122
150
  const data = `${payload}1004`;
123
151
  return `${data}${crc16(data)}`;
@@ -141,12 +169,12 @@ function createMerchantQr(options) {
141
169
  );
142
170
  }
143
171
  const dynamic = options.dynamic ?? options.amount !== void 0;
144
- const account = accountFields.map(([id, value]) => {
172
+ for (const [id] of accountFields) {
145
173
  if (!/^\d{2}$/.test(id)) {
146
174
  throw new RangeError(`Invalid merchant account sub-field ID: ${id}`);
147
175
  }
148
- return encodeField(id, value);
149
- }).join("");
176
+ }
177
+ const account = accountFields.sort(([a], [b]) => Number(a) - Number(b)).map(([id, value]) => encodeField(id, value)).join("");
150
178
  let payload = encodeField("00", "01") + encodeField("01", dynamic ? "12" : "11") + encodeField(tag, account) + encodeField("52", mcc) + encodeField("53", "586");
151
179
  if (options.amount !== void 0) {
152
180
  payload += encodeField("54", formatAmount(options.amount, 13, "amount"));
@@ -194,10 +222,21 @@ function createMerchantQr(options) {
194
222
  function fieldValue(fields, id) {
195
223
  return fields.find((field) => field.id === id)?.value ?? null;
196
224
  }
225
+ function parseExpiry(value) {
226
+ const match = value ? /^(\d{2})(\d{2})(\d{4})(\d{2})(\d{2})$/.exec(value) : null;
227
+ if (!match) return null;
228
+ const [, dd, mm, yyyy, hh, min] = match;
229
+ const [day, month, year, hour, minute] = [dd, mm, yyyy, hh, min].map(
230
+ Number
231
+ );
232
+ const date = new Date(2e3, month - 1, day, hour, minute);
233
+ date.setFullYear(year);
234
+ const real = date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day && date.getHours() === hour && date.getMinutes() === minute;
235
+ return real ? `${yyyy}-${mm}-${dd}T${hh}:${min}` : null;
236
+ }
197
237
  function toAmount(value) {
198
- if (value === null) return null;
199
- const amount = Number(value);
200
- return Number.isFinite(amount) ? amount : null;
238
+ if (value === null || !/^\d+(\.\d+)?$/.test(value)) return null;
239
+ return Number(value);
201
240
  }
202
241
  function parseRaastQr(payload) {
203
242
  const text = payload.trim();
@@ -240,9 +279,9 @@ function parseRaastQr(payload) {
240
279
  dynamic: fieldValue(fields, "01") === "12",
241
280
  crcValid,
242
281
  iban,
243
- ibanValid: iban !== null && chunkE47SNBWQ_cjs.validateIBAN(iban),
282
+ ibanValid: iban !== null && chunk3IARSCO6_cjs.validateIBAN(iban),
244
283
  amount: toAmount(fieldValue(fields, kind === "p2p" ? "05" : "54")),
245
- expiresAt: expiry && /^\d{12}$/.test(expiry) ? `${expiry.slice(4, 8)}-${expiry.slice(2, 4)}-${expiry.slice(0, 2)}T${expiry.slice(8, 10)}:${expiry.slice(10)}` : null,
284
+ expiresAt: parseExpiry(expiry),
246
285
  bankName: kind === "p2p" ? fieldValue(fields, "03") : null,
247
286
  particulars: kind === "p2p" ? fieldValue(fields, "06") : null,
248
287
  merchantName: kind === "merchant" ? fieldValue(fields, "59") : null,
@@ -254,7 +293,39 @@ function parseRaastQr(payload) {
254
293
  fields
255
294
  };
256
295
  }
296
+ function localDateTime(value) {
297
+ const [date, time] = value.split("T");
298
+ const [year, month, day] = date.split("-").map(Number);
299
+ const [hour, minute] = time.split(":").map(Number);
300
+ return new Date(year, month - 1, day, hour, minute);
301
+ }
302
+ function validateRaastQr(payload, options = {}) {
303
+ const qr = parseRaastQr(payload);
304
+ if (qr === null) {
305
+ return { valid: false, errors: ["not-a-raast-qr"], warnings: [], qr: null };
306
+ }
307
+ const errors = [];
308
+ const warnings = [];
309
+ const now = options.now ?? /* @__PURE__ */ new Date();
310
+ if (!qr.crcValid) errors.push("bad-checksum");
311
+ if (qr.iban === null) errors.push("no-iban");
312
+ else if (!qr.ibanValid) errors.push("invalid-iban");
313
+ if (qr.kind === "p2p") {
314
+ if (qr.dynamic && qr.expiresAt === null) errors.push("missing-expiry");
315
+ if (!qr.dynamic && qr.amount !== null) warnings.push("amount-ignored");
316
+ if (qr.expiresAt !== null) {
317
+ const remaining = localDateTime(qr.expiresAt).getTime() - now.getTime();
318
+ if (remaining <= 0) {
319
+ errors.push("expired");
320
+ } else if (remaining <= (options.expiresSoonMs ?? 36e5)) {
321
+ warnings.push("expires-soon");
322
+ }
323
+ }
324
+ }
325
+ return { valid: errors.length === 0, errors, warnings, qr };
326
+ }
257
327
 
258
328
  exports.createMerchantQr = createMerchantQr;
259
329
  exports.createRaastP2PQr = createRaastP2PQr;
260
330
  exports.parseRaastQr = parseRaastQr;
331
+ exports.validateRaastQr = validateRaastQr;
@@ -63,6 +63,9 @@ var allocatedPrefixes = lazy(
63
63
  networks_default.map((entry) => entry.prefix)
64
64
  )
65
65
  );
66
+ function isAllocatedPrefix(prefix) {
67
+ return allocatedPrefixes().has(prefix);
68
+ }
66
69
  function normalizePhoneDigits(phone) {
67
70
  let digits = stripSeparators(toAsciiDigits(phone));
68
71
  if (digits.startsWith("+")) {
@@ -92,4 +95,4 @@ function getPhonePrefix(phone) {
92
95
  return `0${digits.slice(2, 5)}`;
93
96
  }
94
97
 
95
- export { getPhonePrefix, networks_default, normalizePhoneDigits };
98
+ export { getPhonePrefix, isAllocatedPrefix, networks_default, normalizePhoneDigits };
@@ -1,4 +1,4 @@
1
- import { networks_default, getPhonePrefix } from './chunk-Y6BUGLXU.js';
1
+ import { networks_default, getPhonePrefix } from './chunk-6IPPANNX.js';
2
2
  import { lazy } from './chunk-ENQ7O7VW.js';
3
3
 
4
4
  // src/networks.ts
@@ -143,6 +143,15 @@ var UR_0_TO_99 = [
143
143
  "\u0627\u0679\u06BE\u0627\u0646\u0648\u06D2",
144
144
  "\u0646\u0646\u0627\u0646\u0648\u06D2"
145
145
  ];
146
+ function resolveLanguage(language) {
147
+ const value = language ?? "en";
148
+ if (value !== "en" && value !== "ur") {
149
+ throw new RangeError(
150
+ `language must be 'en' or 'ur', received ${String(value)}`
151
+ );
152
+ }
153
+ return value;
154
+ }
146
155
  function underHundred(n, language) {
147
156
  if (language === "ur") {
148
157
  return UR_0_TO_99[n];
@@ -168,7 +177,7 @@ function convert(n, language) {
168
177
  return [underHundred(n, language)];
169
178
  }
170
179
  function numberToWords(n, options = {}) {
171
- const language = options.language ?? "en";
180
+ const language = resolveLanguage(options.language);
172
181
  if (!Number.isSafeInteger(n)) {
173
182
  throw new RangeError(`Expected a safe integer, received ${String(n)}`);
174
183
  }
@@ -188,7 +197,7 @@ function titleCase(text) {
188
197
  );
189
198
  }
190
199
  function amountInWords(amount, options = {}) {
191
- const language = options.language ?? "en";
200
+ const language = resolveLanguage(options.language);
192
201
  if (!Number.isFinite(amount) || amount < 0) {
193
202
  throw new RangeError(
194
203
  `Amount must be a finite number of zero or more, received ${String(amount)}`
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunk4VVFS6FN_cjs = require('./chunk-4VVFS6FN.cjs');
4
- var chunk3COX5FSL_cjs = require('./chunk-3COX5FSL.cjs');
4
+ var chunkSBS2GHM3_cjs = require('./chunk-SBS2GHM3.cjs');
5
5
  var chunkVPBMIYO2_cjs = require('./chunk-VPBMIYO2.cjs');
6
6
 
7
7
  // src/address.ts
@@ -9,10 +9,10 @@ function byLengthDesc(a, b) {
9
9
  return b.length - a.length;
10
10
  }
11
11
  var cityNames = chunkVPBMIYO2_cjs.lazy(
12
- () => chunk3COX5FSL_cjs.cities_default.map((entry) => entry.city).sort(byLengthDesc)
12
+ () => chunkSBS2GHM3_cjs.cities_default.map((entry) => entry.city).sort(byLengthDesc)
13
13
  );
14
14
  var districtNames = chunkVPBMIYO2_cjs.lazy(
15
- () => chunk3COX5FSL_cjs.districts_default.map((entry) => entry.district).sort(byLengthDesc)
15
+ () => chunkSBS2GHM3_cjs.districts_default.map((entry) => entry.district).sort(byLengthDesc)
16
16
  );
17
17
  var PROVINCES = [
18
18
  "Islamabad Capital Territory",
@@ -82,7 +82,7 @@ function parseAddress(address) {
82
82
  if (postalCode !== null && city === null) {
83
83
  city = chunk4VVFS6FN_cjs.getCityByPostalCode(postalCode);
84
84
  }
85
- const inferredProvince = city !== null ? chunk3COX5FSL_cjs.getProvince(city) ?? chunk3COX5FSL_cjs.getDistrictProvince(city) : district !== null ? chunk3COX5FSL_cjs.getDistrictProvince(district) : null;
85
+ const inferredProvince = city !== null ? chunkSBS2GHM3_cjs.getProvince(city) ?? chunkSBS2GHM3_cjs.getDistrictProvince(city) : district !== null ? chunkSBS2GHM3_cjs.getDistrictProvince(district) : null;
86
86
  if (province === null) {
87
87
  province = inferredProvince;
88
88
  } else if (inferredProvince !== null && inferredProvince !== province) {
@@ -1,4 +1,4 @@
1
- import { normalizePhoneDigits } from './chunk-Y6BUGLXU.js';
1
+ import { normalizePhoneDigits } from './chunk-6IPPANNX.js';
2
2
 
3
3
  // src/whatsapp.ts
4
4
  function createWhatsAppLink(phone, message) {
@@ -1,20 +1,20 @@
1
1
  'use strict';
2
2
 
3
- var chunkBSS4Z7NI_cjs = require('./chunk-BSS4Z7NI.cjs');
4
- var chunkPHHKIMO2_cjs = require('./chunk-PHHKIMO2.cjs');
3
+ var chunk3ZA265SK_cjs = require('./chunk-3ZA265SK.cjs');
4
+ var chunk33FXHM2E_cjs = require('./chunk-33FXHM2E.cjs');
5
5
  var chunkH6M6L26S_cjs = require('./chunk-H6M6L26S.cjs');
6
6
  var chunkHTCSHHOR_cjs = require('./chunk-HTCSHHOR.cjs');
7
- var chunkE47SNBWQ_cjs = require('./chunk-E47SNBWQ.cjs');
7
+ var chunk3IARSCO6_cjs = require('./chunk-3IARSCO6.cjs');
8
8
 
9
9
  // src/adapters/rules.ts
10
10
  var RULES = {
11
11
  cnic: { test: chunkHTCSHHOR_cjs.validateCNIC, message: "Invalid CNIC number" },
12
- phone: { test: chunkPHHKIMO2_cjs.validatePhone, message: "Invalid Pakistani mobile number" },
13
- iban: { test: chunkE47SNBWQ_cjs.validateIBAN, message: "Invalid Pakistani IBAN" },
12
+ phone: { test: chunk33FXHM2E_cjs.validatePhone, message: "Invalid Pakistani mobile number" },
13
+ iban: { test: chunk3IARSCO6_cjs.validateIBAN, message: "Invalid Pakistani IBAN" },
14
14
  ntn: { test: chunkH6M6L26S_cjs.validateNTN, message: "Invalid NTN" },
15
15
  strn: { test: chunkH6M6L26S_cjs.validateSTRN, message: "Invalid STRN" },
16
16
  landline: {
17
- test: chunkBSS4Z7NI_cjs.validateLandline,
17
+ test: chunk3ZA265SK_cjs.validateLandline,
18
18
  message: "Invalid Pakistani landline number"
19
19
  }
20
20
  };
@@ -145,6 +145,15 @@ var UR_0_TO_99 = [
145
145
  "\u0627\u0679\u06BE\u0627\u0646\u0648\u06D2",
146
146
  "\u0646\u0646\u0627\u0646\u0648\u06D2"
147
147
  ];
148
+ function resolveLanguage(language) {
149
+ const value = language ?? "en";
150
+ if (value !== "en" && value !== "ur") {
151
+ throw new RangeError(
152
+ `language must be 'en' or 'ur', received ${String(value)}`
153
+ );
154
+ }
155
+ return value;
156
+ }
148
157
  function underHundred(n, language) {
149
158
  if (language === "ur") {
150
159
  return UR_0_TO_99[n];
@@ -170,7 +179,7 @@ function convert(n, language) {
170
179
  return [underHundred(n, language)];
171
180
  }
172
181
  function numberToWords(n, options = {}) {
173
- const language = options.language ?? "en";
182
+ const language = resolveLanguage(options.language);
174
183
  if (!Number.isSafeInteger(n)) {
175
184
  throw new RangeError(`Expected a safe integer, received ${String(n)}`);
176
185
  }
@@ -190,7 +199,7 @@ function titleCase(text) {
190
199
  );
191
200
  }
192
201
  function amountInWords(amount, options = {}) {
193
- const language = options.language ?? "en";
202
+ const language = resolveLanguage(options.language);
194
203
  if (!Number.isFinite(amount) || amount < 0) {
195
204
  throw new RangeError(
196
205
  `Amount must be a finite number of zero or more, received ${String(amount)}`
@@ -1,19 +1,19 @@
1
1
  'use strict';
2
2
 
3
- var chunkYLWZGSFY_cjs = require('./chunk-YLWZGSFY.cjs');
3
+ var chunkNTD4JLDW_cjs = require('./chunk-NTD4JLDW.cjs');
4
4
  var chunkVPBMIYO2_cjs = require('./chunk-VPBMIYO2.cjs');
5
5
 
6
6
  // src/networks.ts
7
7
  var prefixMap = chunkVPBMIYO2_cjs.lazy(
8
8
  () => new Map(
9
- chunkYLWZGSFY_cjs.networks_default.map((entry) => [
9
+ chunkNTD4JLDW_cjs.networks_default.map((entry) => [
10
10
  entry.prefix,
11
11
  entry.network
12
12
  ])
13
13
  )
14
14
  );
15
15
  function getNetwork(phone) {
16
- const prefix = chunkYLWZGSFY_cjs.getPhonePrefix(phone);
16
+ const prefix = chunkNTD4JLDW_cjs.getPhonePrefix(phone);
17
17
  if (prefix === null) {
18
18
  return "Unknown";
19
19
  }
@@ -1,8 +1,8 @@
1
- import { validateLandline } from './chunk-T3E4B5MJ.js';
2
- import { validatePhone } from './chunk-432ZYMYV.js';
1
+ import { validateLandline } from './chunk-RXNYY5K5.js';
2
+ import { validatePhone } from './chunk-PLDVGOKZ.js';
3
3
  import { validateSTRN, validateNTN } from './chunk-CEPNSHIC.js';
4
4
  import { validateCNIC } from './chunk-EEVNLTB4.js';
5
- import { validateIBAN } from './chunk-4EUKCSLW.js';
5
+ import { validateIBAN } from './chunk-YPPKY5XZ.js';
6
6
 
7
7
  // src/adapters/rules.ts
8
8
  var RULES = {
@@ -1,5 +1,5 @@
1
1
  import { getCityByPostalCode } from './chunk-LIYNKIKS.js';
2
- import { cities_default, districts_default, getProvince, getDistrictProvince } from './chunk-K6CZFCX6.js';
2
+ import { cities_default, districts_default, getProvince, getDistrictProvince } from './chunk-J272OMDL.js';
3
3
  import { lazy, normalizeWhitespace, normalizeKey } from './chunk-ENQ7O7VW.js';
4
4
 
5
5
  // src/address.ts
@@ -914,6 +914,10 @@ var districts_default = [
914
914
  district: "Abbottabad",
915
915
  province: "Khyber Pakhtunkhwa"
916
916
  },
917
+ {
918
+ district: "Allai",
919
+ province: "Khyber Pakhtunkhwa"
920
+ },
917
921
  {
918
922
  district: "Astore",
919
923
  province: "Gilgit-Baltistan"
@@ -954,6 +958,10 @@ var districts_default = [
954
958
  district: "Barkhan",
955
959
  province: "Balochistan"
956
960
  },
961
+ {
962
+ district: "Barshore",
963
+ province: "Balochistan"
964
+ },
957
965
  {
958
966
  district: "Batagram",
959
967
  province: "Khyber Pakhtunkhwa"
@@ -970,6 +978,10 @@ var districts_default = [
970
978
  district: "Buner",
971
979
  province: "Khyber Pakhtunkhwa"
972
980
  },
981
+ {
982
+ district: "Central Dir",
983
+ province: "Khyber Pakhtunkhwa"
984
+ },
973
985
  {
974
986
  district: "Chagai",
975
987
  province: "Balochistan"
@@ -998,10 +1010,6 @@ var districts_default = [
998
1010
  district: "Darel",
999
1011
  province: "Gilgit-Baltistan"
1000
1012
  },
1001
- {
1002
- district: "Dera Bugti",
1003
- province: "Balochistan"
1004
- },
1005
1013
  {
1006
1014
  district: "Dera Ghazi Khan",
1007
1015
  province: "Punjab"
@@ -1358,6 +1366,10 @@ var districts_default = [
1358
1366
  district: "Neelam",
1359
1367
  province: "Azad Jammu and Kashmir"
1360
1368
  },
1369
+ {
1370
+ district: "North Dera Bugti",
1371
+ province: "Balochistan"
1372
+ },
1361
1373
  {
1362
1374
  district: "North Waziristan",
1363
1375
  province: "Khyber Pakhtunkhwa"
@@ -1378,6 +1390,10 @@ var districts_default = [
1378
1390
  district: "Orakzai",
1379
1391
  province: "Khyber Pakhtunkhwa"
1380
1392
  },
1393
+ {
1394
+ district: "Paharpur",
1395
+ province: "Khyber Pakhtunkhwa"
1396
+ },
1381
1397
  {
1382
1398
  district: "Pakpattan",
1383
1399
  province: "Punjab"
@@ -1403,7 +1419,11 @@ var districts_default = [
1403
1419
  province: "Sindh"
1404
1420
  },
1405
1421
  {
1406
- district: "Quetta",
1422
+ district: "Quetta East",
1423
+ province: "Balochistan"
1424
+ },
1425
+ {
1426
+ district: "Quetta West",
1407
1427
  province: "Balochistan"
1408
1428
  },
1409
1429
  {
@@ -1474,6 +1494,10 @@ var districts_default = [
1474
1494
  district: "Sohbatpur",
1475
1495
  province: "Balochistan"
1476
1496
  },
1497
+ {
1498
+ district: "South Dera Bugti",
1499
+ province: "Balochistan"
1500
+ },
1477
1501
  {
1478
1502
  district: "Sudhnuti",
1479
1503
  province: "Azad Jammu and Kashmir"
@@ -1538,6 +1562,10 @@ var districts_default = [
1538
1562
  district: "Tor Ghar",
1539
1563
  province: "Khyber Pakhtunkhwa"
1540
1564
  },
1565
+ {
1566
+ district: "Tump",
1567
+ province: "Balochistan"
1568
+ },
1541
1569
  {
1542
1570
  district: "Umerkot",
1543
1571
  province: "Sindh"
@@ -1558,6 +1586,10 @@ var districts_default = [
1558
1586
  district: "Upper South Waziristan",
1559
1587
  province: "Khyber Pakhtunkhwa"
1560
1588
  },
1589
+ {
1590
+ district: "Upper Swat",
1591
+ province: "Khyber Pakhtunkhwa"
1592
+ },
1561
1593
  {
1562
1594
  district: "Usta Muhammad",
1563
1595
  province: "Balochistan"
@@ -1566,6 +1598,10 @@ var districts_default = [
1566
1598
  district: "Vehari",
1567
1599
  province: "Punjab"
1568
1600
  },
1601
+ {
1602
+ district: "Wadh",
1603
+ province: "Balochistan"
1604
+ },
1569
1605
  {
1570
1606
  district: "Washuk",
1571
1607
  province: "Balochistan"
@@ -1619,8 +1655,17 @@ function getDistrictProvince(district) {
1619
1655
  if (key.length === 0) {
1620
1656
  return null;
1621
1657
  }
1622
- return districtLookup().get(key) ?? null;
1658
+ return districtLookup().get(key) ?? (Object.hasOwn(FORMER_DISTRICTS, key) ? FORMER_DISTRICTS[key] : null) ?? null;
1623
1659
  }
1660
+ var FORMER_DISTRICTS = {
1661
+ // Split into Lower and Upper South Waziristan (2022).
1662
+ "south waziristan": "Khyber Pakhtunkhwa",
1663
+ // Split into Quetta East and Quetta West (2026).
1664
+ quetta: "Balochistan",
1665
+ // Became South Dera Bugti; Upper Dera Bugti became North Dera Bugti (2026).
1666
+ "dera bugti": "Balochistan",
1667
+ "upper dera bugti": "Balochistan"
1668
+ };
1624
1669
  function searchDistricts(query) {
1625
1670
  const normalizedQuery = normalizeKey(query);
1626
1671
  if (normalizedQuery.length === 0) {
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkYLWZGSFY_cjs = require('./chunk-YLWZGSFY.cjs');
3
+ var chunkNTD4JLDW_cjs = require('./chunk-NTD4JLDW.cjs');
4
4
 
5
5
  // src/whatsapp.ts
6
6
  function createWhatsAppLink(phone, message) {
7
- const digits = chunkYLWZGSFY_cjs.normalizePhoneDigits(phone);
7
+ const digits = chunkNTD4JLDW_cjs.normalizePhoneDigits(phone);
8
8
  if (digits === null) {
9
9
  return null;
10
10
  }
@@ -65,6 +65,9 @@ var allocatedPrefixes = chunkVPBMIYO2_cjs.lazy(
65
65
  networks_default.map((entry) => entry.prefix)
66
66
  )
67
67
  );
68
+ function isAllocatedPrefix(prefix) {
69
+ return allocatedPrefixes().has(prefix);
70
+ }
68
71
  function normalizePhoneDigits(phone) {
69
72
  let digits = chunkVPBMIYO2_cjs.stripSeparators(chunkVPBMIYO2_cjs.toAsciiDigits(phone));
70
73
  if (digits.startsWith("+")) {
@@ -95,5 +98,6 @@ function getPhonePrefix(phone) {
95
98
  }
96
99
 
97
100
  exports.getPhonePrefix = getPhonePrefix;
101
+ exports.isAllocatedPrefix = isAllocatedPrefix;
98
102
  exports.networks_default = networks_default;
99
103
  exports.normalizePhoneDigits = normalizePhoneDigits;