@evotecit/officeimo 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +13 -10
  2. package/bundles/officeimo-canopyx.js +813 -358
  3. package/bundles/officeimo-canopyx.mjs +700 -246
  4. package/bundles/officeimo-csv.js +29 -19
  5. package/bundles/officeimo-csv.mjs +17 -7
  6. package/bundles/officeimo-datatables.js +806 -360
  7. package/bundles/officeimo-datatables.mjs +694 -249
  8. package/bundles/officeimo-execution.js +35 -25
  9. package/bundles/officeimo-execution.mjs +17 -7
  10. package/bundles/officeimo-pdf.js +734 -289
  11. package/bundles/officeimo-pdf.mjs +685 -241
  12. package/bundles/officeimo-xlsx.js +88 -77
  13. package/bundles/officeimo-xlsx.mjs +22 -11
  14. package/bundles/officeimo.js +790 -344
  15. package/bundles/officeimo.mjs +680 -235
  16. package/dist/core/index.d.ts +2 -0
  17. package/dist/core/iteration.js +2 -2
  18. package/dist/core/sinks.js +2 -1
  19. package/dist/integrations/canopyx/source.js +13 -7
  20. package/dist/integrations/datatables/snapshot.js +3 -3
  21. package/dist/internal/rows.js +13 -4
  22. package/dist/pdf/document-grouped.js +72 -22
  23. package/dist/pdf/font-resources.js +2 -1
  24. package/dist/pdf/inline-text.js +50 -9
  25. package/dist/pdf/objects.js +188 -11
  26. package/dist/pdf/pages.js +25 -26
  27. package/dist/pdf/paragraph-layout.d.ts +2 -0
  28. package/dist/pdf/paragraph-layout.js +9 -4
  29. package/dist/pdf/session.js +1 -1
  30. package/dist/pdf/settings.d.ts +2 -0
  31. package/dist/pdf/settings.js +27 -2
  32. package/dist/pdf/structure.js +80 -28
  33. package/dist/pdf/table-band-flow.js +26 -11
  34. package/dist/pdf/table-band-plan.js +1 -3
  35. package/dist/pdf/table-layout.d.ts +4 -0
  36. package/dist/pdf/table-layout.js +22 -10
  37. package/dist/pdf/table-structure.js +28 -12
  38. package/dist/pdf/text.js +5 -0
  39. package/dist/pdf/types.d.ts +4 -2
  40. package/dist/pdf/xref.d.ts +1 -0
  41. package/dist/pdf/xref.js +30 -0
  42. package/dist/xlsx/values.js +3 -2
  43. package/dist/zip/entry.js +1 -1
  44. package/dist/zip/index.js +1 -1
  45. 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("1ae4f4554ececbf0fc1e5d32f40275e35f228dca922cfc0760ae681fd9690d7e") ?? (() => {
45
+ const _m4 = _modules.get("87c24efeaa0f1579c19afeeb4918caeb4f8f65a88d24a246e2cfd712b37dbac3") ?? (() => {
46
46
  function checkAbort(signal) {
47
47
  if (signal?.aborted)
48
- throw signal.reason ?? new DOMException("Export cancelled.", "AbortError");
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 ?? new DOMException("Export cancelled.", "AbortError")); };
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("1ae4f4554ececbf0fc1e5d32f40275e35f228dca922cfc0760ae681fd9690d7e", _exports);
196
+ _modules.set("87c24efeaa0f1579c19afeeb4918caeb4f8f65a88d24a246e2cfd712b37dbac3", _exports);
197
197
  return _exports;
198
198
  })();
199
199
 
200
- const _m3 = _modules.get("0c4bd256ca66b488390b27a6d197e5ba99ae051ae662621b67a5e80b0479eefc") ?? (() => {
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("0c4bd256ca66b488390b27a6d197e5ba99ae051ae662621b67a5e80b0479eefc", _exports);
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("c15eede1e0b2a0a81c7153114bbb20e411413650f1c70c29bbda627241c59dbd") ?? (() => {
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
- if (row.length > columns.length)
516
+ const length = row.length;
517
+ if (length > columns.length)
516
518
  throw new RangeError("Row has more values than declared columns.");
517
- for (const value of row)
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
- return row;
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("c15eede1e0b2a0a81c7153114bbb20e411413650f1c70c29bbda627241c59dbd", _exports);
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("18d120e0ba2b5d6d4a098d72a6f558dec1c936c1f1a0e4996c6d240a928c931e") ?? (() => {
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("18d120e0ba2b5d6d4a098d72a6f558dec1c936c1f1a0e4996c6d240a928c931e", _exports);
922
+ _modules.set("046b305cdccf817d847addb75a778131622de23f2840830bbe1c0c26053a68c0", _exports);
913
923
  return _exports;
914
924
  })();
915
925
 
916
- const _m1 = _modules.get("4af46fa949e848316dc59f9073630c7949316a763a7c9a753335d276c580b8e6") ?? (() => {
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("4af46fa949e848316dc59f9073630c7949316a763a7c9a753335d276c580b8e6", _exports);
971
+ _modules.set("81b3d47c02b7d8443b79e02b3cfb52032d6b73d9a3fb592b777ebe028ad0ef00", _exports);
962
972
  return _exports;
963
973
  })();
964
974
 
@@ -1100,7 +1110,7 @@ _modules.set("f0627ba89e5c8fcb376ebe3ce72dcc8d68c34952981f8703e36b8bb1a9894208",
1100
1110
  return _exports;
1101
1111
  })();
1102
1112
 
1103
- const _m15 = _modules.get("9c3d47f5bb21af4555c6ad7b10e216b7c957f2e71027f576989d75e7cf563d1d") ?? (() => {
1113
+ const _m15 = _modules.get("b6dbf755b495baef5c7d7651e6a55b2098f2ee304edca2c8b285a0bd7ec127a1") ?? (() => {
1104
1114
  const { beginTask, checkAbort, consumeRows, taskYieldDue, withAbort } = _m4;
1105
1115
 
1106
1116
  const { BlobByteSink, ChunkedTextSink, withDestination } = _m3;
@@ -1247,7 +1257,7 @@ async function writeCsv(rows, configuration) {
1247
1257
  }
1248
1258
  }
1249
1259
  const _exports = Object.freeze({ saveBlob: _m1.saveBlob, ExportCell: _m5.ExportCell, writeCsvTo: writeCsvTo, writeCsv: writeCsv });
1250
- _modules.set("9c3d47f5bb21af4555c6ad7b10e216b7c957f2e71027f576989d75e7cf563d1d", _exports);
1260
+ _modules.set("b6dbf755b495baef5c7d7651e6a55b2098f2ee304edca2c8b285a0bd7ec127a1", _exports);
1251
1261
  return _exports;
1252
1262
  })();
1253
1263
 
@@ -1299,7 +1309,7 @@ _modules.set("8ece66b561682170c879991995105163f4c484c8355d5e451fc6f52a9fbc3f82",
1299
1309
  return _exports;
1300
1310
  })();
1301
1311
 
1302
- const _m25 = _modules.get("47668dc33afddf93a09736e08c39f34d52518f2bf719e5ef386363758f42e4b7") ?? (() => {
1312
+ const _m25 = _modules.get("2b85e926659d505b8142c9f8a4d8faf64a695a97dea19022031415c30e63d364") ?? (() => {
1303
1313
  const { OfficeIMOError } = _m2;
1304
1314
 
1305
1315
  const { ChunkedTextSink } = _m3;
@@ -1377,11 +1387,11 @@ class XmlWriter {
1377
1387
  throw new OfficeIMOError("INVALID_STATE", "XML writer is closed."); }
1378
1388
  }
1379
1389
  const _exports = Object.freeze({ xmlDeclaration: xmlDeclaration, cleanXml: cleanXml, escapeXml: escapeXml, escapeOoxmlAttribute: escapeOoxmlAttribute, validateXmlName: validateXmlName, XmlWriter: XmlWriter });
1380
- _modules.set("47668dc33afddf93a09736e08c39f34d52518f2bf719e5ef386363758f42e4b7", _exports);
1390
+ _modules.set("2b85e926659d505b8142c9f8a4d8faf64a695a97dea19022031415c30e63d364", _exports);
1381
1391
  return _exports;
1382
1392
  })();
1383
1393
 
1384
- const _m24 = _modules.get("75f1dfdbbf7685a7bfd416b8d7d4b82698a1852f973cf0264456086cf8c20723") ?? (() => {
1394
+ const _m24 = _modules.get("cd6fbdc4df9506c140f11083b3740d048b39c012670222001051b552dbc7bfb0") ?? (() => {
1385
1395
  const { escapeXml, xmlDeclaration } = _m25;
1386
1396
 
1387
1397
  const { isDate } = _m6;
@@ -1403,7 +1413,7 @@ function appPropertiesXml(properties = {}, policy = "strip") {
1403
1413
  '<Application>' + escapeXml(properties.application ?? "OfficeIMO", policy) + '</Application><Company>' + escapeXml(properties.company ?? "", policy) + '</Company></Properties>';
1404
1414
  }
1405
1415
  const _exports = Object.freeze({ corePropertiesXml: corePropertiesXml, appPropertiesXml: appPropertiesXml });
1406
- _modules.set("75f1dfdbbf7685a7bfd416b8d7d4b82698a1852f973cf0264456086cf8c20723", _exports);
1416
+ _modules.set("cd6fbdc4df9506c140f11083b3740d048b39c012670222001051b552dbc7bfb0", _exports);
1407
1417
  return _exports;
1408
1418
  })();
1409
1419
 
@@ -1430,7 +1440,7 @@ _modules.set("790c15edc51b308be3e7d8222630d407f8c79c31ab21ba0b9f92c00f44ab4021",
1430
1440
  return _exports;
1431
1441
  })();
1432
1442
 
1433
- const _m27 = _modules.get("34b448ff5052fe659ccb250d80fc2a0b13ab82890f50132ef5c9e51da369a582") ?? (() => {
1443
+ const _m27 = _modules.get("597d152d20a2a28ee5cd6d4243a79a71ce8b83769a77441bfc944aadc0a6efbd") ?? (() => {
1434
1444
  const { checkAbort, withAbort } = _m4;
1435
1445
 
1436
1446
  const { OfficeIMOError } = _m2;
@@ -1461,7 +1471,7 @@ class EntryWriter {
1461
1471
  closed = false;
1462
1472
  cleaned = false;
1463
1473
  lifetime = new AbortController();
1464
- abort = () => { this.fail(this.signal?.reason ?? new DOMException("Export cancelled.", "AbortError")); };
1474
+ abort = () => { this.fail(this.signal?.reason); };
1465
1475
  constructor(compression, sink, signal) {
1466
1476
  this.sink = sink;
1467
1477
  this.signal = signal;
@@ -1558,11 +1568,11 @@ class EntryWriter {
1558
1568
  }
1559
1569
  }
1560
1570
  const _exports = Object.freeze({ Crc32: _m28.Crc32, zipLimit: zipLimit, zipSize: zipSize, EntryWriter: EntryWriter });
1561
- _modules.set("34b448ff5052fe659ccb250d80fc2a0b13ab82890f50132ef5c9e51da369a582", _exports);
1571
+ _modules.set("597d152d20a2a28ee5cd6d4243a79a71ce8b83769a77441bfc944aadc0a6efbd", _exports);
1562
1572
  return _exports;
1563
1573
  })();
1564
1574
 
1565
- const _m26 = _modules.get("cc7c3953e35bb436d0f5fe5c35a60b7e97a00d2e729df52d219d9e246f326b32") ?? (() => {
1575
+ const _m26 = _modules.get("699a019e0c3f317a62bf3a6e59b76b6cf1645908b0f1b1f157c18f4d4f368dfb") ?? (() => {
1566
1576
 
1567
1577
 
1568
1578
  const { EntryWriter, zipSize } = _m27;
@@ -1626,7 +1636,7 @@ class ZipWriter {
1626
1636
  /** Pending header/directory writes and source reads must also stop on explicit discard. */
1627
1637
  async acceptance(operation) {
1628
1638
  const signal = this.options.signal;
1629
- const abort = () => this.lifetime.abort(signal?.reason ?? new DOMException("Export cancelled.", "AbortError"));
1639
+ const abort = () => this.lifetime.abort(signal?.reason);
1630
1640
  signal?.addEventListener("abort", abort, { once: true });
1631
1641
  try {
1632
1642
  checkAbort(signal);
@@ -1818,11 +1828,11 @@ class ZipWriter {
1818
1828
  }
1819
1829
  }
1820
1830
  const _exports = Object.freeze({ Crc32: _m27.Crc32, validateEntryName: validateEntryName, ZipWriter: ZipWriter });
1821
- _modules.set("cc7c3953e35bb436d0f5fe5c35a60b7e97a00d2e729df52d219d9e246f326b32", _exports);
1831
+ _modules.set("699a019e0c3f317a62bf3a6e59b76b6cf1645908b0f1b1f157c18f4d4f368dfb", _exports);
1822
1832
  return _exports;
1823
1833
  })();
1824
1834
 
1825
- const _m22 = _modules.get("c982e9efabd891df539c26c513a3e9cf5a644ae13516f48f9d19f7ed6b584c06") ?? (() => {
1835
+ const _m22 = _modules.get("3bedb42cf4cced6fffb6c1b9e798b93ccb70159cf6cfc582237e723187cc465f") ?? (() => {
1826
1836
 
1827
1837
 
1828
1838
 
@@ -2067,7 +2077,7 @@ class OpcPackage {
2067
2077
  }
2068
2078
  }
2069
2079
  const _exports = Object.freeze({ partUri: _m23.partUri, relationshipPartUri: _m23.relationshipPartUri, relativePartTarget: _m23.relativePartTarget, corePropertiesXml: _m24.corePropertiesXml, appPropertiesXml: _m24.appPropertiesXml, relationshipsNamespace: relationshipsNamespace, officeRelationshipsNamespace: officeRelationshipsNamespace, contentTypesNamespace: contentTypesNamespace, relationshipTypes: relationshipTypes, ContentTypes: ContentTypes, OpcPackage: OpcPackage });
2070
- _modules.set("c982e9efabd891df539c26c513a3e9cf5a644ae13516f48f9d19f7ed6b584c06", _exports);
2080
+ _modules.set("3bedb42cf4cced6fffb6c1b9e798b93ccb70159cf6cfc582237e723187cc465f", _exports);
2071
2081
  return _exports;
2072
2082
  })();
2073
2083
 
@@ -2083,7 +2093,7 @@ _modules.set("204def412284dfb11df9aececd57c8c0455db2927ebdb483dd255e7b29f6f359",
2083
2093
  return _exports;
2084
2094
  })();
2085
2095
 
2086
- const _m31 = _modules.get("27f56318b4276c3e6f79cfb300855315ff9cd1897d4748fa2f306b2deef98c36") ?? (() => {
2096
+ const _m31 = _modules.get("2c814aac0c36fa7d9a1fb54d327695a3655309ef22db0c10974813f8f9d4d6ae") ?? (() => {
2087
2097
  const { OfficeIMOError } = _m2;
2088
2098
 
2089
2099
  const { cleanXml, escapeOoxmlAttribute } = _m25;
@@ -2190,11 +2200,11 @@ function differentialXml(style, policy, numberFormat) {
2190
2200
  return xml;
2191
2201
  }
2192
2202
  const _exports = Object.freeze({ fields: fields, optionalBoolean: optionalBoolean, DifferentialStyles: DifferentialStyles, differentialXml: differentialXml });
2193
- _modules.set("27f56318b4276c3e6f79cfb300855315ff9cd1897d4748fa2f306b2deef98c36", _exports);
2203
+ _modules.set("2c814aac0c36fa7d9a1fb54d327695a3655309ef22db0c10974813f8f9d4d6ae", _exports);
2194
2204
  return _exports;
2195
2205
  })();
2196
2206
 
2197
- const _m29 = _modules.get("bf7ec82677b616a41d07306ba385b32456bc03509817c13bbe65a1ba390a6253") ?? (() => {
2207
+ const _m29 = _modules.get("a4ad9a4388ed41b6b7ce4f5a20c44598082db5adc307e96d12de2840e9508d7e") ?? (() => {
2198
2208
  const { escapeOoxmlAttribute, cleanXml, xmlDeclaration } = _m25;
2199
2209
 
2200
2210
  const { OfficeIMOError } = _m2;
@@ -2404,11 +2414,11 @@ class StyleRegistry {
2404
2414
  }
2405
2415
  }
2406
2416
  const _exports = Object.freeze({ colorArgb: _m30.colorArgb, spreadsheetNamespace: spreadsheetNamespace, NumberFormats: NumberFormats, validateStylePatch: validateStylePatch, copyStylePatch: copyStylePatch, StyleRegistry: StyleRegistry });
2407
- _modules.set("bf7ec82677b616a41d07306ba385b32456bc03509817c13bbe65a1ba390a6253", _exports);
2417
+ _modules.set("a4ad9a4388ed41b6b7ce4f5a20c44598082db5adc307e96d12de2840e9508d7e", _exports);
2408
2418
  return _exports;
2409
2419
  })();
2410
2420
 
2411
- const _m33 = _modules.get("6d0c9930eb0b5d96d92b93ba72759417a324dfd119a592c5a2ee4de0ff3495ec") ?? (() => {
2421
+ const _m33 = _modules.get("bf52f9d5aae9685c7fc71f3e5d6cf248beef190df1f28f89d27617e1c2023429") ?? (() => {
2412
2422
  const { NotSupportedError } = _m2;
2413
2423
 
2414
2424
  const { cleanXml, escapeXml } = _m25;
@@ -2516,11 +2526,11 @@ function formulaXml(cell) {
2516
2526
  return "<f>" + escapeXml(cell.formula, "reject") + "</f><v>" + (cell.cachedValue ?? "") + "</v>";
2517
2527
  }
2518
2528
  const _exports = Object.freeze({ FormulaCell: FormulaCell, isSubtotalFormula: isSubtotalFormula, formulaXml: formulaXml });
2519
- _modules.set("6d0c9930eb0b5d96d92b93ba72759417a324dfd119a592c5a2ee4de0ff3495ec", _exports);
2529
+ _modules.set("bf52f9d5aae9685c7fc71f3e5d6cf248beef190df1f28f89d27617e1c2023429", _exports);
2520
2530
  return _exports;
2521
2531
  })();
2522
2532
 
2523
- const _m32 = _modules.get("45bcbd0fd875662d537921217d5e747170e665dedc70927041f59d5782ed21b0") ?? (() => {
2533
+ const _m32 = _modules.get("597ac0803c83556e97bf37d53e2a3aef4351032669f740ebcf8a06369bf940ed") ?? (() => {
2524
2534
  const { cleanXml, escapeXml } = _m25;
2525
2535
 
2526
2536
  const { assertExportValue, assertScalar } = _m5;
@@ -2584,12 +2594,13 @@ function sheetName(requested, names, policy, register = true) {
2584
2594
  throw new TypeError("Sheet name must be a string.");
2585
2595
  // Validate and deduplicate the decoded literal value, before ST_Xstring attribute encoding.
2586
2596
  // A requested _xHHHH_ token is literal text; the serializer protects its leading underscore.
2587
- let base = cleanXml(requested, policy).replace(/[\[\]:*?/\\]/g, "_").trim().replace(/^'+|'+$/g, "").trim();
2597
+ let base = cleanXml(requested, policy).replace(/[\[\]:*?/\\]/g, "_").replace(/^[\s']+|[\s']+$/g, "");
2598
+ // Clipping can expose an internal apostrophe or the reserved History name.
2599
+ base = clipName(base, 31).replace(/[\s']+$/g, "");
2588
2600
  if (!base)
2589
2601
  base = "Sheet";
2590
2602
  if (base.toLowerCase() === "history")
2591
2603
  base += "_";
2592
- base = clipName(base, 31);
2593
2604
  let name = base, suffix = 2;
2594
2605
  while (names.has(name.toLowerCase())) {
2595
2606
  const tail = " (" + suffix++ + ")";
@@ -2612,11 +2623,11 @@ function excelDate(date, mode) {
2612
2623
  return (time - Date.UTC(1899, 11, 31)) / 86400000 + (time >= Date.UTC(1900, 2, 1) ? 1 : 0);
2613
2624
  }
2614
2625
  const _exports = Object.freeze({ Cell: Cell, assertXlsxValue: assertXlsxValue, copyValue: copyValue, cellText: cellText, inlineText: inlineText, columnName: columnName, sheetName: sheetName, excelDate: excelDate });
2615
- _modules.set("45bcbd0fd875662d537921217d5e747170e665dedc70927041f59d5782ed21b0", _exports);
2626
+ _modules.set("597ac0803c83556e97bf37d53e2a3aef4351032669f740ebcf8a06369bf940ed", _exports);
2616
2627
  return _exports;
2617
2628
  })();
2618
2629
 
2619
- const _m36 = _modules.get("7e3adf1ed8ebd3d36cf5e10c55f94387f7044e585e7a1e14fbf597db4e2e4fea") ?? (() => {
2630
+ const _m36 = _modules.get("abbe9e1ad9c0a68c86d0f20348fd324b7eef48b857c0bd9aa04e8959a7e70622") ?? (() => {
2620
2631
  const { ChunkedTextSink } = _m3;
2621
2632
 
2622
2633
  const { escapeXml, xmlDeclaration } = _m25;
@@ -2725,11 +2736,11 @@ async function writeChartXml(chart, destination, policy, signal) {
2725
2736
  await text.close();
2726
2737
  }
2727
2738
  const _exports = Object.freeze({ chartNamespace: chartNamespace, chartContentType: chartContentType, chartAnchorXml: chartAnchorXml, writeChartXml: writeChartXml });
2728
- _modules.set("7e3adf1ed8ebd3d36cf5e10c55f94387f7044e585e7a1e14fbf597db4e2e4fea", _exports);
2739
+ _modules.set("abbe9e1ad9c0a68c86d0f20348fd324b7eef48b857c0bd9aa04e8959a7e70622", _exports);
2729
2740
  return _exports;
2730
2741
  })();
2731
2742
 
2732
- const _m35 = _modules.get("2a8fdd646d18edd986a29c54b3860ff16650da92d97b03a7cdd3cacd843c5246") ?? (() => {
2743
+ const _m35 = _modules.get("0afdc9d464a68ac5ace8863d7c6e25862748c96faa03ed7b8e46402515a552b8") ?? (() => {
2733
2744
  const { cleanXml, escapeXml, escapeOoxmlAttribute, xmlDeclaration } = _m25;
2734
2745
 
2735
2746
  const { copyExportLink } = _m7;
@@ -2803,11 +2814,11 @@ function drawingXml(images, policy, charts = []) {
2803
2814
  }
2804
2815
  const drawingContentType = "application/vnd.openxmlformats-officedocument.drawing+xml";
2805
2816
  const _exports = Object.freeze({ copyDrawingAnchor: copyDrawingAnchor, cellPosition: cellPosition, copyHyperlink: copyHyperlink, copyImage: copyImage, hyperlinksXml: hyperlinksXml, drawingXml: drawingXml, drawingContentType: drawingContentType });
2806
- _modules.set("2a8fdd646d18edd986a29c54b3860ff16650da92d97b03a7cdd3cacd843c5246", _exports);
2817
+ _modules.set("0afdc9d464a68ac5ace8863d7c6e25862748c96faa03ed7b8e46402515a552b8", _exports);
2807
2818
  return _exports;
2808
2819
  })();
2809
2820
 
2810
- const _m38 = _modules.get("dbb48ba4ffa2659e2972a395c603d203c11ea8addb71c38103c006d6d7937506") ?? (() => {
2821
+ const _m38 = _modules.get("e2e414a8ba22e778a769375327988cd080347bbbc863673a702e1dcfa6e9112a") ?? (() => {
2811
2822
  const { OfficeIMOError } = _m2;
2812
2823
 
2813
2824
  const { cellPosition } = _m35;
@@ -2908,11 +2919,11 @@ class MergeRegions {
2908
2919
  throw new RangeError("Merged ranges must stay within exported rows."); }
2909
2920
  }
2910
2921
  const _exports = Object.freeze({ MergeRegions: MergeRegions });
2911
- _modules.set("dbb48ba4ffa2659e2972a395c603d203c11ea8addb71c38103c006d6d7937506", _exports);
2922
+ _modules.set("e2e414a8ba22e778a769375327988cd080347bbbc863673a702e1dcfa6e9112a", _exports);
2912
2923
  return _exports;
2913
2924
  })();
2914
2925
 
2915
- const _m39 = _modules.get("b9d400aa8d995edccef22cef96a0e14cb28ce2071c42d8cf29de94d74fe82355") ?? (() => {
2926
+ const _m39 = _modules.get("ac538bedcdc7144616b2777232e7049d2fd6449a087017fd9c10d31e0f86b292") ?? (() => {
2916
2927
  const { ExportCell } = _m5;
2917
2928
 
2918
2929
  const { tableSpans } = _m17;
@@ -2945,11 +2956,11 @@ class StructuredRows {
2945
2956
  }
2946
2957
  }
2947
2958
  const _exports = Object.freeze({ StructuredRows: StructuredRows });
2948
- _modules.set("b9d400aa8d995edccef22cef96a0e14cb28ce2071c42d8cf29de94d74fe82355", _exports);
2959
+ _modules.set("ac538bedcdc7144616b2777232e7049d2fd6449a087017fd9c10d31e0f86b292", _exports);
2949
2960
  return _exports;
2950
2961
  })();
2951
2962
 
2952
- const _m37 = _modules.get("26966342ea634f631f6b1e684842fb8d3a01e38fe33cac9b74261ba9ff4c11cb") ?? (() => {
2963
+ const _m37 = _modules.get("47c0c236e4ae7b71726d1d7ebe0d2df8f0eb9204b3865adf34b5163f720d4bd5") ?? (() => {
2953
2964
  const { ExportCell } = _m5;
2954
2965
 
2955
2966
  const { isDate } = _m6;
@@ -3146,11 +3157,11 @@ function printXml(options, policy) {
3146
3157
  (options.footer === undefined ? "" : '<oddFooter>' + escapeOoxmlAttribute("&C" + options.footer.replace(/&/g, "&&"), policy) + '</oddFooter>') + '</headerFooter>' : "");
3147
3158
  }
3148
3159
  const _exports = Object.freeze({ ComputedTotal: ComputedTotal, ReportLayout: ReportLayout, totalFormula: totalFormula, printXml: printXml });
3149
- _modules.set("26966342ea634f631f6b1e684842fb8d3a01e38fe33cac9b74261ba9ff4c11cb", _exports);
3160
+ _modules.set("47c0c236e4ae7b71726d1d7ebe0d2df8f0eb9204b3865adf34b5163f720d4bd5", _exports);
3150
3161
  return _exports;
3151
3162
  })();
3152
3163
 
3153
- const _m41 = _modules.get("4d984092c5be653d0d5c8c910638fe0c0d560f8e74ea34c1a7b52b24be29fbf5") ?? (() => {
3164
+ const _m41 = _modules.get("93ad877d48a12898018a8842f86e9c1a073ae9d16e4ddbdf0de422fdb7567732") ?? (() => {
3154
3165
  const { columnName } = _m32;
3155
3166
 
3156
3167
  /** @internal Data-column selectors use stable keys or one-based worksheet columns. */
@@ -3177,11 +3188,11 @@ function qualifiedCell(sheetName, column, row) {
3177
3188
  return qualifiedColumnRange(sheetName, column, row, 1).split(":")[0];
3178
3189
  }
3179
3190
  const _exports = Object.freeze({ resolveDataColumn: resolveDataColumn, qualifiedColumnRange: qualifiedColumnRange, qualifiedCell: qualifiedCell });
3180
- _modules.set("4d984092c5be653d0d5c8c910638fe0c0d560f8e74ea34c1a7b52b24be29fbf5", _exports);
3191
+ _modules.set("93ad877d48a12898018a8842f86e9c1a073ae9d16e4ddbdf0de422fdb7567732", _exports);
3181
3192
  return _exports;
3182
3193
  })();
3183
3194
 
3184
- const _m42 = _modules.get("216c77d37374c34583daebcedae5d725280614b84266d0048b25fc94d816bbad") ?? (() => {
3195
+ const _m42 = _modules.get("e988da1cd05e9b574b66f0b3e28e40168bcc06e9ec1cdb023e42f358770b7fad") ?? (() => {
3185
3196
  const { OfficeIMOError } = _m2;
3186
3197
 
3187
3198
  const { columnName } = _m32;
@@ -3224,11 +3235,11 @@ function dataRowReference(firstColumn, lastColumn, headerRows, dataRows, ranges)
3224
3235
  return reference || undefined;
3225
3236
  }
3226
3237
  const _exports = Object.freeze({ retainDataRowRanges: retainDataRowRanges, dataRowRanges: dataRowRanges, dataRowCount: dataRowCount, dataRowReference: dataRowReference });
3227
- _modules.set("216c77d37374c34583daebcedae5d725280614b84266d0048b25fc94d816bbad", _exports);
3238
+ _modules.set("e988da1cd05e9b574b66f0b3e28e40168bcc06e9ec1cdb023e42f358770b7fad", _exports);
3228
3239
  return _exports;
3229
3240
  })();
3230
3241
 
3231
- const _m40 = _modules.get("a1fdc34474873603d9907928d65684efabe0bfce470a26305f49b46b5fb5b12a") ?? (() => {
3242
+ const _m40 = _modules.get("f1cb0c25677191521382757695257e846c3da2c5657cd5b640aea352094162e6") ?? (() => {
3232
3243
  const { cleanXml, escapeXml, escapeOoxmlAttribute } = _m25;
3233
3244
 
3234
3245
  const { cellPosition } = _m35;
@@ -3394,11 +3405,11 @@ class ConditionalFormats {
3394
3405
  }
3395
3406
  }
3396
3407
  const _exports = Object.freeze({ prepareConditionalFormats: prepareConditionalFormats, ConditionalFormats: ConditionalFormats });
3397
- _modules.set("a1fdc34474873603d9907928d65684efabe0bfce470a26305f49b46b5fb5b12a", _exports);
3408
+ _modules.set("f1cb0c25677191521382757695257e846c3da2c5657cd5b640aea352094162e6", _exports);
3398
3409
  return _exports;
3399
3410
  })();
3400
3411
 
3401
- const _m43 = _modules.get("082c5d69b3ae3fbd0b4477ae5cfd07155401158d890162c4a223eb67ffeb489b") ?? (() => {
3412
+ const _m43 = _modules.get("cf47c14a3d20ea8306932e3174606385830dd257bdb9ffac8c5114724b4d9257") ?? (() => {
3402
3413
  const { OfficeIMOError } = _m2;
3403
3414
 
3404
3415
  const { checkAbort } = _m4;
@@ -3498,11 +3509,11 @@ function* dataValidationsXml(prepared, headerRows, dataRows, ranges) {
3498
3509
  yield '</dataValidations>';
3499
3510
  }
3500
3511
  const _exports = Object.freeze({ prepareDataValidations: prepareDataValidations, dataValidationsXml: dataValidationsXml });
3501
- _modules.set("082c5d69b3ae3fbd0b4477ae5cfd07155401158d890162c4a223eb67ffeb489b", _exports);
3512
+ _modules.set("cf47c14a3d20ea8306932e3174606385830dd257bdb9ffac8c5114724b4d9257", _exports);
3502
3513
  return _exports;
3503
3514
  })();
3504
3515
 
3505
- const _m34 = _modules.get("5d200c22b866a7be40782b9b348f2ad3b781abd8434f420d780e89aa65ede587") ?? (() => {
3516
+ const _m34 = _modules.get("03e235a81010f60bce2d7cc02a313dd95b5b2b77d09535b160ae02a3556c55b4") ?? (() => {
3506
3517
  const { checkAbort, consumeRows, inputRows, pause, taskYieldDue } = _m4;
3507
3518
 
3508
3519
  const { ChunkedTextSink, BlobByteSink } = _m3;
@@ -4224,11 +4235,11 @@ class Worksheet {
4224
4235
  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); }
4225
4236
  }
4226
4237
  const _exports = Object.freeze({ Worksheet: Worksheet });
4227
- _modules.set("5d200c22b866a7be40782b9b348f2ad3b781abd8434f420d780e89aa65ede587", _exports);
4238
+ _modules.set("03e235a81010f60bce2d7cc02a313dd95b5b2b77d09535b160ae02a3556c55b4", _exports);
4228
4239
  return _exports;
4229
4240
  })();
4230
4241
 
4231
- const _m44 = _modules.get("87ebdbcd48a4e7d39257ef5bdfe726a889dbf5eaf3cd3f51a0205bf65090f6cf") ?? (() => {
4242
+ const _m44 = _modules.get("69b817e85a5cf991b2c75390de7cfb5657f53786c2bf2221e310d489f4e50fa0") ?? (() => {
4232
4243
  const { escapeOoxmlAttribute, escapeXml, xmlDeclaration } = _m25;
4233
4244
 
4234
4245
  const { cellText, columnName } = _m32;
@@ -4271,11 +4282,11 @@ function tableXml(table, rowCount, policy, headerRow = 1, footer) {
4271
4282
  '" showColumnStripes="' + (options.bandedColumns ? 1 : 0) + '"/></table>';
4272
4283
  }
4273
4284
  const _exports = Object.freeze({ defineTable: defineTable, tableXml: tableXml });
4274
- _modules.set("87ebdbcd48a4e7d39257ef5bdfe726a889dbf5eaf3cd3f51a0205bf65090f6cf", _exports);
4285
+ _modules.set("69b817e85a5cf991b2c75390de7cfb5657f53786c2bf2221e310d489f4e50fa0", _exports);
4275
4286
  return _exports;
4276
4287
  })();
4277
4288
 
4278
- const _m45 = _modules.get("9c165af1760666d37381c410b96136694d28d86e1e5fcf4847f2d1087bb952f4") ?? (() => {
4289
+ const _m45 = _modules.get("326038be5df97f3a5a5909d06720e4b63162b0f69961c79600f915e768bd41fb") ?? (() => {
4279
4290
  const { OfficeIMOError } = _m2;
4280
4291
 
4281
4292
  const { cleanXml } = _m25;
@@ -4339,7 +4350,7 @@ function* splitText(text) {
4339
4350
  }
4340
4351
  }
4341
4352
  const _exports = Object.freeze({ TextOverflow: TextOverflow, clipText: clipText });
4342
- _modules.set("9c165af1760666d37381c410b96136694d28d86e1e5fcf4847f2d1087bb952f4", _exports);
4353
+ _modules.set("326038be5df97f3a5a5909d06720e4b63162b0f69961c79600f915e768bd41fb", _exports);
4343
4354
  return _exports;
4344
4355
  })();
4345
4356
 
@@ -4366,7 +4377,7 @@ _modules.set("e00bc0213b723678d050e3e1f11b39ed3d6b0b0fd6a39b403beb1a6bef69e282",
4366
4377
  return _exports;
4367
4378
  })();
4368
4379
 
4369
- const _m48 = _modules.get("bd66b325c9055258132735218be91a78281910aaac042bcac4c5b0f594e35379") ?? (() => {
4380
+ const _m48 = _modules.get("5fcd8ab43752d758bd1b311eae9378643c828dfca1de2875b2bd5f16fc8b4abc") ?? (() => {
4370
4381
  const { checkAbort } = _m4;
4371
4382
 
4372
4383
  const { NotSupportedError, OfficeIMOError } = _m2;
@@ -4494,11 +4505,11 @@ function prepareChartBinding(input, descriptor, budgets, signal, type = "columnC
4494
4505
  }, finish });
4495
4506
  }
4496
4507
  const _exports = Object.freeze({ captureChartRange: captureChartRange, prepareChartBinding: prepareChartBinding });
4497
- _modules.set("bd66b325c9055258132735218be91a78281910aaac042bcac4c5b0f594e35379", _exports);
4508
+ _modules.set("5fcd8ab43752d758bd1b311eae9378643c828dfca1de2875b2bd5f16fc8b4abc", _exports);
4498
4509
  return _exports;
4499
4510
  })();
4500
4511
 
4501
- const _m47 = _modules.get("1a72338dda567009c435c547ffc3b6a8e798369b5455bb94c629f8fab0771eb7") ?? (() => {
4512
+ const _m47 = _modules.get("28c1f1e37db546192ff92887f5cf59224cf6b98370eb79848e428946a7000e76") ?? (() => {
4502
4513
  const { checkAbort } = _m4;
4503
4514
 
4504
4515
  const { NotSupportedError, OfficeIMOError } = _m2;
@@ -4665,11 +4676,11 @@ function prepareChart(input, policy, availablePoints, availableText, signal, res
4665
4676
  points, textCharacters });
4666
4677
  }
4667
4678
  const _exports = Object.freeze({ prepareChart: prepareChart });
4668
- _modules.set("1a72338dda567009c435c547ffc3b6a8e798369b5455bb94c629f8fab0771eb7", _exports);
4679
+ _modules.set("28c1f1e37db546192ff92887f5cf59224cf6b98370eb79848e428946a7000e76", _exports);
4669
4680
  return _exports;
4670
4681
  })();
4671
4682
 
4672
- const _m21 = _modules.get("ae55b8ef5a8ee860d084264e4184cae35d6b359c73b70c059503e435df68f397") ?? (() => {
4683
+ const _m21 = _modules.get("982718d202723335e72aab0c32adf982f3bdaba804612744478ab794f3c9386c") ?? (() => {
4673
4684
  const { beginTask, checkAbort, pause, taskYieldDue } = _m4;
4674
4685
 
4675
4686
  const { OfficeIMOError } = _m2;
@@ -5144,7 +5155,7 @@ class Workbook {
5144
5155
  }
5145
5156
  }
5146
5157
  const _exports = Object.freeze({ Workbook: Workbook });
5147
- _modules.set("ae55b8ef5a8ee860d084264e4184cae35d6b359c73b70c059503e435df68f397", _exports);
5158
+ _modules.set("982718d202723335e72aab0c32adf982f3bdaba804612744478ab794f3c9386c", _exports);
5148
5159
  return _exports;
5149
5160
  })();
5150
5161
 
@@ -5201,7 +5212,7 @@ _modules.set("89111eab1f3857529c2d0cd849f16598097e62bd73841211b9c66ccc7b1b7ca2",
5201
5212
  return _exports;
5202
5213
  })();
5203
5214
 
5204
- const _m49 = _modules.get("d4f8b447d0a2834af0ecb5f89766e5402a65980c89f3a4973b4493cac65051b4") ?? (() => {
5215
+ const _m49 = _modules.get("59ef9ad8736be48605a1d5005a096b977be8e44c0d2a4249345127b2b7f81339") ?? (() => {
5205
5216
  const { withDestination } = _m3;
5206
5217
 
5207
5218
  const { copyColumns } = _m11;
@@ -5256,11 +5267,11 @@ async function writeXlsxTo(rows, destination, configuration) {
5256
5267
  });
5257
5268
  }
5258
5269
  const _exports = Object.freeze({ writeXlsx: writeXlsx, writeXlsxTo: writeXlsxTo });
5259
- _modules.set("d4f8b447d0a2834af0ecb5f89766e5402a65980c89f3a4973b4493cac65051b4", _exports);
5270
+ _modules.set("59ef9ad8736be48605a1d5005a096b977be8e44c0d2a4249345127b2b7f81339", _exports);
5260
5271
  return _exports;
5261
5272
  })();
5262
5273
 
5263
- const _m52 = _modules.get("1c910dc1be8cd6844c1384524ba7c64dc75d80ff09de2fbd5a4752b9cdfd943b") ?? (() => {
5274
+ const _m52 = _modules.get("de7c4720443cbafe0e11a1142f952c4977c47158c42f0a20704db65e3a19bf8b") ?? (() => {
5264
5275
  const { assertGroupedReportSource } = _m8;
5265
5276
 
5266
5277
  const { captureFields } = _m10;
@@ -5349,11 +5360,11 @@ function prepareGroupedSheet(report, configuration, maxConditionalFormats = 1000
5349
5360
  ...(options.grandTotalStyle ? { grandTotalStyle: copyStylePatch(options.grandTotalStyle) } : {}) };
5350
5361
  }
5351
5362
  const _exports = Object.freeze({ groupedOptionFields: groupedOptionFields, prepareGroupedSheet: prepareGroupedSheet });
5352
- _modules.set("1c910dc1be8cd6844c1384524ba7c64dc75d80ff09de2fbd5a4752b9cdfd943b", _exports);
5363
+ _modules.set("de7c4720443cbafe0e11a1142f952c4977c47158c42f0a20704db65e3a19bf8b", _exports);
5353
5364
  return _exports;
5354
5365
  })();
5355
5366
 
5356
- const _m51 = _modules.get("59f736fd5084497af8fb6fd211c910f5980174a39d31641216eda50f6d78bb63") ?? (() => {
5367
+ const _m51 = _modules.get("50d544d4c980d1a8f6a81b2d3e376bf92bed5c415a275b6eacacdb86b15d57b0") ?? (() => {
5357
5368
  const { groupedReportOperation } = _m8;
5358
5369
 
5359
5370
  const { checkAbort, withAbort } = _m4;
@@ -5526,14 +5537,14 @@ async function writeGroupedXlsxTo(report, destination, options) {
5526
5537
  return withDestination(destination, async (sink) => (await write(report, prepared, sink)).result);
5527
5538
  }
5528
5539
  const _exports = Object.freeze({ addGroupedXlsx: addGroupedXlsx, writeGroupedXlsx: writeGroupedXlsx, writeGroupedXlsxTo: writeGroupedXlsxTo });
5529
- _modules.set("59f736fd5084497af8fb6fd211c910f5980174a39d31641216eda50f6d78bb63", _exports);
5540
+ _modules.set("50d544d4c980d1a8f6a81b2d3e376bf92bed5c415a275b6eacacdb86b15d57b0", _exports);
5530
5541
  return _exports;
5531
5542
  })();
5532
5543
 
5533
- const _m20 = _modules.get("5f2337c50c0e9b88b7a8095f5b5df2f3fde33723e3115223465178731cfab42d") ?? (() => {
5544
+ const _m20 = _modules.get("d494060a59e45633a76ad2e4aeb08b6ffbc730ce6c4d50686aa4e3a51ad0ed6e") ?? (() => {
5534
5545
 
5535
5546
  const _exports = Object.freeze({ Workbook: _m21.Workbook, writeXlsx: _m49.writeXlsx, writeXlsxTo: _m49.writeXlsxTo, writeGroupedXlsx: _m51.writeGroupedXlsx, writeGroupedXlsxTo: _m51.writeGroupedXlsxTo, addGroupedXlsx: _m51.addGroupedXlsx, createGroupedReport: _m8.createGroupedReport, Worksheet: _m34.Worksheet, Cell: _m32.Cell, FormulaCell: _m33.FormulaCell, StyleRegistry: _m29.StyleRegistry, NumberFormats: _m29.NumberFormats, saveBlob: _m1.saveBlob, ExportCell: _m5.ExportCell });
5536
- _modules.set("5f2337c50c0e9b88b7a8095f5b5df2f3fde33723e3115223465178731cfab42d", _exports);
5547
+ _modules.set("d494060a59e45633a76ad2e4aeb08b6ffbc730ce6c4d50686aa4e3a51ad0ed6e", _exports);
5537
5548
  return _exports;
5538
5549
  })();
5539
5550
 
@@ -5646,7 +5657,7 @@ _modules.set("278e6adc6a5d4491e688589ef165bd1aa9cc74f557da6f9d6bdf53ecc0c6df47",
5646
5657
  return _exports;
5647
5658
  })();
5648
5659
 
5649
- const _m55 = _modules.get("87a3335ede8f46b6e42f2c03e68f3df802321aa23c52dc4cdfb11165529a5270") ?? (() => {
5660
+ const _m55 = _modules.get("4a089607f7cbe50e13d4382d1cc4e5f6ce32c5773bbec2df84178710f54d9a38") ?? (() => {
5650
5661
  const { OfficeIMOError } = _m2;
5651
5662
 
5652
5663
  const { ExportBudget } = _m9;
@@ -5721,10 +5732,34 @@ function captureWideTable(input) {
5721
5732
  if (repeatColumns !== undefined && !Array.isArray(repeatColumns))
5722
5733
  throw new TypeError("repeatColumns must be an array.");
5723
5734
  const repeats = repeatColumns === undefined ? [] : [...repeatColumns];
5724
- if (repeats.some((value, index) => !Number.isSafeInteger(value) || value < 0 || index > 0 && value <= repeats[index - 1]))
5725
- throw new RangeError("repeatColumns must contain sorted unique nonnegative indices.");
5735
+ if (repeats.some(value => typeof value === "number" ? !Number.isSafeInteger(value) || value < 0 : typeof value !== "string" || !value.length))
5736
+ throw new RangeError("repeatColumns must contain nonnegative indices or nonempty stable keys.");
5737
+ if (repeats.every(value => typeof value === "number") && repeats.some((value, index) => index > 0 && value <= repeats[index - 1]))
5738
+ throw new RangeError("Numeric repeatColumns must contain sorted unique nonnegative indices.");
5726
5739
  return Object.freeze({ mode, ...(minimumColumnWidth === undefined ? {} : { minimumColumnWidth }), repeatColumns: Object.freeze(repeats) });
5727
5740
  }
5741
+ /** Resolve identities against this table's captured selection, without consulting a grid or opening its rows. */
5742
+ function repeatedColumns(policy, columns) {
5743
+ if (typeof policy !== "object")
5744
+ return Object.freeze([]);
5745
+ const selected = new Set();
5746
+ for (const selector of policy.repeatColumns ?? []) {
5747
+ let position;
5748
+ if (typeof selector === "number")
5749
+ position = selector;
5750
+ else {
5751
+ position = columns.findIndex(column => column.key === selector);
5752
+ if (position < 0 || columns.some((column, index) => index !== position && column.key === selector))
5753
+ throw new TypeError("repeatColumns requires an unambiguous selected column key: " + selector);
5754
+ }
5755
+ if (position >= columns.length)
5756
+ throw new RangeError("repeatColumns index exceeds the declared columns.");
5757
+ if (selected.has(position))
5758
+ throw new TypeError("repeatColumns selects the same column more than once.");
5759
+ selected.add(position);
5760
+ }
5761
+ return Object.freeze([...selected].sort((left, right) => left - right));
5762
+ }
5728
5763
  function settings(input, document = false) {
5729
5764
  const configuration = { ...capturePdfOptions(input) };
5730
5765
  configuration.booleanText = captureBooleanText(configuration.booleanText);
@@ -5826,18 +5861,78 @@ function settings(input, document = false) {
5826
5861
  }
5827
5862
  const maxImageWorkingBytes = options.limits?.maxImageWorkingBytes;
5828
5863
  return { options: { ...options, paragraphStyles }, paragraphStyles, page, margins, fontSize, padding,
5864
+ repeatedColumns: document ? Object.freeze([]) : repeatedColumns(options.wideTable, columns),
5829
5865
  limits: { ...limits, ...(maxImageWorkingBytes === undefined ? {} : { maxImageWorkingBytes }) }, budget };
5830
5866
  }
5831
5867
  const _exports = Object.freeze({ positive: _m57.positive, color: _m57.color, presentation: _m57.presentation, pdfOptionFields: pdfOptionFields, pdfLimitFields: pdfLimitFields, capturePdfOptions: capturePdfOptions, capturePdfLimits: capturePdfLimits, captureWideTable: captureWideTable, settings: settings });
5832
- _modules.set("87a3335ede8f46b6e42f2c03e68f3df802321aa23c52dc4cdfb11165529a5270", _exports);
5868
+ _modules.set("4a089607f7cbe50e13d4382d1cc4e5f6ce32c5773bbec2df84178710f54d9a38", _exports);
5869
+ return _exports;
5870
+ })();
5871
+
5872
+ const _m60 = _modules.get("e3d39f39aebcbaf063fd8221df0d9cb5902ad2545a9d9e474bb59d47f15e2c01") ?? (() => {
5873
+ /** @internal One type byte, an eight-byte offset/container number and a two-byte generation/index. */
5874
+ const pdfXrefEntryBytes = 11;
5875
+ function unsigned(bytes, offset, value, width) {
5876
+ if (!Number.isSafeInteger(value) || value < 0 || value >= 2 ** (width * 8))
5877
+ throw new RangeError("Invalid PDF cross-reference field.");
5878
+ // Bitwise shifts truncate to 32 bits. Arithmetic preserves every supported byte offset.
5879
+ for (let index = width - 1; index >= 0; index--) {
5880
+ bytes[offset + index] = value % 256;
5881
+ value = Math.floor(value / 256);
5882
+ }
5883
+ }
5884
+ /** @internal Stream a complete single-section xref, including its own ordinary-object entry.
5885
+ * A defined member index means that the location is an object-stream number rather than a byte offset. */
5886
+ function* pdfXrefChunks(locations, indices) {
5887
+ if (locations.length !== indices.length)
5888
+ throw new Error("PDF cross-reference locations must align.");
5889
+ const perChunk = Math.floor(32768 / pdfXrefEntryBytes);
5890
+ for (let first = 0; first < locations.length; first += perChunk) {
5891
+ const count = Math.min(perChunk, locations.length - first), bytes = new Uint8Array(count * pdfXrefEntryBytes);
5892
+ for (let index = 0; index < count; index++) {
5893
+ const id = first + index, position = index * pdfXrefEntryBytes, location = locations[id], member = indices.at(id);
5894
+ if (location === undefined)
5895
+ throw new Error("PDF contains unwritten objects.");
5896
+ bytes[position] = id === 0 ? 0 : member === undefined ? 1 : 2;
5897
+ unsigned(bytes, position + 1, location, 8);
5898
+ unsigned(bytes, position + 9, id === 0 ? 65535 : member ?? 0, 2);
5899
+ }
5900
+ yield bytes;
5901
+ }
5902
+ }
5903
+ const _exports = Object.freeze({ pdfXrefEntryBytes: pdfXrefEntryBytes, pdfXrefChunks: pdfXrefChunks });
5904
+ _modules.set("e3d39f39aebcbaf063fd8221df0d9cb5902ad2545a9d9e474bb59d47f15e2c01", _exports);
5833
5905
  return _exports;
5834
5906
  })();
5835
5907
 
5836
- const _m59 = _modules.get("5424d3dd13b6ba1c76052de820b3d99e9bac24c012ea36e41b04fd99c779ee8c") ?? (() => {
5908
+ const _m59 = _modules.get("e716b8b1da464094622f5f671518493c78e63ff22a029d61544d2d193b63ce8f") ?? (() => {
5837
5909
  const { checkAbort, withAbort, pause, taskYieldDue } = _m4;
5838
5910
 
5839
5911
  const { OfficeIMOError } = _m2;
5840
5912
 
5913
+ const { pdfXrefChunks, pdfXrefEntryBytes } = _m60;
5914
+
5915
+ const compactObjectCount = 256, compactObjectBytes = 32768;
5916
+ const compactIndexChunkEntries = 4096;
5917
+ /** Lazy Uint16 chunks store compact membership; untouched zero slots denote ordinary objects. */
5918
+ class PdfCompactIndices {
5919
+ count;
5920
+ chunks = [];
5921
+ constructor(count) {
5922
+ this.count = count;
5923
+ }
5924
+ get length() { return this.count; }
5925
+ reserve() { this.count++; }
5926
+ set(id, member) {
5927
+ const chunk = this.chunks[Math.floor(id / compactIndexChunkEntries)] ??= new Uint16Array(compactIndexChunkEntries);
5928
+ // The current batch cap permits indices 0..255; adding one preserves index 255 as 256.
5929
+ chunk[id % compactIndexChunkEntries] = member + 1;
5930
+ }
5931
+ at(id) {
5932
+ const encoded = this.chunks[Math.floor(id / compactIndexChunkEntries)]?.[id % compactIndexChunkEntries] ?? 0;
5933
+ return encoded ? encoded - 1 : undefined;
5934
+ }
5935
+ }
5841
5936
  function pdfNumber(value) {
5842
5937
  if (!Number.isFinite(value) || Math.abs(value) > 1e9)
5843
5938
  throw new RangeError("PDF coordinates and metrics must be finite and bounded.");
@@ -5854,25 +5949,33 @@ function unicodeHex(text) {
5854
5949
  }
5855
5950
  return hex;
5856
5951
  }
5857
- /** @internal Forward-only PDF objects. Only xref offsets and page references survive a completed page. */
5952
+ /** @internal Forward-only PDF objects. Completed objects retain only their xref location. */
5858
5953
  class PdfObjects {
5859
5954
  sink;
5860
5955
  signal;
5861
5956
  maxBytes;
5957
+ compressObjects;
5862
5958
  offsets = [0];
5959
+ // A defined index changes the corresponding full-width offset into an object-stream number.
5960
+ // Membership chunks are allocated only when a compact member needs their ID range.
5961
+ compactIndices;
5962
+ compactBatch;
5963
+ compactArena;
5964
+ compactUnavailable = false;
5863
5965
  encoder = new TextEncoder();
5864
5966
  buffer = new Uint8Array(32768);
5865
5967
  buffered = 0;
5866
5968
  bytes = 0;
5867
- constructor(sink, signal, maxBytes = Number.MAX_SAFE_INTEGER) {
5969
+ constructor(sink, signal, maxBytes = Number.MAX_SAFE_INTEGER, compressObjects = false) {
5868
5970
  this.sink = sink;
5869
5971
  this.signal = signal;
5870
5972
  this.maxBytes = maxBytes;
5973
+ this.compressObjects = compressObjects;
5871
5974
  }
5872
- reserve() { this.offsets.push(undefined); return this.offsets.length - 1; }
5975
+ reserve() { this.offsets.push(undefined); this.compactIndices?.reserve(); return this.offsets.length - 1; }
5873
5976
  async raw(bytes) {
5874
5977
  checkAbort(this.signal);
5875
- if (this.bytes + bytes.length > this.maxBytes)
5978
+ if (!Number.isSafeInteger(this.bytes + bytes.length) || this.bytes + bytes.length > this.maxBytes)
5876
5979
  throw new OfficeIMOError("RESOURCE_LIMIT", "maxOutputBytes exceeded.");
5877
5980
  this.bytes += bytes.length;
5878
5981
  for (let offset = 0; offset < bytes.length;) {
@@ -5881,21 +5984,139 @@ class PdfObjects {
5881
5984
  offset += n;
5882
5985
  this.buffered += n;
5883
5986
  if (this.buffered === this.buffer.length)
5884
- await this.flush();
5987
+ await this.flushBytes();
5885
5988
  }
5886
5989
  }
5887
5990
  async text(text) { await this.raw(this.encoder.encode(text)); }
5888
5991
  async flush() {
5992
+ await this.flushCompact();
5993
+ await this.flushBytes();
5994
+ }
5995
+ /** Publish completed page bytes without forcing a partial structure container to end. */
5996
+ async flushBytes() {
5889
5997
  if (this.buffered) {
5890
5998
  const bytes = this.buffer.subarray(0, this.buffered);
5891
5999
  await withAbort(Promise.resolve(this.sink.write(bytes)), this.signal);
5892
- this.buffer = new Uint8Array(32768);
6000
+ // The sink borrows this view until acceptance; failed or cancelled writes must not reuse it.
5893
6001
  this.buffered = 0;
5894
6002
  }
5895
6003
  if (taskYieldDue())
5896
6004
  await pause();
5897
6005
  checkAbort(this.signal);
5898
6006
  }
6007
+ /** @internal Append only when an existing compact batch can accept a member without async work. */
6008
+ tryCompactObject(id, body) {
6009
+ checkAbort(this.signal);
6010
+ this.validateObject(id);
6011
+ const batch = this.compactBatch;
6012
+ if (!batch || !this.compressObjects || this.compactUnavailable || typeof CompressionStream !== "function" ||
6013
+ body.length > compactObjectBytes || batch.ids.length + 1 >= compactObjectCount)
6014
+ return false;
6015
+ const indexBytes = String(id).length + String(batch.bodyBytes).length + 2;
6016
+ const written = this.encodeCompactBody(body, batch.bodyBytes, compactObjectBytes - batch.indexBytes - indexBytes - batch.bodyBytes - 2);
6017
+ if (written === undefined)
6018
+ return false;
6019
+ this.storeCompactBody(batch, id, written);
6020
+ return true;
6021
+ }
6022
+ /** Small logical structure values share one bounded object-stream container. Other callers keep
6023
+ * ordinary objects; unavailable deflate preserves the classic representation before packing starts. */
6024
+ async compactObject(id, body) {
6025
+ checkAbort(this.signal);
6026
+ this.validateObject(id);
6027
+ if (!this.compressObjects || this.compactUnavailable || body.length > compactObjectBytes)
6028
+ return this.object(id, body);
6029
+ if (typeof CompressionStream !== "function") {
6030
+ if (this.compactIndices)
6031
+ throw new Error("PDF object compression became unavailable.");
6032
+ this.compactUnavailable = true;
6033
+ return this.object(id, body);
6034
+ }
6035
+ const firstIndexBytes = String(id).length + 4;
6036
+ let batch = this.compactBatch;
6037
+ const indexBytes = String(id).length + String(batch?.bodyBytes ?? 0).length + 2;
6038
+ let written = batch && batch.ids.length < compactObjectCount ? this.encodeCompactBody(body, batch.bodyBytes, compactObjectBytes - batch.indexBytes - indexBytes - batch.bodyBytes - 2) : undefined;
6039
+ if (batch && written === undefined) {
6040
+ // Partial encodings only touch the uncommitted suffix. Flush the committed prefix and retry
6041
+ // the whole string so a multibyte scalar is never split between containers.
6042
+ await this.flushCompact();
6043
+ batch = undefined;
6044
+ checkAbort(this.signal);
6045
+ }
6046
+ if (!batch) {
6047
+ written = this.encodeCompactBody(body, 0, compactObjectBytes - firstIndexBytes - 1);
6048
+ if (written === undefined)
6049
+ return this.object(id, body);
6050
+ let compressor;
6051
+ // Probe before selecting the compact representation. Later batches need no idle native
6052
+ // codec while they accumulate, including while ordinary page streams are compressed.
6053
+ if (!this.compactIndices) {
6054
+ try {
6055
+ compressor = new CompressionStream("deflate");
6056
+ }
6057
+ catch {
6058
+ this.compactUnavailable = true;
6059
+ return this.object(id, body);
6060
+ }
6061
+ }
6062
+ batch = { id: this.reserve(), compressor, ids: [], bodyOffsets: [], bodyBytes: 0, indexBytes: 1 };
6063
+ this.compactIndices ??= new PdfCompactIndices(this.offsets.length);
6064
+ this.compactBatch = batch;
6065
+ }
6066
+ this.storeCompactBody(batch, id, written);
6067
+ if (batch.ids.length === compactObjectCount)
6068
+ await this.flushCompact();
6069
+ }
6070
+ storeCompactBody(batch, id, written) {
6071
+ this.offsets[id] = batch.id;
6072
+ this.compactIndices.set(id, batch.ids.length);
6073
+ batch.indexBytes += String(id).length + String(batch.bodyBytes).length + 2;
6074
+ batch.ids.push(id);
6075
+ batch.bodyOffsets.push(batch.bodyBytes);
6076
+ this.compactArena[batch.bodyBytes + written] = 10;
6077
+ batch.bodyBytes += written + 1;
6078
+ }
6079
+ /** An incomplete encoding leaves only scratch bytes beyond the committed batch prefix. */
6080
+ encodeCompactBody(body, offset, available) {
6081
+ if (available < 0)
6082
+ return undefined;
6083
+ const destination = (this.compactArena ??= new Uint8Array(compactObjectBytes)).subarray(offset, offset + available);
6084
+ if (typeof this.encoder.encodeInto === "function") {
6085
+ const result = this.encoder.encodeInto(body, destination);
6086
+ return result.read === body.length ? result.written : undefined;
6087
+ }
6088
+ // Preserve TextEncoder implementations that only expose encode().
6089
+ const bytes = this.encoder.encode(body);
6090
+ if (bytes.length > available)
6091
+ return undefined;
6092
+ destination.set(bytes);
6093
+ return bytes.length;
6094
+ }
6095
+ async flushCompact() {
6096
+ const batch = this.compactBatch;
6097
+ if (!batch)
6098
+ return;
6099
+ this.compactBatch = undefined;
6100
+ let index = "";
6101
+ for (let member = 0; member < batch.ids.length; member++)
6102
+ index += batch.ids[member] + " " + batch.bodyOffsets[member] + " ";
6103
+ const header = this.encoder.encode(index + "\n"), count = batch.ids.length;
6104
+ // Keep the index separate from the arena. Reuse waits for the compressed read or all raw
6105
+ // writes below, so later members cannot overwrite a borrowed batch body.
6106
+ const body = this.compactArena.subarray(0, batch.bodyBytes);
6107
+ batch.ids.length = 0;
6108
+ batch.bodyOffsets.length = 0;
6109
+ if (batch.compressor) {
6110
+ await this.compressedStream(batch.id, body, "/Type /ObjStm /N " + count + " /First " + header.length, batch.compressor, header);
6111
+ }
6112
+ else {
6113
+ this.start(batch.id);
6114
+ await this.text(batch.id + " 0 obj\n<< /Length " + (header.length + body.length) + " /Type /ObjStm /N " + count + " /First " + header.length + " >>\nstream\n");
6115
+ await this.raw(header);
6116
+ await this.raw(body);
6117
+ await this.text("\nendstream\nendobj\n");
6118
+ }
6119
+ }
5899
6120
  async object(id, body) {
5900
6121
  this.start(id);
5901
6122
  if (typeof body === "string") {
@@ -5919,9 +6140,12 @@ class PdfObjects {
5919
6140
  }
5920
6141
  await this.text(chunk + "\nendobj\n");
5921
6142
  }
5922
- start(id) {
5923
- if (!Number.isInteger(id) || id <= 0 || id >= this.offsets.length || this.offsets[id] !== undefined)
6143
+ validateObject(id) {
6144
+ if (!Number.isSafeInteger(id) || id <= 0 || id >= this.offsets.length || this.offsets[id] !== undefined)
5924
6145
  throw new Error("Invalid PDF object state.");
6146
+ }
6147
+ start(id) {
6148
+ this.validateObject(id);
5925
6149
  this.offsets[id] = this.bytes;
5926
6150
  }
5927
6151
  async stream(id, source, dictionary = "", compression = true, owned = false) {
@@ -5942,7 +6166,15 @@ class PdfObjects {
5942
6166
  }
5943
6167
  // Verified internal producers can transfer immutable ownership; other byte sources retain the defensive snapshot.
5944
6168
  const sourceBytes = typeof source === "string" || owned ? bytes : new Uint8Array(bytes);
5945
- const input = new ReadableStream({ start(controller) { controller.enqueue(sourceBytes); controller.close(); } });
6169
+ await this.compressedStream(id, sourceBytes, dictionary, compressor);
6170
+ }
6171
+ async compressedStream(id, sourceBytes, dictionary, compressor, prefix) {
6172
+ const input = new ReadableStream({ start(controller) {
6173
+ if (prefix)
6174
+ controller.enqueue(prefix);
6175
+ controller.enqueue(sourceBytes);
6176
+ controller.close();
6177
+ } });
5946
6178
  const reader = input.pipeThrough(compressor).getReader(), lengthId = this.reserve();
5947
6179
  let length = 0, complete = false;
5948
6180
  try {
@@ -5967,10 +6199,14 @@ class PdfObjects {
5967
6199
  }
5968
6200
  }
5969
6201
  async finish(root, info) {
5970
- if (this.offsets.slice(1).some(offset => offset === undefined))
5971
- throw new Error("PDF contains unwritten objects.");
6202
+ await this.flushCompact();
6203
+ for (let id = 1; id < this.offsets.length; id++)
6204
+ if (this.offsets[id] === undefined)
6205
+ throw new Error("PDF contains unwritten objects.");
5972
6206
  if (this.bytes > 9999999999)
5973
6207
  throw new OfficeIMOError("RESOURCE_LIMIT", "PDF exceeds classic cross-reference offset capacity.");
6208
+ if (this.compactIndices)
6209
+ return this.finishCompact(root, info);
5974
6210
  const start = this.bytes;
5975
6211
  await this.text("xref\n0 " + this.offsets.length + "\n0000000000 65535 f \n");
5976
6212
  for (let i = 1; i < this.offsets.length; i++)
@@ -5978,13 +6214,27 @@ class PdfObjects {
5978
6214
  await this.text("trailer\n<< /Size " + this.offsets.length + " /Root " + root + " 0 R /Info " + info + " 0 R >>\nstartxref\n" + start + "\n%%EOF\n");
5979
6215
  await this.flush();
5980
6216
  }
6217
+ /** Xref payloads have a known length and are emitted in bounded chunks, without another copy
6218
+ * of the document's random-access location arrays or a whole-xref compression buffer. */
6219
+ async finishCompact(root, info) {
6220
+ const id = this.reserve(), start = this.bytes, length = this.offsets.length * pdfXrefEntryBytes;
6221
+ if (!Number.isSafeInteger(length))
6222
+ throw new OfficeIMOError("RESOURCE_LIMIT", "PDF cross-reference stream is too large.");
6223
+ this.start(id);
6224
+ await this.text(id + " 0 obj\n<< /Type /XRef /Size " + this.offsets.length + " /W [1 8 2] /Root " + root + " 0 R /Info " + info +
6225
+ " 0 R /Length " + length + " >>\nstream\n");
6226
+ for (const chunk of pdfXrefChunks(this.offsets, this.compactIndices))
6227
+ await this.raw(chunk);
6228
+ await this.text("\nendstream\nendobj\nstartxref\n" + start + "\n%%EOF\n");
6229
+ await this.flushBytes();
6230
+ }
5981
6231
  }
5982
6232
  const _exports = Object.freeze({ pdfNumber: pdfNumber, unicodeHex: unicodeHex, PdfObjects: PdfObjects });
5983
- _modules.set("5424d3dd13b6ba1c76052de820b3d99e9bac24c012ea36e41b04fd99c779ee8c", _exports);
6233
+ _modules.set("e716b8b1da464094622f5f671518493c78e63ff22a029d61544d2d193b63ce8f", _exports);
5984
6234
  return _exports;
5985
6235
  })();
5986
6236
 
5987
- const _m63 = _modules.get("1e169e6ecdeceff319b5da4bf01f4c653c1a3d9e8ad696b141bf8ac52d9f446c") ?? (() => {
6237
+ const _m64 = _modules.get("1e169e6ecdeceff319b5da4bf01f4c653c1a3d9e8ad696b141bf8ac52d9f446c") ?? (() => {
5988
6238
  /** @internal Bounded big-endian reader used for caller-provided TrueType programs. */
5989
6239
  class FontReader {
5990
6240
  bytes;
@@ -6014,8 +6264,8 @@ _modules.set("1e169e6ecdeceff319b5da4bf01f4c653c1a3d9e8ad696b141bf8ac52d9f446c",
6014
6264
  return _exports;
6015
6265
  })();
6016
6266
 
6017
- const _m64 = _modules.get("0534e48516ba3859978bb5f21d4ddfb17b4276c5e4650a7c7d6d384c25f6b681") ?? (() => {
6018
- const { align4 } = _m63;
6267
+ const _m65 = _modules.get("ecf6c6ab2f9c5f747338d0d59d9f2cae0b006d9d2a210bcb1545db1f046eb80c") ?? (() => {
6268
+ const { align4 } = _m64;
6019
6269
 
6020
6270
  const { checkAbort, pause, taskYieldDue } = _m4;
6021
6271
 
@@ -6235,16 +6485,16 @@ function* checksumSteps(bytes) {
6235
6485
  return sum;
6236
6486
  }
6237
6487
  const _exports = Object.freeze({ subsetTrueType: subsetTrueType, subsetTrueTypeCooperatively: subsetTrueTypeCooperatively });
6238
- _modules.set("0534e48516ba3859978bb5f21d4ddfb17b4276c5e4650a7c7d6d384c25f6b681", _exports);
6488
+ _modules.set("ecf6c6ab2f9c5f747338d0d59d9f2cae0b006d9d2a210bcb1545db1f046eb80c", _exports);
6239
6489
  return _exports;
6240
6490
  })();
6241
6491
 
6242
- const _m62 = _modules.get("77a2a9756cb6f59426300e1b3e601bd68acacdd40e6c30fbeb3cc99607c84891") ?? (() => {
6492
+ const _m63 = _modules.get("2e1fa1582af797386e2e2914c0a27237309b1692a3cc2be688f46590eb74480d") ?? (() => {
6243
6493
  const { NotSupportedError } = _m2;
6244
6494
 
6245
- const { FontReader } = _m63;
6495
+ const { FontReader } = _m64;
6246
6496
 
6247
- const { subsetTrueType, subsetTrueTypeCooperatively } = _m64;
6497
+ const { subsetTrueType, subsetTrueTypeCooperatively } = _m65;
6248
6498
 
6249
6499
  const { checkAbort, pause, taskYieldDue } = _m4;
6250
6500
 
@@ -6480,12 +6730,12 @@ function* parseFont(reader) {
6480
6730
  return { tables, glyphCount, units, ascent, descent, bbox, widths, offsets, canSubset, cmaps };
6481
6731
  }
6482
6732
  const _exports = Object.freeze({ TrueTypeFont: TrueTypeFont });
6483
- _modules.set("77a2a9756cb6f59426300e1b3e601bd68acacdd40e6c30fbeb3cc99607c84891", _exports);
6733
+ _modules.set("2e1fa1582af797386e2e2914c0a27237309b1692a3cc2be688f46590eb74480d", _exports);
6484
6734
  return _exports;
6485
6735
  })();
6486
6736
 
6487
- const _m61 = _modules.get("832d36356946811343532af7b630ef1c2016b6a48d0897282f4be774e20a1de2") ?? (() => {
6488
- const { TrueTypeFont } = _m62;
6737
+ const _m62 = _modules.get("d9c1509dff0538488752433e47cd0927ece5f93c559ad0e32dc56602dfd44596") ?? (() => {
6738
+ const { TrueTypeFont } = _m63;
6489
6739
 
6490
6740
  const { beginTask, checkAbort } = _m4;
6491
6741
 
@@ -6544,11 +6794,11 @@ class PdfFont {
6544
6794
  toBytes() { return fontProgram(this).bytes.slice(); }
6545
6795
  }
6546
6796
  const _exports = Object.freeze({ fontProgram: fontProgram, PdfFont: PdfFont });
6547
- _modules.set("832d36356946811343532af7b630ef1c2016b6a48d0897282f4be774e20a1de2", _exports);
6797
+ _modules.set("d9c1509dff0538488752433e47cd0927ece5f93c559ad0e32dc56602dfd44596", _exports);
6548
6798
  return _exports;
6549
6799
  })();
6550
6800
 
6551
- const _m66 = _modules.get("1ed4965a6e2963a91190baa8a58ada8ce0edde8fe653bcb6609002e872af0d61") ?? (() => {
6801
+ const _m67 = _modules.get("1ed4965a6e2963a91190baa8a58ada8ce0edde8fe653bcb6609002e872af0d61") ?? (() => {
6552
6802
  // Generated by scripts/pdf-widths.mjs from OfficeIMO.Pdf's Adobe AFM-derived metrics.
6553
6803
  const helveticaWidths = new Map([
6554
6804
  [32, [278, 278]],
@@ -6871,12 +7121,12 @@ _modules.set("1ed4965a6e2963a91190baa8a58ada8ce0edde8fe653bcb6609002e872af0d61",
6871
7121
  return _exports;
6872
7122
  })();
6873
7123
 
6874
- const _m65 = _modules.get("cb116ec8bc322f9c03d14c60009ac989d78b64636b24d77b44f5eece758dfbde") ?? (() => {
7124
+ const _m66 = _modules.get("59911f0fe023545e9e97521b268551078bdc4c5f303e446a13b7d52f905e8070") ?? (() => {
6875
7125
  const { OfficeIMOError } = _m2;
6876
7126
 
6877
- const { PdfFont, fontProgram } = _m61;
7127
+ const { PdfFont, fontProgram } = _m62;
6878
7128
 
6879
- const { helveticaWidths } = _m66;
7129
+ const { helveticaWidths } = _m67;
6880
7130
 
6881
7131
  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]));
6882
7132
  /** @internal Called after scalar support succeeds when encoding a standard-font run. */
@@ -6936,21 +7186,22 @@ function selectFont(fonts, bold, italic) {
6936
7186
  return { font, syntheticBold: !!font && bold && !exact, syntheticItalic: !!font && italic && !exact };
6937
7187
  }
6938
7188
  const _exports = Object.freeze({ standardCode: standardCode, resolveScalar: resolveScalar, validateFonts: validateFonts, selectFont: selectFont });
6939
- _modules.set("cb116ec8bc322f9c03d14c60009ac989d78b64636b24d77b44f5eece758dfbde", _exports);
7189
+ _modules.set("59911f0fe023545e9e97521b268551078bdc4c5f303e446a13b7d52f905e8070", _exports);
6940
7190
  return _exports;
6941
7191
  })();
6942
7192
 
6943
- const _m60 = _modules.get("1b9b0585e9faa850e57fc123c307e79711fd1fb6e877b9f14dff1995a019d5b4") ?? (() => {
7193
+ const _m61 = _modules.get("7da602b40c346a3838e75963f9a3f10c95ac5ce08a7b0a23b9d96f8898a01db7") ?? (() => {
6944
7194
  const { NotSupportedError, OfficeIMOError } = _m2;
6945
7195
 
6946
- const { fontProgram } = _m61;
7196
+ const { fontProgram } = _m62;
6947
7197
 
6948
- const { resolveScalar, selectFont, standardCode, validateFonts } = _m65;
7198
+ const { resolveScalar, selectFont, standardCode, validateFonts } = _m66;
6949
7199
 
6950
7200
  const { pdfNumber, unicodeHex } = _m59;
6951
7201
 
6952
7202
  const { checkAbort, pause, taskYieldDue } = _m4;
6953
7203
 
7204
+ const standardHexBytes = Object.freeze(Array.from({ length: 256 }, (_, byte) => byte.toString(16).padStart(2, "0")));
6954
7205
  class PdfFontResource {
6955
7206
  index;
6956
7207
  bold;
@@ -7013,7 +7264,7 @@ class PdfFontResource {
7013
7264
  for (const char of text) {
7014
7265
  const cp = char.codePointAt(0);
7015
7266
  this.width(cp);
7016
- hex += (this.program ? this.mappings.get(cp).cid : standardCode(cp)).toString(16).padStart(this.program ? 4 : 2, "0");
7267
+ hex += this.program ? this.mappings.get(cp).cid.toString(16).padStart(4, "0") : standardHexBytes[standardCode(cp)];
7017
7268
  }
7018
7269
  return "<" + hex + ">";
7019
7270
  }
@@ -7148,11 +7399,11 @@ class PdfFontResources {
7148
7399
  dictionary() { return "<< " + this.resources.map(f => "/" + f.name + " " + f.object + " 0 R").join(" ") + " >>"; }
7149
7400
  }
7150
7401
  const _exports = Object.freeze({ PdfFontResource: PdfFontResource, PdfFontResources: PdfFontResources });
7151
- _modules.set("1b9b0585e9faa850e57fc123c307e79711fd1fb6e877b9f14dff1995a019d5b4", _exports);
7402
+ _modules.set("7da602b40c346a3838e75963f9a3f10c95ac5ce08a7b0a23b9d96f8898a01db7", _exports);
7152
7403
  return _exports;
7153
7404
  })();
7154
7405
 
7155
- const _m68 = _modules.get("4201fbf42dfbfff0db44c5296d810e8eb98e2be18116bac5c8dc4b6046f72e71") ?? (() => {
7406
+ const _m69 = _modules.get("253db2c0eab1f298fda61fb40a5ddaacbf6ad12a7408ee3d8c12d27f88e7ca27") ?? (() => {
7156
7407
  const { OfficeIMOError } = _m2;
7157
7408
 
7158
7409
  const { ExportCell, assertExportValue } = _m5;
@@ -7163,6 +7414,11 @@ const { isDate } = _m6;
7163
7414
 
7164
7415
  const { defaultBooleanText } = _m18;
7165
7416
 
7417
+ /** @internal Charge displayed characters: tabs paint four spaces, while CR/LF only separate lines.
7418
+ * Raw text remains authoritative for input limits and layout. Skip normalization when no text ceiling observes it. */
7419
+ function pdfBudgetText(text, budget) {
7420
+ return budget.limits.maxTextCharacters === undefined ? text : text.replace(/[\t\r\n]/g, character => character === "\t" ? " " : "");
7421
+ }
7166
7422
  function synchronousText(value, name) {
7167
7423
  if (typeof value === "string")
7168
7424
  return value;
@@ -7254,12 +7510,12 @@ function* wrapSteps(text, font, size, width, maxCharacters, maxLines, wrap) {
7254
7510
  }
7255
7511
  return lines;
7256
7512
  }
7257
- const _exports = Object.freeze({ synchronousText: synchronousText, displayText: displayText, wrapText: wrapText, wrapTextCooperatively: wrapTextCooperatively });
7258
- _modules.set("4201fbf42dfbfff0db44c5296d810e8eb98e2be18116bac5c8dc4b6046f72e71", _exports);
7513
+ const _exports = Object.freeze({ pdfBudgetText: pdfBudgetText, synchronousText: synchronousText, displayText: displayText, wrapText: wrapText, wrapTextCooperatively: wrapTextCooperatively });
7514
+ _modules.set("253db2c0eab1f298fda61fb40a5ddaacbf6ad12a7408ee3d8c12d27f88e7ca27", _exports);
7259
7515
  return _exports;
7260
7516
  })();
7261
7517
 
7262
- const _m70 = _modules.get("1a586388978acf7fd9edef2207a526d0d36336e55020e79c863580e612e9d775") ?? (() => {
7518
+ const _m71 = _modules.get("8be3fb029e08d100ce8ffcf50916d5ba7f7bc00d62156cc33815fd58554a9ed6") ?? (() => {
7263
7519
  const { NotSupportedError, OfficeIMOError } = _m2;
7264
7520
 
7265
7521
  const { checkAbort, pause, taskYieldDue, withAbort } = _m4;
@@ -7468,11 +7724,11 @@ async function wrapShapedPdfText(captured, fonts, size, width, settings, wrap) {
7468
7724
  return lines;
7469
7725
  }
7470
7726
  const _exports = Object.freeze({ wrapShapedPdfText: wrapShapedPdfText });
7471
- _modules.set("1a586388978acf7fd9edef2207a526d0d36336e55020e79c863580e612e9d775", _exports);
7727
+ _modules.set("8be3fb029e08d100ce8ffcf50916d5ba7f7bc00d62156cc33815fd58554a9ed6", _exports);
7472
7728
  return _exports;
7473
7729
  })();
7474
7730
 
7475
- const _m69 = _modules.get("b51711edc0702a2ed2cb63ed106ca8b53fcb5c281571cb495a29cb72d37241fe") ?? (() => {
7731
+ const _m70 = _modules.get("0a1c79b51ac9a164b86197239117df6497f45ca2892b423b1ec77a663ccc1c47") ?? (() => {
7476
7732
  const { NotSupportedError, OfficeIMOError } = _m2;
7477
7733
 
7478
7734
  const { copyExportLink } = _m7;
@@ -7481,21 +7737,30 @@ const { checkAbort, pause, taskYieldDue } = _m4;
7481
7737
 
7482
7738
  const { presentation, color } = _m55;
7483
7739
 
7484
- const { wrapShapedPdfText } = _m70;
7740
+ const { wrapShapedPdfText } = _m71;
7485
7741
 
7486
- const { PdfFont } = _m61;
7742
+ const { PdfFont } = _m62;
7487
7743
 
7488
- /** @internal A run list is a PDF presentation value, never an alternate shared table value model. */
7489
- function capturePdfText(value, base, settings, fonts, countEmpty = true) {
7490
- const input = typeof value === "string" ? [{ text: value }] : value;
7744
+ const { pdfBudgetText } = _m69;
7745
+
7746
+ /** @internal Callers supply an owned, validated, frozen base presentation. A run list is a PDF presentation value, never an alternate shared table value model. */
7747
+ function capturePdfText(value, base, settings, fonts, countEmpty = true, reserveBudget = true) {
7748
+ if (typeof value === "string") {
7749
+ if (value.length > settings.limits.maxCellCharacters)
7750
+ throw new OfficeIMOError("RESOURCE_LIMIT", "maxCellCharacters exceeded.");
7751
+ if (reserveBudget && (value.length || countEmpty))
7752
+ settings.budget.reserve(1, pdfBudgetText(value, settings.budget).length);
7753
+ return Object.freeze({ text: value, runs: Object.freeze([Object.freeze({ text: value, style: base })]) });
7754
+ }
7755
+ const input = value;
7491
7756
  if (!Array.isArray(input)) {
7492
7757
  if (input && typeof input.then === "function")
7493
7758
  void Promise.resolve(input).catch(() => { });
7494
7759
  throw new TypeError("PDF text must be a string or a synchronous array of text runs.");
7495
7760
  }
7496
- if (typeof value !== "string" && input.length > settings.limits.maxTextRuns)
7761
+ if (input.length > settings.limits.maxTextRuns)
7497
7762
  throw new OfficeIMOError("RESOURCE_LIMIT", "maxTextRuns exceeded.");
7498
- let characters = 0;
7763
+ let characters = 0, budgetCharacters = 0;
7499
7764
  const runs = [];
7500
7765
  for (const run of input) {
7501
7766
  if (!run || typeof run !== "object" || Object.keys(run).some(key => !["text", "bold", "italic", "color", "link", "font"].includes(key)))
@@ -7511,14 +7776,16 @@ function capturePdfText(value, base, settings, fonts, countEmpty = true) {
7511
7776
  characters += text.length;
7512
7777
  if (characters > settings.limits.maxCellCharacters)
7513
7778
  throw new OfficeIMOError("RESOURCE_LIMIT", "maxCellCharacters exceeded.");
7779
+ if (reserveBudget)
7780
+ budgetCharacters += pdfBudgetText(text, settings.budget).length;
7514
7781
  const style = presentation({ ...base, ...(bold === undefined ? {} : { bold }), ...(italic === undefined ? {} : { italic }), ...(color === undefined ? {} : { color }) });
7515
7782
  if (settings.options.tagged && link !== undefined && text.length && !text.trim())
7516
7783
  throw new TypeError("Tagged PDF inline links require nonempty displayed text.");
7517
7784
  runs.push(Object.freeze({ text, style, ...(font === undefined ? {} : { font }), ...(link === undefined ? {} : { link: copyExportLink(link) }) }));
7518
7785
  }
7519
7786
  // Reserve before allocating a joined rich-text value or retaining it in a kept paragraph chain.
7520
- if (characters || countEmpty)
7521
- settings.budget.reserve(1, characters);
7787
+ if (reserveBudget && (characters || countEmpty))
7788
+ settings.budget.reserve(1, budgetCharacters);
7522
7789
  return Object.freeze({ text: runs.map(run => run.text).join(""), runs: Object.freeze(runs) });
7523
7790
  }
7524
7791
  /** @internal Greedy wrapping over the continuous text stream, preserving run emphasis and URI geometry. */
@@ -7527,8 +7794,39 @@ async function wrapPdfText(captured, fonts, size, width, settings, wrap = true)
7527
7794
  return wrapShapedPdfText(captured, fonts, size, width, settings, wrap);
7528
7795
  const { signal } = settings.options, { text, runs } = captured;
7529
7796
  checkAbort(signal);
7530
- const faces = runs.map(run => fonts.select(run.style.bold, run.style.italic, run.font));
7531
- const fallback = fonts.select(), lines = [];
7797
+ // Keep font-selection order while deferring a single-run face array until wrapping needs it.
7798
+ const single = runs.length === 1 ? runs[0] : undefined;
7799
+ const singleFace = single && fonts.select(single.style.bold, single.style.italic, single.font);
7800
+ const selectedFaces = singleFace ? undefined : runs.map(run => fonts.select(run.style.bold, run.style.italic, run.font));
7801
+ const fallback = fonts.select();
7802
+ // Short fitting runs need no per-character layout arrays. Longer text keeps the existing
7803
+ // cooperative checkpoints; controls or the first overflowing advance use the general path.
7804
+ if (single && text.length > 0 && text.length < 4096) {
7805
+ const run = single, font = singleFace;
7806
+ let widthSoFar = 0, fits = true;
7807
+ for (let offset = 0; offset < text.length;) {
7808
+ const scalar = text.codePointAt(offset);
7809
+ if (scalar === 9 || scalar === 10 || scalar === 13) {
7810
+ fits = false;
7811
+ break;
7812
+ }
7813
+ const advance = font.width(scalar) * size / 1000;
7814
+ if (advance > width + .001 || widthSoFar + advance > width + .001) {
7815
+ fits = false;
7816
+ break;
7817
+ }
7818
+ widthSoFar += advance;
7819
+ offset += scalar > 0xffff ? 2 : 1;
7820
+ }
7821
+ if (fits) {
7822
+ if (settings.limits.maxRowLines < 1)
7823
+ throw new OfficeIMOError("RESOURCE_LIMIT", "maxRowLines exceeded.");
7824
+ return [{ text, width: widthSoFar, segments: [{ text, width: widthSoFar, font,
7825
+ ...(run.style.color === undefined ? {} : { color: run.style.color }), ...(run.link ? { link: run.link } : {}) }],
7826
+ lineHeight: font.lineHeight(size), ascent: Math.max(0, (font.program?.ascent ?? 800) * size / 1000) }];
7827
+ }
7828
+ }
7829
+ const faces = selectedFaces ?? [singleFace], lines = [];
7532
7830
  let chars = [], advances = [], owners = [], measured = 0, breakAt = -1;
7533
7831
  let runIndex = 0, runEnd = runs[0]?.text.length ?? 0, scanned = 0;
7534
7832
  const emit = (count) => {
@@ -7622,23 +7920,21 @@ async function wrapPdfText(captured, fonts, size, width, settings, wrap = true)
7622
7920
  return lines;
7623
7921
  }
7624
7922
  const _exports = Object.freeze({ capturePdfText: capturePdfText, wrapPdfText: wrapPdfText });
7625
- _modules.set("b51711edc0702a2ed2cb63ed106ca8b53fcb5c281571cb495a29cb72d37241fe", _exports);
7923
+ _modules.set("0a1c79b51ac9a164b86197239117df6497f45ca2892b423b1ec77a663ccc1c47", _exports);
7626
7924
  return _exports;
7627
7925
  })();
7628
7926
 
7629
- const _m71 = _modules.get("58480ded0056f234aea5e0c26637308eea7708e97ccc9987242b62c4dbc4f9b8") ?? (() => {
7927
+ const _m72 = _modules.get("9a88773878eacc51df9f05bb5ee90cc2b683b083ebea8fb54375092301388e96") ?? (() => {
7630
7928
  const { OfficeIMOError } = _m2;
7631
7929
 
7632
- const { wrapPdfText } = _m69;
7930
+ const { wrapPdfText } = _m70;
7633
7931
 
7634
7932
  /** Plan without opening a source. Exact column widths never shrink in band mode. */
7635
7933
  function planTableBands(widths, settings) {
7636
7934
  const policy = settings.options.wideTable;
7637
7935
  if (typeof policy !== "object")
7638
7936
  return undefined;
7639
- const available = settings.page.width - settings.margins.left - settings.margins.right, repeats = policy.repeatColumns ?? [];
7640
- if (repeats.some(index => index >= widths.length))
7641
- throw new RangeError("repeatColumns index exceeds the declared columns.");
7937
+ const available = settings.page.width - settings.margins.left - settings.margins.right, repeats = settings.repeatedColumns;
7642
7938
  const repeated = new Set(repeats), rest = widths.map((_, index) => index).filter(index => !repeated.has(index));
7643
7939
  const prefix = repeats.reduce((sum, index) => sum + widths[index], 0);
7644
7940
  if (prefix > available + .001)
@@ -7715,11 +8011,11 @@ function alignBandBlocks(bands, settings) {
7715
8011
  cells: row.cells.map(cell => ({ ...cell, height: heights.slice(index, index + (cell.rowSpan ?? 1)).reduce((sum, value) => sum + value, 0) })) })));
7716
8012
  }
7717
8013
  const _exports = Object.freeze({ planTableBands: planTableBands, projectBandRows: projectBandRows, alignBandBlocks: alignBandBlocks });
7718
- _modules.set("58480ded0056f234aea5e0c26637308eea7708e97ccc9987242b62c4dbc4f9b8", _exports);
8014
+ _modules.set("9a88773878eacc51df9f05bb5ee90cc2b683b083ebea8fb54375092301388e96", _exports);
7719
8015
  return _exports;
7720
8016
  })();
7721
8017
 
7722
- const _m67 = _modules.get("49d84273bffe31099c2dd7f47ecb6d4a7de7b6efd0d3b7e3e02761bcb3646c9c") ?? (() => {
8018
+ const _m68 = _modules.get("07d2da8d8b93f12f172a48b97c1807e485555cf608e2eaa5b7610aa91d4a5305") ?? (() => {
7723
8019
  const { ExportCell } = _m5;
7724
8020
 
7725
8021
  const { copyExportLink } = _m7;
@@ -7730,11 +8026,11 @@ const { createTotals } = _m12;
7730
8026
 
7731
8027
  const { presentation, positive } = _m55;
7732
8028
 
7733
- const { displayText } = _m68;
8029
+ const { displayText, pdfBudgetText } = _m69;
7734
8030
 
7735
- const { capturePdfText, wrapPdfText } = _m69;
8031
+ const { capturePdfText, wrapPdfText } = _m70;
7736
8032
 
7737
- const { planTableBands, projectBandRows, alignBandBlocks } = _m71;
8033
+ const { planTableBands, projectBandRows, alignBandBlocks } = _m72;
7738
8034
 
7739
8035
  class PdfTableLayout {
7740
8036
  settings;
@@ -7747,11 +8043,13 @@ class PdfTableLayout {
7747
8043
  totals;
7748
8044
  repeatedColumns;
7749
8045
  structuredBandRows = new WeakMap();
8046
+ /** Plain/alternate ordinary-data defaults, validated only when a column first needs them. */
8047
+ dataPresentations = [];
7750
8048
  constructor(settings, fonts) {
7751
8049
  this.settings = settings;
7752
8050
  this.fonts = fonts;
7753
8051
  const { options, padding, fontSize, page, margins } = settings, columns = options.columns, available = page.width - margins.left - margins.right;
7754
- this.repeatedColumns = new Set(typeof options.wideTable === "object" ? options.wideTable.repeatColumns : []);
8052
+ this.repeatedColumns = new Set(settings.repeatedColumns);
7755
8053
  let digit;
7756
8054
  if (options.columnWidths && options.columnWidths.length !== columns.length)
7757
8055
  throw new RangeError("columnWidths must declare one point width per column.");
@@ -7792,13 +8090,22 @@ class PdfTableLayout {
7792
8090
  this.headings = headings;
7793
8091
  this.totals = createTotals(columns, options.footer?.totals);
7794
8092
  }
7795
- async cell(value, first, span, row, style) {
8093
+ async cell(value, first, span, row, style, ordinaryData = false) {
7796
8094
  const { options, padding, fontSize, budget } = this.settings, column = options.columns[first];
7797
8095
  const own = value instanceof ExportCell ? value.presentation : undefined;
7798
8096
  const link = value instanceof ExportCell && value.link ? copyExportLink(value.link) : undefined;
7799
- const combined = presentation({ ...(column.alignment === undefined ? {} : { alignment: column.alignment }),
7800
- ...(column.wrapText === undefined ? {} : { wrapText: column.wrapText }), ...style, ...own });
7801
- const font = this.fonts.select(combined.bold, combined.italic), width = this.widths.slice(first, first + span).reduce((n, w) => n + w, 0);
8097
+ const alternate = ordinaryData && row % 2 && options.alternateRowColor ? options.alternateRowColor : undefined;
8098
+ const slot = first * 2 + (alternate ? 1 : 0), reusable = ordinaryData && own === undefined;
8099
+ let combined = reusable ? this.dataPresentations[slot] : undefined;
8100
+ if (!combined) {
8101
+ const rowStyle = ordinaryData ? alternate ? { background: alternate } : {} : style;
8102
+ combined = presentation({ ...(column.alignment === undefined ? {} : { alignment: column.alignment }),
8103
+ ...(column.wrapText === undefined ? {} : { wrapText: column.wrapText }), ...rowStyle, ...own });
8104
+ // Validate only the first reached default; an authored cell may override invalid column defaults.
8105
+ if (reusable)
8106
+ this.dataPresentations[slot] = combined;
8107
+ }
8108
+ 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);
7802
8109
  const context = { rowIndex: row, columnIndex: first, column }, raw = value instanceof ExportCell ? value.value : value;
7803
8110
  let text;
7804
8111
  if (options.formatRuns && row >= 0 && !(value instanceof ExportCell && value.text !== undefined)) {
@@ -7817,10 +8124,11 @@ class PdfTableLayout {
7817
8124
  throw new TypeError("Tagged PDF cell links require nonempty displayed text.");
7818
8125
  if (link && captured.runs.some(run => run.link))
7819
8126
  throw new TypeError("A PDF cell link cannot be combined with inline run links.");
8127
+ const budgetText = pdfBudgetText(captured.text, budget);
7820
8128
  if (this.bands)
7821
- budget.release(1, captured.text.length);
8129
+ budget.release(1, budgetText.length);
7822
8130
  else
7823
- budget.cell(captured.text, captured.text.length);
8131
+ budget.cell(budgetText, budgetText.length);
7824
8132
  const lines = await wrapPdfText(captured, this.fonts, fontSize, width - padding * 2, this.settings, combined.wrapText !== false);
7825
8133
  return { first, span, width, font, style: combined, lineHeight: lines.reduce((height, line) => Math.max(height, line.lineHeight), font.lineHeight(fontSize)),
7826
8134
  ...(link ? { link } : {}), ...(this.bands ? { captured } : {}),
@@ -7919,8 +8227,8 @@ class PdfTableLayout {
7919
8227
  const value = values[column], raw = value instanceof ExportCell ? value.value : value;
7920
8228
  if (!footer)
7921
8229
  this.totals[column].accept(raw);
7922
- const style = footer ? options.footerPresentation ?? {} : index % 2 && options.alternateRowColor ? { background: options.alternateRowColor } : {};
7923
- cells.push(await this.cell(value, column, 1, index, style));
8230
+ const cell = await this.cell(value, column, 1, index, footer ? options.footerPresentation ?? {} : undefined, !footer);
8231
+ cells.push(!footer && options.columns[column].rowHeader ? { ...cell, rowHeader: true } : cell);
7924
8232
  }
7925
8233
  return this.row(cells);
7926
8234
  }
@@ -7934,11 +8242,11 @@ class PdfTableLayout {
7934
8242
  }
7935
8243
  }
7936
8244
  const _exports = Object.freeze({ PdfTableLayout: PdfTableLayout });
7937
- _modules.set("49d84273bffe31099c2dd7f47ecb6d4a7de7b6efd0d3b7e3e02761bcb3646c9c", _exports);
8245
+ _modules.set("07d2da8d8b93f12f172a48b97c1807e485555cf608e2eaa5b7610aa91d4a5305", _exports);
7938
8246
  return _exports;
7939
8247
  })();
7940
8248
 
7941
- const _m73 = _modules.get("fc3b4b4c188e35a35e2451638421293be30b545b691151f1605295d87223a981") ?? (() => {
8249
+ const _m74 = _modules.get("67ad5f4adbd6bc0dddafe5cf82638d46d150237f4ff0bee15c0ace652d5095f4") ?? (() => {
7942
8250
  const { OfficeIMOError } = _m2;
7943
8251
 
7944
8252
  const { checkAbort } = _m4;
@@ -7982,7 +8290,7 @@ class PdfTableBandFlow {
7982
8290
  await this.flush();
7983
8291
  }
7984
8292
  async row(row, allowFirstFragment = false) {
7985
- const { padding, options } = this.layout.settings, minimumLines = this.layout.minimumRowLines(row), minimumHeight = this.layout.minimumRowHeight(row);
8293
+ const { padding, fontSize, options } = this.layout.settings, minimumLines = this.layout.minimumRowLines(row), minimumHeight = this.layout.minimumRowHeight(row);
7986
8294
  if (minimumHeight > this.painter.firstFullCapacity + .001 || minimumHeight > this.painter.continuationCapacity + .001)
7987
8295
  throw new RangeError("Repeated PDF identifiers must fit intact below the first and continued band headings/context.");
7988
8296
  // Keep ordinary rows intact when they fit fresh. A kept heading/caption can deliberately
@@ -8008,16 +8316,29 @@ class PdfTableBandFlow {
8008
8316
  const lines = Math.min(row.lines - first, Math.floor((this.capacity - this.height - padding * 2 + .001) / row.lineHeight));
8009
8317
  if (lines < 1)
8010
8318
  throw new RangeError("PDF page cannot fit a table line below horizontal band headings.");
8011
- const paintedLines = Math.max(lines, minimumLines), height = paintedLines * row.lineHeight + padding * 2;
8319
+ // Reserve one shared logical fragment, but paint only each band's visible cell geometry.
8320
+ const reservedLines = Math.max(lines, minimumLines), height = reservedLines * row.lineHeight + padding * 2;
8012
8321
  const projected = await this.layout.bandRows([row]);
8013
- const fragments = projected.map((rows, index) => [{ ...rows[0], lines: paintedLines, height,
8014
- cells: rows[0].cells.map(cell => {
8015
- const source = this.layout.bands[index].columns[cell.first];
8016
- const visible = this.layout.repeatedColumn(source) ? cell.lines : cell.lines.slice(first, first + lines);
8017
- const { height: _height, ...plain } = cell;
8018
- return { ...plain, lines: visible, ...(first > 0 && this.layout.repeatedColumn(source) ? { semanticArtifact: true } : {}) };
8019
- }) }]);
8020
- await this.accept({ rows: fragments, height, count: 1, completed: first + lines >= row.lines ? [row] : [] });
8322
+ const exhaustedBands = [];
8323
+ const fragments = projected.map((rows, index) => {
8324
+ let remaining = false;
8325
+ const cells = rows[0].cells.map(cell => {
8326
+ const source = this.layout.bands[index].columns[cell.first];
8327
+ const repeated = this.layout.repeatedColumn(source), visible = repeated ? cell.lines : cell.lines.slice(first, first + lines);
8328
+ if (!repeated && (visible.length > 0 || cell.link !== undefined))
8329
+ remaining = true;
8330
+ const { height: _height, ...plain } = cell;
8331
+ return { ...plain, lines: visible,
8332
+ lineHeight: visible.reduce((value, line) => Math.max(value, line.lineHeight), cell.font.lineHeight(fontSize)),
8333
+ ...(first > 0 && repeated ? { semanticArtifact: true } : {}) };
8334
+ });
8335
+ const fragmentLines = Math.max(1, ...cells.map(cell => cell.lines.length));
8336
+ const lineHeight = Math.max(this.layout.lineHeight, ...cells.filter(cell => cell.lines.length > 0).map(cell => cell.lineHeight));
8337
+ // Never omit an initial/new row, a structured block, or a nonrepeated link obligation.
8338
+ exhaustedBands.push(first > 0 && !remaining);
8339
+ return [{ ...rows[0], cells, lines: fragmentLines, lineHeight, height: fragmentLines * lineHeight + padding * 2 }];
8340
+ });
8341
+ await this.accept({ rows: fragments, height, count: 1, completed: first + lines >= row.lines ? [row] : [], exhaustedBands });
8021
8342
  first += lines;
8022
8343
  if (first < row.lines)
8023
8344
  await this.flush();
@@ -8029,7 +8350,7 @@ class PdfTableBandFlow {
8029
8350
  throw new OfficeIMOError("RESOURCE_LIMIT", "A structured PDF block exceeds maxTableWindowRows.");
8030
8351
  for (const row of rows)
8031
8352
  await this.painter.prepareRow?.(row);
8032
- await this.accept({ rows: projected, height, count: rows.length, completed: rows });
8353
+ await this.accept({ rows: projected, height, count: rows.length, completed: rows, exhaustedBands: projected.map(() => false) });
8033
8354
  }
8034
8355
  async keptRows(rows, allowFirstFragment = false) {
8035
8356
  const height = rows.reduce((sum, row) => sum + row.height, 0), fits = height <= this.painter.continuationCapacity + .001;
@@ -8043,6 +8364,8 @@ class PdfTableBandFlow {
8043
8364
  return;
8044
8365
  for (let band = 0; band < this.layout.bands.length; band++) {
8045
8366
  checkAbort(this.layout.settings.options.signal);
8367
+ if (!this.firstWindow && this.entries.length > 0 && this.entries.every(entry => entry.exhaustedBands[band]))
8368
+ continue;
8046
8369
  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);
8047
8370
  }
8048
8371
  for (const entry of this.entries)
@@ -8056,11 +8379,11 @@ class PdfTableBandFlow {
8056
8379
  }
8057
8380
  }
8058
8381
  const _exports = Object.freeze({ PdfTableBandFlow: PdfTableBandFlow });
8059
- _modules.set("fc3b4b4c188e35a35e2451638421293be30b545b691151f1605295d87223a981", _exports);
8382
+ _modules.set("67ad5f4adbd6bc0dddafe5cf82638d46d150237f4ff0bee15c0ace652d5095f4", _exports);
8060
8383
  return _exports;
8061
8384
  })();
8062
8385
 
8063
- const _m74 = _modules.get("2d9fcf56989ea33b92c7f79cc6e1b06b7f5a82cf421559ce3e2f6b67813a17c3") ?? (() => {
8386
+ const _m75 = _modules.get("b52424ed74721dce3a2621456888fe1c6af0490627063e56f690df9abcb1dfff") ?? (() => {
8064
8387
  /** @internal Source-cell identities survive page fragments and horizontal band projections.
8065
8388
  * Only column headers and still-owned row objects remain reachable from this table owner. */
8066
8389
  class PdfTableStructure {
@@ -8070,6 +8393,8 @@ class PdfTableStructure {
8070
8393
  cells = new WeakMap();
8071
8394
  rows = new WeakMap();
8072
8395
  columnHeaders = [];
8396
+ /** Ordinary cells without row headers share immutable dictionary references, bounded by column count. */
8397
+ ordinaryAttributes = [];
8073
8398
  headerCount = 0;
8074
8399
  headersPrepared = false;
8075
8400
  constructor(structure, table, headers) {
@@ -8110,19 +8435,30 @@ class PdfTableStructure {
8110
8435
  return row.cells.map(cell => this.cells.get(cell));
8111
8436
  const rowId = this.structure.element("TR", parent);
8112
8437
  this.rows.set(row, rowId);
8113
- const ids = [];
8114
- let rowHeaderIdentifier;
8115
- // Allocating in source-column order preserves the record's logical reading order.
8438
+ const headers = row.cells.map((cell, index) => rowHeaderIndex === undefined ? cell.rowHeader === true : index === rowHeaderIndex);
8439
+ // Allocate in source order, then resolve every row header before associating even earlier data cells.
8440
+ // Generated summary labels override detail roles so numeric subtotal cells never become row headers.
8441
+ const ids = row.cells.map((cell, index) => {
8442
+ const id = this.structure.element(headers[index] ? "TH" : "TD", rowId);
8443
+ this.cells.set(cell, id);
8444
+ return id;
8445
+ });
8446
+ const rowHeaders = [];
8447
+ for (let index = 0; index < ids.length; index++)
8448
+ if (headers[index])
8449
+ rowHeaders.push(await this.structure.identifier(ids[index]));
8116
8450
  for (let index = 0; index < row.cells.length; index++) {
8117
- const cell = row.cells[index], isRowHeader = index === rowHeaderIndex;
8451
+ const cell = row.cells[index];
8452
+ if (!rowHeaders.length && cell.span === 1 && (cell.rowSpan ?? 1) === 1) {
8453
+ const attributes = this.ordinaryAttributes[cell.first] ??=
8454
+ await this.structure.attributeReference(this.attributeDictionary(cell, this.associations(cell)));
8455
+ this.structure.setAttributes(ids[index], attributes);
8456
+ continue;
8457
+ }
8118
8458
  const associations = this.associations(cell);
8119
- if (rowHeaderIdentifier !== undefined && !isRowHeader)
8120
- associations.push(rowHeaderIdentifier);
8121
- const id = this.structure.element(isRowHeader ? "TH" : "TD", rowId, this.attributes(cell, associations, isRowHeader ? "Row" : undefined));
8122
- this.cells.set(cell, id);
8123
- ids.push(id);
8124
- if (isRowHeader)
8125
- rowHeaderIdentifier = await this.structure.identifier(id);
8459
+ if (!headers[index])
8460
+ associations.push(...rowHeaders);
8461
+ this.structure.setAttributes(ids[index], this.attributes(cell, associations, headers[index] ? "Row" : undefined));
8126
8462
  }
8127
8463
  return ids;
8128
8464
  }
@@ -8148,17 +8484,20 @@ class PdfTableStructure {
8148
8484
  return [...headers].sort((left, right) => left.order - right.order).map(header => header.identifier);
8149
8485
  }
8150
8486
  attributes(cell, headers, scope) {
8151
- return " /A << /O /Table" + (scope === undefined ? "" : " /Scope /" + scope) +
8487
+ return " /A " + this.attributeDictionary(cell, headers, scope);
8488
+ }
8489
+ attributeDictionary(cell, headers, scope) {
8490
+ return "<< /O /Table" + (scope === undefined ? "" : " /Scope /" + scope) +
8152
8491
  (cell.span > 1 ? " /ColSpan " + cell.span : "") + ((cell.rowSpan ?? 1) > 1 ? " /RowSpan " + cell.rowSpan : "") +
8153
8492
  (headers.length ? " /Headers [" + headers.map(id => "(" + id + ")").join(" ") + "]" : "") + " >>";
8154
8493
  }
8155
8494
  }
8156
8495
  const _exports = Object.freeze({ PdfTableStructure: PdfTableStructure });
8157
- _modules.set("2d9fcf56989ea33b92c7f79cc6e1b06b7f5a82cf421559ce3e2f6b67813a17c3", _exports);
8496
+ _modules.set("b52424ed74721dce3a2621456888fe1c6af0490627063e56f690df9abcb1dfff", _exports);
8158
8497
  return _exports;
8159
8498
  })();
8160
8499
 
8161
- const _m75 = _modules.get("c5f5a4892d01de11258381c667d72e97f69410f87c8ddb307be3a7bbb3d6857a") ?? (() => {
8500
+ const _m76 = _modules.get("09c712096a1028af340e275d5a273e870546413797e71ed709657ad0482ea170") ?? (() => {
8162
8501
  const { OfficeIMOError } = _m2;
8163
8502
 
8164
8503
  const { pdfNumber, unicodeHex } = _m59;
@@ -8200,11 +8539,11 @@ function linkAnnotation(link, x, bottom, width, height, maxBytes, structParent,
8200
8539
  (link.tooltip === undefined ? "" : " /Contents <feff" + unicodeHex(link.tooltip) + ">") + " >>";
8201
8540
  }
8202
8541
  const _exports = Object.freeze({ linkAnnotation: linkAnnotation });
8203
- _modules.set("c5f5a4892d01de11258381c667d72e97f69410f87c8ddb307be3a7bbb3d6857a", _exports);
8542
+ _modules.set("09c712096a1028af340e275d5a273e870546413797e71ed709657ad0482ea170", _exports);
8204
8543
  return _exports;
8205
8544
  })();
8206
8545
 
8207
- const _m76 = _modules.get("93a48e0c780b5ff91a51fef40169622179fe47eb3f3bd159989ce92f83b57b80") ?? (() => {
8546
+ const _m77 = _modules.get("c68d18d668366fb9b96d1b53c79dc6305f84cb83c05e4942fcf1cdf96ed1a73f") ?? (() => {
8208
8547
  const { OfficeIMOError } = _m2;
8209
8548
 
8210
8549
  const { unicodeHex } = _m59;
@@ -8249,11 +8588,11 @@ function captureSection(block, settings) {
8249
8588
  ...(pageNumbers === undefined ? {} : { pageNumbers }) });
8250
8589
  }
8251
8590
  const _exports = Object.freeze({ captureBookmark: captureBookmark, captureSection: captureSection });
8252
- _modules.set("93a48e0c780b5ff91a51fef40169622179fe47eb3f3bd159989ce92f83b57b80", _exports);
8591
+ _modules.set("c68d18d668366fb9b96d1b53c79dc6305f84cb83c05e4942fcf1cdf96ed1a73f", _exports);
8253
8592
  return _exports;
8254
8593
  })();
8255
8594
 
8256
- const _m77 = _modules.get("31017b0c80e6e8ace64ed268298a4f155b992b295138be6ad0bffe8d9365710d") ?? (() => {
8595
+ const _m78 = _modules.get("a66257a32f03d958aa57be4de9da7f80b708cebca26b5cc6404de0ee11bfe052") ?? (() => {
8257
8596
  const { settings } = _m55;
8258
8597
 
8259
8598
  /** @internal Every section derives from captured document defaults, never the preceding section. */
@@ -8268,11 +8607,11 @@ function sectionSettings(base, section) {
8268
8607
  return { ...base, page: derived.page, margins: derived.margins, options };
8269
8608
  }
8270
8609
  const _exports = Object.freeze({ sectionSettings: sectionSettings });
8271
- _modules.set("31017b0c80e6e8ace64ed268298a4f155b992b295138be6ad0bffe8d9365710d", _exports);
8610
+ _modules.set("a66257a32f03d958aa57be4de9da7f80b708cebca26b5cc6404de0ee11bfe052", _exports);
8272
8611
  return _exports;
8273
8612
  })();
8274
8613
 
8275
- const _m72 = _modules.get("d0559c6c6f06cb5c1ba8d2494280159aa12c9514566498ca28b1a4a7fefd92db") ?? (() => {
8614
+ const _m73 = _modules.get("ce2a4bebe6ca61c77a6a974bd91981622b1f263d4e56e6b8466af41419151410") ?? (() => {
8276
8615
  const { OfficeIMOError } = _m2;
8277
8616
 
8278
8617
  const { checkAbort } = _m4;
@@ -8281,19 +8620,19 @@ const { pdfNumber } = _m59;
8281
8620
 
8282
8621
  const { color } = _m55;
8283
8622
 
8284
- const { PdfTableBandFlow } = _m73;
8623
+ const { PdfTableBandFlow } = _m74;
8285
8624
 
8286
- const { PdfTableStructure } = _m74;
8625
+ const { PdfTableStructure } = _m75;
8287
8626
 
8288
- const { wrapText, wrapTextCooperatively, synchronousText } = _m68;
8627
+ const { wrapText, wrapTextCooperatively, synchronousText, pdfBudgetText } = _m69;
8289
8628
 
8290
- const { linkAnnotation } = _m75;
8629
+ const { linkAnnotation } = _m76;
8291
8630
 
8292
8631
  const { unicodeHex } = _m59;
8293
8632
 
8294
- const { captureSection, captureBookmark } = _m76;
8633
+ const { captureSection, captureBookmark } = _m77;
8295
8634
 
8296
- const { sectionSettings } = _m77;
8635
+ const { sectionSettings } = _m78;
8297
8636
 
8298
8637
  /** @internal One page of drawing commands and O(page count) references, never the complete report body. */
8299
8638
  class PdfPages {
@@ -8431,8 +8770,9 @@ class PdfPages {
8431
8770
  const lineActualText = !this.structure && line.actualText !== undefined && line.actualText.length > 0;
8432
8771
  if (lineActualText)
8433
8772
  this.add("/Span << /ActualText <FEFF" + unicodeHex(line.actualText) + "> >> BDC\n");
8434
- const marks = new Map();
8773
+ let marks;
8435
8774
  if (line.actualText !== undefined && this.structure && element !== undefined) {
8775
+ marks = new Map();
8436
8776
  // Allocate MCIDs/Link children in logical order, then paint the independently positioned visual order.
8437
8777
  for (const segment of [...line.segments].sort((a, b) => (a.logicalStart ?? 0) - (b.logicalStart ?? 0))) {
8438
8778
  const owner = segment.link ? this.structure.link(element, segment.link) : element;
@@ -8440,7 +8780,7 @@ class PdfPages {
8440
8780
  }
8441
8781
  }
8442
8782
  for (const segment of line.segments) {
8443
- const registered = marks.get(segment), owner = registered?.owner ?? (segment.link && this.structure && element !== undefined ? this.structure.link(element, segment.link) : element);
8783
+ const registered = marks?.get(segment), owner = registered?.owner ?? (segment.link && this.structure && element !== undefined ? this.structure.link(element, segment.link) : element);
8444
8784
  if (segment.glyphs) {
8445
8785
  const font = segment.font, n = pdfNumber, shear = font.syntheticItalic ? .213 : 0;
8446
8786
  let cursor = x, command = "q " + this.rgb(segment.color ?? "111827") + " rg " + this.rgb(segment.color ?? "111827") + " RG\nBT /" + font.name + " " + n(size) + " Tf " +
@@ -8474,7 +8814,7 @@ class PdfPages {
8474
8814
  decoration(text, x, y, width) {
8475
8815
  if (!text)
8476
8816
  return;
8477
- this.settings.budget.cell(text);
8817
+ this.settings.budget.cell(pdfBudgetText(text, this.settings.budget));
8478
8818
  const font = this.fonts.select(), lines = wrapText(text, font, this.settings.fontSize, width, this.settings.limits.maxCellCharacters, 1, false);
8479
8819
  this.text(lines[0].text, font, this.settings.fontSize, x, y);
8480
8820
  }
@@ -8535,9 +8875,7 @@ class PdfPages {
8535
8875
  }
8536
8876
  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;
8537
8877
  if (continuation?.lines.length) {
8538
- if (this.continuationCaptionPaints++ > 0)
8539
- this.settings.budget.cell(continuation.text.text);
8540
- else
8878
+ if (this.continuationCaptionPaints++ === 0)
8541
8879
  this.tableCaptionOwner = this.captionAnnotations(continuation, this.tableCaptionOwner);
8542
8880
  await this.paragraphs([continuation], headerHeight + lineHeight + this.settings.padding * 2, true, { artifact: true, ...(this.tableCaptionOwner === undefined ? {} : { annotationParent: this.tableCaptionOwner }) });
8543
8881
  }
@@ -8655,7 +8993,7 @@ class PdfPages {
8655
8993
  async paragraph(text, style = {}, size = this.settings.fontSize, paginate = true, headingLevel) {
8656
8994
  await this.ensureStarted();
8657
8995
  const { margins, page, limits } = this.settings, font = this.fonts.select(style.bold, style.italic), lineHeight = font.lineHeight(size);
8658
- this.settings.budget.cell(text);
8996
+ this.settings.budget.cell(pdfBudgetText(text, this.settings.budget));
8659
8997
  const lines = await wrapTextCooperatively(text, font, size, page.width - margins.left - margins.right, limits.maxCellCharacters, limits.maxRowLines, true, this.settings.options.signal);
8660
8998
  if (lineHeight > page.height - margins.top - margins.bottom)
8661
8999
  throw new RangeError("PDF page cannot fit a paragraph line at the selected font metrics.");
@@ -8698,6 +9036,8 @@ class PdfPages {
8698
9036
  if (keepTogether && visible.length)
8699
9037
  await this.reserveSpace(visible.reduce((height, paragraph) => height + paragraph.height, 0) + reservations.at(-1), "Kept PDF paragraph group");
8700
9038
  for (const [index, paragraph] of visible.entries()) {
9039
+ if (paragraph.budgetOnPaint)
9040
+ this.settings.budget.cell(pdfBudgetText(paragraph.text.text, this.settings.budget));
8701
9041
  if (paragraph.keepTogether || paragraph.keepWithNext)
8702
9042
  await this.reserveSpace(paragraph.height + reservations[index], "Kept PDF paragraph chain");
8703
9043
  const { margins, page } = this.settings;
@@ -8750,10 +9090,11 @@ class PdfPages {
8750
9090
  /** The generated summary label is a row heading; no localized text/style inference is used. */
8751
9091
  summary(row) { this.summaryRows.add(row); }
8752
9092
  /** Begin an independent table on the current page, retaining its headings on continuation pages.
8753
- * Group context uses captionArtifact: it stays visually complete without duplicating logical headings. */
8754
- async beginTable(layout, preparedHeadings, minimumDataHeight = layout.lineHeight + this.settings.padding * 2, caption, continuationCaption, headingsOnNewPageOnly = false, captionArtifact = false) {
9093
+ * Group context uses captionArtifact: it stays visually complete without duplicating logical headings.
9094
+ * An already-painted opening path only suppresses its artifact caption on that existing page. */
9095
+ async beginTable(layout, preparedHeadings, minimumDataHeight = layout.lineHeight + this.settings.padding * 2, caption, continuationCaption, headingsOnNewPageOnly = false, captionArtifact = false, openingContextAlreadyPainted = false) {
8755
9096
  if (layout.bands)
8756
- return this.beginBands(layout, preparedHeadings, minimumDataHeight, caption, continuationCaption, captionArtifact);
9097
+ return this.beginBands(layout, preparedHeadings, minimumDataHeight, caption, continuationCaption, captionArtifact, openingContextAlreadyPainted);
8757
9098
  await this.ensureStarted();
8758
9099
  this.layout = layout;
8759
9100
  this.paintedHeaderCells = new WeakSet();
@@ -8767,7 +9108,7 @@ class PdfPages {
8767
9108
  // Its own headings remain available when it moves or splits onto a fresh page.
8768
9109
  const initialHeadings = headingsOnNewPageOnly && this.bodyAdded && !this.structure ? [] : headings;
8769
9110
  const height = initialHeadings.reduce((n, row) => n + row.height, 0);
8770
- if (caption) {
9111
+ if (caption && !(captionArtifact && openingContextAlreadyPainted)) {
8771
9112
  await this.reserveSpace(caption.height + height + minimumDataHeight, "Kept PDF table caption and first data fragment");
8772
9113
  this.tableCaptionOwner = captionArtifact ? this.captionAnnotations(caption)
8773
9114
  : caption.lines.length ? this.structure?.element("Caption", this.tableElement) : undefined;
@@ -8789,7 +9130,7 @@ class PdfPages {
8789
9130
  this.dataTop = this.y;
8790
9131
  }
8791
9132
  /** Bind the bounded logical-window owner to the existing physical page painter. */
8792
- async beginBands(layout, preparedHeadings, minimumDataHeight, caption, continuation, captionArtifact) {
9133
+ async beginBands(layout, preparedHeadings, minimumDataHeight, caption, continuation, captionArtifact, openingContextAlreadyPainted) {
8793
9134
  await this.ensureStarted();
8794
9135
  const logicalHeadings = preparedHeadings ?? await layout.headers(), headings = await layout.bandRows(logicalHeadings, true);
8795
9136
  const headerHeight = headings[0].reduce((sum, row) => sum + row.height, 0), { page, margins, padding } = this.settings;
@@ -8798,13 +9139,15 @@ class PdfPages {
8798
9139
  const continuationCapacity = page.height - margins.top - margins.bottom - headerHeight - (continuation?.height ?? 0);
8799
9140
  if (continuationCapacity + .001 < layout.lineHeight + padding * 2)
8800
9141
  throw new RangeError("PDF band headings and continuation context leave no room for a data line.");
8801
- if (this.y - margins.bottom - headerHeight - (caption?.height ?? 0) + .001 < minimum)
9142
+ let openingContextPainted = captionArtifact && openingContextAlreadyPainted;
9143
+ if (this.y - margins.bottom - headerHeight - (openingContextPainted ? 0 : caption?.height ?? 0) + .001 < minimum) {
8802
9144
  await this.pageBreak();
8803
- let initialOffset = page.height - margins.top - this.y;
8804
- const firstCapacity = this.y - margins.bottom - headerHeight - (caption?.height ?? 0);
9145
+ openingContextPainted = false;
9146
+ }
9147
+ const firstCapacity = this.y - margins.bottom - headerHeight - (openingContextPainted ? 0 : caption?.height ?? 0);
8805
9148
  if (firstCapacity + .001 < minimum)
8806
9149
  throw new RangeError("PDF band caption and headings leave no room for a data line.");
8807
- let captionPaints = 0, continuationPaints = 0;
9150
+ let continuationPaints = 0;
8808
9151
  this.tableElement = this.structure?.element("Table", this.groupParent);
8809
9152
  this.paintedHeaderCells = new WeakSet();
8810
9153
  let captionElement = this.structure && caption?.lines.length ? captionArtifact ? this.captionAnnotations(caption)
@@ -8818,21 +9161,16 @@ class PdfPages {
8818
9161
  this.bandFlow = new PdfTableBandFlow(layout, headings, { firstCapacity, firstFullCapacity, continuationCapacity,
8819
9162
  prepareRow: async (row) => { await this.tableStructure?.prepareHeaders(); await this.rowElements(row); },
8820
9163
  completeRow: async (row) => { await this.tableStructure?.completeRow(row.source ?? row); },
8821
- moveFirstToFreshPage: async () => { await this.pageBreak(); initialOffset = 0; },
9164
+ moveFirstToFreshPage: async () => { await this.pageBreak(); openingContextPainted = false; },
8822
9165
  paint: async (band, headers, rows, currentCaption, firstWindow, firstBand) => {
8823
9166
  if (!(firstWindow && firstBand))
8824
9167
  await this.pageBreak();
8825
- if (firstWindow && !firstBand)
8826
- this.y -= initialOffset;
8827
9168
  const frame = layout.bands[band];
8828
9169
  this.layout = { lefts: frame.lefts, lineHeight: layout.lineHeight, headers: async () => headers };
8829
9170
  this.bandCellBudget = true;
8830
9171
  try {
8831
- if (currentCaption?.lines.length) {
8832
- const paints = firstWindow ? captionPaints++ : continuationPaints++;
8833
- if (paints > 0)
8834
- this.settings.budget.cell(currentCaption.text.text);
8835
- if (!firstWindow && paints === 0)
9172
+ if (currentCaption?.lines.length && !(firstWindow && firstBand && openingContextPainted)) {
9173
+ if (!firstWindow && continuationPaints++ === 0)
8836
9174
  captionElement = this.captionAnnotations(currentCaption, captionElement);
8837
9175
  const annotationParent = captionElement;
8838
9176
  await this.paragraphs([currentCaption], headerHeight + minimum, true, firstWindow && firstBand && !captionArtifact ? { role: "Caption", keepOpen: true, ...(captionElement === undefined ? {} : { owner: captionElement }) }
@@ -8936,7 +9274,7 @@ class PdfPages {
8936
9274
  this.annotations = [];
8937
9275
  this.commandBytes = 0;
8938
9276
  this.current = 0;
8939
- await this.objects.flush();
9277
+ await this.objects.flushBytes();
8940
9278
  }
8941
9279
  async finish() {
8942
9280
  if (this.bandFlow) {
@@ -8964,11 +9302,11 @@ class PdfPages {
8964
9302
  }
8965
9303
  }
8966
9304
  const _exports = Object.freeze({ PdfPages: PdfPages });
8967
- _modules.set("d0559c6c6f06cb5c1ba8d2494280159aa12c9514566498ca28b1a4a7fefd92db", _exports);
9305
+ _modules.set("ce2a4bebe6ca61c77a6a974bd91981622b1f263d4e56e6b8466af41419151410", _exports);
8968
9306
  return _exports;
8969
9307
  })();
8970
9308
 
8971
- const _m79 = _modules.get("7a58e8ccb5164de51db14e39ca9695af6487c354df909509f0ae6bfac8ae3887") ?? (() => {
9309
+ const _m80 = _modules.get("7a58e8ccb5164de51db14e39ca9695af6487c354df909509f0ae6bfac8ae3887") ?? (() => {
8972
9310
  /** @internal Incremental PDF number tree: at most 64 entries/children per retained level. */
8973
9311
  class PdfParentTree {
8974
9312
  objects;
@@ -9031,15 +9369,38 @@ _modules.set("7a58e8ccb5164de51db14e39ca9695af6487c354df909509f0ae6bfac8ae3887",
9031
9369
  return _exports;
9032
9370
  })();
9033
9371
 
9034
- const _m78 = _modules.get("b37e74556d1c4d6d8617e6b585127f56635e2ea8e03105a026031f5d3adbce9e") ?? (() => {
9372
+ const _m79 = _modules.get("1c1828a3d6dfc2edda674566203e7aa8e97c984114b7928df13cb373859977d0") ?? (() => {
9035
9373
  const { OfficeIMOError } = _m2;
9036
9374
 
9037
9375
  const { checkAbort } = _m4;
9038
9376
 
9039
9377
  const { unicodeHex } = _m59;
9040
9378
 
9041
- const { PdfParentTree } = _m79;
9379
+ const { PdfParentTree } = _m80;
9042
9380
 
9381
+ /** Same-page marked content uses integer K; cross-page MCR and annotation OBJR stay explicit. */
9382
+ function structureChild(child) {
9383
+ return typeof child === "number" ? (child < 0 ? -child - 1 + " " : child + " 0 R ") : child + " ";
9384
+ }
9385
+ function structurePrefix(element) {
9386
+ return "<< /Type /StructElem /S /" + element.role + " /P " + element.parent + " 0 R" +
9387
+ (element.markedPage === undefined ? "" : " /Pg " + element.markedPage + " 0 R") +
9388
+ (element.identifier === undefined ? "" : " /ID (" + element.identifier + ")") + " /K [";
9389
+ }
9390
+ /** Keep the same bounded small-object representation for both completion paths. */
9391
+ function compactStructureBody(element, prefix) {
9392
+ const remaining = 32768 - prefix.length - element.attributes.length - 4;
9393
+ if (remaining < 0)
9394
+ return undefined;
9395
+ let children = "";
9396
+ for (const child of element.children) {
9397
+ const token = structureChild(child);
9398
+ if (children.length + token.length > remaining)
9399
+ return undefined;
9400
+ children += token;
9401
+ }
9402
+ return prefix + children + "]" + element.attributes + " >>";
9403
+ }
9043
9404
  /** A sorted name tree retains only a small open leaf and branch at each level. */
9044
9405
  class PdfStructureIds {
9045
9406
  objects;
@@ -9129,7 +9490,7 @@ class PdfStructure {
9129
9490
  checkAbort(this.settings.options.signal);
9130
9491
  if (++this.allocated > this.settings.limits.maxStructureElements)
9131
9492
  throw new OfficeIMOError("RESOURCE_LIMIT", "maxStructureElements exceeded.");
9132
- const id = this.objects.reserve(), element = { id, parent, role, children: [], attributes, linkIdentities: [] };
9493
+ const id = this.objects.reserve(), element = { id, parent, role, children: [], attributes };
9133
9494
  this.elements.set(id, element);
9134
9495
  const owner = this.elements.get(parent);
9135
9496
  // A continuation-only linked caption is discovered during painting, after rows may exist.
@@ -9140,6 +9501,20 @@ class PdfStructure {
9140
9501
  owner?.children.push(id);
9141
9502
  return id;
9142
9503
  }
9504
+ /** Attach resolved table associations while a source-ordered logical element is still open. */
9505
+ setAttributes(elementId, attributes) {
9506
+ const element = this.elements.get(elementId);
9507
+ if (!element)
9508
+ throw new Error("PDF structure attributes require an open logical owner.");
9509
+ element.attributes = attributes;
9510
+ }
9511
+ /** Write one immutable attribute dictionary. Its caller owns the bounded scope of reference reuse. */
9512
+ async attributeReference(dictionary) {
9513
+ checkAbort(this.settings.options.signal);
9514
+ const id = this.objects.reserve();
9515
+ await this.objects.object(id, dictionary);
9516
+ return " /A " + id + " 0 R";
9517
+ }
9143
9518
  /** Flat visual sections share the same logical Document and cumulative resource policy. */
9144
9519
  async beginSection() {
9145
9520
  await this.complete(this.section);
@@ -9173,7 +9548,8 @@ class PdfStructure {
9173
9548
  return existing;
9174
9549
  const id = this.element("Link", parent, alternativeText === undefined ? "" : " /Alt <feff" + unicodeHex(alternativeText) + ">");
9175
9550
  parents.set(parent, id);
9176
- this.elements.get(parent).linkIdentities.push(identity);
9551
+ const owner = this.elements.get(parent);
9552
+ (owner.linkIdentities ??= []).push(identity);
9177
9553
  return id;
9178
9554
  }
9179
9555
  /** Associate a native annotation in both directions: OBJR child and annotation ParentTree entry. */
@@ -9196,7 +9572,9 @@ class PdfStructure {
9196
9572
  throw new Error("Marked content requires an open logical owner.");
9197
9573
  const mcid = this.pageParents.length;
9198
9574
  this.pageParents.push(elementId);
9199
- element.children.push("<< /Type /MCR /Pg " + this.pageId + " 0 R /MCID " + mcid + " >>");
9575
+ element.markedPage ??= this.pageId;
9576
+ element.children.push(element.markedPage === this.pageId ? -(mcid + 1) :
9577
+ "<< /Type /MCR /Pg " + this.pageId + " 0 R /MCID " + mcid + " >>");
9200
9578
  return "/" + element.role + " << /MCID " + mcid + (actualText === undefined ? "" : " /ActualText <FEFF" + unicodeHex(actualText) + ">") + " >> BDC\n";
9201
9579
  }
9202
9580
  get pageDictionary() { return " /StructParents " + this.pageKey + " /Tabs /S"; }
@@ -9220,37 +9598,49 @@ class PdfStructure {
9220
9598
  if (!element)
9221
9599
  return;
9222
9600
  for (const child of element.children)
9223
- if (typeof child === "number" && this.elements.has(child))
9601
+ if (typeof child === "number" && child > 0 && !this.completeBuffered(child))
9224
9602
  await this.complete(child);
9225
9603
  checkAbort(this.settings.options.signal);
9226
- const prefix = "<< /Type /StructElem /S /" + element.role + " /P " + element.parent + " 0 R" +
9227
- (element.identifier === undefined ? "" : " /ID (" + element.identifier + ")") + " /K [";
9228
- const remaining = 32768 - prefix.length - element.attributes.length - 4;
9229
- let children = "", small = remaining >= 0;
9230
- if (small)
9231
- for (const child of element.children) {
9232
- const token = typeof child === "number" ? child + " 0 R " : child + " ";
9233
- if (children.length + token.length > remaining) {
9234
- small = false;
9235
- break;
9236
- }
9237
- children += token;
9238
- }
9604
+ const prefix = structurePrefix(element), body = compactStructureBody(element, prefix);
9239
9605
  // Most table cells/rows fit in one encoding. Large parents and alternatives remain streamed.
9240
- await this.objects.object(id, small ? prefix + children + "]" + element.attributes + " >>" : this.body(element));
9241
- for (const identity of element.linkIdentities) {
9242
- const parents = this.links.get(identity);
9243
- parents?.delete(id);
9244
- if (!parents?.size)
9245
- this.links.delete(identity);
9246
- }
9247
- this.elements.delete(id);
9248
- }
9249
- *body(element) {
9250
- yield "<< /Type /StructElem /S /" + element.role + " /P " + element.parent + " 0 R" +
9251
- (element.identifier === undefined ? "" : " /ID (" + element.identifier + ")") + " /K [";
9606
+ if (body !== undefined) {
9607
+ if (!this.objects.tryCompactObject(id, body))
9608
+ await this.objects.compactObject(id, body);
9609
+ }
9610
+ else
9611
+ await this.objects.object(id, this.body(element, prefix));
9612
+ this.releaseElement(element);
9613
+ }
9614
+ /** Close already-bufferable children without creating an async chain per leaf. A false result
9615
+ * leaves the current owner open for the existing awaited flush or ordinary-object path. */
9616
+ completeBuffered(id) {
9617
+ const element = this.elements.get(id);
9618
+ if (!element)
9619
+ return true;
9620
+ for (const child of element.children)
9621
+ if (typeof child === "number" && child > 0 && !this.completeBuffered(child))
9622
+ return false;
9623
+ checkAbort(this.settings.options.signal);
9624
+ const body = compactStructureBody(element, structurePrefix(element));
9625
+ if (body === undefined || !this.objects.tryCompactObject(id, body))
9626
+ return false;
9627
+ this.releaseElement(element);
9628
+ return true;
9629
+ }
9630
+ releaseElement(element) {
9631
+ if (element.linkIdentities)
9632
+ for (const identity of element.linkIdentities) {
9633
+ const parents = this.links.get(identity);
9634
+ parents?.delete(element.id);
9635
+ if (!parents?.size)
9636
+ this.links.delete(identity);
9637
+ }
9638
+ this.elements.delete(element.id);
9639
+ }
9640
+ *body(element, prefix) {
9641
+ yield prefix;
9252
9642
  for (const child of element.children)
9253
- yield typeof child === "number" ? child + " 0 R " : child + " ";
9643
+ yield structureChild(child);
9254
9644
  yield "]" + element.attributes + " >>";
9255
9645
  }
9256
9646
  async completeRow(cells) {
@@ -9287,11 +9677,11 @@ function graphicAlternative(value, settings) {
9287
9677
  return alternativeText;
9288
9678
  }
9289
9679
  const _exports = Object.freeze({ PdfStructure: PdfStructure, graphicAlternative: graphicAlternative });
9290
- _modules.set("b37e74556d1c4d6d8617e6b585127f56635e2ea8e03105a026031f5d3adbce9e", _exports);
9680
+ _modules.set("1c1828a3d6dfc2edda674566203e7aa8e97c984114b7928df13cb373859977d0", _exports);
9291
9681
  return _exports;
9292
9682
  })();
9293
9683
 
9294
- const _m80 = _modules.get("29578404bfc3df4d4b6b8036db67bd83212dbfe6182fadb62c55beb0584b5ca8") ?? (() => {
9684
+ const _m81 = _modules.get("52c78ca6833cee7e5a96b657e2c00172d550176daf2c95e742692f8416977bea") ?? (() => {
9295
9685
  const { OfficeIMOError } = _m2;
9296
9686
 
9297
9687
  const { checkAbort } = _m4;
@@ -9351,22 +9741,22 @@ class PdfOutlines {
9351
9741
  }
9352
9742
  }
9353
9743
  const _exports = Object.freeze({ PdfOutlines: PdfOutlines });
9354
- _modules.set("29578404bfc3df4d4b6b8036db67bd83212dbfe6182fadb62c55beb0584b5ca8", _exports);
9744
+ _modules.set("52c78ca6833cee7e5a96b657e2c00172d550176daf2c95e742692f8416977bea", _exports);
9355
9745
  return _exports;
9356
9746
  })();
9357
9747
 
9358
- const _m58 = _modules.get("50d54cd77023f226b6e16a5fd158bb587e58b21cbf9b731e51b093c4bc32afac") ?? (() => {
9748
+ const _m58 = _modules.get("6f13eca1cc6a3dee16e260ffb7ee38115cc2390084e9b156f0a90915fa5b18b9") ?? (() => {
9359
9749
  const { PdfObjects, unicodeHex } = _m59;
9360
9750
 
9361
- const { PdfFontResources } = _m60;
9751
+ const { PdfFontResources } = _m61;
9362
9752
 
9363
- const { PdfTableLayout } = _m67;
9753
+ const { PdfTableLayout } = _m68;
9364
9754
 
9365
- const { PdfPages } = _m72;
9755
+ const { PdfPages } = _m73;
9366
9756
 
9367
- const { PdfStructure } = _m78;
9757
+ const { PdfStructure } = _m79;
9368
9758
 
9369
- const { PdfOutlines } = _m80;
9759
+ const { PdfOutlines } = _m81;
9370
9760
 
9371
9761
  /** One resource/catalog owner shared by table convenience exports and composed documents. */
9372
9762
  class PdfWriteSession {
@@ -9383,7 +9773,7 @@ class PdfWriteSession {
9383
9773
  info;
9384
9774
  constructor(sink, settings, table = false) {
9385
9775
  this.settings = settings;
9386
- this.objects = new PdfObjects(sink, settings.options.signal, settings.budget.limits.maxOutputBytes);
9776
+ this.objects = new PdfObjects(sink, settings.options.signal, settings.budget.limits.maxOutputBytes, settings.options.compression !== false);
9387
9777
  this.root = this.objects.reserve();
9388
9778
  this.parent = this.objects.reserve();
9389
9779
  this.resources = this.objects.reserve();
@@ -9418,11 +9808,11 @@ class PdfWriteSession {
9418
9808
  }
9419
9809
  }
9420
9810
  const _exports = Object.freeze({ PdfWriteSession: PdfWriteSession });
9421
- _modules.set("50d54cd77023f226b6e16a5fd158bb587e58b21cbf9b731e51b093c4bc32afac", _exports);
9811
+ _modules.set("6f13eca1cc6a3dee16e260ffb7ee38115cc2390084e9b156f0a90915fa5b18b9", _exports);
9422
9812
  return _exports;
9423
9813
  })();
9424
9814
 
9425
- const _m54 = _modules.get("b236032efbf4bb6015fe9a546f753fac23127635b62114367e3c67776de83f5b") ?? (() => {
9815
+ const _m54 = _modules.get("4a658d1639cc333dc8b174a84d2d80a7e20bec2f0e86409d00c3f77199e2eda2") ?? (() => {
9426
9816
  const { BlobByteSink, withDestination } = _m3;
9427
9817
 
9428
9818
  const { beginTask, checkAbort, consumeRows, pause, taskYieldDue } = _m4;
@@ -9487,11 +9877,11 @@ async function writePdfTo(rows, destination, configuration) {
9487
9877
  });
9488
9878
  }
9489
9879
  const _exports = Object.freeze({ writePdf: writePdf, writePdfTo: writePdfTo });
9490
- _modules.set("b236032efbf4bb6015fe9a546f753fac23127635b62114367e3c67776de83f5b", _exports);
9880
+ _modules.set("4a658d1639cc333dc8b174a84d2d80a7e20bec2f0e86409d00c3f77199e2eda2", _exports);
9491
9881
  return _exports;
9492
9882
  })();
9493
9883
 
9494
- const _m84 = _modules.get("55eee1527c670926d154776e46828f4a0f8ae4df5c041a62ff851925b349f9db") ?? (() => {
9884
+ const _m85 = _modules.get("749d1ec5422c0087787f525ef42e3b8d3a94d2b70eb5e42d2e3723a870777ad6") ?? (() => {
9495
9885
  const { NotSupportedError, OfficeIMOError } = _m2;
9496
9886
 
9497
9887
  const { checkAbort, pause, taskYieldDue, withAbort } = _m4;
@@ -9755,16 +10145,16 @@ function paeth(left, up, upperLeft) {
9755
10145
  return a <= b && a <= c ? left : b <= c ? up : upperLeft;
9756
10146
  }
9757
10147
  const _exports = Object.freeze({ pngPixels: pngPixels });
9758
- _modules.set("55eee1527c670926d154776e46828f4a0f8ae4df5c041a62ff851925b349f9db", _exports);
10148
+ _modules.set("749d1ec5422c0087787f525ef42e3b8d3a94d2b70eb5e42d2e3723a870777ad6", _exports);
9759
10149
  return _exports;
9760
10150
  })();
9761
10151
 
9762
- const _m83 = _modules.get("f7e93a79ae9f66b8bbc83d3534c0f5b8df6e85447494ee0532d86f7c53aa7746") ?? (() => {
10152
+ const _m84 = _modules.get("7dca2d9ca5c43893abdaf86df5b1bcb1f3de3d5d33532d082fdfe04711999d21") ?? (() => {
9763
10153
  const { NotSupportedError, OfficeIMOError } = _m2;
9764
10154
 
9765
10155
  const { checkAbort, pause, taskYieldDue } = _m4;
9766
10156
 
9767
- const { pngPixels } = _m84;
10157
+ const { pngPixels } = _m85;
9768
10158
 
9769
10159
  /** Shared document image resources; source objects are captured on first consumption. */
9770
10160
  class PdfDocumentImages {
@@ -9889,11 +10279,11 @@ function jpegSize(bytes) {
9889
10279
  throw new TypeError("JPEG image has no complete frame and scan.");
9890
10280
  }
9891
10281
  const _exports = Object.freeze({ PdfDocumentImages: PdfDocumentImages });
9892
- _modules.set("f7e93a79ae9f66b8bbc83d3534c0f5b8df6e85447494ee0532d86f7c53aa7746", _exports);
10282
+ _modules.set("7dca2d9ca5c43893abdaf86df5b1bcb1f3de3d5d33532d082fdfe04711999d21", _exports);
9893
10283
  return _exports;
9894
10284
  })();
9895
10285
 
9896
- const _m85 = _modules.get("7904dbe183e98e39e18538292dfe007832e8efe39b812f98f1ec5bc96d4e5459") ?? (() => {
10286
+ const _m86 = _modules.get("3290c84fdf80725af802f497d947bc088aa8d93d9db0a33f6f829f9153aa6fd6") ?? (() => {
9897
10287
  const { OfficeIMOError } = _m2;
9898
10288
 
9899
10289
  const { checkAbort, pause, taskYieldDue } = _m4;
@@ -9976,11 +10366,11 @@ async function vectorCommands(block, settings, used) {
9976
10366
  commands.join("") + (fill !== undefined && stroke !== undefined ? "B" : fill !== undefined ? "f" : "S") + (fill !== undefined && fillRule === "evenodd" ? "*" : "") + "\n" };
9977
10367
  }
9978
10368
  const _exports = Object.freeze({ vectorCommands: vectorCommands });
9979
- _modules.set("7904dbe183e98e39e18538292dfe007832e8efe39b812f98f1ec5bc96d4e5459", _exports);
10369
+ _modules.set("3290c84fdf80725af802f497d947bc088aa8d93d9db0a33f6f829f9153aa6fd6", _exports);
9980
10370
  return _exports;
9981
10371
  })();
9982
10372
 
9983
- const _m86 = _modules.get("3bd0bb004f6877b01eb84161fdbcdee0e02df16f4d746e0c2b58d0e001e8a1fe") ?? (() => {
10373
+ const _m87 = _modules.get("da9ad00f94b9ae28e2e3de796928ff0c4eab1d73382b1441e7d779fad4278ef7") ?? (() => {
9984
10374
  const { NotSupportedError, OfficeIMOError } = _m2;
9985
10375
 
9986
10376
  const { checkAbort, pause, taskYieldDue } = _m4;
@@ -10223,25 +10613,27 @@ async function prepareDrawing(drawing, settings, fonts, used) {
10223
10613
  return { width: captured.width, height: captured.height, content: fragments.join(""), commands: captured.commands, elements: captured.elements };
10224
10614
  }
10225
10615
  const _exports = Object.freeze({ checkDrawingBlock: checkDrawingBlock, prepareDrawing: prepareDrawing });
10226
- _modules.set("3bd0bb004f6877b01eb84161fdbcdee0e02df16f4d746e0c2b58d0e001e8a1fe", _exports);
10616
+ _modules.set("da9ad00f94b9ae28e2e3de796928ff0c4eab1d73382b1441e7d779fad4278ef7", _exports);
10227
10617
  return _exports;
10228
10618
  })();
10229
10619
 
10230
- const _m87 = _modules.get("7e360ac48a118b9a220b682e942dcf53d2e14ed8e0730a8fde6df009828b0966") ?? (() => {
10620
+ const _m88 = _modules.get("5e4503b77b357ee6d9fad1f52690085b0f0b140cd3b550b63c5100ed95a92f88") ?? (() => {
10231
10621
  const { OfficeIMOError } = _m2;
10232
10622
 
10233
- const { capturePdfText, wrapPdfText } = _m69;
10623
+ const { capturePdfText, wrapPdfText } = _m70;
10234
10624
 
10235
10625
  const { positive } = _m55;
10236
10626
 
10237
10627
  const { resolveParagraphStyle } = _m56;
10238
10628
 
10239
- const { captureBookmark } = _m76;
10629
+ const { captureBookmark } = _m77;
10240
10630
 
10241
10631
  const { captureFields } = _m10;
10242
10632
 
10633
+ const { pdfBudgetText } = _m69;
10634
+
10243
10635
  /** @internal Copy public paragraph input before any cooperative layout or source enumeration. */
10244
- function captureParagraph(block, settings, fonts) {
10636
+ function captureParagraph(block, settings, fonts, budgetOnPaint = false) {
10245
10637
  if (!block || block.kind !== "paragraph")
10246
10638
  throw new TypeError("PDF paragraph groups accept paragraph blocks only.");
10247
10639
  const { text, headingLevel, presentation: inputStyle, fontSize, keepTogether, keepWithNext, spaceBefore, spaceAfter, style: styleName, bookmark: inputBookmark } = block;
@@ -10254,7 +10646,8 @@ function captureParagraph(block, settings, fonts) {
10254
10646
  }, settings.paragraphStyles);
10255
10647
  const style = resolved.presentation ?? Object.freeze({}), size = positive(resolved.fontSize ?? settings.fontSize, "Paragraph font size", 144);
10256
10648
  const bookmark = captureBookmark(inputBookmark, settings);
10257
- return Object.freeze({ text: capturePdfText(text, style, settings, fonts, false), style, size,
10649
+ return Object.freeze({ text: capturePdfText(text, style, settings, fonts, false, !budgetOnPaint), style, size,
10650
+ ...(budgetOnPaint ? { budgetOnPaint: true } : {}),
10258
10651
  ...(headingLevel === undefined ? {} : { headingLevel }), ...(bookmark === undefined ? {} : { bookmark }),
10259
10652
  keepTogether: resolved.keepTogether ?? false, keepWithNext: resolved.keepWithNext ?? false,
10260
10653
  spaceBefore: resolved.spaceBefore ?? 0, spaceAfter: resolved.spaceAfter ?? 8 });
@@ -10265,13 +10658,16 @@ function captureCaption(caption, settings, fonts) {
10265
10658
  Object.keys(caption).some(key => !["text", "style", "fontSize", "presentation", "spaceBefore", "spaceAfter"].includes(key)))
10266
10659
  throw new TypeError("PDF captions support text, style, fontSize, presentation, spaceBefore and spaceAfter.");
10267
10660
  return captureParagraph({ ...captureFields(caption, ["text", "style", "fontSize", "presentation", "spaceBefore", "spaceAfter"]),
10268
- kind: "paragraph", keepTogether: true, keepWithNext: true }, settings, fonts);
10661
+ kind: "paragraph", keepTogether: true, keepWithNext: true }, settings, fonts, true);
10269
10662
  }
10270
10663
  /** @internal Layout is bounded by the same per-cell text and wrapped-line limits as table cells. */
10271
10664
  async function prepareParagraph(captured, settings, fonts, width = settings.page.width - settings.margins.left - settings.margins.right) {
10272
10665
  if (!captured.text.text)
10273
10666
  return { ...captured, lines: [], height: 0, firstHeight: 0 };
10274
- settings.budget.cell(captured.text.text, captured.text.text.length);
10667
+ if (!captured.budgetOnPaint) {
10668
+ const budgetText = pdfBudgetText(captured.text.text, settings.budget);
10669
+ settings.budget.cell(budgetText, budgetText.length);
10670
+ }
10275
10671
  const lines = await wrapPdfText(captured.text, fonts, captured.size, positive(width, "Paragraph width"), settings);
10276
10672
  return { ...captured, lines, height: captured.spaceBefore + lines.reduce((height, line) => height + line.lineHeight, 0) + captured.spaceAfter,
10277
10673
  firstHeight: captured.spaceBefore + lines[0].lineHeight };
@@ -10301,14 +10697,14 @@ function paragraphStartHeight(paragraphs) {
10301
10697
  return required;
10302
10698
  }
10303
10699
  const _exports = Object.freeze({ captureParagraph: captureParagraph, captureCaption: captureCaption, prepareParagraph: prepareParagraph, checkParagraphBuffer: checkParagraphBuffer, paragraphStartHeight: paragraphStartHeight });
10304
- _modules.set("7e360ac48a118b9a220b682e942dcf53d2e14ed8e0730a8fde6df009828b0966", _exports);
10700
+ _modules.set("5e4503b77b357ee6d9fad1f52690085b0f0b140cd3b550b63c5100ed95a92f88", _exports);
10305
10701
  return _exports;
10306
10702
  })();
10307
10703
 
10308
- const _m88 = _modules.get("57e348628775da4857f6a81eb64a59b0ce1669657fa7b1fa2a7bb17485be2475") ?? (() => {
10309
- const { capturePdfText, wrapPdfText } = _m69;
10704
+ const _m89 = _modules.get("1d57c429705ae0cbc14d98dcfef4c8a6c2df06f391c8f58e99cacb02f2d1cbc7") ?? (() => {
10705
+ const { capturePdfText, wrapPdfText } = _m70;
10310
10706
 
10311
- const { captureParagraph, prepareParagraph } = _m87;
10707
+ const { captureParagraph, prepareParagraph } = _m88;
10312
10708
 
10313
10709
  const { resolveParagraphStyle } = _m56;
10314
10710
 
@@ -10359,11 +10755,11 @@ async function prepareListItem(item, index, options, settings, fonts) {
10359
10755
  height: paragraph.height + lineHeight - first.lineHeight, firstHeight: paragraph.spaceBefore + lineHeight } };
10360
10756
  }
10361
10757
  const _exports = Object.freeze({ captureListOptions: captureListOptions, prepareListItem: prepareListItem });
10362
- _modules.set("57e348628775da4857f6a81eb64a59b0ce1669657fa7b1fa2a7bb17485be2475", _exports);
10758
+ _modules.set("1d57c429705ae0cbc14d98dcfef4c8a6c2df06f391c8f58e99cacb02f2d1cbc7", _exports);
10363
10759
  return _exports;
10364
10760
  })();
10365
10761
 
10366
- const _m90 = _modules.get("0c51d89c5cf0ebfeddbe03d5cd04c8bd29a78cdf70b244a68d44fdf82f0f0016") ?? (() => {
10762
+ const _m91 = _modules.get("d04686d2c067355dfd215333b83eb5f79f96e9e4be49f942e050f21ac0795343") ?? (() => {
10367
10763
  const { assertGroupedReportSource } = _m8;
10368
10764
 
10369
10765
  const { captureFields } = _m10;
@@ -10409,26 +10805,26 @@ function captureGroupedPdfTableOptions(configuration) {
10409
10805
  ...(captured.footerPresentation === undefined ? {} : { footerPresentation: presentation(captured.footerPresentation) }) });
10410
10806
  }
10411
10807
  const _exports = Object.freeze({ groupedPdfLabelFields: groupedPdfLabelFields, groupedPdfTableFields: groupedPdfTableFields, pdfGroupedTable: pdfGroupedTable, captureGroupedPdfTableOptions: captureGroupedPdfTableOptions });
10412
- _modules.set("0c51d89c5cf0ebfeddbe03d5cd04c8bd29a78cdf70b244a68d44fdf82f0f0016", _exports);
10808
+ _modules.set("d04686d2c067355dfd215333b83eb5f79f96e9e4be49f942e050f21ac0795343", _exports);
10413
10809
  return _exports;
10414
10810
  })();
10415
10811
 
10416
- const _m89 = _modules.get("1b926dd1b74341a9639f4b5672eff09e7f4454be52608ee78d5782bf3417f0f7") ?? (() => {
10812
+ const _m90 = _modules.get("d43e573fd5bad18a7ec2d71752168c422c4f8fabbc51f1cef8e3ba389f298715") ?? (() => {
10417
10813
  const { assertGroupedReportSource, groupedReportOperation } = _m8;
10418
10814
 
10419
10815
  const { consumeRows } = _m4;
10420
10816
 
10421
10817
  const { ExportCell } = _m5;
10422
10818
 
10423
- const { captureGroupedPdfTableOptions } = _m90;
10819
+ const { captureGroupedPdfTableOptions } = _m91;
10424
10820
 
10425
10821
  const { settings } = _m55;
10426
10822
 
10427
- const { PdfTableLayout } = _m67;
10823
+ const { PdfTableLayout } = _m68;
10428
10824
 
10429
- const { captureCaption, captureParagraph, prepareParagraph } = _m87;
10825
+ const { captureCaption, captureParagraph, prepareParagraph } = _m88;
10430
10826
 
10431
- const { synchronousText } = _m68;
10827
+ const { synchronousText } = _m69;
10432
10828
 
10433
10829
  /** @internal Render one analytical source in the existing document session. Retain one detail row and
10434
10830
  * at most four closing subtotals. All captions, rows, pages, bytes and fonts use the document owners. */
@@ -10457,10 +10853,44 @@ async function renderGroupedPdfTable(block, context) {
10457
10853
  const continuationLabels = new WeakMap();
10458
10854
  let pending;
10459
10855
  const closing = [];
10460
- const summaryValues = (label, values) => Object.freeze([
10856
+ const aggregatePositions = report.columns.flatMap((column, index) => Object.hasOwn(report.totals, column.key) ? [index] : []);
10857
+ const summaryValues = (label, values, positions) => Object.freeze([
10461
10858
  new ExportCell(label, { text: label, presentation: table.options.footerPresentation }),
10462
- ...values.map(value => new ExportCell(value, { presentation: table.options.footerPresentation }))
10859
+ ...(positions ? positions.map(index => values[index]) : values).map(value => new ExportCell(value, { presentation: table.options.footerPresentation }))
10463
10860
  ]);
10861
+ // Independent summaries have no detail values in non-aggregate columns. Project their
10862
+ // declared operations, including zero/null results, rather than emitting label-only bands.
10863
+ // Keep callback positions in the original source model after this physical projection.
10864
+ const summaryLayouts = new Map();
10865
+ const summaryLayout = (grand) => {
10866
+ const existing = summaryLayouts.get(grand);
10867
+ if (existing)
10868
+ return existing;
10869
+ const positions = [0, ...aggregatePositions.map(index => index + 1)];
10870
+ const projected = positions.map(position => {
10871
+ const column = columns[position];
10872
+ if (!grand)
10873
+ return column;
10874
+ const { groups: _groups, ...leaf } = column;
10875
+ return leaf;
10876
+ });
10877
+ const originalPosition = (position) => {
10878
+ const columnIndex = positions[position.columnIndex];
10879
+ return { ...position, columnIndex, column: columns[columnIndex] };
10880
+ };
10881
+ const repeatColumns = positions.flatMap((position, index) => position === 0 || table.repeatedColumns.includes(position) ? [index] : []);
10882
+ const wideTable = table.options.wideTable;
10883
+ const projectedSettings = { ...sharedTable,
10884
+ repeatedColumns: Object.freeze(repeatColumns), options: { ...table.options, columns: projected,
10885
+ ...(table.options.columnWidths === undefined ? {} : { columnWidths: positions.map(position => table.options.columnWidths[position]) }),
10886
+ ...(typeof wideTable !== "object" ? {} : { wideTable: { ...wideTable, repeatColumns } }),
10887
+ ...(table.options.formatValue === undefined ? {} : { formatValue: (value, position) => table.options.formatValue(value, originalPosition(position)) }),
10888
+ ...(table.options.formatRuns === undefined ? {} : { formatRuns: (value, position) => table.options.formatRuns(value, originalPosition(position)) })
10889
+ } };
10890
+ const projectedLayout = new PdfTableLayout(projectedSettings, fonts);
10891
+ summaryLayouts.set(grand, projectedLayout);
10892
+ return projectedLayout;
10893
+ };
10464
10894
  const prepareGroupContext = async () => {
10465
10895
  const caption = await prepareParagraph(captureCaption({ text: path.map(group => group.label).join("\n"),
10466
10896
  presentation: { bold: true }, spaceAfter: 4 }, pages.settings, fonts), pages.settings, fonts);
@@ -10523,26 +10953,46 @@ async function renderGroupedPdfTable(block, context) {
10523
10953
  ...(group.label.trim() ? { bookmark: { title: group.label, level: (groupHeadingLevel + group.level) } } : {})
10524
10954
  }, pages.settings, fonts), pages.settings, fonts));
10525
10955
  const groupHeight = groupHeadings.reduce((height, heading) => height + heading.height, 0);
10526
- await context.flushParagraphs((caption?.height ?? 0) + groupHeight + headingHeight + minimum);
10527
- let followingHeight = groupHeight + caption.height + headingHeight + minimum;
10956
+ // Newly opened semantic headings already paint the end of this path. Only the open
10957
+ // ancestor prefix needs an artifact here; later physical bands still paint the full path.
10958
+ const ancestorCaption = semantic && semanticDepth > 0 ? await prepareParagraph(captureCaption({
10959
+ text: path.slice(0, semanticDepth).map(group => group.label).join("\n"), presentation: { bold: true }, spaceAfter: 4
10960
+ }, pages.settings, fonts), pages.settings, fonts) : undefined;
10961
+ const openingHeight = semantic ? (ancestorCaption?.height ?? 0) + groupHeight : caption.height;
10962
+ await context.flushParagraphs(openingHeight + headingHeight + minimum);
10963
+ if (ancestorCaption)
10964
+ await pages.paragraphs([ancestorCaption], groupHeight + headingHeight + minimum, true, { artifact: true });
10965
+ let followingHeight = groupHeight + (semantic ? 0 : caption.height) + headingHeight + minimum;
10528
10966
  for (const heading of groupHeadings) {
10529
10967
  followingHeight -= heading.height;
10530
10968
  await pages.beginGroup(semanticDepth++, heading, followingHeight);
10531
10969
  }
10532
- await pages.beginTable(layout, headings, minimum, caption, continuation, false, semantic);
10970
+ await pages.beginTable(layout, headings, minimum, caption, continuation, false, semantic, semantic);
10533
10971
  started = true;
10534
10972
  firstFragment = (caption?.lines.length ?? 0) > 0 || groupHeadings.some(heading => heading.lines.length > 0);
10535
10973
  };
10536
- const semanticSubtotal = async (row, level) => {
10974
+ const semanticSubtotal = async (row, level, values) => {
10975
+ if (level === report.groupBy.length - 1) {
10976
+ // A leaf's own subtotal shares its detail table and header identities. Keep the last
10977
+ // detail/summary bundle when it fits; the existing flow owns continuation and limits.
10978
+ pages.summary(row);
10979
+ closing.push(row);
10980
+ await finishLeaf();
10981
+ await pages.endGroup(level);
10982
+ semanticDepth = level;
10983
+ path = path.slice(0, level);
10984
+ return;
10985
+ }
10537
10986
  await finishLeaf();
10538
10987
  const { caption, continuation } = await prepareGroupContext();
10539
- const minimum = layout.minimumRowHeight(row);
10540
- await context.flushParagraphs(caption.height + headingHeight + minimum);
10988
+ const projected = summaryLayout(false), summaryHeadings = await projected.headers();
10989
+ const summaryRow = await projected.data(values, 0, true), minimum = projected.minimumRowHeight(summaryRow);
10990
+ await context.flushParagraphs(caption.height + await projected.blockHeight(summaryHeadings) + minimum);
10541
10991
  // An ancestor subtotal belongs to that ancestor's section, never the final child's table.
10542
10992
  // Its own visible column headings keep the separate logical summary table truthful.
10543
- await pages.beginTable(layout, headings, minimum, caption, continuation, false, true);
10544
- pages.summary(row);
10545
- await pages.row(row, caption.lines.length > 0 || headings.length > 0);
10993
+ await pages.beginTable(projected, summaryHeadings, minimum, caption, continuation, false, true);
10994
+ pages.summary(summaryRow);
10995
+ await pages.row(summaryRow, caption.lines.length > 0 || summaryHeadings.length > 0);
10546
10996
  await pages.endTable();
10547
10997
  await pages.endGroup(level);
10548
10998
  semanticDepth = level;
@@ -10552,25 +11002,19 @@ async function renderGroupedPdfTable(block, context) {
10552
11002
  await finishLeaf();
10553
11003
  if (!includeGrandTotal && summary.rows !== 0)
10554
11004
  return;
10555
- const completeColumns = summary.rows === 0 ? columns : columns.map(column => {
10556
- const { groups: _groups, ...leaf } = column;
10557
- return leaf;
10558
- });
10559
- const completeTable = settings({ ...table.options, columns: completeColumns,
10560
- includeHeader: input.includeHeader ?? true });
10561
- const completeLayout = summary.rows === 0 ? layout : new PdfTableLayout({ ...completeTable, budget: prepared.budget }, fonts);
11005
+ const completeLayout = summary.rows === 0 ? layout : summaryLayout(true);
10562
11006
  const completeHeadings = summary.rows === 0 ? headings : await completeLayout.headers();
10563
11007
  rowIndex = -1;
10564
11008
  let total;
10565
11009
  if (includeGrandTotal) {
10566
11010
  context.acceptRow(false);
10567
- total = await completeLayout.data(summaryValues(synchronousText(grandTotalLabel(summary), "grandTotalLabel"), summary.totals), 0, true);
11011
+ total = await completeLayout.data(summaryValues(synchronousText(grandTotalLabel(summary), "grandTotalLabel"), summary.totals, summary.rows === 0 ? undefined : aggregatePositions), 0, true);
10568
11012
  }
10569
11013
  if (!completeHeadings.length && !total)
10570
11014
  return;
10571
11015
  const minimum = total ? completeLayout.minimumRowHeight(total) : 0;
10572
11016
  await context.flushParagraphs(await completeLayout.blockHeight(completeHeadings) + minimum);
10573
- await pages.beginTable(completeLayout, completeHeadings, minimum, undefined, undefined, !semantic && summary.rows !== 0);
11017
+ await pages.beginTable(completeLayout, completeHeadings, minimum);
10574
11018
  if (total) {
10575
11019
  if (semantic)
10576
11020
  pages.summary(total);
@@ -10598,9 +11042,11 @@ async function renderGroupedPdfTable(block, context) {
10598
11042
  case "groupEnd": {
10599
11043
  rowIndex = -1;
10600
11044
  context.acceptRow(false);
10601
- const row = await layout.data(summaryValues(synchronousText(subtotalLabel(event), "subtotalLabel"), event.totals), 0, true);
11045
+ const separate = semantic && event.level !== report.groupBy.length - 1;
11046
+ const values = summaryValues(synchronousText(subtotalLabel(event), "subtotalLabel"), event.totals, separate ? aggregatePositions : undefined);
11047
+ const row = separate ? undefined : await layout.data(values, 0, true);
10602
11048
  if (semantic)
10603
- await semanticSubtotal(row, event.level);
11049
+ await semanticSubtotal(row, event.level, values);
10604
11050
  else
10605
11051
  closing.push(row);
10606
11052
  break;
@@ -10617,11 +11063,11 @@ async function renderGroupedPdfTable(block, context) {
10617
11063
  }
10618
11064
  }
10619
11065
  const _exports = Object.freeze({ renderGroupedPdfTable: renderGroupedPdfTable });
10620
- _modules.set("1b926dd1b74341a9639f4b5672eff09e7f4454be52608ee78d5782bf3417f0f7", _exports);
11066
+ _modules.set("d43e573fd5bad18a7ec2d71752168c422c4f8fabbc51f1cef8e3ba389f298715", _exports);
10621
11067
  return _exports;
10622
11068
  })();
10623
11069
 
10624
- const _m82 = _modules.get("0b53b552fbfad950bf3455ae0266ec34d40deadc96dd3e1fe03d26cce63ea40f") ?? (() => {
11070
+ const _m83 = _modules.get("67060b0c8b6d3f6a6d9d53d41dd780ee99ffdae0ed0f90004ac675d382a80223") ?? (() => {
10625
11071
  const { BlobByteSink, withDestination } = _m3;
10626
11072
 
10627
11073
  const { OfficeIMOError } = _m2;
@@ -10638,25 +11084,25 @@ const { settings, captureWideTable } = _m55;
10638
11084
 
10639
11085
  const { pdfNumber: n } = _m59;
10640
11086
 
10641
- const { PdfTableLayout } = _m67;
11087
+ const { PdfTableLayout } = _m68;
10642
11088
 
10643
11089
  const { PdfWriteSession } = _m58;
10644
11090
 
10645
- const { PdfDocumentImages } = _m83;
11091
+ const { PdfDocumentImages } = _m84;
10646
11092
 
10647
- const { vectorCommands } = _m85;
11093
+ const { vectorCommands } = _m86;
10648
11094
 
10649
- const { graphicAlternative } = _m78;
11095
+ const { graphicAlternative } = _m79;
10650
11096
 
10651
- const { checkDrawingBlock, prepareDrawing } = _m86;
11097
+ const { checkDrawingBlock, prepareDrawing } = _m87;
10652
11098
 
10653
- const { captureParagraph, captureCaption, prepareParagraph, checkParagraphBuffer, paragraphStartHeight } = _m87;
11099
+ const { captureParagraph, captureCaption, prepareParagraph, checkParagraphBuffer, paragraphStartHeight } = _m88;
10654
11100
 
10655
- const { captureListOptions, prepareListItem } = _m88;
11101
+ const { captureListOptions, prepareListItem } = _m89;
10656
11102
 
10657
- const { captureSection } = _m76;
11103
+ const { captureSection } = _m77;
10658
11104
 
10659
- const { renderGroupedPdfTable } = _m89;
11105
+ const { renderGroupedPdfTable } = _m90;
10660
11106
 
10661
11107
  const tableOptionFields = ["columns", "includeHeader", "headerRows", "footer", "headerPresentation", "footerPresentation", "alternateRowColor", "columnWidths", "wideTable", "formatValue", "formatRuns"];
10662
11108
  /** Capture typed columns for a single-use table source in a composed document. */
@@ -10911,22 +11357,22 @@ function captureTableOptions(options) {
10911
11357
  return { ...captured, ...(captured.wideTable === undefined ? {} : { wideTable: captureWideTable(captured.wideTable) }) };
10912
11358
  }
10913
11359
  const _exports = Object.freeze({ pdfTable: pdfTable, writePdfDocument: writePdfDocument, writePdfDocumentTo: writePdfDocumentTo });
10914
- _modules.set("0b53b552fbfad950bf3455ae0266ec34d40deadc96dd3e1fe03d26cce63ea40f", _exports);
11360
+ _modules.set("67060b0c8b6d3f6a6d9d53d41dd780ee99ffdae0ed0f90004ac675d382a80223", _exports);
10915
11361
  return _exports;
10916
11362
  })();
10917
11363
 
10918
- const _m81 = _modules.get("3f9d005ed3e31b1080249d471774fa84044f9fa1ec30d71d01d3c2cf77818c4d") ?? (() => {
11364
+ const _m82 = _modules.get("91d1ab43a388d5d7a78db095e27ed8b0f6d28004358cbf296ac818479c58c557") ?? (() => {
10919
11365
  const { assertGroupedReportSource } = _m8;
10920
11366
 
10921
11367
  const { BlobByteSink } = _m3;
10922
11368
 
10923
- const { writePdfDocumentTo } = _m82;
11369
+ const { writePdfDocumentTo } = _m83;
10924
11370
 
10925
11371
  const { pdfOptionFields } = _m55;
10926
11372
 
10927
11373
  const { captureFields } = _m10;
10928
11374
 
10929
- const { pdfGroupedTable, groupedPdfLabelFields, groupedPdfTableFields } = _m90;
11375
+ const { pdfGroupedTable, groupedPdfLabelFields, groupedPdfTableFields } = _m91;
10930
11376
 
10931
11377
 
10932
11378
 
@@ -10960,15 +11406,15 @@ async function writeGroupedPdfTo(report, destination, configuration) {
10960
11406
  delete documentOptions.footer;
10961
11407
  return writePdfDocumentTo([pdfGroupedTable(report, tableOptions)], destination, documentOptions);
10962
11408
  }
10963
- const _exports = Object.freeze({ pdfGroupedTable: _m90.pdfGroupedTable, writeGroupedPdf: writeGroupedPdf, writeGroupedPdfTo: writeGroupedPdfTo });
10964
- _modules.set("3f9d005ed3e31b1080249d471774fa84044f9fa1ec30d71d01d3c2cf77818c4d", _exports);
11409
+ const _exports = Object.freeze({ pdfGroupedTable: _m91.pdfGroupedTable, writeGroupedPdf: writeGroupedPdf, writeGroupedPdfTo: writeGroupedPdfTo });
11410
+ _modules.set("91d1ab43a388d5d7a78db095e27ed8b0f6d28004358cbf296ac818479c58c557", _exports);
10965
11411
  return _exports;
10966
11412
  })();
10967
11413
 
10968
- const _m91 = _modules.get("6ac9b32affc9008e5bd8620fd3792022dfdcd4e0fe51c678bb2ba26bcbe95fd9") ?? (() => {
10969
- const { fontProgram } = _m61;
11414
+ const _m92 = _modules.get("3d777096288d1be55a05a80bc015d4674212e587703f25a7e7cf99a8065feb86") ?? (() => {
11415
+ const { fontProgram } = _m62;
10970
11416
 
10971
- const { resolveScalar, selectFont, validateFonts } = _m65;
11417
+ const { resolveScalar, selectFont, validateFonts } = _m66;
10972
11418
 
10973
11419
  /**
10974
11420
  * Check one text run against the writer's selected font and scalar-layout rules.
@@ -11001,18 +11447,18 @@ function preflightPdfText(text, options = {}) {
11001
11447
  return { supported: true };
11002
11448
  }
11003
11449
  const _exports = Object.freeze({ preflightPdfText: preflightPdfText });
11004
- _modules.set("6ac9b32affc9008e5bd8620fd3792022dfdcd4e0fe51c678bb2ba26bcbe95fd9", _exports);
11450
+ _modules.set("3d777096288d1be55a05a80bc015d4674212e587703f25a7e7cf99a8065feb86", _exports);
11005
11451
  return _exports;
11006
11452
  })();
11007
11453
 
11008
- const _m53 = _modules.get("71169c44be949c319579ad95fc607b6a64115646c56e93cb6b58d6b9e26fb0bf") ?? (() => {
11454
+ const _m53 = _modules.get("dcf6840f5eda4f8535cb4e226425587c2ae436c0eebfbd746aa0bc8a7acb6c4c") ?? (() => {
11009
11455
 
11010
- const _exports = Object.freeze({ writePdf: _m54.writePdf, writePdfTo: _m54.writePdfTo, writeGroupedPdf: _m81.writeGroupedPdf, writeGroupedPdfTo: _m81.writeGroupedPdfTo, pdfGroupedTable: _m81.pdfGroupedTable, createGroupedReport: _m8.createGroupedReport, writePdfDocument: _m82.writePdfDocument, writePdfDocumentTo: _m82.writePdfDocumentTo, pdfTable: _m82.pdfTable, PdfFont: _m61.PdfFont, preflightPdfText: _m91.preflightPdfText, ExportCell: _m5.ExportCell, saveBlob: _m1.saveBlob });
11011
- _modules.set("71169c44be949c319579ad95fc607b6a64115646c56e93cb6b58d6b9e26fb0bf", _exports);
11456
+ const _exports = Object.freeze({ writePdf: _m54.writePdf, writePdfTo: _m54.writePdfTo, writeGroupedPdf: _m82.writeGroupedPdf, writeGroupedPdfTo: _m82.writeGroupedPdfTo, pdfGroupedTable: _m82.pdfGroupedTable, createGroupedReport: _m8.createGroupedReport, writePdfDocument: _m83.writePdfDocument, writePdfDocumentTo: _m83.writePdfDocumentTo, pdfTable: _m83.pdfTable, PdfFont: _m62.PdfFont, preflightPdfText: _m92.preflightPdfText, ExportCell: _m5.ExportCell, saveBlob: _m1.saveBlob });
11457
+ _modules.set("dcf6840f5eda4f8535cb4e226425587c2ae436c0eebfbd746aa0bc8a7acb6c4c", _exports);
11012
11458
  return _exports;
11013
11459
  })();
11014
11460
 
11015
- const _m92 = _modules.get("e37eb5f0298d8bc9492db790f163f4a1d6d8b4293981cfdacfcd9d9810ec9b7f") ?? (() => {
11461
+ const _m93 = _modules.get("e37eb5f0298d8bc9492db790f163f4a1d6d8b4293981cfdacfcd9d9810ec9b7f") ?? (() => {
11016
11462
  /** @internal Runtime-checked calls across the optional third-party API boundary. */
11017
11463
  function call(owner, name, ...args) {
11018
11464
  const fn = member(owner, name);
@@ -11045,12 +11491,12 @@ _modules.set("e37eb5f0298d8bc9492db790f163f4a1d6d8b4293981cfdacfcd9d9810ec9b7f",
11045
11491
  return _exports;
11046
11492
  })();
11047
11493
 
11048
- const _m93 = _modules.get("0e5ede7759618ed3ec827d34fbd62b205f3a5241650504807c24e5323a2496a5") ?? (() => {
11494
+ const _m94 = _modules.get("0e5ede7759618ed3ec827d34fbd62b205f3a5241650504807c24e5323a2496a5") ?? (() => {
11049
11495
  const { ExportCell, assertExportValue } = _m5;
11050
11496
 
11051
11497
  const { tableSpans } = _m17;
11052
11498
 
11053
- const { member } = _m92;
11499
+ const { member } = _m93;
11054
11500
 
11055
11501
  /** @internal */
11056
11502
  function value(input) {
@@ -11119,18 +11565,18 @@ _modules.set("0e5ede7759618ed3ec827d34fbd62b205f3a5241650504807c24e5323a2496a5",
11119
11565
  return _exports;
11120
11566
  })();
11121
11567
 
11122
- const _m94 = _modules.get("c5a0fad0264a40f2d2fd98103420511fc42e3e3fe1d67889bd550927a1b9e196") ?? (() => {
11568
+ const _m95 = _modules.get("355177890a4e7a43de040650e9c2359a6ccf105705bc6231f51db5975a838d3d") ?? (() => {
11123
11569
  const { checkAbort, pause, rowsFromBatches, taskYieldDue } = _m4;
11124
11570
 
11125
11571
  const { ExportBudget } = _m9;
11126
11572
 
11127
11573
  const { captureFields } = _m10;
11128
11574
 
11129
- const { columnOptionFields } = _m11;
11575
+ const { columnOptionFields, copyColumns } = _m11;
11130
11576
 
11131
- const { array, call, indexes, member } = _m92;
11577
+ const { array, call, indexes, member } = _m93;
11132
11578
 
11133
- const { headings, text, value } = _m93;
11579
+ const { headings, text, value } = _m94;
11134
11580
 
11135
11581
  function safeOptions(options) {
11136
11582
  options = captureFields(options, ["rows", "columns", "modifier", "orthogonal", "stripHtml", "stripNewlines", "decodeEntities", "escapeExcelFormula", "trim", "format", "customizeData"]);
@@ -11205,10 +11651,10 @@ function captureDataTablesExport(host, table, options = {}, omitted) {
11205
11651
  for (const index of columnIndexes)
11206
11652
  if (member(options.columnOptions?.[index], "value") !== undefined)
11207
11653
  throw new TypeError("DataTables columnOptions describes columns; resolve values with project.");
11208
- const columns = Object.freeze(leaf.map((label, index) => Object.freeze({
11654
+ const columns = Object.freeze(copyColumns(leaf.map((label, index) => ({
11209
11655
  header: text(label), key: "dt:" + columnIndexes[index], ...options.columnOptions?.[columnIndexes[index]],
11210
11656
  ...(heading.groups[index].length ? { groups: Object.freeze(heading.groups[index]) } : {})
11211
- })));
11657
+ }))).map(column => Object.freeze(column)));
11212
11658
  // Explicit heading overrides also apply to CSV's leaf heading.
11213
11659
  if (!heading.structure)
11214
11660
  heading.rows[heading.rows.length - 1] = columns.map(column => column.header);
@@ -11333,11 +11779,11 @@ function captureDataTablesExport(host, table, options = {}, omitted) {
11333
11779
  ...(footerHeading?.structure ? { footerStructure: footerHeading.structure } : {}), rowCount: count, rows });
11334
11780
  }
11335
11781
  const _exports = Object.freeze({ createDataTablesExport: createDataTablesExport, captureDataTablesExport: captureDataTablesExport });
11336
- _modules.set("c5a0fad0264a40f2d2fd98103420511fc42e3e3fe1d67889bd550927a1b9e196", _exports);
11782
+ _modules.set("355177890a4e7a43de040650e9c2359a6ccf105705bc6231f51db5975a838d3d", _exports);
11337
11783
  return _exports;
11338
11784
  })();
11339
11785
 
11340
- const _m95 = _modules.get("46b68ddd3bfb2a9f845c2684cd1de5fc4212610a87dc8da7d3e35fefc2a34367") ?? (() => {
11786
+ const _m96 = _modules.get("58066519dce31ad3bb7f5f5c377585d3374a84578358ad519e2c021efa1a26f8") ?? (() => {
11341
11787
  const { captureFields } = _m10;
11342
11788
 
11343
11789
  const { ExportBudget } = _m9;
@@ -11378,11 +11824,11 @@ function capturePdfOptions(input = {}) {
11378
11824
  return { ...options, ...(options.limits === undefined ? {} : { limits: capturePdfLimits(options.limits) }) };
11379
11825
  }
11380
11826
  const _exports = Object.freeze({ captureCommonLimits: captureCommonLimits, mergeAdapterLimits: mergeAdapterLimits, captureXlsxOptions: captureXlsxOptions, captureCsvOptions: captureCsvOptions, capturePdfOptions: capturePdfOptions });
11381
- _modules.set("46b68ddd3bfb2a9f845c2684cd1de5fc4212610a87dc8da7d3e35fefc2a34367", _exports);
11827
+ _modules.set("58066519dce31ad3bb7f5f5c377585d3374a84578358ad519e2c021efa1a26f8", _exports);
11382
11828
  return _exports;
11383
11829
  })();
11384
11830
 
11385
- const _m0 = _modules.get("a51cb067a86727f5fa111223487be3c47d95fddc3e466cd52e395c99cbbf4b3b") ?? (() => {
11831
+ const _m0 = _modules.get("0cb74f735a0253b5ad1598ebcb1f454c1a02fa8fb0b7a41976ca5639cacf7338") ?? (() => {
11386
11832
  const { BlobByteSink, checkAbort, saveBlob } = _m1;
11387
11833
 
11388
11834
  const { notifyProgress } = _m14;
@@ -11395,15 +11841,15 @@ const { writePdfTo } = _m53;
11395
11841
 
11396
11842
  const { portableSheet, portableWorkbook } = _m50;
11397
11843
 
11398
- const { call, member } = _m92;
11844
+ const { call, member } = _m93;
11399
11845
 
11400
- const { value } = _m93;
11846
+ const { value } = _m94;
11401
11847
 
11402
- const { captureDataTablesExport } = _m94;
11848
+ const { captureDataTablesExport } = _m95;
11403
11849
 
11404
11850
  const { captureFields } = _m10;
11405
11851
 
11406
- const { captureCommonLimits, captureXlsxOptions, captureCsvOptions, capturePdfOptions, mergeAdapterLimits } = _m95;
11852
+ const { captureCommonLimits, captureXlsxOptions, captureCsvOptions, capturePdfOptions, mergeAdapterLimits } = _m96;
11407
11853
 
11408
11854
 
11409
11855
 
@@ -11564,8 +12010,8 @@ function registerDataTablesButtons(host, options = {}) {
11564
12010
  };
11565
12011
  }
11566
12012
  }
11567
- const _exports = Object.freeze({ createDataTablesExport: _m94.createDataTablesExport, ExportCell: _m5.ExportCell, PdfFont: _m61.PdfFont, writeDataTableTo: writeDataTableTo, exportDataTable: exportDataTable, registerDataTablesButtons: registerDataTablesButtons });
11568
- _modules.set("a51cb067a86727f5fa111223487be3c47d95fddc3e466cd52e395c99cbbf4b3b", _exports);
12013
+ const _exports = Object.freeze({ createDataTablesExport: _m95.createDataTablesExport, ExportCell: _m5.ExportCell, PdfFont: _m62.PdfFont, writeDataTableTo: writeDataTableTo, exportDataTable: exportDataTable, registerDataTablesButtons: registerDataTablesButtons });
12014
+ _modules.set("0cb74f735a0253b5ad1598ebcb1f454c1a02fa8fb0b7a41976ca5639cacf7338", _exports);
11569
12015
  return _exports;
11570
12016
  })();
11571
12017
  Object.assign(officeimo, _m0);