@aidc-toolkit/utility 1.0.26-beta → 1.0.28-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/record.js CHANGED
@@ -10,11 +10,11 @@ export class RecordValidator {
10
10
  /**
11
11
  * Type name for error message.
12
12
  */
13
- _typeName;
13
+ #typeName;
14
14
  /**
15
15
  * Record in which to look up keys.
16
16
  */
17
- _record;
17
+ #record;
18
18
  /**
19
19
  * Constructor.
20
20
  *
@@ -25,20 +25,20 @@ export class RecordValidator {
25
25
  * Record in which to look up keys.
26
26
  */
27
27
  constructor(typeName, record) {
28
- this._typeName = typeName;
29
- this._record = record;
28
+ this.#typeName = typeName;
29
+ this.#record = record;
30
30
  }
31
31
  /**
32
32
  * Get the type name.
33
33
  */
34
34
  get typeName() {
35
- return this._typeName;
35
+ return this.#typeName;
36
36
  }
37
37
  /**
38
38
  * Get the record.
39
39
  */
40
40
  get record() {
41
- return this._record;
41
+ return this.#record;
42
42
  }
43
43
  /**
44
44
  * Validate a key by looking it up in the record.
@@ -1 +1 @@
1
- {"version":3,"file":"record.js","sourceRoot":"","sources":["../src/record.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD;;;;;;GAMG;AACH,MAAM,OAAO,eAAe;IACxB;;OAEG;IACc,SAAS,CAAS;IAEnC;;OAEG;IACc,OAAO,CAA8B;IAEtD;;;;;;;;OAQG;IACH,YAAY,QAAgB,EAAE,MAAmC;QAC7D,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,IAAI,QAAQ;QACR,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;;;;OAKG;IACH,QAAQ,CAAC,GAAW;QAChB,IAAI,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,qCAAqC,EAAE;gBACzE,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,GAAG;aACN,CAAC,CAAC,CAAC;QACR,CAAC;IACL,CAAC;CACJ"}
1
+ {"version":3,"file":"record.js","sourceRoot":"","sources":["../src/record.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD;;;;;;GAMG;AACH,MAAM,OAAO,eAAe;IACxB;;OAEG;IACM,SAAS,CAAS;IAE3B;;OAEG;IACM,OAAO,CAA8B;IAE9C;;;;;;;;OAQG;IACH,YAAY,QAAgB,EAAE,MAAmC;QAC7D,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,IAAI,QAAQ;QACR,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;;;;OAKG;IACH,QAAQ,CAAC,GAAW;QAChB,IAAI,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,qCAAqC,EAAE;gBACzE,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,GAAG;aACN,CAAC,CAAC,CAAC;QACR,CAAC;IACL,CAAC;CACJ"}
package/dist/reg-exp.d.ts CHANGED
@@ -9,10 +9,7 @@ import type { StringValidator } from "./string.js";
9
9
  * to create a more suitable error message for their use case.
10
10
  */
11
11
  export declare class RegExpValidator implements StringValidator {
12
- /**
13
- * Regular expression.
14
- */
15
- private readonly _regExp;
12
+ #private;
16
13
  /**
17
14
  * Constructor.
18
15
  *
@@ -1 +1 @@
1
- {"version":3,"file":"reg-exp.d.ts","sourceRoot":"","sources":["../src/reg-exp.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;;;;;;;GAQG;AACH,qBAAa,eAAgB,YAAW,eAAe;IACnD;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IAEjC;;;;;OAKG;gBACS,MAAM,EAAE,MAAM;IAI1B;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;;;;;;;;OASG;IACH,SAAS,CAAC,kBAAkB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAM/C;;OAEG;IACH,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;CAK5B"}
1
+ {"version":3,"file":"reg-exp.d.ts","sourceRoot":"","sources":["../src/reg-exp.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;;;;;;;GAQG;AACH,qBAAa,eAAgB,YAAW,eAAe;;IAMnD;;;;;OAKG;gBACS,MAAM,EAAE,MAAM;IAI1B;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;;;;;;;;OASG;IACH,SAAS,CAAC,kBAAkB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAM/C;;OAEG;IACH,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;CAK5B"}
package/dist/reg-exp.js CHANGED
@@ -12,7 +12,7 @@ export class RegExpValidator {
12
12
  /**
13
13
  * Regular expression.
14
14
  */
15
- _regExp;
15
+ #regExp;
16
16
  /**
17
17
  * Constructor.
18
18
  *
@@ -20,13 +20,13 @@ export class RegExpValidator {
20
20
  * Regular expression. See {@link RegExpValidator | class documentation} for notes.
21
21
  */
22
22
  constructor(regExp) {
23
- this._regExp = regExp;
23
+ this.#regExp = regExp;
24
24
  }
25
25
  /**
26
26
  * Get the regular expression.
27
27
  */
28
28
  get regExp() {
29
- return this._regExp;
29
+ return this.#regExp;
30
30
  }
31
31
  /**
32
32
  * Create an error message for a string. The generic error message is sufficient for many use cases but a more
@@ -47,7 +47,7 @@ export class RegExpValidator {
47
47
  * @inheritDoc
48
48
  */
49
49
  validate(s) {
50
- if (!this._regExp.test(s)) {
50
+ if (!this.#regExp.test(s)) {
51
51
  throw new RangeError(this.createErrorMessage(s));
52
52
  }
53
53
  }
@@ -1 +1 @@
1
- {"version":3,"file":"reg-exp.js","sourceRoot":"","sources":["../src/reg-exp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD;;;;;;;;GAQG;AACH,MAAM,OAAO,eAAe;IACxB;;OAEG;IACc,OAAO,CAAS;IAEjC;;;;;OAKG;IACH,YAAY,MAAc;QACtB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;;;;;;;;OASG;IACO,kBAAkB,CAAC,CAAS;QAClC,OAAO,cAAc,CAAC,CAAC,CAAC,2CAA2C,EAAE;YACjE,CAAC;SACJ,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,CAAS;QACd,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,UAAU,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;QACrD,CAAC;IACL,CAAC;CACJ"}
1
+ {"version":3,"file":"reg-exp.js","sourceRoot":"","sources":["../src/reg-exp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD;;;;;;;;GAQG;AACH,MAAM,OAAO,eAAe;IACxB;;OAEG;IACM,OAAO,CAAS;IAEzB;;;;;OAKG;IACH,YAAY,MAAc;QACtB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;;;;;;;;OASG;IACO,kBAAkB,CAAC,CAAS;QAClC,OAAO,cAAc,CAAC,CAAC,CAAC,2CAA2C,EAAE;YACjE,CAAC;SACJ,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,CAAS;QACd,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,UAAU,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;QACrD,CAAC;IACL,CAAC;CACJ"}
@@ -2,30 +2,7 @@
2
2
  * Sequence. Defines an ascending or descending sequence of big integers implemented as an iterable.
3
3
  */
4
4
  export declare class Sequence implements Iterable<bigint> {
5
- /**
6
- * Start value (inclusive).
7
- */
8
- private readonly _startValue;
9
- /**
10
- * End value (exclusive).
11
- */
12
- private readonly _endValue;
13
- /**
14
- * Count of values.
15
- */
16
- private readonly _count;
17
- /**
18
- * Delta to the next value; equal to the sign of the count.
19
- */
20
- private readonly _nextDelta;
21
- /**
22
- * Minimum value (inclusive).
23
- */
24
- private readonly _minimumValue;
25
- /**
26
- * Maximum value (inclusive).
27
- */
28
- private readonly _maximumValue;
5
+ #private;
29
6
  /**
30
7
  * Constructor.
31
8
  *
@@ -1 +1 @@
1
- {"version":3,"file":"sequence.d.ts","sourceRoot":"","sources":["../src/sequence.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,QAAS,YAAW,QAAQ,CAAC,MAAM,CAAC;IAC7C;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IAErC;;OAEG;IACH,OAAO,CAAC,QAA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ED
@@ -5,27 +5,27 @@ export class Sequence {
5
5
  /**
6
6
  * Start value (inclusive).
7
7
  */
8
- _startValue;
8
+ #startValue;
9
9
  /**
10
10
  * End value (exclusive).
11
11
  */
12
- _endValue;
12
+ #endValue;
13
13
  /**
14
14
  * Count of values.
15
15
  */
16
- _count;
16
+ #count;
17
17
  /**
18
18
  * Delta to the next value; equal to the sign of the count.
19
19
  */
20
- _nextDelta;
20
+ #nextDelta;
21
21
  /**
22
22
  * Minimum value (inclusive).
23
23
  */
24
- _minimumValue;
24
+ #minimumValue;
25
25
  /**
26
26
  * Maximum value (inclusive).
27
27
  */
28
- _maximumValue;
28
+ #maximumValue;
29
29
  /**
30
30
  * Constructor.
31
31
  *
@@ -37,49 +37,49 @@ export class Sequence {
37
37
  * start value.
38
38
  */
39
39
  constructor(startValue, count) {
40
- this._startValue = BigInt(startValue);
41
- this._endValue = this._startValue + BigInt(count);
42
- this._count = count;
40
+ this.#startValue = BigInt(startValue);
41
+ this.#endValue = this.#startValue + BigInt(count);
42
+ this.#count = count;
43
43
  if (count >= 0) {
44
- this._nextDelta = 1n;
45
- this._minimumValue = this._startValue;
46
- this._maximumValue = this._endValue - 1n;
44
+ this.#nextDelta = 1n;
45
+ this.#minimumValue = this.#startValue;
46
+ this.#maximumValue = this.#endValue - 1n;
47
47
  }
48
48
  else {
49
- this._nextDelta = -1n;
50
- this._minimumValue = this._endValue + 1n;
51
- this._maximumValue = this._startValue;
49
+ this.#nextDelta = -1n;
50
+ this.#minimumValue = this.#endValue + 1n;
51
+ this.#maximumValue = this.#startValue;
52
52
  }
53
53
  }
54
54
  /**
55
55
  * Get the start value (inclusive).
56
56
  */
57
57
  get startValue() {
58
- return this._startValue;
58
+ return this.#startValue;
59
59
  }
60
60
  /**
61
61
  * Get the end value (exclusive).
62
62
  */
63
63
  get endValue() {
64
- return this._endValue;
64
+ return this.#endValue;
65
65
  }
66
66
  /**
67
67
  * Get the count of values.
68
68
  */
69
69
  get count() {
70
- return this._count;
70
+ return this.#count;
71
71
  }
72
72
  /**
73
73
  * Get the minimum value (inclusive).
74
74
  */
75
75
  get minimumValue() {
76
- return this._minimumValue;
76
+ return this.#minimumValue;
77
77
  }
78
78
  /**
79
79
  * Get the maximum value (inclusive).
80
80
  */
81
81
  get maximumValue() {
82
- return this._maximumValue;
82
+ return this.#maximumValue;
83
83
  }
84
84
  /**
85
85
  * Iterable implementation.
@@ -88,7 +88,7 @@ export class Sequence {
88
88
  * Next value in sequence.
89
89
  */
90
90
  *[Symbol.iterator]() {
91
- for (let value = this._startValue; value !== this._endValue; value += this._nextDelta) {
91
+ for (let value = this.#startValue; value !== this.#endValue; value += this.#nextDelta) {
92
92
  yield value;
93
93
  }
94
94
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sequence.js","sourceRoot":"","sources":["../src/sequence.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,QAAQ;IACjB;;OAEG;IACc,WAAW,CAAS;IAErC;;OAEG;IACc,SAAS,CAAS;IAEnC;;OAEG;IACc,MAAM,CAAS;IAEhC;;OAEG;IACc,UAAU,CAAW;IAEtC;;OAEG;IACc,aAAa,CAAS;IAEvC;;OAEG;IACc,aAAa,CAAS;IAEvC;;;;;;;;;OASG;IACH,YAAY,UAA2B,EAAE,KAAa;QAClD,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAClD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QAEpB,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;YACb,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;YACrB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,WAAW,CAAC;YACtC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QAC7C,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC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  */
47
47
  export declare abstract class Transformer {
48
- /**
49
- * Transformers cache, mapping a domain to another map, which maps an optional tweak to a transformer.
50
- */
51
- private static readonly TRANSFORMER_MAPS_MAP;
52
- /**
53
- * Domain.
54
- */
55
- private readonly _domain;
48
+ #private;
56
49
  /**
57
50
  * Constructor.
58
51
  *
@@ -80,13 +73,6 @@ export declare abstract class Transformer {
80
73
  * Get the domain.
81
74
  */
82
75
  get domain(): bigint;
83
- /**
84
- * Validate that a value is within the domain.
85
- *
86
- * @param value
87
- * Value.
88
- */
89
- private validate;
90
76
  /**
91
77
  * Do the work of transforming a value forward.
92
78
  *
@@ -97,32 +83,6 @@ export declare abstract class Transformer {
97
83
  * Transformed value.
98
84
  */
99
85
  protected abstract doForward(value: bigint): bigint;
100
- /**
101
- * Validate that a value is within the domain and do the work of transforming it forward.
102
- *
103
- * @param value
104
- * Value.
105
- *
106
- * @returns
107
- * Transformed value.
108
- */
109
- private validateDoForward;
110
- /**
111
- * Validate that a value is within the domain, do the work of transforming it forward, and apply a callback.
112
- *
113
- * @param transformerCallback
114
- * Called after each value is transformed to convert it to its final value.
115
- *
116
- * @param value
117
- * Value.
118
- *
119
- * @param index
120
- * Index in sequence (0 for single transformation).
121
- *
122
- * @returns
123
- * Transformed value.
124
- */
125
- private validateDoForwardCallback;
126
86
  /**
127
87
  * Transform value(s) forward.
128
88
  *
@@ -213,34 +173,7 @@ export declare class IdentityTransformer extends Transformer {
213
173
  * identical to the input value, as no shuffle or xor takes place.
214
174
  */
215
175
  export declare class EncryptionTransformer extends Transformer {
216
- /**
217
- * Individual bits, pre-calculated for performance.
218
- */
219
- private static readonly BITS;
220
- /**
221
- * Inverse individual bits, pre-calculated for performance.
222
- */
223
- private static readonly INVERSE_BITS;
224
- /**
225
- * Number of bytes covered by the domain.
226
- */
227
- private readonly _domainBytes;
228
- /**
229
- * Xor bytes array generated from the domain and tweak.
230
- */
231
- private readonly _xorBytes;
232
- /**
233
- * Bits array generated from the domain and tweak.
234
- */
235
- private readonly _bits;
236
- /**
237
- * Inverse bits array generated from the domain and tweak.
238
- */
239
- private readonly _inverseBits;
240
- /**
241
- * Number of rounds (length of arrays) generated from the domain and tweak.
242
- */
243
- private readonly _rounds;
176
+ #private;
244
177
  /**
245
178
  * Constructor.
246
179
  *
@@ -251,90 +184,6 @@ export declare class EncryptionTransformer extends Transformer {
251
184
  * Tweak.
252
185
  */
253
186
  constructor(domain: number | bigint, tweak: number | bigint);
254
- /**
255
- * Convert a value to a byte array big enough to handle the entire domain.
256
- *
257
- * @param value
258
- * Value.
259
- *
260
- * @returns
261
- * Big-endian byte array equivalent to the value.
262
- */
263
- private valueToBytes;
264
- /**
265
- * Convert a byte array to a value.
266
- *
267
- * @param bytes
268
- * Big-endian byte array equivalent to the value.
269
- *
270
- * @returns
271
- * Value.
272
- */
273
- private static bytesToValue;
274
- /**
275
- * Shuffle a byte array.
276
- *
277
- * The input array to the forward operation (output from the reverse operation) is `bytes` and the output array from
278
- * the forward operation (input to the reverse operation) is `bytes'`.
279
- *
280
- * The shuffle operation starts by testing the bit at `bits[round]` for each `byte` in `bytes`. The indexes for all
281
- * bytes with that bit set are put into one array (`shuffleIndexes1`) and the rest are put into another
282
- * (`shuffleIndexes0`). The two arrays are concatenated and used to shuffle the input array, using their values
283
- * (`shuffleIndex`) and the indexes of those values (`index`) in the concatenated array.
284
- *
285
- * Forward shuffling moves the entry at `shuffleIndex` to the `index` position.
286
- *
287
- * Reverse shuffling moves the entry at `index` to the `shuffleIndex` position.
288
- *
289
- * As each byte is moved, the bit at `bits[round]` is preserved in its original position. This ensures that the
290
- * process is reversible.
291
- *
292
- * @param bytes
293
- * Byte array.
294
- *
295
- * @param round
296
- * Round number.
297
- *
298
- * @param forward
299
- * True if operating forward (encrypting), false if operating in reverse (decrypting).
300
- *
301
- * @returns
302
- * Shuffled byte array.
303
- */
304
- private shuffle;
305
- /**
306
- * Xor a byte array.
307
- *
308
- * The input array to the forward operation (output from the reverse operation) is `bytes` and the output array from
309
- * the forward operation (input to the reverse operation) is `bytes'`.
310
- *
311
- * Forward:
312
- * - `bytes'[0] = bytes[0] ^ xorBytes[round]`
313
- * - `bytes'[1] = bytes[1] ^ bytes'[0]`
314
- * - `bytes'[2] = bytes[2] ^ bytes'[1]`
315
- * - `...`
316
- * - `bytes'[domainBytes - 1] = bytes[domainBytes - 1] ^ bytes'[domainBytes - 2]`
317
- *
318
- * Reverse:
319
- * - `bytes[0] = bytes'[0] ^ xorBytes[round]`
320
- * - `bytes[1] = bytes'[1] ^ bytes'[0]`
321
- * - `bytes[2] = bytes'[2] ^ bytes'[1]`
322
- * - `...`
323
- * - `bytes[domainBytes - 1] = bytes'[domainBytes - 1] ^ bytes'[domainBytes - 2]`
324
- *
325
- * @param bytes
326
- * Byte array.
327
- *
328
- * @param round
329
- * Round number.
330
- *
331
- * @param forward
332
- * True if operating forward (encrypting), false if operating in reverse (decrypting).
333
- *
334
- * @returns
335
- * Xored byte array.
336
- */
337
- private xor;
338
187
  /**
339
188
  * @inheritDoc
340
189
  */
@@ -1 +1 @@
1
- {"version":3,"file":"transformer.d.ts","sourceRoot":"","sources":["../src/transformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAe,MAAM,uBAAuB,CAAC;AAI1E;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEtE;;;;;;;;GAQG;AACH,MAAM,MAAM,gBAAgB,CAAC,MAAM,SAAS,oBAAoB,IAAI,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;AAE9F;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,iBAAiB,CAAC,iBAAiB,SAAS,gBAAgB,CAAC,oBAAoB,CAAC,EAAE,OAAO,IAAI,iBAAiB,SAAS,CAAC,iBAAiB,SAAS,gBAAgB,CAAC,MAAM,MAAM,CAAC,GAAG,MAAM,GAAG,KAAK,CAAC,GAAG,OAAO,GAAG,QAAQ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