@evotecit/officeimo 0.1.1 → 0.1.3

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 (43) hide show
  1. package/README.md +43 -49
  2. package/bundles/officeimo-canopyx.js +1047 -193
  3. package/bundles/officeimo-canopyx.mjs +958 -111
  4. package/bundles/officeimo-csv.js +18 -15
  5. package/bundles/officeimo-csv.mjs +16 -13
  6. package/bundles/officeimo-datatables.js +249 -153
  7. package/bundles/officeimo-datatables.mjs +169 -73
  8. package/bundles/officeimo-pdf.js +151 -67
  9. package/bundles/officeimo-pdf.mjs +127 -43
  10. package/bundles/officeimo-xlsx.js +78 -69
  11. package/bundles/officeimo-xlsx.mjs +26 -17
  12. package/bundles/officeimo.js +249 -153
  13. package/bundles/officeimo.mjs +169 -73
  14. package/dist/csv/index.js +16 -13
  15. package/dist/integrations/canopyx/diagnostics.d.ts +3 -0
  16. package/dist/integrations/canopyx/diagnostics.js +17 -0
  17. package/dist/integrations/canopyx/grouping.d.ts +6 -0
  18. package/dist/integrations/canopyx/grouping.js +188 -0
  19. package/dist/integrations/canopyx/index.d.ts +2 -2
  20. package/dist/integrations/canopyx/index.js +72 -15
  21. package/dist/integrations/canopyx/metadata.d.ts +4 -0
  22. package/dist/integrations/canopyx/metadata.js +51 -0
  23. package/dist/integrations/canopyx/presentation.d.ts +8 -0
  24. package/dist/integrations/canopyx/presentation.js +40 -0
  25. package/dist/integrations/canopyx/rule-predicates.d.ts +3 -0
  26. package/dist/integrations/canopyx/rule-predicates.js +110 -0
  27. package/dist/integrations/canopyx/rules.d.ts +6 -0
  28. package/dist/integrations/canopyx/rules.js +176 -0
  29. package/dist/integrations/canopyx/source.js +24 -22
  30. package/dist/integrations/canopyx/types.d.ts +89 -8
  31. package/dist/integrations/canopyx/workbook.d.ts +6 -0
  32. package/dist/integrations/canopyx/workbook.js +52 -0
  33. package/dist/opc/index.js +14 -9
  34. package/dist/pdf/font-resources.js +33 -14
  35. package/dist/pdf/pages.js +63 -16
  36. package/dist/pdf/table-band-flow.js +7 -2
  37. package/dist/pdf/table-band-plan.js +9 -1
  38. package/dist/pdf/table-layout.js +6 -2
  39. package/dist/pdf/table-structure.js +9 -8
  40. package/dist/xlsx/workbook.js +7 -4
  41. package/dist/xlsx/worksheet.js +2 -1
  42. package/dist/xml/index.js +3 -3
  43. package/package.json +1 -1
@@ -1110,7 +1110,7 @@ _modules.set("f0627ba89e5c8fcb376ebe3ce72dcc8d68c34952981f8703e36b8bb1a9894208",
1110
1110
  return _exports;
1111
1111
  })();
1112
1112
 
1113
- const _m15 = _modules.get("b6dbf755b495baef5c7d7651e6a55b2098f2ee304edca2c8b285a0bd7ec127a1") ?? (() => {
1113
+ const _m15 = _modules.get("b48bcab805d4c75294dd8d8e8dc57f96d9db3f5af31a8f0ddc6562f010f566e4") ?? (() => {
1114
1114
  const { beginTask, checkAbort, consumeRows, taskYieldDue, withAbort } = _m4;
1115
1115
 
1116
1116
  const { BlobByteSink, ChunkedTextSink, withDestination } = _m3;
@@ -1135,29 +1135,32 @@ const { captureCsvOptions } = _m19;
1135
1135
 
1136
1136
 
1137
1137
 
1138
- function csvField(value, delimiter, protect, quote, booleanText, nullValue) {
1139
- if (value == null && nullValue !== undefined)
1140
- value = nullValue;
1138
+ function csvField(value, delimiter, protect, quote, booleanText) {
1139
+ const kind = typeof value;
1141
1140
  let text;
1142
1141
  if (value == null)
1143
1142
  text = "";
1143
+ else if (kind === "string")
1144
+ text = value;
1145
+ else if (kind === "number") {
1146
+ text = Number.isFinite(value) ? String(value) : "";
1147
+ // Numeric text has no CSV delimiter, quote or line break to escape.
1148
+ return quote === "all" ? '"' + text + '"' : text;
1149
+ }
1150
+ else if (kind === "boolean")
1151
+ text = booleanText[value ? "true" : "false"];
1144
1152
  else if (isDate(value))
1145
1153
  text = Number.isFinite(value.getTime()) ? value.toISOString() : "";
1146
- else if (typeof value === "boolean")
1147
- text = booleanText[value ? "true" : "false"];
1148
- else if (typeof value === "number")
1149
- text = Number.isFinite(value) ? String(value) : "";
1150
- else if (typeof value === "string")
1151
- text = value;
1152
1154
  else {
1153
1155
  if (typeof value.then === "function")
1154
1156
  void Promise.resolve(value).catch(() => { });
1155
1157
  throw new TypeError("CSV cells and formatter results must be synchronous strings, numbers, booleans, Dates or null.");
1156
1158
  }
1157
- if (protect && (typeof value === "string" || typeof value === "boolean") && /^ *[=+\-@\t\r\n]/.test(text))
1159
+ // Only ASCII spaces, controls and markers through @ can begin the protected prefix.
1160
+ if (protect && (kind === "string" || kind === "boolean") && text.charCodeAt(0) <= 64 && /^ *[=+\-@\t\r\n]/.test(text))
1158
1161
  text = "'" + text;
1159
- return quote === "all" || (quote === "strings" && typeof value === "string") || text.includes(delimiter) || /["\r\n]/.test(text)
1160
- ? '"' + text.replace(/"/g, '""') + '"' : text;
1162
+ return quote === "all" || (quote === "strings" && kind === "string") || text.includes(delimiter) || /["\r\n]/.test(text)
1163
+ ? '"' + (text.includes('"') ? text.replace(/"/g, '""') : text) + '"' : text;
1161
1164
  }
1162
1165
  async function writeCsvTo(rows, destination, configuration) {
1163
1166
  const options = captureCsvOptions(configuration);
@@ -1209,7 +1212,7 @@ async function write(rows, sink, options) {
1209
1212
  value = options.nullValue;
1210
1213
  budget.cell(typeof value === "boolean" ? booleanText[value ? "true" : "false"] : value);
1211
1214
  checkAbort(signal);
1212
- text += (i ? delimiter : "") + csvField(value, delimiter, protect, quote, booleanText, options.nullValue);
1215
+ text += (i ? delimiter : "") + csvField(value, delimiter, protect, quote, booleanText);
1213
1216
  if (text.length >= buffer.chunkSize || (i & 127) === 127 && taskYieldDue()) {
1214
1217
  if (buffer.append(text))
1215
1218
  return buffer.flush().then(() => record(values, header, i + 1, snapshot));
@@ -1257,7 +1260,7 @@ async function writeCsv(rows, configuration) {
1257
1260
  }
1258
1261
  }
1259
1262
  const _exports = Object.freeze({ saveBlob: _m1.saveBlob, ExportCell: _m5.ExportCell, writeCsvTo: writeCsvTo, writeCsv: writeCsv });
1260
- _modules.set("b6dbf755b495baef5c7d7651e6a55b2098f2ee304edca2c8b285a0bd7ec127a1", _exports);
1263
+ _modules.set("b48bcab805d4c75294dd8d8e8dc57f96d9db3f5af31a8f0ddc6562f010f566e4", _exports);
1261
1264
  return _exports;
1262
1265
  })();
1263
1266
 
@@ -1309,12 +1312,14 @@ _modules.set("8ece66b561682170c879991995105163f4c484c8355d5e451fc6f52a9fbc3f82",
1309
1312
  return _exports;
1310
1313
  })();
1311
1314
 
1312
- const _m25 = _modules.get("2b85e926659d505b8142c9f8a4d8faf64a695a97dea19022031415c30e63d364") ?? (() => {
1315
+ const _m25 = _modules.get("227236fd7adc9472e188831b8f16fdc69338c4d779f2b69a8abbd8dbfa95b585") ?? (() => {
1313
1316
  const { OfficeIMOError } = _m2;
1314
1317
 
1315
1318
  const { ChunkedTextSink } = _m3;
1316
1319
 
1317
1320
  const xmlDeclaration = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
1321
+ const xmlEscapes = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&apos;",
1322
+ "\r": "&#13;", "\n": "&#10;", "\t": "&#9;" };
1318
1323
  /** XML 1.0 characters; Unicode mode retains valid surrogate pairs. */
1319
1324
  function cleanXml(value, policy = "strip") {
1320
1325
  if (policy !== "strip" && policy !== "reject")
@@ -1326,9 +1331,7 @@ function cleanXml(value, policy = "strip") {
1326
1331
  }
1327
1332
  /** Escape data, including whitespace that XML parsers otherwise normalize. */
1328
1333
  function escapeXml(value, policy = "strip") {
1329
- const escapes = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&apos;",
1330
- "\r": "&#13;", "\n": "&#10;", "\t": "&#9;" };
1331
- return cleanXml(value, policy).replace(/[&<>"'\r\n\t]/g, c => escapes[c]);
1334
+ return cleanXml(value, policy).replace(/[&<>"'\r\n\t]/g, c => xmlEscapes[c]);
1332
1335
  }
1333
1336
  /** Encode an OOXML ST_Xstring attribute without interpreting literal escape tokens as characters. */
1334
1337
  function escapeOoxmlAttribute(value, policy = "strip") {
@@ -1387,11 +1390,11 @@ class XmlWriter {
1387
1390
  throw new OfficeIMOError("INVALID_STATE", "XML writer is closed."); }
1388
1391
  }
1389
1392
  const _exports = Object.freeze({ xmlDeclaration: xmlDeclaration, cleanXml: cleanXml, escapeXml: escapeXml, escapeOoxmlAttribute: escapeOoxmlAttribute, validateXmlName: validateXmlName, XmlWriter: XmlWriter });
1390
- _modules.set("2b85e926659d505b8142c9f8a4d8faf64a695a97dea19022031415c30e63d364", _exports);
1393
+ _modules.set("227236fd7adc9472e188831b8f16fdc69338c4d779f2b69a8abbd8dbfa95b585", _exports);
1391
1394
  return _exports;
1392
1395
  })();
1393
1396
 
1394
- const _m24 = _modules.get("cd6fbdc4df9506c140f11083b3740d048b39c012670222001051b552dbc7bfb0") ?? (() => {
1397
+ const _m24 = _modules.get("56b2057461a668e8c90abd1fbf4f13ff93efd9854e590c82a195799f0f842c2a") ?? (() => {
1395
1398
  const { escapeXml, xmlDeclaration } = _m25;
1396
1399
 
1397
1400
  const { isDate } = _m6;
@@ -1413,7 +1416,7 @@ function appPropertiesXml(properties = {}, policy = "strip") {
1413
1416
  '<Application>' + escapeXml(properties.application ?? "OfficeIMO", policy) + '</Application><Company>' + escapeXml(properties.company ?? "", policy) + '</Company></Properties>';
1414
1417
  }
1415
1418
  const _exports = Object.freeze({ corePropertiesXml: corePropertiesXml, appPropertiesXml: appPropertiesXml });
1416
- _modules.set("cd6fbdc4df9506c140f11083b3740d048b39c012670222001051b552dbc7bfb0", _exports);
1419
+ _modules.set("56b2057461a668e8c90abd1fbf4f13ff93efd9854e590c82a195799f0f842c2a", _exports);
1417
1420
  return _exports;
1418
1421
  })();
1419
1422
 
@@ -1832,7 +1835,7 @@ _modules.set("699a019e0c3f317a62bf3a6e59b76b6cf1645908b0f1b1f157c18f4d4f368dfb",
1832
1835
  return _exports;
1833
1836
  })();
1834
1837
 
1835
- const _m22 = _modules.get("3bedb42cf4cced6fffb6c1b9e798b93ccb70159cf6cfc582237e723187cc465f") ?? (() => {
1838
+ const _m22 = _modules.get("4d4856357f94ecbeea67d111ff5e97f916ccc6be6aaefde219d461c6ad10a8c5") ?? (() => {
1836
1839
 
1837
1840
 
1838
1841
 
@@ -1931,8 +1934,11 @@ class OpcPackage {
1931
1934
  return uri;
1932
1935
  }
1933
1936
  addPart(part) {
1934
- const uri = this.reserve(part.uri, part.contentType);
1935
- this.parts.set(uri.toLowerCase(), { ...part, uri, data: part.data instanceof Uint8Array ? new Uint8Array(part.data) : part.data });
1937
+ const { uri: requestedUri, contentType, data } = part;
1938
+ // Structural accessors and byte ownership are captured before reserving metadata.
1939
+ const capturedData = data instanceof Uint8Array ? new Uint8Array(data) : data;
1940
+ const uri = this.reserve(requestedUri, contentType);
1941
+ this.parts.set(uri.toLowerCase(), { uri, contentType, data: capturedData });
1936
1942
  }
1937
1943
  /** @internal */
1938
1944
  addPrepared(uri, type, prepared) {
@@ -1957,17 +1963,19 @@ class OpcPackage {
1957
1963
  checkAbort(this.options.signal);
1958
1964
  this.open();
1959
1965
  source = source === "/" ? source : partUri(source);
1960
- if (!/^[A-Za-z_][A-Za-z0-9_.-]*$/.test(relationship.id))
1966
+ const { id, type, target: requestedTarget, external } = relationship;
1967
+ this.open();
1968
+ if (!/^[A-Za-z_][A-Za-z0-9_.-]*$/.test(id))
1961
1969
  throw new TypeError("Relationship id must be an XML ID.");
1962
- if (!/^[A-Za-z][A-Za-z0-9+.-]*:[^\s<>"']+$/.test(relationship.type))
1970
+ if (!/^[A-Za-z][A-Za-z0-9+.-]*:[^\s<>"']+$/.test(type))
1963
1971
  throw new TypeError("Relationship type must be an absolute URI.");
1964
- const target = relationship.external ? relationship.target : partUri(relationship.target);
1965
- if (relationship.external && (!target || /[\u0000-\u0020]/.test(target)))
1972
+ const target = external ? requestedTarget : partUri(requestedTarget);
1973
+ if (external && (!target || /[\u0000-\u0020]/.test(target)))
1966
1974
  throw new TypeError("Invalid external relationship target.");
1967
1975
  const key = source.toLowerCase(), list = this.relationships.get(key) ?? new Map();
1968
- if (list.has(relationship.id))
1969
- throw new TypeError("Duplicate relationship id: " + relationship.id);
1970
- list.set(relationship.id, { ...relationship, target });
1976
+ if (list.has(id))
1977
+ throw new TypeError("Duplicate relationship id: " + id);
1978
+ list.set(id, { id, type, target, ...(external === undefined ? {} : { external }) });
1971
1979
  this.relationships.set(key, list);
1972
1980
  }
1973
1981
  setProperties(core = {}, app = {}) {
@@ -2077,7 +2085,7 @@ class OpcPackage {
2077
2085
  }
2078
2086
  }
2079
2087
  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 });
2080
- _modules.set("3bedb42cf4cced6fffb6c1b9e798b93ccb70159cf6cfc582237e723187cc465f", _exports);
2088
+ _modules.set("4d4856357f94ecbeea67d111ff5e97f916ccc6be6aaefde219d461c6ad10a8c5", _exports);
2081
2089
  return _exports;
2082
2090
  })();
2083
2091
 
@@ -2093,7 +2101,7 @@ _modules.set("204def412284dfb11df9aececd57c8c0455db2927ebdb483dd255e7b29f6f359",
2093
2101
  return _exports;
2094
2102
  })();
2095
2103
 
2096
- const _m31 = _modules.get("2c814aac0c36fa7d9a1fb54d327695a3655309ef22db0c10974813f8f9d4d6ae") ?? (() => {
2104
+ const _m31 = _modules.get("6ae88f25e1c09d00fbb828917498569f883fae88ec25d37caebaf8a2b802b148") ?? (() => {
2097
2105
  const { OfficeIMOError } = _m2;
2098
2106
 
2099
2107
  const { cleanXml, escapeOoxmlAttribute } = _m25;
@@ -2200,11 +2208,11 @@ function differentialXml(style, policy, numberFormat) {
2200
2208
  return xml;
2201
2209
  }
2202
2210
  const _exports = Object.freeze({ fields: fields, optionalBoolean: optionalBoolean, DifferentialStyles: DifferentialStyles, differentialXml: differentialXml });
2203
- _modules.set("2c814aac0c36fa7d9a1fb54d327695a3655309ef22db0c10974813f8f9d4d6ae", _exports);
2211
+ _modules.set("6ae88f25e1c09d00fbb828917498569f883fae88ec25d37caebaf8a2b802b148", _exports);
2204
2212
  return _exports;
2205
2213
  })();
2206
2214
 
2207
- const _m29 = _modules.get("a4ad9a4388ed41b6b7ce4f5a20c44598082db5adc307e96d12de2840e9508d7e") ?? (() => {
2215
+ const _m29 = _modules.get("077c3c668f1457253dba044e6f6be7f7afd28a8976ed20c764bd5d5dc7c41889") ?? (() => {
2208
2216
  const { escapeOoxmlAttribute, cleanXml, xmlDeclaration } = _m25;
2209
2217
 
2210
2218
  const { OfficeIMOError } = _m2;
@@ -2414,11 +2422,11 @@ class StyleRegistry {
2414
2422
  }
2415
2423
  }
2416
2424
  const _exports = Object.freeze({ colorArgb: _m30.colorArgb, spreadsheetNamespace: spreadsheetNamespace, NumberFormats: NumberFormats, validateStylePatch: validateStylePatch, copyStylePatch: copyStylePatch, StyleRegistry: StyleRegistry });
2417
- _modules.set("a4ad9a4388ed41b6b7ce4f5a20c44598082db5adc307e96d12de2840e9508d7e", _exports);
2425
+ _modules.set("077c3c668f1457253dba044e6f6be7f7afd28a8976ed20c764bd5d5dc7c41889", _exports);
2418
2426
  return _exports;
2419
2427
  })();
2420
2428
 
2421
- const _m33 = _modules.get("bf52f9d5aae9685c7fc71f3e5d6cf248beef190df1f28f89d27617e1c2023429") ?? (() => {
2429
+ const _m33 = _modules.get("f1de2157d2aefa347a314940eb7f89c16545e11f69923920e605409433742f93") ?? (() => {
2422
2430
  const { NotSupportedError } = _m2;
2423
2431
 
2424
2432
  const { cleanXml, escapeXml } = _m25;
@@ -2526,11 +2534,11 @@ function formulaXml(cell) {
2526
2534
  return "<f>" + escapeXml(cell.formula, "reject") + "</f><v>" + (cell.cachedValue ?? "") + "</v>";
2527
2535
  }
2528
2536
  const _exports = Object.freeze({ FormulaCell: FormulaCell, isSubtotalFormula: isSubtotalFormula, formulaXml: formulaXml });
2529
- _modules.set("bf52f9d5aae9685c7fc71f3e5d6cf248beef190df1f28f89d27617e1c2023429", _exports);
2537
+ _modules.set("f1de2157d2aefa347a314940eb7f89c16545e11f69923920e605409433742f93", _exports);
2530
2538
  return _exports;
2531
2539
  })();
2532
2540
 
2533
- const _m32 = _modules.get("597ac0803c83556e97bf37d53e2a3aef4351032669f740ebcf8a06369bf940ed") ?? (() => {
2541
+ const _m32 = _modules.get("4bce839e90e3ef590aa1b224ffd9c4bdf24d7639b93bdf879f9a0d79de4cd0e4") ?? (() => {
2534
2542
  const { cleanXml, escapeXml } = _m25;
2535
2543
 
2536
2544
  const { assertExportValue, assertScalar } = _m5;
@@ -2623,11 +2631,11 @@ function excelDate(date, mode) {
2623
2631
  return (time - Date.UTC(1899, 11, 31)) / 86400000 + (time >= Date.UTC(1900, 2, 1) ? 1 : 0);
2624
2632
  }
2625
2633
  const _exports = Object.freeze({ Cell: Cell, assertXlsxValue: assertXlsxValue, copyValue: copyValue, cellText: cellText, inlineText: inlineText, columnName: columnName, sheetName: sheetName, excelDate: excelDate });
2626
- _modules.set("597ac0803c83556e97bf37d53e2a3aef4351032669f740ebcf8a06369bf940ed", _exports);
2634
+ _modules.set("4bce839e90e3ef590aa1b224ffd9c4bdf24d7639b93bdf879f9a0d79de4cd0e4", _exports);
2627
2635
  return _exports;
2628
2636
  })();
2629
2637
 
2630
- const _m36 = _modules.get("abbe9e1ad9c0a68c86d0f20348fd324b7eef48b857c0bd9aa04e8959a7e70622") ?? (() => {
2638
+ const _m36 = _modules.get("84c16159c55cf4c0af5d3c67510302694946ae99c6c685fc09314069ee3da5c5") ?? (() => {
2631
2639
  const { ChunkedTextSink } = _m3;
2632
2640
 
2633
2641
  const { escapeXml, xmlDeclaration } = _m25;
@@ -2736,11 +2744,11 @@ async function writeChartXml(chart, destination, policy, signal) {
2736
2744
  await text.close();
2737
2745
  }
2738
2746
  const _exports = Object.freeze({ chartNamespace: chartNamespace, chartContentType: chartContentType, chartAnchorXml: chartAnchorXml, writeChartXml: writeChartXml });
2739
- _modules.set("abbe9e1ad9c0a68c86d0f20348fd324b7eef48b857c0bd9aa04e8959a7e70622", _exports);
2747
+ _modules.set("84c16159c55cf4c0af5d3c67510302694946ae99c6c685fc09314069ee3da5c5", _exports);
2740
2748
  return _exports;
2741
2749
  })();
2742
2750
 
2743
- const _m35 = _modules.get("0afdc9d464a68ac5ace8863d7c6e25862748c96faa03ed7b8e46402515a552b8") ?? (() => {
2751
+ const _m35 = _modules.get("9d4496a1ff3d58ac0b9dcd7304e6861184df30700c344329157899639df7b5e4") ?? (() => {
2744
2752
  const { cleanXml, escapeXml, escapeOoxmlAttribute, xmlDeclaration } = _m25;
2745
2753
 
2746
2754
  const { copyExportLink } = _m7;
@@ -2814,11 +2822,11 @@ function drawingXml(images, policy, charts = []) {
2814
2822
  }
2815
2823
  const drawingContentType = "application/vnd.openxmlformats-officedocument.drawing+xml";
2816
2824
  const _exports = Object.freeze({ copyDrawingAnchor: copyDrawingAnchor, cellPosition: cellPosition, copyHyperlink: copyHyperlink, copyImage: copyImage, hyperlinksXml: hyperlinksXml, drawingXml: drawingXml, drawingContentType: drawingContentType });
2817
- _modules.set("0afdc9d464a68ac5ace8863d7c6e25862748c96faa03ed7b8e46402515a552b8", _exports);
2825
+ _modules.set("9d4496a1ff3d58ac0b9dcd7304e6861184df30700c344329157899639df7b5e4", _exports);
2818
2826
  return _exports;
2819
2827
  })();
2820
2828
 
2821
- const _m38 = _modules.get("e2e414a8ba22e778a769375327988cd080347bbbc863673a702e1dcfa6e9112a") ?? (() => {
2829
+ const _m38 = _modules.get("4c91e257806f805b473340527db7ce3404c98ac27db0a775ff047dc3dded10cc") ?? (() => {
2822
2830
  const { OfficeIMOError } = _m2;
2823
2831
 
2824
2832
  const { cellPosition } = _m35;
@@ -2919,11 +2927,11 @@ class MergeRegions {
2919
2927
  throw new RangeError("Merged ranges must stay within exported rows."); }
2920
2928
  }
2921
2929
  const _exports = Object.freeze({ MergeRegions: MergeRegions });
2922
- _modules.set("e2e414a8ba22e778a769375327988cd080347bbbc863673a702e1dcfa6e9112a", _exports);
2930
+ _modules.set("4c91e257806f805b473340527db7ce3404c98ac27db0a775ff047dc3dded10cc", _exports);
2923
2931
  return _exports;
2924
2932
  })();
2925
2933
 
2926
- const _m39 = _modules.get("ac538bedcdc7144616b2777232e7049d2fd6449a087017fd9c10d31e0f86b292") ?? (() => {
2934
+ const _m39 = _modules.get("47efdc8f108b0e995accdd63fd1addea0e4de507010cbf0975417e7151636360") ?? (() => {
2927
2935
  const { ExportCell } = _m5;
2928
2936
 
2929
2937
  const { tableSpans } = _m17;
@@ -2956,11 +2964,11 @@ class StructuredRows {
2956
2964
  }
2957
2965
  }
2958
2966
  const _exports = Object.freeze({ StructuredRows: StructuredRows });
2959
- _modules.set("ac538bedcdc7144616b2777232e7049d2fd6449a087017fd9c10d31e0f86b292", _exports);
2967
+ _modules.set("47efdc8f108b0e995accdd63fd1addea0e4de507010cbf0975417e7151636360", _exports);
2960
2968
  return _exports;
2961
2969
  })();
2962
2970
 
2963
- const _m37 = _modules.get("47c0c236e4ae7b71726d1d7ebe0d2df8f0eb9204b3865adf34b5163f720d4bd5") ?? (() => {
2971
+ const _m37 = _modules.get("23615ba776e7025e5e40cde325ad13799a7eeae6c88cb2ed74395222f91e6a81") ?? (() => {
2964
2972
  const { ExportCell } = _m5;
2965
2973
 
2966
2974
  const { isDate } = _m6;
@@ -3157,11 +3165,11 @@ function printXml(options, policy) {
3157
3165
  (options.footer === undefined ? "" : '<oddFooter>' + escapeOoxmlAttribute("&C" + options.footer.replace(/&/g, "&&"), policy) + '</oddFooter>') + '</headerFooter>' : "");
3158
3166
  }
3159
3167
  const _exports = Object.freeze({ ComputedTotal: ComputedTotal, ReportLayout: ReportLayout, totalFormula: totalFormula, printXml: printXml });
3160
- _modules.set("47c0c236e4ae7b71726d1d7ebe0d2df8f0eb9204b3865adf34b5163f720d4bd5", _exports);
3168
+ _modules.set("23615ba776e7025e5e40cde325ad13799a7eeae6c88cb2ed74395222f91e6a81", _exports);
3161
3169
  return _exports;
3162
3170
  })();
3163
3171
 
3164
- const _m41 = _modules.get("93ad877d48a12898018a8842f86e9c1a073ae9d16e4ddbdf0de422fdb7567732") ?? (() => {
3172
+ const _m41 = _modules.get("7845d79cd22590bbefc767802abfe3f805e8f68807521cef8d07ecc42db0b491") ?? (() => {
3165
3173
  const { columnName } = _m32;
3166
3174
 
3167
3175
  /** @internal Data-column selectors use stable keys or one-based worksheet columns. */
@@ -3188,11 +3196,11 @@ function qualifiedCell(sheetName, column, row) {
3188
3196
  return qualifiedColumnRange(sheetName, column, row, 1).split(":")[0];
3189
3197
  }
3190
3198
  const _exports = Object.freeze({ resolveDataColumn: resolveDataColumn, qualifiedColumnRange: qualifiedColumnRange, qualifiedCell: qualifiedCell });
3191
- _modules.set("93ad877d48a12898018a8842f86e9c1a073ae9d16e4ddbdf0de422fdb7567732", _exports);
3199
+ _modules.set("7845d79cd22590bbefc767802abfe3f805e8f68807521cef8d07ecc42db0b491", _exports);
3192
3200
  return _exports;
3193
3201
  })();
3194
3202
 
3195
- const _m42 = _modules.get("e988da1cd05e9b574b66f0b3e28e40168bcc06e9ec1cdb023e42f358770b7fad") ?? (() => {
3203
+ const _m42 = _modules.get("4892a7dafefc4d82567cd2bd4cc8da5470cee4dbf546e6473f782f44bd4bbe35") ?? (() => {
3196
3204
  const { OfficeIMOError } = _m2;
3197
3205
 
3198
3206
  const { columnName } = _m32;
@@ -3235,11 +3243,11 @@ function dataRowReference(firstColumn, lastColumn, headerRows, dataRows, ranges)
3235
3243
  return reference || undefined;
3236
3244
  }
3237
3245
  const _exports = Object.freeze({ retainDataRowRanges: retainDataRowRanges, dataRowRanges: dataRowRanges, dataRowCount: dataRowCount, dataRowReference: dataRowReference });
3238
- _modules.set("e988da1cd05e9b574b66f0b3e28e40168bcc06e9ec1cdb023e42f358770b7fad", _exports);
3246
+ _modules.set("4892a7dafefc4d82567cd2bd4cc8da5470cee4dbf546e6473f782f44bd4bbe35", _exports);
3239
3247
  return _exports;
3240
3248
  })();
3241
3249
 
3242
- const _m40 = _modules.get("f1cb0c25677191521382757695257e846c3da2c5657cd5b640aea352094162e6") ?? (() => {
3250
+ const _m40 = _modules.get("736b2b2fc3489642263dbaf677544e8a270eea6b8efb0cc26c67346e66cab118") ?? (() => {
3243
3251
  const { cleanXml, escapeXml, escapeOoxmlAttribute } = _m25;
3244
3252
 
3245
3253
  const { cellPosition } = _m35;
@@ -3405,11 +3413,11 @@ class ConditionalFormats {
3405
3413
  }
3406
3414
  }
3407
3415
  const _exports = Object.freeze({ prepareConditionalFormats: prepareConditionalFormats, ConditionalFormats: ConditionalFormats });
3408
- _modules.set("f1cb0c25677191521382757695257e846c3da2c5657cd5b640aea352094162e6", _exports);
3416
+ _modules.set("736b2b2fc3489642263dbaf677544e8a270eea6b8efb0cc26c67346e66cab118", _exports);
3409
3417
  return _exports;
3410
3418
  })();
3411
3419
 
3412
- const _m43 = _modules.get("cf47c14a3d20ea8306932e3174606385830dd257bdb9ffac8c5114724b4d9257") ?? (() => {
3420
+ const _m43 = _modules.get("860c88d97ba76e8713c14d56967152e369d2f08f50ffada68827a9c220881c61") ?? (() => {
3413
3421
  const { OfficeIMOError } = _m2;
3414
3422
 
3415
3423
  const { checkAbort } = _m4;
@@ -3509,11 +3517,11 @@ function* dataValidationsXml(prepared, headerRows, dataRows, ranges) {
3509
3517
  yield '</dataValidations>';
3510
3518
  }
3511
3519
  const _exports = Object.freeze({ prepareDataValidations: prepareDataValidations, dataValidationsXml: dataValidationsXml });
3512
- _modules.set("cf47c14a3d20ea8306932e3174606385830dd257bdb9ffac8c5114724b4d9257", _exports);
3520
+ _modules.set("860c88d97ba76e8713c14d56967152e369d2f08f50ffada68827a9c220881c61", _exports);
3513
3521
  return _exports;
3514
3522
  })();
3515
3523
 
3516
- const _m34 = _modules.get("03e235a81010f60bce2d7cc02a313dd95b5b2b77d09535b160ae02a3556c55b4") ?? (() => {
3524
+ const _m34 = _modules.get("b99287e3e329b75007119103112a699c368d8237b37fa79e083b0014a21952e4") ?? (() => {
3517
3525
  const { checkAbort, consumeRows, inputRows, pause, taskYieldDue } = _m4;
3518
3526
 
3519
3527
  const { ChunkedTextSink, BlobByteSink } = _m3;
@@ -3793,7 +3801,8 @@ class Worksheet {
3793
3801
  });
3794
3802
  const originalCharacters = typeof value === "string" ? value.length : 0;
3795
3803
  let reservedCharacters = this.preserved || header || footer ? originalCharacters : undefined;
3796
- if (type === "string" && cleanXml(value, this.book.settings.invalidCharacterPolicy).length > 32767) {
3804
+ // Cleaning removes characters; ordinary strings cannot cross Excel's limit.
3805
+ if (type === "string" && originalCharacters > 32767 && cleanXml(value, this.book.settings.invalidCharacterPolicy).length > 32767) {
3797
3806
  const cell = col.letter + row;
3798
3807
  if (link || this.linkedCells.has(cell))
3799
3808
  throw new TypeError("A text-preservation cell cannot also have an external hyperlink.");
@@ -4235,11 +4244,11 @@ class Worksheet {
4235
4244
  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); }
4236
4245
  }
4237
4246
  const _exports = Object.freeze({ Worksheet: Worksheet });
4238
- _modules.set("03e235a81010f60bce2d7cc02a313dd95b5b2b77d09535b160ae02a3556c55b4", _exports);
4247
+ _modules.set("b99287e3e329b75007119103112a699c368d8237b37fa79e083b0014a21952e4", _exports);
4239
4248
  return _exports;
4240
4249
  })();
4241
4250
 
4242
- const _m44 = _modules.get("69b817e85a5cf991b2c75390de7cfb5657f53786c2bf2221e310d489f4e50fa0") ?? (() => {
4251
+ const _m44 = _modules.get("7f1b6bb321e8055ba5269c0fe0933cf02f9a4ce269d3b8e4a64cc63d8398954a") ?? (() => {
4243
4252
  const { escapeOoxmlAttribute, escapeXml, xmlDeclaration } = _m25;
4244
4253
 
4245
4254
  const { cellText, columnName } = _m32;
@@ -4282,11 +4291,11 @@ function tableXml(table, rowCount, policy, headerRow = 1, footer) {
4282
4291
  '" showColumnStripes="' + (options.bandedColumns ? 1 : 0) + '"/></table>';
4283
4292
  }
4284
4293
  const _exports = Object.freeze({ defineTable: defineTable, tableXml: tableXml });
4285
- _modules.set("69b817e85a5cf991b2c75390de7cfb5657f53786c2bf2221e310d489f4e50fa0", _exports);
4294
+ _modules.set("7f1b6bb321e8055ba5269c0fe0933cf02f9a4ce269d3b8e4a64cc63d8398954a", _exports);
4286
4295
  return _exports;
4287
4296
  })();
4288
4297
 
4289
- const _m45 = _modules.get("326038be5df97f3a5a5909d06720e4b63162b0f69961c79600f915e768bd41fb") ?? (() => {
4298
+ const _m45 = _modules.get("0c395783b9d7cc62dd39a21adeb698ad4a61e2c89f7b1fc8712e2eb2ccfe9d92") ?? (() => {
4290
4299
  const { OfficeIMOError } = _m2;
4291
4300
 
4292
4301
  const { cleanXml } = _m25;
@@ -4350,7 +4359,7 @@ function* splitText(text) {
4350
4359
  }
4351
4360
  }
4352
4361
  const _exports = Object.freeze({ TextOverflow: TextOverflow, clipText: clipText });
4353
- _modules.set("326038be5df97f3a5a5909d06720e4b63162b0f69961c79600f915e768bd41fb", _exports);
4362
+ _modules.set("0c395783b9d7cc62dd39a21adeb698ad4a61e2c89f7b1fc8712e2eb2ccfe9d92", _exports);
4354
4363
  return _exports;
4355
4364
  })();
4356
4365
 
@@ -4377,7 +4386,7 @@ _modules.set("e00bc0213b723678d050e3e1f11b39ed3d6b0b0fd6a39b403beb1a6bef69e282",
4377
4386
  return _exports;
4378
4387
  })();
4379
4388
 
4380
- const _m48 = _modules.get("5fcd8ab43752d758bd1b311eae9378643c828dfca1de2875b2bd5f16fc8b4abc") ?? (() => {
4389
+ const _m48 = _modules.get("35db01801a6b2e3e0c5acd7493e56f04b5b41b1d57afa8be28b8358378ad6494") ?? (() => {
4381
4390
  const { checkAbort } = _m4;
4382
4391
 
4383
4392
  const { NotSupportedError, OfficeIMOError } = _m2;
@@ -4505,11 +4514,11 @@ function prepareChartBinding(input, descriptor, budgets, signal, type = "columnC
4505
4514
  }, finish });
4506
4515
  }
4507
4516
  const _exports = Object.freeze({ captureChartRange: captureChartRange, prepareChartBinding: prepareChartBinding });
4508
- _modules.set("5fcd8ab43752d758bd1b311eae9378643c828dfca1de2875b2bd5f16fc8b4abc", _exports);
4517
+ _modules.set("35db01801a6b2e3e0c5acd7493e56f04b5b41b1d57afa8be28b8358378ad6494", _exports);
4509
4518
  return _exports;
4510
4519
  })();
4511
4520
 
4512
- const _m47 = _modules.get("28c1f1e37db546192ff92887f5cf59224cf6b98370eb79848e428946a7000e76") ?? (() => {
4521
+ const _m47 = _modules.get("6ff482aba6cf0b524cf20f6a4f8af16b842a49f36448b14e73beaf838885d219") ?? (() => {
4513
4522
  const { checkAbort } = _m4;
4514
4523
 
4515
4524
  const { NotSupportedError, OfficeIMOError } = _m2;
@@ -4676,11 +4685,11 @@ function prepareChart(input, policy, availablePoints, availableText, signal, res
4676
4685
  points, textCharacters });
4677
4686
  }
4678
4687
  const _exports = Object.freeze({ prepareChart: prepareChart });
4679
- _modules.set("28c1f1e37db546192ff92887f5cf59224cf6b98370eb79848e428946a7000e76", _exports);
4688
+ _modules.set("6ff482aba6cf0b524cf20f6a4f8af16b842a49f36448b14e73beaf838885d219", _exports);
4680
4689
  return _exports;
4681
4690
  })();
4682
4691
 
4683
- const _m21 = _modules.get("982718d202723335e72aab0c32adf982f3bdaba804612744478ab794f3c9386c") ?? (() => {
4692
+ const _m21 = _modules.get("0f11efc0d52501e827898643b33f7fa42365115a892aa801634ecea3f3603681") ?? (() => {
4684
4693
  const { beginTask, checkAbort, pause, taskYieldDue } = _m4;
4685
4694
 
4686
4695
  const { OfficeIMOError } = _m2;
@@ -5019,12 +5028,15 @@ class Workbook {
5019
5028
  });
5020
5029
  }
5021
5030
  addPart(part) {
5031
+ this.assertOpen();
5032
+ const { uri, contentType, data, relationship } = part;
5033
+ const capturedRelationship = relationship && { id: relationship.id, type: relationship.type, source: relationship.source };
5022
5034
  this.assertOpen();
5023
5035
  // Reserve now so collisions and invalid names fail at the call site.
5024
- this.package.addPart(part);
5025
- if (part.relationship) {
5026
- const { source, ...rel } = part.relationship;
5027
- this.package.addRelationship(source ?? "/xl/workbook.xml", { ...rel, target: part.uri });
5036
+ this.package.addPart({ uri, contentType, data });
5037
+ if (capturedRelationship) {
5038
+ const { source, id, type } = capturedRelationship;
5039
+ this.package.addRelationship(source ?? "/xl/workbook.xml", { id, type, target: uri });
5028
5040
  }
5029
5041
  }
5030
5042
  /** Complete the archive and return counts. Does not close or dispose a caller-owned sink. */
@@ -5155,7 +5167,7 @@ class Workbook {
5155
5167
  }
5156
5168
  }
5157
5169
  const _exports = Object.freeze({ Workbook: Workbook });
5158
- _modules.set("982718d202723335e72aab0c32adf982f3bdaba804612744478ab794f3c9386c", _exports);
5170
+ _modules.set("0f11efc0d52501e827898643b33f7fa42365115a892aa801634ecea3f3603681", _exports);
5159
5171
  return _exports;
5160
5172
  })();
5161
5173
 
@@ -5212,7 +5224,7 @@ _modules.set("89111eab1f3857529c2d0cd849f16598097e62bd73841211b9c66ccc7b1b7ca2",
5212
5224
  return _exports;
5213
5225
  })();
5214
5226
 
5215
- const _m49 = _modules.get("59ef9ad8736be48605a1d5005a096b977be8e44c0d2a4249345127b2b7f81339") ?? (() => {
5227
+ const _m49 = _modules.get("8d425cd3abec2c5e0140f71239bbeacbae0e57524ed70a8e545f80286c4a1308") ?? (() => {
5216
5228
  const { withDestination } = _m3;
5217
5229
 
5218
5230
  const { copyColumns } = _m11;
@@ -5267,11 +5279,11 @@ async function writeXlsxTo(rows, destination, configuration) {
5267
5279
  });
5268
5280
  }
5269
5281
  const _exports = Object.freeze({ writeXlsx: writeXlsx, writeXlsxTo: writeXlsxTo });
5270
- _modules.set("59ef9ad8736be48605a1d5005a096b977be8e44c0d2a4249345127b2b7f81339", _exports);
5282
+ _modules.set("8d425cd3abec2c5e0140f71239bbeacbae0e57524ed70a8e545f80286c4a1308", _exports);
5271
5283
  return _exports;
5272
5284
  })();
5273
5285
 
5274
- const _m52 = _modules.get("de7c4720443cbafe0e11a1142f952c4977c47158c42f0a20704db65e3a19bf8b") ?? (() => {
5286
+ const _m52 = _modules.get("02f1b8fe9368420b22d79efc01f2b37794fc40aaf8150161b3b7623fcdc0d71f") ?? (() => {
5275
5287
  const { assertGroupedReportSource } = _m8;
5276
5288
 
5277
5289
  const { captureFields } = _m10;
@@ -5360,11 +5372,11 @@ function prepareGroupedSheet(report, configuration, maxConditionalFormats = 1000
5360
5372
  ...(options.grandTotalStyle ? { grandTotalStyle: copyStylePatch(options.grandTotalStyle) } : {}) };
5361
5373
  }
5362
5374
  const _exports = Object.freeze({ groupedOptionFields: groupedOptionFields, prepareGroupedSheet: prepareGroupedSheet });
5363
- _modules.set("de7c4720443cbafe0e11a1142f952c4977c47158c42f0a20704db65e3a19bf8b", _exports);
5375
+ _modules.set("02f1b8fe9368420b22d79efc01f2b37794fc40aaf8150161b3b7623fcdc0d71f", _exports);
5364
5376
  return _exports;
5365
5377
  })();
5366
5378
 
5367
- const _m51 = _modules.get("50d544d4c980d1a8f6a81b2d3e376bf92bed5c415a275b6eacacdb86b15d57b0") ?? (() => {
5379
+ const _m51 = _modules.get("6b646c4d57b8f8f452eaa7e61d2935bab09681aceb6064b8600bf73ca10b8f4e") ?? (() => {
5368
5380
  const { groupedReportOperation } = _m8;
5369
5381
 
5370
5382
  const { checkAbort, withAbort } = _m4;
@@ -5537,14 +5549,14 @@ async function writeGroupedXlsxTo(report, destination, options) {
5537
5549
  return withDestination(destination, async (sink) => (await write(report, prepared, sink)).result);
5538
5550
  }
5539
5551
  const _exports = Object.freeze({ addGroupedXlsx: addGroupedXlsx, writeGroupedXlsx: writeGroupedXlsx, writeGroupedXlsxTo: writeGroupedXlsxTo });
5540
- _modules.set("50d544d4c980d1a8f6a81b2d3e376bf92bed5c415a275b6eacacdb86b15d57b0", _exports);
5552
+ _modules.set("6b646c4d57b8f8f452eaa7e61d2935bab09681aceb6064b8600bf73ca10b8f4e", _exports);
5541
5553
  return _exports;
5542
5554
  })();
5543
5555
 
5544
- const _m20 = _modules.get("d494060a59e45633a76ad2e4aeb08b6ffbc730ce6c4d50686aa4e3a51ad0ed6e") ?? (() => {
5556
+ const _m20 = _modules.get("9fbdb5c6f6af75d87ac6cb47771fe48fa6527be2cb7d16dbad56e4213e2f7195") ?? (() => {
5545
5557
 
5546
5558
  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 });
5547
- _modules.set("d494060a59e45633a76ad2e4aeb08b6ffbc730ce6c4d50686aa4e3a51ad0ed6e", _exports);
5559
+ _modules.set("9fbdb5c6f6af75d87ac6cb47771fe48fa6527be2cb7d16dbad56e4213e2f7195", _exports);
5548
5560
  return _exports;
5549
5561
  })();
5550
5562
 
@@ -7190,7 +7202,7 @@ _modules.set("59911f0fe023545e9e97521b268551078bdc4c5f303e446a13b7d52f905e8070",
7190
7202
  return _exports;
7191
7203
  })();
7192
7204
 
7193
- const _m61 = _modules.get("7da602b40c346a3838e75963f9a3f10c95ac5ce08a7b0a23b9d96f8898a01db7") ?? (() => {
7205
+ const _m61 = _modules.get("4d4736e6b8e2aaecc6f6c1b124b7e6bc0a5e141dcc725edf0ad4847d87fca1b3") ?? (() => {
7194
7206
  const { NotSupportedError, OfficeIMOError } = _m2;
7195
7207
 
7196
7208
  const { fontProgram } = _m62;
@@ -7201,7 +7213,8 @@ const { pdfNumber, unicodeHex } = _m59;
7201
7213
 
7202
7214
  const { checkAbort, pause, taskYieldDue } = _m4;
7203
7215
 
7204
- const standardHexBytes = Object.freeze(Array.from({ length: 256 }, (_, byte) => byte.toString(16).padStart(2, "0")));
7216
+ const hexBytes = Object.freeze(Array.from({ length: 256 }, (_, byte) => byte.toString(16).padStart(2, "0")));
7217
+ function cidHex(cid) { return hexBytes[cid >>> 8] + hexBytes[cid & 255]; }
7205
7218
  class PdfFontResource {
7206
7219
  index;
7207
7220
  bold;
@@ -7232,12 +7245,16 @@ class PdfFontResource {
7232
7245
  width(scalar) {
7233
7246
  if (this.shared)
7234
7247
  return this.shared.width(scalar);
7235
- const existing = this.mappings.get(scalar);
7236
- if (existing)
7237
- return existing.width;
7238
- const standard = this.standardWidths.get(scalar);
7239
- if (standard !== undefined)
7240
- return standard;
7248
+ if (this.program) {
7249
+ const existing = this.mappings.get(scalar);
7250
+ if (existing)
7251
+ return existing.width;
7252
+ }
7253
+ else {
7254
+ const standard = this.standardWidths.get(scalar);
7255
+ if (standard !== undefined)
7256
+ return standard;
7257
+ }
7241
7258
  const resolved = resolveScalar(scalar, this.program, this.bold);
7242
7259
  if (!resolved.supported) {
7243
7260
  if (resolved.code === "unpaired-surrogate")
@@ -7250,7 +7267,8 @@ class PdfFontResource {
7250
7267
  }
7251
7268
  if (this.mappings.size >= 65535)
7252
7269
  throw new OfficeIMOError("RESOURCE_LIMIT", "A PDF font supports at most 65,535 distinct Unicode scalars.");
7253
- const mapping = { cid: this.mappings.size + 1, glyph: resolved.glyph, width: resolved.width, text: String.fromCodePoint(scalar) };
7270
+ const cid = this.mappings.size + 1;
7271
+ const mapping = { cid, hex: cidHex(cid), glyph: resolved.glyph, width: resolved.width, text: String.fromCodePoint(scalar) };
7254
7272
  this.mappings.set(scalar, mapping);
7255
7273
  return mapping.width;
7256
7274
  }
@@ -7263,8 +7281,20 @@ class PdfFontResource {
7263
7281
  let hex = "";
7264
7282
  for (const char of text) {
7265
7283
  const cp = char.codePointAt(0);
7266
- this.width(cp);
7267
- hex += this.program ? this.mappings.get(cp).cid.toString(16).padStart(4, "0") : standardHexBytes[standardCode(cp)];
7284
+ if (this.program) {
7285
+ let mapping = this.mappings.get(cp);
7286
+ // Layout normally registered the scalar already; validate only a newly painted scalar.
7287
+ if (!mapping) {
7288
+ this.width(cp);
7289
+ mapping = this.mappings.get(cp);
7290
+ }
7291
+ hex += mapping.hex;
7292
+ }
7293
+ else {
7294
+ if (!this.standardWidths.has(cp))
7295
+ this.width(cp);
7296
+ hex += hexBytes[standardCode(cp)];
7297
+ }
7268
7298
  }
7269
7299
  return "<" + hex + ">";
7270
7300
  }
@@ -7279,10 +7309,11 @@ class PdfFontResource {
7279
7309
  if (!mapping) {
7280
7310
  if (this.mappings.size >= 65535)
7281
7311
  throw new OfficeIMOError("RESOURCE_LIMIT", "A PDF font supports at most 65,535 distinct CID mappings.");
7282
- mapping = { cid: this.mappings.size + 1, glyph, width: this.program.widths[glyph], text };
7312
+ const cid = this.mappings.size + 1;
7313
+ mapping = { cid, hex: cidHex(cid), glyph, width: this.program.widths[glyph], text };
7283
7314
  this.mappings.set(key, mapping);
7284
7315
  }
7285
- return "<" + mapping.cid.toString(16).padStart(4, "0") + ">";
7316
+ return "<" + mapping.hex + ">";
7286
7317
  }
7287
7318
  async write(objects, compression) {
7288
7319
  checkAbort(this.signal);
@@ -7331,7 +7362,7 @@ class PdfFontResource {
7331
7362
  const batch = mapped.slice(i, i + 100);
7332
7363
  cmap += batch.length + " beginbfchar\n";
7333
7364
  for (const [, m] of batch)
7334
- cmap += "<" + m.cid.toString(16).padStart(4, "0") + "> <" + unicodeHex(m.text) + ">\n";
7365
+ cmap += "<" + m.hex + "> <" + unicodeHex(m.text) + ">\n";
7335
7366
  cmap += "endbfchar\n";
7336
7367
  if (taskYieldDue())
7337
7368
  await pause();
@@ -7382,7 +7413,7 @@ class PdfFontResources {
7382
7413
  if (!found)
7383
7414
  this.explicitSelections.set(explicit, selections);
7384
7415
  }
7385
- const key = String(bold) + String(italic), existing = selections.get(key);
7416
+ const key = (bold ? 2 : 0) | (italic ? 1 : 0), existing = selections.get(key);
7386
7417
  if (existing)
7387
7418
  return existing;
7388
7419
  const { font, syntheticBold, syntheticItalic } = explicit ? { font: explicit, syntheticBold: bold, syntheticItalic: italic } : selectFont(this.fonts, bold, italic);
@@ -7399,7 +7430,7 @@ class PdfFontResources {
7399
7430
  dictionary() { return "<< " + this.resources.map(f => "/" + f.name + " " + f.object + " 0 R").join(" ") + " >>"; }
7400
7431
  }
7401
7432
  const _exports = Object.freeze({ PdfFontResource: PdfFontResource, PdfFontResources: PdfFontResources });
7402
- _modules.set("7da602b40c346a3838e75963f9a3f10c95ac5ce08a7b0a23b9d96f8898a01db7", _exports);
7433
+ _modules.set("4d4736e6b8e2aaecc6f6c1b124b7e6bc0a5e141dcc725edf0ad4847d87fca1b3", _exports);
7403
7434
  return _exports;
7404
7435
  })();
7405
7436
 
@@ -7924,7 +7955,7 @@ _modules.set("0a1c79b51ac9a164b86197239117df6497f45ca2892b423b1ec77a663ccc1c47",
7924
7955
  return _exports;
7925
7956
  })();
7926
7957
 
7927
- const _m72 = _modules.get("9a88773878eacc51df9f05bb5ee90cc2b683b083ebea8fb54375092301388e96") ?? (() => {
7958
+ const _m72 = _modules.get("2f40af05ba09102fe440c1d46385b64cecdd233371771796c9ae4e8d523f2cea") ?? (() => {
7928
7959
  const { OfficeIMOError } = _m2;
7929
7960
 
7930
7961
  const { wrapPdfText } = _m70;
@@ -7972,6 +8003,14 @@ async function projectBandRows(rows, band, widths, settings, fonts) {
7972
8003
  for (const row of rows) {
7973
8004
  const cells = [];
7974
8005
  for (const cell of row.cells) {
8006
+ // Ordinary data and leaf headings keep their captured width and lines in every band.
8007
+ // Look up their physical position without allocating another per-row column index.
8008
+ if (cell.span === 1) {
8009
+ const first = band.columns.indexOf(cell.first);
8010
+ if (first >= 0)
8011
+ cells.push({ ...cell, source: cell.source ?? cell, first });
8012
+ continue;
8013
+ }
7975
8014
  for (let first = 0; first < band.columns.length;) {
7976
8015
  const source = band.columns[first];
7977
8016
  if (source < cell.first || source >= cell.first + cell.span) {
@@ -7982,7 +8021,7 @@ async function projectBandRows(rows, band, widths, settings, fonts) {
7982
8021
  while (end < band.columns.length && band.columns[end] === band.columns[end - 1] + 1 && band.columns[end] < cell.first + cell.span)
7983
8022
  end++;
7984
8023
  const width = band.columns.slice(first, end).reduce((sum, index) => sum + widths[index], 0);
7985
- const lines = cell.span === 1 ? cell.lines : await wrapPdfText(cell.captured, fonts, settings.fontSize, width - settings.padding * 2, settings, cell.style.wrapText !== false);
8024
+ const lines = await wrapPdfText(cell.captured, fonts, settings.fontSize, width - settings.padding * 2, settings, cell.style.wrapText !== false);
7986
8025
  cells.push({ ...cell, source: cell.source ?? cell, first, span: end - first, width, lines,
7987
8026
  lineHeight: lines.reduce((height, line) => Math.max(height, line.lineHeight), cell.font.lineHeight(settings.fontSize)) });
7988
8027
  first = end;
@@ -8011,11 +8050,11 @@ function alignBandBlocks(bands, settings) {
8011
8050
  cells: row.cells.map(cell => ({ ...cell, height: heights.slice(index, index + (cell.rowSpan ?? 1)).reduce((sum, value) => sum + value, 0) })) })));
8012
8051
  }
8013
8052
  const _exports = Object.freeze({ planTableBands: planTableBands, projectBandRows: projectBandRows, alignBandBlocks: alignBandBlocks });
8014
- _modules.set("9a88773878eacc51df9f05bb5ee90cc2b683b083ebea8fb54375092301388e96", _exports);
8053
+ _modules.set("2f40af05ba09102fe440c1d46385b64cecdd233371771796c9ae4e8d523f2cea", _exports);
8015
8054
  return _exports;
8016
8055
  })();
8017
8056
 
8018
- const _m68 = _modules.get("07d2da8d8b93f12f172a48b97c1807e485555cf608e2eaa5b7610aa91d4a5305") ?? (() => {
8057
+ const _m68 = _modules.get("ad81357e627d3100e1068a8ce521aa1c1cd65de5c6c6ab36f807a3e5da50d874") ?? (() => {
8019
8058
  const { ExportCell } = _m5;
8020
8059
 
8021
8060
  const { copyExportLink } = _m7;
@@ -8135,8 +8174,12 @@ class PdfTableLayout {
8135
8174
  lines };
8136
8175
  }
8137
8176
  row(cells) {
8138
- const lines = Math.max(1, ...cells.map(c => c.lines.length));
8139
- const lineHeight = Math.max(this.lineHeight, ...cells.map(c => c.lineHeight));
8177
+ let lines = 1, lineHeight = this.lineHeight;
8178
+ for (let index = 0; index < cells.length; index++) {
8179
+ const cell = cells[index];
8180
+ lines = Math.max(lines, cell.lines.length);
8181
+ lineHeight = Math.max(lineHeight, cell.lineHeight);
8182
+ }
8140
8183
  return { cells, lines, lineHeight, height: lines * lineHeight + this.settings.padding * 2 };
8141
8184
  }
8142
8185
  async headers() {
@@ -8242,11 +8285,11 @@ class PdfTableLayout {
8242
8285
  }
8243
8286
  }
8244
8287
  const _exports = Object.freeze({ PdfTableLayout: PdfTableLayout });
8245
- _modules.set("07d2da8d8b93f12f172a48b97c1807e485555cf608e2eaa5b7610aa91d4a5305", _exports);
8288
+ _modules.set("ad81357e627d3100e1068a8ce521aa1c1cd65de5c6c6ab36f807a3e5da50d874", _exports);
8246
8289
  return _exports;
8247
8290
  })();
8248
8291
 
8249
- const _m74 = _modules.get("67ad5f4adbd6bc0dddafe5cf82638d46d150237f4ff0bee15c0ace652d5095f4") ?? (() => {
8292
+ const _m74 = _modules.get("9ea74d93c18250e809a7be745444b886bcd5ec924a78e6ab004d649789db1f72") ?? (() => {
8250
8293
  const { OfficeIMOError } = _m2;
8251
8294
 
8252
8295
  const { checkAbort } = _m4;
@@ -8290,7 +8333,7 @@ class PdfTableBandFlow {
8290
8333
  await this.flush();
8291
8334
  }
8292
8335
  async row(row, allowFirstFragment = false) {
8293
- const { padding, fontSize, options } = this.layout.settings, minimumLines = this.layout.minimumRowLines(row), minimumHeight = this.layout.minimumRowHeight(row);
8336
+ const { padding, fontSize, options } = this.layout.settings, minimumLines = this.layout.minimumRowLines(row), minimumHeight = minimumLines * row.lineHeight + padding * 2;
8294
8337
  if (minimumHeight > this.painter.firstFullCapacity + .001 || minimumHeight > this.painter.continuationCapacity + .001)
8295
8338
  throw new RangeError("Repeated PDF identifiers must fit intact below the first and continued band headings/context.");
8296
8339
  // Keep ordinary rows intact when they fit fresh. A kept heading/caption can deliberately
@@ -8324,9 +8367,14 @@ class PdfTableBandFlow {
8324
8367
  let remaining = false;
8325
8368
  const cells = rows[0].cells.map(cell => {
8326
8369
  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);
8370
+ const repeated = this.layout.repeatedColumn(source), reusable = cell.span === 1 && (cell.source?.span ?? 1) === 1 && (cell.rowSpan ?? 1) === 1 &&
8371
+ cell.height === undefined && first === 0 && (repeated || lines >= cell.lines.length);
8372
+ const visible = repeated || reusable ? cell.lines : cell.lines.slice(first, first + lines);
8328
8373
  if (!repeated && (visible.length > 0 || cell.link !== undefined))
8329
8374
  remaining = true;
8375
+ // A complete first fragment already owns these lines and their maximum font metrics.
8376
+ if (reusable)
8377
+ return cell;
8330
8378
  const { height: _height, ...plain } = cell;
8331
8379
  return { ...plain, lines: visible,
8332
8380
  lineHeight: visible.reduce((value, line) => Math.max(value, line.lineHeight), cell.font.lineHeight(fontSize)),
@@ -8379,11 +8427,11 @@ class PdfTableBandFlow {
8379
8427
  }
8380
8428
  }
8381
8429
  const _exports = Object.freeze({ PdfTableBandFlow: PdfTableBandFlow });
8382
- _modules.set("67ad5f4adbd6bc0dddafe5cf82638d46d150237f4ff0bee15c0ace652d5095f4", _exports);
8430
+ _modules.set("9ea74d93c18250e809a7be745444b886bcd5ec924a78e6ab004d649789db1f72", _exports);
8383
8431
  return _exports;
8384
8432
  })();
8385
8433
 
8386
- const _m75 = _modules.get("b52424ed74721dce3a2621456888fe1c6af0490627063e56f690df9abcb1dfff") ?? (() => {
8434
+ const _m75 = _modules.get("9deed79565a5da5009f7a01579df8d6a3f019b78eb7b17d831c7964840e9a6bf") ?? (() => {
8387
8435
  /** @internal Source-cell identities survive page fragments and horizontal band projections.
8388
8436
  * Only column headers and still-owned row objects remain reachable from this table owner. */
8389
8437
  class PdfTableStructure {
@@ -8435,30 +8483,31 @@ class PdfTableStructure {
8435
8483
  return row.cells.map(cell => this.cells.get(cell));
8436
8484
  const rowId = this.structure.element("TR", parent);
8437
8485
  this.rows.set(row, rowId);
8438
- const headers = row.cells.map((cell, index) => rowHeaderIndex === undefined ? cell.rowHeader === true : index === rowHeaderIndex);
8439
8486
  // Allocate in source order, then resolve every row header before associating even earlier data cells.
8440
8487
  // Generated summary labels override detail roles so numeric subtotal cells never become row headers.
8441
8488
  const ids = row.cells.map((cell, index) => {
8442
- const id = this.structure.element(headers[index] ? "TH" : "TD", rowId);
8489
+ const header = rowHeaderIndex === undefined ? cell.rowHeader === true : index === rowHeaderIndex;
8490
+ const id = this.structure.element(header ? "TH" : "TD", rowId);
8443
8491
  this.cells.set(cell, id);
8444
8492
  return id;
8445
8493
  });
8446
- const rowHeaders = [];
8494
+ let rowHeaders;
8447
8495
  for (let index = 0; index < ids.length; index++)
8448
- if (headers[index])
8449
- rowHeaders.push(await this.structure.identifier(ids[index]));
8496
+ if (rowHeaderIndex === undefined ? row.cells[index].rowHeader === true : index === rowHeaderIndex)
8497
+ (rowHeaders ??= []).push(await this.structure.identifier(ids[index]));
8450
8498
  for (let index = 0; index < row.cells.length; index++) {
8451
8499
  const cell = row.cells[index];
8452
- if (!rowHeaders.length && cell.span === 1 && (cell.rowSpan ?? 1) === 1) {
8500
+ if (!rowHeaders && cell.span === 1 && (cell.rowSpan ?? 1) === 1) {
8453
8501
  const attributes = this.ordinaryAttributes[cell.first] ??=
8454
8502
  await this.structure.attributeReference(this.attributeDictionary(cell, this.associations(cell)));
8455
8503
  this.structure.setAttributes(ids[index], attributes);
8456
8504
  continue;
8457
8505
  }
8458
8506
  const associations = this.associations(cell);
8459
- if (!headers[index])
8507
+ const header = rowHeaderIndex === undefined ? cell.rowHeader === true : index === rowHeaderIndex;
8508
+ if (!header && rowHeaders)
8460
8509
  associations.push(...rowHeaders);
8461
- this.structure.setAttributes(ids[index], this.attributes(cell, associations, headers[index] ? "Row" : undefined));
8510
+ this.structure.setAttributes(ids[index], this.attributes(cell, associations, header ? "Row" : undefined));
8462
8511
  }
8463
8512
  return ids;
8464
8513
  }
@@ -8493,7 +8542,7 @@ class PdfTableStructure {
8493
8542
  }
8494
8543
  }
8495
8544
  const _exports = Object.freeze({ PdfTableStructure: PdfTableStructure });
8496
- _modules.set("b52424ed74721dce3a2621456888fe1c6af0490627063e56f690df9abcb1dfff", _exports);
8545
+ _modules.set("9deed79565a5da5009f7a01579df8d6a3f019b78eb7b17d831c7964840e9a6bf", _exports);
8497
8546
  return _exports;
8498
8547
  })();
8499
8548
 
@@ -8611,7 +8660,7 @@ _modules.set("a66257a32f03d958aa57be4de9da7f80b708cebca26b5cc6404de0ee11bfe052",
8611
8660
  return _exports;
8612
8661
  })();
8613
8662
 
8614
- const _m73 = _modules.get("ce2a4bebe6ca61c77a6a974bd91981622b1f263d4e56e6b8466af41419151410") ?? (() => {
8663
+ const _m73 = _modules.get("3ed7114181be5a3066742336da574fef7f2fc04ee6dfc5e64211f3bedad4cab9") ?? (() => {
8615
8664
  const { OfficeIMOError } = _m2;
8616
8665
 
8617
8666
  const { checkAbort } = _m4;
@@ -8646,7 +8695,8 @@ class PdfPages {
8646
8695
  outlines;
8647
8696
  references = [];
8648
8697
  current = 0;
8649
- commands = [];
8698
+ commands = "";
8699
+ commandParts = [];
8650
8700
  commandBytes = 0;
8651
8701
  annotations = [];
8652
8702
  hyperlinks = 0;
@@ -8664,6 +8714,12 @@ class PdfPages {
8664
8714
  pendingBookmarks = [];
8665
8715
  pageNumberWidth = 0;
8666
8716
  colors = new Map();
8717
+ textFont;
8718
+ textSize = 0;
8719
+ textColor = "";
8720
+ textPrefix = "";
8721
+ rectangleLefts;
8722
+ rectangleColumns = [];
8667
8723
  externalObjects = new Map();
8668
8724
  bandFlow;
8669
8725
  bandCellBudget = false;
@@ -8730,7 +8786,7 @@ class PdfPages {
8730
8786
  }
8731
8787
  add(command) {
8732
8788
  this.retainPageBytes(command.length);
8733
- this.commands.push(command);
8789
+ this.commands += command;
8734
8790
  }
8735
8791
  retainPageBytes(length) {
8736
8792
  this.commandBytes += length;
@@ -8750,9 +8806,17 @@ class PdfPages {
8750
8806
  return this.structure ? "/Artifact << /Type /" + type + " >> BDC\n" + command + "EMC\n" : command;
8751
8807
  }
8752
8808
  text(text, font, size, x, baseline, foreground = "111827", element) {
8753
- const n = pdfNumber, shear = font.syntheticItalic ? .213 : 0;
8754
- const command = "q " + this.rgb(foreground) + " rg " + this.rgb(foreground) + " RG\nBT /" + font.name + " " + n(size) + " Tf " +
8755
- (font.syntheticBold ? n(size * .025) + " w 2 Tr " : "0 Tr ") + "1 0 " + n(shear) + " 1 " + n(x) + " " + n(baseline) + " Tm " + font.encode(text) + " Tj ET Q\n";
8809
+ const n = pdfNumber;
8810
+ if (font !== this.textFont || size !== this.textSize || foreground !== this.textColor) {
8811
+ const shear = font.syntheticItalic ? .213 : 0, rgb = this.rgb(foreground);
8812
+ // Keep one prefix, independent of report size. Resource identity includes synthetic styling.
8813
+ this.textPrefix = "q " + rgb + " rg " + rgb + " RG\nBT /" + font.name + " " + n(size) + " Tf " +
8814
+ (font.syntheticBold ? n(size * .025) + " w 2 Tr " : "0 Tr ") + "1 0 " + n(shear) + " 1 ";
8815
+ this.textFont = font;
8816
+ this.textSize = size;
8817
+ this.textColor = foreground;
8818
+ }
8819
+ const command = this.textPrefix + n(x) + " " + n(baseline) + " Tm " + font.encode(text) + " Tj ET Q\n";
8756
8820
  this.add(this.structure && element !== undefined ? this.structure.mark(element) + command + "EMC\n" : this.artifact(command, "Pagination"));
8757
8821
  }
8758
8822
  link(link, x, bottom, width, height, element) {
@@ -8782,8 +8846,8 @@ class PdfPages {
8782
8846
  for (const segment of line.segments) {
8783
8847
  const registered = marks?.get(segment), owner = registered?.owner ?? (segment.link && this.structure && element !== undefined ? this.structure.link(element, segment.link) : element);
8784
8848
  if (segment.glyphs) {
8785
- const font = segment.font, n = pdfNumber, shear = font.syntheticItalic ? .213 : 0;
8786
- let cursor = x, command = "q " + this.rgb(segment.color ?? "111827") + " rg " + this.rgb(segment.color ?? "111827") + " RG\nBT /" + font.name + " " + n(size) + " Tf " +
8849
+ const font = segment.font, n = pdfNumber, shear = font.syntheticItalic ? .213 : 0, rgb = this.rgb(segment.color ?? "111827");
8850
+ let cursor = x, command = "q " + rgb + " rg " + rgb + " RG\nBT /" + font.name + " " + n(size) + " Tf " +
8787
8851
  (font.syntheticBold ? n(size * .025) + " w 2 Tr " : "0 Tr ");
8788
8852
  for (const glyph of segment.glyphs) {
8789
8853
  command += "1 0 " + n(shear) + " 1 " + n(cursor + (glyph.xOffset + shear * glyph.yOffset) * size / 1000) + " " + n(baseline + glyph.yOffset * size / 1000) + " Tm " + font.encodeGlyph(glyph.id, glyph.logicalText) + " Tj\n";
@@ -8831,7 +8895,8 @@ class PdfPages {
8831
8895
  this.current = this.objects.reserve();
8832
8896
  this.references.push(this.current);
8833
8897
  }
8834
- this.commands = [];
8898
+ this.commands = "";
8899
+ this.commandParts = [];
8835
8900
  this.annotations = [];
8836
8901
  this.commandBytes = 0;
8837
8902
  this.bodyAdded = false;
@@ -8896,7 +8961,7 @@ class PdfPages {
8896
8961
  // Charge physical repeats without recapturing callbacks or making them semantic duplicates.
8897
8962
  for (const cell of header.cells)
8898
8963
  if (!this.bandCellBudget && this.paintedHeaderBudgetCells.has(cell.source ?? cell))
8899
- this.settings.budget.cell(cell.lines.map(line => line.text).join(""));
8964
+ this.settings.budget.cell(this.settings.budget.limits.maxTextCharacters === undefined ? "" : cell.lines.map(line => line.text).join(""));
8900
8965
  const elements = this.tableStructure ? header.cells.map(cell => this.tableStructure.owner(cell.source ?? cell)) : undefined;
8901
8966
  const repeated = header.cells.map(cell => this.paintedHeaderCells.has(cell.source ?? cell));
8902
8967
  this.draw(header, 0, header.lines, elements, repeated);
@@ -8914,14 +8979,32 @@ class PdfPages {
8914
8979
  if (!this.layout)
8915
8980
  throw new Error("A table layout is required before drawing rows.");
8916
8981
  this.bodyAdded = true;
8917
- const { padding, fontSize } = this.settings, n = pdfNumber, height = lineCount * row.lineHeight + padding * 2;
8982
+ const { padding, fontSize } = this.settings, n = pdfNumber, height = lineCount * row.lineHeight + padding * 2, lefts = this.layout.lefts;
8983
+ // One geometry token per active physical column; table/band changes release the old tokens.
8984
+ if (this.rectangleLefts !== lefts) {
8985
+ this.rectangleLefts = lefts;
8986
+ this.rectangleColumns = [];
8987
+ }
8988
+ let rectangleHeight, rectangleBottom = "", rectangleHeightText = "";
8918
8989
  for (const [index, cell] of row.cells.entries()) {
8919
8990
  if (this.bandCellBudget)
8920
- this.settings.budget.cell((cell.height === undefined ? cell.lines.slice(firstLine, firstLine + lineCount) : cell.lines).map(line => line.text).join(""));
8921
- const x = this.layout.lefts[cell.first], cellHeight = cell.height ?? height;
8991
+ this.settings.budget.cell(this.settings.budget.limits.maxTextCharacters === undefined ? "" :
8992
+ (cell.height === undefined ? cell.lines.slice(firstLine, firstLine + lineCount) : cell.lines).map(line => line.text).join(""));
8993
+ const x = lefts[cell.first], cellHeight = cell.height ?? height;
8994
+ if (cellHeight !== rectangleHeight) {
8995
+ rectangleBottom = n(this.y - cellHeight);
8996
+ rectangleHeightText = n(cellHeight);
8997
+ rectangleHeight = cellHeight;
8998
+ }
8999
+ let horizontal = this.rectangleColumns[cell.first];
9000
+ if (!horizontal || horizontal.x !== x || horizontal.width !== cell.width) {
9001
+ horizontal = { x, width: cell.width, left: n(x), widthText: n(cell.width) };
9002
+ this.rectangleColumns[cell.first] = horizontal;
9003
+ }
9004
+ const rectangle = horizontal.left + " " + rectangleBottom + " " + horizontal.widthText + " " + rectangleHeightText;
8922
9005
  if (cell.style.background)
8923
- this.add(this.artifact("q " + this.rgb(cell.style.background) + " rg " + n(x) + " " + n(this.y - cellHeight) + " " + n(cell.width) + " " + n(cellHeight) + " re f Q\n"));
8924
- this.add(this.artifact("q 0.82 0.85 0.89 RG 0.4 w " + n(x) + " " + n(this.y - cellHeight) + " " + n(cell.width) + " " + n(cellHeight) + " re S Q\n"));
9006
+ this.add(this.artifact("q " + this.rgb(cell.style.background) + " rg " + rectangle + " re f Q\n"));
9007
+ this.add(this.artifact("q 0.82 0.85 0.89 RG 0.4 w " + rectangle + " re S Q\n"));
8925
9008
  const element = elements?.[index], artifact = cell.semanticArtifact || repeated[index], owner = cell.link && this.structure && element !== undefined ? this.structure.link(element, cell.link) : element;
8926
9009
  for (let line = firstLine; line < Math.min(cell.lines.length, cell.height ? cell.lines.length : firstLine + lineCount); line++) {
8927
9010
  const text = cell.lines[line], left = cell.style.alignment === "right" ? cell.width - padding - text.width : cell.style.alignment === "center" ? (cell.width - text.width) / 2 : padding;
@@ -8931,6 +9014,7 @@ class PdfPages {
8931
9014
  this.link(cell.link, x, this.y - cellHeight, cell.width, cellHeight, owner);
8932
9015
  }
8933
9016
  this.y -= row.structured ? row.height : height;
9017
+ this.sealCommands();
8934
9018
  }
8935
9019
  async block(rows) {
8936
9020
  if (this.bandFlow)
@@ -9256,9 +9340,22 @@ class PdfPages {
9256
9340
  marker: { line: item.marker, gap: item.markerGap, ...(label === undefined ? {} : { owner: label }) } });
9257
9341
  await this.structure?.complete(li);
9258
9342
  }
9343
+ sealCommands() {
9344
+ if (this.commands) {
9345
+ this.commandParts.push(this.commands);
9346
+ this.commands = "";
9347
+ }
9348
+ }
9349
+ takeCommands() {
9350
+ this.sealCommands();
9351
+ const content = this.commandParts.join("");
9352
+ // Encoding and awaited delivery own the page value; the next page starts independently.
9353
+ this.commandParts = [];
9354
+ return content;
9355
+ }
9259
9356
  async finishPage() {
9260
9357
  const contents = this.objects.reserve(), { page, options } = this.settings;
9261
- await this.objects.stream(contents, this.commands.join(""), "", options.compression !== false);
9358
+ await this.objects.stream(contents, this.takeCommands(), "", options.compression !== false);
9262
9359
  const annotations = [];
9263
9360
  for (const annotation of this.annotations) {
9264
9361
  annotations.push(annotation.id);
@@ -9270,7 +9367,6 @@ class PdfPages {
9270
9367
  (annotations.length ? " /Annots [" + annotations.map(id => id + " 0 R").join(" ") + "]" : "") + " >>");
9271
9368
  if (this.structure)
9272
9369
  await this.structure.finishPage();
9273
- this.commands = [];
9274
9370
  this.annotations = [];
9275
9371
  this.commandBytes = 0;
9276
9372
  this.current = 0;
@@ -9302,7 +9398,7 @@ class PdfPages {
9302
9398
  }
9303
9399
  }
9304
9400
  const _exports = Object.freeze({ PdfPages: PdfPages });
9305
- _modules.set("ce2a4bebe6ca61c77a6a974bd91981622b1f263d4e56e6b8466af41419151410", _exports);
9401
+ _modules.set("3ed7114181be5a3066742336da574fef7f2fc04ee6dfc5e64211f3bedad4cab9", _exports);
9306
9402
  return _exports;
9307
9403
  })();
9308
9404
 
@@ -9745,7 +9841,7 @@ _modules.set("52c78ca6833cee7e5a96b657e2c00172d550176daf2c95e742692f8416977bea",
9745
9841
  return _exports;
9746
9842
  })();
9747
9843
 
9748
- const _m58 = _modules.get("6f13eca1cc6a3dee16e260ffb7ee38115cc2390084e9b156f0a90915fa5b18b9") ?? (() => {
9844
+ const _m58 = _modules.get("afdad27eb363e8de0c3bd69ebf358860eb76f5c6fb29f43a87635807cb7fc273") ?? (() => {
9749
9845
  const { PdfObjects, unicodeHex } = _m59;
9750
9846
 
9751
9847
  const { PdfFontResources } = _m61;
@@ -9808,11 +9904,11 @@ class PdfWriteSession {
9808
9904
  }
9809
9905
  }
9810
9906
  const _exports = Object.freeze({ PdfWriteSession: PdfWriteSession });
9811
- _modules.set("6f13eca1cc6a3dee16e260ffb7ee38115cc2390084e9b156f0a90915fa5b18b9", _exports);
9907
+ _modules.set("afdad27eb363e8de0c3bd69ebf358860eb76f5c6fb29f43a87635807cb7fc273", _exports);
9812
9908
  return _exports;
9813
9909
  })();
9814
9910
 
9815
- const _m54 = _modules.get("4a658d1639cc333dc8b174a84d2d80a7e20bec2f0e86409d00c3f77199e2eda2") ?? (() => {
9911
+ const _m54 = _modules.get("45cf9fd6b6293c1a83bc8554e1bcb5cf119f44701fbad7849f39a712cab5074b") ?? (() => {
9816
9912
  const { BlobByteSink, withDestination } = _m3;
9817
9913
 
9818
9914
  const { beginTask, checkAbort, consumeRows, pause, taskYieldDue } = _m4;
@@ -9877,7 +9973,7 @@ async function writePdfTo(rows, destination, configuration) {
9877
9973
  });
9878
9974
  }
9879
9975
  const _exports = Object.freeze({ writePdf: writePdf, writePdfTo: writePdfTo });
9880
- _modules.set("4a658d1639cc333dc8b174a84d2d80a7e20bec2f0e86409d00c3f77199e2eda2", _exports);
9976
+ _modules.set("45cf9fd6b6293c1a83bc8554e1bcb5cf119f44701fbad7849f39a712cab5074b", _exports);
9881
9977
  return _exports;
9882
9978
  })();
9883
9979
 
@@ -10809,7 +10905,7 @@ _modules.set("d04686d2c067355dfd215333b83eb5f79f96e9e4be49f942e050f21ac0795343",
10809
10905
  return _exports;
10810
10906
  })();
10811
10907
 
10812
- const _m90 = _modules.get("d43e573fd5bad18a7ec2d71752168c422c4f8fabbc51f1cef8e3ba389f298715") ?? (() => {
10908
+ const _m90 = _modules.get("289fa3a052c7fbab2a3ca0fb91fb9974db709d24b7d850f1175810258f0409a0") ?? (() => {
10813
10909
  const { assertGroupedReportSource, groupedReportOperation } = _m8;
10814
10910
 
10815
10911
  const { consumeRows } = _m4;
@@ -11063,11 +11159,11 @@ async function renderGroupedPdfTable(block, context) {
11063
11159
  }
11064
11160
  }
11065
11161
  const _exports = Object.freeze({ renderGroupedPdfTable: renderGroupedPdfTable });
11066
- _modules.set("d43e573fd5bad18a7ec2d71752168c422c4f8fabbc51f1cef8e3ba389f298715", _exports);
11162
+ _modules.set("289fa3a052c7fbab2a3ca0fb91fb9974db709d24b7d850f1175810258f0409a0", _exports);
11067
11163
  return _exports;
11068
11164
  })();
11069
11165
 
11070
- const _m83 = _modules.get("67060b0c8b6d3f6a6d9d53d41dd780ee99ffdae0ed0f90004ac675d382a80223") ?? (() => {
11166
+ const _m83 = _modules.get("9051bf9fc3168e24b53b16c123a42816198456846003fb49191c03a18cdab904") ?? (() => {
11071
11167
  const { BlobByteSink, withDestination } = _m3;
11072
11168
 
11073
11169
  const { OfficeIMOError } = _m2;
@@ -11357,11 +11453,11 @@ function captureTableOptions(options) {
11357
11453
  return { ...captured, ...(captured.wideTable === undefined ? {} : { wideTable: captureWideTable(captured.wideTable) }) };
11358
11454
  }
11359
11455
  const _exports = Object.freeze({ pdfTable: pdfTable, writePdfDocument: writePdfDocument, writePdfDocumentTo: writePdfDocumentTo });
11360
- _modules.set("67060b0c8b6d3f6a6d9d53d41dd780ee99ffdae0ed0f90004ac675d382a80223", _exports);
11456
+ _modules.set("9051bf9fc3168e24b53b16c123a42816198456846003fb49191c03a18cdab904", _exports);
11361
11457
  return _exports;
11362
11458
  })();
11363
11459
 
11364
- const _m82 = _modules.get("91d1ab43a388d5d7a78db095e27ed8b0f6d28004358cbf296ac818479c58c557") ?? (() => {
11460
+ const _m82 = _modules.get("abe76e52ffeed11ab42477c83ddde1d1d7de28b803096436b5b23cb153af58ba") ?? (() => {
11365
11461
  const { assertGroupedReportSource } = _m8;
11366
11462
 
11367
11463
  const { BlobByteSink } = _m3;
@@ -11407,7 +11503,7 @@ async function writeGroupedPdfTo(report, destination, configuration) {
11407
11503
  return writePdfDocumentTo([pdfGroupedTable(report, tableOptions)], destination, documentOptions);
11408
11504
  }
11409
11505
  const _exports = Object.freeze({ pdfGroupedTable: _m91.pdfGroupedTable, writeGroupedPdf: writeGroupedPdf, writeGroupedPdfTo: writeGroupedPdfTo });
11410
- _modules.set("91d1ab43a388d5d7a78db095e27ed8b0f6d28004358cbf296ac818479c58c557", _exports);
11506
+ _modules.set("abe76e52ffeed11ab42477c83ddde1d1d7de28b803096436b5b23cb153af58ba", _exports);
11411
11507
  return _exports;
11412
11508
  })();
11413
11509
 
@@ -11451,10 +11547,10 @@ _modules.set("3d777096288d1be55a05a80bc015d4674212e587703f25a7e7cf99a8065feb86",
11451
11547
  return _exports;
11452
11548
  })();
11453
11549
 
11454
- const _m53 = _modules.get("dcf6840f5eda4f8535cb4e226425587c2ae436c0eebfbd746aa0bc8a7acb6c4c") ?? (() => {
11550
+ const _m53 = _modules.get("027aafa08408056b10d7d717d63d1f7c0ee20ecfc68213aa66feacc75ec525fe") ?? (() => {
11455
11551
 
11456
11552
  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);
11553
+ _modules.set("027aafa08408056b10d7d717d63d1f7c0ee20ecfc68213aa66feacc75ec525fe", _exports);
11458
11554
  return _exports;
11459
11555
  })();
11460
11556
 
@@ -11828,7 +11924,7 @@ _modules.set("58066519dce31ad3bb7f5f5c377585d3374a84578358ad519e2c021efa1a26f8",
11828
11924
  return _exports;
11829
11925
  })();
11830
11926
 
11831
- const _m0 = _modules.get("0cb74f735a0253b5ad1598ebcb1f454c1a02fa8fb0b7a41976ca5639cacf7338") ?? (() => {
11927
+ const _m0 = _modules.get("febf70a0ae4804a10a5333e9d7f0cdd19a5362f9d4bdb21fc5ce101b0a3334d8") ?? (() => {
11832
11928
  const { BlobByteSink, checkAbort, saveBlob } = _m1;
11833
11929
 
11834
11930
  const { notifyProgress } = _m14;
@@ -12011,7 +12107,7 @@ function registerDataTablesButtons(host, options = {}) {
12011
12107
  }
12012
12108
  }
12013
12109
  const _exports = Object.freeze({ createDataTablesExport: _m95.createDataTablesExport, ExportCell: _m5.ExportCell, PdfFont: _m62.PdfFont, writeDataTableTo: writeDataTableTo, exportDataTable: exportDataTable, registerDataTablesButtons: registerDataTablesButtons });
12014
- _modules.set("0cb74f735a0253b5ad1598ebcb1f454c1a02fa8fb0b7a41976ca5639cacf7338", _exports);
12110
+ _modules.set("febf70a0ae4804a10a5333e9d7f0cdd19a5362f9d4bdb21fc5ce101b0a3334d8", _exports);
12015
12111
  return _exports;
12016
12112
  })();
12017
12113
  Object.assign(officeimo, _m0);