svg-table 0.1.2 → 0.2.1
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/CHANGES.md +8 -0
- package/TableStyler.ts +68 -49
- package/dist/TableData.js +94 -106
- package/dist/TableData.js.map +1 -1
- package/dist/TableFormatter.js +54 -81
- package/dist/TableFormatter.js.map +1 -1
- package/dist/TableStyler.d.ts +24 -24
- package/dist/TableStyler.d.ts.map +1 -1
- package/dist/TableStyler.js +225 -270
- package/dist/TableStyler.js.map +1 -1
- package/dist/stylings.d.ts +23 -14
- package/dist/stylings.d.ts.map +1 -1
- package/dist/stylings.js +31 -38
- package/dist/stylings.js.map +1 -1
- package/dist/tableData.test.js +90 -90
- package/dist/tableData.test.js.map +1 -1
- package/dist/tableFormatter.test.js +57 -53
- package/dist/tableFormatter.test.js.map +1 -1
- package/dist/tableStyler.test.js +141 -299
- package/dist/tableStyler.test.js.map +1 -1
- package/dist/tableSvg.js +120 -158
- package/dist/tableSvg.js.map +1 -1
- package/dist/tableUtils.js +2 -2
- package/dist/tableUtils.js.map +1 -1
- package/eslint.config.js +10 -3
- package/jest.config.cjs +7 -0
- package/package.json +12 -10
- package/stylings.ts +23 -15
- package/tableData.test.ts +4 -4
- package/tableStyler.test.ts +1 -1
- package/tableSvg.ts +1 -1
- package/tsconfig.json +18 -83
- package/jest.config.js +0 -5
- package/svg-table-0.0.1.tgz +0 -0
- package/svg-table-0.1.2-snapshot.tgz +0 -0
package/dist/TableFormatter.js
CHANGED
|
@@ -1,34 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
-
if (!m) return o;
|
|
5
|
-
var i = m.call(o), r, ar = [], e;
|
|
6
|
-
try {
|
|
7
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
-
}
|
|
9
|
-
catch (error) { e = { error: error }; }
|
|
10
|
-
finally {
|
|
11
|
-
try {
|
|
12
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
-
}
|
|
14
|
-
finally { if (e) throw e.error; }
|
|
15
|
-
}
|
|
16
|
-
return ar;
|
|
17
|
-
};
|
|
18
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
3
|
exports.TableFormatter = exports.TableFormatterType = void 0;
|
|
20
4
|
exports.defaultFormatter = defaultFormatter;
|
|
21
5
|
exports.defaultFormatting = defaultFormatting;
|
|
22
6
|
exports.isFormattingTag = isFormattingTag;
|
|
23
|
-
|
|
24
|
-
|
|
7
|
+
const result_fn_1 = require("result-fn");
|
|
8
|
+
const TableData_1 = require("./TableData");
|
|
25
9
|
/**
|
|
26
10
|
* Default formatter that converts a {@link value} of type `V` to a string
|
|
27
11
|
* @param value The value to convert
|
|
28
12
|
* @return a string representation of the {@link value}
|
|
29
13
|
*/
|
|
30
14
|
function defaultFormatter(value) {
|
|
31
|
-
return value === undefined || value === null ? '' :
|
|
15
|
+
return value === undefined || value === null ? '' : `${value}`;
|
|
32
16
|
}
|
|
33
17
|
function defaultFormatting() {
|
|
34
18
|
return {
|
|
@@ -54,13 +38,13 @@ function isFormattingTag(tag) {
|
|
|
54
38
|
* This class is used to define custom formatters for specific rows, columns, or cells,
|
|
55
39
|
* with support for priority-based selection of formatters.
|
|
56
40
|
*/
|
|
57
|
-
|
|
41
|
+
class TableFormatter {
|
|
58
42
|
/**
|
|
59
43
|
* @param dataFrame A data-frame that will be tagged with the row, column, and
|
|
60
44
|
* cell formatters.
|
|
61
45
|
* @private
|
|
62
46
|
*/
|
|
63
|
-
|
|
47
|
+
constructor(dataFrame) {
|
|
64
48
|
this.dataFrame = dataFrame;
|
|
65
49
|
}
|
|
66
50
|
/**
|
|
@@ -71,18 +55,18 @@ var TableFormatter = /** @class */ (function () {
|
|
|
71
55
|
* @return A new {@link TableFormatter} based on the {@link TableData}
|
|
72
56
|
* @see TableFormatter.fromDataFrame
|
|
73
57
|
*/
|
|
74
|
-
|
|
58
|
+
static fromTableData(tableData) {
|
|
75
59
|
return new TableFormatter(tableData.unwrapDataFrame());
|
|
76
|
-
}
|
|
60
|
+
}
|
|
77
61
|
/**
|
|
78
62
|
* Constructs a new {@link TableFormatter} from a {@link DataFrame} object
|
|
79
63
|
* @param dataFrame The data-frame object from which to construct the table formatter
|
|
80
64
|
* @return A new {@link TableFormatter} based on the {@link DataFrame}
|
|
81
65
|
@see TableFormatter.fromTableData
|
|
82
66
|
*/
|
|
83
|
-
|
|
67
|
+
static fromDataFrame(dataFrame) {
|
|
84
68
|
return new TableFormatter(dataFrame.copy());
|
|
85
|
-
}
|
|
69
|
+
}
|
|
86
70
|
/**
|
|
87
71
|
* Formatters convert the column value types to formatted strings. The formatter used to format a given
|
|
88
72
|
* cell depends on the priority of each formatter associated with that cell. The formatter with the
|
|
@@ -132,12 +116,11 @@ var TableFormatter = /** @class */ (function () {
|
|
|
132
116
|
* ]).getOrThrow()
|
|
133
117
|
* ```
|
|
134
118
|
*/
|
|
135
|
-
|
|
136
|
-
if (priority === void 0) { priority = 0; }
|
|
119
|
+
addColumnFormatter(columnIndex, formatter, priority = 0) {
|
|
137
120
|
return this.dataFrame
|
|
138
|
-
.tagColumn(columnIndex, TableFormatterType.COLUMN, { formatter
|
|
139
|
-
.map(
|
|
140
|
-
}
|
|
121
|
+
.tagColumn(columnIndex, TableFormatterType.COLUMN, { formatter, priority })
|
|
122
|
+
.map(data => new TableFormatter(data));
|
|
123
|
+
}
|
|
141
124
|
/**
|
|
142
125
|
* Adds formatters to specified column indexes in a table formatter.
|
|
143
126
|
*
|
|
@@ -192,22 +175,20 @@ var TableFormatter = /** @class */ (function () {
|
|
|
192
175
|
* ]).getOrThrow()
|
|
193
176
|
* ```
|
|
194
177
|
*/
|
|
195
|
-
|
|
196
|
-
if (priority === void 0) { priority = 0; }
|
|
178
|
+
addColumnFormatters(columnIndexes, formatter, priority = 0) {
|
|
197
179
|
return TableFormatter.addColumnFormatters(this, columnIndexes.slice(), formatter, priority);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
if (priority === void 0) { priority = 0; }
|
|
180
|
+
}
|
|
181
|
+
static addColumnFormatters(tableFormatter, columnIndexes, formatter, priority = 0) {
|
|
201
182
|
if (columnIndexes.length > 0) {
|
|
202
|
-
|
|
183
|
+
const columnIndex = columnIndexes.shift();
|
|
203
184
|
if (columnIndex != null) {
|
|
204
185
|
return tableFormatter
|
|
205
186
|
.addColumnFormatter(columnIndex, formatter, priority)
|
|
206
|
-
.flatMap(
|
|
187
|
+
.flatMap(tf => TableFormatter.addColumnFormatters(tf, columnIndexes, formatter, priority));
|
|
207
188
|
}
|
|
208
189
|
}
|
|
209
190
|
return (0, result_fn_1.successResult)(tableFormatter);
|
|
210
|
-
}
|
|
191
|
+
}
|
|
211
192
|
/**
|
|
212
193
|
* Formatters convert the row value types to formatted strings. The formatter used to format each cell in
|
|
213
194
|
* a given row depends on the priority of each formatter associated with that cell. The formatter with the
|
|
@@ -257,12 +238,11 @@ var TableFormatter = /** @class */ (function () {
|
|
|
257
238
|
* ]).getOrThrow()
|
|
258
239
|
* ```
|
|
259
240
|
*/
|
|
260
|
-
|
|
261
|
-
if (priority === void 0) { priority = 0; }
|
|
241
|
+
addRowFormatter(rowIndex, formatter, priority = 0) {
|
|
262
242
|
return this.dataFrame
|
|
263
|
-
.tagRow(rowIndex, TableFormatterType.ROW, { formatter
|
|
264
|
-
.map(
|
|
265
|
-
}
|
|
243
|
+
.tagRow(rowIndex, TableFormatterType.ROW, { formatter, priority })
|
|
244
|
+
.map(data => new TableFormatter(data));
|
|
245
|
+
}
|
|
266
246
|
/**
|
|
267
247
|
* Adds formatters to specified row indexes in a table formatter.
|
|
268
248
|
*
|
|
@@ -316,22 +296,20 @@ var TableFormatter = /** @class */ (function () {
|
|
|
316
296
|
* ]).getOrThrow()
|
|
317
297
|
* ```
|
|
318
298
|
*/
|
|
319
|
-
|
|
320
|
-
if (priority === void 0) { priority = 0; }
|
|
299
|
+
addRowFormatters(rowIndexes, formatter, priority = 0) {
|
|
321
300
|
return TableFormatter.addRowFormatters(this, rowIndexes.slice(), formatter, priority);
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
if (priority === void 0) { priority = 0; }
|
|
301
|
+
}
|
|
302
|
+
static addRowFormatters(tableFormatter, rowIndexes, formatter, priority = 0) {
|
|
325
303
|
if (rowIndexes.length > 0) {
|
|
326
|
-
|
|
304
|
+
const rowIndex = rowIndexes.shift();
|
|
327
305
|
if (rowIndex != null) {
|
|
328
306
|
return tableFormatter
|
|
329
307
|
.addRowFormatter(rowIndex, formatter, priority)
|
|
330
|
-
.flatMap(
|
|
308
|
+
.flatMap(tf => TableFormatter.addRowFormatters(tf, rowIndexes, formatter, priority));
|
|
331
309
|
}
|
|
332
310
|
}
|
|
333
311
|
return (0, result_fn_1.successResult)(tableFormatter);
|
|
334
|
-
}
|
|
312
|
+
}
|
|
335
313
|
/**
|
|
336
314
|
* Adds a formatter to a specified cell based on the row and column indexes.
|
|
337
315
|
* @param rowIndex The row index of the cell.
|
|
@@ -388,12 +366,11 @@ var TableFormatter = /** @class */ (function () {
|
|
|
388
366
|
* ]).getOrThrow()
|
|
389
367
|
* ```
|
|
390
368
|
*/
|
|
391
|
-
|
|
392
|
-
if (priority === void 0) { priority = 0; }
|
|
369
|
+
addCellFormatter(rowIndex, columnIndex, formatter, priority = 0) {
|
|
393
370
|
return this.dataFrame
|
|
394
|
-
.tagCell(rowIndex, columnIndex, TableFormatterType.CELL, { formatter
|
|
395
|
-
.map(
|
|
396
|
-
}
|
|
371
|
+
.tagCell(rowIndex, columnIndex, TableFormatterType.CELL, { formatter, priority })
|
|
372
|
+
.map(data => new TableFormatter(data));
|
|
373
|
+
}
|
|
397
374
|
/**
|
|
398
375
|
* Adds formatters to specified cell indexes in a table formatter.
|
|
399
376
|
* @param cellIndexes An array of cell indexes to which the formatter will be applied.
|
|
@@ -449,23 +426,21 @@ var TableFormatter = /** @class */ (function () {
|
|
|
449
426
|
* ]).getOrThrow()
|
|
450
427
|
* ```
|
|
451
428
|
*/
|
|
452
|
-
|
|
453
|
-
if (priority === void 0) { priority = 0; }
|
|
429
|
+
addCellFormatters(cellIndexes, formatter, priority = 0) {
|
|
454
430
|
return TableFormatter.addCellFormatters(this, cellIndexes.slice(), formatter, priority);
|
|
455
|
-
}
|
|
456
|
-
|
|
431
|
+
}
|
|
432
|
+
static addCellFormatters(tableFormatter, cellIndexes, formatter, priority = 0) {
|
|
457
433
|
var _a;
|
|
458
|
-
if (priority === void 0) { priority = 0; }
|
|
459
434
|
if (cellIndexes.length > 0) {
|
|
460
|
-
|
|
435
|
+
const [rowIndex, columnIndex] = (_a = cellIndexes.shift()) !== null && _a !== void 0 ? _a : [undefined, undefined];
|
|
461
436
|
if (rowIndex != null && columnIndex != null) {
|
|
462
437
|
return tableFormatter
|
|
463
438
|
.addCellFormatter(rowIndex, columnIndex, formatter, priority)
|
|
464
|
-
.flatMap(
|
|
439
|
+
.flatMap(tf => TableFormatter.addCellFormatters(tf, cellIndexes, formatter, priority));
|
|
465
440
|
}
|
|
466
441
|
}
|
|
467
442
|
return (0, result_fn_1.successResult)(tableFormatter);
|
|
468
|
-
}
|
|
443
|
+
}
|
|
469
444
|
/**
|
|
470
445
|
* Formats the table headers, footer, and values using the formatters that have been added
|
|
471
446
|
* to this `TableData<V>` object and returns a new `TableData<string>` object where all the
|
|
@@ -533,9 +508,9 @@ var TableFormatter = /** @class */ (function () {
|
|
|
533
508
|
* expect(tableData.data().map(df => df.equals(expectedData)).getOrThrow()).toBeTruthy()
|
|
534
509
|
* ```
|
|
535
510
|
*/
|
|
536
|
-
|
|
537
|
-
return this.formatTableInto(
|
|
538
|
-
}
|
|
511
|
+
formatTable() {
|
|
512
|
+
return this.formatTableInto(dataFrame => TableData_1.TableData.fromDataFrame(dataFrame));
|
|
513
|
+
}
|
|
539
514
|
/**
|
|
540
515
|
* Generally, the {@link TableFormatter} formats the {@link DataFrame} into a `TableData<string>`
|
|
541
516
|
* where all the elements of the {@link TableData} are a string. Because a formatted table does
|
|
@@ -546,24 +521,23 @@ var TableFormatter = /** @class */ (function () {
|
|
|
546
521
|
* desired type (`D`), or failure, containing an error message.
|
|
547
522
|
* @see formatTable
|
|
548
523
|
*/
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
var formattedDataFrame = this
|
|
524
|
+
formatTableInto(mapper) {
|
|
525
|
+
const formattingFailures = [];
|
|
526
|
+
const formattedDataFrame = this
|
|
553
527
|
.dataFrame
|
|
554
|
-
.mapElements(
|
|
555
|
-
|
|
528
|
+
.mapElements((elem, row, col) => {
|
|
529
|
+
const tags = this.dataFrame
|
|
556
530
|
.tagsFor(row, col)
|
|
557
|
-
.filter(
|
|
558
|
-
|
|
559
|
-
.sort(
|
|
531
|
+
.filter(tag => isFormattingTag(tag));
|
|
532
|
+
const sorted = tags
|
|
533
|
+
.sort((t1, t2) => t2.value.priority - t1.value.priority);
|
|
560
534
|
if (sorted.length > 0) {
|
|
561
|
-
|
|
535
|
+
const formatter = sorted[0].value.formatter;
|
|
562
536
|
try {
|
|
563
537
|
return formatter(elem);
|
|
564
538
|
}
|
|
565
539
|
catch (e) {
|
|
566
|
-
formattingFailures.push(
|
|
540
|
+
formattingFailures.push(`(TableData::formatTable) Failed to format cell (${row}, ${col}); value: ${elem}; error: ${e}`);
|
|
567
541
|
}
|
|
568
542
|
}
|
|
569
543
|
return defaultFormatter(elem);
|
|
@@ -572,8 +546,7 @@ var TableFormatter = /** @class */ (function () {
|
|
|
572
546
|
return (0, result_fn_1.successResult)(mapper(formattedDataFrame));
|
|
573
547
|
}
|
|
574
548
|
return (0, result_fn_1.failureResult)(formattingFailures.concat('').join('\n'));
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
}());
|
|
549
|
+
}
|
|
550
|
+
}
|
|
578
551
|
exports.TableFormatter = TableFormatter;
|
|
579
552
|
//# sourceMappingURL=TableFormatter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableFormatter.js","sourceRoot":"","sources":["../TableFormatter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TableFormatter.js","sourceRoot":"","sources":["../TableFormatter.ts"],"names":[],"mappings":";;;AAcA,4CAEC;AAOD,8CAKC;AAQD,0CAMC;AAzCD,yCAAoE;AACpE,2CAAsC;AAOtC;;;;GAIG;AACH,SAAgB,gBAAgB,CAAI,KAAQ;IACxC,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,CAAA;AAClE,CAAC;AAOD,SAAgB,iBAAiB;IAC7B,OAAO;QACH,SAAS,EAAE,CAAA,gBAAmB,CAAA;QAC9B,QAAQ,EAAE,CAAC;KACd,CAAA;AACL,CAAC;AAED,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC1B,6CAAuB,CAAA;IACvB,iDAA2B,CAAA;IAC3B,2CAAqB,CAAA;AACzB,CAAC,EAJW,kBAAkB,kCAAlB,kBAAkB,QAI7B;AAED,SAAgB,eAAe,CAAC,GAAiC;IAC7D,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,kBAAkB,CAAC,MAAM;QACtC,GAAG,CAAC,IAAI,KAAK,kBAAkB,CAAC,GAAG;QACnC,GAAG,CAAC,IAAI,KAAK,kBAAkB,CAAC,IAAI,CAAC;QACzC,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC;QACrC,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,CAAA;AAC5C,CAAC;AAED;;;;GAIG;AACH,MAAa,cAAc;IAEvB;;;;OAIG;IACH,YAAqC,SAAuB;QAAvB,cAAS,GAAT,SAAS,CAAc;IAC5D,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,aAAa,CAAI,SAAuB;QAC3C,OAA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,CAAC,CAAA;QACpC,CAAC,CAAC,CAAA;QACN,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAClC,OAAO,IAAA,yBAAa,EAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAA;QACpD,CAAC;QACD,OAAO,IAAA,yBAAa,EAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IAClE,CAAC;CACJ;AAzhBD,wCAyhBC"}
|
package/dist/TableStyler.d.ts
CHANGED
|
@@ -16,15 +16,15 @@ export declare class StyledTable<V> {
|
|
|
16
16
|
private readonly margin;
|
|
17
17
|
/**
|
|
18
18
|
* Creates a new StyledTable instance.
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
21
|
-
* @param
|
|
22
|
-
* @param
|
|
23
|
-
* @param
|
|
24
|
-
* @param
|
|
25
|
-
* @param
|
|
19
|
+
* @param dataFrame_ The data frame containing the table data
|
|
20
|
+
* @param font_ The font settings for the table
|
|
21
|
+
* @param border_ The border settings for the table
|
|
22
|
+
* @param background_ The background settings for the table
|
|
23
|
+
* @param dimension_ The dimension settings for the table
|
|
24
|
+
* @param padding_ The padding settings for the table
|
|
25
|
+
* @param margin_ The margin settings for the table
|
|
26
26
|
*/
|
|
27
|
-
constructor(
|
|
27
|
+
constructor(dataFrame_: DataFrame<V>, font_: TableFont, border_: Border, background_: Background, dimension_: Pick<Dimension, "width" | "height">, padding_: Padding, margin_: Margin);
|
|
28
28
|
/**
|
|
29
29
|
* @return A copy of the {@link DataFrame} with all the styling and formatting tags
|
|
30
30
|
*/
|
|
@@ -167,24 +167,24 @@ export declare class StyledTable<V> {
|
|
|
167
167
|
* Provides methods to configure various styling aspects of a table.
|
|
168
168
|
*/
|
|
169
169
|
export declare class TableStyler<V> {
|
|
170
|
-
private dataFrame;
|
|
171
|
-
private font;
|
|
172
|
-
private border;
|
|
173
|
-
private background;
|
|
174
|
-
private dimension;
|
|
175
|
-
private padding;
|
|
176
|
-
private margin;
|
|
170
|
+
private readonly dataFrame;
|
|
171
|
+
private readonly font;
|
|
172
|
+
private readonly border;
|
|
173
|
+
private readonly background;
|
|
174
|
+
private readonly dimension;
|
|
175
|
+
private readonly padding;
|
|
176
|
+
private readonly margin;
|
|
177
177
|
private readonly errors;
|
|
178
178
|
/**
|
|
179
179
|
* Private constructor to enforce factory method usage.
|
|
180
|
-
* @param
|
|
181
|
-
* @param
|
|
182
|
-
* @param
|
|
183
|
-
* @param
|
|
184
|
-
* @param
|
|
185
|
-
* @param
|
|
186
|
-
* @param
|
|
187
|
-
* @param
|
|
180
|
+
* @param dataFrame_ The data frame containing the table data
|
|
181
|
+
* @param font_ The font settings for the table
|
|
182
|
+
* @param border_ The border settings for the table
|
|
183
|
+
* @param background_ The background settings for the table
|
|
184
|
+
* @param dimension_ The dimension settings for the table
|
|
185
|
+
* @param padding_ The padding settings for the table
|
|
186
|
+
* @param margin_ The margin settings for the table
|
|
187
|
+
* @param errors_ Array to collect error messages during styling operations
|
|
188
188
|
*/
|
|
189
189
|
private constructor();
|
|
190
190
|
/**
|
|
@@ -272,7 +272,7 @@ export declare class TableStyler<V> {
|
|
|
272
272
|
* Sets the style for the column header row.
|
|
273
273
|
* @param columnHeaderStyle The style to apply to the column header. Style properties that are not specified
|
|
274
274
|
* will be set to their default values.
|
|
275
|
-
* @param priority The priority of this style (higher values take precedence)
|
|
275
|
+
* @param [priority=Infinity] The priority of this style (higher values take precedence)
|
|
276
276
|
* @returns A new TableStyler instance with the column header style applied
|
|
277
277
|
*/
|
|
278
278
|
withColumnHeaderStyle(columnHeaderStyle?: Partial<ColumnHeaderStyle>, priority?: number): TableStyler<V>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableStyler.d.ts","sourceRoot":"","sources":["../TableStyler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAmC,SA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