@handijitcom/tr 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/LICENSE +21 -0
- package/README.md +418 -2
- package/build/index.cjs +556 -0
- package/build/index.cjs.map +1 -0
- package/build/index.d.mts +102 -0
- package/build/index.d.ts +102 -0
- package/build/index.mjs +533 -0
- package/build/index.mjs.map +1 -0
- package/build/index.umd.js +2 -0
- package/build/index.umd.js.map +1 -0
- package/package.json +95 -4
package/build/index.mjs
ADDED
|
@@ -0,0 +1,533 @@
|
|
|
1
|
+
/** Names a value's type for an error message; `typeof null` alone would say "object". */
|
|
2
|
+
const describeType = (value) => value === null ? "null" : typeof value;
|
|
3
|
+
/** Throws a TypeError naming the caller when a required text argument is not a string. */
|
|
4
|
+
const assertString = (value, fnName, param) => {
|
|
5
|
+
if (typeof value !== "string") {
|
|
6
|
+
throw new TypeError(`${fnName}: expected ${param} to be a string, received ${describeType(value)}`);
|
|
7
|
+
}
|
|
8
|
+
return value;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/** 100% expressed in basis points; rates carry at most two decimals (e.g. 0.25%). */
|
|
12
|
+
const BASIS = 10000n;
|
|
13
|
+
/** Reads an amount of kuruş as a bigint, so no float ever enters money arithmetic. */
|
|
14
|
+
const toKurus = (value, fnName) => {
|
|
15
|
+
if (typeof value === "bigint")
|
|
16
|
+
return value;
|
|
17
|
+
if (typeof value !== "number") {
|
|
18
|
+
throw new TypeError(`${fnName}: expected an integer amount of kuruş (number or bigint), received ${describeType(value)}`);
|
|
19
|
+
}
|
|
20
|
+
// A fraction of a kuruş or an unsafe integer has already lost precision; guessing would corrupt money.
|
|
21
|
+
if (!Number.isSafeInteger(value)) {
|
|
22
|
+
throw new RangeError(`${fnName}: expected a safe integer amount of kuruş, received ${value}; pass a bigint for larger amounts`);
|
|
23
|
+
}
|
|
24
|
+
return BigInt(value);
|
|
25
|
+
};
|
|
26
|
+
/** Hands the result back in the caller's numeric type; a number result must stay a safe integer. */
|
|
27
|
+
const fromKurus = (amount, asBigint, fnName) => {
|
|
28
|
+
if (asBigint)
|
|
29
|
+
return amount;
|
|
30
|
+
const result = Number(amount);
|
|
31
|
+
if (!Number.isSafeInteger(result)) {
|
|
32
|
+
throw new RangeError(`${fnName}: the result ${amount} exceeds Number.MAX_SAFE_INTEGER; pass the amount as a bigint`);
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
/** Integer division rounded half away from zero, so a refund mirrors its sale exactly. */
|
|
37
|
+
const divRound = (numerator, divisor) => {
|
|
38
|
+
const quotient = numerator / divisor;
|
|
39
|
+
const remainder = numerator % divisor;
|
|
40
|
+
const twiceRemainder = (remainder < 0n ? -remainder : remainder) * 2n;
|
|
41
|
+
if (twiceRemainder < divisor)
|
|
42
|
+
return quotient;
|
|
43
|
+
return numerator < 0n ? quotient - 1n : quotient + 1n;
|
|
44
|
+
};
|
|
45
|
+
/** Converts a VAT rate in percent (20, 10, 1, 0.5) to integer basis points. */
|
|
46
|
+
const toBasisPoints = (ratePercent, fnName) => {
|
|
47
|
+
if (typeof ratePercent !== "number") {
|
|
48
|
+
throw new TypeError(`${fnName}: expected ratePercent to be a number, received ${describeType(ratePercent)}`);
|
|
49
|
+
}
|
|
50
|
+
const basisPoints = Math.round(ratePercent * 100);
|
|
51
|
+
// The tolerance absorbs binary noise such as 0.07 * 100 = 7.000000000000001.
|
|
52
|
+
if (!(ratePercent >= 0) ||
|
|
53
|
+
!Number.isSafeInteger(basisPoints) ||
|
|
54
|
+
Math.abs(ratePercent * 100 - basisPoints) > 1e-6) {
|
|
55
|
+
throw new RangeError(`${fnName}: expected a non-negative VAT rate in percent with at most two decimals (like 20 or 0.5), received ${ratePercent}`);
|
|
56
|
+
}
|
|
57
|
+
return BigInt(basisPoints);
|
|
58
|
+
};
|
|
59
|
+
/** VAT owed on a net amount, rounded half away from zero to the kuruş. */
|
|
60
|
+
const vatOnNet = (net, basisPoints) => divRound(net * basisPoints, BASIS);
|
|
61
|
+
/** The net part of a gross (VAT-included) amount, rounded half away from zero to the kuruş. */
|
|
62
|
+
const netOfGross = (gross, basisPoints) => divRound(gross * BASIS, BASIS + basisPoints);
|
|
63
|
+
|
|
64
|
+
/** Adds VAT to a net amount of kuruş: addVat(10000, 20) → 12000. The VAT is rounded half away from zero. */
|
|
65
|
+
const addVat = ((kurus, ratePercent) => {
|
|
66
|
+
const net = toKurus(kurus, "addVat");
|
|
67
|
+
const basisPoints = toBasisPoints(ratePercent, "addVat");
|
|
68
|
+
return fromKurus(net + vatOnNet(net, basisPoints), typeof kurus === "bigint", "addVat");
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// Created on first use rather than at import time; building a collator is not free.
|
|
72
|
+
let collator;
|
|
73
|
+
/** Compares two strings in Turkish alphabetical order (c < ç < d, ı < i); pass it to `sort`. */
|
|
74
|
+
const compareTr = (a, b) => {
|
|
75
|
+
assertString(a, "compareTr", "a");
|
|
76
|
+
assertString(b, "compareTr", "b");
|
|
77
|
+
collator ??= new Intl.Collator("tr");
|
|
78
|
+
return collator.compare(a, b);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// "İ" may also arrive decomposed as "I" + combining dot above (U+0307).
|
|
82
|
+
const DOTTED_CAPITAL_I = /İ|İ/g;
|
|
83
|
+
const DOTLESS_CAPITAL_I = /I/g;
|
|
84
|
+
const DOTTED_SMALL_I = /i/g;
|
|
85
|
+
const DOTLESS_SMALL_I = /ı/g;
|
|
86
|
+
const COMBINING_MARKS = /\p{M}/gu;
|
|
87
|
+
/** Lower-cases with Turkish rules (I → ı, İ → i) regardless of the runtime's default locale. */
|
|
88
|
+
const lowerTr = (text) => text
|
|
89
|
+
.replace(DOTTED_CAPITAL_I, "i")
|
|
90
|
+
.replace(DOTLESS_CAPITAL_I, "ı")
|
|
91
|
+
.toLowerCase();
|
|
92
|
+
/** Upper-cases with Turkish rules (i → İ, ı → I) regardless of the runtime's default locale. */
|
|
93
|
+
const upperTr = (text) => text.replace(DOTTED_SMALL_I, "İ").replace(DOTLESS_SMALL_I, "I").toUpperCase();
|
|
94
|
+
/**
|
|
95
|
+
* Strips diacritics from lower-cased text: ç→c ğ→g ı→i ö→o ş→s ü→u â→a î→i û→u (and é, ñ...).
|
|
96
|
+
* Canonical decomposition splits each letter from its mark; "ı" has no decomposition of its own.
|
|
97
|
+
*/
|
|
98
|
+
const foldDiacritics = (lowerText) => lowerText
|
|
99
|
+
.normalize("NFD")
|
|
100
|
+
.replace(COMBINING_MARKS, "")
|
|
101
|
+
.replace(DOTLESS_SMALL_I, "i");
|
|
102
|
+
|
|
103
|
+
const WHITESPACE_RUN = /\s+/g;
|
|
104
|
+
/** Normalizes text for search: " IŞIK Çağrı " → "isik cagri". Punctuation is kept. */
|
|
105
|
+
const foldTurkish = (text) => foldDiacritics(lowerTr(assertString(text, "foldTurkish", "text")))
|
|
106
|
+
.replace(WHITESPACE_RUN, " ")
|
|
107
|
+
.trim();
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Türkiye has stayed on UTC+03:00 all year since September 2016. A fixed offset makes a date read
|
|
111
|
+
* the same on a UTC server and in the browser (no hydration mismatch) without time-zone data.
|
|
112
|
+
*/
|
|
113
|
+
const TURKIYE_OFFSET_MS = 3 * 60 * 60 * 1000;
|
|
114
|
+
|
|
115
|
+
const pad = (value, length) => String(value).padStart(length, "0");
|
|
116
|
+
/** Formats a Date or epoch milliseconds as "dd.MM.yyyy" in Türkiye time (UTC+03:00). */
|
|
117
|
+
const formatDateTr = (date) => {
|
|
118
|
+
let time;
|
|
119
|
+
// The tag check also accepts a Date from another realm (iframe, vm), where instanceof fails.
|
|
120
|
+
if (Object.prototype.toString.call(date) === "[object Date]") {
|
|
121
|
+
time = Date.prototype.getTime.call(date);
|
|
122
|
+
}
|
|
123
|
+
else if (typeof date === "number") {
|
|
124
|
+
time = date;
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
throw new TypeError(`formatDateTr: expected a Date or epoch milliseconds, received ${describeType(date)}`);
|
|
128
|
+
}
|
|
129
|
+
const shifted = new Date(time + TURKIYE_OFFSET_MS);
|
|
130
|
+
const year = shifted.getUTCFullYear();
|
|
131
|
+
// NaN (an invalid date) fails both comparisons, as does a year "yyyy" cannot hold.
|
|
132
|
+
if (!(year >= 0 && year <= 9999)) {
|
|
133
|
+
throw new RangeError(`formatDateTr: expected a valid date between the years 0 and 9999, received ${String(date)}`);
|
|
134
|
+
}
|
|
135
|
+
return `${pad(shifted.getUTCDate(), 2)}.${pad(shifted.getUTCMonth() + 1, 2)}.${pad(year, 4)}`;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const WHITESPACE$1 = /\s+/g;
|
|
139
|
+
// A Turkish IBAN: "TR", two check digits and 24 digits (bank code, reserved digit, account).
|
|
140
|
+
const TR_IBAN_PATTERN = /^TR\d{24}$/;
|
|
141
|
+
// "TR" as ISO 13616 digits: T = 29, R = 27.
|
|
142
|
+
const TR_AS_DIGITS = "2927";
|
|
143
|
+
/** Checks a Turkish IBAN: 26 characters and the mod-97 check. Spaces and lower case are accepted. Non-strings → false. */
|
|
144
|
+
const isIban = (value) => {
|
|
145
|
+
if (typeof value !== "string")
|
|
146
|
+
return false;
|
|
147
|
+
const iban = value.replace(WHITESPACE$1, "").toUpperCase();
|
|
148
|
+
if (!TR_IBAN_PATTERN.test(iban))
|
|
149
|
+
return false;
|
|
150
|
+
// ISO 13616: move the country code and check digits to the end; a valid IBAN leaves remainder 1.
|
|
151
|
+
// Folding digit by digit keeps every step far below Number.MAX_SAFE_INTEGER.
|
|
152
|
+
const rearranged = iban.slice(4) + TR_AS_DIGITS + iban.slice(2, 4);
|
|
153
|
+
let remainder = 0;
|
|
154
|
+
for (let i = 0; i < rearranged.length; i++) {
|
|
155
|
+
remainder = (remainder * 10 + rearranged.charCodeAt(i) - 48) % 97;
|
|
156
|
+
}
|
|
157
|
+
return remainder === 1;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const WHITESPACE = /\s+/g;
|
|
161
|
+
/** Formats a valid Turkish IBAN in groups of four: "TR33 0006 1005 1978 6457 8413 26". Invalid → undefined. */
|
|
162
|
+
const formatIban = (value) => {
|
|
163
|
+
if (typeof value !== "string" || !isIban(value))
|
|
164
|
+
return undefined;
|
|
165
|
+
const iban = value.replace(WHITESPACE, "").toUpperCase();
|
|
166
|
+
const groups = [];
|
|
167
|
+
for (let i = 0; i < iban.length; i += 4)
|
|
168
|
+
groups.push(iban.slice(i, i + 4));
|
|
169
|
+
return groups.join(" ");
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
/** Inserts a dot every three digits from the right: "1234567" → "1.234.567". */
|
|
173
|
+
const groupThousands = (digits) => {
|
|
174
|
+
const headLength = digits.length % 3 === 0 ? 3 : digits.length % 3;
|
|
175
|
+
let grouped = digits.slice(0, headLength);
|
|
176
|
+
for (let i = headLength; i < digits.length; i += 3) {
|
|
177
|
+
grouped += `.${digits.slice(i, i + 3)}`;
|
|
178
|
+
}
|
|
179
|
+
return grouped;
|
|
180
|
+
};
|
|
181
|
+
/** Formats integer kuruş as Turkish lira: 123456 → "₺1.234,56", -5 → "-₺0,05". */
|
|
182
|
+
const formatLira = (kurus, { symbol, fraction } = {}) => {
|
|
183
|
+
const exact = toKurus(kurus, "formatLira");
|
|
184
|
+
const showFraction = fraction !== false;
|
|
185
|
+
// Rounded first, so -49 kuruş shown without kuruş reads "₺0" and not "-₺0".
|
|
186
|
+
const amount = showFraction ? exact : divRound(exact, 100n);
|
|
187
|
+
const isNegative = amount < 0n;
|
|
188
|
+
const absolute = isNegative ? -amount : amount;
|
|
189
|
+
const body = showFraction
|
|
190
|
+
? `${groupThousands((absolute / 100n).toString())},${(absolute % 100n).toString().padStart(2, "0")}`
|
|
191
|
+
: groupThousands(absolute.toString());
|
|
192
|
+
return `${isNegative ? "-" : ""}${symbol === false ? "" : "₺"}${body}`;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
const SEPARATORS = /[\s().-]/g;
|
|
196
|
+
// Optional country or trunk prefix, then a 10-digit national number. Turkish national numbers
|
|
197
|
+
// start with 2, 3 or 4 (landline), 5 (mobile) or 8 (850 and other non-geographic numbers).
|
|
198
|
+
const PHONE_PATTERN = /^(?:\+90|0090|90|0)?([2-58]\d{9})$/;
|
|
199
|
+
/** Normalizes a Turkish phone number to E.164: "0 (532) 123 45 67" → "+905321234567". Invalid → undefined. */
|
|
200
|
+
const normalizePhone = (value) => {
|
|
201
|
+
if (typeof value !== "string")
|
|
202
|
+
return undefined;
|
|
203
|
+
const match = PHONE_PATTERN.exec(value.replace(SEPARATORS, ""));
|
|
204
|
+
return match === null ? undefined : `+90${match[1]}`;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
/** Formats a Turkish phone number for display: "+905321234567" → "0532 123 45 67". Invalid → undefined. */
|
|
208
|
+
const formatPhone = (value) => {
|
|
209
|
+
const e164 = normalizePhone(value);
|
|
210
|
+
if (e164 === undefined)
|
|
211
|
+
return undefined;
|
|
212
|
+
return `0${e164.slice(3, 6)} ${e164.slice(6, 9)} ${e164.slice(9, 11)} ${e164.slice(11)}`;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
/** Checks for a Turkish mobile number (national number starting with 5) in any form normalizePhone accepts. */
|
|
216
|
+
const isMobilePhone = (value) => normalizePhone(value)?.startsWith("+905") === true;
|
|
217
|
+
|
|
218
|
+
// Eleven digits, never starting with zero.
|
|
219
|
+
const TCKN_PATTERN = /^[1-9]\d{10}$/;
|
|
220
|
+
/** Checks a Turkish identity number (T.C. Kimlik No): format and both check digits. Non-strings → false. */
|
|
221
|
+
const isTckn = (value) => {
|
|
222
|
+
if (typeof value !== "string" || !TCKN_PATTERN.test(value))
|
|
223
|
+
return false;
|
|
224
|
+
const digit = (index) => value.charCodeAt(index) - 48;
|
|
225
|
+
const oddSum = digit(0) + digit(2) + digit(4) + digit(6) + digit(8);
|
|
226
|
+
const evenSum = digit(1) + digit(3) + digit(5) + digit(7);
|
|
227
|
+
// The difference can be negative; the extra + 10 keeps the remainder in 0–9.
|
|
228
|
+
const tenth = (((oddSum * 7 - evenSum) % 10) + 10) % 10;
|
|
229
|
+
const eleventh = (oddSum + evenSum + digit(9)) % 10;
|
|
230
|
+
return tenth === digit(9) && eleventh === digit(10);
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
const VKN_PATTERN = /^\d{10}$/;
|
|
234
|
+
/** Checks a Turkish tax number (Vergi Kimlik No): ten digits and the check digit. Non-strings → false. */
|
|
235
|
+
const isVkn = (value) => {
|
|
236
|
+
if (typeof value !== "string" || !VKN_PATTERN.test(value))
|
|
237
|
+
return false;
|
|
238
|
+
const digit = (index) => value.charCodeAt(index) - 48;
|
|
239
|
+
let sum = 0;
|
|
240
|
+
for (let i = 0; i < 9; i++) {
|
|
241
|
+
const shifted = (digit(i) + 9 - i) % 10;
|
|
242
|
+
let weighted = (shifted * 2 ** (9 - i)) % 9;
|
|
243
|
+
// The published algorithm counts a non-zero multiple of 9 as 9, not 0.
|
|
244
|
+
if (shifted !== 0 && weighted === 0)
|
|
245
|
+
weighted = 9;
|
|
246
|
+
sum += weighted;
|
|
247
|
+
}
|
|
248
|
+
return (10 - (sum % 10)) % 10 === digit(9);
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
const ONES = [
|
|
252
|
+
"",
|
|
253
|
+
"bir",
|
|
254
|
+
"iki",
|
|
255
|
+
"üç",
|
|
256
|
+
"dört",
|
|
257
|
+
"beş",
|
|
258
|
+
"altı",
|
|
259
|
+
"yedi",
|
|
260
|
+
"sekiz",
|
|
261
|
+
"dokuz",
|
|
262
|
+
];
|
|
263
|
+
const TENS = [
|
|
264
|
+
"",
|
|
265
|
+
"on",
|
|
266
|
+
"yirmi",
|
|
267
|
+
"otuz",
|
|
268
|
+
"kırk",
|
|
269
|
+
"elli",
|
|
270
|
+
"altmış",
|
|
271
|
+
"yetmiş",
|
|
272
|
+
"seksen",
|
|
273
|
+
"doksan",
|
|
274
|
+
];
|
|
275
|
+
const SCALES = [
|
|
276
|
+
"",
|
|
277
|
+
"bin",
|
|
278
|
+
"milyon",
|
|
279
|
+
"milyar",
|
|
280
|
+
"trilyon",
|
|
281
|
+
"katrilyon",
|
|
282
|
+
"kentilyon",
|
|
283
|
+
];
|
|
284
|
+
// One past the largest amount the scale words above can name (999 kentilyon 999 katrilyon...).
|
|
285
|
+
const LIRA_LIMIT = 10n ** 21n;
|
|
286
|
+
/** Words for 1–999. Turkish says "yüz", not "bir yüz". */
|
|
287
|
+
const hundredsInWords = (group) => {
|
|
288
|
+
const hundreds = Math.floor(group / 100);
|
|
289
|
+
const tens = Math.floor(group / 10) % 10;
|
|
290
|
+
const ones = group % 10;
|
|
291
|
+
const words = [];
|
|
292
|
+
if (hundreds > 1)
|
|
293
|
+
words.push(ONES[hundreds]);
|
|
294
|
+
if (hundreds > 0)
|
|
295
|
+
words.push("yüz");
|
|
296
|
+
if (tens > 0)
|
|
297
|
+
words.push(TENS[tens]);
|
|
298
|
+
if (ones > 0)
|
|
299
|
+
words.push(ONES[ones]);
|
|
300
|
+
return words;
|
|
301
|
+
};
|
|
302
|
+
/** Words for a positive whole number. Turkish says "bin", not "bir bin", but "bir milyon". */
|
|
303
|
+
const integerInWords = (value) => {
|
|
304
|
+
const words = [];
|
|
305
|
+
let rest = value;
|
|
306
|
+
for (let scale = 0; rest > 0n; scale++, rest /= 1000n) {
|
|
307
|
+
const group = Number(rest % 1000n);
|
|
308
|
+
if (group === 0)
|
|
309
|
+
continue;
|
|
310
|
+
const groupWords = scale === 1 && group === 1 ? [] : hundredsInWords(group);
|
|
311
|
+
if (scale > 0)
|
|
312
|
+
groupWords.push(SCALES[scale]);
|
|
313
|
+
words.unshift(...groupWords);
|
|
314
|
+
}
|
|
315
|
+
return words;
|
|
316
|
+
};
|
|
317
|
+
/** Spells integer kuruş out in Turkish: 123456 → "bin iki yüz otuz dört lira elli altı kuruş". */
|
|
318
|
+
const liraInWords = (kurus) => {
|
|
319
|
+
const amount = toKurus(kurus, "liraInWords");
|
|
320
|
+
if (amount === 0n)
|
|
321
|
+
return "sıfır lira";
|
|
322
|
+
const absolute = amount < 0n ? -amount : amount;
|
|
323
|
+
const lira = absolute / 100n;
|
|
324
|
+
if (lira >= LIRA_LIMIT) {
|
|
325
|
+
throw new RangeError(`liraInWords: amounts of ${LIRA_LIMIT} lira or more have no Turkish scale word, received ${amount} kuruş`);
|
|
326
|
+
}
|
|
327
|
+
const kurusPart = Number(absolute % 100n);
|
|
328
|
+
const words = amount < 0n ? ["eksi"] : [];
|
|
329
|
+
if (lira > 0n)
|
|
330
|
+
words.push(...integerInWords(lira), "lira");
|
|
331
|
+
if (kurusPart > 0)
|
|
332
|
+
words.push(...hundredsInWords(kurusPart), "kuruş");
|
|
333
|
+
return words.join(" ");
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
// d.M.yyyy or dd.MM.yyyy; "/" is accepted too, but the two separators must match.
|
|
337
|
+
const DATE_PATTERN = /^(\d{1,2})([./])(\d{1,2})\2(\d{4})$/;
|
|
338
|
+
/** Reads "dd.MM.yyyy" as the start of that day in Türkiye time (UTC+03:00). Impossible dates → undefined. */
|
|
339
|
+
const parseDateTr = (text) => {
|
|
340
|
+
if (typeof text !== "string")
|
|
341
|
+
return undefined;
|
|
342
|
+
const match = DATE_PATTERN.exec(text.trim());
|
|
343
|
+
if (match === null)
|
|
344
|
+
return undefined;
|
|
345
|
+
const day = Number(match[1]);
|
|
346
|
+
const month = Number(match[3]);
|
|
347
|
+
const year = Number(match[4]);
|
|
348
|
+
// setUTCFullYear, unlike Date.UTC, does not map the years 0–99 to 1900–1999.
|
|
349
|
+
const utcMidnight = new Date(0);
|
|
350
|
+
utcMidnight.setUTCFullYear(year, month - 1, day);
|
|
351
|
+
// Date rolls 31.04 over to 01.05 and month 13 into the next year; a roll-over means "no such day".
|
|
352
|
+
if (utcMidnight.getUTCDate() !== day ||
|
|
353
|
+
utcMidnight.getUTCMonth() !== month - 1) {
|
|
354
|
+
return undefined;
|
|
355
|
+
}
|
|
356
|
+
return new Date(utcMidnight.getTime() - TURKIYE_OFFSET_MS);
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Optional minus, optional "₺", then lira either grouped with dots ("1.234.567") or plain
|
|
361
|
+
* ("1234567"), an optional comma with one or two kuruş digits, and an optional "₺" / "TL" / "TRY".
|
|
362
|
+
*/
|
|
363
|
+
const AMOUNT_PATTERN = /^(-)?\s*(?:₺\s*)?(\d{1,3}(?:\.\d{3})+|\d+)(?:,(\d{1,2}))?\s*(?:₺|TL|TRY)?$/i;
|
|
364
|
+
/** Reads a Turkish-formatted lira amount as integer kuruş: "1.234,56" → 123456; anything else → undefined. */
|
|
365
|
+
const parseLira = (text) => {
|
|
366
|
+
if (typeof text !== "string")
|
|
367
|
+
return undefined;
|
|
368
|
+
const match = AMOUNT_PATTERN.exec(text.trim());
|
|
369
|
+
if (match === null)
|
|
370
|
+
return undefined;
|
|
371
|
+
// The lira group is mandatory in the pattern, so it is always present on a match.
|
|
372
|
+
const lira = match[2];
|
|
373
|
+
const kurus = match[3] ?? "";
|
|
374
|
+
const amount = BigInt(lira.replaceAll(".", "")) * 100n + BigInt(kurus.padEnd(2, "0"));
|
|
375
|
+
const result = Number(match[1] === undefined ? amount : -amount);
|
|
376
|
+
// An amount a number cannot hold exactly is rejected rather than silently rounded.
|
|
377
|
+
return Number.isSafeInteger(result) ? result : undefined;
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
/** Freezes the list and every entry, so no consumer can corrupt the shared table. */
|
|
381
|
+
const freezeAll = (list) => Object.freeze(list.map((province) => Object.freeze(province)));
|
|
382
|
+
/** The 81 provinces of Türkiye ordered by plate code: PROVINCES[0] is Adana (01). */
|
|
383
|
+
const PROVINCES = /* @__PURE__ */ freezeAll([
|
|
384
|
+
{ plate: 1, name: "Adana" },
|
|
385
|
+
{ plate: 2, name: "Adıyaman" },
|
|
386
|
+
{ plate: 3, name: "Afyonkarahisar" },
|
|
387
|
+
{ plate: 4, name: "Ağrı" },
|
|
388
|
+
{ plate: 5, name: "Amasya" },
|
|
389
|
+
{ plate: 6, name: "Ankara" },
|
|
390
|
+
{ plate: 7, name: "Antalya" },
|
|
391
|
+
{ plate: 8, name: "Artvin" },
|
|
392
|
+
{ plate: 9, name: "Aydın" },
|
|
393
|
+
{ plate: 10, name: "Balıkesir" },
|
|
394
|
+
{ plate: 11, name: "Bilecik" },
|
|
395
|
+
{ plate: 12, name: "Bingöl" },
|
|
396
|
+
{ plate: 13, name: "Bitlis" },
|
|
397
|
+
{ plate: 14, name: "Bolu" },
|
|
398
|
+
{ plate: 15, name: "Burdur" },
|
|
399
|
+
{ plate: 16, name: "Bursa" },
|
|
400
|
+
{ plate: 17, name: "Çanakkale" },
|
|
401
|
+
{ plate: 18, name: "Çankırı" },
|
|
402
|
+
{ plate: 19, name: "Çorum" },
|
|
403
|
+
{ plate: 20, name: "Denizli" },
|
|
404
|
+
{ plate: 21, name: "Diyarbakır" },
|
|
405
|
+
{ plate: 22, name: "Edirne" },
|
|
406
|
+
{ plate: 23, name: "Elazığ" },
|
|
407
|
+
{ plate: 24, name: "Erzincan" },
|
|
408
|
+
{ plate: 25, name: "Erzurum" },
|
|
409
|
+
{ plate: 26, name: "Eskişehir" },
|
|
410
|
+
{ plate: 27, name: "Gaziantep" },
|
|
411
|
+
{ plate: 28, name: "Giresun" },
|
|
412
|
+
{ plate: 29, name: "Gümüşhane" },
|
|
413
|
+
{ plate: 30, name: "Hakkari" },
|
|
414
|
+
{ plate: 31, name: "Hatay" },
|
|
415
|
+
{ plate: 32, name: "Isparta" },
|
|
416
|
+
{ plate: 33, name: "Mersin" },
|
|
417
|
+
{ plate: 34, name: "İstanbul" },
|
|
418
|
+
{ plate: 35, name: "İzmir" },
|
|
419
|
+
{ plate: 36, name: "Kars" },
|
|
420
|
+
{ plate: 37, name: "Kastamonu" },
|
|
421
|
+
{ plate: 38, name: "Kayseri" },
|
|
422
|
+
{ plate: 39, name: "Kırklareli" },
|
|
423
|
+
{ plate: 40, name: "Kırşehir" },
|
|
424
|
+
{ plate: 41, name: "Kocaeli" },
|
|
425
|
+
{ plate: 42, name: "Konya" },
|
|
426
|
+
{ plate: 43, name: "Kütahya" },
|
|
427
|
+
{ plate: 44, name: "Malatya" },
|
|
428
|
+
{ plate: 45, name: "Manisa" },
|
|
429
|
+
{ plate: 46, name: "Kahramanmaraş" },
|
|
430
|
+
{ plate: 47, name: "Mardin" },
|
|
431
|
+
{ plate: 48, name: "Muğla" },
|
|
432
|
+
{ plate: 49, name: "Muş" },
|
|
433
|
+
{ plate: 50, name: "Nevşehir" },
|
|
434
|
+
{ plate: 51, name: "Niğde" },
|
|
435
|
+
{ plate: 52, name: "Ordu" },
|
|
436
|
+
{ plate: 53, name: "Rize" },
|
|
437
|
+
{ plate: 54, name: "Sakarya" },
|
|
438
|
+
{ plate: 55, name: "Samsun" },
|
|
439
|
+
{ plate: 56, name: "Siirt" },
|
|
440
|
+
{ plate: 57, name: "Sinop" },
|
|
441
|
+
{ plate: 58, name: "Sivas" },
|
|
442
|
+
{ plate: 59, name: "Tekirdağ" },
|
|
443
|
+
{ plate: 60, name: "Tokat" },
|
|
444
|
+
{ plate: 61, name: "Trabzon" },
|
|
445
|
+
{ plate: 62, name: "Tunceli" },
|
|
446
|
+
{ plate: 63, name: "Şanlıurfa" },
|
|
447
|
+
{ plate: 64, name: "Uşak" },
|
|
448
|
+
{ plate: 65, name: "Van" },
|
|
449
|
+
{ plate: 66, name: "Yozgat" },
|
|
450
|
+
{ plate: 67, name: "Zonguldak" },
|
|
451
|
+
{ plate: 68, name: "Aksaray" },
|
|
452
|
+
{ plate: 69, name: "Bayburt" },
|
|
453
|
+
{ plate: 70, name: "Karaman" },
|
|
454
|
+
{ plate: 71, name: "Kırıkkale" },
|
|
455
|
+
{ plate: 72, name: "Batman" },
|
|
456
|
+
{ plate: 73, name: "Şırnak" },
|
|
457
|
+
{ plate: 74, name: "Bartın" },
|
|
458
|
+
{ plate: 75, name: "Ardahan" },
|
|
459
|
+
{ plate: 76, name: "Iğdır" },
|
|
460
|
+
{ plate: 77, name: "Yalova" },
|
|
461
|
+
{ plate: 78, name: "Karabük" },
|
|
462
|
+
{ plate: 79, name: "Kilis" },
|
|
463
|
+
{ plate: 80, name: "Osmaniye" },
|
|
464
|
+
{ plate: 81, name: "Düzce" },
|
|
465
|
+
]);
|
|
466
|
+
|
|
467
|
+
const PLATE_PATTERN = /^\d{1,2}$/;
|
|
468
|
+
/** Reads a plate code given as 34, "34" or "06"; anything else becomes NaN. */
|
|
469
|
+
const toPlateNumber = (plate) => {
|
|
470
|
+
if (typeof plate === "number")
|
|
471
|
+
return plate;
|
|
472
|
+
if (typeof plate === "string" && PLATE_PATTERN.test(plate.trim())) {
|
|
473
|
+
return Number(plate.trim());
|
|
474
|
+
}
|
|
475
|
+
return NaN;
|
|
476
|
+
};
|
|
477
|
+
/** Looks a province up by plate code: provinceByPlate("06") → { plate: 6, name: "Ankara" }. Unknown → undefined. */
|
|
478
|
+
const provinceByPlate = (plate) => {
|
|
479
|
+
const code = toPlateNumber(plate);
|
|
480
|
+
// PROVINCES is ordered by plate, so the code is the index plus one; out of range reads undefined.
|
|
481
|
+
return Number.isInteger(code) ? PROVINCES[code - 1] : undefined;
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
/** Strips VAT from a gross amount of kuruş: removeVat(12000, 20) → 10000. The net is rounded half away from zero. */
|
|
485
|
+
const removeVat = ((grossKurus, ratePercent) => {
|
|
486
|
+
const gross = toKurus(grossKurus, "removeVat");
|
|
487
|
+
const basisPoints = toBasisPoints(ratePercent, "removeVat");
|
|
488
|
+
return fromKurus(netOfGross(gross, basisPoints), typeof grossKurus === "bigint", "removeVat");
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
const NON_ALPHANUMERIC_RUN = /[^a-z0-9]+/g;
|
|
492
|
+
const EDGE_DASHES = /^-|-$/g;
|
|
493
|
+
/** Turns any text into a URL slug: "Ön Fren Balatası" → "on-fren-balatasi". */
|
|
494
|
+
const slugify = (text, { maxLength } = {}) => {
|
|
495
|
+
assertString(text, "slugify", "text");
|
|
496
|
+
// Runs collapse to one dash first, so at most one dash can sit at either edge.
|
|
497
|
+
const slug = foldDiacritics(lowerTr(text))
|
|
498
|
+
.replace(NON_ALPHANUMERIC_RUN, "-")
|
|
499
|
+
.replace(EDGE_DASHES, "");
|
|
500
|
+
// NaN, a non-number or anything below 1 means "no limit", like leaving the option out.
|
|
501
|
+
if (!(typeof maxLength === "number" && maxLength >= 1))
|
|
502
|
+
return slug;
|
|
503
|
+
if (slug.length <= maxLength)
|
|
504
|
+
return slug;
|
|
505
|
+
const limit = Math.floor(maxLength);
|
|
506
|
+
// A dash right after the cut means the cut already falls between two words.
|
|
507
|
+
if (slug[limit] === "-")
|
|
508
|
+
return slug.slice(0, limit);
|
|
509
|
+
const head = slug.slice(0, limit);
|
|
510
|
+
const lastDash = head.lastIndexOf("-");
|
|
511
|
+
// A single word longer than the limit has no boundary to cut at; it is cut hard.
|
|
512
|
+
return lastDash === -1 ? head : head.slice(0, lastDash);
|
|
513
|
+
};
|
|
514
|
+
|
|
515
|
+
/** Lower-cases with Turkish rules ("IĞDIR" → "ığdır", "İZMİR" → "izmir") in any runtime locale. */
|
|
516
|
+
const toLowerTr = (text) => lowerTr(assertString(text, "toLowerTr", "text"));
|
|
517
|
+
|
|
518
|
+
/** Upper-cases with Turkish rules ("izmir" → "İZMİR", "ığdır" → "IĞDIR") in any runtime locale. */
|
|
519
|
+
const toUpperTr = (text) => upperTr(assertString(text, "toUpperTr", "text"));
|
|
520
|
+
|
|
521
|
+
/** The VAT part of an amount of kuruş: vatOf(10000, 20) → 2000; vatOf(12000, 20, { from: "gross" }) → 2000. */
|
|
522
|
+
const vatOf = ((kurus, ratePercent, { from } = {}) => {
|
|
523
|
+
const amount = toKurus(kurus, "vatOf");
|
|
524
|
+
const basisPoints = toBasisPoints(ratePercent, "vatOf");
|
|
525
|
+
// From a gross amount the VAT is what remains after the rounded net, so net + VAT = gross exactly.
|
|
526
|
+
const vat = from === "gross"
|
|
527
|
+
? amount - netOfGross(amount, basisPoints)
|
|
528
|
+
: vatOnNet(amount, basisPoints);
|
|
529
|
+
return fromKurus(vat, typeof kurus === "bigint", "vatOf");
|
|
530
|
+
});
|
|
531
|
+
|
|
532
|
+
export { PROVINCES, addVat, compareTr, foldTurkish, formatDateTr, formatIban, formatLira, formatPhone, isIban, isMobilePhone, isTckn, isVkn, liraInWords, normalizePhone, parseDateTr, parseLira, provinceByPlate, removeVat, slugify, toLowerTr, toUpperTr, vatOf };
|
|
533
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../lib/helpers/assert.helper.ts","../lib/helpers/kurus.helper.ts","../lib/modules/add-vat.ts","../lib/modules/compare-tr.ts","../lib/helpers/turkish-case.helper.ts","../lib/modules/fold-turkish.ts","../lib/helpers/turkiye-time.helper.ts","../lib/modules/format-date-tr.ts","../lib/modules/is-iban.ts","../lib/modules/format-iban.ts","../lib/modules/format-lira.ts","../lib/modules/normalize-phone.ts","../lib/modules/format-phone.ts","../lib/modules/is-mobile-phone.ts","../lib/modules/is-tckn.ts","../lib/modules/is-vkn.ts","../lib/modules/lira-in-words.ts","../lib/modules/parse-date-tr.ts","../lib/modules/parse-lira.ts","../lib/modules/provinces.ts","../lib/modules/province-by-plate.ts","../lib/modules/remove-vat.ts","../lib/modules/slugify.ts","../lib/modules/to-lower-tr.ts","../lib/modules/to-upper-tr.ts","../lib/modules/vat-of.ts"],"sourcesContent":["/** Names a value's type for an error message; `typeof null` alone would say \"object\". */\nconst describeType = (value: unknown): string =>\n value === null ? \"null\" : typeof value;\n\n/** Throws a TypeError naming the caller when a required text argument is not a string. */\nconst assertString = (\n value: unknown,\n fnName: string,\n param: string\n): string => {\n if (typeof value !== \"string\") {\n throw new TypeError(\n `${fnName}: expected ${param} to be a string, received ${describeType(value)}`\n );\n }\n return value;\n};\n\nexport { assertString, describeType };\n","import { describeType } from \"./assert.helper\";\n\n/** 100% expressed in basis points; rates carry at most two decimals (e.g. 0.25%). */\nconst BASIS = 10_000n;\n\n/** Reads an amount of kuruş as a bigint, so no float ever enters money arithmetic. */\nconst toKurus = (value: unknown, fnName: string): bigint => {\n if (typeof value === \"bigint\") return value;\n if (typeof value !== \"number\") {\n throw new TypeError(\n `${fnName}: expected an integer amount of kuruş (number or bigint), received ${describeType(value)}`\n );\n }\n // A fraction of a kuruş or an unsafe integer has already lost precision; guessing would corrupt money.\n if (!Number.isSafeInteger(value)) {\n throw new RangeError(\n `${fnName}: expected a safe integer amount of kuruş, received ${value}; pass a bigint for larger amounts`\n );\n }\n return BigInt(value);\n};\n\n/** Hands the result back in the caller's numeric type; a number result must stay a safe integer. */\nconst fromKurus = (\n amount: bigint,\n asBigint: boolean,\n fnName: string\n): number | bigint => {\n if (asBigint) return amount;\n const result = Number(amount);\n if (!Number.isSafeInteger(result)) {\n throw new RangeError(\n `${fnName}: the result ${amount} exceeds Number.MAX_SAFE_INTEGER; pass the amount as a bigint`\n );\n }\n return result;\n};\n\n/** Integer division rounded half away from zero, so a refund mirrors its sale exactly. */\nconst divRound = (numerator: bigint, divisor: bigint): bigint => {\n const quotient = numerator / divisor;\n const remainder = numerator % divisor;\n const twiceRemainder = (remainder < 0n ? -remainder : remainder) * 2n;\n if (twiceRemainder < divisor) return quotient;\n return numerator < 0n ? quotient - 1n : quotient + 1n;\n};\n\n/** Converts a VAT rate in percent (20, 10, 1, 0.5) to integer basis points. */\nconst toBasisPoints = (ratePercent: unknown, fnName: string): bigint => {\n if (typeof ratePercent !== \"number\") {\n throw new TypeError(\n `${fnName}: expected ratePercent to be a number, received ${describeType(ratePercent)}`\n );\n }\n const basisPoints = Math.round(ratePercent * 100);\n // The tolerance absorbs binary noise such as 0.07 * 100 = 7.000000000000001.\n if (\n !(ratePercent >= 0) ||\n !Number.isSafeInteger(basisPoints) ||\n Math.abs(ratePercent * 100 - basisPoints) > 1e-6\n ) {\n throw new RangeError(\n `${fnName}: expected a non-negative VAT rate in percent with at most two decimals (like 20 or 0.5), received ${ratePercent}`\n );\n }\n return BigInt(basisPoints);\n};\n\n/** VAT owed on a net amount, rounded half away from zero to the kuruş. */\nconst vatOnNet = (net: bigint, basisPoints: bigint): bigint =>\n divRound(net * basisPoints, BASIS);\n\n/** The net part of a gross (VAT-included) amount, rounded half away from zero to the kuruş. */\nconst netOfGross = (gross: bigint, basisPoints: bigint): bigint =>\n divRound(gross * BASIS, BASIS + basisPoints);\n\nexport { divRound, fromKurus, netOfGross, toBasisPoints, toKurus, vatOnNet };\n","import type { VatCalculator } from \"../types\";\nimport {\n fromKurus,\n toBasisPoints,\n toKurus,\n vatOnNet,\n} from \"../helpers/kurus.helper\";\n\n/** Adds VAT to a net amount of kuruş: addVat(10000, 20) → 12000. The VAT is rounded half away from zero. */\nconst addVat = ((\n kurus: number | bigint,\n ratePercent: number\n): number | bigint => {\n const net = toKurus(kurus, \"addVat\");\n const basisPoints = toBasisPoints(ratePercent, \"addVat\");\n return fromKurus(\n net + vatOnNet(net, basisPoints),\n typeof kurus === \"bigint\",\n \"addVat\"\n );\n}) as VatCalculator;\n\nexport default addVat;\n","import { assertString } from \"../helpers/assert.helper\";\n\n// Created on first use rather than at import time; building a collator is not free.\nlet collator: Intl.Collator | undefined;\n\n/** Compares two strings in Turkish alphabetical order (c < ç < d, ı < i); pass it to `sort`. */\nconst compareTr = (a: string, b: string): number => {\n assertString(a, \"compareTr\", \"a\");\n assertString(b, \"compareTr\", \"b\");\n collator ??= new Intl.Collator(\"tr\");\n return collator.compare(a, b);\n};\n\nexport default compareTr;\n","// \"İ\" may also arrive decomposed as \"I\" + combining dot above (U+0307).\nconst DOTTED_CAPITAL_I = /İ|İ/g;\nconst DOTLESS_CAPITAL_I = /I/g;\nconst DOTTED_SMALL_I = /i/g;\nconst DOTLESS_SMALL_I = /ı/g;\nconst COMBINING_MARKS = /\\p{M}/gu;\n\n/** Lower-cases with Turkish rules (I → ı, İ → i) regardless of the runtime's default locale. */\nconst lowerTr = (text: string): string =>\n text\n .replace(DOTTED_CAPITAL_I, \"i\")\n .replace(DOTLESS_CAPITAL_I, \"ı\")\n .toLowerCase();\n\n/** Upper-cases with Turkish rules (i → İ, ı → I) regardless of the runtime's default locale. */\nconst upperTr = (text: string): string =>\n text.replace(DOTTED_SMALL_I, \"İ\").replace(DOTLESS_SMALL_I, \"I\").toUpperCase();\n\n/**\n * Strips diacritics from lower-cased text: ç→c ğ→g ı→i ö→o ş→s ü→u â→a î→i û→u (and é, ñ...).\n * Canonical decomposition splits each letter from its mark; \"ı\" has no decomposition of its own.\n */\nconst foldDiacritics = (lowerText: string): string =>\n lowerText\n .normalize(\"NFD\")\n .replace(COMBINING_MARKS, \"\")\n .replace(DOTLESS_SMALL_I, \"i\");\n\nexport { foldDiacritics, lowerTr, upperTr };\n","import { assertString } from \"../helpers/assert.helper\";\nimport { foldDiacritics, lowerTr } from \"../helpers/turkish-case.helper\";\n\nconst WHITESPACE_RUN = /\\s+/g;\n\n/** Normalizes text for search: \" IŞIK Çağrı \" → \"isik cagri\". Punctuation is kept. */\nconst foldTurkish = (text: string): string =>\n foldDiacritics(lowerTr(assertString(text, \"foldTurkish\", \"text\")))\n .replace(WHITESPACE_RUN, \" \")\n .trim();\n\nexport default foldTurkish;\n","/**\n * Türkiye has stayed on UTC+03:00 all year since September 2016. A fixed offset makes a date read\n * the same on a UTC server and in the browser (no hydration mismatch) without time-zone data.\n */\nconst TURKIYE_OFFSET_MS = 3 * 60 * 60 * 1000;\n\nexport { TURKIYE_OFFSET_MS };\n","import { describeType } from \"../helpers/assert.helper\";\nimport { TURKIYE_OFFSET_MS } from \"../helpers/turkiye-time.helper\";\n\nconst pad = (value: number, length: number): string =>\n String(value).padStart(length, \"0\");\n\n/** Formats a Date or epoch milliseconds as \"dd.MM.yyyy\" in Türkiye time (UTC+03:00). */\nconst formatDateTr = (date: Date | number): string => {\n let time: number;\n // The tag check also accepts a Date from another realm (iframe, vm), where instanceof fails.\n if (Object.prototype.toString.call(date) === \"[object Date]\") {\n time = Date.prototype.getTime.call(date);\n } else if (typeof date === \"number\") {\n time = date;\n } else {\n throw new TypeError(\n `formatDateTr: expected a Date or epoch milliseconds, received ${describeType(date)}`\n );\n }\n\n const shifted = new Date(time + TURKIYE_OFFSET_MS);\n const year = shifted.getUTCFullYear();\n // NaN (an invalid date) fails both comparisons, as does a year \"yyyy\" cannot hold.\n if (!(year >= 0 && year <= 9999)) {\n throw new RangeError(\n `formatDateTr: expected a valid date between the years 0 and 9999, received ${String(date)}`\n );\n }\n return `${pad(shifted.getUTCDate(), 2)}.${pad(shifted.getUTCMonth() + 1, 2)}.${pad(year, 4)}`;\n};\n\nexport default formatDateTr;\n","const WHITESPACE = /\\s+/g;\n// A Turkish IBAN: \"TR\", two check digits and 24 digits (bank code, reserved digit, account).\nconst TR_IBAN_PATTERN = /^TR\\d{24}$/;\n// \"TR\" as ISO 13616 digits: T = 29, R = 27.\nconst TR_AS_DIGITS = \"2927\";\n\n/** Checks a Turkish IBAN: 26 characters and the mod-97 check. Spaces and lower case are accepted. Non-strings → false. */\nconst isIban = (value: unknown): boolean => {\n if (typeof value !== \"string\") return false;\n const iban = value.replace(WHITESPACE, \"\").toUpperCase();\n if (!TR_IBAN_PATTERN.test(iban)) return false;\n\n // ISO 13616: move the country code and check digits to the end; a valid IBAN leaves remainder 1.\n // Folding digit by digit keeps every step far below Number.MAX_SAFE_INTEGER.\n const rearranged = iban.slice(4) + TR_AS_DIGITS + iban.slice(2, 4);\n let remainder = 0;\n for (let i = 0; i < rearranged.length; i++) {\n remainder = (remainder * 10 + rearranged.charCodeAt(i) - 48) % 97;\n }\n return remainder === 1;\n};\n\nexport default isIban;\n","import isIban from \"./is-iban\";\n\nconst WHITESPACE = /\\s+/g;\n\n/** Formats a valid Turkish IBAN in groups of four: \"TR33 0006 1005 1978 6457 8413 26\". Invalid → undefined. */\nconst formatIban = (value: unknown): string | undefined => {\n if (typeof value !== \"string\" || !isIban(value)) return undefined;\n const iban = value.replace(WHITESPACE, \"\").toUpperCase();\n const groups: string[] = [];\n for (let i = 0; i < iban.length; i += 4) groups.push(iban.slice(i, i + 4));\n return groups.join(\" \");\n};\n\nexport default formatIban;\n","import type { Kurus } from \"../types\";\nimport { divRound, toKurus } from \"../helpers/kurus.helper\";\n\ntype FormatLiraOptions = {\n /** Prefix the lira sign \"₺\". Default `true`; only `false` turns it off. */\n symbol?: boolean;\n /** Show the two kuruş digits. Default `true`; `false` rounds half away from zero to whole lira. */\n fraction?: boolean;\n};\n\n/** Inserts a dot every three digits from the right: \"1234567\" → \"1.234.567\". */\nconst groupThousands = (digits: string): string => {\n const headLength = digits.length % 3 === 0 ? 3 : digits.length % 3;\n let grouped = digits.slice(0, headLength);\n for (let i = headLength; i < digits.length; i += 3) {\n grouped += `.${digits.slice(i, i + 3)}`;\n }\n return grouped;\n};\n\n/** Formats integer kuruş as Turkish lira: 123456 → \"₺1.234,56\", -5 → \"-₺0,05\". */\nconst formatLira = (\n kurus: Kurus,\n { symbol, fraction }: FormatLiraOptions = {}\n): string => {\n const exact = toKurus(kurus, \"formatLira\");\n const showFraction = fraction !== false;\n // Rounded first, so -49 kuruş shown without kuruş reads \"₺0\" and not \"-₺0\".\n const amount = showFraction ? exact : divRound(exact, 100n);\n const isNegative = amount < 0n;\n const absolute = isNegative ? -amount : amount;\n\n const body = showFraction\n ? `${groupThousands((absolute / 100n).toString())},${(absolute % 100n).toString().padStart(2, \"0\")}`\n : groupThousands(absolute.toString());\n return `${isNegative ? \"-\" : \"\"}${symbol === false ? \"\" : \"₺\"}${body}`;\n};\n\nexport type { FormatLiraOptions };\nexport default formatLira;\n","const SEPARATORS = /[\\s().-]/g;\n// Optional country or trunk prefix, then a 10-digit national number. Turkish national numbers\n// start with 2, 3 or 4 (landline), 5 (mobile) or 8 (850 and other non-geographic numbers).\nconst PHONE_PATTERN = /^(?:\\+90|0090|90|0)?([2-58]\\d{9})$/;\n\n/** Normalizes a Turkish phone number to E.164: \"0 (532) 123 45 67\" → \"+905321234567\". Invalid → undefined. */\nconst normalizePhone = (value: unknown): string | undefined => {\n if (typeof value !== \"string\") return undefined;\n const match = PHONE_PATTERN.exec(value.replace(SEPARATORS, \"\"));\n return match === null ? undefined : `+90${match[1]}`;\n};\n\nexport default normalizePhone;\n","import normalizePhone from \"./normalize-phone\";\n\n/** Formats a Turkish phone number for display: \"+905321234567\" → \"0532 123 45 67\". Invalid → undefined. */\nconst formatPhone = (value: unknown): string | undefined => {\n const e164 = normalizePhone(value);\n if (e164 === undefined) return undefined;\n return `0${e164.slice(3, 6)} ${e164.slice(6, 9)} ${e164.slice(9, 11)} ${e164.slice(11)}`;\n};\n\nexport default formatPhone;\n","import normalizePhone from \"./normalize-phone\";\n\n/** Checks for a Turkish mobile number (national number starting with 5) in any form normalizePhone accepts. */\nconst isMobilePhone = (value: unknown): boolean =>\n normalizePhone(value)?.startsWith(\"+905\") === true;\n\nexport default isMobilePhone;\n","// Eleven digits, never starting with zero.\nconst TCKN_PATTERN = /^[1-9]\\d{10}$/;\n\n/** Checks a Turkish identity number (T.C. Kimlik No): format and both check digits. Non-strings → false. */\nconst isTckn = (value: unknown): boolean => {\n if (typeof value !== \"string\" || !TCKN_PATTERN.test(value)) return false;\n const digit = (index: number): number => value.charCodeAt(index) - 48;\n\n const oddSum = digit(0) + digit(2) + digit(4) + digit(6) + digit(8);\n const evenSum = digit(1) + digit(3) + digit(5) + digit(7);\n // The difference can be negative; the extra + 10 keeps the remainder in 0–9.\n const tenth = (((oddSum * 7 - evenSum) % 10) + 10) % 10;\n const eleventh = (oddSum + evenSum + digit(9)) % 10;\n return tenth === digit(9) && eleventh === digit(10);\n};\n\nexport default isTckn;\n","const VKN_PATTERN = /^\\d{10}$/;\n\n/** Checks a Turkish tax number (Vergi Kimlik No): ten digits and the check digit. Non-strings → false. */\nconst isVkn = (value: unknown): boolean => {\n if (typeof value !== \"string\" || !VKN_PATTERN.test(value)) return false;\n const digit = (index: number): number => value.charCodeAt(index) - 48;\n\n let sum = 0;\n for (let i = 0; i < 9; i++) {\n const shifted = (digit(i) + 9 - i) % 10;\n let weighted = (shifted * 2 ** (9 - i)) % 9;\n // The published algorithm counts a non-zero multiple of 9 as 9, not 0.\n if (shifted !== 0 && weighted === 0) weighted = 9;\n sum += weighted;\n }\n return (10 - (sum % 10)) % 10 === digit(9);\n};\n\nexport default isVkn;\n","import type { Kurus } from \"../types\";\nimport { toKurus } from \"../helpers/kurus.helper\";\n\nconst ONES = [\n \"\",\n \"bir\",\n \"iki\",\n \"üç\",\n \"dört\",\n \"beş\",\n \"altı\",\n \"yedi\",\n \"sekiz\",\n \"dokuz\",\n];\nconst TENS = [\n \"\",\n \"on\",\n \"yirmi\",\n \"otuz\",\n \"kırk\",\n \"elli\",\n \"altmış\",\n \"yetmiş\",\n \"seksen\",\n \"doksan\",\n];\nconst SCALES = [\n \"\",\n \"bin\",\n \"milyon\",\n \"milyar\",\n \"trilyon\",\n \"katrilyon\",\n \"kentilyon\",\n];\n// One past the largest amount the scale words above can name (999 kentilyon 999 katrilyon...).\nconst LIRA_LIMIT = 10n ** 21n;\n\n/** Words for 1–999. Turkish says \"yüz\", not \"bir yüz\". */\nconst hundredsInWords = (group: number): string[] => {\n const hundreds = Math.floor(group / 100);\n const tens = Math.floor(group / 10) % 10;\n const ones = group % 10;\n const words: string[] = [];\n if (hundreds > 1) words.push(ONES[hundreds]!);\n if (hundreds > 0) words.push(\"yüz\");\n if (tens > 0) words.push(TENS[tens]!);\n if (ones > 0) words.push(ONES[ones]!);\n return words;\n};\n\n/** Words for a positive whole number. Turkish says \"bin\", not \"bir bin\", but \"bir milyon\". */\nconst integerInWords = (value: bigint): string[] => {\n const words: string[] = [];\n let rest = value;\n for (let scale = 0; rest > 0n; scale++, rest /= 1000n) {\n const group = Number(rest % 1000n);\n if (group === 0) continue;\n const groupWords = scale === 1 && group === 1 ? [] : hundredsInWords(group);\n if (scale > 0) groupWords.push(SCALES[scale]!);\n words.unshift(...groupWords);\n }\n return words;\n};\n\n/** Spells integer kuruş out in Turkish: 123456 → \"bin iki yüz otuz dört lira elli altı kuruş\". */\nconst liraInWords = (kurus: Kurus): string => {\n const amount = toKurus(kurus, \"liraInWords\");\n if (amount === 0n) return \"sıfır lira\";\n const absolute = amount < 0n ? -amount : amount;\n const lira = absolute / 100n;\n if (lira >= LIRA_LIMIT) {\n throw new RangeError(\n `liraInWords: amounts of ${LIRA_LIMIT} lira or more have no Turkish scale word, received ${amount} kuruş`\n );\n }\n\n const kurusPart = Number(absolute % 100n);\n const words: string[] = amount < 0n ? [\"eksi\"] : [];\n if (lira > 0n) words.push(...integerInWords(lira), \"lira\");\n if (kurusPart > 0) words.push(...hundredsInWords(kurusPart), \"kuruş\");\n return words.join(\" \");\n};\n\nexport default liraInWords;\n","import { TURKIYE_OFFSET_MS } from \"../helpers/turkiye-time.helper\";\n\n// d.M.yyyy or dd.MM.yyyy; \"/\" is accepted too, but the two separators must match.\nconst DATE_PATTERN = /^(\\d{1,2})([./])(\\d{1,2})\\2(\\d{4})$/;\n\n/** Reads \"dd.MM.yyyy\" as the start of that day in Türkiye time (UTC+03:00). Impossible dates → undefined. */\nconst parseDateTr = (text: unknown): Date | undefined => {\n if (typeof text !== \"string\") return undefined;\n const match = DATE_PATTERN.exec(text.trim());\n if (match === null) return undefined;\n const day = Number(match[1]);\n const month = Number(match[3]);\n const year = Number(match[4]);\n\n // setUTCFullYear, unlike Date.UTC, does not map the years 0–99 to 1900–1999.\n const utcMidnight = new Date(0);\n utcMidnight.setUTCFullYear(year, month - 1, day);\n // Date rolls 31.04 over to 01.05 and month 13 into the next year; a roll-over means \"no such day\".\n if (\n utcMidnight.getUTCDate() !== day ||\n utcMidnight.getUTCMonth() !== month - 1\n ) {\n return undefined;\n }\n return new Date(utcMidnight.getTime() - TURKIYE_OFFSET_MS);\n};\n\nexport default parseDateTr;\n","/**\n * Optional minus, optional \"₺\", then lira either grouped with dots (\"1.234.567\") or plain\n * (\"1234567\"), an optional comma with one or two kuruş digits, and an optional \"₺\" / \"TL\" / \"TRY\".\n */\nconst AMOUNT_PATTERN =\n /^(-)?\\s*(?:₺\\s*)?(\\d{1,3}(?:\\.\\d{3})+|\\d+)(?:,(\\d{1,2}))?\\s*(?:₺|TL|TRY)?$/i;\n\n/** Reads a Turkish-formatted lira amount as integer kuruş: \"1.234,56\" → 123456; anything else → undefined. */\nconst parseLira = (text: unknown): number | undefined => {\n if (typeof text !== \"string\") return undefined;\n const match = AMOUNT_PATTERN.exec(text.trim());\n if (match === null) return undefined;\n // The lira group is mandatory in the pattern, so it is always present on a match.\n const lira = match[2] as string;\n const kurus = match[3] ?? \"\";\n\n const amount =\n BigInt(lira.replaceAll(\".\", \"\")) * 100n + BigInt(kurus.padEnd(2, \"0\"));\n const result = Number(match[1] === undefined ? amount : -amount);\n // An amount a number cannot hold exactly is rejected rather than silently rounded.\n return Number.isSafeInteger(result) ? result : undefined;\n};\n\nexport default parseLira;\n","import type { Province } from \"../types\";\n\n/** Freezes the list and every entry, so no consumer can corrupt the shared table. */\nconst freezeAll = (list: Province[]): readonly Province[] =>\n Object.freeze(list.map((province) => Object.freeze(province)));\n\n/** The 81 provinces of Türkiye ordered by plate code: PROVINCES[0] is Adana (01). */\nconst PROVINCES: readonly Province[] = /* @__PURE__ */ freezeAll([\n { plate: 1, name: \"Adana\" },\n { plate: 2, name: \"Adıyaman\" },\n { plate: 3, name: \"Afyonkarahisar\" },\n { plate: 4, name: \"Ağrı\" },\n { plate: 5, name: \"Amasya\" },\n { plate: 6, name: \"Ankara\" },\n { plate: 7, name: \"Antalya\" },\n { plate: 8, name: \"Artvin\" },\n { plate: 9, name: \"Aydın\" },\n { plate: 10, name: \"Balıkesir\" },\n { plate: 11, name: \"Bilecik\" },\n { plate: 12, name: \"Bingöl\" },\n { plate: 13, name: \"Bitlis\" },\n { plate: 14, name: \"Bolu\" },\n { plate: 15, name: \"Burdur\" },\n { plate: 16, name: \"Bursa\" },\n { plate: 17, name: \"Çanakkale\" },\n { plate: 18, name: \"Çankırı\" },\n { plate: 19, name: \"Çorum\" },\n { plate: 20, name: \"Denizli\" },\n { plate: 21, name: \"Diyarbakır\" },\n { plate: 22, name: \"Edirne\" },\n { plate: 23, name: \"Elazığ\" },\n { plate: 24, name: \"Erzincan\" },\n { plate: 25, name: \"Erzurum\" },\n { plate: 26, name: \"Eskişehir\" },\n { plate: 27, name: \"Gaziantep\" },\n { plate: 28, name: \"Giresun\" },\n { plate: 29, name: \"Gümüşhane\" },\n { plate: 30, name: \"Hakkari\" },\n { plate: 31, name: \"Hatay\" },\n { plate: 32, name: \"Isparta\" },\n { plate: 33, name: \"Mersin\" },\n { plate: 34, name: \"İstanbul\" },\n { plate: 35, name: \"İzmir\" },\n { plate: 36, name: \"Kars\" },\n { plate: 37, name: \"Kastamonu\" },\n { plate: 38, name: \"Kayseri\" },\n { plate: 39, name: \"Kırklareli\" },\n { plate: 40, name: \"Kırşehir\" },\n { plate: 41, name: \"Kocaeli\" },\n { plate: 42, name: \"Konya\" },\n { plate: 43, name: \"Kütahya\" },\n { plate: 44, name: \"Malatya\" },\n { plate: 45, name: \"Manisa\" },\n { plate: 46, name: \"Kahramanmaraş\" },\n { plate: 47, name: \"Mardin\" },\n { plate: 48, name: \"Muğla\" },\n { plate: 49, name: \"Muş\" },\n { plate: 50, name: \"Nevşehir\" },\n { plate: 51, name: \"Niğde\" },\n { plate: 52, name: \"Ordu\" },\n { plate: 53, name: \"Rize\" },\n { plate: 54, name: \"Sakarya\" },\n { plate: 55, name: \"Samsun\" },\n { plate: 56, name: \"Siirt\" },\n { plate: 57, name: \"Sinop\" },\n { plate: 58, name: \"Sivas\" },\n { plate: 59, name: \"Tekirdağ\" },\n { plate: 60, name: \"Tokat\" },\n { plate: 61, name: \"Trabzon\" },\n { plate: 62, name: \"Tunceli\" },\n { plate: 63, name: \"Şanlıurfa\" },\n { plate: 64, name: \"Uşak\" },\n { plate: 65, name: \"Van\" },\n { plate: 66, name: \"Yozgat\" },\n { plate: 67, name: \"Zonguldak\" },\n { plate: 68, name: \"Aksaray\" },\n { plate: 69, name: \"Bayburt\" },\n { plate: 70, name: \"Karaman\" },\n { plate: 71, name: \"Kırıkkale\" },\n { plate: 72, name: \"Batman\" },\n { plate: 73, name: \"Şırnak\" },\n { plate: 74, name: \"Bartın\" },\n { plate: 75, name: \"Ardahan\" },\n { plate: 76, name: \"Iğdır\" },\n { plate: 77, name: \"Yalova\" },\n { plate: 78, name: \"Karabük\" },\n { plate: 79, name: \"Kilis\" },\n { plate: 80, name: \"Osmaniye\" },\n { plate: 81, name: \"Düzce\" },\n]);\n\nexport default PROVINCES;\n","import type { Province } from \"../types\";\nimport PROVINCES from \"./provinces\";\n\nconst PLATE_PATTERN = /^\\d{1,2}$/;\n\n/** Reads a plate code given as 34, \"34\" or \"06\"; anything else becomes NaN. */\nconst toPlateNumber = (plate: unknown): number => {\n if (typeof plate === \"number\") return plate;\n if (typeof plate === \"string\" && PLATE_PATTERN.test(plate.trim())) {\n return Number(plate.trim());\n }\n return NaN;\n};\n\n/** Looks a province up by plate code: provinceByPlate(\"06\") → { plate: 6, name: \"Ankara\" }. Unknown → undefined. */\nconst provinceByPlate = (plate: number | string): Province | undefined => {\n const code = toPlateNumber(plate);\n // PROVINCES is ordered by plate, so the code is the index plus one; out of range reads undefined.\n return Number.isInteger(code) ? PROVINCES[code - 1] : undefined;\n};\n\nexport default provinceByPlate;\n","import type { VatCalculator } from \"../types\";\nimport {\n fromKurus,\n netOfGross,\n toBasisPoints,\n toKurus,\n} from \"../helpers/kurus.helper\";\n\n/** Strips VAT from a gross amount of kuruş: removeVat(12000, 20) → 10000. The net is rounded half away from zero. */\nconst removeVat = ((\n grossKurus: number | bigint,\n ratePercent: number\n): number | bigint => {\n const gross = toKurus(grossKurus, \"removeVat\");\n const basisPoints = toBasisPoints(ratePercent, \"removeVat\");\n return fromKurus(\n netOfGross(gross, basisPoints),\n typeof grossKurus === \"bigint\",\n \"removeVat\"\n );\n}) as VatCalculator;\n\nexport default removeVat;\n","import { assertString } from \"../helpers/assert.helper\";\nimport { foldDiacritics, lowerTr } from \"../helpers/turkish-case.helper\";\n\ntype SlugifyOptions = {\n /** Longest slug to return; a longer one is cut at the last word boundary that fits. NaN or below 1 means no limit. */\n maxLength?: number;\n};\n\nconst NON_ALPHANUMERIC_RUN = /[^a-z0-9]+/g;\nconst EDGE_DASHES = /^-|-$/g;\n\n/** Turns any text into a URL slug: \"Ön Fren Balatası\" → \"on-fren-balatasi\". */\nconst slugify = (text: string, { maxLength }: SlugifyOptions = {}): string => {\n assertString(text, \"slugify\", \"text\");\n // Runs collapse to one dash first, so at most one dash can sit at either edge.\n const slug = foldDiacritics(lowerTr(text))\n .replace(NON_ALPHANUMERIC_RUN, \"-\")\n .replace(EDGE_DASHES, \"\");\n\n // NaN, a non-number or anything below 1 means \"no limit\", like leaving the option out.\n if (!(typeof maxLength === \"number\" && maxLength >= 1)) return slug;\n if (slug.length <= maxLength) return slug;\n\n const limit = Math.floor(maxLength);\n // A dash right after the cut means the cut already falls between two words.\n if (slug[limit] === \"-\") return slug.slice(0, limit);\n const head = slug.slice(0, limit);\n const lastDash = head.lastIndexOf(\"-\");\n // A single word longer than the limit has no boundary to cut at; it is cut hard.\n return lastDash === -1 ? head : head.slice(0, lastDash);\n};\n\nexport type { SlugifyOptions };\nexport default slugify;\n","import { assertString } from \"../helpers/assert.helper\";\nimport { lowerTr } from \"../helpers/turkish-case.helper\";\n\n/** Lower-cases with Turkish rules (\"IĞDIR\" → \"ığdır\", \"İZMİR\" → \"izmir\") in any runtime locale. */\nconst toLowerTr = (text: string): string =>\n lowerTr(assertString(text, \"toLowerTr\", \"text\"));\n\nexport default toLowerTr;\n","import { assertString } from \"../helpers/assert.helper\";\nimport { upperTr } from \"../helpers/turkish-case.helper\";\n\n/** Upper-cases with Turkish rules (\"izmir\" → \"İZMİR\", \"ığdır\" → \"IĞDIR\") in any runtime locale. */\nconst toUpperTr = (text: string): string =>\n upperTr(assertString(text, \"toUpperTr\", \"text\"));\n\nexport default toUpperTr;\n","import {\n fromKurus,\n netOfGross,\n toBasisPoints,\n toKurus,\n vatOnNet,\n} from \"../helpers/kurus.helper\";\n\ntype VatOfOptions = {\n /** `\"net\"` (default): VAT on top of the amount. `\"gross\"`: the VAT already inside the amount. */\n from?: \"net\" | \"gross\";\n};\n\n/** Returns a number for a number amount and a bigint for a bigint amount. */\ntype VatOf = {\n (kurus: number, ratePercent: number, options?: VatOfOptions): number;\n (kurus: bigint, ratePercent: number, options?: VatOfOptions): bigint;\n};\n\n/** The VAT part of an amount of kuruş: vatOf(10000, 20) → 2000; vatOf(12000, 20, { from: \"gross\" }) → 2000. */\nconst vatOf = ((\n kurus: number | bigint,\n ratePercent: number,\n { from }: VatOfOptions = {}\n): number | bigint => {\n const amount = toKurus(kurus, \"vatOf\");\n const basisPoints = toBasisPoints(ratePercent, \"vatOf\");\n // From a gross amount the VAT is what remains after the rounded net, so net + VAT = gross exactly.\n const vat =\n from === \"gross\"\n ? amount - netOfGross(amount, basisPoints)\n : vatOnNet(amount, basisPoints);\n return fromKurus(vat, typeof kurus === \"bigint\", \"vatOf\");\n}) as VatOf;\n\nexport type { VatOfOptions };\nexport default vatOf;\n"],"names":["WHITESPACE"],"mappings":"AAAA;AACA,MAAM,YAAY,GAAG,CAAC,KAAc,KAClC,KAAK,KAAK,IAAI,GAAG,MAAM,GAAG,OAAO,KAAK;AAExC;AACA,MAAM,YAAY,GAAG,CACnB,KAAc,EACd,MAAc,EACd,KAAa,KACH;AACV,IAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AAC7B,QAAA,MAAM,IAAI,SAAS,CACjB,CAAA,EAAG,MAAM,CAAA,WAAA,EAAc,KAAK,CAAA,0BAAA,EAA6B,YAAY,CAAC,KAAK,CAAC,CAAA,CAAE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