@evotecit/officeimo 0.1.0 → 0.1.2
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/README.md +13 -10
- package/bundles/officeimo-canopyx.js +842 -377
- package/bundles/officeimo-canopyx.mjs +729 -265
- package/bundles/officeimo-csv.js +29 -19
- package/bundles/officeimo-csv.mjs +17 -7
- package/bundles/officeimo-datatables.js +835 -379
- package/bundles/officeimo-datatables.mjs +723 -268
- package/bundles/officeimo-execution.js +35 -25
- package/bundles/officeimo-execution.mjs +17 -7
- package/bundles/officeimo-pdf.js +737 -291
- package/bundles/officeimo-pdf.mjs +688 -243
- package/bundles/officeimo-xlsx.js +114 -94
- package/bundles/officeimo-xlsx.mjs +48 -28
- package/bundles/officeimo.js +819 -363
- package/bundles/officeimo.mjs +709 -254
- package/dist/core/index.d.ts +2 -0
- package/dist/core/iteration.js +2 -2
- package/dist/core/sinks.js +2 -1
- package/dist/integrations/canopyx/source.js +13 -7
- package/dist/integrations/datatables/snapshot.js +3 -3
- package/dist/internal/rows.js +13 -4
- package/dist/opc/index.js +14 -9
- package/dist/pdf/document-grouped.js +72 -22
- package/dist/pdf/font-resources.js +2 -1
- package/dist/pdf/inline-text.js +50 -9
- package/dist/pdf/objects.js +188 -11
- package/dist/pdf/pages.js +28 -28
- package/dist/pdf/paragraph-layout.d.ts +2 -0
- package/dist/pdf/paragraph-layout.js +9 -4
- package/dist/pdf/session.js +1 -1
- package/dist/pdf/settings.d.ts +2 -0
- package/dist/pdf/settings.js +27 -2
- package/dist/pdf/structure.js +80 -28
- package/dist/pdf/table-band-flow.js +26 -11
- package/dist/pdf/table-band-plan.js +1 -3
- package/dist/pdf/table-layout.d.ts +4 -0
- package/dist/pdf/table-layout.js +22 -10
- package/dist/pdf/table-structure.js +28 -12
- package/dist/pdf/text.js +5 -0
- package/dist/pdf/types.d.ts +4 -2
- package/dist/pdf/xref.d.ts +1 -0
- package/dist/pdf/xref.js +30 -0
- package/dist/xlsx/values.js +3 -2
- package/dist/xlsx/workbook.js +7 -4
- package/dist/xlsx/worksheet.js +2 -1
- package/dist/xml/index.js +3 -3
- package/dist/zip/entry.js +1 -1
- package/dist/zip/index.js +1 -1
- package/package.json +1 -1
|
@@ -42,10 +42,10 @@ _modules.set("d5c945064d81fdd257960f48c421125e106e5f270427d170bb05587dd96a44ea",
|
|
|
42
42
|
return _exports;
|
|
43
43
|
})();
|
|
44
44
|
|
|
45
|
-
const _m4 = _modules.get("
|
|
45
|
+
const _m4 = _modules.get("87c24efeaa0f1579c19afeeb4918caeb4f8f65a88d24a246e2cfd712b37dbac3") ?? (() => {
|
|
46
46
|
function checkAbort(signal) {
|
|
47
47
|
if (signal?.aborted)
|
|
48
|
-
throw signal.reason
|
|
48
|
+
throw signal.reason;
|
|
49
49
|
}
|
|
50
50
|
/** Race a pending producer or sink operation without leaving abort listeners behind. */
|
|
51
51
|
function withAbort(promise, signal) {
|
|
@@ -53,7 +53,7 @@ function withAbort(promise, signal) {
|
|
|
53
53
|
return Promise.resolve(promise);
|
|
54
54
|
return new Promise((resolve, reject) => {
|
|
55
55
|
const cleanup = () => signal.removeEventListener("abort", abort);
|
|
56
|
-
const abort = () => { cleanup(); reject(signal.reason
|
|
56
|
+
const abort = () => { cleanup(); reject(signal.reason); };
|
|
57
57
|
signal.addEventListener("abort", abort, { once: true });
|
|
58
58
|
Promise.resolve(promise).then(value => { cleanup(); resolve(value); }, error => { cleanup(); reject(error); });
|
|
59
59
|
if (signal.aborted)
|
|
@@ -193,11 +193,11 @@ function pause() {
|
|
|
193
193
|
});
|
|
194
194
|
}
|
|
195
195
|
const _exports = Object.freeze({ checkAbort: checkAbort, withAbort: withAbort, inputRows: inputRows, rowsFromBatches: rowsFromBatches, concatRows: concatRows, consumeRows: consumeRows, beginTask: beginTask, taskYieldDue: taskYieldDue, pause: pause });
|
|
196
|
-
_modules.set("
|
|
196
|
+
_modules.set("87c24efeaa0f1579c19afeeb4918caeb4f8f65a88d24a246e2cfd712b37dbac3", _exports);
|
|
197
197
|
return _exports;
|
|
198
198
|
})();
|
|
199
199
|
|
|
200
|
-
const _m3 = _modules.get("
|
|
200
|
+
const _m3 = _modules.get("5337d1e3bd5ae0c1d10a476fcd31540d20337ccf7aa93c7e9e26c2b1a7dab92b") ?? (() => {
|
|
201
201
|
const { checkAbort, consumeRows, withAbort, pause, taskYieldDue } = _m4;
|
|
202
202
|
|
|
203
203
|
const { OfficeIMOError } = _m2;
|
|
@@ -207,8 +207,9 @@ async function withDestination(destination, operation) {
|
|
|
207
207
|
// Native streams can belong to another browser realm; constructor identity is not portable.
|
|
208
208
|
if (destination && typeof destination.getWriter === "function") {
|
|
209
209
|
const writer = destination.getWriter();
|
|
210
|
+
// Native streams may retain accepted chunks after write resolves.
|
|
210
211
|
try {
|
|
211
|
-
return await operation({ write: bytes => writer.write(bytes) });
|
|
212
|
+
return await operation({ write: bytes => writer.write(new Uint8Array(bytes)) });
|
|
212
213
|
}
|
|
213
214
|
finally {
|
|
214
215
|
writer.releaseLock();
|
|
@@ -302,7 +303,7 @@ async function writeBytes(source, sink, signal) {
|
|
|
302
303
|
});
|
|
303
304
|
}
|
|
304
305
|
const _exports = Object.freeze({ withDestination: withDestination, BlobByteSink: BlobByteSink, ChunkedTextSink: ChunkedTextSink, writeBytes: writeBytes });
|
|
305
|
-
_modules.set("
|
|
306
|
+
_modules.set("5337d1e3bd5ae0c1d10a476fcd31540d20337ccf7aa93c7e9e26c2b1a7dab92b", _exports);
|
|
306
307
|
return _exports;
|
|
307
308
|
})();
|
|
308
309
|
|
|
@@ -499,7 +500,7 @@ _modules.set("42faf379960e5674a6fdfa8c8fca0bb68bbd74587231248d2524d7004def3671",
|
|
|
499
500
|
return _exports;
|
|
500
501
|
})();
|
|
501
502
|
|
|
502
|
-
const _m11 = _modules.get("
|
|
503
|
+
const _m11 = _modules.get("0391fe35ea7d02b25804ab4d0e7543136d6bb615f368f268c74aa135f23aa6bc") ?? (() => {
|
|
503
504
|
const { assertExportValue } = _m5;
|
|
504
505
|
|
|
505
506
|
const { checkAbort } = _m4;
|
|
@@ -512,11 +513,18 @@ function createRowProjector(columns, worksheet, signal, validate = assertExportV
|
|
|
512
513
|
const getters = columns.some(column => column.value);
|
|
513
514
|
return (row, rowIndex = 0) => {
|
|
514
515
|
if (Array.isArray(row) && !getters) {
|
|
515
|
-
|
|
516
|
+
const length = row.length;
|
|
517
|
+
if (length > columns.length)
|
|
516
518
|
throw new RangeError("Row has more values than declared columns.");
|
|
517
|
-
|
|
519
|
+
// Resolve each positional value once, just like key/value projections. Returning the
|
|
520
|
+
// source array would let an accessor change a value after the portable-value check.
|
|
521
|
+
const values = new Array(length);
|
|
522
|
+
for (let index = 0; index < length; index++) {
|
|
523
|
+
const value = row[index];
|
|
518
524
|
validate(value);
|
|
519
|
-
|
|
525
|
+
values[index] = value;
|
|
526
|
+
}
|
|
527
|
+
return values;
|
|
520
528
|
}
|
|
521
529
|
if (!row || typeof row !== "object" || isDate(row))
|
|
522
530
|
throw new TypeError("A row must be an array or object.");
|
|
@@ -545,7 +553,7 @@ function createRowProjector(columns, worksheet, signal, validate = assertExportV
|
|
|
545
553
|
};
|
|
546
554
|
}
|
|
547
555
|
/** @internal Shared metadata fields for full columns and adapter-owned partial overrides. */
|
|
548
|
-
const columnOptionFields = ["header", "key", "value", "width", "type", "format", "wrapText", "alignment", "groups", "style", "valueFormatter"];
|
|
556
|
+
const columnOptionFields = ["header", "key", "value", "width", "type", "format", "wrapText", "alignment", "rowHeader", "groups", "style", "valueFormatter"];
|
|
549
557
|
function copyColumns(columns, workbookStyles = false) {
|
|
550
558
|
if (!Array.isArray(columns))
|
|
551
559
|
throw new TypeError("Declare the columns in export order.");
|
|
@@ -561,6 +569,8 @@ function copyColumns(columns, workbookStyles = false) {
|
|
|
561
569
|
throw new TypeError("Each column needs a string header and an optional string key.");
|
|
562
570
|
if (captured.value !== undefined && typeof captured.value !== "function")
|
|
563
571
|
throw new TypeError("Column value getters must be functions.");
|
|
572
|
+
if (captured.rowHeader !== undefined && typeof captured.rowHeader !== "boolean")
|
|
573
|
+
throw new TypeError("Column rowHeader must be boolean.");
|
|
564
574
|
if (captured.groups !== undefined) {
|
|
565
575
|
if (!Array.isArray(captured.groups))
|
|
566
576
|
throw new TypeError("Column groups must be an array of strings.");
|
|
@@ -573,7 +583,7 @@ function copyColumns(columns, workbookStyles = false) {
|
|
|
573
583
|
});
|
|
574
584
|
}
|
|
575
585
|
const _exports = Object.freeze({ createRowProjector: createRowProjector, columnOptionFields: columnOptionFields, copyColumns: copyColumns });
|
|
576
|
-
_modules.set("
|
|
586
|
+
_modules.set("0391fe35ea7d02b25804ab4d0e7543136d6bb615f368f268c74aa135f23aa6bc", _exports);
|
|
577
587
|
return _exports;
|
|
578
588
|
})();
|
|
579
589
|
|
|
@@ -647,7 +657,7 @@ _modules.set("e95bb0e3f342d1379b67a3d541fa808e06361da8460169a6aec152ee7deb69b2",
|
|
|
647
657
|
return _exports;
|
|
648
658
|
})();
|
|
649
659
|
|
|
650
|
-
const _m8 = _modules.get("
|
|
660
|
+
const _m8 = _modules.get("046b305cdccf817d847addb75a778131622de23f2840830bbe1c0c26053a68c0") ?? (() => {
|
|
651
661
|
const { ExportCell, assertScalar } = _m5;
|
|
652
662
|
|
|
653
663
|
const { isDate } = _m6;
|
|
@@ -909,11 +919,11 @@ function createGroupedReport(rows, options) {
|
|
|
909
919
|
return source;
|
|
910
920
|
}
|
|
911
921
|
const _exports = Object.freeze({ assertGroupedReportSource: assertGroupedReportSource, groupedReportEvents: groupedReportEvents, groupedReportOperation: groupedReportOperation, createGroupedReport: createGroupedReport });
|
|
912
|
-
_modules.set("
|
|
922
|
+
_modules.set("046b305cdccf817d847addb75a778131622de23f2840830bbe1c0c26053a68c0", _exports);
|
|
913
923
|
return _exports;
|
|
914
924
|
})();
|
|
915
925
|
|
|
916
|
-
const _m1 = _modules.get("
|
|
926
|
+
const _m1 = _modules.get("81b3d47c02b7d8443b79e02b3cfb52032d6b73d9a3fb592b777ebe028ad0ef00") ?? (() => {
|
|
917
927
|
|
|
918
928
|
|
|
919
929
|
|
|
@@ -958,7 +968,7 @@ function saveBlob(blob, fileName) {
|
|
|
958
968
|
}
|
|
959
969
|
}
|
|
960
970
|
const _exports = Object.freeze({ OfficeIMOError: _m2.OfficeIMOError, NotSupportedError: _m2.NotSupportedError, BlobByteSink: _m3.BlobByteSink, ChunkedTextSink: _m3.ChunkedTextSink, writeBytes: _m3.writeBytes, ExportCell: _m5.ExportCell, createGroupedReport: _m8.createGroupedReport, checkAbort: _m4.checkAbort, withAbort: _m4.withAbort, inputRows: _m4.inputRows, pause: _m4.pause, detectFeatures: detectFeatures, saveBlob: saveBlob });
|
|
961
|
-
_modules.set("
|
|
971
|
+
_modules.set("81b3d47c02b7d8443b79e02b3cfb52032d6b73d9a3fb592b777ebe028ad0ef00", _exports);
|
|
962
972
|
return _exports;
|
|
963
973
|
})();
|
|
964
974
|
|
|
@@ -1187,7 +1197,7 @@ _modules.set("9b33d9107e62ba8299c576072de40d24a261464f118de4ace64f23154fc78307",
|
|
|
1187
1197
|
return _exports;
|
|
1188
1198
|
})();
|
|
1189
1199
|
|
|
1190
|
-
const _m17 = _modules.get("
|
|
1200
|
+
const _m17 = _modules.get("4a089607f7cbe50e13d4382d1cc4e5f6ce32c5773bbec2df84178710f54d9a38") ?? (() => {
|
|
1191
1201
|
const { OfficeIMOError } = _m2;
|
|
1192
1202
|
|
|
1193
1203
|
const { ExportBudget } = _m9;
|
|
@@ -1262,10 +1272,34 @@ function captureWideTable(input) {
|
|
|
1262
1272
|
if (repeatColumns !== undefined && !Array.isArray(repeatColumns))
|
|
1263
1273
|
throw new TypeError("repeatColumns must be an array.");
|
|
1264
1274
|
const repeats = repeatColumns === undefined ? [] : [...repeatColumns];
|
|
1265
|
-
if (repeats.some(
|
|
1266
|
-
throw new RangeError("repeatColumns must contain
|
|
1275
|
+
if (repeats.some(value => typeof value === "number" ? !Number.isSafeInteger(value) || value < 0 : typeof value !== "string" || !value.length))
|
|
1276
|
+
throw new RangeError("repeatColumns must contain nonnegative indices or nonempty stable keys.");
|
|
1277
|
+
if (repeats.every(value => typeof value === "number") && repeats.some((value, index) => index > 0 && value <= repeats[index - 1]))
|
|
1278
|
+
throw new RangeError("Numeric repeatColumns must contain sorted unique nonnegative indices.");
|
|
1267
1279
|
return Object.freeze({ mode, ...(minimumColumnWidth === undefined ? {} : { minimumColumnWidth }), repeatColumns: Object.freeze(repeats) });
|
|
1268
1280
|
}
|
|
1281
|
+
/** Resolve identities against this table's captured selection, without consulting a grid or opening its rows. */
|
|
1282
|
+
function repeatedColumns(policy, columns) {
|
|
1283
|
+
if (typeof policy !== "object")
|
|
1284
|
+
return Object.freeze([]);
|
|
1285
|
+
const selected = new Set();
|
|
1286
|
+
for (const selector of policy.repeatColumns ?? []) {
|
|
1287
|
+
let position;
|
|
1288
|
+
if (typeof selector === "number")
|
|
1289
|
+
position = selector;
|
|
1290
|
+
else {
|
|
1291
|
+
position = columns.findIndex(column => column.key === selector);
|
|
1292
|
+
if (position < 0 || columns.some((column, index) => index !== position && column.key === selector))
|
|
1293
|
+
throw new TypeError("repeatColumns requires an unambiguous selected column key: " + selector);
|
|
1294
|
+
}
|
|
1295
|
+
if (position >= columns.length)
|
|
1296
|
+
throw new RangeError("repeatColumns index exceeds the declared columns.");
|
|
1297
|
+
if (selected.has(position))
|
|
1298
|
+
throw new TypeError("repeatColumns selects the same column more than once.");
|
|
1299
|
+
selected.add(position);
|
|
1300
|
+
}
|
|
1301
|
+
return Object.freeze([...selected].sort((left, right) => left - right));
|
|
1302
|
+
}
|
|
1269
1303
|
function settings(input, document = false) {
|
|
1270
1304
|
const configuration = { ...capturePdfOptions(input) };
|
|
1271
1305
|
configuration.booleanText = captureBooleanText(configuration.booleanText);
|
|
@@ -1367,10 +1401,11 @@ function settings(input, document = false) {
|
|
|
1367
1401
|
}
|
|
1368
1402
|
const maxImageWorkingBytes = options.limits?.maxImageWorkingBytes;
|
|
1369
1403
|
return { options: { ...options, paragraphStyles }, paragraphStyles, page, margins, fontSize, padding,
|
|
1404
|
+
repeatedColumns: document ? Object.freeze([]) : repeatedColumns(options.wideTable, columns),
|
|
1370
1405
|
limits: { ...limits, ...(maxImageWorkingBytes === undefined ? {} : { maxImageWorkingBytes }) }, budget };
|
|
1371
1406
|
}
|
|
1372
1407
|
const _exports = Object.freeze({ positive: _m20.positive, color: _m20.color, presentation: _m20.presentation, pdfOptionFields: pdfOptionFields, pdfLimitFields: pdfLimitFields, capturePdfOptions: capturePdfOptions, capturePdfLimits: capturePdfLimits, captureWideTable: captureWideTable, settings: settings });
|
|
1373
|
-
_modules.set("
|
|
1408
|
+
_modules.set("4a089607f7cbe50e13d4382d1cc4e5f6ce32c5773bbec2df84178710f54d9a38", _exports);
|
|
1374
1409
|
return _exports;
|
|
1375
1410
|
})();
|
|
1376
1411
|
|
|
@@ -1397,7 +1432,7 @@ _modules.set("e00bc0213b723678d050e3e1f11b39ed3d6b0b0fd6a39b403beb1a6bef69e282",
|
|
|
1397
1432
|
return _exports;
|
|
1398
1433
|
})();
|
|
1399
1434
|
|
|
1400
|
-
const _m15 = _modules.get("
|
|
1435
|
+
const _m15 = _modules.get("58066519dce31ad3bb7f5f5c377585d3374a84578358ad519e2c021efa1a26f8") ?? (() => {
|
|
1401
1436
|
const { captureFields } = _m10;
|
|
1402
1437
|
|
|
1403
1438
|
const { ExportBudget } = _m9;
|
|
@@ -1438,7 +1473,7 @@ function capturePdfOptions(input = {}) {
|
|
|
1438
1473
|
return { ...options, ...(options.limits === undefined ? {} : { limits: capturePdfLimits(options.limits) }) };
|
|
1439
1474
|
}
|
|
1440
1475
|
const _exports = Object.freeze({ captureCommonLimits: captureCommonLimits, mergeAdapterLimits: mergeAdapterLimits, captureXlsxOptions: captureXlsxOptions, captureCsvOptions: captureCsvOptions, capturePdfOptions: capturePdfOptions });
|
|
1441
|
-
_modules.set("
|
|
1476
|
+
_modules.set("58066519dce31ad3bb7f5f5c377585d3374a84578358ad519e2c021efa1a26f8", _exports);
|
|
1442
1477
|
return _exports;
|
|
1443
1478
|
})();
|
|
1444
1479
|
|
|
@@ -1490,12 +1525,14 @@ _modules.set("8ece66b561682170c879991995105163f4c484c8355d5e451fc6f52a9fbc3f82",
|
|
|
1490
1525
|
return _exports;
|
|
1491
1526
|
})();
|
|
1492
1527
|
|
|
1493
|
-
const _m28 = _modules.get("
|
|
1528
|
+
const _m28 = _modules.get("227236fd7adc9472e188831b8f16fdc69338c4d779f2b69a8abbd8dbfa95b585") ?? (() => {
|
|
1494
1529
|
const { OfficeIMOError } = _m2;
|
|
1495
1530
|
|
|
1496
1531
|
const { ChunkedTextSink } = _m3;
|
|
1497
1532
|
|
|
1498
1533
|
const xmlDeclaration = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
|
|
1534
|
+
const xmlEscapes = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'",
|
|
1535
|
+
"\r": " ", "\n": " ", "\t": "	" };
|
|
1499
1536
|
/** XML 1.0 characters; Unicode mode retains valid surrogate pairs. */
|
|
1500
1537
|
function cleanXml(value, policy = "strip") {
|
|
1501
1538
|
if (policy !== "strip" && policy !== "reject")
|
|
@@ -1507,9 +1544,7 @@ function cleanXml(value, policy = "strip") {
|
|
|
1507
1544
|
}
|
|
1508
1545
|
/** Escape data, including whitespace that XML parsers otherwise normalize. */
|
|
1509
1546
|
function escapeXml(value, policy = "strip") {
|
|
1510
|
-
|
|
1511
|
-
"\r": " ", "\n": " ", "\t": "	" };
|
|
1512
|
-
return cleanXml(value, policy).replace(/[&<>"'\r\n\t]/g, c => escapes[c]);
|
|
1547
|
+
return cleanXml(value, policy).replace(/[&<>"'\r\n\t]/g, c => xmlEscapes[c]);
|
|
1513
1548
|
}
|
|
1514
1549
|
/** Encode an OOXML ST_Xstring attribute without interpreting literal escape tokens as characters. */
|
|
1515
1550
|
function escapeOoxmlAttribute(value, policy = "strip") {
|
|
@@ -1568,11 +1603,11 @@ class XmlWriter {
|
|
|
1568
1603
|
throw new OfficeIMOError("INVALID_STATE", "XML writer is closed."); }
|
|
1569
1604
|
}
|
|
1570
1605
|
const _exports = Object.freeze({ xmlDeclaration: xmlDeclaration, cleanXml: cleanXml, escapeXml: escapeXml, escapeOoxmlAttribute: escapeOoxmlAttribute, validateXmlName: validateXmlName, XmlWriter: XmlWriter });
|
|
1571
|
-
_modules.set("
|
|
1606
|
+
_modules.set("227236fd7adc9472e188831b8f16fdc69338c4d779f2b69a8abbd8dbfa95b585", _exports);
|
|
1572
1607
|
return _exports;
|
|
1573
1608
|
})();
|
|
1574
1609
|
|
|
1575
|
-
const _m27 = _modules.get("
|
|
1610
|
+
const _m27 = _modules.get("56b2057461a668e8c90abd1fbf4f13ff93efd9854e590c82a195799f0f842c2a") ?? (() => {
|
|
1576
1611
|
const { escapeXml, xmlDeclaration } = _m28;
|
|
1577
1612
|
|
|
1578
1613
|
const { isDate } = _m6;
|
|
@@ -1594,7 +1629,7 @@ function appPropertiesXml(properties = {}, policy = "strip") {
|
|
|
1594
1629
|
'<Application>' + escapeXml(properties.application ?? "OfficeIMO", policy) + '</Application><Company>' + escapeXml(properties.company ?? "", policy) + '</Company></Properties>';
|
|
1595
1630
|
}
|
|
1596
1631
|
const _exports = Object.freeze({ corePropertiesXml: corePropertiesXml, appPropertiesXml: appPropertiesXml });
|
|
1597
|
-
_modules.set("
|
|
1632
|
+
_modules.set("56b2057461a668e8c90abd1fbf4f13ff93efd9854e590c82a195799f0f842c2a", _exports);
|
|
1598
1633
|
return _exports;
|
|
1599
1634
|
})();
|
|
1600
1635
|
|
|
@@ -1621,7 +1656,7 @@ _modules.set("790c15edc51b308be3e7d8222630d407f8c79c31ab21ba0b9f92c00f44ab4021",
|
|
|
1621
1656
|
return _exports;
|
|
1622
1657
|
})();
|
|
1623
1658
|
|
|
1624
|
-
const _m30 = _modules.get("
|
|
1659
|
+
const _m30 = _modules.get("597d152d20a2a28ee5cd6d4243a79a71ce8b83769a77441bfc944aadc0a6efbd") ?? (() => {
|
|
1625
1660
|
const { checkAbort, withAbort } = _m4;
|
|
1626
1661
|
|
|
1627
1662
|
const { OfficeIMOError } = _m2;
|
|
@@ -1652,7 +1687,7 @@ class EntryWriter {
|
|
|
1652
1687
|
closed = false;
|
|
1653
1688
|
cleaned = false;
|
|
1654
1689
|
lifetime = new AbortController();
|
|
1655
|
-
abort = () => { this.fail(this.signal?.reason
|
|
1690
|
+
abort = () => { this.fail(this.signal?.reason); };
|
|
1656
1691
|
constructor(compression, sink, signal) {
|
|
1657
1692
|
this.sink = sink;
|
|
1658
1693
|
this.signal = signal;
|
|
@@ -1749,11 +1784,11 @@ class EntryWriter {
|
|
|
1749
1784
|
}
|
|
1750
1785
|
}
|
|
1751
1786
|
const _exports = Object.freeze({ Crc32: _m31.Crc32, zipLimit: zipLimit, zipSize: zipSize, EntryWriter: EntryWriter });
|
|
1752
|
-
_modules.set("
|
|
1787
|
+
_modules.set("597d152d20a2a28ee5cd6d4243a79a71ce8b83769a77441bfc944aadc0a6efbd", _exports);
|
|
1753
1788
|
return _exports;
|
|
1754
1789
|
})();
|
|
1755
1790
|
|
|
1756
|
-
const _m29 = _modules.get("
|
|
1791
|
+
const _m29 = _modules.get("699a019e0c3f317a62bf3a6e59b76b6cf1645908b0f1b1f157c18f4d4f368dfb") ?? (() => {
|
|
1757
1792
|
|
|
1758
1793
|
|
|
1759
1794
|
const { EntryWriter, zipSize } = _m30;
|
|
@@ -1817,7 +1852,7 @@ class ZipWriter {
|
|
|
1817
1852
|
/** Pending header/directory writes and source reads must also stop on explicit discard. */
|
|
1818
1853
|
async acceptance(operation) {
|
|
1819
1854
|
const signal = this.options.signal;
|
|
1820
|
-
const abort = () => this.lifetime.abort(signal?.reason
|
|
1855
|
+
const abort = () => this.lifetime.abort(signal?.reason);
|
|
1821
1856
|
signal?.addEventListener("abort", abort, { once: true });
|
|
1822
1857
|
try {
|
|
1823
1858
|
checkAbort(signal);
|
|
@@ -2009,11 +2044,11 @@ class ZipWriter {
|
|
|
2009
2044
|
}
|
|
2010
2045
|
}
|
|
2011
2046
|
const _exports = Object.freeze({ Crc32: _m30.Crc32, validateEntryName: validateEntryName, ZipWriter: ZipWriter });
|
|
2012
|
-
_modules.set("
|
|
2047
|
+
_modules.set("699a019e0c3f317a62bf3a6e59b76b6cf1645908b0f1b1f157c18f4d4f368dfb", _exports);
|
|
2013
2048
|
return _exports;
|
|
2014
2049
|
})();
|
|
2015
2050
|
|
|
2016
|
-
const _m25 = _modules.get("
|
|
2051
|
+
const _m25 = _modules.get("4d4856357f94ecbeea67d111ff5e97f916ccc6be6aaefde219d461c6ad10a8c5") ?? (() => {
|
|
2017
2052
|
|
|
2018
2053
|
|
|
2019
2054
|
|
|
@@ -2112,8 +2147,11 @@ class OpcPackage {
|
|
|
2112
2147
|
return uri;
|
|
2113
2148
|
}
|
|
2114
2149
|
addPart(part) {
|
|
2115
|
-
const uri
|
|
2116
|
-
|
|
2150
|
+
const { uri: requestedUri, contentType, data } = part;
|
|
2151
|
+
// Structural accessors and byte ownership are captured before reserving metadata.
|
|
2152
|
+
const capturedData = data instanceof Uint8Array ? new Uint8Array(data) : data;
|
|
2153
|
+
const uri = this.reserve(requestedUri, contentType);
|
|
2154
|
+
this.parts.set(uri.toLowerCase(), { uri, contentType, data: capturedData });
|
|
2117
2155
|
}
|
|
2118
2156
|
/** @internal */
|
|
2119
2157
|
addPrepared(uri, type, prepared) {
|
|
@@ -2138,17 +2176,19 @@ class OpcPackage {
|
|
|
2138
2176
|
checkAbort(this.options.signal);
|
|
2139
2177
|
this.open();
|
|
2140
2178
|
source = source === "/" ? source : partUri(source);
|
|
2141
|
-
|
|
2179
|
+
const { id, type, target: requestedTarget, external } = relationship;
|
|
2180
|
+
this.open();
|
|
2181
|
+
if (!/^[A-Za-z_][A-Za-z0-9_.-]*$/.test(id))
|
|
2142
2182
|
throw new TypeError("Relationship id must be an XML ID.");
|
|
2143
|
-
if (!/^[A-Za-z][A-Za-z0-9+.-]*:[^\s<>"']+$/.test(
|
|
2183
|
+
if (!/^[A-Za-z][A-Za-z0-9+.-]*:[^\s<>"']+$/.test(type))
|
|
2144
2184
|
throw new TypeError("Relationship type must be an absolute URI.");
|
|
2145
|
-
const target =
|
|
2146
|
-
if (
|
|
2185
|
+
const target = external ? requestedTarget : partUri(requestedTarget);
|
|
2186
|
+
if (external && (!target || /[\u0000-\u0020]/.test(target)))
|
|
2147
2187
|
throw new TypeError("Invalid external relationship target.");
|
|
2148
2188
|
const key = source.toLowerCase(), list = this.relationships.get(key) ?? new Map();
|
|
2149
|
-
if (list.has(
|
|
2150
|
-
throw new TypeError("Duplicate relationship id: " +
|
|
2151
|
-
list.set(
|
|
2189
|
+
if (list.has(id))
|
|
2190
|
+
throw new TypeError("Duplicate relationship id: " + id);
|
|
2191
|
+
list.set(id, { id, type, target, ...(external === undefined ? {} : { external }) });
|
|
2152
2192
|
this.relationships.set(key, list);
|
|
2153
2193
|
}
|
|
2154
2194
|
setProperties(core = {}, app = {}) {
|
|
@@ -2258,7 +2298,7 @@ class OpcPackage {
|
|
|
2258
2298
|
}
|
|
2259
2299
|
}
|
|
2260
2300
|
const _exports = Object.freeze({ partUri: _m26.partUri, relationshipPartUri: _m26.relationshipPartUri, relativePartTarget: _m26.relativePartTarget, corePropertiesXml: _m27.corePropertiesXml, appPropertiesXml: _m27.appPropertiesXml, relationshipsNamespace: relationshipsNamespace, officeRelationshipsNamespace: officeRelationshipsNamespace, contentTypesNamespace: contentTypesNamespace, relationshipTypes: relationshipTypes, ContentTypes: ContentTypes, OpcPackage: OpcPackage });
|
|
2261
|
-
_modules.set("
|
|
2301
|
+
_modules.set("4d4856357f94ecbeea67d111ff5e97f916ccc6be6aaefde219d461c6ad10a8c5", _exports);
|
|
2262
2302
|
return _exports;
|
|
2263
2303
|
})();
|
|
2264
2304
|
|
|
@@ -2274,7 +2314,7 @@ _modules.set("204def412284dfb11df9aececd57c8c0455db2927ebdb483dd255e7b29f6f359",
|
|
|
2274
2314
|
return _exports;
|
|
2275
2315
|
})();
|
|
2276
2316
|
|
|
2277
|
-
const _m34 = _modules.get("
|
|
2317
|
+
const _m34 = _modules.get("6ae88f25e1c09d00fbb828917498569f883fae88ec25d37caebaf8a2b802b148") ?? (() => {
|
|
2278
2318
|
const { OfficeIMOError } = _m2;
|
|
2279
2319
|
|
|
2280
2320
|
const { cleanXml, escapeOoxmlAttribute } = _m28;
|
|
@@ -2381,11 +2421,11 @@ function differentialXml(style, policy, numberFormat) {
|
|
|
2381
2421
|
return xml;
|
|
2382
2422
|
}
|
|
2383
2423
|
const _exports = Object.freeze({ fields: fields, optionalBoolean: optionalBoolean, DifferentialStyles: DifferentialStyles, differentialXml: differentialXml });
|
|
2384
|
-
_modules.set("
|
|
2424
|
+
_modules.set("6ae88f25e1c09d00fbb828917498569f883fae88ec25d37caebaf8a2b802b148", _exports);
|
|
2385
2425
|
return _exports;
|
|
2386
2426
|
})();
|
|
2387
2427
|
|
|
2388
|
-
const _m32 = _modules.get("
|
|
2428
|
+
const _m32 = _modules.get("077c3c668f1457253dba044e6f6be7f7afd28a8976ed20c764bd5d5dc7c41889") ?? (() => {
|
|
2389
2429
|
const { escapeOoxmlAttribute, cleanXml, xmlDeclaration } = _m28;
|
|
2390
2430
|
|
|
2391
2431
|
const { OfficeIMOError } = _m2;
|
|
@@ -2595,11 +2635,11 @@ class StyleRegistry {
|
|
|
2595
2635
|
}
|
|
2596
2636
|
}
|
|
2597
2637
|
const _exports = Object.freeze({ colorArgb: _m33.colorArgb, spreadsheetNamespace: spreadsheetNamespace, NumberFormats: NumberFormats, validateStylePatch: validateStylePatch, copyStylePatch: copyStylePatch, StyleRegistry: StyleRegistry });
|
|
2598
|
-
_modules.set("
|
|
2638
|
+
_modules.set("077c3c668f1457253dba044e6f6be7f7afd28a8976ed20c764bd5d5dc7c41889", _exports);
|
|
2599
2639
|
return _exports;
|
|
2600
2640
|
})();
|
|
2601
2641
|
|
|
2602
|
-
const _m36 = _modules.get("
|
|
2642
|
+
const _m36 = _modules.get("f1de2157d2aefa347a314940eb7f89c16545e11f69923920e605409433742f93") ?? (() => {
|
|
2603
2643
|
const { NotSupportedError } = _m2;
|
|
2604
2644
|
|
|
2605
2645
|
const { cleanXml, escapeXml } = _m28;
|
|
@@ -2707,11 +2747,11 @@ function formulaXml(cell) {
|
|
|
2707
2747
|
return "<f>" + escapeXml(cell.formula, "reject") + "</f><v>" + (cell.cachedValue ?? "") + "</v>";
|
|
2708
2748
|
}
|
|
2709
2749
|
const _exports = Object.freeze({ FormulaCell: FormulaCell, isSubtotalFormula: isSubtotalFormula, formulaXml: formulaXml });
|
|
2710
|
-
_modules.set("
|
|
2750
|
+
_modules.set("f1de2157d2aefa347a314940eb7f89c16545e11f69923920e605409433742f93", _exports);
|
|
2711
2751
|
return _exports;
|
|
2712
2752
|
})();
|
|
2713
2753
|
|
|
2714
|
-
const _m35 = _modules.get("
|
|
2754
|
+
const _m35 = _modules.get("4bce839e90e3ef590aa1b224ffd9c4bdf24d7639b93bdf879f9a0d79de4cd0e4") ?? (() => {
|
|
2715
2755
|
const { cleanXml, escapeXml } = _m28;
|
|
2716
2756
|
|
|
2717
2757
|
const { assertExportValue, assertScalar } = _m5;
|
|
@@ -2775,12 +2815,13 @@ function sheetName(requested, names, policy, register = true) {
|
|
|
2775
2815
|
throw new TypeError("Sheet name must be a string.");
|
|
2776
2816
|
// Validate and deduplicate the decoded literal value, before ST_Xstring attribute encoding.
|
|
2777
2817
|
// A requested _xHHHH_ token is literal text; the serializer protects its leading underscore.
|
|
2778
|
-
let base = cleanXml(requested, policy).replace(/[\[\]:*?/\\]/g, "_").
|
|
2818
|
+
let base = cleanXml(requested, policy).replace(/[\[\]:*?/\\]/g, "_").replace(/^[\s']+|[\s']+$/g, "");
|
|
2819
|
+
// Clipping can expose an internal apostrophe or the reserved History name.
|
|
2820
|
+
base = clipName(base, 31).replace(/[\s']+$/g, "");
|
|
2779
2821
|
if (!base)
|
|
2780
2822
|
base = "Sheet";
|
|
2781
2823
|
if (base.toLowerCase() === "history")
|
|
2782
2824
|
base += "_";
|
|
2783
|
-
base = clipName(base, 31);
|
|
2784
2825
|
let name = base, suffix = 2;
|
|
2785
2826
|
while (names.has(name.toLowerCase())) {
|
|
2786
2827
|
const tail = " (" + suffix++ + ")";
|
|
@@ -2803,11 +2844,11 @@ function excelDate(date, mode) {
|
|
|
2803
2844
|
return (time - Date.UTC(1899, 11, 31)) / 86400000 + (time >= Date.UTC(1900, 2, 1) ? 1 : 0);
|
|
2804
2845
|
}
|
|
2805
2846
|
const _exports = Object.freeze({ Cell: Cell, assertXlsxValue: assertXlsxValue, copyValue: copyValue, cellText: cellText, inlineText: inlineText, columnName: columnName, sheetName: sheetName, excelDate: excelDate });
|
|
2806
|
-
_modules.set("
|
|
2847
|
+
_modules.set("4bce839e90e3ef590aa1b224ffd9c4bdf24d7639b93bdf879f9a0d79de4cd0e4", _exports);
|
|
2807
2848
|
return _exports;
|
|
2808
2849
|
})();
|
|
2809
2850
|
|
|
2810
|
-
const _m39 = _modules.get("
|
|
2851
|
+
const _m39 = _modules.get("84c16159c55cf4c0af5d3c67510302694946ae99c6c685fc09314069ee3da5c5") ?? (() => {
|
|
2811
2852
|
const { ChunkedTextSink } = _m3;
|
|
2812
2853
|
|
|
2813
2854
|
const { escapeXml, xmlDeclaration } = _m28;
|
|
@@ -2916,11 +2957,11 @@ async function writeChartXml(chart, destination, policy, signal) {
|
|
|
2916
2957
|
await text.close();
|
|
2917
2958
|
}
|
|
2918
2959
|
const _exports = Object.freeze({ chartNamespace: chartNamespace, chartContentType: chartContentType, chartAnchorXml: chartAnchorXml, writeChartXml: writeChartXml });
|
|
2919
|
-
_modules.set("
|
|
2960
|
+
_modules.set("84c16159c55cf4c0af5d3c67510302694946ae99c6c685fc09314069ee3da5c5", _exports);
|
|
2920
2961
|
return _exports;
|
|
2921
2962
|
})();
|
|
2922
2963
|
|
|
2923
|
-
const _m38 = _modules.get("
|
|
2964
|
+
const _m38 = _modules.get("9d4496a1ff3d58ac0b9dcd7304e6861184df30700c344329157899639df7b5e4") ?? (() => {
|
|
2924
2965
|
const { cleanXml, escapeXml, escapeOoxmlAttribute, xmlDeclaration } = _m28;
|
|
2925
2966
|
|
|
2926
2967
|
const { copyExportLink } = _m7;
|
|
@@ -2994,11 +3035,11 @@ function drawingXml(images, policy, charts = []) {
|
|
|
2994
3035
|
}
|
|
2995
3036
|
const drawingContentType = "application/vnd.openxmlformats-officedocument.drawing+xml";
|
|
2996
3037
|
const _exports = Object.freeze({ copyDrawingAnchor: copyDrawingAnchor, cellPosition: cellPosition, copyHyperlink: copyHyperlink, copyImage: copyImage, hyperlinksXml: hyperlinksXml, drawingXml: drawingXml, drawingContentType: drawingContentType });
|
|
2997
|
-
_modules.set("
|
|
3038
|
+
_modules.set("9d4496a1ff3d58ac0b9dcd7304e6861184df30700c344329157899639df7b5e4", _exports);
|
|
2998
3039
|
return _exports;
|
|
2999
3040
|
})();
|
|
3000
3041
|
|
|
3001
|
-
const _m41 = _modules.get("
|
|
3042
|
+
const _m41 = _modules.get("4c91e257806f805b473340527db7ce3404c98ac27db0a775ff047dc3dded10cc") ?? (() => {
|
|
3002
3043
|
const { OfficeIMOError } = _m2;
|
|
3003
3044
|
|
|
3004
3045
|
const { cellPosition } = _m38;
|
|
@@ -3099,11 +3140,11 @@ class MergeRegions {
|
|
|
3099
3140
|
throw new RangeError("Merged ranges must stay within exported rows."); }
|
|
3100
3141
|
}
|
|
3101
3142
|
const _exports = Object.freeze({ MergeRegions: MergeRegions });
|
|
3102
|
-
_modules.set("
|
|
3143
|
+
_modules.set("4c91e257806f805b473340527db7ce3404c98ac27db0a775ff047dc3dded10cc", _exports);
|
|
3103
3144
|
return _exports;
|
|
3104
3145
|
})();
|
|
3105
3146
|
|
|
3106
|
-
const _m42 = _modules.get("
|
|
3147
|
+
const _m42 = _modules.get("47efdc8f108b0e995accdd63fd1addea0e4de507010cbf0975417e7151636360") ?? (() => {
|
|
3107
3148
|
const { ExportCell } = _m5;
|
|
3108
3149
|
|
|
3109
3150
|
const { tableSpans } = _m18;
|
|
@@ -3136,11 +3177,11 @@ class StructuredRows {
|
|
|
3136
3177
|
}
|
|
3137
3178
|
}
|
|
3138
3179
|
const _exports = Object.freeze({ StructuredRows: StructuredRows });
|
|
3139
|
-
_modules.set("
|
|
3180
|
+
_modules.set("47efdc8f108b0e995accdd63fd1addea0e4de507010cbf0975417e7151636360", _exports);
|
|
3140
3181
|
return _exports;
|
|
3141
3182
|
})();
|
|
3142
3183
|
|
|
3143
|
-
const _m40 = _modules.get("
|
|
3184
|
+
const _m40 = _modules.get("23615ba776e7025e5e40cde325ad13799a7eeae6c88cb2ed74395222f91e6a81") ?? (() => {
|
|
3144
3185
|
const { ExportCell } = _m5;
|
|
3145
3186
|
|
|
3146
3187
|
const { isDate } = _m6;
|
|
@@ -3337,11 +3378,11 @@ function printXml(options, policy) {
|
|
|
3337
3378
|
(options.footer === undefined ? "" : '<oddFooter>' + escapeOoxmlAttribute("&C" + options.footer.replace(/&/g, "&&"), policy) + '</oddFooter>') + '</headerFooter>' : "");
|
|
3338
3379
|
}
|
|
3339
3380
|
const _exports = Object.freeze({ ComputedTotal: ComputedTotal, ReportLayout: ReportLayout, totalFormula: totalFormula, printXml: printXml });
|
|
3340
|
-
_modules.set("
|
|
3381
|
+
_modules.set("23615ba776e7025e5e40cde325ad13799a7eeae6c88cb2ed74395222f91e6a81", _exports);
|
|
3341
3382
|
return _exports;
|
|
3342
3383
|
})();
|
|
3343
3384
|
|
|
3344
|
-
const _m44 = _modules.get("
|
|
3385
|
+
const _m44 = _modules.get("7845d79cd22590bbefc767802abfe3f805e8f68807521cef8d07ecc42db0b491") ?? (() => {
|
|
3345
3386
|
const { columnName } = _m35;
|
|
3346
3387
|
|
|
3347
3388
|
/** @internal Data-column selectors use stable keys or one-based worksheet columns. */
|
|
@@ -3368,11 +3409,11 @@ function qualifiedCell(sheetName, column, row) {
|
|
|
3368
3409
|
return qualifiedColumnRange(sheetName, column, row, 1).split(":")[0];
|
|
3369
3410
|
}
|
|
3370
3411
|
const _exports = Object.freeze({ resolveDataColumn: resolveDataColumn, qualifiedColumnRange: qualifiedColumnRange, qualifiedCell: qualifiedCell });
|
|
3371
|
-
_modules.set("
|
|
3412
|
+
_modules.set("7845d79cd22590bbefc767802abfe3f805e8f68807521cef8d07ecc42db0b491", _exports);
|
|
3372
3413
|
return _exports;
|
|
3373
3414
|
})();
|
|
3374
3415
|
|
|
3375
|
-
const _m45 = _modules.get("
|
|
3416
|
+
const _m45 = _modules.get("4892a7dafefc4d82567cd2bd4cc8da5470cee4dbf546e6473f782f44bd4bbe35") ?? (() => {
|
|
3376
3417
|
const { OfficeIMOError } = _m2;
|
|
3377
3418
|
|
|
3378
3419
|
const { columnName } = _m35;
|
|
@@ -3415,11 +3456,11 @@ function dataRowReference(firstColumn, lastColumn, headerRows, dataRows, ranges)
|
|
|
3415
3456
|
return reference || undefined;
|
|
3416
3457
|
}
|
|
3417
3458
|
const _exports = Object.freeze({ retainDataRowRanges: retainDataRowRanges, dataRowRanges: dataRowRanges, dataRowCount: dataRowCount, dataRowReference: dataRowReference });
|
|
3418
|
-
_modules.set("
|
|
3459
|
+
_modules.set("4892a7dafefc4d82567cd2bd4cc8da5470cee4dbf546e6473f782f44bd4bbe35", _exports);
|
|
3419
3460
|
return _exports;
|
|
3420
3461
|
})();
|
|
3421
3462
|
|
|
3422
|
-
const _m43 = _modules.get("
|
|
3463
|
+
const _m43 = _modules.get("736b2b2fc3489642263dbaf677544e8a270eea6b8efb0cc26c67346e66cab118") ?? (() => {
|
|
3423
3464
|
const { cleanXml, escapeXml, escapeOoxmlAttribute } = _m28;
|
|
3424
3465
|
|
|
3425
3466
|
const { cellPosition } = _m38;
|
|
@@ -3585,11 +3626,11 @@ class ConditionalFormats {
|
|
|
3585
3626
|
}
|
|
3586
3627
|
}
|
|
3587
3628
|
const _exports = Object.freeze({ prepareConditionalFormats: prepareConditionalFormats, ConditionalFormats: ConditionalFormats });
|
|
3588
|
-
_modules.set("
|
|
3629
|
+
_modules.set("736b2b2fc3489642263dbaf677544e8a270eea6b8efb0cc26c67346e66cab118", _exports);
|
|
3589
3630
|
return _exports;
|
|
3590
3631
|
})();
|
|
3591
3632
|
|
|
3592
|
-
const _m46 = _modules.get("
|
|
3633
|
+
const _m46 = _modules.get("860c88d97ba76e8713c14d56967152e369d2f08f50ffada68827a9c220881c61") ?? (() => {
|
|
3593
3634
|
const { OfficeIMOError } = _m2;
|
|
3594
3635
|
|
|
3595
3636
|
const { checkAbort } = _m4;
|
|
@@ -3689,11 +3730,11 @@ function* dataValidationsXml(prepared, headerRows, dataRows, ranges) {
|
|
|
3689
3730
|
yield '</dataValidations>';
|
|
3690
3731
|
}
|
|
3691
3732
|
const _exports = Object.freeze({ prepareDataValidations: prepareDataValidations, dataValidationsXml: dataValidationsXml });
|
|
3692
|
-
_modules.set("
|
|
3733
|
+
_modules.set("860c88d97ba76e8713c14d56967152e369d2f08f50ffada68827a9c220881c61", _exports);
|
|
3693
3734
|
return _exports;
|
|
3694
3735
|
})();
|
|
3695
3736
|
|
|
3696
|
-
const _m37 = _modules.get("
|
|
3737
|
+
const _m37 = _modules.get("b99287e3e329b75007119103112a699c368d8237b37fa79e083b0014a21952e4") ?? (() => {
|
|
3697
3738
|
const { checkAbort, consumeRows, inputRows, pause, taskYieldDue } = _m4;
|
|
3698
3739
|
|
|
3699
3740
|
const { ChunkedTextSink, BlobByteSink } = _m3;
|
|
@@ -3973,7 +4014,8 @@ class Worksheet {
|
|
|
3973
4014
|
});
|
|
3974
4015
|
const originalCharacters = typeof value === "string" ? value.length : 0;
|
|
3975
4016
|
let reservedCharacters = this.preserved || header || footer ? originalCharacters : undefined;
|
|
3976
|
-
|
|
4017
|
+
// Cleaning removes characters; ordinary strings cannot cross Excel's limit.
|
|
4018
|
+
if (type === "string" && originalCharacters > 32767 && cleanXml(value, this.book.settings.invalidCharacterPolicy).length > 32767) {
|
|
3977
4019
|
const cell = col.letter + row;
|
|
3978
4020
|
if (link || this.linkedCells.has(cell))
|
|
3979
4021
|
throw new TypeError("A text-preservation cell cannot also have an external hyperlink.");
|
|
@@ -4415,11 +4457,11 @@ class Worksheet {
|
|
|
4415
4457
|
async discard(error) { this.failed = true; this.error = error; this.pending = []; this.pendingCharacters = 0; this.prepared = undefined; this.buffer = undefined; this.nativeCharts.length = 0; this.chartSources.length = 0; this.output.discard(); await this.entry?.discard(error); }
|
|
4416
4458
|
}
|
|
4417
4459
|
const _exports = Object.freeze({ Worksheet: Worksheet });
|
|
4418
|
-
_modules.set("
|
|
4460
|
+
_modules.set("b99287e3e329b75007119103112a699c368d8237b37fa79e083b0014a21952e4", _exports);
|
|
4419
4461
|
return _exports;
|
|
4420
4462
|
})();
|
|
4421
4463
|
|
|
4422
|
-
const _m47 = _modules.get("
|
|
4464
|
+
const _m47 = _modules.get("7f1b6bb321e8055ba5269c0fe0933cf02f9a4ce269d3b8e4a64cc63d8398954a") ?? (() => {
|
|
4423
4465
|
const { escapeOoxmlAttribute, escapeXml, xmlDeclaration } = _m28;
|
|
4424
4466
|
|
|
4425
4467
|
const { cellText, columnName } = _m35;
|
|
@@ -4462,11 +4504,11 @@ function tableXml(table, rowCount, policy, headerRow = 1, footer) {
|
|
|
4462
4504
|
'" showColumnStripes="' + (options.bandedColumns ? 1 : 0) + '"/></table>';
|
|
4463
4505
|
}
|
|
4464
4506
|
const _exports = Object.freeze({ defineTable: defineTable, tableXml: tableXml });
|
|
4465
|
-
_modules.set("
|
|
4507
|
+
_modules.set("7f1b6bb321e8055ba5269c0fe0933cf02f9a4ce269d3b8e4a64cc63d8398954a", _exports);
|
|
4466
4508
|
return _exports;
|
|
4467
4509
|
})();
|
|
4468
4510
|
|
|
4469
|
-
const _m48 = _modules.get("
|
|
4511
|
+
const _m48 = _modules.get("0c395783b9d7cc62dd39a21adeb698ad4a61e2c89f7b1fc8712e2eb2ccfe9d92") ?? (() => {
|
|
4470
4512
|
const { OfficeIMOError } = _m2;
|
|
4471
4513
|
|
|
4472
4514
|
const { cleanXml } = _m28;
|
|
@@ -4530,11 +4572,11 @@ function* splitText(text) {
|
|
|
4530
4572
|
}
|
|
4531
4573
|
}
|
|
4532
4574
|
const _exports = Object.freeze({ TextOverflow: TextOverflow, clipText: clipText });
|
|
4533
|
-
_modules.set("
|
|
4575
|
+
_modules.set("0c395783b9d7cc62dd39a21adeb698ad4a61e2c89f7b1fc8712e2eb2ccfe9d92", _exports);
|
|
4534
4576
|
return _exports;
|
|
4535
4577
|
})();
|
|
4536
4578
|
|
|
4537
|
-
const _m50 = _modules.get("
|
|
4579
|
+
const _m50 = _modules.get("35db01801a6b2e3e0c5acd7493e56f04b5b41b1d57afa8be28b8358378ad6494") ?? (() => {
|
|
4538
4580
|
const { checkAbort } = _m4;
|
|
4539
4581
|
|
|
4540
4582
|
const { NotSupportedError, OfficeIMOError } = _m2;
|
|
@@ -4662,11 +4704,11 @@ function prepareChartBinding(input, descriptor, budgets, signal, type = "columnC
|
|
|
4662
4704
|
}, finish });
|
|
4663
4705
|
}
|
|
4664
4706
|
const _exports = Object.freeze({ captureChartRange: captureChartRange, prepareChartBinding: prepareChartBinding });
|
|
4665
|
-
_modules.set("
|
|
4707
|
+
_modules.set("35db01801a6b2e3e0c5acd7493e56f04b5b41b1d57afa8be28b8358378ad6494", _exports);
|
|
4666
4708
|
return _exports;
|
|
4667
4709
|
})();
|
|
4668
4710
|
|
|
4669
|
-
const _m49 = _modules.get("
|
|
4711
|
+
const _m49 = _modules.get("6ff482aba6cf0b524cf20f6a4f8af16b842a49f36448b14e73beaf838885d219") ?? (() => {
|
|
4670
4712
|
const { checkAbort } = _m4;
|
|
4671
4713
|
|
|
4672
4714
|
const { NotSupportedError, OfficeIMOError } = _m2;
|
|
@@ -4833,11 +4875,11 @@ function prepareChart(input, policy, availablePoints, availableText, signal, res
|
|
|
4833
4875
|
points, textCharacters });
|
|
4834
4876
|
}
|
|
4835
4877
|
const _exports = Object.freeze({ prepareChart: prepareChart });
|
|
4836
|
-
_modules.set("
|
|
4878
|
+
_modules.set("6ff482aba6cf0b524cf20f6a4f8af16b842a49f36448b14e73beaf838885d219", _exports);
|
|
4837
4879
|
return _exports;
|
|
4838
4880
|
})();
|
|
4839
4881
|
|
|
4840
|
-
const _m24 = _modules.get("
|
|
4882
|
+
const _m24 = _modules.get("0f11efc0d52501e827898643b33f7fa42365115a892aa801634ecea3f3603681") ?? (() => {
|
|
4841
4883
|
const { beginTask, checkAbort, pause, taskYieldDue } = _m4;
|
|
4842
4884
|
|
|
4843
4885
|
const { OfficeIMOError } = _m2;
|
|
@@ -5176,12 +5218,15 @@ class Workbook {
|
|
|
5176
5218
|
});
|
|
5177
5219
|
}
|
|
5178
5220
|
addPart(part) {
|
|
5221
|
+
this.assertOpen();
|
|
5222
|
+
const { uri, contentType, data, relationship } = part;
|
|
5223
|
+
const capturedRelationship = relationship && { id: relationship.id, type: relationship.type, source: relationship.source };
|
|
5179
5224
|
this.assertOpen();
|
|
5180
5225
|
// Reserve now so collisions and invalid names fail at the call site.
|
|
5181
|
-
this.package.addPart(
|
|
5182
|
-
if (
|
|
5183
|
-
const { source,
|
|
5184
|
-
this.package.addRelationship(source ?? "/xl/workbook.xml", {
|
|
5226
|
+
this.package.addPart({ uri, contentType, data });
|
|
5227
|
+
if (capturedRelationship) {
|
|
5228
|
+
const { source, id, type } = capturedRelationship;
|
|
5229
|
+
this.package.addRelationship(source ?? "/xl/workbook.xml", { id, type, target: uri });
|
|
5185
5230
|
}
|
|
5186
5231
|
}
|
|
5187
5232
|
/** Complete the archive and return counts. Does not close or dispose a caller-owned sink. */
|
|
@@ -5312,7 +5357,7 @@ class Workbook {
|
|
|
5312
5357
|
}
|
|
5313
5358
|
}
|
|
5314
5359
|
const _exports = Object.freeze({ Workbook: Workbook });
|
|
5315
|
-
_modules.set("
|
|
5360
|
+
_modules.set("0f11efc0d52501e827898643b33f7fa42365115a892aa801634ecea3f3603681", _exports);
|
|
5316
5361
|
return _exports;
|
|
5317
5362
|
})();
|
|
5318
5363
|
|
|
@@ -5369,7 +5414,7 @@ _modules.set("89111eab1f3857529c2d0cd849f16598097e62bd73841211b9c66ccc7b1b7ca2",
|
|
|
5369
5414
|
return _exports;
|
|
5370
5415
|
})();
|
|
5371
5416
|
|
|
5372
|
-
const _m51 = _modules.get("
|
|
5417
|
+
const _m51 = _modules.get("8d425cd3abec2c5e0140f71239bbeacbae0e57524ed70a8e545f80286c4a1308") ?? (() => {
|
|
5373
5418
|
const { withDestination } = _m3;
|
|
5374
5419
|
|
|
5375
5420
|
const { copyColumns } = _m11;
|
|
@@ -5424,11 +5469,11 @@ async function writeXlsxTo(rows, destination, configuration) {
|
|
|
5424
5469
|
});
|
|
5425
5470
|
}
|
|
5426
5471
|
const _exports = Object.freeze({ writeXlsx: writeXlsx, writeXlsxTo: writeXlsxTo });
|
|
5427
|
-
_modules.set("
|
|
5472
|
+
_modules.set("8d425cd3abec2c5e0140f71239bbeacbae0e57524ed70a8e545f80286c4a1308", _exports);
|
|
5428
5473
|
return _exports;
|
|
5429
5474
|
})();
|
|
5430
5475
|
|
|
5431
|
-
const _m54 = _modules.get("
|
|
5476
|
+
const _m54 = _modules.get("02f1b8fe9368420b22d79efc01f2b37794fc40aaf8150161b3b7623fcdc0d71f") ?? (() => {
|
|
5432
5477
|
const { assertGroupedReportSource } = _m8;
|
|
5433
5478
|
|
|
5434
5479
|
const { captureFields } = _m10;
|
|
@@ -5517,11 +5562,11 @@ function prepareGroupedSheet(report, configuration, maxConditionalFormats = 1000
|
|
|
5517
5562
|
...(options.grandTotalStyle ? { grandTotalStyle: copyStylePatch(options.grandTotalStyle) } : {}) };
|
|
5518
5563
|
}
|
|
5519
5564
|
const _exports = Object.freeze({ groupedOptionFields: groupedOptionFields, prepareGroupedSheet: prepareGroupedSheet });
|
|
5520
|
-
_modules.set("
|
|
5565
|
+
_modules.set("02f1b8fe9368420b22d79efc01f2b37794fc40aaf8150161b3b7623fcdc0d71f", _exports);
|
|
5521
5566
|
return _exports;
|
|
5522
5567
|
})();
|
|
5523
5568
|
|
|
5524
|
-
const _m53 = _modules.get("
|
|
5569
|
+
const _m53 = _modules.get("6b646c4d57b8f8f452eaa7e61d2935bab09681aceb6064b8600bf73ca10b8f4e") ?? (() => {
|
|
5525
5570
|
const { groupedReportOperation } = _m8;
|
|
5526
5571
|
|
|
5527
5572
|
const { checkAbort, withAbort } = _m4;
|
|
@@ -5694,14 +5739,14 @@ async function writeGroupedXlsxTo(report, destination, options) {
|
|
|
5694
5739
|
return withDestination(destination, async (sink) => (await write(report, prepared, sink)).result);
|
|
5695
5740
|
}
|
|
5696
5741
|
const _exports = Object.freeze({ addGroupedXlsx: addGroupedXlsx, writeGroupedXlsx: writeGroupedXlsx, writeGroupedXlsxTo: writeGroupedXlsxTo });
|
|
5697
|
-
_modules.set("
|
|
5742
|
+
_modules.set("6b646c4d57b8f8f452eaa7e61d2935bab09681aceb6064b8600bf73ca10b8f4e", _exports);
|
|
5698
5743
|
return _exports;
|
|
5699
5744
|
})();
|
|
5700
5745
|
|
|
5701
|
-
const _m23 = _modules.get("
|
|
5746
|
+
const _m23 = _modules.get("9fbdb5c6f6af75d87ac6cb47771fe48fa6527be2cb7d16dbad56e4213e2f7195") ?? (() => {
|
|
5702
5747
|
|
|
5703
5748
|
const _exports = Object.freeze({ Workbook: _m24.Workbook, writeXlsx: _m51.writeXlsx, writeXlsxTo: _m51.writeXlsxTo, writeGroupedXlsx: _m53.writeGroupedXlsx, writeGroupedXlsxTo: _m53.writeGroupedXlsxTo, addGroupedXlsx: _m53.addGroupedXlsx, createGroupedReport: _m8.createGroupedReport, Worksheet: _m37.Worksheet, Cell: _m35.Cell, FormulaCell: _m36.FormulaCell, StyleRegistry: _m32.StyleRegistry, NumberFormats: _m32.NumberFormats, saveBlob: _m1.saveBlob, ExportCell: _m5.ExportCell });
|
|
5704
|
-
_modules.set("
|
|
5749
|
+
_modules.set("9fbdb5c6f6af75d87ac6cb47771fe48fa6527be2cb7d16dbad56e4213e2f7195", _exports);
|
|
5705
5750
|
return _exports;
|
|
5706
5751
|
})();
|
|
5707
5752
|
|
|
@@ -5727,7 +5772,7 @@ _modules.set("2f5c0823847e9209017d01b2a753f36056df2a9988fae1f3a1bd5fd186545220",
|
|
|
5727
5772
|
return _exports;
|
|
5728
5773
|
})();
|
|
5729
5774
|
|
|
5730
|
-
const _m55 = _modules.get("
|
|
5775
|
+
const _m55 = _modules.get("b6dbf755b495baef5c7d7651e6a55b2098f2ee304edca2c8b285a0bd7ec127a1") ?? (() => {
|
|
5731
5776
|
const { beginTask, checkAbort, consumeRows, taskYieldDue, withAbort } = _m4;
|
|
5732
5777
|
|
|
5733
5778
|
const { BlobByteSink, ChunkedTextSink, withDestination } = _m3;
|
|
@@ -5874,15 +5919,74 @@ async function writeCsv(rows, configuration) {
|
|
|
5874
5919
|
}
|
|
5875
5920
|
}
|
|
5876
5921
|
const _exports = Object.freeze({ saveBlob: _m1.saveBlob, ExportCell: _m5.ExportCell, writeCsvTo: writeCsvTo, writeCsv: writeCsv });
|
|
5877
|
-
_modules.set("
|
|
5922
|
+
_modules.set("b6dbf755b495baef5c7d7651e6a55b2098f2ee304edca2c8b285a0bd7ec127a1", _exports);
|
|
5878
5923
|
return _exports;
|
|
5879
5924
|
})();
|
|
5880
5925
|
|
|
5881
|
-
const
|
|
5926
|
+
const _m61 = _modules.get("e3d39f39aebcbaf063fd8221df0d9cb5902ad2545a9d9e474bb59d47f15e2c01") ?? (() => {
|
|
5927
|
+
/** @internal One type byte, an eight-byte offset/container number and a two-byte generation/index. */
|
|
5928
|
+
const pdfXrefEntryBytes = 11;
|
|
5929
|
+
function unsigned(bytes, offset, value, width) {
|
|
5930
|
+
if (!Number.isSafeInteger(value) || value < 0 || value >= 2 ** (width * 8))
|
|
5931
|
+
throw new RangeError("Invalid PDF cross-reference field.");
|
|
5932
|
+
// Bitwise shifts truncate to 32 bits. Arithmetic preserves every supported byte offset.
|
|
5933
|
+
for (let index = width - 1; index >= 0; index--) {
|
|
5934
|
+
bytes[offset + index] = value % 256;
|
|
5935
|
+
value = Math.floor(value / 256);
|
|
5936
|
+
}
|
|
5937
|
+
}
|
|
5938
|
+
/** @internal Stream a complete single-section xref, including its own ordinary-object entry.
|
|
5939
|
+
* A defined member index means that the location is an object-stream number rather than a byte offset. */
|
|
5940
|
+
function* pdfXrefChunks(locations, indices) {
|
|
5941
|
+
if (locations.length !== indices.length)
|
|
5942
|
+
throw new Error("PDF cross-reference locations must align.");
|
|
5943
|
+
const perChunk = Math.floor(32768 / pdfXrefEntryBytes);
|
|
5944
|
+
for (let first = 0; first < locations.length; first += perChunk) {
|
|
5945
|
+
const count = Math.min(perChunk, locations.length - first), bytes = new Uint8Array(count * pdfXrefEntryBytes);
|
|
5946
|
+
for (let index = 0; index < count; index++) {
|
|
5947
|
+
const id = first + index, position = index * pdfXrefEntryBytes, location = locations[id], member = indices.at(id);
|
|
5948
|
+
if (location === undefined)
|
|
5949
|
+
throw new Error("PDF contains unwritten objects.");
|
|
5950
|
+
bytes[position] = id === 0 ? 0 : member === undefined ? 1 : 2;
|
|
5951
|
+
unsigned(bytes, position + 1, location, 8);
|
|
5952
|
+
unsigned(bytes, position + 9, id === 0 ? 65535 : member ?? 0, 2);
|
|
5953
|
+
}
|
|
5954
|
+
yield bytes;
|
|
5955
|
+
}
|
|
5956
|
+
}
|
|
5957
|
+
const _exports = Object.freeze({ pdfXrefEntryBytes: pdfXrefEntryBytes, pdfXrefChunks: pdfXrefChunks });
|
|
5958
|
+
_modules.set("e3d39f39aebcbaf063fd8221df0d9cb5902ad2545a9d9e474bb59d47f15e2c01", _exports);
|
|
5959
|
+
return _exports;
|
|
5960
|
+
})();
|
|
5961
|
+
|
|
5962
|
+
const _m60 = _modules.get("e716b8b1da464094622f5f671518493c78e63ff22a029d61544d2d193b63ce8f") ?? (() => {
|
|
5882
5963
|
const { checkAbort, withAbort, pause, taskYieldDue } = _m4;
|
|
5883
5964
|
|
|
5884
5965
|
const { OfficeIMOError } = _m2;
|
|
5885
5966
|
|
|
5967
|
+
const { pdfXrefChunks, pdfXrefEntryBytes } = _m61;
|
|
5968
|
+
|
|
5969
|
+
const compactObjectCount = 256, compactObjectBytes = 32768;
|
|
5970
|
+
const compactIndexChunkEntries = 4096;
|
|
5971
|
+
/** Lazy Uint16 chunks store compact membership; untouched zero slots denote ordinary objects. */
|
|
5972
|
+
class PdfCompactIndices {
|
|
5973
|
+
count;
|
|
5974
|
+
chunks = [];
|
|
5975
|
+
constructor(count) {
|
|
5976
|
+
this.count = count;
|
|
5977
|
+
}
|
|
5978
|
+
get length() { return this.count; }
|
|
5979
|
+
reserve() { this.count++; }
|
|
5980
|
+
set(id, member) {
|
|
5981
|
+
const chunk = this.chunks[Math.floor(id / compactIndexChunkEntries)] ??= new Uint16Array(compactIndexChunkEntries);
|
|
5982
|
+
// The current batch cap permits indices 0..255; adding one preserves index 255 as 256.
|
|
5983
|
+
chunk[id % compactIndexChunkEntries] = member + 1;
|
|
5984
|
+
}
|
|
5985
|
+
at(id) {
|
|
5986
|
+
const encoded = this.chunks[Math.floor(id / compactIndexChunkEntries)]?.[id % compactIndexChunkEntries] ?? 0;
|
|
5987
|
+
return encoded ? encoded - 1 : undefined;
|
|
5988
|
+
}
|
|
5989
|
+
}
|
|
5886
5990
|
function pdfNumber(value) {
|
|
5887
5991
|
if (!Number.isFinite(value) || Math.abs(value) > 1e9)
|
|
5888
5992
|
throw new RangeError("PDF coordinates and metrics must be finite and bounded.");
|
|
@@ -5899,25 +6003,33 @@ function unicodeHex(text) {
|
|
|
5899
6003
|
}
|
|
5900
6004
|
return hex;
|
|
5901
6005
|
}
|
|
5902
|
-
/** @internal Forward-only PDF objects.
|
|
6006
|
+
/** @internal Forward-only PDF objects. Completed objects retain only their xref location. */
|
|
5903
6007
|
class PdfObjects {
|
|
5904
6008
|
sink;
|
|
5905
6009
|
signal;
|
|
5906
6010
|
maxBytes;
|
|
6011
|
+
compressObjects;
|
|
5907
6012
|
offsets = [0];
|
|
6013
|
+
// A defined index changes the corresponding full-width offset into an object-stream number.
|
|
6014
|
+
// Membership chunks are allocated only when a compact member needs their ID range.
|
|
6015
|
+
compactIndices;
|
|
6016
|
+
compactBatch;
|
|
6017
|
+
compactArena;
|
|
6018
|
+
compactUnavailable = false;
|
|
5908
6019
|
encoder = new TextEncoder();
|
|
5909
6020
|
buffer = new Uint8Array(32768);
|
|
5910
6021
|
buffered = 0;
|
|
5911
6022
|
bytes = 0;
|
|
5912
|
-
constructor(sink, signal, maxBytes = Number.MAX_SAFE_INTEGER) {
|
|
6023
|
+
constructor(sink, signal, maxBytes = Number.MAX_SAFE_INTEGER, compressObjects = false) {
|
|
5913
6024
|
this.sink = sink;
|
|
5914
6025
|
this.signal = signal;
|
|
5915
6026
|
this.maxBytes = maxBytes;
|
|
6027
|
+
this.compressObjects = compressObjects;
|
|
5916
6028
|
}
|
|
5917
|
-
reserve() { this.offsets.push(undefined); return this.offsets.length - 1; }
|
|
6029
|
+
reserve() { this.offsets.push(undefined); this.compactIndices?.reserve(); return this.offsets.length - 1; }
|
|
5918
6030
|
async raw(bytes) {
|
|
5919
6031
|
checkAbort(this.signal);
|
|
5920
|
-
if (this.bytes + bytes.length > this.maxBytes)
|
|
6032
|
+
if (!Number.isSafeInteger(this.bytes + bytes.length) || this.bytes + bytes.length > this.maxBytes)
|
|
5921
6033
|
throw new OfficeIMOError("RESOURCE_LIMIT", "maxOutputBytes exceeded.");
|
|
5922
6034
|
this.bytes += bytes.length;
|
|
5923
6035
|
for (let offset = 0; offset < bytes.length;) {
|
|
@@ -5926,21 +6038,139 @@ class PdfObjects {
|
|
|
5926
6038
|
offset += n;
|
|
5927
6039
|
this.buffered += n;
|
|
5928
6040
|
if (this.buffered === this.buffer.length)
|
|
5929
|
-
await this.
|
|
6041
|
+
await this.flushBytes();
|
|
5930
6042
|
}
|
|
5931
6043
|
}
|
|
5932
6044
|
async text(text) { await this.raw(this.encoder.encode(text)); }
|
|
5933
6045
|
async flush() {
|
|
6046
|
+
await this.flushCompact();
|
|
6047
|
+
await this.flushBytes();
|
|
6048
|
+
}
|
|
6049
|
+
/** Publish completed page bytes without forcing a partial structure container to end. */
|
|
6050
|
+
async flushBytes() {
|
|
5934
6051
|
if (this.buffered) {
|
|
5935
6052
|
const bytes = this.buffer.subarray(0, this.buffered);
|
|
5936
6053
|
await withAbort(Promise.resolve(this.sink.write(bytes)), this.signal);
|
|
5937
|
-
this
|
|
6054
|
+
// The sink borrows this view until acceptance; failed or cancelled writes must not reuse it.
|
|
5938
6055
|
this.buffered = 0;
|
|
5939
6056
|
}
|
|
5940
6057
|
if (taskYieldDue())
|
|
5941
6058
|
await pause();
|
|
5942
6059
|
checkAbort(this.signal);
|
|
5943
6060
|
}
|
|
6061
|
+
/** @internal Append only when an existing compact batch can accept a member without async work. */
|
|
6062
|
+
tryCompactObject(id, body) {
|
|
6063
|
+
checkAbort(this.signal);
|
|
6064
|
+
this.validateObject(id);
|
|
6065
|
+
const batch = this.compactBatch;
|
|
6066
|
+
if (!batch || !this.compressObjects || this.compactUnavailable || typeof CompressionStream !== "function" ||
|
|
6067
|
+
body.length > compactObjectBytes || batch.ids.length + 1 >= compactObjectCount)
|
|
6068
|
+
return false;
|
|
6069
|
+
const indexBytes = String(id).length + String(batch.bodyBytes).length + 2;
|
|
6070
|
+
const written = this.encodeCompactBody(body, batch.bodyBytes, compactObjectBytes - batch.indexBytes - indexBytes - batch.bodyBytes - 2);
|
|
6071
|
+
if (written === undefined)
|
|
6072
|
+
return false;
|
|
6073
|
+
this.storeCompactBody(batch, id, written);
|
|
6074
|
+
return true;
|
|
6075
|
+
}
|
|
6076
|
+
/** Small logical structure values share one bounded object-stream container. Other callers keep
|
|
6077
|
+
* ordinary objects; unavailable deflate preserves the classic representation before packing starts. */
|
|
6078
|
+
async compactObject(id, body) {
|
|
6079
|
+
checkAbort(this.signal);
|
|
6080
|
+
this.validateObject(id);
|
|
6081
|
+
if (!this.compressObjects || this.compactUnavailable || body.length > compactObjectBytes)
|
|
6082
|
+
return this.object(id, body);
|
|
6083
|
+
if (typeof CompressionStream !== "function") {
|
|
6084
|
+
if (this.compactIndices)
|
|
6085
|
+
throw new Error("PDF object compression became unavailable.");
|
|
6086
|
+
this.compactUnavailable = true;
|
|
6087
|
+
return this.object(id, body);
|
|
6088
|
+
}
|
|
6089
|
+
const firstIndexBytes = String(id).length + 4;
|
|
6090
|
+
let batch = this.compactBatch;
|
|
6091
|
+
const indexBytes = String(id).length + String(batch?.bodyBytes ?? 0).length + 2;
|
|
6092
|
+
let written = batch && batch.ids.length < compactObjectCount ? this.encodeCompactBody(body, batch.bodyBytes, compactObjectBytes - batch.indexBytes - indexBytes - batch.bodyBytes - 2) : undefined;
|
|
6093
|
+
if (batch && written === undefined) {
|
|
6094
|
+
// Partial encodings only touch the uncommitted suffix. Flush the committed prefix and retry
|
|
6095
|
+
// the whole string so a multibyte scalar is never split between containers.
|
|
6096
|
+
await this.flushCompact();
|
|
6097
|
+
batch = undefined;
|
|
6098
|
+
checkAbort(this.signal);
|
|
6099
|
+
}
|
|
6100
|
+
if (!batch) {
|
|
6101
|
+
written = this.encodeCompactBody(body, 0, compactObjectBytes - firstIndexBytes - 1);
|
|
6102
|
+
if (written === undefined)
|
|
6103
|
+
return this.object(id, body);
|
|
6104
|
+
let compressor;
|
|
6105
|
+
// Probe before selecting the compact representation. Later batches need no idle native
|
|
6106
|
+
// codec while they accumulate, including while ordinary page streams are compressed.
|
|
6107
|
+
if (!this.compactIndices) {
|
|
6108
|
+
try {
|
|
6109
|
+
compressor = new CompressionStream("deflate");
|
|
6110
|
+
}
|
|
6111
|
+
catch {
|
|
6112
|
+
this.compactUnavailable = true;
|
|
6113
|
+
return this.object(id, body);
|
|
6114
|
+
}
|
|
6115
|
+
}
|
|
6116
|
+
batch = { id: this.reserve(), compressor, ids: [], bodyOffsets: [], bodyBytes: 0, indexBytes: 1 };
|
|
6117
|
+
this.compactIndices ??= new PdfCompactIndices(this.offsets.length);
|
|
6118
|
+
this.compactBatch = batch;
|
|
6119
|
+
}
|
|
6120
|
+
this.storeCompactBody(batch, id, written);
|
|
6121
|
+
if (batch.ids.length === compactObjectCount)
|
|
6122
|
+
await this.flushCompact();
|
|
6123
|
+
}
|
|
6124
|
+
storeCompactBody(batch, id, written) {
|
|
6125
|
+
this.offsets[id] = batch.id;
|
|
6126
|
+
this.compactIndices.set(id, batch.ids.length);
|
|
6127
|
+
batch.indexBytes += String(id).length + String(batch.bodyBytes).length + 2;
|
|
6128
|
+
batch.ids.push(id);
|
|
6129
|
+
batch.bodyOffsets.push(batch.bodyBytes);
|
|
6130
|
+
this.compactArena[batch.bodyBytes + written] = 10;
|
|
6131
|
+
batch.bodyBytes += written + 1;
|
|
6132
|
+
}
|
|
6133
|
+
/** An incomplete encoding leaves only scratch bytes beyond the committed batch prefix. */
|
|
6134
|
+
encodeCompactBody(body, offset, available) {
|
|
6135
|
+
if (available < 0)
|
|
6136
|
+
return undefined;
|
|
6137
|
+
const destination = (this.compactArena ??= new Uint8Array(compactObjectBytes)).subarray(offset, offset + available);
|
|
6138
|
+
if (typeof this.encoder.encodeInto === "function") {
|
|
6139
|
+
const result = this.encoder.encodeInto(body, destination);
|
|
6140
|
+
return result.read === body.length ? result.written : undefined;
|
|
6141
|
+
}
|
|
6142
|
+
// Preserve TextEncoder implementations that only expose encode().
|
|
6143
|
+
const bytes = this.encoder.encode(body);
|
|
6144
|
+
if (bytes.length > available)
|
|
6145
|
+
return undefined;
|
|
6146
|
+
destination.set(bytes);
|
|
6147
|
+
return bytes.length;
|
|
6148
|
+
}
|
|
6149
|
+
async flushCompact() {
|
|
6150
|
+
const batch = this.compactBatch;
|
|
6151
|
+
if (!batch)
|
|
6152
|
+
return;
|
|
6153
|
+
this.compactBatch = undefined;
|
|
6154
|
+
let index = "";
|
|
6155
|
+
for (let member = 0; member < batch.ids.length; member++)
|
|
6156
|
+
index += batch.ids[member] + " " + batch.bodyOffsets[member] + " ";
|
|
6157
|
+
const header = this.encoder.encode(index + "\n"), count = batch.ids.length;
|
|
6158
|
+
// Keep the index separate from the arena. Reuse waits for the compressed read or all raw
|
|
6159
|
+
// writes below, so later members cannot overwrite a borrowed batch body.
|
|
6160
|
+
const body = this.compactArena.subarray(0, batch.bodyBytes);
|
|
6161
|
+
batch.ids.length = 0;
|
|
6162
|
+
batch.bodyOffsets.length = 0;
|
|
6163
|
+
if (batch.compressor) {
|
|
6164
|
+
await this.compressedStream(batch.id, body, "/Type /ObjStm /N " + count + " /First " + header.length, batch.compressor, header);
|
|
6165
|
+
}
|
|
6166
|
+
else {
|
|
6167
|
+
this.start(batch.id);
|
|
6168
|
+
await this.text(batch.id + " 0 obj\n<< /Length " + (header.length + body.length) + " /Type /ObjStm /N " + count + " /First " + header.length + " >>\nstream\n");
|
|
6169
|
+
await this.raw(header);
|
|
6170
|
+
await this.raw(body);
|
|
6171
|
+
await this.text("\nendstream\nendobj\n");
|
|
6172
|
+
}
|
|
6173
|
+
}
|
|
5944
6174
|
async object(id, body) {
|
|
5945
6175
|
this.start(id);
|
|
5946
6176
|
if (typeof body === "string") {
|
|
@@ -5964,9 +6194,12 @@ class PdfObjects {
|
|
|
5964
6194
|
}
|
|
5965
6195
|
await this.text(chunk + "\nendobj\n");
|
|
5966
6196
|
}
|
|
5967
|
-
|
|
5968
|
-
if (!Number.
|
|
6197
|
+
validateObject(id) {
|
|
6198
|
+
if (!Number.isSafeInteger(id) || id <= 0 || id >= this.offsets.length || this.offsets[id] !== undefined)
|
|
5969
6199
|
throw new Error("Invalid PDF object state.");
|
|
6200
|
+
}
|
|
6201
|
+
start(id) {
|
|
6202
|
+
this.validateObject(id);
|
|
5970
6203
|
this.offsets[id] = this.bytes;
|
|
5971
6204
|
}
|
|
5972
6205
|
async stream(id, source, dictionary = "", compression = true, owned = false) {
|
|
@@ -5987,7 +6220,15 @@ class PdfObjects {
|
|
|
5987
6220
|
}
|
|
5988
6221
|
// Verified internal producers can transfer immutable ownership; other byte sources retain the defensive snapshot.
|
|
5989
6222
|
const sourceBytes = typeof source === "string" || owned ? bytes : new Uint8Array(bytes);
|
|
5990
|
-
|
|
6223
|
+
await this.compressedStream(id, sourceBytes, dictionary, compressor);
|
|
6224
|
+
}
|
|
6225
|
+
async compressedStream(id, sourceBytes, dictionary, compressor, prefix) {
|
|
6226
|
+
const input = new ReadableStream({ start(controller) {
|
|
6227
|
+
if (prefix)
|
|
6228
|
+
controller.enqueue(prefix);
|
|
6229
|
+
controller.enqueue(sourceBytes);
|
|
6230
|
+
controller.close();
|
|
6231
|
+
} });
|
|
5991
6232
|
const reader = input.pipeThrough(compressor).getReader(), lengthId = this.reserve();
|
|
5992
6233
|
let length = 0, complete = false;
|
|
5993
6234
|
try {
|
|
@@ -6012,10 +6253,14 @@ class PdfObjects {
|
|
|
6012
6253
|
}
|
|
6013
6254
|
}
|
|
6014
6255
|
async finish(root, info) {
|
|
6015
|
-
|
|
6016
|
-
|
|
6256
|
+
await this.flushCompact();
|
|
6257
|
+
for (let id = 1; id < this.offsets.length; id++)
|
|
6258
|
+
if (this.offsets[id] === undefined)
|
|
6259
|
+
throw new Error("PDF contains unwritten objects.");
|
|
6017
6260
|
if (this.bytes > 9999999999)
|
|
6018
6261
|
throw new OfficeIMOError("RESOURCE_LIMIT", "PDF exceeds classic cross-reference offset capacity.");
|
|
6262
|
+
if (this.compactIndices)
|
|
6263
|
+
return this.finishCompact(root, info);
|
|
6019
6264
|
const start = this.bytes;
|
|
6020
6265
|
await this.text("xref\n0 " + this.offsets.length + "\n0000000000 65535 f \n");
|
|
6021
6266
|
for (let i = 1; i < this.offsets.length; i++)
|
|
@@ -6023,13 +6268,27 @@ class PdfObjects {
|
|
|
6023
6268
|
await this.text("trailer\n<< /Size " + this.offsets.length + " /Root " + root + " 0 R /Info " + info + " 0 R >>\nstartxref\n" + start + "\n%%EOF\n");
|
|
6024
6269
|
await this.flush();
|
|
6025
6270
|
}
|
|
6271
|
+
/** Xref payloads have a known length and are emitted in bounded chunks, without another copy
|
|
6272
|
+
* of the document's random-access location arrays or a whole-xref compression buffer. */
|
|
6273
|
+
async finishCompact(root, info) {
|
|
6274
|
+
const id = this.reserve(), start = this.bytes, length = this.offsets.length * pdfXrefEntryBytes;
|
|
6275
|
+
if (!Number.isSafeInteger(length))
|
|
6276
|
+
throw new OfficeIMOError("RESOURCE_LIMIT", "PDF cross-reference stream is too large.");
|
|
6277
|
+
this.start(id);
|
|
6278
|
+
await this.text(id + " 0 obj\n<< /Type /XRef /Size " + this.offsets.length + " /W [1 8 2] /Root " + root + " 0 R /Info " + info +
|
|
6279
|
+
" 0 R /Length " + length + " >>\nstream\n");
|
|
6280
|
+
for (const chunk of pdfXrefChunks(this.offsets, this.compactIndices))
|
|
6281
|
+
await this.raw(chunk);
|
|
6282
|
+
await this.text("\nendstream\nendobj\nstartxref\n" + start + "\n%%EOF\n");
|
|
6283
|
+
await this.flushBytes();
|
|
6284
|
+
}
|
|
6026
6285
|
}
|
|
6027
6286
|
const _exports = Object.freeze({ pdfNumber: pdfNumber, unicodeHex: unicodeHex, PdfObjects: PdfObjects });
|
|
6028
|
-
_modules.set("
|
|
6287
|
+
_modules.set("e716b8b1da464094622f5f671518493c78e63ff22a029d61544d2d193b63ce8f", _exports);
|
|
6029
6288
|
return _exports;
|
|
6030
6289
|
})();
|
|
6031
6290
|
|
|
6032
|
-
const
|
|
6291
|
+
const _m65 = _modules.get("1e169e6ecdeceff319b5da4bf01f4c653c1a3d9e8ad696b141bf8ac52d9f446c") ?? (() => {
|
|
6033
6292
|
/** @internal Bounded big-endian reader used for caller-provided TrueType programs. */
|
|
6034
6293
|
class FontReader {
|
|
6035
6294
|
bytes;
|
|
@@ -6059,8 +6318,8 @@ _modules.set("1e169e6ecdeceff319b5da4bf01f4c653c1a3d9e8ad696b141bf8ac52d9f446c",
|
|
|
6059
6318
|
return _exports;
|
|
6060
6319
|
})();
|
|
6061
6320
|
|
|
6062
|
-
const
|
|
6063
|
-
const { align4 } =
|
|
6321
|
+
const _m66 = _modules.get("ecf6c6ab2f9c5f747338d0d59d9f2cae0b006d9d2a210bcb1545db1f046eb80c") ?? (() => {
|
|
6322
|
+
const { align4 } = _m65;
|
|
6064
6323
|
|
|
6065
6324
|
const { checkAbort, pause, taskYieldDue } = _m4;
|
|
6066
6325
|
|
|
@@ -6280,16 +6539,16 @@ function* checksumSteps(bytes) {
|
|
|
6280
6539
|
return sum;
|
|
6281
6540
|
}
|
|
6282
6541
|
const _exports = Object.freeze({ subsetTrueType: subsetTrueType, subsetTrueTypeCooperatively: subsetTrueTypeCooperatively });
|
|
6283
|
-
_modules.set("
|
|
6542
|
+
_modules.set("ecf6c6ab2f9c5f747338d0d59d9f2cae0b006d9d2a210bcb1545db1f046eb80c", _exports);
|
|
6284
6543
|
return _exports;
|
|
6285
6544
|
})();
|
|
6286
6545
|
|
|
6287
|
-
const
|
|
6546
|
+
const _m64 = _modules.get("2e1fa1582af797386e2e2914c0a27237309b1692a3cc2be688f46590eb74480d") ?? (() => {
|
|
6288
6547
|
const { NotSupportedError } = _m2;
|
|
6289
6548
|
|
|
6290
|
-
const { FontReader } =
|
|
6549
|
+
const { FontReader } = _m65;
|
|
6291
6550
|
|
|
6292
|
-
const { subsetTrueType, subsetTrueTypeCooperatively } =
|
|
6551
|
+
const { subsetTrueType, subsetTrueTypeCooperatively } = _m66;
|
|
6293
6552
|
|
|
6294
6553
|
const { checkAbort, pause, taskYieldDue } = _m4;
|
|
6295
6554
|
|
|
@@ -6525,12 +6784,12 @@ function* parseFont(reader) {
|
|
|
6525
6784
|
return { tables, glyphCount, units, ascent, descent, bbox, widths, offsets, canSubset, cmaps };
|
|
6526
6785
|
}
|
|
6527
6786
|
const _exports = Object.freeze({ TrueTypeFont: TrueTypeFont });
|
|
6528
|
-
_modules.set("
|
|
6787
|
+
_modules.set("2e1fa1582af797386e2e2914c0a27237309b1692a3cc2be688f46590eb74480d", _exports);
|
|
6529
6788
|
return _exports;
|
|
6530
6789
|
})();
|
|
6531
6790
|
|
|
6532
|
-
const
|
|
6533
|
-
const { TrueTypeFont } =
|
|
6791
|
+
const _m63 = _modules.get("d9c1509dff0538488752433e47cd0927ece5f93c559ad0e32dc56602dfd44596") ?? (() => {
|
|
6792
|
+
const { TrueTypeFont } = _m64;
|
|
6534
6793
|
|
|
6535
6794
|
const { beginTask, checkAbort } = _m4;
|
|
6536
6795
|
|
|
@@ -6589,11 +6848,11 @@ class PdfFont {
|
|
|
6589
6848
|
toBytes() { return fontProgram(this).bytes.slice(); }
|
|
6590
6849
|
}
|
|
6591
6850
|
const _exports = Object.freeze({ fontProgram: fontProgram, PdfFont: PdfFont });
|
|
6592
|
-
_modules.set("
|
|
6851
|
+
_modules.set("d9c1509dff0538488752433e47cd0927ece5f93c559ad0e32dc56602dfd44596", _exports);
|
|
6593
6852
|
return _exports;
|
|
6594
6853
|
})();
|
|
6595
6854
|
|
|
6596
|
-
const
|
|
6855
|
+
const _m68 = _modules.get("1ed4965a6e2963a91190baa8a58ada8ce0edde8fe653bcb6609002e872af0d61") ?? (() => {
|
|
6597
6856
|
// Generated by scripts/pdf-widths.mjs from OfficeIMO.Pdf's Adobe AFM-derived metrics.
|
|
6598
6857
|
const helveticaWidths = new Map([
|
|
6599
6858
|
[32, [278, 278]],
|
|
@@ -6916,12 +7175,12 @@ _modules.set("1ed4965a6e2963a91190baa8a58ada8ce0edde8fe653bcb6609002e872af0d61",
|
|
|
6916
7175
|
return _exports;
|
|
6917
7176
|
})();
|
|
6918
7177
|
|
|
6919
|
-
const
|
|
7178
|
+
const _m67 = _modules.get("59911f0fe023545e9e97521b268551078bdc4c5f303e446a13b7d52f905e8070") ?? (() => {
|
|
6920
7179
|
const { OfficeIMOError } = _m2;
|
|
6921
7180
|
|
|
6922
|
-
const { PdfFont, fontProgram } =
|
|
7181
|
+
const { PdfFont, fontProgram } = _m63;
|
|
6923
7182
|
|
|
6924
|
-
const { helveticaWidths } =
|
|
7183
|
+
const { helveticaWidths } = _m68;
|
|
6925
7184
|
|
|
6926
7185
|
const winAnsiExtras = new Map([0x20ac, 0, 0x201a, 0x192, 0x201e, 0x2026, 0x2020, 0x2021, 0x2c6, 0x2030, 0x160, 0x2039, 0x152, 0, 0x17d, 0, 0, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x2dc, 0x2122, 0x161, 0x203a, 0x153, 0, 0x17e, 0x178].map((cp, i) => [cp, i + 128]));
|
|
6927
7186
|
/** @internal Called after scalar support succeeds when encoding a standard-font run. */
|
|
@@ -6981,21 +7240,22 @@ function selectFont(fonts, bold, italic) {
|
|
|
6981
7240
|
return { font, syntheticBold: !!font && bold && !exact, syntheticItalic: !!font && italic && !exact };
|
|
6982
7241
|
}
|
|
6983
7242
|
const _exports = Object.freeze({ standardCode: standardCode, resolveScalar: resolveScalar, validateFonts: validateFonts, selectFont: selectFont });
|
|
6984
|
-
_modules.set("
|
|
7243
|
+
_modules.set("59911f0fe023545e9e97521b268551078bdc4c5f303e446a13b7d52f905e8070", _exports);
|
|
6985
7244
|
return _exports;
|
|
6986
7245
|
})();
|
|
6987
7246
|
|
|
6988
|
-
const
|
|
7247
|
+
const _m62 = _modules.get("7da602b40c346a3838e75963f9a3f10c95ac5ce08a7b0a23b9d96f8898a01db7") ?? (() => {
|
|
6989
7248
|
const { NotSupportedError, OfficeIMOError } = _m2;
|
|
6990
7249
|
|
|
6991
|
-
const { fontProgram } =
|
|
7250
|
+
const { fontProgram } = _m63;
|
|
6992
7251
|
|
|
6993
|
-
const { resolveScalar, selectFont, standardCode, validateFonts } =
|
|
7252
|
+
const { resolveScalar, selectFont, standardCode, validateFonts } = _m67;
|
|
6994
7253
|
|
|
6995
7254
|
const { pdfNumber, unicodeHex } = _m60;
|
|
6996
7255
|
|
|
6997
7256
|
const { checkAbort, pause, taskYieldDue } = _m4;
|
|
6998
7257
|
|
|
7258
|
+
const standardHexBytes = Object.freeze(Array.from({ length: 256 }, (_, byte) => byte.toString(16).padStart(2, "0")));
|
|
6999
7259
|
class PdfFontResource {
|
|
7000
7260
|
index;
|
|
7001
7261
|
bold;
|
|
@@ -7058,7 +7318,7 @@ class PdfFontResource {
|
|
|
7058
7318
|
for (const char of text) {
|
|
7059
7319
|
const cp = char.codePointAt(0);
|
|
7060
7320
|
this.width(cp);
|
|
7061
|
-
hex +=
|
|
7321
|
+
hex += this.program ? this.mappings.get(cp).cid.toString(16).padStart(4, "0") : standardHexBytes[standardCode(cp)];
|
|
7062
7322
|
}
|
|
7063
7323
|
return "<" + hex + ">";
|
|
7064
7324
|
}
|
|
@@ -7193,11 +7453,11 @@ class PdfFontResources {
|
|
|
7193
7453
|
dictionary() { return "<< " + this.resources.map(f => "/" + f.name + " " + f.object + " 0 R").join(" ") + " >>"; }
|
|
7194
7454
|
}
|
|
7195
7455
|
const _exports = Object.freeze({ PdfFontResource: PdfFontResource, PdfFontResources: PdfFontResources });
|
|
7196
|
-
_modules.set("
|
|
7456
|
+
_modules.set("7da602b40c346a3838e75963f9a3f10c95ac5ce08a7b0a23b9d96f8898a01db7", _exports);
|
|
7197
7457
|
return _exports;
|
|
7198
7458
|
})();
|
|
7199
7459
|
|
|
7200
|
-
const
|
|
7460
|
+
const _m70 = _modules.get("253db2c0eab1f298fda61fb40a5ddaacbf6ad12a7408ee3d8c12d27f88e7ca27") ?? (() => {
|
|
7201
7461
|
const { OfficeIMOError } = _m2;
|
|
7202
7462
|
|
|
7203
7463
|
const { ExportCell, assertExportValue } = _m5;
|
|
@@ -7208,6 +7468,11 @@ const { isDate } = _m6;
|
|
|
7208
7468
|
|
|
7209
7469
|
const { defaultBooleanText } = _m21;
|
|
7210
7470
|
|
|
7471
|
+
/** @internal Charge displayed characters: tabs paint four spaces, while CR/LF only separate lines.
|
|
7472
|
+
* Raw text remains authoritative for input limits and layout. Skip normalization when no text ceiling observes it. */
|
|
7473
|
+
function pdfBudgetText(text, budget) {
|
|
7474
|
+
return budget.limits.maxTextCharacters === undefined ? text : text.replace(/[\t\r\n]/g, character => character === "\t" ? " " : "");
|
|
7475
|
+
}
|
|
7211
7476
|
function synchronousText(value, name) {
|
|
7212
7477
|
if (typeof value === "string")
|
|
7213
7478
|
return value;
|
|
@@ -7299,12 +7564,12 @@ function* wrapSteps(text, font, size, width, maxCharacters, maxLines, wrap) {
|
|
|
7299
7564
|
}
|
|
7300
7565
|
return lines;
|
|
7301
7566
|
}
|
|
7302
|
-
const _exports = Object.freeze({ synchronousText: synchronousText, displayText: displayText, wrapText: wrapText, wrapTextCooperatively: wrapTextCooperatively });
|
|
7303
|
-
_modules.set("
|
|
7567
|
+
const _exports = Object.freeze({ pdfBudgetText: pdfBudgetText, synchronousText: synchronousText, displayText: displayText, wrapText: wrapText, wrapTextCooperatively: wrapTextCooperatively });
|
|
7568
|
+
_modules.set("253db2c0eab1f298fda61fb40a5ddaacbf6ad12a7408ee3d8c12d27f88e7ca27", _exports);
|
|
7304
7569
|
return _exports;
|
|
7305
7570
|
})();
|
|
7306
7571
|
|
|
7307
|
-
const
|
|
7572
|
+
const _m72 = _modules.get("8be3fb029e08d100ce8ffcf50916d5ba7f7bc00d62156cc33815fd58554a9ed6") ?? (() => {
|
|
7308
7573
|
const { NotSupportedError, OfficeIMOError } = _m2;
|
|
7309
7574
|
|
|
7310
7575
|
const { checkAbort, pause, taskYieldDue, withAbort } = _m4;
|
|
@@ -7513,11 +7778,11 @@ async function wrapShapedPdfText(captured, fonts, size, width, settings, wrap) {
|
|
|
7513
7778
|
return lines;
|
|
7514
7779
|
}
|
|
7515
7780
|
const _exports = Object.freeze({ wrapShapedPdfText: wrapShapedPdfText });
|
|
7516
|
-
_modules.set("
|
|
7781
|
+
_modules.set("8be3fb029e08d100ce8ffcf50916d5ba7f7bc00d62156cc33815fd58554a9ed6", _exports);
|
|
7517
7782
|
return _exports;
|
|
7518
7783
|
})();
|
|
7519
7784
|
|
|
7520
|
-
const
|
|
7785
|
+
const _m71 = _modules.get("0a1c79b51ac9a164b86197239117df6497f45ca2892b423b1ec77a663ccc1c47") ?? (() => {
|
|
7521
7786
|
const { NotSupportedError, OfficeIMOError } = _m2;
|
|
7522
7787
|
|
|
7523
7788
|
const { copyExportLink } = _m7;
|
|
@@ -7526,21 +7791,30 @@ const { checkAbort, pause, taskYieldDue } = _m4;
|
|
|
7526
7791
|
|
|
7527
7792
|
const { presentation, color } = _m17;
|
|
7528
7793
|
|
|
7529
|
-
const { wrapShapedPdfText } =
|
|
7794
|
+
const { wrapShapedPdfText } = _m72;
|
|
7795
|
+
|
|
7796
|
+
const { PdfFont } = _m63;
|
|
7530
7797
|
|
|
7531
|
-
const {
|
|
7798
|
+
const { pdfBudgetText } = _m70;
|
|
7532
7799
|
|
|
7533
|
-
/** @internal A run list is a PDF presentation value, never an alternate shared table value model. */
|
|
7534
|
-
function capturePdfText(value, base, settings, fonts, countEmpty = true) {
|
|
7535
|
-
|
|
7800
|
+
/** @internal Callers supply an owned, validated, frozen base presentation. A run list is a PDF presentation value, never an alternate shared table value model. */
|
|
7801
|
+
function capturePdfText(value, base, settings, fonts, countEmpty = true, reserveBudget = true) {
|
|
7802
|
+
if (typeof value === "string") {
|
|
7803
|
+
if (value.length > settings.limits.maxCellCharacters)
|
|
7804
|
+
throw new OfficeIMOError("RESOURCE_LIMIT", "maxCellCharacters exceeded.");
|
|
7805
|
+
if (reserveBudget && (value.length || countEmpty))
|
|
7806
|
+
settings.budget.reserve(1, pdfBudgetText(value, settings.budget).length);
|
|
7807
|
+
return Object.freeze({ text: value, runs: Object.freeze([Object.freeze({ text: value, style: base })]) });
|
|
7808
|
+
}
|
|
7809
|
+
const input = value;
|
|
7536
7810
|
if (!Array.isArray(input)) {
|
|
7537
7811
|
if (input && typeof input.then === "function")
|
|
7538
7812
|
void Promise.resolve(input).catch(() => { });
|
|
7539
7813
|
throw new TypeError("PDF text must be a string or a synchronous array of text runs.");
|
|
7540
7814
|
}
|
|
7541
|
-
if (
|
|
7815
|
+
if (input.length > settings.limits.maxTextRuns)
|
|
7542
7816
|
throw new OfficeIMOError("RESOURCE_LIMIT", "maxTextRuns exceeded.");
|
|
7543
|
-
let characters = 0;
|
|
7817
|
+
let characters = 0, budgetCharacters = 0;
|
|
7544
7818
|
const runs = [];
|
|
7545
7819
|
for (const run of input) {
|
|
7546
7820
|
if (!run || typeof run !== "object" || Object.keys(run).some(key => !["text", "bold", "italic", "color", "link", "font"].includes(key)))
|
|
@@ -7556,14 +7830,16 @@ function capturePdfText(value, base, settings, fonts, countEmpty = true) {
|
|
|
7556
7830
|
characters += text.length;
|
|
7557
7831
|
if (characters > settings.limits.maxCellCharacters)
|
|
7558
7832
|
throw new OfficeIMOError("RESOURCE_LIMIT", "maxCellCharacters exceeded.");
|
|
7833
|
+
if (reserveBudget)
|
|
7834
|
+
budgetCharacters += pdfBudgetText(text, settings.budget).length;
|
|
7559
7835
|
const style = presentation({ ...base, ...(bold === undefined ? {} : { bold }), ...(italic === undefined ? {} : { italic }), ...(color === undefined ? {} : { color }) });
|
|
7560
7836
|
if (settings.options.tagged && link !== undefined && text.length && !text.trim())
|
|
7561
7837
|
throw new TypeError("Tagged PDF inline links require nonempty displayed text.");
|
|
7562
7838
|
runs.push(Object.freeze({ text, style, ...(font === undefined ? {} : { font }), ...(link === undefined ? {} : { link: copyExportLink(link) }) }));
|
|
7563
7839
|
}
|
|
7564
7840
|
// Reserve before allocating a joined rich-text value or retaining it in a kept paragraph chain.
|
|
7565
|
-
if (characters || countEmpty)
|
|
7566
|
-
settings.budget.reserve(1,
|
|
7841
|
+
if (reserveBudget && (characters || countEmpty))
|
|
7842
|
+
settings.budget.reserve(1, budgetCharacters);
|
|
7567
7843
|
return Object.freeze({ text: runs.map(run => run.text).join(""), runs: Object.freeze(runs) });
|
|
7568
7844
|
}
|
|
7569
7845
|
/** @internal Greedy wrapping over the continuous text stream, preserving run emphasis and URI geometry. */
|
|
@@ -7572,8 +7848,39 @@ async function wrapPdfText(captured, fonts, size, width, settings, wrap = true)
|
|
|
7572
7848
|
return wrapShapedPdfText(captured, fonts, size, width, settings, wrap);
|
|
7573
7849
|
const { signal } = settings.options, { text, runs } = captured;
|
|
7574
7850
|
checkAbort(signal);
|
|
7575
|
-
|
|
7576
|
-
const
|
|
7851
|
+
// Keep font-selection order while deferring a single-run face array until wrapping needs it.
|
|
7852
|
+
const single = runs.length === 1 ? runs[0] : undefined;
|
|
7853
|
+
const singleFace = single && fonts.select(single.style.bold, single.style.italic, single.font);
|
|
7854
|
+
const selectedFaces = singleFace ? undefined : runs.map(run => fonts.select(run.style.bold, run.style.italic, run.font));
|
|
7855
|
+
const fallback = fonts.select();
|
|
7856
|
+
// Short fitting runs need no per-character layout arrays. Longer text keeps the existing
|
|
7857
|
+
// cooperative checkpoints; controls or the first overflowing advance use the general path.
|
|
7858
|
+
if (single && text.length > 0 && text.length < 4096) {
|
|
7859
|
+
const run = single, font = singleFace;
|
|
7860
|
+
let widthSoFar = 0, fits = true;
|
|
7861
|
+
for (let offset = 0; offset < text.length;) {
|
|
7862
|
+
const scalar = text.codePointAt(offset);
|
|
7863
|
+
if (scalar === 9 || scalar === 10 || scalar === 13) {
|
|
7864
|
+
fits = false;
|
|
7865
|
+
break;
|
|
7866
|
+
}
|
|
7867
|
+
const advance = font.width(scalar) * size / 1000;
|
|
7868
|
+
if (advance > width + .001 || widthSoFar + advance > width + .001) {
|
|
7869
|
+
fits = false;
|
|
7870
|
+
break;
|
|
7871
|
+
}
|
|
7872
|
+
widthSoFar += advance;
|
|
7873
|
+
offset += scalar > 0xffff ? 2 : 1;
|
|
7874
|
+
}
|
|
7875
|
+
if (fits) {
|
|
7876
|
+
if (settings.limits.maxRowLines < 1)
|
|
7877
|
+
throw new OfficeIMOError("RESOURCE_LIMIT", "maxRowLines exceeded.");
|
|
7878
|
+
return [{ text, width: widthSoFar, segments: [{ text, width: widthSoFar, font,
|
|
7879
|
+
...(run.style.color === undefined ? {} : { color: run.style.color }), ...(run.link ? { link: run.link } : {}) }],
|
|
7880
|
+
lineHeight: font.lineHeight(size), ascent: Math.max(0, (font.program?.ascent ?? 800) * size / 1000) }];
|
|
7881
|
+
}
|
|
7882
|
+
}
|
|
7883
|
+
const faces = selectedFaces ?? [singleFace], lines = [];
|
|
7577
7884
|
let chars = [], advances = [], owners = [], measured = 0, breakAt = -1;
|
|
7578
7885
|
let runIndex = 0, runEnd = runs[0]?.text.length ?? 0, scanned = 0;
|
|
7579
7886
|
const emit = (count) => {
|
|
@@ -7667,23 +7974,21 @@ async function wrapPdfText(captured, fonts, size, width, settings, wrap = true)
|
|
|
7667
7974
|
return lines;
|
|
7668
7975
|
}
|
|
7669
7976
|
const _exports = Object.freeze({ capturePdfText: capturePdfText, wrapPdfText: wrapPdfText });
|
|
7670
|
-
_modules.set("
|
|
7977
|
+
_modules.set("0a1c79b51ac9a164b86197239117df6497f45ca2892b423b1ec77a663ccc1c47", _exports);
|
|
7671
7978
|
return _exports;
|
|
7672
7979
|
})();
|
|
7673
7980
|
|
|
7674
|
-
const
|
|
7981
|
+
const _m73 = _modules.get("9a88773878eacc51df9f05bb5ee90cc2b683b083ebea8fb54375092301388e96") ?? (() => {
|
|
7675
7982
|
const { OfficeIMOError } = _m2;
|
|
7676
7983
|
|
|
7677
|
-
const { wrapPdfText } =
|
|
7984
|
+
const { wrapPdfText } = _m71;
|
|
7678
7985
|
|
|
7679
7986
|
/** Plan without opening a source. Exact column widths never shrink in band mode. */
|
|
7680
7987
|
function planTableBands(widths, settings) {
|
|
7681
7988
|
const policy = settings.options.wideTable;
|
|
7682
7989
|
if (typeof policy !== "object")
|
|
7683
7990
|
return undefined;
|
|
7684
|
-
const available = settings.page.width - settings.margins.left - settings.margins.right, repeats =
|
|
7685
|
-
if (repeats.some(index => index >= widths.length))
|
|
7686
|
-
throw new RangeError("repeatColumns index exceeds the declared columns.");
|
|
7991
|
+
const available = settings.page.width - settings.margins.left - settings.margins.right, repeats = settings.repeatedColumns;
|
|
7687
7992
|
const repeated = new Set(repeats), rest = widths.map((_, index) => index).filter(index => !repeated.has(index));
|
|
7688
7993
|
const prefix = repeats.reduce((sum, index) => sum + widths[index], 0);
|
|
7689
7994
|
if (prefix > available + .001)
|
|
@@ -7760,11 +8065,11 @@ function alignBandBlocks(bands, settings) {
|
|
|
7760
8065
|
cells: row.cells.map(cell => ({ ...cell, height: heights.slice(index, index + (cell.rowSpan ?? 1)).reduce((sum, value) => sum + value, 0) })) })));
|
|
7761
8066
|
}
|
|
7762
8067
|
const _exports = Object.freeze({ planTableBands: planTableBands, projectBandRows: projectBandRows, alignBandBlocks: alignBandBlocks });
|
|
7763
|
-
_modules.set("
|
|
8068
|
+
_modules.set("9a88773878eacc51df9f05bb5ee90cc2b683b083ebea8fb54375092301388e96", _exports);
|
|
7764
8069
|
return _exports;
|
|
7765
8070
|
})();
|
|
7766
8071
|
|
|
7767
|
-
const
|
|
8072
|
+
const _m69 = _modules.get("07d2da8d8b93f12f172a48b97c1807e485555cf608e2eaa5b7610aa91d4a5305") ?? (() => {
|
|
7768
8073
|
const { ExportCell } = _m5;
|
|
7769
8074
|
|
|
7770
8075
|
const { copyExportLink } = _m7;
|
|
@@ -7775,11 +8080,11 @@ const { createTotals } = _m12;
|
|
|
7775
8080
|
|
|
7776
8081
|
const { presentation, positive } = _m17;
|
|
7777
8082
|
|
|
7778
|
-
const { displayText } =
|
|
8083
|
+
const { displayText, pdfBudgetText } = _m70;
|
|
7779
8084
|
|
|
7780
|
-
const { capturePdfText, wrapPdfText } =
|
|
8085
|
+
const { capturePdfText, wrapPdfText } = _m71;
|
|
7781
8086
|
|
|
7782
|
-
const { planTableBands, projectBandRows, alignBandBlocks } =
|
|
8087
|
+
const { planTableBands, projectBandRows, alignBandBlocks } = _m73;
|
|
7783
8088
|
|
|
7784
8089
|
class PdfTableLayout {
|
|
7785
8090
|
settings;
|
|
@@ -7792,11 +8097,13 @@ class PdfTableLayout {
|
|
|
7792
8097
|
totals;
|
|
7793
8098
|
repeatedColumns;
|
|
7794
8099
|
structuredBandRows = new WeakMap();
|
|
8100
|
+
/** Plain/alternate ordinary-data defaults, validated only when a column first needs them. */
|
|
8101
|
+
dataPresentations = [];
|
|
7795
8102
|
constructor(settings, fonts) {
|
|
7796
8103
|
this.settings = settings;
|
|
7797
8104
|
this.fonts = fonts;
|
|
7798
8105
|
const { options, padding, fontSize, page, margins } = settings, columns = options.columns, available = page.width - margins.left - margins.right;
|
|
7799
|
-
this.repeatedColumns = new Set(
|
|
8106
|
+
this.repeatedColumns = new Set(settings.repeatedColumns);
|
|
7800
8107
|
let digit;
|
|
7801
8108
|
if (options.columnWidths && options.columnWidths.length !== columns.length)
|
|
7802
8109
|
throw new RangeError("columnWidths must declare one point width per column.");
|
|
@@ -7837,13 +8144,22 @@ class PdfTableLayout {
|
|
|
7837
8144
|
this.headings = headings;
|
|
7838
8145
|
this.totals = createTotals(columns, options.footer?.totals);
|
|
7839
8146
|
}
|
|
7840
|
-
async cell(value, first, span, row, style) {
|
|
8147
|
+
async cell(value, first, span, row, style, ordinaryData = false) {
|
|
7841
8148
|
const { options, padding, fontSize, budget } = this.settings, column = options.columns[first];
|
|
7842
8149
|
const own = value instanceof ExportCell ? value.presentation : undefined;
|
|
7843
8150
|
const link = value instanceof ExportCell && value.link ? copyExportLink(value.link) : undefined;
|
|
7844
|
-
const
|
|
7845
|
-
|
|
7846
|
-
|
|
8151
|
+
const alternate = ordinaryData && row % 2 && options.alternateRowColor ? options.alternateRowColor : undefined;
|
|
8152
|
+
const slot = first * 2 + (alternate ? 1 : 0), reusable = ordinaryData && own === undefined;
|
|
8153
|
+
let combined = reusable ? this.dataPresentations[slot] : undefined;
|
|
8154
|
+
if (!combined) {
|
|
8155
|
+
const rowStyle = ordinaryData ? alternate ? { background: alternate } : {} : style;
|
|
8156
|
+
combined = presentation({ ...(column.alignment === undefined ? {} : { alignment: column.alignment }),
|
|
8157
|
+
...(column.wrapText === undefined ? {} : { wrapText: column.wrapText }), ...rowStyle, ...own });
|
|
8158
|
+
// Validate only the first reached default; an authored cell may override invalid column defaults.
|
|
8159
|
+
if (reusable)
|
|
8160
|
+
this.dataPresentations[slot] = combined;
|
|
8161
|
+
}
|
|
8162
|
+
const font = this.fonts.select(combined.bold, combined.italic), width = span === 1 ? this.widths[first] : this.widths.slice(first, first + span).reduce((n, w) => n + w, 0);
|
|
7847
8163
|
const context = { rowIndex: row, columnIndex: first, column }, raw = value instanceof ExportCell ? value.value : value;
|
|
7848
8164
|
let text;
|
|
7849
8165
|
if (options.formatRuns && row >= 0 && !(value instanceof ExportCell && value.text !== undefined)) {
|
|
@@ -7862,10 +8178,11 @@ class PdfTableLayout {
|
|
|
7862
8178
|
throw new TypeError("Tagged PDF cell links require nonempty displayed text.");
|
|
7863
8179
|
if (link && captured.runs.some(run => run.link))
|
|
7864
8180
|
throw new TypeError("A PDF cell link cannot be combined with inline run links.");
|
|
8181
|
+
const budgetText = pdfBudgetText(captured.text, budget);
|
|
7865
8182
|
if (this.bands)
|
|
7866
|
-
budget.release(1,
|
|
8183
|
+
budget.release(1, budgetText.length);
|
|
7867
8184
|
else
|
|
7868
|
-
budget.cell(
|
|
8185
|
+
budget.cell(budgetText, budgetText.length);
|
|
7869
8186
|
const lines = await wrapPdfText(captured, this.fonts, fontSize, width - padding * 2, this.settings, combined.wrapText !== false);
|
|
7870
8187
|
return { first, span, width, font, style: combined, lineHeight: lines.reduce((height, line) => Math.max(height, line.lineHeight), font.lineHeight(fontSize)),
|
|
7871
8188
|
...(link ? { link } : {}), ...(this.bands ? { captured } : {}),
|
|
@@ -7964,8 +8281,8 @@ class PdfTableLayout {
|
|
|
7964
8281
|
const value = values[column], raw = value instanceof ExportCell ? value.value : value;
|
|
7965
8282
|
if (!footer)
|
|
7966
8283
|
this.totals[column].accept(raw);
|
|
7967
|
-
const
|
|
7968
|
-
cells.push(
|
|
8284
|
+
const cell = await this.cell(value, column, 1, index, footer ? options.footerPresentation ?? {} : undefined, !footer);
|
|
8285
|
+
cells.push(!footer && options.columns[column].rowHeader ? { ...cell, rowHeader: true } : cell);
|
|
7969
8286
|
}
|
|
7970
8287
|
return this.row(cells);
|
|
7971
8288
|
}
|
|
@@ -7979,11 +8296,11 @@ class PdfTableLayout {
|
|
|
7979
8296
|
}
|
|
7980
8297
|
}
|
|
7981
8298
|
const _exports = Object.freeze({ PdfTableLayout: PdfTableLayout });
|
|
7982
|
-
_modules.set("
|
|
8299
|
+
_modules.set("07d2da8d8b93f12f172a48b97c1807e485555cf608e2eaa5b7610aa91d4a5305", _exports);
|
|
7983
8300
|
return _exports;
|
|
7984
8301
|
})();
|
|
7985
8302
|
|
|
7986
|
-
const
|
|
8303
|
+
const _m75 = _modules.get("67ad5f4adbd6bc0dddafe5cf82638d46d150237f4ff0bee15c0ace652d5095f4") ?? (() => {
|
|
7987
8304
|
const { OfficeIMOError } = _m2;
|
|
7988
8305
|
|
|
7989
8306
|
const { checkAbort } = _m4;
|
|
@@ -8027,7 +8344,7 @@ class PdfTableBandFlow {
|
|
|
8027
8344
|
await this.flush();
|
|
8028
8345
|
}
|
|
8029
8346
|
async row(row, allowFirstFragment = false) {
|
|
8030
|
-
const { padding, options } = this.layout.settings, minimumLines = this.layout.minimumRowLines(row), minimumHeight = this.layout.minimumRowHeight(row);
|
|
8347
|
+
const { padding, fontSize, options } = this.layout.settings, minimumLines = this.layout.minimumRowLines(row), minimumHeight = this.layout.minimumRowHeight(row);
|
|
8031
8348
|
if (minimumHeight > this.painter.firstFullCapacity + .001 || minimumHeight > this.painter.continuationCapacity + .001)
|
|
8032
8349
|
throw new RangeError("Repeated PDF identifiers must fit intact below the first and continued band headings/context.");
|
|
8033
8350
|
// Keep ordinary rows intact when they fit fresh. A kept heading/caption can deliberately
|
|
@@ -8053,16 +8370,29 @@ class PdfTableBandFlow {
|
|
|
8053
8370
|
const lines = Math.min(row.lines - first, Math.floor((this.capacity - this.height - padding * 2 + .001) / row.lineHeight));
|
|
8054
8371
|
if (lines < 1)
|
|
8055
8372
|
throw new RangeError("PDF page cannot fit a table line below horizontal band headings.");
|
|
8056
|
-
|
|
8373
|
+
// Reserve one shared logical fragment, but paint only each band's visible cell geometry.
|
|
8374
|
+
const reservedLines = Math.max(lines, minimumLines), height = reservedLines * row.lineHeight + padding * 2;
|
|
8057
8375
|
const projected = await this.layout.bandRows([row]);
|
|
8058
|
-
const
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8376
|
+
const exhaustedBands = [];
|
|
8377
|
+
const fragments = projected.map((rows, index) => {
|
|
8378
|
+
let remaining = false;
|
|
8379
|
+
const cells = rows[0].cells.map(cell => {
|
|
8380
|
+
const source = this.layout.bands[index].columns[cell.first];
|
|
8381
|
+
const repeated = this.layout.repeatedColumn(source), visible = repeated ? cell.lines : cell.lines.slice(first, first + lines);
|
|
8382
|
+
if (!repeated && (visible.length > 0 || cell.link !== undefined))
|
|
8383
|
+
remaining = true;
|
|
8384
|
+
const { height: _height, ...plain } = cell;
|
|
8385
|
+
return { ...plain, lines: visible,
|
|
8386
|
+
lineHeight: visible.reduce((value, line) => Math.max(value, line.lineHeight), cell.font.lineHeight(fontSize)),
|
|
8387
|
+
...(first > 0 && repeated ? { semanticArtifact: true } : {}) };
|
|
8388
|
+
});
|
|
8389
|
+
const fragmentLines = Math.max(1, ...cells.map(cell => cell.lines.length));
|
|
8390
|
+
const lineHeight = Math.max(this.layout.lineHeight, ...cells.filter(cell => cell.lines.length > 0).map(cell => cell.lineHeight));
|
|
8391
|
+
// Never omit an initial/new row, a structured block, or a nonrepeated link obligation.
|
|
8392
|
+
exhaustedBands.push(first > 0 && !remaining);
|
|
8393
|
+
return [{ ...rows[0], cells, lines: fragmentLines, lineHeight, height: fragmentLines * lineHeight + padding * 2 }];
|
|
8394
|
+
});
|
|
8395
|
+
await this.accept({ rows: fragments, height, count: 1, completed: first + lines >= row.lines ? [row] : [], exhaustedBands });
|
|
8066
8396
|
first += lines;
|
|
8067
8397
|
if (first < row.lines)
|
|
8068
8398
|
await this.flush();
|
|
@@ -8074,7 +8404,7 @@ class PdfTableBandFlow {
|
|
|
8074
8404
|
throw new OfficeIMOError("RESOURCE_LIMIT", "A structured PDF block exceeds maxTableWindowRows.");
|
|
8075
8405
|
for (const row of rows)
|
|
8076
8406
|
await this.painter.prepareRow?.(row);
|
|
8077
|
-
await this.accept({ rows: projected, height, count: rows.length, completed: rows });
|
|
8407
|
+
await this.accept({ rows: projected, height, count: rows.length, completed: rows, exhaustedBands: projected.map(() => false) });
|
|
8078
8408
|
}
|
|
8079
8409
|
async keptRows(rows, allowFirstFragment = false) {
|
|
8080
8410
|
const height = rows.reduce((sum, row) => sum + row.height, 0), fits = height <= this.painter.continuationCapacity + .001;
|
|
@@ -8088,6 +8418,8 @@ class PdfTableBandFlow {
|
|
|
8088
8418
|
return;
|
|
8089
8419
|
for (let band = 0; band < this.layout.bands.length; band++) {
|
|
8090
8420
|
checkAbort(this.layout.settings.options.signal);
|
|
8421
|
+
if (!this.firstWindow && this.entries.length > 0 && this.entries.every(entry => entry.exhaustedBands[band]))
|
|
8422
|
+
continue;
|
|
8091
8423
|
await this.painter.paint(band, this.headings[band], this.entries.flatMap(entry => entry.rows[band]), this.firstWindow ? this.caption : this.continuation, this.firstWindow, band === 0);
|
|
8092
8424
|
}
|
|
8093
8425
|
for (const entry of this.entries)
|
|
@@ -8101,11 +8433,11 @@ class PdfTableBandFlow {
|
|
|
8101
8433
|
}
|
|
8102
8434
|
}
|
|
8103
8435
|
const _exports = Object.freeze({ PdfTableBandFlow: PdfTableBandFlow });
|
|
8104
|
-
_modules.set("
|
|
8436
|
+
_modules.set("67ad5f4adbd6bc0dddafe5cf82638d46d150237f4ff0bee15c0ace652d5095f4", _exports);
|
|
8105
8437
|
return _exports;
|
|
8106
8438
|
})();
|
|
8107
8439
|
|
|
8108
|
-
const
|
|
8440
|
+
const _m76 = _modules.get("b52424ed74721dce3a2621456888fe1c6af0490627063e56f690df9abcb1dfff") ?? (() => {
|
|
8109
8441
|
/** @internal Source-cell identities survive page fragments and horizontal band projections.
|
|
8110
8442
|
* Only column headers and still-owned row objects remain reachable from this table owner. */
|
|
8111
8443
|
class PdfTableStructure {
|
|
@@ -8115,6 +8447,8 @@ class PdfTableStructure {
|
|
|
8115
8447
|
cells = new WeakMap();
|
|
8116
8448
|
rows = new WeakMap();
|
|
8117
8449
|
columnHeaders = [];
|
|
8450
|
+
/** Ordinary cells without row headers share immutable dictionary references, bounded by column count. */
|
|
8451
|
+
ordinaryAttributes = [];
|
|
8118
8452
|
headerCount = 0;
|
|
8119
8453
|
headersPrepared = false;
|
|
8120
8454
|
constructor(structure, table, headers) {
|
|
@@ -8155,19 +8489,30 @@ class PdfTableStructure {
|
|
|
8155
8489
|
return row.cells.map(cell => this.cells.get(cell));
|
|
8156
8490
|
const rowId = this.structure.element("TR", parent);
|
|
8157
8491
|
this.rows.set(row, rowId);
|
|
8158
|
-
const
|
|
8159
|
-
|
|
8160
|
-
//
|
|
8492
|
+
const headers = row.cells.map((cell, index) => rowHeaderIndex === undefined ? cell.rowHeader === true : index === rowHeaderIndex);
|
|
8493
|
+
// Allocate in source order, then resolve every row header before associating even earlier data cells.
|
|
8494
|
+
// Generated summary labels override detail roles so numeric subtotal cells never become row headers.
|
|
8495
|
+
const ids = row.cells.map((cell, index) => {
|
|
8496
|
+
const id = this.structure.element(headers[index] ? "TH" : "TD", rowId);
|
|
8497
|
+
this.cells.set(cell, id);
|
|
8498
|
+
return id;
|
|
8499
|
+
});
|
|
8500
|
+
const rowHeaders = [];
|
|
8501
|
+
for (let index = 0; index < ids.length; index++)
|
|
8502
|
+
if (headers[index])
|
|
8503
|
+
rowHeaders.push(await this.structure.identifier(ids[index]));
|
|
8161
8504
|
for (let index = 0; index < row.cells.length; index++) {
|
|
8162
|
-
const cell = row.cells[index]
|
|
8505
|
+
const cell = row.cells[index];
|
|
8506
|
+
if (!rowHeaders.length && cell.span === 1 && (cell.rowSpan ?? 1) === 1) {
|
|
8507
|
+
const attributes = this.ordinaryAttributes[cell.first] ??=
|
|
8508
|
+
await this.structure.attributeReference(this.attributeDictionary(cell, this.associations(cell)));
|
|
8509
|
+
this.structure.setAttributes(ids[index], attributes);
|
|
8510
|
+
continue;
|
|
8511
|
+
}
|
|
8163
8512
|
const associations = this.associations(cell);
|
|
8164
|
-
if (
|
|
8165
|
-
associations.push(
|
|
8166
|
-
|
|
8167
|
-
this.cells.set(cell, id);
|
|
8168
|
-
ids.push(id);
|
|
8169
|
-
if (isRowHeader)
|
|
8170
|
-
rowHeaderIdentifier = await this.structure.identifier(id);
|
|
8513
|
+
if (!headers[index])
|
|
8514
|
+
associations.push(...rowHeaders);
|
|
8515
|
+
this.structure.setAttributes(ids[index], this.attributes(cell, associations, headers[index] ? "Row" : undefined));
|
|
8171
8516
|
}
|
|
8172
8517
|
return ids;
|
|
8173
8518
|
}
|
|
@@ -8193,17 +8538,20 @@ class PdfTableStructure {
|
|
|
8193
8538
|
return [...headers].sort((left, right) => left.order - right.order).map(header => header.identifier);
|
|
8194
8539
|
}
|
|
8195
8540
|
attributes(cell, headers, scope) {
|
|
8196
|
-
return " /A
|
|
8541
|
+
return " /A " + this.attributeDictionary(cell, headers, scope);
|
|
8542
|
+
}
|
|
8543
|
+
attributeDictionary(cell, headers, scope) {
|
|
8544
|
+
return "<< /O /Table" + (scope === undefined ? "" : " /Scope /" + scope) +
|
|
8197
8545
|
(cell.span > 1 ? " /ColSpan " + cell.span : "") + ((cell.rowSpan ?? 1) > 1 ? " /RowSpan " + cell.rowSpan : "") +
|
|
8198
8546
|
(headers.length ? " /Headers [" + headers.map(id => "(" + id + ")").join(" ") + "]" : "") + " >>";
|
|
8199
8547
|
}
|
|
8200
8548
|
}
|
|
8201
8549
|
const _exports = Object.freeze({ PdfTableStructure: PdfTableStructure });
|
|
8202
|
-
_modules.set("
|
|
8550
|
+
_modules.set("b52424ed74721dce3a2621456888fe1c6af0490627063e56f690df9abcb1dfff", _exports);
|
|
8203
8551
|
return _exports;
|
|
8204
8552
|
})();
|
|
8205
8553
|
|
|
8206
|
-
const
|
|
8554
|
+
const _m77 = _modules.get("09c712096a1028af340e275d5a273e870546413797e71ed709657ad0482ea170") ?? (() => {
|
|
8207
8555
|
const { OfficeIMOError } = _m2;
|
|
8208
8556
|
|
|
8209
8557
|
const { pdfNumber, unicodeHex } = _m60;
|
|
@@ -8245,11 +8593,11 @@ function linkAnnotation(link, x, bottom, width, height, maxBytes, structParent,
|
|
|
8245
8593
|
(link.tooltip === undefined ? "" : " /Contents <feff" + unicodeHex(link.tooltip) + ">") + " >>";
|
|
8246
8594
|
}
|
|
8247
8595
|
const _exports = Object.freeze({ linkAnnotation: linkAnnotation });
|
|
8248
|
-
_modules.set("
|
|
8596
|
+
_modules.set("09c712096a1028af340e275d5a273e870546413797e71ed709657ad0482ea170", _exports);
|
|
8249
8597
|
return _exports;
|
|
8250
8598
|
})();
|
|
8251
8599
|
|
|
8252
|
-
const
|
|
8600
|
+
const _m78 = _modules.get("c68d18d668366fb9b96d1b53c79dc6305f84cb83c05e4942fcf1cdf96ed1a73f") ?? (() => {
|
|
8253
8601
|
const { OfficeIMOError } = _m2;
|
|
8254
8602
|
|
|
8255
8603
|
const { unicodeHex } = _m60;
|
|
@@ -8294,11 +8642,11 @@ function captureSection(block, settings) {
|
|
|
8294
8642
|
...(pageNumbers === undefined ? {} : { pageNumbers }) });
|
|
8295
8643
|
}
|
|
8296
8644
|
const _exports = Object.freeze({ captureBookmark: captureBookmark, captureSection: captureSection });
|
|
8297
|
-
_modules.set("
|
|
8645
|
+
_modules.set("c68d18d668366fb9b96d1b53c79dc6305f84cb83c05e4942fcf1cdf96ed1a73f", _exports);
|
|
8298
8646
|
return _exports;
|
|
8299
8647
|
})();
|
|
8300
8648
|
|
|
8301
|
-
const
|
|
8649
|
+
const _m79 = _modules.get("a66257a32f03d958aa57be4de9da7f80b708cebca26b5cc6404de0ee11bfe052") ?? (() => {
|
|
8302
8650
|
const { settings } = _m17;
|
|
8303
8651
|
|
|
8304
8652
|
/** @internal Every section derives from captured document defaults, never the preceding section. */
|
|
@@ -8313,11 +8661,11 @@ function sectionSettings(base, section) {
|
|
|
8313
8661
|
return { ...base, page: derived.page, margins: derived.margins, options };
|
|
8314
8662
|
}
|
|
8315
8663
|
const _exports = Object.freeze({ sectionSettings: sectionSettings });
|
|
8316
|
-
_modules.set("
|
|
8664
|
+
_modules.set("a66257a32f03d958aa57be4de9da7f80b708cebca26b5cc6404de0ee11bfe052", _exports);
|
|
8317
8665
|
return _exports;
|
|
8318
8666
|
})();
|
|
8319
8667
|
|
|
8320
|
-
const
|
|
8668
|
+
const _m74 = _modules.get("a7fca40cb8c75af206111c90db36839b4648982beeb4179efda0ddd1ee366210") ?? (() => {
|
|
8321
8669
|
const { OfficeIMOError } = _m2;
|
|
8322
8670
|
|
|
8323
8671
|
const { checkAbort } = _m4;
|
|
@@ -8326,19 +8674,19 @@ const { pdfNumber } = _m60;
|
|
|
8326
8674
|
|
|
8327
8675
|
const { color } = _m17;
|
|
8328
8676
|
|
|
8329
|
-
const { PdfTableBandFlow } =
|
|
8677
|
+
const { PdfTableBandFlow } = _m75;
|
|
8330
8678
|
|
|
8331
|
-
const { PdfTableStructure } =
|
|
8679
|
+
const { PdfTableStructure } = _m76;
|
|
8332
8680
|
|
|
8333
|
-
const { wrapText, wrapTextCooperatively, synchronousText } =
|
|
8681
|
+
const { wrapText, wrapTextCooperatively, synchronousText, pdfBudgetText } = _m70;
|
|
8334
8682
|
|
|
8335
|
-
const { linkAnnotation } =
|
|
8683
|
+
const { linkAnnotation } = _m77;
|
|
8336
8684
|
|
|
8337
8685
|
const { unicodeHex } = _m60;
|
|
8338
8686
|
|
|
8339
|
-
const { captureSection, captureBookmark } =
|
|
8687
|
+
const { captureSection, captureBookmark } = _m78;
|
|
8340
8688
|
|
|
8341
|
-
const { sectionSettings } =
|
|
8689
|
+
const { sectionSettings } = _m79;
|
|
8342
8690
|
|
|
8343
8691
|
/** @internal One page of drawing commands and O(page count) references, never the complete report body. */
|
|
8344
8692
|
class PdfPages {
|
|
@@ -8476,8 +8824,9 @@ class PdfPages {
|
|
|
8476
8824
|
const lineActualText = !this.structure && line.actualText !== undefined && line.actualText.length > 0;
|
|
8477
8825
|
if (lineActualText)
|
|
8478
8826
|
this.add("/Span << /ActualText <FEFF" + unicodeHex(line.actualText) + "> >> BDC\n");
|
|
8479
|
-
|
|
8827
|
+
let marks;
|
|
8480
8828
|
if (line.actualText !== undefined && this.structure && element !== undefined) {
|
|
8829
|
+
marks = new Map();
|
|
8481
8830
|
// Allocate MCIDs/Link children in logical order, then paint the independently positioned visual order.
|
|
8482
8831
|
for (const segment of [...line.segments].sort((a, b) => (a.logicalStart ?? 0) - (b.logicalStart ?? 0))) {
|
|
8483
8832
|
const owner = segment.link ? this.structure.link(element, segment.link) : element;
|
|
@@ -8485,7 +8834,7 @@ class PdfPages {
|
|
|
8485
8834
|
}
|
|
8486
8835
|
}
|
|
8487
8836
|
for (const segment of line.segments) {
|
|
8488
|
-
const registered = marks
|
|
8837
|
+
const registered = marks?.get(segment), owner = registered?.owner ?? (segment.link && this.structure && element !== undefined ? this.structure.link(element, segment.link) : element);
|
|
8489
8838
|
if (segment.glyphs) {
|
|
8490
8839
|
const font = segment.font, n = pdfNumber, shear = font.syntheticItalic ? .213 : 0;
|
|
8491
8840
|
let cursor = x, command = "q " + this.rgb(segment.color ?? "111827") + " rg " + this.rgb(segment.color ?? "111827") + " RG\nBT /" + font.name + " " + n(size) + " Tf " +
|
|
@@ -8519,7 +8868,7 @@ class PdfPages {
|
|
|
8519
8868
|
decoration(text, x, y, width) {
|
|
8520
8869
|
if (!text)
|
|
8521
8870
|
return;
|
|
8522
|
-
this.settings.budget.cell(text);
|
|
8871
|
+
this.settings.budget.cell(pdfBudgetText(text, this.settings.budget));
|
|
8523
8872
|
const font = this.fonts.select(), lines = wrapText(text, font, this.settings.fontSize, width, this.settings.limits.maxCellCharacters, 1, false);
|
|
8524
8873
|
this.text(lines[0].text, font, this.settings.fontSize, x, y);
|
|
8525
8874
|
}
|
|
@@ -8580,9 +8929,7 @@ class PdfPages {
|
|
|
8580
8929
|
}
|
|
8581
8930
|
const headers = preparedHeadings ?? (tableHeadings && this.layout ? this.activeHeadings ??= await this.layout.headers() : []), headerHeight = headers.reduce((n, h) => n + h.height, 0), continuation = tableHeadings && this.layout ? this.continuationCaption : undefined;
|
|
8582
8931
|
if (continuation?.lines.length) {
|
|
8583
|
-
if (this.continuationCaptionPaints++
|
|
8584
|
-
this.settings.budget.cell(continuation.text.text);
|
|
8585
|
-
else
|
|
8932
|
+
if (this.continuationCaptionPaints++ === 0)
|
|
8586
8933
|
this.tableCaptionOwner = this.captionAnnotations(continuation, this.tableCaptionOwner);
|
|
8587
8934
|
await this.paragraphs([continuation], headerHeight + lineHeight + this.settings.padding * 2, true, { artifact: true, ...(this.tableCaptionOwner === undefined ? {} : { annotationParent: this.tableCaptionOwner }) });
|
|
8588
8935
|
}
|
|
@@ -8603,7 +8950,7 @@ class PdfPages {
|
|
|
8603
8950
|
// Charge physical repeats without recapturing callbacks or making them semantic duplicates.
|
|
8604
8951
|
for (const cell of header.cells)
|
|
8605
8952
|
if (!this.bandCellBudget && this.paintedHeaderBudgetCells.has(cell.source ?? cell))
|
|
8606
|
-
this.settings.budget.cell(cell.lines.map(line => line.text).join(""));
|
|
8953
|
+
this.settings.budget.cell(this.settings.budget.limits.maxTextCharacters === undefined ? "" : cell.lines.map(line => line.text).join(""));
|
|
8607
8954
|
const elements = this.tableStructure ? header.cells.map(cell => this.tableStructure.owner(cell.source ?? cell)) : undefined;
|
|
8608
8955
|
const repeated = header.cells.map(cell => this.paintedHeaderCells.has(cell.source ?? cell));
|
|
8609
8956
|
this.draw(header, 0, header.lines, elements, repeated);
|
|
@@ -8624,7 +8971,8 @@ class PdfPages {
|
|
|
8624
8971
|
const { padding, fontSize } = this.settings, n = pdfNumber, height = lineCount * row.lineHeight + padding * 2;
|
|
8625
8972
|
for (const [index, cell] of row.cells.entries()) {
|
|
8626
8973
|
if (this.bandCellBudget)
|
|
8627
|
-
this.settings.budget.cell(
|
|
8974
|
+
this.settings.budget.cell(this.settings.budget.limits.maxTextCharacters === undefined ? "" :
|
|
8975
|
+
(cell.height === undefined ? cell.lines.slice(firstLine, firstLine + lineCount) : cell.lines).map(line => line.text).join(""));
|
|
8628
8976
|
const x = this.layout.lefts[cell.first], cellHeight = cell.height ?? height;
|
|
8629
8977
|
if (cell.style.background)
|
|
8630
8978
|
this.add(this.artifact("q " + this.rgb(cell.style.background) + " rg " + n(x) + " " + n(this.y - cellHeight) + " " + n(cell.width) + " " + n(cellHeight) + " re f Q\n"));
|
|
@@ -8700,7 +9048,7 @@ class PdfPages {
|
|
|
8700
9048
|
async paragraph(text, style = {}, size = this.settings.fontSize, paginate = true, headingLevel) {
|
|
8701
9049
|
await this.ensureStarted();
|
|
8702
9050
|
const { margins, page, limits } = this.settings, font = this.fonts.select(style.bold, style.italic), lineHeight = font.lineHeight(size);
|
|
8703
|
-
this.settings.budget.cell(text);
|
|
9051
|
+
this.settings.budget.cell(pdfBudgetText(text, this.settings.budget));
|
|
8704
9052
|
const lines = await wrapTextCooperatively(text, font, size, page.width - margins.left - margins.right, limits.maxCellCharacters, limits.maxRowLines, true, this.settings.options.signal);
|
|
8705
9053
|
if (lineHeight > page.height - margins.top - margins.bottom)
|
|
8706
9054
|
throw new RangeError("PDF page cannot fit a paragraph line at the selected font metrics.");
|
|
@@ -8743,6 +9091,8 @@ class PdfPages {
|
|
|
8743
9091
|
if (keepTogether && visible.length)
|
|
8744
9092
|
await this.reserveSpace(visible.reduce((height, paragraph) => height + paragraph.height, 0) + reservations.at(-1), "Kept PDF paragraph group");
|
|
8745
9093
|
for (const [index, paragraph] of visible.entries()) {
|
|
9094
|
+
if (paragraph.budgetOnPaint)
|
|
9095
|
+
this.settings.budget.cell(pdfBudgetText(paragraph.text.text, this.settings.budget));
|
|
8746
9096
|
if (paragraph.keepTogether || paragraph.keepWithNext)
|
|
8747
9097
|
await this.reserveSpace(paragraph.height + reservations[index], "Kept PDF paragraph chain");
|
|
8748
9098
|
const { margins, page } = this.settings;
|
|
@@ -8795,10 +9145,11 @@ class PdfPages {
|
|
|
8795
9145
|
/** The generated summary label is a row heading; no localized text/style inference is used. */
|
|
8796
9146
|
summary(row) { this.summaryRows.add(row); }
|
|
8797
9147
|
/** Begin an independent table on the current page, retaining its headings on continuation pages.
|
|
8798
|
-
* Group context uses captionArtifact: it stays visually complete without duplicating logical headings.
|
|
8799
|
-
|
|
9148
|
+
* Group context uses captionArtifact: it stays visually complete without duplicating logical headings.
|
|
9149
|
+
* An already-painted opening path only suppresses its artifact caption on that existing page. */
|
|
9150
|
+
async beginTable(layout, preparedHeadings, minimumDataHeight = layout.lineHeight + this.settings.padding * 2, caption, continuationCaption, headingsOnNewPageOnly = false, captionArtifact = false, openingContextAlreadyPainted = false) {
|
|
8800
9151
|
if (layout.bands)
|
|
8801
|
-
return this.beginBands(layout, preparedHeadings, minimumDataHeight, caption, continuationCaption, captionArtifact);
|
|
9152
|
+
return this.beginBands(layout, preparedHeadings, minimumDataHeight, caption, continuationCaption, captionArtifact, openingContextAlreadyPainted);
|
|
8802
9153
|
await this.ensureStarted();
|
|
8803
9154
|
this.layout = layout;
|
|
8804
9155
|
this.paintedHeaderCells = new WeakSet();
|
|
@@ -8812,7 +9163,7 @@ class PdfPages {
|
|
|
8812
9163
|
// Its own headings remain available when it moves or splits onto a fresh page.
|
|
8813
9164
|
const initialHeadings = headingsOnNewPageOnly && this.bodyAdded && !this.structure ? [] : headings;
|
|
8814
9165
|
const height = initialHeadings.reduce((n, row) => n + row.height, 0);
|
|
8815
|
-
if (caption) {
|
|
9166
|
+
if (caption && !(captionArtifact && openingContextAlreadyPainted)) {
|
|
8816
9167
|
await this.reserveSpace(caption.height + height + minimumDataHeight, "Kept PDF table caption and first data fragment");
|
|
8817
9168
|
this.tableCaptionOwner = captionArtifact ? this.captionAnnotations(caption)
|
|
8818
9169
|
: caption.lines.length ? this.structure?.element("Caption", this.tableElement) : undefined;
|
|
@@ -8834,7 +9185,7 @@ class PdfPages {
|
|
|
8834
9185
|
this.dataTop = this.y;
|
|
8835
9186
|
}
|
|
8836
9187
|
/** Bind the bounded logical-window owner to the existing physical page painter. */
|
|
8837
|
-
async beginBands(layout, preparedHeadings, minimumDataHeight, caption, continuation, captionArtifact) {
|
|
9188
|
+
async beginBands(layout, preparedHeadings, minimumDataHeight, caption, continuation, captionArtifact, openingContextAlreadyPainted) {
|
|
8838
9189
|
await this.ensureStarted();
|
|
8839
9190
|
const logicalHeadings = preparedHeadings ?? await layout.headers(), headings = await layout.bandRows(logicalHeadings, true);
|
|
8840
9191
|
const headerHeight = headings[0].reduce((sum, row) => sum + row.height, 0), { page, margins, padding } = this.settings;
|
|
@@ -8843,13 +9194,15 @@ class PdfPages {
|
|
|
8843
9194
|
const continuationCapacity = page.height - margins.top - margins.bottom - headerHeight - (continuation?.height ?? 0);
|
|
8844
9195
|
if (continuationCapacity + .001 < layout.lineHeight + padding * 2)
|
|
8845
9196
|
throw new RangeError("PDF band headings and continuation context leave no room for a data line.");
|
|
8846
|
-
|
|
9197
|
+
let openingContextPainted = captionArtifact && openingContextAlreadyPainted;
|
|
9198
|
+
if (this.y - margins.bottom - headerHeight - (openingContextPainted ? 0 : caption?.height ?? 0) + .001 < minimum) {
|
|
8847
9199
|
await this.pageBreak();
|
|
8848
|
-
|
|
8849
|
-
|
|
9200
|
+
openingContextPainted = false;
|
|
9201
|
+
}
|
|
9202
|
+
const firstCapacity = this.y - margins.bottom - headerHeight - (openingContextPainted ? 0 : caption?.height ?? 0);
|
|
8850
9203
|
if (firstCapacity + .001 < minimum)
|
|
8851
9204
|
throw new RangeError("PDF band caption and headings leave no room for a data line.");
|
|
8852
|
-
let
|
|
9205
|
+
let continuationPaints = 0;
|
|
8853
9206
|
this.tableElement = this.structure?.element("Table", this.groupParent);
|
|
8854
9207
|
this.paintedHeaderCells = new WeakSet();
|
|
8855
9208
|
let captionElement = this.structure && caption?.lines.length ? captionArtifact ? this.captionAnnotations(caption)
|
|
@@ -8863,21 +9216,16 @@ class PdfPages {
|
|
|
8863
9216
|
this.bandFlow = new PdfTableBandFlow(layout, headings, { firstCapacity, firstFullCapacity, continuationCapacity,
|
|
8864
9217
|
prepareRow: async (row) => { await this.tableStructure?.prepareHeaders(); await this.rowElements(row); },
|
|
8865
9218
|
completeRow: async (row) => { await this.tableStructure?.completeRow(row.source ?? row); },
|
|
8866
|
-
moveFirstToFreshPage: async () => { await this.pageBreak();
|
|
9219
|
+
moveFirstToFreshPage: async () => { await this.pageBreak(); openingContextPainted = false; },
|
|
8867
9220
|
paint: async (band, headers, rows, currentCaption, firstWindow, firstBand) => {
|
|
8868
9221
|
if (!(firstWindow && firstBand))
|
|
8869
9222
|
await this.pageBreak();
|
|
8870
|
-
if (firstWindow && !firstBand)
|
|
8871
|
-
this.y -= initialOffset;
|
|
8872
9223
|
const frame = layout.bands[band];
|
|
8873
9224
|
this.layout = { lefts: frame.lefts, lineHeight: layout.lineHeight, headers: async () => headers };
|
|
8874
9225
|
this.bandCellBudget = true;
|
|
8875
9226
|
try {
|
|
8876
|
-
if (currentCaption?.lines.length) {
|
|
8877
|
-
|
|
8878
|
-
if (paints > 0)
|
|
8879
|
-
this.settings.budget.cell(currentCaption.text.text);
|
|
8880
|
-
if (!firstWindow && paints === 0)
|
|
9227
|
+
if (currentCaption?.lines.length && !(firstWindow && firstBand && openingContextPainted)) {
|
|
9228
|
+
if (!firstWindow && continuationPaints++ === 0)
|
|
8881
9229
|
captionElement = this.captionAnnotations(currentCaption, captionElement);
|
|
8882
9230
|
const annotationParent = captionElement;
|
|
8883
9231
|
await this.paragraphs([currentCaption], headerHeight + minimum, true, firstWindow && firstBand && !captionArtifact ? { role: "Caption", keepOpen: true, ...(captionElement === undefined ? {} : { owner: captionElement }) }
|
|
@@ -8981,7 +9329,7 @@ class PdfPages {
|
|
|
8981
9329
|
this.annotations = [];
|
|
8982
9330
|
this.commandBytes = 0;
|
|
8983
9331
|
this.current = 0;
|
|
8984
|
-
await this.objects.
|
|
9332
|
+
await this.objects.flushBytes();
|
|
8985
9333
|
}
|
|
8986
9334
|
async finish() {
|
|
8987
9335
|
if (this.bandFlow) {
|
|
@@ -9009,11 +9357,11 @@ class PdfPages {
|
|
|
9009
9357
|
}
|
|
9010
9358
|
}
|
|
9011
9359
|
const _exports = Object.freeze({ PdfPages: PdfPages });
|
|
9012
|
-
_modules.set("
|
|
9360
|
+
_modules.set("a7fca40cb8c75af206111c90db36839b4648982beeb4179efda0ddd1ee366210", _exports);
|
|
9013
9361
|
return _exports;
|
|
9014
9362
|
})();
|
|
9015
9363
|
|
|
9016
|
-
const
|
|
9364
|
+
const _m81 = _modules.get("7a58e8ccb5164de51db14e39ca9695af6487c354df909509f0ae6bfac8ae3887") ?? (() => {
|
|
9017
9365
|
/** @internal Incremental PDF number tree: at most 64 entries/children per retained level. */
|
|
9018
9366
|
class PdfParentTree {
|
|
9019
9367
|
objects;
|
|
@@ -9076,15 +9424,38 @@ _modules.set("7a58e8ccb5164de51db14e39ca9695af6487c354df909509f0ae6bfac8ae3887",
|
|
|
9076
9424
|
return _exports;
|
|
9077
9425
|
})();
|
|
9078
9426
|
|
|
9079
|
-
const
|
|
9427
|
+
const _m80 = _modules.get("1c1828a3d6dfc2edda674566203e7aa8e97c984114b7928df13cb373859977d0") ?? (() => {
|
|
9080
9428
|
const { OfficeIMOError } = _m2;
|
|
9081
9429
|
|
|
9082
9430
|
const { checkAbort } = _m4;
|
|
9083
9431
|
|
|
9084
9432
|
const { unicodeHex } = _m60;
|
|
9085
9433
|
|
|
9086
|
-
const { PdfParentTree } =
|
|
9434
|
+
const { PdfParentTree } = _m81;
|
|
9087
9435
|
|
|
9436
|
+
/** Same-page marked content uses integer K; cross-page MCR and annotation OBJR stay explicit. */
|
|
9437
|
+
function structureChild(child) {
|
|
9438
|
+
return typeof child === "number" ? (child < 0 ? -child - 1 + " " : child + " 0 R ") : child + " ";
|
|
9439
|
+
}
|
|
9440
|
+
function structurePrefix(element) {
|
|
9441
|
+
return "<< /Type /StructElem /S /" + element.role + " /P " + element.parent + " 0 R" +
|
|
9442
|
+
(element.markedPage === undefined ? "" : " /Pg " + element.markedPage + " 0 R") +
|
|
9443
|
+
(element.identifier === undefined ? "" : " /ID (" + element.identifier + ")") + " /K [";
|
|
9444
|
+
}
|
|
9445
|
+
/** Keep the same bounded small-object representation for both completion paths. */
|
|
9446
|
+
function compactStructureBody(element, prefix) {
|
|
9447
|
+
const remaining = 32768 - prefix.length - element.attributes.length - 4;
|
|
9448
|
+
if (remaining < 0)
|
|
9449
|
+
return undefined;
|
|
9450
|
+
let children = "";
|
|
9451
|
+
for (const child of element.children) {
|
|
9452
|
+
const token = structureChild(child);
|
|
9453
|
+
if (children.length + token.length > remaining)
|
|
9454
|
+
return undefined;
|
|
9455
|
+
children += token;
|
|
9456
|
+
}
|
|
9457
|
+
return prefix + children + "]" + element.attributes + " >>";
|
|
9458
|
+
}
|
|
9088
9459
|
/** A sorted name tree retains only a small open leaf and branch at each level. */
|
|
9089
9460
|
class PdfStructureIds {
|
|
9090
9461
|
objects;
|
|
@@ -9174,7 +9545,7 @@ class PdfStructure {
|
|
|
9174
9545
|
checkAbort(this.settings.options.signal);
|
|
9175
9546
|
if (++this.allocated > this.settings.limits.maxStructureElements)
|
|
9176
9547
|
throw new OfficeIMOError("RESOURCE_LIMIT", "maxStructureElements exceeded.");
|
|
9177
|
-
const id = this.objects.reserve(), element = { id, parent, role, children: [], attributes
|
|
9548
|
+
const id = this.objects.reserve(), element = { id, parent, role, children: [], attributes };
|
|
9178
9549
|
this.elements.set(id, element);
|
|
9179
9550
|
const owner = this.elements.get(parent);
|
|
9180
9551
|
// A continuation-only linked caption is discovered during painting, after rows may exist.
|
|
@@ -9185,6 +9556,20 @@ class PdfStructure {
|
|
|
9185
9556
|
owner?.children.push(id);
|
|
9186
9557
|
return id;
|
|
9187
9558
|
}
|
|
9559
|
+
/** Attach resolved table associations while a source-ordered logical element is still open. */
|
|
9560
|
+
setAttributes(elementId, attributes) {
|
|
9561
|
+
const element = this.elements.get(elementId);
|
|
9562
|
+
if (!element)
|
|
9563
|
+
throw new Error("PDF structure attributes require an open logical owner.");
|
|
9564
|
+
element.attributes = attributes;
|
|
9565
|
+
}
|
|
9566
|
+
/** Write one immutable attribute dictionary. Its caller owns the bounded scope of reference reuse. */
|
|
9567
|
+
async attributeReference(dictionary) {
|
|
9568
|
+
checkAbort(this.settings.options.signal);
|
|
9569
|
+
const id = this.objects.reserve();
|
|
9570
|
+
await this.objects.object(id, dictionary);
|
|
9571
|
+
return " /A " + id + " 0 R";
|
|
9572
|
+
}
|
|
9188
9573
|
/** Flat visual sections share the same logical Document and cumulative resource policy. */
|
|
9189
9574
|
async beginSection() {
|
|
9190
9575
|
await this.complete(this.section);
|
|
@@ -9218,7 +9603,8 @@ class PdfStructure {
|
|
|
9218
9603
|
return existing;
|
|
9219
9604
|
const id = this.element("Link", parent, alternativeText === undefined ? "" : " /Alt <feff" + unicodeHex(alternativeText) + ">");
|
|
9220
9605
|
parents.set(parent, id);
|
|
9221
|
-
this.elements.get(parent)
|
|
9606
|
+
const owner = this.elements.get(parent);
|
|
9607
|
+
(owner.linkIdentities ??= []).push(identity);
|
|
9222
9608
|
return id;
|
|
9223
9609
|
}
|
|
9224
9610
|
/** Associate a native annotation in both directions: OBJR child and annotation ParentTree entry. */
|
|
@@ -9241,7 +9627,9 @@ class PdfStructure {
|
|
|
9241
9627
|
throw new Error("Marked content requires an open logical owner.");
|
|
9242
9628
|
const mcid = this.pageParents.length;
|
|
9243
9629
|
this.pageParents.push(elementId);
|
|
9244
|
-
element.
|
|
9630
|
+
element.markedPage ??= this.pageId;
|
|
9631
|
+
element.children.push(element.markedPage === this.pageId ? -(mcid + 1) :
|
|
9632
|
+
"<< /Type /MCR /Pg " + this.pageId + " 0 R /MCID " + mcid + " >>");
|
|
9245
9633
|
return "/" + element.role + " << /MCID " + mcid + (actualText === undefined ? "" : " /ActualText <FEFF" + unicodeHex(actualText) + ">") + " >> BDC\n";
|
|
9246
9634
|
}
|
|
9247
9635
|
get pageDictionary() { return " /StructParents " + this.pageKey + " /Tabs /S"; }
|
|
@@ -9265,37 +9653,49 @@ class PdfStructure {
|
|
|
9265
9653
|
if (!element)
|
|
9266
9654
|
return;
|
|
9267
9655
|
for (const child of element.children)
|
|
9268
|
-
if (typeof child === "number" && this.
|
|
9656
|
+
if (typeof child === "number" && child > 0 && !this.completeBuffered(child))
|
|
9269
9657
|
await this.complete(child);
|
|
9270
9658
|
checkAbort(this.settings.options.signal);
|
|
9271
|
-
const prefix =
|
|
9272
|
-
(element.identifier === undefined ? "" : " /ID (" + element.identifier + ")") + " /K [";
|
|
9273
|
-
const remaining = 32768 - prefix.length - element.attributes.length - 4;
|
|
9274
|
-
let children = "", small = remaining >= 0;
|
|
9275
|
-
if (small)
|
|
9276
|
-
for (const child of element.children) {
|
|
9277
|
-
const token = typeof child === "number" ? child + " 0 R " : child + " ";
|
|
9278
|
-
if (children.length + token.length > remaining) {
|
|
9279
|
-
small = false;
|
|
9280
|
-
break;
|
|
9281
|
-
}
|
|
9282
|
-
children += token;
|
|
9283
|
-
}
|
|
9659
|
+
const prefix = structurePrefix(element), body = compactStructureBody(element, prefix);
|
|
9284
9660
|
// Most table cells/rows fit in one encoding. Large parents and alternatives remain streamed.
|
|
9285
|
-
|
|
9286
|
-
|
|
9287
|
-
|
|
9288
|
-
|
|
9289
|
-
|
|
9290
|
-
|
|
9291
|
-
|
|
9292
|
-
|
|
9293
|
-
|
|
9294
|
-
|
|
9295
|
-
|
|
9296
|
-
|
|
9661
|
+
if (body !== undefined) {
|
|
9662
|
+
if (!this.objects.tryCompactObject(id, body))
|
|
9663
|
+
await this.objects.compactObject(id, body);
|
|
9664
|
+
}
|
|
9665
|
+
else
|
|
9666
|
+
await this.objects.object(id, this.body(element, prefix));
|
|
9667
|
+
this.releaseElement(element);
|
|
9668
|
+
}
|
|
9669
|
+
/** Close already-bufferable children without creating an async chain per leaf. A false result
|
|
9670
|
+
* leaves the current owner open for the existing awaited flush or ordinary-object path. */
|
|
9671
|
+
completeBuffered(id) {
|
|
9672
|
+
const element = this.elements.get(id);
|
|
9673
|
+
if (!element)
|
|
9674
|
+
return true;
|
|
9675
|
+
for (const child of element.children)
|
|
9676
|
+
if (typeof child === "number" && child > 0 && !this.completeBuffered(child))
|
|
9677
|
+
return false;
|
|
9678
|
+
checkAbort(this.settings.options.signal);
|
|
9679
|
+
const body = compactStructureBody(element, structurePrefix(element));
|
|
9680
|
+
if (body === undefined || !this.objects.tryCompactObject(id, body))
|
|
9681
|
+
return false;
|
|
9682
|
+
this.releaseElement(element);
|
|
9683
|
+
return true;
|
|
9684
|
+
}
|
|
9685
|
+
releaseElement(element) {
|
|
9686
|
+
if (element.linkIdentities)
|
|
9687
|
+
for (const identity of element.linkIdentities) {
|
|
9688
|
+
const parents = this.links.get(identity);
|
|
9689
|
+
parents?.delete(element.id);
|
|
9690
|
+
if (!parents?.size)
|
|
9691
|
+
this.links.delete(identity);
|
|
9692
|
+
}
|
|
9693
|
+
this.elements.delete(element.id);
|
|
9694
|
+
}
|
|
9695
|
+
*body(element, prefix) {
|
|
9696
|
+
yield prefix;
|
|
9297
9697
|
for (const child of element.children)
|
|
9298
|
-
yield
|
|
9698
|
+
yield structureChild(child);
|
|
9299
9699
|
yield "]" + element.attributes + " >>";
|
|
9300
9700
|
}
|
|
9301
9701
|
async completeRow(cells) {
|
|
@@ -9332,11 +9732,11 @@ function graphicAlternative(value, settings) {
|
|
|
9332
9732
|
return alternativeText;
|
|
9333
9733
|
}
|
|
9334
9734
|
const _exports = Object.freeze({ PdfStructure: PdfStructure, graphicAlternative: graphicAlternative });
|
|
9335
|
-
_modules.set("
|
|
9735
|
+
_modules.set("1c1828a3d6dfc2edda674566203e7aa8e97c984114b7928df13cb373859977d0", _exports);
|
|
9336
9736
|
return _exports;
|
|
9337
9737
|
})();
|
|
9338
9738
|
|
|
9339
|
-
const
|
|
9739
|
+
const _m82 = _modules.get("52c78ca6833cee7e5a96b657e2c00172d550176daf2c95e742692f8416977bea") ?? (() => {
|
|
9340
9740
|
const { OfficeIMOError } = _m2;
|
|
9341
9741
|
|
|
9342
9742
|
const { checkAbort } = _m4;
|
|
@@ -9396,22 +9796,22 @@ class PdfOutlines {
|
|
|
9396
9796
|
}
|
|
9397
9797
|
}
|
|
9398
9798
|
const _exports = Object.freeze({ PdfOutlines: PdfOutlines });
|
|
9399
|
-
_modules.set("
|
|
9799
|
+
_modules.set("52c78ca6833cee7e5a96b657e2c00172d550176daf2c95e742692f8416977bea", _exports);
|
|
9400
9800
|
return _exports;
|
|
9401
9801
|
})();
|
|
9402
9802
|
|
|
9403
|
-
const _m59 = _modules.get("
|
|
9803
|
+
const _m59 = _modules.get("eb2c981b4568b33deca2137956ace31ea621b6a6287755ec234336d0a7c23cfc") ?? (() => {
|
|
9404
9804
|
const { PdfObjects, unicodeHex } = _m60;
|
|
9405
9805
|
|
|
9406
|
-
const { PdfFontResources } =
|
|
9806
|
+
const { PdfFontResources } = _m62;
|
|
9407
9807
|
|
|
9408
|
-
const { PdfTableLayout } =
|
|
9808
|
+
const { PdfTableLayout } = _m69;
|
|
9409
9809
|
|
|
9410
|
-
const { PdfPages } =
|
|
9810
|
+
const { PdfPages } = _m74;
|
|
9411
9811
|
|
|
9412
|
-
const { PdfStructure } =
|
|
9812
|
+
const { PdfStructure } = _m80;
|
|
9413
9813
|
|
|
9414
|
-
const { PdfOutlines } =
|
|
9814
|
+
const { PdfOutlines } = _m82;
|
|
9415
9815
|
|
|
9416
9816
|
/** One resource/catalog owner shared by table convenience exports and composed documents. */
|
|
9417
9817
|
class PdfWriteSession {
|
|
@@ -9428,7 +9828,7 @@ class PdfWriteSession {
|
|
|
9428
9828
|
info;
|
|
9429
9829
|
constructor(sink, settings, table = false) {
|
|
9430
9830
|
this.settings = settings;
|
|
9431
|
-
this.objects = new PdfObjects(sink, settings.options.signal, settings.budget.limits.maxOutputBytes);
|
|
9831
|
+
this.objects = new PdfObjects(sink, settings.options.signal, settings.budget.limits.maxOutputBytes, settings.options.compression !== false);
|
|
9432
9832
|
this.root = this.objects.reserve();
|
|
9433
9833
|
this.parent = this.objects.reserve();
|
|
9434
9834
|
this.resources = this.objects.reserve();
|
|
@@ -9463,11 +9863,11 @@ class PdfWriteSession {
|
|
|
9463
9863
|
}
|
|
9464
9864
|
}
|
|
9465
9865
|
const _exports = Object.freeze({ PdfWriteSession: PdfWriteSession });
|
|
9466
|
-
_modules.set("
|
|
9866
|
+
_modules.set("eb2c981b4568b33deca2137956ace31ea621b6a6287755ec234336d0a7c23cfc", _exports);
|
|
9467
9867
|
return _exports;
|
|
9468
9868
|
})();
|
|
9469
9869
|
|
|
9470
|
-
const _m58 = _modules.get("
|
|
9870
|
+
const _m58 = _modules.get("98eb735e985f873ed0ffc628449a20d1f3bb729a87b6d6b3099b6f308438fcb5") ?? (() => {
|
|
9471
9871
|
const { BlobByteSink, withDestination } = _m3;
|
|
9472
9872
|
|
|
9473
9873
|
const { beginTask, checkAbort, consumeRows, pause, taskYieldDue } = _m4;
|
|
@@ -9532,11 +9932,11 @@ async function writePdfTo(rows, destination, configuration) {
|
|
|
9532
9932
|
});
|
|
9533
9933
|
}
|
|
9534
9934
|
const _exports = Object.freeze({ writePdf: writePdf, writePdfTo: writePdfTo });
|
|
9535
|
-
_modules.set("
|
|
9935
|
+
_modules.set("98eb735e985f873ed0ffc628449a20d1f3bb729a87b6d6b3099b6f308438fcb5", _exports);
|
|
9536
9936
|
return _exports;
|
|
9537
9937
|
})();
|
|
9538
9938
|
|
|
9539
|
-
const
|
|
9939
|
+
const _m86 = _modules.get("749d1ec5422c0087787f525ef42e3b8d3a94d2b70eb5e42d2e3723a870777ad6") ?? (() => {
|
|
9540
9940
|
const { NotSupportedError, OfficeIMOError } = _m2;
|
|
9541
9941
|
|
|
9542
9942
|
const { checkAbort, pause, taskYieldDue, withAbort } = _m4;
|
|
@@ -9800,16 +10200,16 @@ function paeth(left, up, upperLeft) {
|
|
|
9800
10200
|
return a <= b && a <= c ? left : b <= c ? up : upperLeft;
|
|
9801
10201
|
}
|
|
9802
10202
|
const _exports = Object.freeze({ pngPixels: pngPixels });
|
|
9803
|
-
_modules.set("
|
|
10203
|
+
_modules.set("749d1ec5422c0087787f525ef42e3b8d3a94d2b70eb5e42d2e3723a870777ad6", _exports);
|
|
9804
10204
|
return _exports;
|
|
9805
10205
|
})();
|
|
9806
10206
|
|
|
9807
|
-
const
|
|
10207
|
+
const _m85 = _modules.get("7dca2d9ca5c43893abdaf86df5b1bcb1f3de3d5d33532d082fdfe04711999d21") ?? (() => {
|
|
9808
10208
|
const { NotSupportedError, OfficeIMOError } = _m2;
|
|
9809
10209
|
|
|
9810
10210
|
const { checkAbort, pause, taskYieldDue } = _m4;
|
|
9811
10211
|
|
|
9812
|
-
const { pngPixels } =
|
|
10212
|
+
const { pngPixels } = _m86;
|
|
9813
10213
|
|
|
9814
10214
|
/** Shared document image resources; source objects are captured on first consumption. */
|
|
9815
10215
|
class PdfDocumentImages {
|
|
@@ -9934,11 +10334,11 @@ function jpegSize(bytes) {
|
|
|
9934
10334
|
throw new TypeError("JPEG image has no complete frame and scan.");
|
|
9935
10335
|
}
|
|
9936
10336
|
const _exports = Object.freeze({ PdfDocumentImages: PdfDocumentImages });
|
|
9937
|
-
_modules.set("
|
|
10337
|
+
_modules.set("7dca2d9ca5c43893abdaf86df5b1bcb1f3de3d5d33532d082fdfe04711999d21", _exports);
|
|
9938
10338
|
return _exports;
|
|
9939
10339
|
})();
|
|
9940
10340
|
|
|
9941
|
-
const
|
|
10341
|
+
const _m87 = _modules.get("3290c84fdf80725af802f497d947bc088aa8d93d9db0a33f6f829f9153aa6fd6") ?? (() => {
|
|
9942
10342
|
const { OfficeIMOError } = _m2;
|
|
9943
10343
|
|
|
9944
10344
|
const { checkAbort, pause, taskYieldDue } = _m4;
|
|
@@ -10021,11 +10421,11 @@ async function vectorCommands(block, settings, used) {
|
|
|
10021
10421
|
commands.join("") + (fill !== undefined && stroke !== undefined ? "B" : fill !== undefined ? "f" : "S") + (fill !== undefined && fillRule === "evenodd" ? "*" : "") + "\n" };
|
|
10022
10422
|
}
|
|
10023
10423
|
const _exports = Object.freeze({ vectorCommands: vectorCommands });
|
|
10024
|
-
_modules.set("
|
|
10424
|
+
_modules.set("3290c84fdf80725af802f497d947bc088aa8d93d9db0a33f6f829f9153aa6fd6", _exports);
|
|
10025
10425
|
return _exports;
|
|
10026
10426
|
})();
|
|
10027
10427
|
|
|
10028
|
-
const
|
|
10428
|
+
const _m88 = _modules.get("da9ad00f94b9ae28e2e3de796928ff0c4eab1d73382b1441e7d779fad4278ef7") ?? (() => {
|
|
10029
10429
|
const { NotSupportedError, OfficeIMOError } = _m2;
|
|
10030
10430
|
|
|
10031
10431
|
const { checkAbort, pause, taskYieldDue } = _m4;
|
|
@@ -10268,25 +10668,27 @@ async function prepareDrawing(drawing, settings, fonts, used) {
|
|
|
10268
10668
|
return { width: captured.width, height: captured.height, content: fragments.join(""), commands: captured.commands, elements: captured.elements };
|
|
10269
10669
|
}
|
|
10270
10670
|
const _exports = Object.freeze({ checkDrawingBlock: checkDrawingBlock, prepareDrawing: prepareDrawing });
|
|
10271
|
-
_modules.set("
|
|
10671
|
+
_modules.set("da9ad00f94b9ae28e2e3de796928ff0c4eab1d73382b1441e7d779fad4278ef7", _exports);
|
|
10272
10672
|
return _exports;
|
|
10273
10673
|
})();
|
|
10274
10674
|
|
|
10275
|
-
const
|
|
10675
|
+
const _m89 = _modules.get("5e4503b77b357ee6d9fad1f52690085b0f0b140cd3b550b63c5100ed95a92f88") ?? (() => {
|
|
10276
10676
|
const { OfficeIMOError } = _m2;
|
|
10277
10677
|
|
|
10278
|
-
const { capturePdfText, wrapPdfText } =
|
|
10678
|
+
const { capturePdfText, wrapPdfText } = _m71;
|
|
10279
10679
|
|
|
10280
10680
|
const { positive } = _m17;
|
|
10281
10681
|
|
|
10282
10682
|
const { resolveParagraphStyle } = _m19;
|
|
10283
10683
|
|
|
10284
|
-
const { captureBookmark } =
|
|
10684
|
+
const { captureBookmark } = _m78;
|
|
10285
10685
|
|
|
10286
10686
|
const { captureFields } = _m10;
|
|
10287
10687
|
|
|
10688
|
+
const { pdfBudgetText } = _m70;
|
|
10689
|
+
|
|
10288
10690
|
/** @internal Copy public paragraph input before any cooperative layout or source enumeration. */
|
|
10289
|
-
function captureParagraph(block, settings, fonts) {
|
|
10691
|
+
function captureParagraph(block, settings, fonts, budgetOnPaint = false) {
|
|
10290
10692
|
if (!block || block.kind !== "paragraph")
|
|
10291
10693
|
throw new TypeError("PDF paragraph groups accept paragraph blocks only.");
|
|
10292
10694
|
const { text, headingLevel, presentation: inputStyle, fontSize, keepTogether, keepWithNext, spaceBefore, spaceAfter, style: styleName, bookmark: inputBookmark } = block;
|
|
@@ -10299,7 +10701,8 @@ function captureParagraph(block, settings, fonts) {
|
|
|
10299
10701
|
}, settings.paragraphStyles);
|
|
10300
10702
|
const style = resolved.presentation ?? Object.freeze({}), size = positive(resolved.fontSize ?? settings.fontSize, "Paragraph font size", 144);
|
|
10301
10703
|
const bookmark = captureBookmark(inputBookmark, settings);
|
|
10302
|
-
return Object.freeze({ text: capturePdfText(text, style, settings, fonts, false), style, size,
|
|
10704
|
+
return Object.freeze({ text: capturePdfText(text, style, settings, fonts, false, !budgetOnPaint), style, size,
|
|
10705
|
+
...(budgetOnPaint ? { budgetOnPaint: true } : {}),
|
|
10303
10706
|
...(headingLevel === undefined ? {} : { headingLevel }), ...(bookmark === undefined ? {} : { bookmark }),
|
|
10304
10707
|
keepTogether: resolved.keepTogether ?? false, keepWithNext: resolved.keepWithNext ?? false,
|
|
10305
10708
|
spaceBefore: resolved.spaceBefore ?? 0, spaceAfter: resolved.spaceAfter ?? 8 });
|
|
@@ -10310,13 +10713,16 @@ function captureCaption(caption, settings, fonts) {
|
|
|
10310
10713
|
Object.keys(caption).some(key => !["text", "style", "fontSize", "presentation", "spaceBefore", "spaceAfter"].includes(key)))
|
|
10311
10714
|
throw new TypeError("PDF captions support text, style, fontSize, presentation, spaceBefore and spaceAfter.");
|
|
10312
10715
|
return captureParagraph({ ...captureFields(caption, ["text", "style", "fontSize", "presentation", "spaceBefore", "spaceAfter"]),
|
|
10313
|
-
kind: "paragraph", keepTogether: true, keepWithNext: true }, settings, fonts);
|
|
10716
|
+
kind: "paragraph", keepTogether: true, keepWithNext: true }, settings, fonts, true);
|
|
10314
10717
|
}
|
|
10315
10718
|
/** @internal Layout is bounded by the same per-cell text and wrapped-line limits as table cells. */
|
|
10316
10719
|
async function prepareParagraph(captured, settings, fonts, width = settings.page.width - settings.margins.left - settings.margins.right) {
|
|
10317
10720
|
if (!captured.text.text)
|
|
10318
10721
|
return { ...captured, lines: [], height: 0, firstHeight: 0 };
|
|
10319
|
-
|
|
10722
|
+
if (!captured.budgetOnPaint) {
|
|
10723
|
+
const budgetText = pdfBudgetText(captured.text.text, settings.budget);
|
|
10724
|
+
settings.budget.cell(budgetText, budgetText.length);
|
|
10725
|
+
}
|
|
10320
10726
|
const lines = await wrapPdfText(captured.text, fonts, captured.size, positive(width, "Paragraph width"), settings);
|
|
10321
10727
|
return { ...captured, lines, height: captured.spaceBefore + lines.reduce((height, line) => height + line.lineHeight, 0) + captured.spaceAfter,
|
|
10322
10728
|
firstHeight: captured.spaceBefore + lines[0].lineHeight };
|
|
@@ -10346,14 +10752,14 @@ function paragraphStartHeight(paragraphs) {
|
|
|
10346
10752
|
return required;
|
|
10347
10753
|
}
|
|
10348
10754
|
const _exports = Object.freeze({ captureParagraph: captureParagraph, captureCaption: captureCaption, prepareParagraph: prepareParagraph, checkParagraphBuffer: checkParagraphBuffer, paragraphStartHeight: paragraphStartHeight });
|
|
10349
|
-
_modules.set("
|
|
10755
|
+
_modules.set("5e4503b77b357ee6d9fad1f52690085b0f0b140cd3b550b63c5100ed95a92f88", _exports);
|
|
10350
10756
|
return _exports;
|
|
10351
10757
|
})();
|
|
10352
10758
|
|
|
10353
|
-
const
|
|
10354
|
-
const { capturePdfText, wrapPdfText } =
|
|
10759
|
+
const _m90 = _modules.get("1d57c429705ae0cbc14d98dcfef4c8a6c2df06f391c8f58e99cacb02f2d1cbc7") ?? (() => {
|
|
10760
|
+
const { capturePdfText, wrapPdfText } = _m71;
|
|
10355
10761
|
|
|
10356
|
-
const { captureParagraph, prepareParagraph } =
|
|
10762
|
+
const { captureParagraph, prepareParagraph } = _m89;
|
|
10357
10763
|
|
|
10358
10764
|
const { resolveParagraphStyle } = _m19;
|
|
10359
10765
|
|
|
@@ -10404,11 +10810,11 @@ async function prepareListItem(item, index, options, settings, fonts) {
|
|
|
10404
10810
|
height: paragraph.height + lineHeight - first.lineHeight, firstHeight: paragraph.spaceBefore + lineHeight } };
|
|
10405
10811
|
}
|
|
10406
10812
|
const _exports = Object.freeze({ captureListOptions: captureListOptions, prepareListItem: prepareListItem });
|
|
10407
|
-
_modules.set("
|
|
10813
|
+
_modules.set("1d57c429705ae0cbc14d98dcfef4c8a6c2df06f391c8f58e99cacb02f2d1cbc7", _exports);
|
|
10408
10814
|
return _exports;
|
|
10409
10815
|
})();
|
|
10410
10816
|
|
|
10411
|
-
const
|
|
10817
|
+
const _m92 = _modules.get("d04686d2c067355dfd215333b83eb5f79f96e9e4be49f942e050f21ac0795343") ?? (() => {
|
|
10412
10818
|
const { assertGroupedReportSource } = _m8;
|
|
10413
10819
|
|
|
10414
10820
|
const { captureFields } = _m10;
|
|
@@ -10454,26 +10860,26 @@ function captureGroupedPdfTableOptions(configuration) {
|
|
|
10454
10860
|
...(captured.footerPresentation === undefined ? {} : { footerPresentation: presentation(captured.footerPresentation) }) });
|
|
10455
10861
|
}
|
|
10456
10862
|
const _exports = Object.freeze({ groupedPdfLabelFields: groupedPdfLabelFields, groupedPdfTableFields: groupedPdfTableFields, pdfGroupedTable: pdfGroupedTable, captureGroupedPdfTableOptions: captureGroupedPdfTableOptions });
|
|
10457
|
-
_modules.set("
|
|
10863
|
+
_modules.set("d04686d2c067355dfd215333b83eb5f79f96e9e4be49f942e050f21ac0795343", _exports);
|
|
10458
10864
|
return _exports;
|
|
10459
10865
|
})();
|
|
10460
10866
|
|
|
10461
|
-
const
|
|
10867
|
+
const _m91 = _modules.get("d43e573fd5bad18a7ec2d71752168c422c4f8fabbc51f1cef8e3ba389f298715") ?? (() => {
|
|
10462
10868
|
const { assertGroupedReportSource, groupedReportOperation } = _m8;
|
|
10463
10869
|
|
|
10464
10870
|
const { consumeRows } = _m4;
|
|
10465
10871
|
|
|
10466
10872
|
const { ExportCell } = _m5;
|
|
10467
10873
|
|
|
10468
|
-
const { captureGroupedPdfTableOptions } =
|
|
10874
|
+
const { captureGroupedPdfTableOptions } = _m92;
|
|
10469
10875
|
|
|
10470
10876
|
const { settings } = _m17;
|
|
10471
10877
|
|
|
10472
|
-
const { PdfTableLayout } =
|
|
10878
|
+
const { PdfTableLayout } = _m69;
|
|
10473
10879
|
|
|
10474
|
-
const { captureCaption, captureParagraph, prepareParagraph } =
|
|
10880
|
+
const { captureCaption, captureParagraph, prepareParagraph } = _m89;
|
|
10475
10881
|
|
|
10476
|
-
const { synchronousText } =
|
|
10882
|
+
const { synchronousText } = _m70;
|
|
10477
10883
|
|
|
10478
10884
|
/** @internal Render one analytical source in the existing document session. Retain one detail row and
|
|
10479
10885
|
* at most four closing subtotals. All captions, rows, pages, bytes and fonts use the document owners. */
|
|
@@ -10502,10 +10908,44 @@ async function renderGroupedPdfTable(block, context) {
|
|
|
10502
10908
|
const continuationLabels = new WeakMap();
|
|
10503
10909
|
let pending;
|
|
10504
10910
|
const closing = [];
|
|
10505
|
-
const
|
|
10911
|
+
const aggregatePositions = report.columns.flatMap((column, index) => Object.hasOwn(report.totals, column.key) ? [index] : []);
|
|
10912
|
+
const summaryValues = (label, values, positions) => Object.freeze([
|
|
10506
10913
|
new ExportCell(label, { text: label, presentation: table.options.footerPresentation }),
|
|
10507
|
-
...values.map(value => new ExportCell(value, { presentation: table.options.footerPresentation }))
|
|
10914
|
+
...(positions ? positions.map(index => values[index]) : values).map(value => new ExportCell(value, { presentation: table.options.footerPresentation }))
|
|
10508
10915
|
]);
|
|
10916
|
+
// Independent summaries have no detail values in non-aggregate columns. Project their
|
|
10917
|
+
// declared operations, including zero/null results, rather than emitting label-only bands.
|
|
10918
|
+
// Keep callback positions in the original source model after this physical projection.
|
|
10919
|
+
const summaryLayouts = new Map();
|
|
10920
|
+
const summaryLayout = (grand) => {
|
|
10921
|
+
const existing = summaryLayouts.get(grand);
|
|
10922
|
+
if (existing)
|
|
10923
|
+
return existing;
|
|
10924
|
+
const positions = [0, ...aggregatePositions.map(index => index + 1)];
|
|
10925
|
+
const projected = positions.map(position => {
|
|
10926
|
+
const column = columns[position];
|
|
10927
|
+
if (!grand)
|
|
10928
|
+
return column;
|
|
10929
|
+
const { groups: _groups, ...leaf } = column;
|
|
10930
|
+
return leaf;
|
|
10931
|
+
});
|
|
10932
|
+
const originalPosition = (position) => {
|
|
10933
|
+
const columnIndex = positions[position.columnIndex];
|
|
10934
|
+
return { ...position, columnIndex, column: columns[columnIndex] };
|
|
10935
|
+
};
|
|
10936
|
+
const repeatColumns = positions.flatMap((position, index) => position === 0 || table.repeatedColumns.includes(position) ? [index] : []);
|
|
10937
|
+
const wideTable = table.options.wideTable;
|
|
10938
|
+
const projectedSettings = { ...sharedTable,
|
|
10939
|
+
repeatedColumns: Object.freeze(repeatColumns), options: { ...table.options, columns: projected,
|
|
10940
|
+
...(table.options.columnWidths === undefined ? {} : { columnWidths: positions.map(position => table.options.columnWidths[position]) }),
|
|
10941
|
+
...(typeof wideTable !== "object" ? {} : { wideTable: { ...wideTable, repeatColumns } }),
|
|
10942
|
+
...(table.options.formatValue === undefined ? {} : { formatValue: (value, position) => table.options.formatValue(value, originalPosition(position)) }),
|
|
10943
|
+
...(table.options.formatRuns === undefined ? {} : { formatRuns: (value, position) => table.options.formatRuns(value, originalPosition(position)) })
|
|
10944
|
+
} };
|
|
10945
|
+
const projectedLayout = new PdfTableLayout(projectedSettings, fonts);
|
|
10946
|
+
summaryLayouts.set(grand, projectedLayout);
|
|
10947
|
+
return projectedLayout;
|
|
10948
|
+
};
|
|
10509
10949
|
const prepareGroupContext = async () => {
|
|
10510
10950
|
const caption = await prepareParagraph(captureCaption({ text: path.map(group => group.label).join("\n"),
|
|
10511
10951
|
presentation: { bold: true }, spaceAfter: 4 }, pages.settings, fonts), pages.settings, fonts);
|
|
@@ -10568,26 +11008,46 @@ async function renderGroupedPdfTable(block, context) {
|
|
|
10568
11008
|
...(group.label.trim() ? { bookmark: { title: group.label, level: (groupHeadingLevel + group.level) } } : {})
|
|
10569
11009
|
}, pages.settings, fonts), pages.settings, fonts));
|
|
10570
11010
|
const groupHeight = groupHeadings.reduce((height, heading) => height + heading.height, 0);
|
|
10571
|
-
|
|
10572
|
-
|
|
11011
|
+
// Newly opened semantic headings already paint the end of this path. Only the open
|
|
11012
|
+
// ancestor prefix needs an artifact here; later physical bands still paint the full path.
|
|
11013
|
+
const ancestorCaption = semantic && semanticDepth > 0 ? await prepareParagraph(captureCaption({
|
|
11014
|
+
text: path.slice(0, semanticDepth).map(group => group.label).join("\n"), presentation: { bold: true }, spaceAfter: 4
|
|
11015
|
+
}, pages.settings, fonts), pages.settings, fonts) : undefined;
|
|
11016
|
+
const openingHeight = semantic ? (ancestorCaption?.height ?? 0) + groupHeight : caption.height;
|
|
11017
|
+
await context.flushParagraphs(openingHeight + headingHeight + minimum);
|
|
11018
|
+
if (ancestorCaption)
|
|
11019
|
+
await pages.paragraphs([ancestorCaption], groupHeight + headingHeight + minimum, true, { artifact: true });
|
|
11020
|
+
let followingHeight = groupHeight + (semantic ? 0 : caption.height) + headingHeight + minimum;
|
|
10573
11021
|
for (const heading of groupHeadings) {
|
|
10574
11022
|
followingHeight -= heading.height;
|
|
10575
11023
|
await pages.beginGroup(semanticDepth++, heading, followingHeight);
|
|
10576
11024
|
}
|
|
10577
|
-
await pages.beginTable(layout, headings, minimum, caption, continuation, false, semantic);
|
|
11025
|
+
await pages.beginTable(layout, headings, minimum, caption, continuation, false, semantic, semantic);
|
|
10578
11026
|
started = true;
|
|
10579
11027
|
firstFragment = (caption?.lines.length ?? 0) > 0 || groupHeadings.some(heading => heading.lines.length > 0);
|
|
10580
11028
|
};
|
|
10581
|
-
const semanticSubtotal = async (row, level) => {
|
|
11029
|
+
const semanticSubtotal = async (row, level, values) => {
|
|
11030
|
+
if (level === report.groupBy.length - 1) {
|
|
11031
|
+
// A leaf's own subtotal shares its detail table and header identities. Keep the last
|
|
11032
|
+
// detail/summary bundle when it fits; the existing flow owns continuation and limits.
|
|
11033
|
+
pages.summary(row);
|
|
11034
|
+
closing.push(row);
|
|
11035
|
+
await finishLeaf();
|
|
11036
|
+
await pages.endGroup(level);
|
|
11037
|
+
semanticDepth = level;
|
|
11038
|
+
path = path.slice(0, level);
|
|
11039
|
+
return;
|
|
11040
|
+
}
|
|
10582
11041
|
await finishLeaf();
|
|
10583
11042
|
const { caption, continuation } = await prepareGroupContext();
|
|
10584
|
-
const
|
|
10585
|
-
await
|
|
11043
|
+
const projected = summaryLayout(false), summaryHeadings = await projected.headers();
|
|
11044
|
+
const summaryRow = await projected.data(values, 0, true), minimum = projected.minimumRowHeight(summaryRow);
|
|
11045
|
+
await context.flushParagraphs(caption.height + await projected.blockHeight(summaryHeadings) + minimum);
|
|
10586
11046
|
// An ancestor subtotal belongs to that ancestor's section, never the final child's table.
|
|
10587
11047
|
// Its own visible column headings keep the separate logical summary table truthful.
|
|
10588
|
-
await pages.beginTable(
|
|
10589
|
-
pages.summary(
|
|
10590
|
-
await pages.row(
|
|
11048
|
+
await pages.beginTable(projected, summaryHeadings, minimum, caption, continuation, false, true);
|
|
11049
|
+
pages.summary(summaryRow);
|
|
11050
|
+
await pages.row(summaryRow, caption.lines.length > 0 || summaryHeadings.length > 0);
|
|
10591
11051
|
await pages.endTable();
|
|
10592
11052
|
await pages.endGroup(level);
|
|
10593
11053
|
semanticDepth = level;
|
|
@@ -10597,25 +11057,19 @@ async function renderGroupedPdfTable(block, context) {
|
|
|
10597
11057
|
await finishLeaf();
|
|
10598
11058
|
if (!includeGrandTotal && summary.rows !== 0)
|
|
10599
11059
|
return;
|
|
10600
|
-
const
|
|
10601
|
-
const { groups: _groups, ...leaf } = column;
|
|
10602
|
-
return leaf;
|
|
10603
|
-
});
|
|
10604
|
-
const completeTable = settings({ ...table.options, columns: completeColumns,
|
|
10605
|
-
includeHeader: input.includeHeader ?? true });
|
|
10606
|
-
const completeLayout = summary.rows === 0 ? layout : new PdfTableLayout({ ...completeTable, budget: prepared.budget }, fonts);
|
|
11060
|
+
const completeLayout = summary.rows === 0 ? layout : summaryLayout(true);
|
|
10607
11061
|
const completeHeadings = summary.rows === 0 ? headings : await completeLayout.headers();
|
|
10608
11062
|
rowIndex = -1;
|
|
10609
11063
|
let total;
|
|
10610
11064
|
if (includeGrandTotal) {
|
|
10611
11065
|
context.acceptRow(false);
|
|
10612
|
-
total = await completeLayout.data(summaryValues(synchronousText(grandTotalLabel(summary), "grandTotalLabel"), summary.totals), 0, true);
|
|
11066
|
+
total = await completeLayout.data(summaryValues(synchronousText(grandTotalLabel(summary), "grandTotalLabel"), summary.totals, summary.rows === 0 ? undefined : aggregatePositions), 0, true);
|
|
10613
11067
|
}
|
|
10614
11068
|
if (!completeHeadings.length && !total)
|
|
10615
11069
|
return;
|
|
10616
11070
|
const minimum = total ? completeLayout.minimumRowHeight(total) : 0;
|
|
10617
11071
|
await context.flushParagraphs(await completeLayout.blockHeight(completeHeadings) + minimum);
|
|
10618
|
-
await pages.beginTable(completeLayout, completeHeadings, minimum
|
|
11072
|
+
await pages.beginTable(completeLayout, completeHeadings, minimum);
|
|
10619
11073
|
if (total) {
|
|
10620
11074
|
if (semantic)
|
|
10621
11075
|
pages.summary(total);
|
|
@@ -10643,9 +11097,11 @@ async function renderGroupedPdfTable(block, context) {
|
|
|
10643
11097
|
case "groupEnd": {
|
|
10644
11098
|
rowIndex = -1;
|
|
10645
11099
|
context.acceptRow(false);
|
|
10646
|
-
const
|
|
11100
|
+
const separate = semantic && event.level !== report.groupBy.length - 1;
|
|
11101
|
+
const values = summaryValues(synchronousText(subtotalLabel(event), "subtotalLabel"), event.totals, separate ? aggregatePositions : undefined);
|
|
11102
|
+
const row = separate ? undefined : await layout.data(values, 0, true);
|
|
10647
11103
|
if (semantic)
|
|
10648
|
-
await semanticSubtotal(row, event.level);
|
|
11104
|
+
await semanticSubtotal(row, event.level, values);
|
|
10649
11105
|
else
|
|
10650
11106
|
closing.push(row);
|
|
10651
11107
|
break;
|
|
@@ -10662,11 +11118,11 @@ async function renderGroupedPdfTable(block, context) {
|
|
|
10662
11118
|
}
|
|
10663
11119
|
}
|
|
10664
11120
|
const _exports = Object.freeze({ renderGroupedPdfTable: renderGroupedPdfTable });
|
|
10665
|
-
_modules.set("
|
|
11121
|
+
_modules.set("d43e573fd5bad18a7ec2d71752168c422c4f8fabbc51f1cef8e3ba389f298715", _exports);
|
|
10666
11122
|
return _exports;
|
|
10667
11123
|
})();
|
|
10668
11124
|
|
|
10669
|
-
const
|
|
11125
|
+
const _m84 = _modules.get("f6c70e9a0bed09b5a1c61a662ad7d3faf731c911f574e2df285f669bd643b947") ?? (() => {
|
|
10670
11126
|
const { BlobByteSink, withDestination } = _m3;
|
|
10671
11127
|
|
|
10672
11128
|
const { OfficeIMOError } = _m2;
|
|
@@ -10683,25 +11139,25 @@ const { settings, captureWideTable } = _m17;
|
|
|
10683
11139
|
|
|
10684
11140
|
const { pdfNumber: n } = _m60;
|
|
10685
11141
|
|
|
10686
|
-
const { PdfTableLayout } =
|
|
11142
|
+
const { PdfTableLayout } = _m69;
|
|
10687
11143
|
|
|
10688
11144
|
const { PdfWriteSession } = _m59;
|
|
10689
11145
|
|
|
10690
|
-
const { PdfDocumentImages } =
|
|
11146
|
+
const { PdfDocumentImages } = _m85;
|
|
10691
11147
|
|
|
10692
|
-
const { vectorCommands } =
|
|
11148
|
+
const { vectorCommands } = _m87;
|
|
10693
11149
|
|
|
10694
|
-
const { graphicAlternative } =
|
|
11150
|
+
const { graphicAlternative } = _m80;
|
|
10695
11151
|
|
|
10696
|
-
const { checkDrawingBlock, prepareDrawing } =
|
|
11152
|
+
const { checkDrawingBlock, prepareDrawing } = _m88;
|
|
10697
11153
|
|
|
10698
|
-
const { captureParagraph, captureCaption, prepareParagraph, checkParagraphBuffer, paragraphStartHeight } =
|
|
11154
|
+
const { captureParagraph, captureCaption, prepareParagraph, checkParagraphBuffer, paragraphStartHeight } = _m89;
|
|
10699
11155
|
|
|
10700
|
-
const { captureListOptions, prepareListItem } =
|
|
11156
|
+
const { captureListOptions, prepareListItem } = _m90;
|
|
10701
11157
|
|
|
10702
|
-
const { captureSection } =
|
|
11158
|
+
const { captureSection } = _m78;
|
|
10703
11159
|
|
|
10704
|
-
const { renderGroupedPdfTable } =
|
|
11160
|
+
const { renderGroupedPdfTable } = _m91;
|
|
10705
11161
|
|
|
10706
11162
|
const tableOptionFields = ["columns", "includeHeader", "headerRows", "footer", "headerPresentation", "footerPresentation", "alternateRowColor", "columnWidths", "wideTable", "formatValue", "formatRuns"];
|
|
10707
11163
|
/** Capture typed columns for a single-use table source in a composed document. */
|
|
@@ -10956,22 +11412,22 @@ function captureTableOptions(options) {
|
|
|
10956
11412
|
return { ...captured, ...(captured.wideTable === undefined ? {} : { wideTable: captureWideTable(captured.wideTable) }) };
|
|
10957
11413
|
}
|
|
10958
11414
|
const _exports = Object.freeze({ pdfTable: pdfTable, writePdfDocument: writePdfDocument, writePdfDocumentTo: writePdfDocumentTo });
|
|
10959
|
-
_modules.set("
|
|
11415
|
+
_modules.set("f6c70e9a0bed09b5a1c61a662ad7d3faf731c911f574e2df285f669bd643b947", _exports);
|
|
10960
11416
|
return _exports;
|
|
10961
11417
|
})();
|
|
10962
11418
|
|
|
10963
|
-
const
|
|
11419
|
+
const _m83 = _modules.get("879a0adeb3c62918085a071cbc37f221eb89a0fd73d56ebb5e9cfe0d49db8ee9") ?? (() => {
|
|
10964
11420
|
const { assertGroupedReportSource } = _m8;
|
|
10965
11421
|
|
|
10966
11422
|
const { BlobByteSink } = _m3;
|
|
10967
11423
|
|
|
10968
|
-
const { writePdfDocumentTo } =
|
|
11424
|
+
const { writePdfDocumentTo } = _m84;
|
|
10969
11425
|
|
|
10970
11426
|
const { pdfOptionFields } = _m17;
|
|
10971
11427
|
|
|
10972
11428
|
const { captureFields } = _m10;
|
|
10973
11429
|
|
|
10974
|
-
const { pdfGroupedTable, groupedPdfLabelFields, groupedPdfTableFields } =
|
|
11430
|
+
const { pdfGroupedTable, groupedPdfLabelFields, groupedPdfTableFields } = _m92;
|
|
10975
11431
|
|
|
10976
11432
|
|
|
10977
11433
|
|
|
@@ -11005,15 +11461,15 @@ async function writeGroupedPdfTo(report, destination, configuration) {
|
|
|
11005
11461
|
delete documentOptions.footer;
|
|
11006
11462
|
return writePdfDocumentTo([pdfGroupedTable(report, tableOptions)], destination, documentOptions);
|
|
11007
11463
|
}
|
|
11008
|
-
const _exports = Object.freeze({ pdfGroupedTable:
|
|
11009
|
-
_modules.set("
|
|
11464
|
+
const _exports = Object.freeze({ pdfGroupedTable: _m92.pdfGroupedTable, writeGroupedPdf: writeGroupedPdf, writeGroupedPdfTo: writeGroupedPdfTo });
|
|
11465
|
+
_modules.set("879a0adeb3c62918085a071cbc37f221eb89a0fd73d56ebb5e9cfe0d49db8ee9", _exports);
|
|
11010
11466
|
return _exports;
|
|
11011
11467
|
})();
|
|
11012
11468
|
|
|
11013
|
-
const
|
|
11014
|
-
const { fontProgram } =
|
|
11469
|
+
const _m93 = _modules.get("3d777096288d1be55a05a80bc015d4674212e587703f25a7e7cf99a8065feb86") ?? (() => {
|
|
11470
|
+
const { fontProgram } = _m63;
|
|
11015
11471
|
|
|
11016
|
-
const { resolveScalar, selectFont, validateFonts } =
|
|
11472
|
+
const { resolveScalar, selectFont, validateFonts } = _m67;
|
|
11017
11473
|
|
|
11018
11474
|
/**
|
|
11019
11475
|
* Check one text run against the writer's selected font and scalar-layout rules.
|
|
@@ -11046,18 +11502,18 @@ function preflightPdfText(text, options = {}) {
|
|
|
11046
11502
|
return { supported: true };
|
|
11047
11503
|
}
|
|
11048
11504
|
const _exports = Object.freeze({ preflightPdfText: preflightPdfText });
|
|
11049
|
-
_modules.set("
|
|
11505
|
+
_modules.set("3d777096288d1be55a05a80bc015d4674212e587703f25a7e7cf99a8065feb86", _exports);
|
|
11050
11506
|
return _exports;
|
|
11051
11507
|
})();
|
|
11052
11508
|
|
|
11053
|
-
const _m57 = _modules.get("
|
|
11509
|
+
const _m57 = _modules.get("2deab7b4ccb08bed297341ddb563d8fcf74277aff38c1dfc3d9edd61c0d98481") ?? (() => {
|
|
11054
11510
|
|
|
11055
|
-
const _exports = Object.freeze({ writePdf: _m58.writePdf, writePdfTo: _m58.writePdfTo, writeGroupedPdf:
|
|
11056
|
-
_modules.set("
|
|
11511
|
+
const _exports = Object.freeze({ writePdf: _m58.writePdf, writePdfTo: _m58.writePdfTo, writeGroupedPdf: _m83.writeGroupedPdf, writeGroupedPdfTo: _m83.writeGroupedPdfTo, pdfGroupedTable: _m83.pdfGroupedTable, createGroupedReport: _m8.createGroupedReport, writePdfDocument: _m84.writePdfDocument, writePdfDocumentTo: _m84.writePdfDocumentTo, pdfTable: _m84.pdfTable, PdfFont: _m63.PdfFont, preflightPdfText: _m93.preflightPdfText, ExportCell: _m5.ExportCell, saveBlob: _m1.saveBlob });
|
|
11512
|
+
_modules.set("2deab7b4ccb08bed297341ddb563d8fcf74277aff38c1dfc3d9edd61c0d98481", _exports);
|
|
11057
11513
|
return _exports;
|
|
11058
11514
|
})();
|
|
11059
11515
|
|
|
11060
|
-
const
|
|
11516
|
+
const _m95 = _modules.get("c0aee2c5df0df3e62ca31fc685243cdd4b449f083834e8d28cf92c20dfa7b27f") ?? (() => {
|
|
11061
11517
|
/** @internal Typed conversion follows declared datetime intent, never localized display text. */
|
|
11062
11518
|
function datetime(value, mode, clock) {
|
|
11063
11519
|
if (mode === "text")
|
|
@@ -11097,13 +11553,21 @@ _modules.set("c0aee2c5df0df3e62ca31fc685243cdd4b449f083834e8d28cf92c20dfa7b27f",
|
|
|
11097
11553
|
return _exports;
|
|
11098
11554
|
})();
|
|
11099
11555
|
|
|
11100
|
-
const
|
|
11556
|
+
const _m94 = _modules.get("91dbdf35d8f192b3c0ea92dfab6b9812872fbe3c8d85a5d2afe389bd61262ba2") ?? (() => {
|
|
11101
11557
|
const { ExportCell, checkAbort, inputRows } = _m1;
|
|
11102
11558
|
|
|
11103
|
-
const { datetime } =
|
|
11559
|
+
const { datetime } = _m95;
|
|
11560
|
+
|
|
11561
|
+
const { captureFields } = _m10;
|
|
11562
|
+
|
|
11563
|
+
const { copyColumns } = _m11;
|
|
11564
|
+
|
|
11565
|
+
const { copyCellPresentation } = _m5;
|
|
11104
11566
|
|
|
11567
|
+
const columnFields = ["width", "format", "wrapText", "alignment", "rowHeader", "groups"];
|
|
11105
11568
|
/** Map an immutable CanopyX record capture to a writer without querying the grid or retaining its body. */
|
|
11106
11569
|
function createCanopyExport(capture, format, options = {}) {
|
|
11570
|
+
options = captureFields(options, ["tones", "columnOptions", "unsupportedPresentation", "datetime", "xlsx", "signal", "onDiagnostic"]);
|
|
11107
11571
|
if (format !== "xlsx" && format !== "csv" && format !== "pdf")
|
|
11108
11572
|
throw new TypeError("Canopy export format must be xlsx, csv or pdf.");
|
|
11109
11573
|
if (!capture || typeof capture.rows !== "function" || !capture.request)
|
|
@@ -11146,7 +11610,7 @@ function createCanopyExport(capture, format, options = {}) {
|
|
|
11146
11610
|
const tones = new Map(Object.entries(options.tones ?? {}).map(([name, style]) => {
|
|
11147
11611
|
if (!style || typeof style !== "object" || Array.isArray(style))
|
|
11148
11612
|
throw new TypeError("Tone mappings must be portable presentation objects.");
|
|
11149
|
-
return [name,
|
|
11613
|
+
return [name, copyCellPresentation(style)];
|
|
11150
11614
|
}));
|
|
11151
11615
|
const tone = (name, rowId, columnId) => {
|
|
11152
11616
|
if (name === undefined)
|
|
@@ -11170,15 +11634,16 @@ function createCanopyExport(capture, format, options = {}) {
|
|
|
11170
11634
|
throw new TypeError("Invalid or duplicate Canopy export column.");
|
|
11171
11635
|
ids.add(column.id);
|
|
11172
11636
|
diagnostics(column.diagnostics, undefined, column.id);
|
|
11173
|
-
const
|
|
11174
|
-
for (const key of Object.keys(
|
|
11175
|
-
if (!
|
|
11637
|
+
const selected = Object.hasOwn(options.columnOptions ?? {}, column.id) ? options.columnOptions[column.id] : {};
|
|
11638
|
+
for (const key of Object.keys(selected))
|
|
11639
|
+
if (!columnFields.includes(key))
|
|
11176
11640
|
throw new TypeError("Unsupported Canopy column option: " + key);
|
|
11177
|
-
|
|
11641
|
+
const override = captureFields(selected, columnFields);
|
|
11642
|
+
const [captured] = copyColumns([{ ...override, key: column.id, header: column.title,
|
|
11178
11643
|
...(values === "raw" && column.kind === "number" ? { type: "number" } : {}),
|
|
11179
11644
|
...(override.wrapText === undefined && column.wrap === undefined ? {} : { wrapText: override.wrapText ?? column.wrap }),
|
|
11180
|
-
...(override.alignment === undefined && column.alignment === undefined ? {} : { alignment: override.alignment ?? column.alignment })
|
|
11181
|
-
|
|
11645
|
+
...(override.alignment === undefined && column.alignment === undefined ? {} : { alignment: override.alignment ?? column.alignment }) }]);
|
|
11646
|
+
return Object.freeze({ id: column.id, kind: column.kind, column: Object.freeze(captured) });
|
|
11182
11647
|
});
|
|
11183
11648
|
const rowCount = request.recordCount;
|
|
11184
11649
|
return Object.freeze({ columns: Object.freeze(specs.map(spec => spec.column)), rowCount, async *rows() {
|
|
@@ -11217,11 +11682,11 @@ function createCanopyExport(capture, format, options = {}) {
|
|
|
11217
11682
|
} });
|
|
11218
11683
|
}
|
|
11219
11684
|
const _exports = Object.freeze({ createCanopyExport: createCanopyExport });
|
|
11220
|
-
_modules.set("
|
|
11685
|
+
_modules.set("91dbdf35d8f192b3c0ea92dfab6b9812872fbe3c8d85a5d2afe389bd61262ba2", _exports);
|
|
11221
11686
|
return _exports;
|
|
11222
11687
|
})();
|
|
11223
11688
|
|
|
11224
|
-
const _m0 = _modules.get("
|
|
11689
|
+
const _m0 = _modules.get("3e66cc3ead243255e3903dfabd767d39c2507193c6631b6a40caad66216c13ed") ?? (() => {
|
|
11225
11690
|
const { BlobByteSink } = _m1;
|
|
11226
11691
|
|
|
11227
11692
|
const { notifyProgress } = _m14;
|
|
@@ -11236,7 +11701,7 @@ const { writeCsvTo } = _m55;
|
|
|
11236
11701
|
|
|
11237
11702
|
const { writePdfTo } = _m57;
|
|
11238
11703
|
|
|
11239
|
-
const { createCanopyExport } =
|
|
11704
|
+
const { createCanopyExport } = _m94;
|
|
11240
11705
|
|
|
11241
11706
|
|
|
11242
11707
|
|
|
@@ -11278,8 +11743,8 @@ async function exportCanopy(capture, format, options = {}) {
|
|
|
11278
11743
|
throw error;
|
|
11279
11744
|
}
|
|
11280
11745
|
}
|
|
11281
|
-
const _exports = Object.freeze({ createCanopyExport:
|
|
11282
|
-
_modules.set("
|
|
11746
|
+
const _exports = Object.freeze({ createCanopyExport: _m94.createCanopyExport, ExportCell: _m5.ExportCell, PdfFont: _m63.PdfFont, writeCanopyTo: writeCanopyTo, exportCanopy: exportCanopy });
|
|
11747
|
+
_modules.set("3e66cc3ead243255e3903dfabd767d39c2507193c6631b6a40caad66216c13ed", _exports);
|
|
11283
11748
|
return _exports;
|
|
11284
11749
|
})();
|
|
11285
11750
|
Object.assign(officeimo, _m0);
|