@aidc-toolkit/utility 0.9.6-beta → 0.9.8-beta

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/dist/index.js CHANGED
@@ -1,379 +1,90 @@
1
- // src/iterator_proxy.ts
2
- var IteratorProxyBase = class _IteratorProxyBase {
3
- /**
4
- * Convert an iteration source to an iterable.
5
- *
6
- * @param iterationSource
7
- * Iteration source.
8
- *
9
- * @returns
10
- * Iteration source if it is already an iterable, otherwise iteration source wrapped in an iterable.
11
- */
12
- static toIterable(iterationSource) {
13
- return Symbol.iterator in iterationSource ? iterationSource : {
14
- [Symbol.iterator]() {
15
- return iterationSource;
16
- }
17
- };
18
- }
19
- /**
20
- * Initial iterable.
21
- */
22
- _initialIterable;
23
- /**
24
- * Initial iterator.
25
- */
26
- _initialIterator;
27
- /**
28
- * Constructor.
29
- *
30
- * @param initialIterationSource
31
- * Initial iteration source.
32
- */
33
- constructor(initialIterationSource) {
34
- this._initialIterable = _IteratorProxyBase.toIterable(initialIterationSource);
35
- }
36
- /**
37
- * Get the initial iterable.
38
- */
39
- get initialIterable() {
40
- return this._initialIterable;
41
- }
42
- /**
43
- * Get the initial iterator.
44
- */
45
- get initialIterator() {
46
- if (this._initialIterator === void 0) {
47
- this._initialIterator = this.initialIterable[Symbol.iterator]();
48
- }
49
- return this._initialIterator;
50
- }
51
- /**
52
- * @inheritDoc
53
- */
54
- get [Symbol.toStringTag]() {
55
- return "IteratorProxy";
56
- }
57
- /**
58
- * @inheritDoc
59
- */
60
- [Symbol.dispose]() {
61
- }
62
- /**
63
- * @inheritDoc
64
- */
65
- [Symbol.iterator]() {
66
- return this;
67
- }
68
- /**
69
- * Get the next result from the initial iterator.
70
- *
71
- * @param value
72
- * Tuple value to be passed to Iterator.next().
73
- *
74
- * @returns
75
- * Next result from the initial iterator.
76
- */
77
- initialNext(...value) {
78
- return this.initialIterator.next(...value);
79
- }
80
- /**
81
- * @inheritDoc
82
- */
83
- map(callback) {
84
- return new IteratorMapProxy(this, callback);
85
- }
86
- /**
87
- * @inheritDoc
88
- */
89
- flatMap(callback) {
90
- return new IteratorFlatMapProxy(this, callback);
91
- }
92
- /**
93
- * @inheritDoc
94
- */
95
- filter(predicate) {
96
- return new IteratorFilterProxy(this, predicate, true);
97
- }
98
- /**
99
- * @inheritDoc
100
- */
101
- take(limit) {
102
- return new IteratorTakeProxy(this, limit);
103
- }
104
- /**
105
- * @inheritDoc
106
- */
107
- drop(count) {
108
- return new IteratorDropProxy(this, count);
109
- }
110
- /**
111
- * @inheritDoc
112
- */
113
- reduce(callback, initialValue) {
114
- let index = 0;
115
- let result = initialValue;
116
- for (const value of this) {
117
- if (index === 0 && arguments.length === 1) {
118
- result = value;
119
- } else {
120
- result = callback(result, value, index);
121
- }
122
- index++;
123
- }
124
- if (index === 0 && arguments.length === 1) {
125
- throw new Error("reduce() of empty iterator with no initial value");
126
- }
127
- return result;
128
- }
129
- /**
130
- * @inheritDoc
131
- */
132
- toArray() {
133
- return Array.from(this);
134
- }
135
- /**
136
- * @inheritDoc
137
- */
138
- forEach(callback) {
139
- let index = 0;
140
- for (const element of this) {
141
- callback(element, index++);
142
- }
143
- }
144
- /**
145
- * @inheritDoc
146
- */
147
- some(predicate) {
148
- return new IteratorFilterProxy(this, predicate, true).next().done !== true;
149
- }
150
- /**
151
- * @inheritDoc
152
- */
153
- every(predicate) {
154
- return new IteratorFilterProxy(this, predicate, false).next().done === true;
155
- }
156
- /**
157
- * @inheritDoc
158
- */
159
- find(predicate) {
160
- return new IteratorFilterProxy(this, predicate, true).next().value;
161
- }
162
- };
163
- var IteratorProxyObject = class extends IteratorProxyBase {
164
- /**
165
- * @inheritDoc
166
- */
167
- next(...value) {
168
- return this.initialNext(...value);
169
- }
170
- };
171
- var IteratorMapProxyBase = class extends IteratorProxyBase {
172
- /**
173
- * Callback.
174
- */
175
- _callback;
176
- /**
177
- * Index into initial iteration source.
178
- */
179
- _index;
180
- /**
181
- * Constructor.
182
- *
183
- * @param initialIterationSource
184
- * Initial iteration source.
185
- *
186
- * @param callback
187
- * Callback.
188
- */
189
- constructor(initialIterationSource, callback) {
190
- super(initialIterationSource);
191
- this._callback = callback;
192
- this._index = 0;
193
- }
194
- /**
195
- * Get the next result from the intermediate iterator.
196
- *
197
- * @param value
198
- * Tuple value to be passed to Iterator.next().
199
- *
200
- * @returns
201
- * Next result from the intermediate iterator.
202
- */
203
- intermediateNext(...value) {
204
- const initialResult = this.initialNext(...value);
205
- return initialResult.done !== true ? {
206
- value: this._callback(initialResult.value, this._index++)
207
- } : {
208
- done: true,
209
- value: void 0
210
- };
211
- }
212
- };
213
- var IteratorMapProxy = class extends IteratorMapProxyBase {
214
- /**
215
- * @inheritDoc
216
- */
217
- next(...value) {
218
- return this.intermediateNext(...value);
219
- }
220
- };
221
- var IteratorFlatMapProxy = class extends IteratorMapProxyBase {
222
- _intermediateIterator;
223
- /**
224
- * @inheritDoc
225
- */
226
- next(...value) {
227
- let finalResult = void 0;
228
- do {
229
- if (this._intermediateIterator === void 0) {
230
- const intermediateResult = this.intermediateNext(...value);
231
- if (intermediateResult.done === true) {
232
- finalResult = intermediateResult;
233
- } else {
234
- this._intermediateIterator = IteratorProxyBase.toIterable(intermediateResult.value)[Symbol.iterator]();
235
- }
236
- } else {
237
- const pendingFinalResult = this._intermediateIterator.next();
238
- if (pendingFinalResult.done === true) {
239
- this._intermediateIterator = void 0;
240
- } else {
241
- finalResult = pendingFinalResult;
242
- }
243
- }
244
- } while (finalResult === void 0);
245
- return finalResult;
246
- }
247
- };
248
- var IteratorFilterProxy = class extends IteratorProxyBase {
249
- /**
250
- * Predicate.
251
- */
252
- _predicate;
253
- /**
254
- * Expected truthy result of the predicate.
255
- */
256
- _expectedTruthy;
257
- /**
258
- * Index into iteration source.
259
- */
260
- _index;
261
- /**
262
- * Constructor.
263
- *
264
- * @param iterationSource
265
- * Iteration source.
266
- *
267
- * @param predicate
268
- * Predicate.
269
- *
270
- * @param expectedTruthy
271
- * Expected truthy result of the predicate.
272
- */
273
- constructor(iterationSource, predicate, expectedTruthy) {
274
- super(iterationSource);
275
- this._predicate = predicate;
276
- this._expectedTruthy = expectedTruthy;
277
- this._index = 0;
278
- }
279
- /**
280
- * @inheritDoc
281
- */
282
- next(...value) {
283
- let result;
284
- const expectedTruthy = this._expectedTruthy;
285
- do {
286
- result = this.initialNext(...value);
287
- } while (result.done !== true && Boolean(this._predicate(result.value, this._index++)) !== expectedTruthy);
288
- return result;
289
- }
290
- };
291
- var IteratorCountProxyBase = class extends IteratorProxyObject {
292
- /**
293
- * Count.
294
- */
295
- _count;
296
- /**
297
- * Constructor.
298
- *
299
- * @param initialIterationSource
300
- * Initial iteration source.
301
- *
302
- * @param count
303
- * Count.
304
- */
305
- constructor(initialIterationSource, count) {
306
- super(initialIterationSource);
307
- if (!Number.isInteger(count) || count < 0) {
308
- throw new RangeError("Count must be a positive integer");
309
- }
310
- this._count = count;
311
- }
312
- /**
313
- * Determine if iterator is exhausted (by count or by iterator itself).
314
- */
315
- get exhausted() {
316
- return this._count <= 0;
317
- }
318
- /**
319
- * @inheritDoc
320
- */
321
- next(...value) {
322
- const result = super.next(...value);
323
- if (result.done !== true) {
324
- this._count--;
325
- } else {
326
- this._count = 0;
327
- }
328
- return result;
1
+ // src/locale/i18n.ts
2
+ import { i18nAssertValidResources, i18nCoreInit } from "@aidc-toolkit/core";
3
+ import i18next from "i18next";
4
+
5
+ // src/locale/en/locale-strings.ts
6
+ var localeStrings = {
7
+ Transformer: {
8
+ domainMustBeGreaterThanZero: "Domain {{domain}} must be greater than 0",
9
+ tweakMustBeGreaterThanOrEqualToZero: "Tweak {{tweak}} must be greater than or equal to 0",
10
+ valueMustBeGreaterThanOrEqualToZero: "Value {{value}} must be greater than or equal to 0",
11
+ valueMustBeLessThan: "Value {{value}} must be less than {{domain}}",
12
+ minValueMustBeGreaterThanOrEqualToZero: "Minimum value {{minValue}} must be greater than or equal to 0",
13
+ maxValueMustBeLessThan: "Maximum value {{maxValue}} must be less than {{domain}}"
14
+ },
15
+ RegExpValidator: {
16
+ stringDoesNotMatchPattern: "String {{s}} does not match pattern"
17
+ },
18
+ CharacterSetValidator: {
19
+ firstZeroFirstCharacter: "Character set must support zero as first character",
20
+ allNumericAllNumericCharacters: "Character set must support all numeric characters in sequence",
21
+ stringMustNotBeAllNumeric: "String must not be all numeric",
22
+ lengthMustBeGreaterThanOrEqualTo: "Length {{length}} must be greater than or equal to {{minimumLength}}",
23
+ lengthMustBeLessThanOrEqualTo: "Length {{length}} must be less than or equal to {{maximumLength}}",
24
+ lengthMustBeEqualTo: "Length {{length}} must be equal to {{exactLength}}",
25
+ lengthOfComponentMustBeGreaterThanOrEqualTo: "Length {{length}} of {{component}} must be greater than or equal to {{minimumLength}}",
26
+ lengthOfComponentMustBeLessThanOrEqualTo: "Length {{length}} of {{component}} must be less than or equal to {{maximumLength}}",
27
+ lengthOfComponentMustBeEqualTo: "Length {{length}} of {{component}} must be equal to {{exactLength}}",
28
+ invalidCharacterAtPosition: "Invalid character '{{c}}' at position {{position}}",
29
+ invalidCharacterAtPositionOfComponent: "Invalid character '{{c}}' at position {{position}} of {{component}}",
30
+ exclusionNotSupported: "Exclusion value of {{exclusion}} is not supported",
31
+ invalidTweakWithAllNumericExclusion: "Tweak must not be used with all-numeric exclusion",
32
+ endSequenceValueMustBeLessThanOrEqualTo: "End sequence value (start sequence value + count - 1) must be less than {{domain}}"
33
+ },
34
+ RecordValidator: {
35
+ typeNameKeyNotFound: '{{typeName}} "{{key}}" not found'
329
36
  }
330
37
  };
331
- var IteratorTakeProxy = class extends IteratorCountProxyBase {
332
- /**
333
- * @inheritDoc
334
- */
335
- next(...value) {
336
- return !this.exhausted ? super.next(...value) : {
337
- done: true,
338
- value: void 0
339
- };
38
+
39
+ // src/locale/fr/locale-strings.ts
40
+ var localeStrings2 = {
41
+ Transformer: {
42
+ domainMustBeGreaterThanZero: "Le domaine {{domain}} doit \xEAtre sup\xE9rieur \xE0 0",
43
+ tweakMustBeGreaterThanOrEqualToZero: "Le r\xE9glage {{tweak}} doit \xEAtre sup\xE9rieur ou \xE9gal \xE0 0",
44
+ valueMustBeGreaterThanOrEqualToZero: "La valeur {{value}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 0",
45
+ valueMustBeLessThan: "La valeur {{value}} doit \xEAtre inf\xE9rieure \xE0 {{domain}}",
46
+ minValueMustBeGreaterThanOrEqualToZero: "La valeur minimale {{minValue}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 0",
47
+ maxValueMustBeLessThan: "La valeur maximale {{maxValue}} doit \xEAtre inf\xE9rieure \xE0 {{domain}}"
48
+ },
49
+ RegExpValidator: {
50
+ stringDoesNotMatchPattern: "La cha\xEEne {{s}} ne correspond pas au mod\xE8le"
51
+ },
52
+ CharacterSetValidator: {
53
+ firstZeroFirstCharacter: "Le jeu de caract\xE8res doit prendre en charge z\xE9ro comme premier caract\xE8re",
54
+ allNumericAllNumericCharacters: "Le jeu de caract\xE8res doit prendre en charge tous les caract\xE8res num\xE9riques en s\xE9quence",
55
+ stringMustNotBeAllNumeric: "La cha\xEEne ne doit pas \xEAtre enti\xE8rement num\xE9rique",
56
+ lengthMustBeGreaterThanOrEqualTo: "La longueur {{length}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 {{minimumLength}}",
57
+ lengthMustBeLessThanOrEqualTo: "La longueur {{length}} doit \xEAtre inf\xE9rieure ou \xE9gale \xE0 {{maximumLength}}",
58
+ lengthMustBeEqualTo: "La longueur {{length}} doit \xEAtre \xE9gale \xE0 {{exactLength}}",
59
+ lengthOfComponentMustBeGreaterThanOrEqualTo: "La longueur {{length}} de {{component}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 {{minimumLength}}",
60
+ lengthOfComponentMustBeLessThanOrEqualTo: "La longueur {{length}} de {{component}} doit \xEAtre inf\xE9rieure ou \xE9gale \xE0 {{maximumLength}}",
61
+ lengthOfComponentMustBeEqualTo: "La longueur {{length}} de {{component}} doit \xEAtre \xE9gale \xE0 {{exactLength}}",
62
+ invalidCharacterAtPosition: "Caract\xE8re non valide '{{c}}' \xE0 la position {{position}}",
63
+ invalidCharacterAtPositionOfComponent: "Caract\xE8re non valide '{{c}}' \xE0 la position {{position}} de {{component}}",
64
+ exclusionNotSupported: "La valeur d'exclusion de {{exclusion}} n'est pas prise en charge",
65
+ invalidTweakWithAllNumericExclusion: "Le r\xE9glage ne doit pas \xEAtre utilis\xE9 avec une exclusion enti\xE8rement num\xE9rique",
66
+ endSequenceValueMustBeLessThanOrEqualTo: "La valeur de la s\xE9quence de fin (valeur de la s\xE9quence de d\xE9but + nombre - 1) doit \xEAtre inf\xE9rieure \xE0 {{domaine}}"
67
+ },
68
+ RecordValidator: {
69
+ typeNameKeyNotFound: '{{typeName}} "{{key}}" introuvable'
340
70
  }
341
71
  };
342
- var IteratorDropProxy = class extends IteratorCountProxyBase {
343
- /**
344
- * @inheritDoc
345
- */
346
- next(...value) {
347
- while (!this.exhausted) {
348
- super.next(...value);
349
- }
350
- return super.next(...value);
72
+
73
+ // src/locale/i18n.ts
74
+ var utilityNS = "aidct_utility";
75
+ i18nAssertValidResources(localeStrings, "fr", localeStrings2);
76
+ var utilityResources = {
77
+ en: {
78
+ aidct_utility: localeStrings
79
+ },
80
+ fr: {
81
+ aidct_utility: localeStrings2
351
82
  }
352
83
  };
353
- function iteratorProxy() {
354
- let supported;
355
- try {
356
- supported = process.env["NODE_ENV"] !== "test";
357
- } catch (_e) {
358
- supported = true;
359
- }
360
- if (supported) {
361
- try {
362
- Iterator.from([]);
363
- } catch (_e) {
364
- supported = false;
365
- }
366
- }
367
- return supported ? Iterator : {
368
- /**
369
- * @inheritDoc
370
- */
371
- from(value) {
372
- return value instanceof IteratorProxyBase ? value : new IteratorProxyObject(value);
373
- }
374
- };
84
+ var i18nextUtility = i18next.createInstance();
85
+ async function i18nUtilityInit(environment, debug = false) {
86
+ await i18nCoreInit(i18nextUtility, environment, debug, utilityNS, utilityResources);
375
87
  }
376
- var IteratorProxy = iteratorProxy();
377
88
 
378
89
  // src/sequencer.ts
379
90
  var Sequencer = class {
@@ -401,10 +112,6 @@ var Sequencer = class {
401
112
  * Maximum value (inclusive).
402
113
  */
403
114
  _maxValue;
404
- /**
405
- * Next value.
406
- */
407
- _nextValue;
408
115
  /**
409
116
  * Constructor.
410
117
  *
@@ -419,8 +126,7 @@ var Sequencer = class {
419
126
  this._startValue = BigInt(startValue);
420
127
  this._endValue = this._startValue + BigInt(count);
421
128
  this._count = count;
422
- const ascending = count >= 0;
423
- if (ascending) {
129
+ if (count >= 0) {
424
130
  this._nextDelta = 1n;
425
131
  this._minValue = this._startValue;
426
132
  this._maxValue = this._endValue - 1n;
@@ -429,7 +135,6 @@ var Sequencer = class {
429
135
  this._minValue = this._endValue + 1n;
430
136
  this._maxValue = this._startValue;
431
137
  }
432
- this._nextValue = this._startValue;
433
138
  }
434
139
  /**
435
140
  * Get the start value (inclusive).
@@ -464,121 +169,27 @@ var Sequencer = class {
464
169
  /**
465
170
  * Iterable implementation.
466
171
  *
467
- * @returns
468
- * this
469
- */
470
- [Symbol.iterator]() {
471
- return this;
472
- }
473
- /**
474
- * Iterator implementation.
475
- *
476
- * @returns
477
- * Iterator result. If iterator is exhausted, the value is absolute value of the count.
172
+ * @yields
173
+ * Next value in sequence.
478
174
  */
479
- next() {
480
- const done = this._nextValue === this._endValue;
481
- let result;
482
- if (!done) {
483
- result = {
484
- value: this._nextValue
485
- };
486
- this._nextValue += this._nextDelta;
487
- } else {
488
- result = {
489
- done: true,
490
- value: Math.abs(this._count)
491
- };
175
+ *[Symbol.iterator]() {
176
+ for (let value = this._startValue; value !== this._endValue; value += this._nextDelta) {
177
+ yield value;
492
178
  }
493
- return result;
494
- }
495
- /**
496
- * Reset the iterator.
497
- */
498
- reset() {
499
- this._nextValue = this._startValue;
500
- }
501
- };
502
-
503
- // src/locale/i18n.ts
504
- import { i18nAddResourceBundle, i18nAssertValidResources, i18next } from "@aidc-toolkit/core";
505
-
506
- // src/locale/en/locale_strings.ts
507
- var localeStrings = {
508
- Transformer: {
509
- domainMustBeGreaterThanZero: "Domain {{domain}} must be greater than 0",
510
- tweakMustBeGreaterThanOrEqualToZero: "Tweak {{tweak}} must be greater than or equal to 0",
511
- valueMustBeGreaterThanOrEqualToZero: "Value {{value}} must be greater than or equal to 0",
512
- valueMustBeLessThan: "Value {{value}} must be less than {{domain}}",
513
- minValueMustBeGreaterThanOrEqualToZero: "Minimum value {{minValue}} must be greater than or equal to 0",
514
- maxValueMustBeLessThan: "Maximum value {{maxValue}} must be less than {{domain}}"
515
- },
516
- RegExpValidator: {
517
- stringDoesNotMatchPattern: "String {{s}} does not match pattern"
518
- },
519
- CharacterSetValidator: {
520
- firstZeroFirstCharacter: "Character set must support zero as first character",
521
- allNumericAllNumericCharacters: "Character set must support all numeric characters in sequence",
522
- stringMustNotBeAllNumeric: "String must not be all numeric",
523
- lengthMustBeGreaterThanOrEqualTo: "Length {{length}} must be greater than or equal to {{minimumLength}}",
524
- lengthMustBeLessThanOrEqualTo: "Length {{length}} must be less than or equal to {{maximumLength}}",
525
- lengthMustBeEqualTo: "Length {{length}} must be equal to {{exactLength}}",
526
- lengthOfComponentMustBeGreaterThanOrEqualTo: "Length {{length}} of {{component}} must be greater than or equal to {{minimumLength}}",
527
- lengthOfComponentMustBeLessThanOrEqualTo: "Length {{length}} of {{component}} must be less than or equal to {{maximumLength}}",
528
- lengthOfComponentMustBeEqualTo: "Length {{length}} of {{component}} must be equal to {{exactLength}}",
529
- invalidCharacterAtPosition: "Invalid character '{{c}}' at position {{position}}",
530
- invalidCharacterAtPositionOfComponent: "Invalid character '{{c}}' at position {{position}} of {{component}}",
531
- exclusionNotSupported: "Exclusion value of {{exclusion}} is not supported",
532
- invalidTweakWithAllNumericExclusion: "Tweak must not be used with all-numeric exclusion",
533
- endSequenceValueMustBeLessThanOrEqualTo: "End sequence value (start sequence value + count - 1) must be less than {{domain}}"
534
- },
535
- RecordValidator: {
536
- typeNameKeyNotFound: '{{typeName}} "{{key}}" not found'
537
- }
538
- };
539
-
540
- // src/locale/fr/locale_strings.ts
541
- var localeStrings2 = {
542
- Transformer: {
543
- domainMustBeGreaterThanZero: "Le domaine {{domain}} doit \xEAtre sup\xE9rieur \xE0 0",
544
- tweakMustBeGreaterThanOrEqualToZero: "Le r\xE9glage {{tweak}} doit \xEAtre sup\xE9rieur ou \xE9gal \xE0 0",
545
- valueMustBeGreaterThanOrEqualToZero: "La valeur {{value}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 0",
546
- valueMustBeLessThan: "La valeur {{value}} doit \xEAtre inf\xE9rieure \xE0 {{domain}}",
547
- minValueMustBeGreaterThanOrEqualToZero: "La valeur minimale {{minValue}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 0",
548
- maxValueMustBeLessThan: "La valeur maximale {{maxValue}} doit \xEAtre inf\xE9rieure \xE0 {{domain}}"
549
- },
550
- RegExpValidator: {
551
- stringDoesNotMatchPattern: "La cha\xEEne {{s}} ne correspond pas au mod\xE8le"
552
- },
553
- CharacterSetValidator: {
554
- firstZeroFirstCharacter: "Le jeu de caract\xE8res doit prendre en charge z\xE9ro comme premier caract\xE8re",
555
- allNumericAllNumericCharacters: "Le jeu de caract\xE8res doit prendre en charge tous les caract\xE8res num\xE9riques en s\xE9quence",
556
- stringMustNotBeAllNumeric: "La cha\xEEne ne doit pas \xEAtre enti\xE8rement num\xE9rique",
557
- lengthMustBeGreaterThanOrEqualTo: "La longueur {{length}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 {{minimumLength}}",
558
- lengthMustBeLessThanOrEqualTo: "La longueur {{length}} doit \xEAtre inf\xE9rieure ou \xE9gale \xE0 {{maximumLength}}",
559
- lengthMustBeEqualTo: "La longueur {{length}} doit \xEAtre \xE9gale \xE0 {{exactLength}}",
560
- lengthOfComponentMustBeGreaterThanOrEqualTo: "La longueur {{length}} de {{component}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 {{minimumLength}}",
561
- lengthOfComponentMustBeLessThanOrEqualTo: "La longueur {{length}} de {{component}} doit \xEAtre inf\xE9rieure ou \xE9gale \xE0 {{maximumLength}}",
562
- lengthOfComponentMustBeEqualTo: "La longueur {{length}} de {{component}} doit \xEAtre \xE9gale \xE0 {{exactLength}}",
563
- invalidCharacterAtPosition: "Caract\xE8re non valide '{{c}}' \xE0 la position {{position}}",
564
- invalidCharacterAtPositionOfComponent: "Caract\xE8re non valide '{{c}}' \xE0 la position {{position}} de {{component}}",
565
- exclusionNotSupported: "La valeur d'exclusion de {{exclusion}} n'est pas prise en charge",
566
- invalidTweakWithAllNumericExclusion: "Le r\xE9glage ne doit pas \xEAtre utilis\xE9 avec une exclusion enti\xE8rement num\xE9rique",
567
- endSequenceValueMustBeLessThanOrEqualTo: "La valeur de la s\xE9quence de fin (valeur de la s\xE9quence de d\xE9but + nombre - 1) doit \xEAtre inf\xE9rieure \xE0 {{domaine}}"
568
- },
569
- RecordValidator: {
570
- typeNameKeyNotFound: '{{typeName}} "{{key}}" introuvable'
571
179
  }
572
180
  };
573
181
 
574
- // src/locale/i18n.ts
575
- var utilityNS = "aidct_utility";
576
- i18nAssertValidResources(localeStrings, "fr", localeStrings2);
577
- i18nAddResourceBundle("en", utilityNS, localeStrings);
578
- i18nAddResourceBundle("fr", utilityNS, localeStrings2);
579
- var i18n_default = i18next;
580
-
581
182
  // src/transformer.ts
183
+ function transformIterable(iterable, transformerCallback) {
184
+ return {
185
+ *[Symbol.iterator]() {
186
+ let index = 0;
187
+ for (const input of iterable) {
188
+ yield transformerCallback(input, index++);
189
+ }
190
+ }
191
+ };
192
+ }
582
193
  var Transformer = class _Transformer {
583
194
  /**
584
195
  * Transformers cache, mapping a domain to another map, which maps an optional tweak to a transformer.
@@ -597,8 +208,7 @@ var Transformer = class _Transformer {
597
208
  constructor(domain) {
598
209
  this._domain = BigInt(domain);
599
210
  if (this._domain <= 0n) {
600
- throw new RangeError(i18n_default.t("Transformer.domainMustBeGreaterThanZero", {
601
- ns: utilityNS,
211
+ throw new RangeError(i18nextUtility.t("Transformer.domainMustBeGreaterThanZero", {
602
212
  domain
603
213
  }));
604
214
  }
@@ -647,14 +257,12 @@ var Transformer = class _Transformer {
647
257
  */
648
258
  validate(value) {
649
259
  if (value < 0n) {
650
- throw new RangeError(i18n_default.t("Transformer.valueMustBeGreaterThanOrEqualToZero", {
651
- ns: utilityNS,
260
+ throw new RangeError(i18nextUtility.t("Transformer.valueMustBeGreaterThanOrEqualToZero", {
652
261
  value
653
262
  }));
654
263
  }
655
264
  if (value >= this.domain) {
656
- throw new RangeError(i18n_default.t("Transformer.valueMustBeLessThan", {
657
- ns: utilityNS,
265
+ throw new RangeError(i18nextUtility.t("Transformer.valueMustBeLessThan", {
658
266
  value,
659
267
  domain: this.domain
660
268
  }));
@@ -670,29 +278,35 @@ var Transformer = class _Transformer {
670
278
  result = transformerCallback === void 0 ? transformedValue : transformerCallback(transformedValue, 0);
671
279
  } else if (valueOrValues instanceof Sequencer) {
672
280
  if (valueOrValues.minValue < 0n) {
673
- throw new RangeError(i18n_default.t("Transformer.minValueMustBeGreaterThanOrEqualToZero", {
674
- ns: utilityNS,
281
+ throw new RangeError(i18nextUtility.t("Transformer.minValueMustBeGreaterThanOrEqualToZero", {
675
282
  minValue: valueOrValues.minValue
676
283
  }));
677
284
  }
678
285
  if (valueOrValues.maxValue >= this.domain) {
679
- throw new RangeError(i18n_default.t("Transformer.maxValueMustBeLessThan", {
680
- ns: utilityNS,
286
+ throw new RangeError(i18nextUtility.t("Transformer.maxValueMustBeLessThan", {
681
287
  maxValue: valueOrValues.maxValue,
682
288
  domain: this.domain
683
289
  }));
684
290
  }
685
- result = transformerCallback === void 0 ? IteratorProxy.from(valueOrValues).map((value) => this.doForward(value)) : IteratorProxy.from(valueOrValues).map((value, index) => transformerCallback(this.doForward(value), index));
291
+ if (transformerCallback === void 0) {
292
+ result = transformIterable(valueOrValues, (value) => this.doForward(value));
293
+ } else {
294
+ result = transformIterable(valueOrValues, (value, index) => transformerCallback(this.doForward(value), index));
295
+ }
686
296
  } else {
687
- result = transformerCallback === void 0 ? IteratorProxy.from(valueOrValues).map((value) => {
688
- const valueN = BigInt(value);
689
- this.validate(valueN);
690
- return this.doForward(valueN);
691
- }) : IteratorProxy.from(valueOrValues).map((value, index) => {
692
- const valueN = BigInt(value);
693
- this.validate(valueN);
694
- return transformerCallback(this.doForward(valueN), index);
695
- });
297
+ if (transformerCallback === void 0) {
298
+ result = transformIterable(valueOrValues, (value) => {
299
+ const valueN = BigInt(value);
300
+ this.validate(valueN);
301
+ return this.doForward(valueN);
302
+ });
303
+ } else {
304
+ result = transformIterable(valueOrValues, (value, index) => {
305
+ const valueN = BigInt(value);
306
+ this.validate(valueN);
307
+ return transformerCallback(this.doForward(valueN), index);
308
+ });
309
+ }
696
310
  }
697
311
  return result;
698
312
  }
@@ -788,8 +402,7 @@ var EncryptionTransformer = class _EncryptionTransformer extends Transformer {
788
402
  constructor(domain, tweak) {
789
403
  super(domain);
790
404
  if (tweak < 0n) {
791
- throw new RangeError(i18n_default.t("Transformer.tweakMustBeGreaterThanOrEqualToZero", {
792
- ns: utilityNS,
405
+ throw new RangeError(i18nextUtility.t("Transformer.tweakMustBeGreaterThanOrEqualToZero", {
793
406
  tweak
794
407
  }));
795
408
  }
@@ -980,7 +593,7 @@ var EncryptionTransformer = class _EncryptionTransformer extends Transformer {
980
593
  }
981
594
  };
982
595
 
983
- // src/reg_exp.ts
596
+ // src/reg-exp.ts
984
597
  var RegExpValidator = class {
985
598
  /**
986
599
  * Regular expression.
@@ -1012,8 +625,7 @@ var RegExpValidator = class {
1012
625
  * Error message.
1013
626
  */
1014
627
  createErrorMessage(s) {
1015
- return i18n_default.t("RegExpValidator.stringDoesNotMatchPattern", {
1016
- ns: utilityNS,
628
+ return i18nextUtility.t("RegExpValidator.stringDoesNotMatchPattern", {
1017
629
  s
1018
630
  });
1019
631
  }
@@ -1069,9 +681,8 @@ var RecordValidator = class {
1069
681
  * Record key.
1070
682
  */
1071
683
  validate(key) {
1072
- if (this.record[key] === void 0) {
1073
- throw new RangeError(i18n_default.t("RecordValidator.typeNameKeyNotFound", {
1074
- ns: utilityNS,
684
+ if (!(key in this.record)) {
685
+ throw new RangeError(i18nextUtility.t("RecordValidator.typeNameKeyNotFound", {
1075
686
  typeName: this.typeName,
1076
687
  key
1077
688
  }));
@@ -1079,7 +690,7 @@ var RecordValidator = class {
1079
690
  }
1080
691
  };
1081
692
 
1082
- // src/character_set.ts
693
+ // src/character-set.ts
1083
694
  var Exclusion = /* @__PURE__ */ ((Exclusion2) => {
1084
695
  Exclusion2[Exclusion2["None"] = 0] = "None";
1085
696
  Exclusion2[Exclusion2["FirstZero"] = 1] = "FirstZero";
@@ -1098,9 +709,7 @@ var CharacterSetValidator = class _CharacterSetValidator {
1098
709
  * Error message.
1099
710
  */
1100
711
  createErrorMessage(_s) {
1101
- return i18n_default.t("CharacterSetValidator.stringMustNotBeAllNumeric", {
1102
- ns: utilityNS
1103
- });
712
+ return i18nextUtility.t("CharacterSetValidator.stringMustNotBeAllNumeric");
1104
713
  }
1105
714
  }(/\D/);
1106
715
  /**
@@ -1210,8 +819,7 @@ var CharacterSetValidator = class _CharacterSetValidator {
1210
819
  */
1211
820
  validateExclusion(exclusion) {
1212
821
  if (exclusion !== 0 /* None */ && !this._exclusionSupport.includes(exclusion)) {
1213
- throw new RangeError(i18n_default.t("CharacterSetValidator.exclusionNotSupported", {
1214
- ns: utilityNS,
822
+ throw new RangeError(i18nextUtility.t("CharacterSetValidator.exclusionNotSupported", {
1215
823
  exclusion
1216
824
  }));
1217
825
  }
@@ -1233,15 +841,13 @@ var CharacterSetValidator = class _CharacterSetValidator {
1233
841
  if (minimumLength !== void 0 && length < minimumLength) {
1234
842
  let errorMessage;
1235
843
  if (maximumLength !== void 0 && maximumLength === minimumLength) {
1236
- errorMessage = i18n_default.t(validation?.component === void 0 ? "CharacterSetValidator.lengthMustBeEqualTo" : "CharacterSetValidator.lengthOfComponentMustBeEqualTo", {
1237
- ns: utilityNS,
844
+ errorMessage = i18nextUtility.t(validation?.component === void 0 ? "CharacterSetValidator.lengthMustBeEqualTo" : "CharacterSetValidator.lengthOfComponentMustBeEqualTo", {
1238
845
  component: _CharacterSetValidator.componentToString(validation?.component),
1239
846
  length,
1240
847
  exactLength: minimumLength
1241
848
  });
1242
849
  } else {
1243
- errorMessage = i18n_default.t(validation?.component === void 0 ? "CharacterSetValidator.lengthMustBeGreaterThanOrEqualTo" : "CharacterSetValidator.lengthOfComponentMustBeGreaterThanOrEqualTo", {
1244
- ns: utilityNS,
850
+ errorMessage = i18nextUtility.t(validation?.component === void 0 ? "CharacterSetValidator.lengthMustBeGreaterThanOrEqualTo" : "CharacterSetValidator.lengthOfComponentMustBeGreaterThanOrEqualTo", {
1245
851
  component: _CharacterSetValidator.componentToString(validation?.component),
1246
852
  length,
1247
853
  minimumLength
@@ -1250,8 +856,7 @@ var CharacterSetValidator = class _CharacterSetValidator {
1250
856
  throw new RangeError(errorMessage);
1251
857
  }
1252
858
  if (maximumLength !== void 0 && length > maximumLength) {
1253
- throw new RangeError(i18n_default.t(validation?.component === void 0 ? "CharacterSetValidator.lengthMustBeLessThanOrEqualTo" : "CharacterSetValidator.lengthOfComponentMustBeLessThanOrEqualTo", {
1254
- ns: utilityNS,
859
+ throw new RangeError(i18nextUtility.t(validation?.component === void 0 ? "CharacterSetValidator.lengthMustBeLessThanOrEqualTo" : "CharacterSetValidator.lengthOfComponentMustBeLessThanOrEqualTo", {
1255
860
  component: _CharacterSetValidator.componentToString(validation?.component),
1256
861
  length,
1257
862
  maximumLength
@@ -1259,8 +864,7 @@ var CharacterSetValidator = class _CharacterSetValidator {
1259
864
  }
1260
865
  const index = this.characterIndexes(s).findIndex((characterIndex) => characterIndex === void 0);
1261
866
  if (index !== -1) {
1262
- throw new RangeError(i18n_default.t(validation?.component === void 0 ? "CharacterSetValidator.invalidCharacterAtPosition" : "CharacterSetValidator.invalidCharacterAtPositionOfComponent", {
1263
- ns: utilityNS,
867
+ throw new RangeError(i18nextUtility.t(validation?.component === void 0 ? "CharacterSetValidator.invalidCharacterAtPosition" : "CharacterSetValidator.invalidCharacterAtPositionOfComponent", {
1264
868
  component: _CharacterSetValidator.componentToString(validation?.component),
1265
869
  c: s.charAt(index),
1266
870
  position: index + (validation?.positionOffset ?? 0) + 1
@@ -1273,8 +877,7 @@ var CharacterSetValidator = class _CharacterSetValidator {
1273
877
  break;
1274
878
  case 1 /* FirstZero */:
1275
879
  if (s.startsWith("0")) {
1276
- throw new RangeError(i18n_default.t(validation.component === void 0 ? "CharacterSetValidator.invalidCharacterAtPosition" : "CharacterSetValidator.invalidCharacterAtPositionOfComponent", {
1277
- ns: utilityNS,
880
+ throw new RangeError(i18nextUtility.t(validation.component === void 0 ? "CharacterSetValidator.invalidCharacterAtPosition" : "CharacterSetValidator.invalidCharacterAtPositionOfComponent", {
1278
881
  component: _CharacterSetValidator.componentToString(validation.component),
1279
882
  c: "0",
1280
883
  position: (validation.positionOffset ?? 0) + 1
@@ -1361,9 +964,7 @@ var CharacterSetCreator = class _CharacterSetCreator extends CharacterSetValidat
1361
964
  exclusionDomains[0 /* None */] = exclusionNoneDomains;
1362
965
  if (exclusionSupport.includes(1 /* FirstZero */)) {
1363
966
  if (characterSet[0] !== "0") {
1364
- throw new RangeError(i18n_default.t("CharacterSetValidator.firstZeroFirstCharacter", {
1365
- ns: utilityNS
1366
- }));
967
+ throw new RangeError(i18nextUtility.t("CharacterSetValidator.firstZeroFirstCharacter"));
1367
968
  }
1368
969
  const exclusionFirstZeroDomains = new Array(_CharacterSetCreator.MAXIMUM_STRING_LENGTH + 1);
1369
970
  exclusionFirstZeroDomains[0] = 0n;
@@ -1377,9 +978,7 @@ var CharacterSetCreator = class _CharacterSetCreator extends CharacterSetValidat
1377
978
  let expectedNumberIndex = numberIndexes2[0];
1378
979
  for (const numberIndex of numberIndexes2) {
1379
980
  if (numberIndex === void 0 || numberIndex !== expectedNumberIndex) {
1380
- throw new RangeError(i18n_default.t("CharacterSetValidator.allNumericAllNumericCharacters", {
1381
- ns: utilityNS
1382
- }));
981
+ throw new RangeError(i18nextUtility.t("CharacterSetValidator.allNumericAllNumericCharacters"));
1383
982
  }
1384
983
  expectedNumberIndex = numberIndex + 1;
1385
984
  }
@@ -1434,9 +1033,7 @@ var CharacterSetCreator = class _CharacterSetCreator extends CharacterSetValidat
1434
1033
  let shift;
1435
1034
  if (length === 0) {
1436
1035
  if (!shiftForward && value < 10n) {
1437
- throw new RangeError(i18n_default.t("CharacterSetValidator.stringMustNotBeAllNumeric", {
1438
- ns: utilityNS
1439
- }));
1036
+ throw new RangeError(i18nextUtility.t("CharacterSetValidator.stringMustNotBeAllNumeric"));
1440
1037
  }
1441
1038
  shift = 10n;
1442
1039
  } else {
@@ -1460,15 +1057,13 @@ var CharacterSetCreator = class _CharacterSetCreator extends CharacterSetValidat
1460
1057
  */
1461
1058
  validateLength(length) {
1462
1059
  if (length < 0) {
1463
- throw new RangeError(i18n_default.t("CharacterSetValidator.lengthMustBeGreaterThanOrEqualTo", {
1464
- ns: utilityNS,
1060
+ throw new RangeError(i18nextUtility.t("CharacterSetValidator.lengthMustBeGreaterThanOrEqualTo", {
1465
1061
  length,
1466
1062
  minimumLength: 0
1467
1063
  }));
1468
1064
  }
1469
1065
  if (length > _CharacterSetCreator.MAXIMUM_STRING_LENGTH) {
1470
- throw new RangeError(i18n_default.t("CharacterSetValidator.lengthMustBeLessThanOrEqualTo", {
1471
- ns: utilityNS,
1066
+ throw new RangeError(i18nextUtility.t("CharacterSetValidator.lengthMustBeLessThanOrEqualTo", {
1472
1067
  length,
1473
1068
  maximumLength: _CharacterSetCreator.MAXIMUM_STRING_LENGTH
1474
1069
  }));
@@ -1542,8 +1137,7 @@ var CharacterSetCreator = class _CharacterSetCreator extends CharacterSetValidat
1542
1137
  const characterSetSizeN = BigInt(this.characterSetSize);
1543
1138
  let value = this.characterIndexes(s).reduce((accumulator, characterIndex, index) => {
1544
1139
  if (characterIndex === void 0) {
1545
- throw new RangeError(i18n_default.t("CharacterSetValidator.invalidCharacterAtPosition", {
1546
- ns: utilityNS,
1140
+ throw new RangeError(i18nextUtility.t("CharacterSetValidator.invalidCharacterAtPosition", {
1547
1141
  c: s.charAt(index),
1548
1142
  position: index + 1
1549
1143
  }));
@@ -1551,8 +1145,7 @@ var CharacterSetCreator = class _CharacterSetCreator extends CharacterSetValidat
1551
1145
  let value2;
1552
1146
  if (index === 0 && exclusion === 1 /* FirstZero */) {
1553
1147
  if (characterIndex === 0) {
1554
- throw new RangeError(i18n_default.t("CharacterSetValidator.invalidCharacterAtPosition", {
1555
- ns: utilityNS,
1148
+ throw new RangeError(i18nextUtility.t("CharacterSetValidator.invalidCharacterAtPosition", {
1556
1149
  c: "0",
1557
1150
  position: 1
1558
1151
  }));
@@ -1677,10 +1270,14 @@ export {
1677
1270
  Exclusion,
1678
1271
  HEXADECIMAL_CREATOR,
1679
1272
  IdentityTransformer,
1680
- IteratorProxy,
1681
1273
  NUMERIC_CREATOR,
1682
1274
  RecordValidator,
1683
1275
  RegExpValidator,
1684
1276
  Sequencer,
1685
- Transformer
1277
+ Transformer,
1278
+ i18nUtilityInit,
1279
+ i18nextUtility,
1280
+ transformIterable,
1281
+ utilityNS,
1282
+ utilityResources
1686
1283
  };