ooxml-core 1.14.0 → 1.16.0

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 (143) hide show
  1. package/dist/PptxHandler-3A7VEXVK.cjs +13 -0
  2. package/dist/PptxHandler-7POULDRL.mjs +4 -0
  3. package/dist/{PptxHandler-KNBFECUE.mjs → PptxHandler-M35YFCUC.mjs} +2 -2
  4. package/dist/PresentationBuilder-C7NPM7OQ.mjs +4 -0
  5. package/dist/{PresentationBuilder-II7C4A3R.cjs → PresentationBuilder-XVRTITYR.cjs} +6 -5
  6. package/dist/{PresentationBuilder-5DCCFHWJ.mjs → PresentationBuilder-Y6DJK6H2.mjs} +2 -2
  7. package/dist/automation/index.cjs +1198 -1095
  8. package/dist/automation/index.mjs +1198 -1095
  9. package/dist/chunk-5W2QL4SB.cjs +244 -0
  10. package/dist/{chunk-TQE7FFNT.cjs → chunk-AHRFBMLK.cjs} +4070 -2015
  11. package/dist/{chunk-2D4IFQ5M.mjs → chunk-B37EVUMG.mjs} +1 -1
  12. package/dist/{chunk-4WZLFUUA.mjs → chunk-C2Y6SZDN.mjs} +934 -200
  13. package/dist/chunk-CA7KCNL3.mjs +236 -0
  14. package/dist/{chunk-BSUIDT6K.cjs → chunk-DWRJ62KP.cjs} +1 -0
  15. package/dist/{chunk-TNNXOW2O.mjs → chunk-KOX5Y5E5.mjs} +1 -1
  16. package/dist/{chunk-54ASP65T.mjs → chunk-LM6VBPQJ.mjs} +416 -15
  17. package/dist/{chunk-PC4MTLG4.cjs → chunk-OA5V3JJC.cjs} +8 -8
  18. package/dist/{chunk-ORH32TO3.mjs → chunk-OKGQ2X7D.mjs} +3092 -1037
  19. package/dist/{chunk-X7MGZQ6C.cjs → chunk-UGWY72WC.cjs} +396 -254
  20. package/dist/{chunk-XGXIS4PN.mjs → chunk-WBCV52YV.mjs} +3077 -1027
  21. package/dist/{chunk-2EBMHIGJ.mjs → chunk-WEFFRYXN.mjs} +379 -242
  22. package/dist/{chunk-AXF2FC4D.mjs → chunk-WSRCLCMB.mjs} +1 -0
  23. package/dist/{chunk-LMMP67YN.mjs → chunk-XCJRUBGJ.mjs} +1 -1
  24. package/dist/geometry/index.cjs +259 -0
  25. package/dist/geometry/index.d.ts +1 -0
  26. package/dist/geometry/index.d.ts.map +1 -1
  27. package/dist/geometry/index.mjs +255 -1
  28. package/dist/geometry/shape-gallery-catalog.d.ts +32 -0
  29. package/dist/geometry/shape-gallery-catalog.d.ts.map +1 -0
  30. package/dist/index.cjs +371 -112
  31. package/dist/index.mjs +371 -112
  32. package/dist/pptx/automation/index.cjs +4523 -1957
  33. package/dist/pptx/automation/index.d.ts +4 -4
  34. package/dist/pptx/automation/index.mjs +5 -5
  35. package/dist/pptx/chunks/{elements-tK7xnWeS.d.ts → elements-iUzpAeqR.d.ts} +232 -2
  36. package/dist/pptx/chunks/elements-iUzpAeqR.d.ts.map +1 -0
  37. package/dist/pptx/chunks/{index-DS9Y4Ne3.d.ts → index-BWHNCVNC.d.ts} +1673 -1534
  38. package/dist/pptx/chunks/index-BWHNCVNC.d.ts.map +1 -0
  39. package/dist/pptx/chunks/{index-BSpNQuvz.d.ts → index-CiyTR6mm.d.ts} +201 -5
  40. package/dist/pptx/chunks/index-CiyTR6mm.d.ts.map +1 -0
  41. package/dist/pptx/chunks/{text-operations-BdD_UQ11.d.ts → text-operations-CfLVZ7DK.d.ts} +81 -3
  42. package/dist/pptx/chunks/text-operations-CfLVZ7DK.d.ts.map +1 -0
  43. package/dist/pptx/cli/index.cjs +4465 -1899
  44. package/dist/pptx/cli/index.d.ts +1 -1
  45. package/dist/pptx/cli/index.mjs +4 -4
  46. package/dist/pptx/converter/index.cjs +52 -1
  47. package/dist/pptx/converter/index.d.ts +1 -1
  48. package/dist/pptx/converter/index.mjs +2 -2
  49. package/dist/pptx/editor/render/collaboration-live-patch-target.cjs +4 -4
  50. package/dist/pptx/editor/render/collaboration-live-patch-target.mjs +2 -2
  51. package/dist/pptx/editor/render/collaboration-reconcile.cjs +7 -7
  52. package/dist/pptx/editor/render/collaboration-reconcile.mjs +2 -2
  53. package/dist/pptx/editor/render/collaboration-sync.cjs +14 -14
  54. package/dist/pptx/editor/render/collaboration-sync.d.ts.map +1 -1
  55. package/dist/pptx/editor/render/collaboration-sync.mjs +1 -1
  56. package/dist/pptx/editor/render/find-replace.cjs +15 -14
  57. package/dist/pptx/editor/render/find-replace.d.ts +2 -2
  58. package/dist/pptx/editor/render/find-replace.mjs +2 -1
  59. package/dist/pptx/editor/render/slide-operations.cjs +9 -8
  60. package/dist/pptx/editor/render/slide-operations.mjs +3 -2
  61. package/dist/pptx/editor/render/slide-size-rescale.cjs +3 -3
  62. package/dist/pptx/editor/render/slide-size-rescale.d.ts +1 -1
  63. package/dist/pptx/editor/render/slide-size-rescale.d.ts.map +1 -1
  64. package/dist/pptx/editor/render/slide-size-rescale.mjs +3 -3
  65. package/dist/pptx/editor/render/text-runs-style-patch.d.ts +1 -1
  66. package/dist/pptx/editor/render/text-style-scope.d.ts +1 -1
  67. package/dist/pptx/index.cjs +5656 -2290
  68. package/dist/pptx/index.d.ts +5 -5
  69. package/dist/pptx/index.mjs +5 -5
  70. package/dist/teams/ics.d.ts.map +1 -1
  71. package/dist/teams/index.cjs +631 -635
  72. package/dist/teams/index.d.ts +1 -0
  73. package/dist/teams/index.d.ts.map +1 -1
  74. package/dist/teams/index.mjs +616 -636
  75. package/dist/teams/meetings.d.ts +11 -1
  76. package/dist/teams/meetings.d.ts.map +1 -1
  77. package/dist/teams/recurrence-calendar.d.ts +41 -0
  78. package/dist/teams/recurrence-calendar.d.ts.map +1 -0
  79. package/dist/teams/recurrence.d.ts +1 -1
  80. package/dist/teams/recurrence.d.ts.map +1 -1
  81. package/dist/teams/server-session.d.ts +19 -0
  82. package/dist/teams/server-session.d.ts.map +1 -1
  83. package/dist/xlsx/edit/pivots.d.ts.map +1 -1
  84. package/dist/xlsx/index.cjs +1137 -1027
  85. package/dist/xlsx/index.mjs +1136 -1028
  86. package/dist/xlsx/load/index.cjs +593 -652
  87. package/dist/xlsx/load/index.mjs +593 -652
  88. package/dist/xlsx/model-pivots.d.ts +64 -4
  89. package/dist/xlsx/model-pivots.d.ts.map +1 -1
  90. package/dist/xlsx/pivot/aggregate.d.ts +6 -3
  91. package/dist/xlsx/pivot/aggregate.d.ts.map +1 -1
  92. package/dist/xlsx/pivot/axes.d.ts +5 -0
  93. package/dist/xlsx/pivot/axes.d.ts.map +1 -1
  94. package/dist/xlsx/pivot/captions-locales.d.ts +3 -0
  95. package/dist/xlsx/pivot/captions-locales.d.ts.map +1 -0
  96. package/dist/xlsx/pivot/captions-read.d.ts +14 -0
  97. package/dist/xlsx/pivot/captions-read.d.ts.map +1 -0
  98. package/dist/xlsx/pivot/captions.d.ts +26 -0
  99. package/dist/xlsx/pivot/captions.d.ts.map +1 -0
  100. package/dist/xlsx/pivot/columns.d.ts +9 -3
  101. package/dist/xlsx/pivot/columns.d.ts.map +1 -1
  102. package/dist/xlsx/pivot/data.d.ts +3 -2
  103. package/dist/xlsx/pivot/data.d.ts.map +1 -1
  104. package/dist/xlsx/pivot/date-axes.d.ts +1 -1
  105. package/dist/xlsx/pivot/date-axes.d.ts.map +1 -1
  106. package/dist/xlsx/pivot/date-group-read.d.ts.map +1 -1
  107. package/dist/xlsx/pivot/date-groups.d.ts +8 -3
  108. package/dist/xlsx/pivot/date-groups.d.ts.map +1 -1
  109. package/dist/xlsx/pivot/index.d.ts +2 -1
  110. package/dist/xlsx/pivot/index.d.ts.map +1 -1
  111. package/dist/xlsx/pivot/item-labels.d.ts +12 -0
  112. package/dist/xlsx/pivot/item-labels.d.ts.map +1 -0
  113. package/dist/xlsx/pivot/item-names-read.d.ts +8 -0
  114. package/dist/xlsx/pivot/item-names-read.d.ts.map +1 -0
  115. package/dist/xlsx/pivot/measures.d.ts +2 -8
  116. package/dist/xlsx/pivot/measures.d.ts.map +1 -1
  117. package/dist/xlsx/pivot/nested.d.ts +4 -2
  118. package/dist/xlsx/pivot/nested.d.ts.map +1 -1
  119. package/dist/xlsx/pivot/page-filter-admission.d.ts.map +1 -1
  120. package/dist/xlsx/pivot/page-filter.d.ts +1 -1
  121. package/dist/xlsx/pivot/page-filter.d.ts.map +1 -1
  122. package/dist/xlsx/pivot/read.d.ts.map +1 -1
  123. package/dist/xlsx/pivot/subtotals.d.ts +6 -1
  124. package/dist/xlsx/pivot/subtotals.d.ts.map +1 -1
  125. package/dist/xlsx/pivot/table-xml.d.ts.map +1 -1
  126. package/dist/xlsx/pivot/values-axis.d.ts +7 -4
  127. package/dist/xlsx/pivot/values-axis.d.ts.map +1 -1
  128. package/dist/xlsx/ui/commands/i18n/navigation.d.ts.map +1 -1
  129. package/dist/xlsx/ui/commands/i18n/pivots.d.ts.map +1 -1
  130. package/dist/xlsx/ui/index.cjs +1002 -1136
  131. package/dist/xlsx/ui/index.mjs +1002 -1136
  132. package/package.json +1 -1
  133. package/dist/PptxHandler-5YP75BPO.cjs +0 -12
  134. package/dist/PptxHandler-GT5Q66TG.mjs +0 -3
  135. package/dist/PresentationBuilder-CVM6LJ7L.mjs +0 -3
  136. package/dist/pptx/chunks/elements-tK7xnWeS.d.ts.map +0 -1
  137. package/dist/pptx/chunks/index-BSpNQuvz.d.ts.map +0 -1
  138. package/dist/pptx/chunks/index-DS9Y4Ne3.d.ts.map +0 -1
  139. package/dist/pptx/chunks/text-operations-BdD_UQ11.d.ts.map +0 -1
  140. package/dist/xlsx/pivot/hierarchy-first.d.ts +0 -21
  141. package/dist/xlsx/pivot/hierarchy-first.d.ts.map +0 -1
  142. package/dist/xlsx/pivot/hierarchy.d.ts +0 -8
  143. package/dist/xlsx/pivot/hierarchy.d.ts.map +0 -1
@@ -27,19 +27,19 @@ var isCellError = (value2) => typeof value2 === "object" && value2 !== null && "
27
27
  var MAX_ROW = 1048575;
28
28
  var MAX_COL = 16383;
29
29
  function columnLabel(col) {
30
- let label5 = "";
30
+ let label2 = "";
31
31
  let n = col + 1;
32
32
  while (n > 0) {
33
33
  const rem = (n - 1) % 26;
34
- label5 = String.fromCharCode(65 + rem) + label5;
34
+ label2 = String.fromCharCode(65 + rem) + label2;
35
35
  n = Math.floor((n - 1) / 26);
36
36
  }
37
- return label5;
37
+ return label2;
38
38
  }
39
- function columnIndex(label5) {
40
- if (!/^[A-Za-z]{1,3}$/.test(label5)) return -1;
39
+ function columnIndex(label2) {
40
+ if (!/^[A-Za-z]{1,3}$/.test(label2)) return -1;
41
41
  let n = 0;
42
- for (const ch of label5.toUpperCase()) n = n * 26 + (ch.charCodeAt(0) - 64);
42
+ for (const ch of label2.toUpperCase()) n = n * 26 + (ch.charCodeAt(0) - 64);
43
43
  return n - 1;
44
44
  }
45
45
  var formatAddress = (address2) => `${columnLabel(address2.col)}${address2.row + 1}`;
@@ -3836,14 +3836,14 @@ function unique(args, ctx) {
3836
3836
  const byCol = args.length > 1 && args[1] !== null && toBool(ctx.toScalar(args[1] ?? null));
3837
3837
  const once = args.length > 2 && args[2] !== null && toBool(ctx.toScalar(args[2] ?? null));
3838
3838
  if (byCol) m = transpose(m);
3839
- const keyOf2 = (row2) => JSON.stringify(
3839
+ const keyOf3 = (row2) => JSON.stringify(
3840
3840
  row2.map(
3841
3841
  (v) => isError(v) ? `#${v.error}` : typeof v === "string" ? `s${v.toLowerCase()}` : v
3842
3842
  )
3843
3843
  );
3844
3844
  const counts = /* @__PURE__ */ new Map();
3845
3845
  for (const row2 of m.data) {
3846
- const key = keyOf2(row2);
3846
+ const key = keyOf3(row2);
3847
3847
  const entry = counts.get(key);
3848
3848
  if (entry) entry.count++;
3849
3849
  else counts.set(key, { row: row2, count: 1 });
@@ -4134,24 +4134,24 @@ function tableOf(ctx, value2) {
4134
4134
  if (!head || records.length === 0) fail(ERR.VALUE);
4135
4135
  return { headers: head.map((v) => label(v).toLowerCase()), records };
4136
4136
  }
4137
- function fieldIndex(table2, field) {
4137
+ function fieldIndex(table3, field) {
4138
4138
  const value2 = scalar(field);
4139
4139
  if (isError(value2)) fail(value2);
4140
4140
  if (typeof value2 === "number") {
4141
4141
  const index3 = Math.trunc(value2) - 1;
4142
- if (index3 < 0 || index3 >= table2.headers.length) fail(ERR.VALUE);
4142
+ if (index3 < 0 || index3 >= table3.headers.length) fail(ERR.VALUE);
4143
4143
  return index3;
4144
4144
  }
4145
- const index2 = table2.headers.indexOf(label(value2).toLowerCase());
4145
+ const index2 = table3.headers.indexOf(label(value2).toLowerCase());
4146
4146
  if (index2 < 0) fail(ERR.VALUE);
4147
4147
  return index2;
4148
4148
  }
4149
- function recordFilter(table2, criteria) {
4149
+ function recordFilter(table3, criteria) {
4150
4150
  const [head, ...rows2] = criteria;
4151
4151
  if (!head || rows2.length === 0) fail(ERR.VALUE);
4152
4152
  const columns = head.map((name) => {
4153
4153
  if (name === null || name === "") return -1;
4154
- return table2.headers.indexOf(label(name).toLowerCase());
4154
+ return table3.headers.indexOf(label(name).toLowerCase());
4155
4155
  });
4156
4156
  const alternatives = rows2.map(
4157
4157
  (row2) => row2.flatMap((cell, c) => {
@@ -4165,10 +4165,10 @@ function recordFilter(table2, criteria) {
4165
4165
  return (record) => alternatives.some((tests) => tests.every((test) => test(record)));
4166
4166
  }
4167
4167
  function selected(ctx, args) {
4168
- const table2 = tableOf(ctx, args[0]);
4169
- const column2 = fieldIndex(table2, args[1]);
4170
- const matches2 = recordFilter(table2, ctx.toMatrix(args[2] ?? null).data);
4171
- return table2.records.filter(matches2).map((record) => record[column2] ?? null);
4168
+ const table3 = tableOf(ctx, args[0]);
4169
+ const column2 = fieldIndex(table3, args[1]);
4170
+ const matches2 = recordFilter(table3, ctx.toMatrix(args[2] ?? null).data);
4171
+ return table3.records.filter(matches2).map((record) => record[column2] ?? null);
4172
4172
  }
4173
4173
  var numbers = (values2) => {
4174
4174
  for (const v of values2) if (isError(v)) fail(v);
@@ -6467,30 +6467,30 @@ function findTable(host, name, sheet, row2, col) {
6467
6467
  if (name) {
6468
6468
  const lower3 = name.toLowerCase();
6469
6469
  for (let s = 0; s < sheets.length; s++) {
6470
- const table3 = sheets[s]?.tables.find(
6470
+ const table4 = sheets[s]?.tables.find(
6471
6471
  (t) => t.displayName.toLowerCase() === lower3 || t.name.toLowerCase() === lower3
6472
6472
  );
6473
- if (table3) return { table: table3, sheet: s };
6473
+ if (table4) return { table: table4, sheet: s };
6474
6474
  }
6475
6475
  return void 0;
6476
6476
  }
6477
- const table2 = sheets[sheet]?.tables.find(
6477
+ const table3 = sheets[sheet]?.tables.find(
6478
6478
  (t) => row2 >= t.range.start.row && row2 <= t.range.end.row && col >= t.range.start.col && col <= t.range.end.col
6479
6479
  );
6480
- return table2 ? { table: table2, sheet } : void 0;
6480
+ return table3 ? { table: table3, sheet } : void 0;
6481
6481
  }
6482
6482
  function resolveStructured(ref, frame) {
6483
6483
  const found = findTable(frame.host, ref.table, frame.sheet, frame.row, frame.col);
6484
6484
  if (!found) return ref.table ? ERR.NAME : ERR.REF;
6485
- const { table: table2, sheet } = found;
6486
- const range2 = normalizeRange(table2.range);
6487
- const headerRow = table2.headerRow ? range2.start.row : -1;
6488
- const dataStart = range2.start.row + (table2.headerRow ? 1 : 0);
6489
- const dataEnd = range2.end.row - (table2.totalsRow ? 1 : 0);
6490
- const totalsRow = table2.totalsRow ? range2.end.row : -1;
6485
+ const { table: table3, sheet } = found;
6486
+ const range2 = normalizeRange(table3.range);
6487
+ const headerRow = table3.headerRow ? range2.start.row : -1;
6488
+ const dataStart = range2.start.row + (table3.headerRow ? 1 : 0);
6489
+ const dataEnd = range2.end.row - (table3.totalsRow ? 1 : 0);
6490
+ const totalsRow = table3.totalsRow ? range2.end.row : -1;
6491
6491
  const columnOf = (name) => {
6492
6492
  const lower3 = name.toLowerCase();
6493
- const index2 = table2.columns.findIndex((c) => c.name.toLowerCase() === lower3);
6493
+ const index2 = table3.columns.findIndex((c) => c.name.toLowerCase() === lower3);
6494
6494
  return index2 < 0 ? -1 : range2.start.col + index2;
6495
6495
  };
6496
6496
  let c1 = range2.start.col;
@@ -7758,16 +7758,16 @@ function lookupArray(value2) {
7758
7758
  }
7759
7759
  function vhlookup(args, ctx, vertical2) {
7760
7760
  const lookup2 = blankAsZero(args);
7761
- const table2 = lookupArray(args[1] ?? null);
7761
+ const table3 = lookupArray(args[1] ?? null);
7762
7762
  const index2 = int(args[2]);
7763
7763
  const approximate2 = args.length < 4 ? true : bool(args[3]);
7764
- const { rows: rows2, cols } = shape(table2);
7764
+ const { rows: rows2, cols } = shape(table3);
7765
7765
  if (index2 < 1) fail(ERR.VALUE);
7766
7766
  if (index2 > (vertical2 ? cols : rows2)) fail(ERR.REF);
7767
- const keys = line(ctx, table2, vertical2 ? "col" : "row", 0);
7767
+ const keys = line(ctx, table3, vertical2 ? "col" : "row", 0);
7768
7768
  const at = approximate2 ? findAscending(keys, lookup2) : findExact(keys, lookup2, true);
7769
7769
  if (at < 0) fail(ERR.NA);
7770
- return vertical2 ? cellOf(table2, at, index2 - 1) : cellOf(table2, index2 - 1, at);
7770
+ return vertical2 ? cellOf(table3, at, index2 - 1) : cellOf(table3, index2 - 1, at);
7771
7771
  }
7772
7772
  function match(args, ctx) {
7773
7773
  const lookup2 = blankAsZero(args);
@@ -9262,10 +9262,10 @@ var REGRESSION_FUNCTIONS = [
9262
9262
  const lay = logs(layout(ctx, args));
9263
9263
  const fit = fitLeastSquares(lay.x, lay.y, withConst(args, 2));
9264
9264
  const stats = !omitted(args, 3) && bool(args[3]);
9265
- const table2 = coefficientTable(fit, stats, Math.exp);
9266
- if (!stats) return table2;
9265
+ const table3 = coefficientTable(fit, stats, Math.exp);
9266
+ if (!stats) return table3;
9267
9267
  const plain3 = coefficientTable(fit, true, (v) => v).data;
9268
- return new Matrix([table2.data[0] ?? [], ...plain3.slice(1)]);
9268
+ return new Matrix([table3.data[0] ?? [], ...plain3.slice(1)]);
9269
9269
  },
9270
9270
  ARGS
9271
9271
  ),
@@ -11607,7 +11607,7 @@ var DEFAULT_XML_LIMITS = {
11607
11607
  maxNodes: 5e6
11608
11608
  };
11609
11609
  var MARKUP_RE = /<!--[\s\S]*?-->|<!\[CDATA\[[\s\S]*?\]\]>|<\?[\s\S]*?\?>|<(\/?)([^\s\/>]+)(?:\s+[^\s=\/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*\s*(\/?)>/g;
11610
- function checkXmlLimits(xml, label5, limits = {}) {
11610
+ function checkXmlLimits(xml, label2, limits = {}) {
11611
11611
  const maxDepth = limits.maxDepth ?? DEFAULT_XML_LIMITS.maxDepth;
11612
11612
  const maxNodes = limits.maxNodes ?? DEFAULT_XML_LIMITS.maxNodes;
11613
11613
  let depth = 0;
@@ -11620,16 +11620,16 @@ function checkXmlLimits(xml, label5, limits = {}) {
11620
11620
  continue;
11621
11621
  }
11622
11622
  nodes++;
11623
- if (nodes > maxNodes) throw new Error(`${label5} XML exceeds the limit of ${maxNodes} elements`);
11623
+ if (nodes > maxNodes) throw new Error(`${label2} XML exceeds the limit of ${maxNodes} elements`);
11624
11624
  if (!selfClosing && ++depth > maxDepth)
11625
- throw new Error(`${label5} XML exceeds the nesting depth limit of ${maxDepth}`);
11625
+ throw new Error(`${label2} XML exceeds the nesting depth limit of ${maxDepth}`);
11626
11626
  }
11627
11627
  }
11628
11628
  function parseXml(xml, options6 = {}) {
11629
- const label5 = options6.label ?? "OOXML";
11629
+ const label2 = options6.label ?? "OOXML";
11630
11630
  if (/<!DOCTYPE|<!ENTITY/i.test(xml))
11631
- throw new Error(`${label5} XML with DTD or entity declarations is not supported`);
11632
- checkXmlLimits(xml, label5, options6.limits);
11631
+ throw new Error(`${label2} XML with DTD or entity declarations is not supported`);
11632
+ checkXmlLimits(xml, label2, options6.limits);
11633
11633
  let parseError = "";
11634
11634
  let parsed;
11635
11635
  try {
@@ -11640,12 +11640,12 @@ function parseXml(xml, options6 = {}) {
11640
11640
  }).parseFromString(xml, "application/xml");
11641
11641
  } catch (error) {
11642
11642
  throw new Error(
11643
- `Invalid ${label5} XML: ${error instanceof Error ? error.message : String(error)}`,
11643
+ `Invalid ${label2} XML: ${error instanceof Error ? error.message : String(error)}`,
11644
11644
  { cause: error }
11645
11645
  );
11646
11646
  }
11647
11647
  if (parseError || !parsed.documentElement)
11648
- throw new Error(`Invalid ${label5} XML: ${parseError || "missing root element"}`);
11648
+ throw new Error(`Invalid ${label2} XML: ${parseError || "missing root element"}`);
11649
11649
  return parsed;
11650
11650
  }
11651
11651
  var buildXml = (node2) => new XMLSerializer().serializeToString(node2);
@@ -11664,11 +11664,514 @@ var pivotRowFields = (pivot) => [
11664
11664
  ...pivot.secondRowField ? [pivot.secondRowField] : [],
11665
11665
  ...pivot.secondRowField ? pivot.moreRowFields ?? [] : []
11666
11666
  ];
11667
+ function pivotValuesIndex(pivot) {
11668
+ if (pivot.valuesAxis !== "rows") return -1;
11669
+ const count2 = pivotRowFields(pivot).length;
11670
+ const at = pivot.valuesPosition;
11671
+ if (typeof at === "number") return Math.min(Math.max(Math.trunc(at), 0), count2);
11672
+ return at === "first" ? 0 : at === "between" ? Math.min(1, count2) : count2;
11673
+ }
11667
11674
  var pivotColumnFields = (pivot) => [
11668
11675
  ...pivot.columnField ? [pivot.columnField] : [],
11669
11676
  ...pivot.columnField ? pivot.moreColumnFields ?? [] : []
11670
11677
  ];
11671
11678
 
11679
+ // i18n/locale.ts
11680
+ var SUPPORTED_OFFICE_LOCALES = ["en", "fr", "de", "es", "zh-CN"];
11681
+ var DEFAULT_REJECTED_SUBTAGS = ["hant", "tw", "hk", "mo"];
11682
+ function normalizeLocale(input, supported, fallback, options6 = {}) {
11683
+ const parts = (input ?? "").trim().toLowerCase().split(/[-_]/).filter(Boolean);
11684
+ const language = parts[0];
11685
+ if (!language) return fallback;
11686
+ const find3 = (tag) => supported.find((item) => item.toLowerCase() === tag);
11687
+ const exact = find3(parts.join("-"));
11688
+ if (exact) return exact;
11689
+ const base = find3(language);
11690
+ if (base) return base;
11691
+ const rejected = options6.rejectedSubtags ?? DEFAULT_REJECTED_SUBTAGS;
11692
+ if (parts.slice(1).some((part) => rejected.includes(part))) return fallback;
11693
+ return supported.find((item) => item.toLowerCase().split("-")[0] === language && item.includes("-")) ?? fallback;
11694
+ }
11695
+ function normalizeOfficeLocale(input) {
11696
+ return normalizeLocale(input, SUPPORTED_OFFICE_LOCALES, "en");
11697
+ }
11698
+
11699
+ // i18n/dictionary.ts
11700
+ function mergeMessageModules(modules) {
11701
+ const merged = {};
11702
+ for (const path of Object.keys(modules).sort()) {
11703
+ const module = modules[path];
11704
+ if (!module) continue;
11705
+ for (const value2 of Object.values(module)) {
11706
+ if (!value2 || typeof value2 !== "object" || Array.isArray(value2)) continue;
11707
+ const entries = Object.entries(value2);
11708
+ if (!entries.every(([, text2]) => typeof text2 === "string")) continue;
11709
+ for (const [key, text2] of entries) merged[key] = text2;
11710
+ }
11711
+ }
11712
+ return merged;
11713
+ }
11714
+
11715
+ // i18n/translator.ts
11716
+ var SINGLE2 = /\{(\w+)\}/g;
11717
+ var DOUBLE = /\{\{\s*(\w+)\s*\}\}/g;
11718
+ function interpolate(template, params, placeholder = "single") {
11719
+ if (!params) return template;
11720
+ const pattern = placeholder === "double" ? DOUBLE : SINGLE2;
11721
+ return template.replace(
11722
+ pattern,
11723
+ (match2, name) => Object.prototype.hasOwnProperty.call(params, name) && params[name] !== void 0 ? String(params[name]) : match2
11724
+ );
11725
+ }
11726
+ function createTranslator(messages, fallbacks = [], options6 = {}) {
11727
+ const placeholder = options6.placeholder ?? "single";
11728
+ return (key, params) => {
11729
+ let text2 = messages?.[key];
11730
+ for (let i2 = 0; text2 === void 0 && i2 < fallbacks.length; i2++) text2 = fallbacks[i2]?.[key];
11731
+ return interpolate(text2 ?? options6.missing?.(key) ?? key, params, placeholder);
11732
+ };
11733
+ }
11734
+
11735
+ // i18n/option-strings.ts
11736
+ var enOptionStrings = {
11737
+ General: "General",
11738
+ Display: "Display",
11739
+ Formulas: "Formulas",
11740
+ Data: "Data",
11741
+ Proofing: "Proofing",
11742
+ Save: "Save",
11743
+ Language: "Language",
11744
+ Accessibility: "Accessibility",
11745
+ Advanced: "Advanced",
11746
+ "Customize Ribbon": "Customize Ribbon",
11747
+ "Quick Access Toolbar": "Quick Access Toolbar",
11748
+ "Add-ins": "Add-ins",
11749
+ "Trust Center": "Trust Center",
11750
+ OK: "OK",
11751
+ Cancel: "Cancel",
11752
+ Close: "Close",
11753
+ Categories: "Categories",
11754
+ "Reset all options": "Reset all options",
11755
+ "General options for working with {product}.": "General options for working with {product}.",
11756
+ "Change how {product} corrects and formats your text.": "Change how {product} corrects and formats your text.",
11757
+ "Customize how documents are saved.": "Customize how documents are saved.",
11758
+ "Set the Office Language Preferences.": "Set the Office Language Preferences.",
11759
+ "Make {product} easier to work with.": "Make {product} easier to work with.",
11760
+ "Advanced options for working with {product}.": "Advanced options for working with {product}.",
11761
+ "Customize the Ribbon and keyboard shortcuts.": "Customize the Ribbon and keyboard shortcuts.",
11762
+ "Customize the Quick Access Toolbar.": "Customize the Quick Access Toolbar.",
11763
+ "View and manage Microsoft Office Add-ins.": "View and manage Microsoft Office Add-ins.",
11764
+ "Help keep your documents safe and your computer secure and healthy.": "Help keep your documents safe and your computer secure and healthy.",
11765
+ "User Interface options": "User Interface options",
11766
+ "Show Mini Toolbar on selection": "Show Mini Toolbar on selection",
11767
+ "Enable Live Preview": "Enable Live Preview",
11768
+ "ScreenTip style": "ScreenTip style",
11769
+ "Show feature descriptions in ScreenTips": "Show feature descriptions in ScreenTips",
11770
+ "Personalize your copy of Microsoft Office": "Personalize your copy of Microsoft Office",
11771
+ "User name": "User name",
11772
+ "Office Theme": "Office Theme",
11773
+ "Office display language": "Office display language",
11774
+ "Choose the language for menus, buttons and messages.": "Choose the language for menus, buttons and messages.",
11775
+ "Not available yet. Needs rich text formatting.": "Not available yet. Needs rich text formatting.",
11776
+ "Not available yet. Styles are applied on click; hover previews are not drawn yet.": "Not available yet. Styles are applied on click; hover previews are not drawn yet.",
11777
+ "Not available yet. ScreenTips always describe the command.": "Not available yet. ScreenTips always describe the command.",
11778
+ "Not available yet. Documents are saved to this device; AutoRecover is not kept.": "Not available yet. Documents are saved to this device; AutoRecover is not kept.",
11779
+ "Not available yet. There are no accessibility settings to change.": "Not available yet. There are no accessibility settings to change.",
11780
+ "Not available yet. The editing behaviour is fixed.": "Not available yet. The editing behaviour is fixed.",
11781
+ "Not available yet. The Quick Access Toolbar is fixed.": "Not available yet. The Quick Access Toolbar is fixed.",
11782
+ "Not available yet. The ribbon layout is fixed.": "Not available yet. The ribbon layout is fixed.",
11783
+ "Not available yet. The display language is fixed.": "Not available yet. The display language is fixed.",
11784
+ "Not available. Add-ins and macros are never run.": "Not available. Add-ins and macros are never run.",
11785
+ "Not available. Documents stay local and active content is never run.": "Not available. Documents stay local and active content is never run."
11786
+ };
11787
+ var frOptionStrings = {
11788
+ General: "G\xE9n\xE9ral",
11789
+ Display: "Affichage",
11790
+ Formulas: "Formules",
11791
+ Data: "Donn\xE9es",
11792
+ Proofing: "V\xE9rification",
11793
+ Save: "Enregistrer",
11794
+ Language: "Langue",
11795
+ Accessibility: "Accessibilit\xE9",
11796
+ Advanced: "Options avanc\xE9es",
11797
+ "Customize Ribbon": "Personnaliser le ruban",
11798
+ "Quick Access Toolbar": "Barre d\u2019outils Acc\xE8s rapide",
11799
+ "Add-ins": "Compl\xE9ments",
11800
+ "Trust Center": "Centre de gestion de la confidentialit\xE9",
11801
+ OK: "OK",
11802
+ Cancel: "Annuler",
11803
+ Close: "Fermer",
11804
+ Categories: "Cat\xE9gories",
11805
+ "Reset all options": "R\xE9initialiser toutes les options",
11806
+ "General options for working with {product}.": "Options g\xE9n\xE9rales pour l\u2019utilisation de {product}.",
11807
+ "Change how {product} corrects and formats your text.": "Modifiez la fa\xE7on dont {product} corrige et met en forme votre texte.",
11808
+ "Customize how documents are saved.": "Personnalisez l\u2019enregistrement des documents.",
11809
+ "Set the Office Language Preferences.": "D\xE9finissez les pr\xE9f\xE9rences de langue d\u2019Office.",
11810
+ "Make {product} easier to work with.": "Facilitez l\u2019utilisation de {product}.",
11811
+ "Advanced options for working with {product}.": "Options avanc\xE9es pour l\u2019utilisation de {product}.",
11812
+ "Customize the Ribbon and keyboard shortcuts.": "Personnalisez le ruban et les raccourcis clavier.",
11813
+ "Customize the Quick Access Toolbar.": "Personnalisez la barre d\u2019outils Acc\xE8s rapide.",
11814
+ "View and manage Microsoft Office Add-ins.": "Affichez et g\xE9rez les compl\xE9ments Microsoft Office.",
11815
+ "Help keep your documents safe and your computer secure and healthy.": "Prot\xE9gez vos documents et assurez la s\xE9curit\xE9 et le bon \xE9tat de votre ordinateur.",
11816
+ "User Interface options": "Options de l\u2019interface utilisateur",
11817
+ "Show Mini Toolbar on selection": "Afficher la mini barre d\u2019outils lors de la s\xE9lection",
11818
+ "Enable Live Preview": "Activer l\u2019aper\xE7u dynamique",
11819
+ "ScreenTip style": "Style des info-bulles",
11820
+ "Show feature descriptions in ScreenTips": "Afficher les descriptions des fonctionnalit\xE9s dans les info-bulles",
11821
+ "Personalize your copy of Microsoft Office": "Personnalisez votre copie de Microsoft Office",
11822
+ "User name": "Nom d\u2019utilisateur",
11823
+ "Office Theme": "Th\xE8me Office",
11824
+ "Office display language": "Langue d\u2019affichage d\u2019Office",
11825
+ "Choose the language for menus, buttons and messages.": "Choisissez la langue des menus, des boutons et des messages.",
11826
+ "Not available yet. Needs rich text formatting.": "Pas encore disponible. N\xE9cessite la mise en forme de texte enrichi.",
11827
+ "Not available yet. Styles are applied on click; hover previews are not drawn yet.": "Pas encore disponible. Les styles s\u2019appliquent au clic ; les aper\xE7us au survol ne sont pas encore dessin\xE9s.",
11828
+ "Not available yet. ScreenTips always describe the command.": "Pas encore disponible. Les info-bulles d\xE9crivent toujours la commande.",
11829
+ "Not available yet. Documents are saved to this device; AutoRecover is not kept.": "Pas encore disponible. Les documents sont enregistr\xE9s sur cet appareil ; la r\xE9cup\xE9ration automatique n\u2019est pas conserv\xE9e.",
11830
+ "Not available yet. There are no accessibility settings to change.": "Pas encore disponible. Aucun param\xE8tre d\u2019accessibilit\xE9 n\u2019est modifiable.",
11831
+ "Not available yet. The editing behaviour is fixed.": "Pas encore disponible. Le comportement de modification est fixe.",
11832
+ "Not available yet. The Quick Access Toolbar is fixed.": "Pas encore disponible. La barre d\u2019outils Acc\xE8s rapide est fixe.",
11833
+ "Not available yet. The ribbon layout is fixed.": "Pas encore disponible. La disposition du ruban est fixe.",
11834
+ "Not available yet. The display language is fixed.": "Pas encore disponible. La langue d\u2019affichage est fixe.",
11835
+ "Not available. Add-ins and macros are never run.": "Non disponible. Les compl\xE9ments et les macros ne sont jamais ex\xE9cut\xE9s.",
11836
+ "Not available. Documents stay local and active content is never run.": "Non disponible. Les documents restent locaux et le contenu actif n\u2019est jamais ex\xE9cut\xE9."
11837
+ };
11838
+ var deOptionStrings = {
11839
+ General: "Allgemein",
11840
+ Display: "Anzeige",
11841
+ Formulas: "Formeln",
11842
+ Data: "Daten",
11843
+ Proofing: "Dokumentpr\xFCfung",
11844
+ Save: "Speichern",
11845
+ Language: "Sprache",
11846
+ Accessibility: "Barrierefreiheit",
11847
+ Advanced: "Erweitert",
11848
+ "Customize Ribbon": "Men\xFCband anpassen",
11849
+ "Quick Access Toolbar": "Symbolleiste f\xFCr den Schnellzugriff",
11850
+ "Add-ins": "Add-Ins",
11851
+ "Trust Center": "Trust Center",
11852
+ OK: "OK",
11853
+ Cancel: "Abbrechen",
11854
+ Close: "Schlie\xDFen",
11855
+ Categories: "Kategorien",
11856
+ "Reset all options": "Alle Optionen zur\xFCcksetzen",
11857
+ "General options for working with {product}.": "Allgemeine Optionen f\xFCr die Arbeit mit {product}.",
11858
+ "Change how {product} corrects and formats your text.": "\xC4ndern Sie, wie {product} Ihren Text korrigiert und formatiert.",
11859
+ "Customize how documents are saved.": "Passen Sie an, wie Dokumente gespeichert werden.",
11860
+ "Set the Office Language Preferences.": "Legen Sie die Office-Spracheinstellungen fest.",
11861
+ "Make {product} easier to work with.": "Machen Sie {product} einfacher bedienbar.",
11862
+ "Advanced options for working with {product}.": "Erweiterte Optionen f\xFCr die Arbeit mit {product}.",
11863
+ "Customize the Ribbon and keyboard shortcuts.": "Passen Sie das Men\xFCband und die Tastenkombinationen an.",
11864
+ "Customize the Quick Access Toolbar.": "Passen Sie die Symbolleiste f\xFCr den Schnellzugriff an.",
11865
+ "View and manage Microsoft Office Add-ins.": "Microsoft Office-Add-Ins anzeigen und verwalten.",
11866
+ "Help keep your documents safe and your computer secure and healthy.": "Sch\xFCtzen Sie Ihre Dokumente und halten Sie Ihren Computer sicher und fehlerfrei.",
11867
+ "User Interface options": "Benutzeroberfl\xE4chenoptionen",
11868
+ "Show Mini Toolbar on selection": "Minisymbolleiste bei Auswahl anzeigen",
11869
+ "Enable Live Preview": "Livevorschau aktivieren",
11870
+ "ScreenTip style": "QuickInfo-Format",
11871
+ "Show feature descriptions in ScreenTips": "Funktionsbeschreibungen in QuickInfos anzeigen",
11872
+ "Personalize your copy of Microsoft Office": "Microsoft Office personalisieren",
11873
+ "User name": "Benutzername",
11874
+ "Office Theme": "Office-Design",
11875
+ "Office display language": "Office-Anzeigesprache",
11876
+ "Choose the language for menus, buttons and messages.": "W\xE4hlen Sie die Sprache f\xFCr Men\xFCs, Schaltfl\xE4chen und Meldungen.",
11877
+ "Not available yet. Needs rich text formatting.": "Noch nicht verf\xFCgbar. Erfordert Formatierung von Rich-Text.",
11878
+ "Not available yet. Styles are applied on click; hover previews are not drawn yet.": "Noch nicht verf\xFCgbar. Formatvorlagen werden per Klick angewendet; Vorschauen beim Dar\xFCberfahren werden noch nicht gezeichnet.",
11879
+ "Not available yet. ScreenTips always describe the command.": "Noch nicht verf\xFCgbar. QuickInfos beschreiben immer den Befehl.",
11880
+ "Not available yet. Documents are saved to this device; AutoRecover is not kept.": "Noch nicht verf\xFCgbar. Dokumente werden auf diesem Ger\xE4t gespeichert; AutoWiederherstellen wird nicht gef\xFChrt.",
11881
+ "Not available yet. There are no accessibility settings to change.": "Noch nicht verf\xFCgbar. Es gibt keine Einstellungen zur Barrierefreiheit zu \xE4ndern.",
11882
+ "Not available yet. The editing behaviour is fixed.": "Noch nicht verf\xFCgbar. Das Bearbeitungsverhalten ist festgelegt.",
11883
+ "Not available yet. The Quick Access Toolbar is fixed.": "Noch nicht verf\xFCgbar. Die Symbolleiste f\xFCr den Schnellzugriff ist festgelegt.",
11884
+ "Not available yet. The ribbon layout is fixed.": "Noch nicht verf\xFCgbar. Das Men\xFCband-Layout ist festgelegt.",
11885
+ "Not available yet. The display language is fixed.": "Noch nicht verf\xFCgbar. Die Anzeigesprache ist festgelegt.",
11886
+ "Not available. Add-ins and macros are never run.": "Nicht verf\xFCgbar. Add-Ins und Makros werden nie ausgef\xFChrt.",
11887
+ "Not available. Documents stay local and active content is never run.": "Nicht verf\xFCgbar. Dokumente bleiben lokal und aktive Inhalte werden nie ausgef\xFChrt."
11888
+ };
11889
+ var esOptionStrings = {
11890
+ General: "General",
11891
+ Display: "Mostrar",
11892
+ Formulas: "F\xF3rmulas",
11893
+ Data: "Datos",
11894
+ Proofing: "Revisi\xF3n",
11895
+ Save: "Guardar",
11896
+ Language: "Idioma",
11897
+ Accessibility: "Accesibilidad",
11898
+ Advanced: "Avanzadas",
11899
+ "Customize Ribbon": "Personalizar cinta de opciones",
11900
+ "Quick Access Toolbar": "Barra de herramientas de acceso r\xE1pido",
11901
+ "Add-ins": "Complementos",
11902
+ "Trust Center": "Centro de confianza",
11903
+ OK: "Aceptar",
11904
+ Cancel: "Cancelar",
11905
+ Close: "Cerrar",
11906
+ Categories: "Categor\xEDas",
11907
+ "Reset all options": "Restablecer todas las opciones",
11908
+ "General options for working with {product}.": "Opciones generales para trabajar con {product}.",
11909
+ "Change how {product} corrects and formats your text.": "Cambie la forma en que {product} corrige y da formato al texto.",
11910
+ "Customize how documents are saved.": "Personalice c\xF3mo se guardan los documentos.",
11911
+ "Set the Office Language Preferences.": "Establezca las preferencias de idioma de Office.",
11912
+ "Make {product} easier to work with.": "Haga que {product} sea m\xE1s f\xE1cil de usar.",
11913
+ "Advanced options for working with {product}.": "Opciones avanzadas para trabajar con {product}.",
11914
+ "Customize the Ribbon and keyboard shortcuts.": "Personalice la cinta de opciones y los m\xE9todos abreviados de teclado.",
11915
+ "Customize the Quick Access Toolbar.": "Personalice la barra de herramientas de acceso r\xE1pido.",
11916
+ "View and manage Microsoft Office Add-ins.": "Vea y administre los complementos de Microsoft Office.",
11917
+ "Help keep your documents safe and your computer secure and healthy.": "Ayude a mantener seguros sus documentos y a proteger y mantener en buen estado su equipo.",
11918
+ "User Interface options": "Opciones de la interfaz de usuario",
11919
+ "Show Mini Toolbar on selection": "Mostrar minibarra de herramientas al seleccionar",
11920
+ "Enable Live Preview": "Habilitar vistas previas din\xE1micas",
11921
+ "ScreenTip style": "Estilo de la informaci\xF3n en pantalla",
11922
+ "Show feature descriptions in ScreenTips": "Mostrar descripciones de caracter\xEDsticas en la informaci\xF3n en pantalla",
11923
+ "Personalize your copy of Microsoft Office": "Personalice su copia de Microsoft Office",
11924
+ "User name": "Nombre de usuario",
11925
+ "Office Theme": "Tema de Office",
11926
+ "Office display language": "Idioma de presentaci\xF3n de Office",
11927
+ "Choose the language for menus, buttons and messages.": "Elija el idioma de los men\xFAs, los botones y los mensajes.",
11928
+ "Not available yet. Needs rich text formatting.": "A\xFAn no disponible. Requiere formato de texto enriquecido.",
11929
+ "Not available yet. Styles are applied on click; hover previews are not drawn yet.": "A\xFAn no disponible. Los estilos se aplican al hacer clic; las vistas previas al pasar el cursor todav\xEDa no se dibujan.",
11930
+ "Not available yet. ScreenTips always describe the command.": "A\xFAn no disponible. La informaci\xF3n en pantalla siempre describe el comando.",
11931
+ "Not available yet. Documents are saved to this device; AutoRecover is not kept.": "A\xFAn no disponible. Los documentos se guardan en este dispositivo; no se conserva la recuperaci\xF3n autom\xE1tica.",
11932
+ "Not available yet. There are no accessibility settings to change.": "A\xFAn no disponible. No hay opciones de accesibilidad que cambiar.",
11933
+ "Not available yet. The editing behaviour is fixed.": "A\xFAn no disponible. El comportamiento de edici\xF3n es fijo.",
11934
+ "Not available yet. The Quick Access Toolbar is fixed.": "A\xFAn no disponible. La barra de herramientas de acceso r\xE1pido es fija.",
11935
+ "Not available yet. The ribbon layout is fixed.": "A\xFAn no disponible. El dise\xF1o de la cinta de opciones es fijo.",
11936
+ "Not available yet. The display language is fixed.": "A\xFAn no disponible. El idioma de presentaci\xF3n es fijo.",
11937
+ "Not available. Add-ins and macros are never run.": "No disponible. Los complementos y las macros nunca se ejecutan.",
11938
+ "Not available. Documents stay local and active content is never run.": "No disponible. Los documentos permanecen locales y el contenido activo nunca se ejecuta."
11939
+ };
11940
+ var zhOptionStrings = {
11941
+ General: "\u5E38\u89C4",
11942
+ Display: "\u663E\u793A",
11943
+ Formulas: "\u516C\u5F0F",
11944
+ Data: "\u6570\u636E",
11945
+ Proofing: "\u6821\u5BF9",
11946
+ Save: "\u4FDD\u5B58",
11947
+ Language: "\u8BED\u8A00",
11948
+ Accessibility: "\u8F85\u52A9\u529F\u80FD",
11949
+ Advanced: "\u9AD8\u7EA7",
11950
+ "Customize Ribbon": "\u81EA\u5B9A\u4E49\u529F\u80FD\u533A",
11951
+ "Quick Access Toolbar": "\u5FEB\u901F\u8BBF\u95EE\u5DE5\u5177\u680F",
11952
+ "Add-ins": "\u52A0\u8F7D\u9879",
11953
+ "Trust Center": "\u4FE1\u4EFB\u4E2D\u5FC3",
11954
+ OK: "\u786E\u5B9A",
11955
+ Cancel: "\u53D6\u6D88",
11956
+ Close: "\u5173\u95ED",
11957
+ Categories: "\u7C7B\u522B",
11958
+ "Reset all options": "\u91CD\u7F6E\u6240\u6709\u9009\u9879",
11959
+ "General options for working with {product}.": "\u4F7F\u7528 {product} \u7684\u5E38\u89C4\u9009\u9879\u3002",
11960
+ "Change how {product} corrects and formats your text.": "\u66F4\u6539 {product} \u66F4\u6B63\u548C\u8BBE\u7F6E\u6587\u672C\u683C\u5F0F\u7684\u65B9\u5F0F\u3002",
11961
+ "Customize how documents are saved.": "\u81EA\u5B9A\u4E49\u4FDD\u5B58\u6587\u6863\u7684\u65B9\u5F0F\u3002",
11962
+ "Set the Office Language Preferences.": "\u8BBE\u7F6E Office \u8BED\u8A00\u9996\u9009\u9879\u3002",
11963
+ "Make {product} easier to work with.": "\u8BA9 {product} \u66F4\u6613\u4E8E\u4F7F\u7528\u3002",
11964
+ "Advanced options for working with {product}.": "\u4F7F\u7528 {product} \u7684\u9AD8\u7EA7\u9009\u9879\u3002",
11965
+ "Customize the Ribbon and keyboard shortcuts.": "\u81EA\u5B9A\u4E49\u529F\u80FD\u533A\u548C\u952E\u76D8\u5FEB\u6377\u65B9\u5F0F\u3002",
11966
+ "Customize the Quick Access Toolbar.": "\u81EA\u5B9A\u4E49\u5FEB\u901F\u8BBF\u95EE\u5DE5\u5177\u680F\u3002",
11967
+ "View and manage Microsoft Office Add-ins.": "\u67E5\u770B\u548C\u7BA1\u7406 Microsoft Office \u52A0\u8F7D\u9879\u3002",
11968
+ "Help keep your documents safe and your computer secure and healthy.": "\u5E2E\u52A9\u4FDD\u969C\u6587\u6863\u5B89\u5168\uFF0C\u5E76\u4F7F\u8BA1\u7B97\u673A\u4FDD\u6301\u5B89\u5168\u548C\u5065\u5EB7\u3002",
11969
+ "User Interface options": "\u7528\u6237\u754C\u9762\u9009\u9879",
11970
+ "Show Mini Toolbar on selection": "\u9009\u62E9\u65F6\u663E\u793A\u6D6E\u52A8\u5DE5\u5177\u680F",
11971
+ "Enable Live Preview": "\u542F\u7528\u5B9E\u65F6\u9884\u89C8",
11972
+ "ScreenTip style": "\u5C4F\u5E55\u63D0\u793A\u6837\u5F0F",
11973
+ "Show feature descriptions in ScreenTips": "\u5728\u5C4F\u5E55\u63D0\u793A\u4E2D\u663E\u793A\u529F\u80FD\u8BF4\u660E",
11974
+ "Personalize your copy of Microsoft Office": "\u5BF9 Microsoft Office \u8FDB\u884C\u4E2A\u6027\u5316\u8BBE\u7F6E",
11975
+ "User name": "\u7528\u6237\u540D",
11976
+ "Office Theme": "Office \u4E3B\u9898",
11977
+ "Office display language": "Office \u663E\u793A\u8BED\u8A00",
11978
+ "Choose the language for menus, buttons and messages.": "\u9009\u62E9\u83DC\u5355\u3001\u6309\u94AE\u548C\u6D88\u606F\u4F7F\u7528\u7684\u8BED\u8A00\u3002",
11979
+ "Not available yet. Needs rich text formatting.": "\u6682\u4E0D\u53EF\u7528\u3002\u9700\u8981\u5BCC\u6587\u672C\u683C\u5F0F\u3002",
11980
+ "Not available yet. Styles are applied on click; hover previews are not drawn yet.": "\u6682\u4E0D\u53EF\u7528\u3002\u6837\u5F0F\u5728\u5355\u51FB\u65F6\u5E94\u7528\uFF1B\u5C1A\u4E0D\u7ED8\u5236\u60AC\u505C\u9884\u89C8\u3002",
11981
+ "Not available yet. ScreenTips always describe the command.": "\u6682\u4E0D\u53EF\u7528\u3002\u5C4F\u5E55\u63D0\u793A\u59CB\u7EC8\u63CF\u8FF0\u8BE5\u547D\u4EE4\u3002",
11982
+ "Not available yet. Documents are saved to this device; AutoRecover is not kept.": "\u6682\u4E0D\u53EF\u7528\u3002\u6587\u6863\u4FDD\u5B58\u5230\u6B64\u8BBE\u5907\uFF1B\u4E0D\u4FDD\u7559\u81EA\u52A8\u6062\u590D\u3002",
11983
+ "Not available yet. There are no accessibility settings to change.": "\u6682\u4E0D\u53EF\u7528\u3002\u6CA1\u6709\u53EF\u66F4\u6539\u7684\u8F85\u52A9\u529F\u80FD\u8BBE\u7F6E\u3002",
11984
+ "Not available yet. The editing behaviour is fixed.": "\u6682\u4E0D\u53EF\u7528\u3002\u7F16\u8F91\u884C\u4E3A\u662F\u56FA\u5B9A\u7684\u3002",
11985
+ "Not available yet. The Quick Access Toolbar is fixed.": "\u6682\u4E0D\u53EF\u7528\u3002\u5FEB\u901F\u8BBF\u95EE\u5DE5\u5177\u680F\u662F\u56FA\u5B9A\u7684\u3002",
11986
+ "Not available yet. The ribbon layout is fixed.": "\u6682\u4E0D\u53EF\u7528\u3002\u529F\u80FD\u533A\u5E03\u5C40\u662F\u56FA\u5B9A\u7684\u3002",
11987
+ "Not available yet. The display language is fixed.": "\u6682\u4E0D\u53EF\u7528\u3002\u663E\u793A\u8BED\u8A00\u662F\u56FA\u5B9A\u7684\u3002",
11988
+ "Not available. Add-ins and macros are never run.": "\u4E0D\u53EF\u7528\u3002\u52A0\u8F7D\u9879\u548C\u5B8F\u6C38\u8FDC\u4E0D\u4F1A\u8FD0\u884C\u3002",
11989
+ "Not available. Documents stay local and active content is never run.": "\u4E0D\u53EF\u7528\u3002\u6587\u6863\u4FDD\u7559\u5728\u672C\u5730\uFF0C\u6D3B\u52A8\u5185\u5BB9\u6C38\u8FDC\u4E0D\u4F1A\u8FD0\u884C\u3002"
11990
+ };
11991
+ var optionStrings = {
11992
+ en: enOptionStrings,
11993
+ fr: frOptionStrings,
11994
+ de: deOptionStrings,
11995
+ es: esOptionStrings,
11996
+ "zh-CN": zhOptionStrings
11997
+ };
11998
+
11999
+ // xlsx/pivot/captions-locales.ts
12000
+ var table2 = (words2, prefix, rest, functions) => ({
12001
+ ...rest,
12002
+ functions,
12003
+ aggregates: Object.fromEntries(
12004
+ Object.keys(words2).map((fn) => [fn, prefix(words2[fn])])
12005
+ )
12006
+ });
12007
+ var GERMAN = {
12008
+ sum: "Summe",
12009
+ count: "Anzahl",
12010
+ average: "Mittelwert",
12011
+ max: "Max",
12012
+ min: "Min",
12013
+ product: "Produkt",
12014
+ countNums: "Anzahl (Zahlen)",
12015
+ stdDev: "Standardabweichung",
12016
+ stdDevp: "Standardabweichung (Grundgesamtheit)",
12017
+ var: "Varianz",
12018
+ varp: "Varianz (Grundgesamtheit)"
12019
+ };
12020
+ var SPANISH = {
12021
+ sum: "Suma",
12022
+ count: "Cuenta",
12023
+ average: "Promedio",
12024
+ max: "M\xE1x",
12025
+ min: "M\xEDn",
12026
+ product: "Producto",
12027
+ countNums: "Cuenta de n\xFAmeros",
12028
+ stdDev: "Desvest",
12029
+ stdDevp: "Desvestp",
12030
+ var: "Var",
12031
+ varp: "Varp"
12032
+ };
12033
+ var FRENCH = {
12034
+ sum: "Somme",
12035
+ count: "Nombre",
12036
+ average: "Moyenne",
12037
+ max: "Max",
12038
+ min: "Min",
12039
+ product: "Produit",
12040
+ countNums: "Nombre (nombres)",
12041
+ stdDev: "\xC9cartype",
12042
+ stdDevp: "\xC9cartypep",
12043
+ var: "Var",
12044
+ varp: "Varp"
12045
+ };
12046
+ var CHINESE = {
12047
+ sum: "\u6C42\u548C",
12048
+ count: "\u8BA1\u6570",
12049
+ average: "\u5E73\u5747\u503C",
12050
+ max: "\u6700\u5927\u503C",
12051
+ min: "\u6700\u5C0F\u503C",
12052
+ product: "\u4E58\u79EF",
12053
+ countNums: "\u6570\u503C\u8BA1\u6570",
12054
+ stdDev: "\u6807\u51C6\u504F\u5DEE",
12055
+ stdDevp: "\u603B\u4F53\u6807\u51C6\u504F\u5DEE",
12056
+ var: "\u65B9\u5DEE",
12057
+ varp: "\u603B\u4F53\u65B9\u5DEE"
12058
+ };
12059
+ var LOCALIZED_PIVOT_CAPTIONS = {
12060
+ de: table2(
12061
+ GERMAN,
12062
+ (word) => `${word} von {0}`,
12063
+ {
12064
+ rowLabels: "Zeilenbeschriftungen",
12065
+ columnLabels: "Spaltenbeschriftungen",
12066
+ grandTotal: "Gesamtergebnis",
12067
+ values: "Werte",
12068
+ all: "(Alle)",
12069
+ blank: "(leer)",
12070
+ subtotal: "{0} Ergebnis",
12071
+ measureTotal: "Gesamt {0}"
12072
+ },
12073
+ GERMAN
12074
+ ),
12075
+ es: table2(
12076
+ SPANISH,
12077
+ (word) => `${word} de {0}`,
12078
+ {
12079
+ rowLabels: "Etiquetas de fila",
12080
+ columnLabels: "Etiquetas de columna",
12081
+ grandTotal: "Total general",
12082
+ values: "Valores",
12083
+ all: "(Todas)",
12084
+ blank: "(en blanco)",
12085
+ subtotal: "{0} Total",
12086
+ measureTotal: "Total {0}"
12087
+ },
12088
+ SPANISH
12089
+ ),
12090
+ fr: table2(
12091
+ FRENCH,
12092
+ (word) => `${word} de {0}`,
12093
+ {
12094
+ rowLabels: "\xC9tiquettes de lignes",
12095
+ columnLabels: "\xC9tiquettes de colonnes",
12096
+ grandTotal: "Total g\xE9n\xE9ral",
12097
+ values: "Valeurs",
12098
+ all: "(Tous)",
12099
+ blank: "(vide)",
12100
+ subtotal: "{0} Total",
12101
+ measureTotal: "Total {0}"
12102
+ },
12103
+ FRENCH
12104
+ ),
12105
+ "zh-CN": table2(
12106
+ CHINESE,
12107
+ (word) => `${word}\u9879:{0}`,
12108
+ {
12109
+ rowLabels: "\u884C\u6807\u7B7E",
12110
+ columnLabels: "\u5217\u6807\u7B7E",
12111
+ grandTotal: "\u603B\u8BA1",
12112
+ values: "\u6570\u503C",
12113
+ all: "(\u5168\u90E8)",
12114
+ blank: "(\u7A7A\u767D)",
12115
+ subtotal: "{0} \u6C47\u603B",
12116
+ measureTotal: "\u603B\u8BA1 {0}"
12117
+ },
12118
+ CHINESE
12119
+ )
12120
+ };
12121
+
12122
+ // xlsx/pivot/captions.ts
12123
+ var FUNCTIONS = {
12124
+ sum: "Sum",
12125
+ count: "Count",
12126
+ average: "Average",
12127
+ max: "Max",
12128
+ min: "Min",
12129
+ product: "Product",
12130
+ countNums: "Count",
12131
+ stdDev: "StdDev",
12132
+ stdDevp: "StdDevp",
12133
+ var: "Var",
12134
+ varp: "Varp"
12135
+ };
12136
+ var aggregateNames = () => Object.fromEntries(
12137
+ Object.keys(FUNCTIONS).map((fn) => [
12138
+ fn,
12139
+ `${fn[0].toUpperCase()}${fn.slice(1)} of {0}`
12140
+ ])
12141
+ );
12142
+ var ENGLISH_PIVOT_CAPTIONS = {
12143
+ rowLabels: "Row Labels",
12144
+ columnLabels: "Column Labels",
12145
+ grandTotal: "Grand Total",
12146
+ values: "Values",
12147
+ all: "(All)",
12148
+ blank: "(blank)",
12149
+ subtotal: "{0} Total",
12150
+ measureTotal: "Total {0}",
12151
+ functions: FUNCTIONS,
12152
+ aggregates: aggregateNames()
12153
+ };
12154
+ var fillCaption = (template, ...args) => template.replace(/\{(\d)\}/g, (_match, at) => args[Number(at)] ?? "");
12155
+ function pivotCaptions(pivot) {
12156
+ const own = pivot.captions;
12157
+ if (!own) return ENGLISH_PIVOT_CAPTIONS;
12158
+ return {
12159
+ ...ENGLISH_PIVOT_CAPTIONS,
12160
+ ...Object.fromEntries(Object.entries(own).filter(([, value2]) => typeof value2 === "string")),
12161
+ functions: { ...ENGLISH_PIVOT_CAPTIONS.functions, ...own.functions },
12162
+ aggregates: { ...ENGLISH_PIVOT_CAPTIONS.aggregates, ...own.aggregates }
12163
+ };
12164
+ }
12165
+ var pivotMeasureName = (aggregate2, field, pivot = {}) => fillCaption(pivotCaptions(pivot).aggregates[aggregate2], field);
12166
+ function localizedPivotCaptions(locale) {
12167
+ const caps = LOCALIZED_PIVOT_CAPTIONS[normalizeOfficeLocale(locale)];
12168
+ return caps ? structuredClone(caps) : void 0;
12169
+ }
12170
+ function authoredCaptions(options6) {
12171
+ const own = options6.captions ?? localizedPivotCaptions(options6.locale);
12172
+ return own && Object.keys(own).length ? structuredClone(own) : void 0;
12173
+ }
12174
+
11672
12175
  // xlsx/pivot/date-groups.ts
11673
12176
  var PIVOT_DATE_UNITS = [
11674
12177
  "seconds",
@@ -11693,7 +12196,7 @@ var LEAP_MONTHS = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
11693
12196
  var MAX_ITEMS = 1e4;
11694
12197
  var pad3 = (value2, width = 2) => String(value2).padStart(width, "0");
11695
12198
  var dateGroupUnits = (group) => PIVOT_DATE_UNITS.filter((unit) => group.by.includes(unit));
11696
- var dateGroupFieldName = (unit, field) => `${UNIT_TITLES[unit]} (${field})`;
12199
+ var dateGroupFieldName = (unit, field, group) => group?.localized?.[unit]?.name ?? `${UNIT_TITLES[unit]} (${field})`;
11697
12200
  var dateGroupDays = (group) => group.by.length === 1 && group.by[0] === "days" ? group.days ?? 1 : 1;
11698
12201
  function dateGroupRange(group, serials) {
11699
12202
  let min = Infinity;
@@ -11716,7 +12219,7 @@ var secondsOfDay = (serial) => Math.round((serial - Math.floor(serial)) * 86400)
11716
12219
  function dayBuckets(range2, days) {
11717
12220
  return Math.max(1, Math.ceil((Math.floor(range2.end) - Math.floor(range2.start) + 1) / days));
11718
12221
  }
11719
- function dateUnitLabels(unit, range2, days, date1904) {
12222
+ function englishDateUnitLabels(unit, range2, days, date1904) {
11720
12223
  const labels = [`<${isoDay(range2.start, date1904)}`];
11721
12224
  if (unit === "seconds" || unit === "minutes")
11722
12225
  for (let i2 = 0; i2 < 60; i2++) labels.push(`:${pad3(i2)}`);
@@ -11745,6 +12248,11 @@ function dateUnitLabels(unit, range2, days, date1904) {
11745
12248
  labels.push(`>${isoDay(range2.end, date1904)}`);
11746
12249
  return labels;
11747
12250
  }
12251
+ function dateUnitLabels(unit, range2, days, date1904, group) {
12252
+ const english = englishDateUnitLabels(unit, range2, days, date1904);
12253
+ const localized = group?.localized?.[unit]?.labels;
12254
+ return localized?.length === english.length ? localized : english;
12255
+ }
11748
12256
  function dateUnitIndex(unit, range2, days, date1904, serial, count2) {
11749
12257
  if (serial < range2.start) return 0;
11750
12258
  if (serial > range2.end) return count2 - 1;
@@ -11768,7 +12276,7 @@ function derivedDateFields(pivot) {
11768
12276
  for (const group of pivot.dateGroups ?? [])
11769
12277
  for (const unit of dateGroupUnits(group))
11770
12278
  derived.push({
11771
- name: dateGroupFieldName(unit, group.field),
12279
+ name: dateGroupFieldName(unit, group.field, group),
11772
12280
  unit,
11773
12281
  group,
11774
12282
  index: databaseFields + derived.length
@@ -11779,7 +12287,7 @@ function countDerived(pivot) {
11779
12287
  let count2 = 0;
11780
12288
  for (const group of pivot.dateGroups ?? [])
11781
12289
  for (const unit of dateGroupUnits(group))
11782
- if (pivot.fields.includes(dateGroupFieldName(unit, group.field))) count2++;
12290
+ if (pivot.fields.includes(dateGroupFieldName(unit, group.field, group))) count2++;
11783
12291
  return count2;
11784
12292
  }
11785
12293
  var pivotAxisFieldNames = (pivot) => [
@@ -11799,7 +12307,7 @@ function derivedDateLabels(pivot, name) {
11799
12307
  if (!entry) return void 0;
11800
12308
  const [group] = resolveDateGroups({ ...pivot, dateGroups: [entry.group] });
11801
12309
  const range2 = { start: group.start, end: group.end };
11802
- return dateUnitLabels(entry.unit, range2, dateGroupDays(group), pivot.date1904 ?? false);
12310
+ return dateUnitLabels(entry.unit, range2, dateGroupDays(group), pivot.date1904 ?? false, group);
11803
12311
  }
11804
12312
  function validateDateGroups(pivot) {
11805
12313
  const groups = pivot.dateGroups;
@@ -11815,18 +12323,16 @@ function validateDateGroups(pivot) {
11815
12323
  seen.add(group.field);
11816
12324
  if (!(pivot.dateFields ?? []).includes(group.field))
11817
12325
  throw new Error("Only fields that contain dates can be grouped by date.");
11818
- if (pivot.pageFilter || pivot.dateFilter)
11819
- throw new Error("Date groups cannot be combined with report filters or timelines.");
11820
12326
  const serials = pivot.records.map((record) => record[index2]);
11821
12327
  if (!serials.length || serials.some((v) => typeof v !== "number" || !Number.isFinite(v)))
11822
12328
  throw new Error("Only fields that contain dates can be grouped by date.");
11823
12329
  const range2 = dateGroupRange(group, serials);
11824
12330
  if (range2.start >= range2.end) throw new Error("The date group must end after it starts.");
11825
12331
  for (const unit of dateGroupUnits(group)) {
11826
- const name = dateGroupFieldName(unit, group.field);
12332
+ const name = dateGroupFieldName(unit, group.field, group);
11827
12333
  if (pivot.fields.includes(name))
11828
12334
  throw new Error("A source field already has the name of a date group field.");
11829
- if (dateUnitLabels(unit, range2, dateGroupDays(group), pivot.date1904 ?? false).length > MAX_ITEMS)
12335
+ if (dateUnitLabels(unit, range2, dateGroupDays(group), pivot.date1904 ?? false, group).length > MAX_ITEMS)
11830
12336
  throw new Error("The date group has too many items.");
11831
12337
  }
11832
12338
  }
@@ -11840,7 +12346,7 @@ function expandDateGroups(pivot) {
11840
12346
  const tables = derived.map((entry) => {
11841
12347
  const range2 = { start: entry.group.start, end: entry.group.end };
11842
12348
  const days = dateGroupDays(entry.group);
11843
- const labels = dateUnitLabels(entry.unit, range2, days, date1904);
12349
+ const labels = dateUnitLabels(entry.unit, range2, days, date1904, entry.group);
11844
12350
  return {
11845
12351
  base: pivot.fields.indexOf(entry.group.field),
11846
12352
  labels,
@@ -11852,9 +12358,9 @@ function expandDateGroups(pivot) {
11852
12358
  fields: [...pivot.fields, ...derived.map((entry) => entry.name)],
11853
12359
  records: pivot.records.map((record) => [
11854
12360
  ...record,
11855
- ...tables.map((table2) => {
11856
- const value2 = record[table2.base];
11857
- return typeof value2 === "number" ? table2.labels[table2.index(value2)] : null;
12361
+ ...tables.map((table3) => {
12362
+ const value2 = record[table3.base];
12363
+ return typeof value2 === "number" ? table3.labels[table3.index(value2)] : null;
11858
12364
  })
11859
12365
  ])
11860
12366
  };
@@ -11932,19 +12438,6 @@ function groupLabelsOf(pivot, field) {
11932
12438
  }
11933
12439
 
11934
12440
  // xlsx/pivot/subtotals.ts
11935
- var PIVOT_SUBTOTALS = {
11936
- sum: { attr: "sumSubtotal", item: "sum", label: "Sum" },
11937
- count: { attr: "countASubtotal", item: "countA", label: "Count" },
11938
- average: { attr: "avgSubtotal", item: "avg", label: "Average" },
11939
- max: { attr: "maxSubtotal", item: "max", label: "Max" },
11940
- min: { attr: "minSubtotal", item: "min", label: "Min" },
11941
- product: { attr: "productSubtotal", item: "product", label: "Product" },
11942
- countNums: { attr: "countSubtotal", item: "count", label: "Count" },
11943
- stdDev: { attr: "stdDevSubtotal", item: "stdDev", label: "StdDev" },
11944
- stdDevp: { attr: "stdDevPSubtotal", item: "stdDevP", label: "StdDevp" },
11945
- var: { attr: "varSubtotal", item: "var", label: "Var" },
11946
- varp: { attr: "varPSubtotal", item: "varP", label: "Varp" }
11947
- };
11948
12441
  var PIVOT_SUBTOTAL_ORDER = [
11949
12442
  "sum",
11950
12443
  "count",
@@ -11973,15 +12466,13 @@ function normalizedFieldSubtotals(entries) {
11973
12466
  };
11974
12467
  });
11975
12468
  }
11976
- function validateFieldSubtotals(pivot, rowFields) {
12469
+ function validateFieldSubtotals(pivot, axisFields) {
11977
12470
  const entries = pivot.fieldSubtotals;
11978
12471
  if (entries === void 0) return;
11979
12472
  if (!Array.isArray(entries)) throw new Error("Choose valid field subtotals.");
11980
- if (entries.length && pivot.valuesAxis === "rows")
11981
- throw new Error("Field subtotals require Values on columns.");
11982
12473
  const seen = /* @__PURE__ */ new Set();
11983
12474
  for (const entry of entries) {
11984
- if (!entry || typeof entry !== "object" || !rowFields.includes(entry.field) || seen.has(entry.field) || !Array.isArray(entry.functions) || entry.functions.some((fn) => !PIVOT_AGGREGATES.includes(fn)) || new Set(entry.functions).size !== entry.functions.length)
12475
+ if (!entry || typeof entry !== "object" || !axisFields.includes(entry.field) || seen.has(entry.field) || !Array.isArray(entry.functions) || entry.functions.some((fn) => !PIVOT_AGGREGATES.includes(fn)) || new Set(entry.functions).size !== entry.functions.length)
11985
12476
  throw new Error("Choose valid field subtotals.");
11986
12477
  seen.add(entry.field);
11987
12478
  }
@@ -12045,6 +12536,14 @@ function pruneItemFilters(pivot) {
12045
12536
  return next.length ? next : void 0;
12046
12537
  }
12047
12538
 
12539
+ // xlsx/pivot/item-labels.ts
12540
+ var keyOf = (field, item) => `${field}\0${pivotValueKey(item)}`;
12541
+ function pivotItemLabeler(pivot) {
12542
+ const blank = pivotCaptions(pivot).blank;
12543
+ const names = pivot.itemNames?.length ? new Map(pivot.itemNames.map((entry) => [keyOf(entry.field, entry.item), entry.name])) : void 0;
12544
+ return (field, value2) => names?.get(keyOf(field, value2)) ?? (value2 === null || value2 === "" ? blank : pivotItemLabel(value2));
12545
+ }
12546
+
12048
12547
  // xlsx/pivot/page-filter.ts
12049
12548
  function validatePivotPageFilter(pivot) {
12050
12549
  const filter2 = pivot.pageFilter;
@@ -12056,23 +12555,24 @@ function validatePivotPageFilter(pivot) {
12056
12555
  pivot.columnField,
12057
12556
  pivot.valueField,
12058
12557
  ...extras.map((v) => v?.field)
12059
- ].includes(filter2.field) || pivot.valuesAxis === "rows")
12060
- throw new Error("Report filters require Values on columns and a separate source field.");
12558
+ ].includes(filter2.field))
12559
+ throw new Error("Report filters require a separate source field.");
12061
12560
  if (filter2.item !== void 0 && !(filter2.item === null || typeof filter2.item === "string" || typeof filter2.item === "boolean" || typeof filter2.item === "number" && Number.isFinite(filter2.item) || isCellError(filter2.item) && isErrorCode(filter2.item.error) && Object.keys(filter2.item).length === 1))
12062
12561
  throw new Error("Choose a cached literal report filter item.");
12063
12562
  }
12064
12563
  function pivotPageProjection(pivot) {
12065
- return applyPivotGroups(applyPivotItemFilters(pagedProjection(pivot)));
12564
+ const groups = pivot.dateGroups?.length ? { ...pivot, dateGroups: resolveDateGroups(pivot) } : pivot;
12565
+ return applyPivotGroups(applyPivotItemFilters(pagedProjection(groups)));
12066
12566
  }
12067
12567
  function pagedProjection(pivot) {
12068
12568
  const filter2 = pivot.pageFilter;
12069
12569
  if (!filter2) return pivot;
12070
12570
  const labels = /* @__PURE__ */ new Map();
12071
12571
  for (const item of pivotItems(pivot, filter2.field)) {
12072
- const label5 = String(pivotItemLabel(item)).toLowerCase(), key2 = pivotValueKey(item);
12073
- if (label5 === "(all)" || labels.has(label5) && labels.get(label5) !== key2)
12572
+ const label2 = String(pivotItemLabel(item)).toLowerCase(), key2 = pivotValueKey(item);
12573
+ if (label2 === "(all)" || labels.has(label2) && labels.get(label2) !== key2)
12074
12574
  throw new Error("Ambiguous report filter item captions are preserved.");
12075
- labels.set(label5, key2);
12575
+ labels.set(label2, key2);
12076
12576
  }
12077
12577
  if (filter2.item === void 0) return pivot;
12078
12578
  const index2 = pivot.fields.indexOf(filter2.field), key = pivotValueKey(filter2.item);
@@ -12090,7 +12590,7 @@ function prependPivotPage(grid6, pivot) {
12090
12590
  values: [
12091
12591
  [
12092
12592
  pivot.pageFilter.field,
12093
- pivot.pageFilter.item === void 0 ? "(All)" : pivotItemLabel(pivot.pageFilter.item),
12593
+ pivot.pageFilter.item === void 0 ? pivotCaptions(pivot).all : pivotItemLabeler(pivot)(pivot.pageFilter.field, pivot.pageFilter.item),
12094
12594
  ...Array(width - 2).fill(null)
12095
12595
  ],
12096
12596
  Array(width).fill(null),
@@ -12175,13 +12675,9 @@ function validatePivotFields(pivot) {
12175
12675
  const columns = pivotColumnFields(pivot);
12176
12676
  if (pivot.moreColumnFields !== void 0 && (!Array.isArray(pivot.moreColumnFields) || pivot.moreColumnFields.length > 0 && !pivot.columnField || pivot.moreColumnFields.length > 62 || pivot.moreColumnFields.some((name) => typeof name !== "string")))
12177
12677
  throw new Error("Choose valid PivotTable column fields.");
12178
- if (pivot.valuesAxis === "rows" && rows2.length > 2)
12179
- throw new Error("Values on rows support at most two row fields.");
12180
- if (pivot.valuesAxis === "rows" && columns.length > 1)
12181
- throw new Error("Values on rows support one column field.");
12182
12678
  if (pivot.pageFilter && columns.length > 1)
12183
12679
  throw new Error("Report filters support one column field.");
12184
- validateFieldSubtotals(pivot, rows2);
12680
+ validateFieldSubtotals(pivot, [...rows2, ...columns]);
12185
12681
  const axisNames = pivotAxisFieldNames(pivot);
12186
12682
  if ((pivot.dateGroups ?? []).some(
12187
12683
  (group) => [...rows2, ...columns].some((name) => name === group.field)
@@ -12190,13 +12686,14 @@ function validatePivotFields(pivot) {
12190
12686
  const extras = pivot.additionalValues ?? [];
12191
12687
  if (pivot.valuesAxis !== void 0 && !["columns", "rows"].includes(pivot.valuesAxis))
12192
12688
  throw new Error("Choose a valid Values axis.");
12193
- if (pivot.valuesPosition !== void 0 && !["last", "between", "first"].includes(pivot.valuesPosition))
12689
+ const position = pivot.valuesPosition;
12690
+ if (position !== void 0 && !["last", "between", "first"].includes(position) && !(typeof position === "number" && Number.isInteger(position) && position >= 0))
12194
12691
  throw new Error("Choose a valid Values position.");
12195
- if ((pivot.valuesPosition === "between" || pivot.valuesPosition === "first") && (pivot.valuesAxis !== "rows" || !pivot.secondRowField))
12692
+ if (position !== void 0 && position !== "last" && (pivot.valuesAxis !== "rows" || position === "between" && !pivot.secondRowField || typeof position === "number" && position > rows2.length))
12196
12693
  throw new Error("Values before or between fields require two row fields and Values on rows.");
12197
12694
  if (pivot.valuesAxis === "rows" && (!Array.isArray(extras) || !extras.length))
12198
12695
  throw new Error("Values on rows require multiple measures.");
12199
- if (extras.length > 0 && pivot.sourceXml && parseXml(pivot.sourceXml).documentElement.getAttribute("dataCaption") !== "Values")
12696
+ if (extras.length > 0 && pivot.sourceXml && parseXml(pivot.sourceXml).documentElement.getAttribute("dataCaption") !== pivotCaptions(pivot).values)
12200
12697
  throw new Error("This PivotTable uses unsupported Values header captions.");
12201
12698
  if (!Array.isArray(extras) || extras.length > 15 || extras.some(
12202
12699
  (measure2) => !measure2 || !pivot.fields.includes(measure2.field) || !PIVOT_AGGREGATES.includes(measure2.aggregate) || typeof measure2.caption !== "string" || !measure2.caption.trim() || measure2.caption.length > 255 || pivot.fields.some((field) => field.toLowerCase() === measure2.caption.toLowerCase())
@@ -12209,16 +12706,33 @@ function validatePivotFields(pivot) {
12209
12706
  if (pivot.layout !== void 0 && !["tabular", "compact", "outline"].includes(pivot.layout) || pivot.subtotalPosition !== void 0 && !["top", "bottom"].includes(pivot.subtotalPosition) || !PIVOT_AGGREGATES.includes(pivot.aggregate) || !pivot.fields.includes(pivot.valueField) || [...rows2, ...columns].some((field) => !axisNames.includes(field)) || (/* @__PURE__ */ new Set([...rows2, ...columns])).size !== rows2.length + columns.length || pivot.subtotals !== void 0 && typeof pivot.subtotals !== "boolean" || pivot.repeatLabels !== void 0 && typeof pivot.repeatLabels !== "boolean")
12210
12707
  throw new Error("Choose valid PivotTable fields; row and column fields must differ.");
12211
12708
  }
12212
- function pivotCaption(aggregate2, field) {
12213
- return `${aggregate2[0].toUpperCase()}${aggregate2.slice(1)} of ${field}`;
12709
+ function pivotCaption(aggregate2, field, pivot) {
12710
+ return pivotMeasureName(aggregate2, field, pivot);
12711
+ }
12712
+
12713
+ // xlsx/write/xml-out.ts
12714
+ var CONTROL = "\0-\b\v\f-" + String.fromCharCode(65534, 65535);
12715
+ var INVALID_XML = new RegExp(`[${CONTROL}]`, "g");
12716
+ var escapeText = (text2) => text2.replace(INVALID_XML, "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
12717
+ var escapeAttr = (text2) => text2.replace(INVALID_XML, "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/\r/g, "&#13;").replace(/\n/g, "&#10;").replace(/\t/g, "&#9;");
12718
+ function attrs(values2) {
12719
+ let out = "";
12720
+ for (const [name, value2] of Object.entries(values2)) {
12721
+ if (value2 === void 0) continue;
12722
+ const text2 = typeof value2 === "boolean" ? value2 ? "1" : "0" : typeof value2 === "number" ? num2(value2) : value2;
12723
+ out += ` ${name}="${escapeAttr(text2)}"`;
12724
+ }
12725
+ return out;
12214
12726
  }
12727
+ var el = (name, values2 = {}, content = "") => content ? `<${name}${attrs(values2)}>${content}</${name}>` : `<${name}${attrs(values2)}/>`;
12728
+ var num2 = (value2) => Object.is(value2, -0) ? "0" : String(value2);
12215
12729
 
12216
12730
  // xlsx/pivot/measures.ts
12217
12731
  var pivotMeasures = (pivot) => [
12218
12732
  { field: pivot.valueField, aggregate: pivot.aggregate, caption: pivot.valueCaption },
12219
12733
  ...pivot.additionalValues ?? []
12220
12734
  ];
12221
- function normalizedPivotMeasures(values2) {
12735
+ function normalizedPivotMeasures(values2, pivot) {
12222
12736
  if (!Array.isArray(values2) || values2.length > 15)
12223
12737
  throw new Error("Choose between one and sixteen PivotTable value fields.");
12224
12738
  return values2.map((value2) => {
@@ -12230,7 +12744,7 @@ function normalizedPivotMeasures(values2) {
12230
12744
  return {
12231
12745
  field: value2.field,
12232
12746
  aggregate: aggregate2,
12233
- caption: value2.caption ?? `${aggregate2[0].toUpperCase()}${aggregate2.slice(1)} of ${value2.field}`
12747
+ caption: value2.caption ?? pivotMeasureName(aggregate2, value2.field, pivot)
12234
12748
  };
12235
12749
  });
12236
12750
  }
@@ -12262,307 +12776,16 @@ function aggregateValues(records, field, type) {
12262
12776
  return type === "average" ? sum3 / numbers3.length : sum3;
12263
12777
  }
12264
12778
  var pivotMeasureNumber = (pivot, records, measure2) => aggregateValues(records, pivot.fields.indexOf(measure2.field), measure2.aggregate);
12265
- var pivotNumbers = (pivot, records) => pivotMeasures(pivot).map((measure2) => pivotMeasureNumber(pivot, records, measure2));
12266
- function pivotHeaderDimensions(pivot, columnItems, rowLabels) {
12267
- return {
12268
- rows: (pivot.columnField ? 2 : 1) + (pivot.pageFilter ? 2 : 0),
12269
- width: rowLabels + (pivot.columnField ? columnItems + 1 : 1)
12270
- };
12271
- }
12272
- function pivotHeaders(pivot, columns, labels, label5) {
12273
- const rowLabels = pivot.layout === "compact" ? ["Row Labels"] : pivot.valuesPosition === "first" ? ["Values", ...labels] : pivot.valuesPosition === "between" ? [labels[0], "Values", labels[1]] : [...labels, "Values"];
12274
- return pivot.columnField ? [
12275
- [
12276
- ...rowLabels.map(() => null),
12277
- pivot.layout === "compact" ? "Column Labels" : pivot.columnField,
12278
- ...columns.map(() => null)
12279
- ],
12280
- [...rowLabels, ...columns.map(label5), "Grand Total"]
12281
- ] : [[...rowLabels, null]];
12282
- }
12283
-
12284
- // xlsx/pivot/hierarchy-first.ts
12285
- function appendFirstPivotValues(pivot, context) {
12286
- const {
12287
- rowItems,
12288
- secondRowItems,
12289
- columnItems,
12290
- children: children2,
12291
- innerIndices,
12292
- groups,
12293
- details,
12294
- buckets,
12295
- width,
12296
- rowLabels,
12297
- top,
12298
- bottom,
12299
- append
12300
- } = context;
12301
- const compact3 = pivot.layout === "compact";
12302
- const tabular = !pivot.layout || pivot.layout === "tabular";
12303
- const blank = () => Array(width - rowLabels).fill(null);
12304
- pivotMeasures(pivot).forEach((measure2, m) => {
12305
- const numbers3 = (keys, records) => [
12306
- ...columnItems.map(
12307
- (column2) => pivotMeasureNumber(
12308
- pivot,
12309
- buckets.get(JSON.stringify([...keys, pivotValueKey(column2)])) ?? [],
12310
- measure2
12311
- )
12312
- ),
12313
- pivotMeasureNumber(pivot, records, measure2)
12314
- ];
12315
- if (!tabular)
12316
- append([measure2.caption, ...Array(rowLabels - 1).fill(null)], blank(), {
12317
- indices: [m],
12318
- measure: m
12319
- });
12320
- let first2 = true;
12321
- rowItems.forEach((outer, outerIndex) => {
12322
- const key = pivotValueKey(outer);
12323
- const group = groups.get(key) ?? [];
12324
- if (!tabular)
12325
- append(
12326
- compact3 ? [pivotItemLabel(outer)] : [null, pivotItemLabel(outer), null],
12327
- top ? numbers3([key], group) : blank(),
12328
- { indices: [m, outerIndex], measure: m },
12329
- compact3 ? 1 : 0
12330
- );
12331
- const innerKeys = [...children2.get(key)].sort(
12332
- (a, b) => innerIndices.get(a) - innerIndices.get(b)
12333
- );
12334
- innerKeys.forEach((innerKey, child) => {
12335
- const innerIndex = innerIndices.get(innerKey);
12336
- append(
12337
- compact3 ? [pivotItemLabel(secondRowItems[innerIndex])] : [
12338
- tabular && first2 ? measure2.caption : null,
12339
- pivot.repeatLabels || tabular && child === 0 ? pivotItemLabel(outer) : null,
12340
- pivotItemLabel(secondRowItems[innerIndex])
12341
- ],
12342
- numbers3([key, innerKey], details.get(JSON.stringify([key, innerKey]))),
12343
- { indices: [m, outerIndex, innerIndex], measure: m },
12344
- compact3 ? 2 : 0
12345
- );
12346
- first2 = false;
12347
- });
12348
- if (bottom)
12349
- append(
12350
- compact3 ? [`${String(pivotItemLabel(outer))} Total`] : [null, `${String(pivotItemLabel(outer))} Total`, null],
12351
- numbers3([key], group),
12352
- { indices: [m, outerIndex], measure: m, type: "default" },
12353
- compact3 ? 1 : 0
12354
- );
12355
- });
12356
- });
12357
- }
12358
-
12359
- // xlsx/pivot/hierarchy.ts
12360
- var label2 = pivotItemLabel;
12361
- function hierarchicalPivotGrid(pivot) {
12362
- const rowItems = pivotItems(pivot, pivot.rowField);
12363
- const secondRowItems = pivotItems(pivot, pivot.secondRowField);
12364
- const columnItems = pivot.columnField ? pivotItems(pivot, pivot.columnField) : [];
12365
- const outerField = pivot.fields.indexOf(pivot.rowField);
12366
- const innerField = pivot.fields.indexOf(pivot.secondRowField);
12367
- const columnField = pivot.columnField ? pivot.fields.indexOf(pivot.columnField) : -1;
12368
- const layout2 = pivot.layout ?? "tabular";
12369
- const compact3 = layout2 === "compact";
12370
- const firstValues = pivot.valuesPosition === "first";
12371
- const between = pivot.valuesPosition === "between";
12372
- const measures = pivotMeasures(pivot);
12373
- const top = firstValues && layout2 !== "tabular" && pivot.subtotals !== false && (pivot.subtotalPosition ?? "top") === "top";
12374
- const bottom = pivot.subtotals !== false && !top;
12375
- const rowLabelColumns = compact3 ? 1 : 3;
12376
- const groups = /* @__PURE__ */ new Map();
12377
- const details = /* @__PURE__ */ new Map();
12378
- const children2 = /* @__PURE__ */ new Map();
12379
- const innerIndices = new Map(secondRowItems.map((item, index2) => [pivotValueKey(item), index2]));
12380
- const buckets = /* @__PURE__ */ new Map();
12381
- const collect = (map, key, record) => {
12382
- const list = map.get(key);
12383
- if (list) list.push(record);
12384
- else map.set(key, [record]);
12385
- };
12386
- for (const record of pivot.records) {
12387
- const outer = pivotValueKey(record[outerField] ?? null);
12388
- const inner2 = pivotValueKey(record[innerField] ?? null);
12389
- collect(groups, outer, record);
12390
- collect(details, JSON.stringify([outer, inner2]), record);
12391
- if (!children2.has(outer)) children2.set(outer, /* @__PURE__ */ new Set());
12392
- children2.get(outer).add(inner2);
12393
- if (pivot.columnField) {
12394
- const column2 = pivotValueKey(record[columnField] ?? null);
12395
- for (const key of [[], [outer], [outer, inner2]])
12396
- collect(buckets, JSON.stringify([...key, column2]), record);
12397
- }
12398
- }
12399
- const dimensions = pivotHeaderDimensions(pivot, columnItems.length, rowLabelColumns);
12400
- const rows2 = (details.size + rowItems.length * Number(bottom) + 1) * measures.length + rowItems.length * Number(layout2 !== "tabular") * (firstValues ? measures.length : 1) + (firstValues ? measures.length : between ? rowItems.length * measures.length : details.size) * Number(layout2 !== "tabular") + dimensions.rows;
12401
- if (rows2 * dimensions.width > 1e6) throw new Error("The PivotTable result is too large.");
12402
- const labels = compact3 ? ["Row Labels"] : [pivot.rowField, pivot.secondRowField];
12403
- const values2 = pivotHeaders(pivot, columnItems, labels, label2);
12404
- const firstDataRow = values2.length;
12405
- const indents = values2.map(() => 0);
12406
- const rowEntries = [];
12407
- const append = (labels2, numbers4, entry, indent = 0) => {
12408
- values2.push([...labels2, ...numbers4]);
12409
- rowEntries.push(entry);
12410
- indents.push(indent);
12411
- };
12412
- const bands = (keys, records) => [
12413
- ...columnItems.map(
12414
- (column2) => pivotNumbers(pivot, buckets.get(JSON.stringify([...keys, pivotValueKey(column2)])) ?? [])
12415
- ),
12416
- pivotNumbers(pivot, records)
12417
- ];
12418
- const numbers3 = (keys, records) => bands(keys, records).flat();
12419
- const appendMeasures = (labels2, keys, records, indices, type) => {
12420
- const values3 = bands(keys, records);
12421
- measures.forEach(
12422
- (measure2, m) => append(
12423
- type ? [
12424
- `${type === "grand" ? "Total" : String(labels2[0])} ${measure2.caption}`,
12425
- ...Array(rowLabelColumns - 1).fill(null)
12426
- ] : compact3 ? [measure2.caption] : [
12427
- ...labels2.map(
12428
- (label5) => layout2 === "tabular" && m === 0 || pivot.repeatLabels ? label5 : null
12429
- ),
12430
- measure2.caption
12431
- ],
12432
- values3.map((band) => band[m] ?? null),
12433
- { indices: type ? indices : [...indices, m], measure: m, ...type ? { type } : {} },
12434
- compact3 && !type ? 2 : 0
12435
- )
12436
- );
12437
- };
12438
- if (firstValues)
12439
- appendFirstPivotValues(pivot, {
12440
- rowItems,
12441
- secondRowItems,
12442
- columnItems,
12443
- children: children2,
12444
- innerIndices,
12445
- groups,
12446
- details,
12447
- buckets,
12448
- width: dimensions.width,
12449
- rowLabels: rowLabelColumns,
12450
- top,
12451
- bottom,
12452
- append
12453
- });
12454
- else
12455
- rowItems.forEach((outer, outerIndex) => {
12456
- const key = pivotValueKey(outer);
12457
- if (layout2 !== "tabular")
12458
- append(
12459
- [label2(outer), ...Array(rowLabelColumns - 1).fill(null)],
12460
- top ? numbers3([key], groups.get(key) ?? []) : Array(dimensions.width - rowLabelColumns).fill(null),
12461
- { indices: [outerIndex] }
12462
- );
12463
- let first2 = true;
12464
- const innerKeys = [...children2.get(key)].sort(
12465
- (a, b) => innerIndices.get(a) - innerIndices.get(b)
12466
- );
12467
- if (between)
12468
- measures.forEach((measure2, m) => {
12469
- if (layout2 !== "tabular")
12470
- append(
12471
- compact3 ? [measure2.caption] : [pivot.repeatLabels ? label2(outer) : null, measure2.caption, null],
12472
- Array(dimensions.width - rowLabelColumns).fill(null),
12473
- { indices: [outerIndex, m], measure: m },
12474
- compact3 ? 1 : 0
12475
- );
12476
- innerKeys.forEach((innerKey, child) => {
12477
- const innerIndex = innerIndices.get(innerKey);
12478
- const keys = [key, innerKey];
12479
- const records = details.get(JSON.stringify(keys));
12480
- append(
12481
- compact3 ? [label2(secondRowItems[innerIndex])] : [
12482
- pivot.repeatLabels || layout2 === "tabular" && m === 0 && child === 0 ? label2(outer) : null,
12483
- layout2 === "tabular" && child === 0 ? measure2.caption : null,
12484
- label2(secondRowItems[innerIndex])
12485
- ],
12486
- [
12487
- ...columnItems.map(
12488
- (column2) => pivotMeasureNumber(
12489
- pivot,
12490
- buckets.get(JSON.stringify([...keys, pivotValueKey(column2)])) ?? [],
12491
- measure2
12492
- )
12493
- ),
12494
- pivotMeasureNumber(pivot, records, measure2)
12495
- ],
12496
- { indices: [outerIndex, m, innerIndex], measure: m },
12497
- compact3 ? 2 : 0
12498
- );
12499
- });
12500
- });
12501
- else
12502
- innerKeys.forEach((innerKey) => {
12503
- const innerIndex = innerIndices.get(innerKey);
12504
- const inner2 = secondRowItems[innerIndex];
12505
- const keys = [key, innerKey];
12506
- const records = details.get(JSON.stringify(keys));
12507
- if (!records) return;
12508
- if (layout2 !== "tabular")
12509
- append(
12510
- compact3 ? [label2(inner2)] : [pivot.repeatLabels ? label2(outer) : null, label2(inner2), null],
12511
- Array(dimensions.width - rowLabelColumns).fill(null),
12512
- { indices: [outerIndex, innerIndex] },
12513
- compact3 ? 1 : 0
12514
- );
12515
- appendMeasures(
12516
- [pivot.repeatLabels || first2 ? label2(outer) : null, label2(inner2)],
12517
- keys,
12518
- records,
12519
- [outerIndex, innerIndex]
12520
- );
12521
- first2 = false;
12522
- });
12523
- if (bottom)
12524
- appendMeasures([label2(outer)], [key], groups.get(key) ?? [], [outerIndex], "default");
12525
- });
12526
- appendMeasures([], [], pivot.records, [0], "grand");
12527
- return {
12528
- values: values2,
12529
- rowItems,
12530
- secondRowItems,
12531
- columnItems,
12532
- rowEntries,
12533
- firstDataRow,
12534
- rowLabelColumns,
12535
- indents,
12536
- firstHeaderRow: 1
12537
- };
12538
- }
12539
-
12540
- // xlsx/write/xml-out.ts
12541
- var CONTROL = "\0-\b\v\f-" + String.fromCharCode(65534, 65535);
12542
- var INVALID_XML = new RegExp(`[${CONTROL}]`, "g");
12543
- var escapeText = (text2) => text2.replace(INVALID_XML, "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
12544
- var escapeAttr = (text2) => text2.replace(INVALID_XML, "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/\r/g, "&#13;").replace(/\n/g, "&#10;").replace(/\t/g, "&#9;");
12545
- function attrs(values2) {
12546
- let out = "";
12547
- for (const [name, value2] of Object.entries(values2)) {
12548
- if (value2 === void 0) continue;
12549
- const text2 = typeof value2 === "boolean" ? value2 ? "1" : "0" : typeof value2 === "number" ? num2(value2) : value2;
12550
- out += ` ${name}="${escapeAttr(text2)}"`;
12551
- }
12552
- return out;
12553
- }
12554
- var el = (name, values2 = {}, content = "") => content ? `<${name}${attrs(values2)}>${content}</${name}>` : `<${name}${attrs(values2)}/>`;
12555
- var num2 = (value2) => Object.is(value2, -0) ? "0" : String(value2);
12556
12779
 
12557
12780
  // xlsx/pivot/columns.ts
12558
12781
  var SEPARATOR = "";
12559
- var label3 = pivotItemLabel;
12560
12782
  var columnKey = (keys, depth) => keys.slice(0, depth).join(SEPARATOR);
12561
12783
  var recordColumnKeys = (record, indices) => indices.map((index2) => pivotValueKey(record[index2] ?? null));
12562
12784
  function pivotColumnEntries(pivot) {
12563
12785
  const names = pivotColumnFields(pivot);
12564
12786
  const items = names.map((name) => pivotItems(pivot, name));
12565
12787
  const entries = [];
12788
+ const functions = names.map((name) => fieldSubtotalFunctions(pivot, name));
12566
12789
  if (names.length) {
12567
12790
  const order = items.map(
12568
12791
  (list) => new Map(list.map((item, index2) => [pivotValueKey(item), index2]))
@@ -12597,7 +12820,9 @@ function pivotColumnEntries(pivot) {
12597
12820
  if (level === names.length - 1) entries.push({ kind: "leaf", ...entry });
12598
12821
  else {
12599
12822
  visit2(child[1], level + 1, here.path, here.values, here.keys);
12600
- entries.push({ kind: "subtotal", ...entry });
12823
+ const own = functions[level];
12824
+ if (own === "auto") entries.push({ kind: "subtotal", ...entry });
12825
+ else for (const fn of own) entries.push({ kind: "subtotal", ...entry, fn });
12601
12826
  }
12602
12827
  }
12603
12828
  };
@@ -12606,26 +12831,31 @@ function pivotColumnEntries(pivot) {
12606
12831
  entries.push({ kind: "grand", path: [], key: "", values: [] });
12607
12832
  return { names, items, entries };
12608
12833
  }
12609
- function pivotColumnDimensions(pivot, columns, labelColumns) {
12610
- const measures = 1 + (pivot.additionalValues?.length ?? 0);
12834
+ function pivotColumnDimensions(pivot, columns, labelColumns, valuesOnRows = false) {
12835
+ const measures = valuesOnRows ? 1 : 1 + (pivot.additionalValues?.length ?? 0);
12611
12836
  const levels = columns.names.length;
12612
12837
  return {
12613
12838
  rows: (levels ? levels + 1 + Number(measures > 1) : 1) + (pivot.pageFilter ? 2 : 0),
12614
12839
  width: labelColumns + (levels ? columns.entries.length : 1) * measures
12615
12840
  };
12616
12841
  }
12617
- function pivotColumnHeaders(pivot, columns, rowLabels) {
12618
- const measures = pivotMeasures(pivot);
12842
+ function pivotColumnHeaders(pivot, columns, rowLabels, valuesOnRows = false) {
12843
+ const measures = valuesOnRows ? pivotMeasures(pivot).slice(0, 1) : pivotMeasures(pivot);
12619
12844
  const count2 = measures.length;
12620
12845
  const levels = columns.names.length;
12621
- if (!levels) return [[...rowLabels, ...measures.map((measure2) => measure2.caption)]];
12846
+ if (!levels)
12847
+ return [
12848
+ [...rowLabels, ...valuesOnRows ? [null] : measures.map((measure2) => measure2.caption)]
12849
+ ];
12622
12850
  const compact3 = pivot.layout === "compact";
12623
12851
  const labelColumns = rowLabels.length;
12624
12852
  const width = labelColumns + columns.entries.length * count2;
12625
12853
  const rows2 = levels + 1 + Number(count2 > 1);
12626
12854
  const grid6 = Array.from({ length: rows2 }, () => Array(width).fill(null));
12627
- if (count2 === 1) grid6[0][0] = pivot.valueCaption;
12628
- const titles = compact3 ? ["Column Labels"] : [...columns.names, ...count2 > 1 ? ["Values"] : []];
12855
+ if (count2 === 1 && !valuesOnRows) grid6[0][0] = pivot.valueCaption;
12856
+ const caps = pivotCaptions(pivot);
12857
+ const labelOf = pivotItemLabeler(pivot);
12858
+ const titles = compact3 ? [caps.columnLabels] : [...columns.names, ...count2 > 1 ? [caps.values] : []];
12629
12859
  titles.forEach((title, i2) => {
12630
12860
  grid6[0][labelColumns + i2] = title;
12631
12861
  });
@@ -12638,23 +12868,23 @@ function pivotColumnHeaders(pivot, columns, rowLabels) {
12638
12868
  if (entry.kind === "leaf") {
12639
12869
  entry.path.forEach((_index, level) => {
12640
12870
  const continued = entry.path.slice(0, level + 1).every((p, i2) => p === previous[i2]);
12641
- if (!continued) grid6[1 + level][at] = label3(entry.values[level]);
12871
+ if (!continued) grid6[1 + level][at] = labelOf(columns.names[level], entry.values[level]);
12642
12872
  });
12643
12873
  previous = entry.path;
12644
12874
  if (count2 > 1) measures.forEach((measure2, m) => grid6[rows2 - 1][at + m] = measure2.caption);
12645
12875
  return;
12646
12876
  }
12647
12877
  const row2 = entry.kind === "grand" ? 1 : entry.path.length;
12648
- const name = entry.kind === "grand" ? "" : String(label3(entry.values.at(-1)));
12878
+ const name = entry.kind === "grand" ? "" : String(labelOf(columns.names[entry.path.length - 1], entry.values.at(-1)));
12649
12879
  measures.forEach((measure2, m) => {
12650
- grid6[row2][at + m] = count2 === 1 ? entry.kind === "grand" ? "Grand Total" : `${name} Total` : entry.kind === "grand" ? `Total ${measure2.caption}` : `${name} ${measure2.caption}`;
12880
+ const custom = entry.fn ? caps.functions[entry.fn] : void 0;
12881
+ grid6[row2][at + m] = custom ? count2 === 1 ? `${name} ${custom}` : `${name} ${custom} of ${measure2.field}` : count2 === 1 ? entry.kind === "grand" ? caps.grandTotal : fillCaption(caps.subtotal, name) : entry.kind === "grand" ? fillCaption(caps.measureTotal, measure2.caption) : `${name} ${measure2.caption}`;
12651
12882
  });
12652
12883
  });
12653
12884
  return grid6;
12654
12885
  }
12655
12886
 
12656
12887
  // xlsx/pivot/nested.ts
12657
- var label4 = pivotItemLabel;
12658
12888
  var MAX_CELLS = 1e6;
12659
12889
  var node = (index2, value2) => ({
12660
12890
  index: index2,
@@ -12666,6 +12896,10 @@ var node = (index2, value2) => ({
12666
12896
  function nestedPivotGrid(pivot) {
12667
12897
  const names = pivotRowFields(pivot);
12668
12898
  const depth = names.length;
12899
+ const valuesAt = pivotValuesIndex(pivot);
12900
+ const onRows = valuesAt >= 0;
12901
+ const levels = depth + (onRows ? 1 : 0);
12902
+ const fieldOf = (level) => !onRows || level < valuesAt ? level : level === valuesAt ? -1 : level - 1;
12669
12903
  const axisItems = names.map((name) => pivotItems(pivot, name));
12670
12904
  const itemIndices = axisItems.map(
12671
12905
  (items) => new Map(items.map((item, index2) => [pivotValueKey(item), index2]))
@@ -12677,125 +12911,170 @@ function nestedPivotGrid(pivot) {
12677
12911
  const compact3 = layout2 === "compact";
12678
12912
  const tabular = layout2 === "tabular";
12679
12913
  const above = !tabular && (pivot.subtotalPosition ?? "top") === "top";
12680
- const labelColumns = compact3 ? 1 : depth;
12914
+ const labelColumns = compact3 ? 1 : levels;
12681
12915
  const measures = pivotMeasures(pivot);
12916
+ const functions = names.map((name) => fieldSubtotalFunctions(pivot, name));
12917
+ const caps = pivotCaptions(pivot);
12918
+ const labelOf = pivotItemLabeler(pivot);
12682
12919
  const root = node(0, null);
12683
12920
  for (const record of pivot.records) {
12684
12921
  const keys = recordColumnKeys(record, columnFields);
12685
12922
  let current = root;
12686
- for (let level = -1; level < depth; level++) {
12687
- if (level >= 0) {
12688
- const value2 = record[fieldIndices[level]] ?? null;
12923
+ for (let field = -1; field < depth; field++) {
12924
+ if (field >= 0) {
12925
+ const value2 = record[fieldIndices[field]] ?? null;
12689
12926
  const key = pivotValueKey(value2);
12690
12927
  let child = current.children.get(key);
12691
12928
  if (!child) {
12692
- child = node(itemIndices[level].get(key), value2);
12929
+ child = node(itemIndices[field].get(key), value2);
12693
12930
  current.children.set(key, child);
12694
12931
  }
12695
12932
  current = child;
12696
12933
  }
12697
12934
  current.records.push(record);
12698
- for (let width = 1; width <= keys.length; width++) {
12699
- const key = columnKey(keys, width);
12935
+ for (let width2 = 1; width2 <= keys.length; width2++) {
12936
+ const key = columnKey(keys, width2);
12700
12937
  const list = current.columns.get(key);
12701
12938
  if (list) list.push(record);
12702
12939
  else current.columns.set(key, [record]);
12703
12940
  }
12704
12941
  }
12705
12942
  }
12706
- const dimensions = pivotColumnDimensions(pivot, columns, labelColumns);
12707
- const functions = names.map((name) => fieldSubtotalFunctions(pivot, name));
12708
- let rows2 = 1;
12709
- const count2 = (parent, level) => {
12710
- for (const child of parent.children.values()) {
12711
- rows2++;
12712
- if (level < depth - 1) {
12713
- const f6 = functions[level];
12714
- rows2 += f6 === "auto" ? 1 : f6.length;
12715
- count2(child, level + 1);
12716
- }
12717
- }
12718
- };
12719
- count2(root, 0);
12720
- if ((rows2 + dimensions.rows) * dimensions.width > MAX_CELLS)
12721
- throw new Error("The PivotTable result is too large.");
12722
- const values2 = pivotColumnHeaders(pivot, columns, compact3 ? ["Row Labels"] : names);
12723
- const firstDataRow = values2.length;
12724
- const indents = values2.map(() => 0);
12943
+ const dimensions = pivotColumnDimensions(pivot, columns, labelColumns, onRows);
12944
+ const rowTitles = names.map((name) => name);
12945
+ if (onRows) rowTitles.splice(valuesAt, 0, caps.values);
12946
+ let values2 = [];
12947
+ let indents = [];
12725
12948
  const rowEntries = [];
12726
- const blanks = () => Array(dimensions.width - labelColumns).fill(null);
12727
- const bands = (group, run) => columns.entries.flatMap(
12728
- (entry) => run(entry.kind === "grand" ? group.records : group.columns.get(entry.key) ?? [])
12729
- );
12730
- const numbers3 = (group) => bands(group, (records) => pivotNumbers(pivot, records));
12731
- const subtotalNumbers = (group, fn) => bands(
12732
- group,
12733
- (records) => measures.map((measure2) => aggregateValues(records, pivot.fields.indexOf(measure2.field), fn))
12734
- );
12735
- const labelCells = (path, shown, text2) => {
12949
+ let counting = true;
12950
+ let rowCount = 0;
12951
+ const width = dimensions.width - labelColumns;
12952
+ const blanks = () => Array(width).fill(null);
12953
+ const cells = (group, rowFn, measure2) => columns.entries.flatMap((entry) => {
12954
+ const records = entry.kind === "grand" ? group.records : group.columns.get(entry.key) ?? [];
12955
+ const picked = measure2 === void 0 ? measures : [measures[measure2]];
12956
+ if (rowFn && entry.fn && rowFn !== entry.fn) return picked.map(() => null);
12957
+ const fn = rowFn ?? entry.fn;
12958
+ return picked.map(
12959
+ (one2) => fn ? aggregateValues(records, pivot.fields.indexOf(one2.field), fn) : pivotMeasureNumber(pivot, records, one2)
12960
+ );
12961
+ });
12962
+ const labelCells = (path, shown, level, text2) => {
12736
12963
  if (compact3) return [text2];
12737
- const cells = Array(depth).fill(null);
12738
- path.forEach((value2, level) => {
12739
- if (shown[level]) cells[level] = label4(value2);
12964
+ const row2 = Array(levels).fill(null);
12965
+ path.labels.forEach((value2, at) => {
12966
+ if (shown[at]) row2[at] = value2;
12740
12967
  });
12741
- cells[path.length] = text2;
12742
- return cells;
12968
+ row2[level] = text2;
12969
+ return row2;
12743
12970
  };
12744
- const push3 = (cells, numbersOnRow, entry, indent) => {
12745
- values2.push([...cells, ...numbersOnRow]);
12971
+ const push3 = (indent, build4) => {
12972
+ if (counting) {
12973
+ if ((++rowCount + dimensions.rows) * dimensions.width > MAX_CELLS)
12974
+ throw new Error("The PivotTable result is too large.");
12975
+ return;
12976
+ }
12977
+ const [cells2, numbers3, entry] = build4();
12978
+ values2.push([...cells2, ...numbers3]);
12746
12979
  rowEntries.push(entry);
12747
12980
  indents.push(compact3 ? indent : 0);
12748
12981
  };
12749
- const emit = (parent, level, path, indices, firsts) => {
12750
- const last = level === depth - 1;
12751
- const own = functions[level];
12752
- const children2 = [...parent.children.values()].sort((a, b) => a.index - b.index);
12982
+ const entryOf = (indices, measure2, type) => ({
12983
+ indices,
12984
+ ...measure2 !== void 0 ? { measure: measure2 } : {},
12985
+ ...type ? { type } : {}
12986
+ });
12987
+ const walk = (level, group, measure2, path) => {
12988
+ const field = fieldOf(level);
12989
+ const last = level === levels - 1;
12990
+ const repeated = Array.from(
12991
+ { length: level },
12992
+ (_v, k) => !!pivot.repeatLabels && fieldOf(k) >= 0
12993
+ );
12994
+ const leafShown = (firsts) => repeated.map((repeat, k) => repeat || tabular && firsts.slice(k + 1).every(Boolean));
12995
+ if (field < 0) {
12996
+ measures.forEach((one2, m) => {
12997
+ const here = {
12998
+ labels: [...path.labels, one2.caption],
12999
+ indices: [...path.indices, m],
13000
+ firsts: [...path.firsts, m === 0]
13001
+ };
13002
+ if (last)
13003
+ return push3(level, () => [
13004
+ labelCells(path, leafShown(here.firsts), level, one2.caption),
13005
+ cells(group, void 0, m),
13006
+ entryOf(here.indices, m)
13007
+ ]);
13008
+ if (!tabular)
13009
+ push3(level, () => [
13010
+ labelCells(path, repeated, level, one2.caption),
13011
+ blanks(),
13012
+ entryOf(here.indices, m)
13013
+ ]);
13014
+ walk(level + 1, group, m, here);
13015
+ });
13016
+ return;
13017
+ }
13018
+ const own = functions[field];
13019
+ const valuesAbove = !onRows || valuesAt < level;
13020
+ const showsValue = above && own === "auto" && valuesAbove;
13021
+ const children2 = [...group.children.values()].sort((a, b) => a.index - b.index);
12753
13022
  children2.forEach((child, position) => {
12754
- const here = [...path, child.value];
12755
- const at = [...indices, child.index];
12756
- const firstHere = [...firsts, position === 0];
12757
- const repeated = Array(level).fill(!!pivot.repeatLabels);
12758
- if (last) {
12759
- const shown = repeated.map(
12760
- (repeat, k) => repeat || tabular && firstHere.slice(k + 1).every(Boolean)
12761
- );
12762
- push3(labelCells(path, shown, label4(child.value)), numbers3(child), { indices: at }, level);
12763
- return;
12764
- }
13023
+ const here = {
13024
+ labels: [...path.labels, labelOf(names[field], child.value)],
13025
+ indices: [...path.indices, child.index],
13026
+ firsts: [...path.firsts, position === 0]
13027
+ };
13028
+ const text2 = labelOf(names[field], child.value);
13029
+ if (last)
13030
+ return push3(level, () => [
13031
+ labelCells(path, leafShown(here.firsts), level, text2),
13032
+ cells(child, void 0, measure2),
13033
+ entryOf(here.indices, measure2)
13034
+ ]);
12765
13035
  if (!tabular)
12766
- push3(
12767
- labelCells(path, repeated, label4(child.value)),
12768
- own === "auto" && above ? numbers3(child) : blanks(),
12769
- { indices: at },
12770
- level
12771
- );
12772
- emit(child, level + 1, here, at, firstHere);
12773
- const caption = String(label4(child.value));
13036
+ push3(level, () => [
13037
+ labelCells(path, repeated, level, text2),
13038
+ showsValue ? cells(child, void 0, measure2) : blanks(),
13039
+ entryOf(here.indices, measure2)
13040
+ ]);
13041
+ walk(level + 1, child, measure2, here);
13042
+ if (field === depth - 1) return;
13043
+ const caption = String(text2);
13044
+ const subtotal = (title, fn, one2) => push3(level, () => [
13045
+ labelCells(path, repeated, level, title),
13046
+ cells(child, fn, one2),
13047
+ entryOf(here.indices, one2, fn ?? "default")
13048
+ ]);
12774
13049
  if (own === "auto") {
12775
- if (!above)
12776
- push3(
12777
- labelCells(path, repeated, `${caption} Total`),
12778
- numbers3(child),
12779
- { indices: at, type: "default" },
12780
- level
12781
- );
13050
+ if (showsValue) return;
13051
+ if (valuesAbove) subtotal(fillCaption(caps.subtotal, caption), void 0, measure2);
13052
+ else measures.forEach((one2, m) => subtotal(`${caption} ${one2.caption}`, void 0, m));
12782
13053
  } else
12783
13054
  for (const fn of own)
12784
- push3(
12785
- labelCells(path, repeated, `${caption} ${PIVOT_SUBTOTALS[fn].label}`),
12786
- subtotalNumbers(child, fn),
12787
- { indices: at, type: fn },
12788
- level
12789
- );
13055
+ if (valuesAbove) subtotal(`${caption} ${caps.functions[fn]}`, fn, measure2);
13056
+ else
13057
+ measures.forEach(
13058
+ (one2, m) => subtotal(`${caption} ${caps.functions[fn]} of ${one2.field}`, fn, m)
13059
+ );
12790
13060
  });
12791
13061
  };
12792
- emit(root, 0, [], [], []);
12793
- push3(
12794
- compact3 ? ["Grand Total"] : ["Grand Total", ...Array(depth - 1).fill(null)],
12795
- numbers3(root),
12796
- { indices: [0], type: "grand" },
12797
- 0
12798
- );
13062
+ const grand = (text2, measure2) => push3(0, () => [
13063
+ compact3 ? [text2] : [text2, ...Array(levels - 1).fill(null)],
13064
+ cells(root, void 0, measure2),
13065
+ entryOf([0], measure2, "grand")
13066
+ ]);
13067
+ const build3 = () => {
13068
+ walk(0, root, void 0, { labels: [], indices: [], firsts: [] });
13069
+ if (onRows) measures.forEach((one2, m) => grand(fillCaption(caps.measureTotal, one2.caption), m));
13070
+ else grand(caps.grandTotal);
13071
+ };
13072
+ build3();
13073
+ counting = false;
13074
+ values2 = pivotColumnHeaders(pivot, columns, compact3 ? [caps.rowLabels] : rowTitles, onRows);
13075
+ const firstDataRow = values2.length;
13076
+ indents = values2.map(() => 0);
13077
+ build3();
12799
13078
  return {
12800
13079
  values: values2,
12801
13080
  rowItems: axisItems[0],
@@ -12807,105 +13086,15 @@ function nestedPivotGrid(pivot) {
12807
13086
  rowEntries,
12808
13087
  firstDataRow,
12809
13088
  rowLabelColumns: labelColumns,
12810
- indents
13089
+ indents,
13090
+ ...onRows ? { firstHeaderRow: 1 } : {}
12811
13091
  };
12812
13092
  }
12813
13093
 
12814
13094
  // xlsx/pivot/aggregate.ts
12815
13095
  function pivotGrid(pivot) {
12816
13096
  validatePivotFields(pivot);
12817
- return prependPivotPage(pivotDataGrid(pivotPageProjection(pivot)), pivot);
12818
- }
12819
- function pivotDataGrid(pivot) {
12820
- if (pivot.valuesAxis !== "rows") return nestedPivotGrid(pivot);
12821
- if (pivot.secondRowField) return hierarchicalPivotGrid(pivot);
12822
- const rowItems = pivotItems(pivot, pivot.rowField);
12823
- const columnItems = pivot.columnField ? pivotItems(pivot, pivot.columnField) : [];
12824
- const compact3 = pivot.layout === "compact";
12825
- const headings = pivot.layout !== void 0 && pivot.layout !== "tabular";
12826
- const dimensions = pivotHeaderDimensions(pivot, columnItems.length, compact3 ? 1 : 2);
12827
- const dataRows = (rowItems.length + 1) * (1 + (pivot.additionalValues?.length ?? 0)) + (headings ? rowItems.length : 0);
12828
- if ((dataRows + dimensions.rows) * dimensions.width > 1e6)
12829
- throw new Error("The PivotTable result is too large.");
12830
- const label5 = pivotItemLabel;
12831
- const values2 = pivotHeaders(pivot, columnItems, [compact3 ? "Row Labels" : pivot.rowField], label5);
12832
- const rowField = pivot.fields.indexOf(pivot.rowField);
12833
- const colField = pivot.columnField ? pivot.fields.indexOf(pivot.columnField) : -1;
12834
- const groups = /* @__PURE__ */ new Map();
12835
- const cells = /* @__PURE__ */ new Map();
12836
- const columns = /* @__PURE__ */ new Map();
12837
- const collect = (map, key, record) => {
12838
- const found = map.get(key);
12839
- if (found) found.push(record);
12840
- else map.set(key, [record]);
12841
- };
12842
- for (const record of pivot.records) {
12843
- const key = pivotValueKey(record[rowField] ?? null);
12844
- collect(groups, key, record);
12845
- if (pivot.columnField) {
12846
- const col = pivotValueKey(record[colField] ?? null);
12847
- collect(columns, col, record);
12848
- collect(cells, JSON.stringify([key, col]), record);
12849
- }
12850
- }
12851
- const firstDataRow = values2.length;
12852
- const measures = pivotMeasures(pivot);
12853
- const rowEntries = [];
12854
- const indents = values2.map(() => 0);
12855
- const append = (caption, bands, index2, grand = false) => {
12856
- measures.forEach((measure2, m) => {
12857
- values2.push([
12858
- ...compact3 ? [grand ? `Total ${measure2.caption}` : measure2.caption] : [
12859
- grand ? `Total ${measure2.caption}` : pivot.repeatLabels || !headings && m === 0 ? caption : null,
12860
- grand ? null : measure2.caption
12861
- ],
12862
- ...bands.map((band) => band[m] ?? null)
12863
- ]);
12864
- indents.push(compact3 && !grand ? 1 : 0);
12865
- rowEntries.push({
12866
- indices: grand ? [0] : [index2, m],
12867
- measure: m,
12868
- ...grand ? { type: "grand" } : {}
12869
- });
12870
- });
12871
- };
12872
- rowItems.forEach((item, index2) => {
12873
- const key = pivotValueKey(item);
12874
- if (headings) {
12875
- values2.push([label5(item), ...Array(dimensions.width - 1).fill(null)]);
12876
- rowEntries.push({ indices: [index2] });
12877
- indents.push(0);
12878
- }
12879
- append(
12880
- label5(item),
12881
- [
12882
- ...columnItems.map(
12883
- (col) => pivotNumbers(pivot, cells.get(JSON.stringify([key, pivotValueKey(col)])) ?? [])
12884
- ),
12885
- pivotNumbers(pivot, groups.get(key) ?? [])
12886
- ],
12887
- index2
12888
- );
12889
- });
12890
- append(
12891
- "Grand Total",
12892
- [
12893
- ...columnItems.map((col) => pivotNumbers(pivot, columns.get(pivotValueKey(col)) ?? [])),
12894
- pivotNumbers(pivot, pivot.records)
12895
- ],
12896
- 0,
12897
- true
12898
- );
12899
- return {
12900
- values: values2,
12901
- rowItems,
12902
- columnItems,
12903
- firstDataRow,
12904
- rowLabelColumns: compact3 ? 1 : 2,
12905
- indents,
12906
- firstHeaderRow: 1,
12907
- rowEntries
12908
- };
13097
+ return prependPivotPage(nestedPivotGrid(pivotPageProjection(pivot)), pivot);
12909
13098
  }
12910
13099
  function pivotTableAt(sheet, at) {
12911
13100
  return sheet.pivotTables?.find((pivot) => rangeContains(pivot.location, at));
@@ -13018,7 +13207,7 @@ function headerMode(args, i2, ctx, firstRow) {
13018
13207
  if (mode === 1 || mode === 3) return true;
13019
13208
  return fail(ERR.VALUE);
13020
13209
  }
13021
- var keyOf = (values2) => JSON.stringify(values2);
13210
+ var keyOf2 = (values2) => JSON.stringify(values2);
13022
13211
  var plain2 = (v) => v === void 0 || isError(v) ? null : v;
13023
13212
  function compareBy(keys, rows2) {
13024
13213
  return (a, b) => {
@@ -13058,12 +13247,12 @@ function groupby(args, ctx) {
13058
13247
  if (rows2.length === 0) fail(ERR.CALC);
13059
13248
  const groups = /* @__PURE__ */ new Map();
13060
13249
  for (const r of rows2) {
13061
- const key = keyOf(keysM.data[r]);
13250
+ const key = keyOf2(keysM.data[r]);
13062
13251
  const found = groups.get(key);
13063
13252
  if (found) found.push(r);
13064
13253
  else groups.set(key, [r]);
13065
13254
  }
13066
- const table2 = [...groups.values()].map((members) => {
13255
+ const table3 = [...groups.values()].map((members) => {
13067
13256
  const key = keysM.data[members[0]];
13068
13257
  const cells = Array.from(
13069
13258
  { length: vCols },
@@ -13075,8 +13264,8 @@ function groupby(args, ctx) {
13075
13264
  return [...key, ...cells];
13076
13265
  });
13077
13266
  for (const key of sort2) if (Math.abs(key) > kCols + vCols) fail(ERR.VALUE);
13078
- const order = table2.map((_, i2) => i2).sort(compareBy(sort2, table2));
13079
- const out = order.map((i2) => table2[i2]);
13267
+ const order = table3.map((_, i2) => i2).sort(compareBy(sort2, table3));
13268
+ const out = order.map((i2) => table3[i2]);
13080
13269
  if (depth !== 0) {
13081
13270
  const total2 = [
13082
13271
  "Total",
@@ -13125,8 +13314,8 @@ function pivotby(args, ctx) {
13125
13314
  const colKeys = /* @__PURE__ */ new Map();
13126
13315
  for (const r of used) {
13127
13316
  for (const [map, key] of [
13128
- [rowKeys, keyOf(rowsM.data[r])],
13129
- [colKeys, keyOf(colsM.data[r])]
13317
+ [rowKeys, keyOf2(rowsM.data[r])],
13318
+ [colKeys, keyOf2(colsM.data[r])]
13130
13319
  ]) {
13131
13320
  const found = map.get(key);
13132
13321
  if (found) found.push(r);
@@ -13859,8 +14048,8 @@ function resolveName(node2, frame) {
13859
14048
  const value2 = evaluateDefinedName(node2.name, sheet, node2.prefix !== void 0, frame);
13860
14049
  if (value2 !== void 0) return value2;
13861
14050
  if (!node2.prefix) {
13862
- const table2 = resolveStructured({ table: node2.name, specials: [] }, frame);
13863
- if (!(isError(table2) && table2.error === "#NAME?")) return table2;
14051
+ const table3 = resolveStructured({ table: node2.name, specials: [] }, frame);
14052
+ if (!(isError(table3) && table3.error === "#NAME?")) return table3;
13864
14053
  }
13865
14054
  return ERR.NAME;
13866
14055
  }
@@ -15718,8 +15907,8 @@ function deleteSheetInFormula(formula, sheetName, tableNames = []) {
15718
15907
  for (const token of tokens) {
15719
15908
  const prefix = token.prefix;
15720
15909
  const onSheet = prefix !== void 0 && prefix.book === void 0 && prefix.sheet2 === void 0 && same2(prefix.sheet, sheetName);
15721
- const table2 = typeof token.value === "string" && tables.has(token.value.toLowerCase()) && (token.kind === "structured" || token.kind === "name" && !prefix);
15722
- if ((token.kind === "ref" || token.kind === "name") && onSheet || table2) {
15910
+ const table3 = typeof token.value === "string" && tables.has(token.value.toLowerCase()) && (token.kind === "structured" || token.kind === "name" && !prefix);
15911
+ if ((token.kind === "ref" || token.kind === "name") && onSheet || table3) {
15723
15912
  token.text = "#REF!";
15724
15913
  changed = true;
15725
15914
  }
@@ -15782,11 +15971,11 @@ function renameTableColumnInFormula(formula, tableName, oldName, newName, inside
15782
15971
  // xlsx/formula/structured-to-a1.ts
15783
15972
  var abs = (row2, col, rowAbs = true) => `$${columnLabel(col)}${rowAbs ? "$" : ""}${row2 + 1}`;
15784
15973
  function a1For(ref, t) {
15785
- const { table: table2 } = t;
15786
- const { start, end } = table2.range;
15974
+ const { table: table3 } = t;
15975
+ const { start, end } = table3.range;
15787
15976
  const index2 = (name) => {
15788
15977
  if (name === void 0) return void 0;
15789
- const i2 = table2.columns.findIndex((c) => c.name.toLowerCase() === name.toLowerCase());
15978
+ const i2 = table3.columns.findIndex((c) => c.name.toLowerCase() === name.toLowerCase());
15790
15979
  return i2 < 0 ? -1 : start.col + i2;
15791
15980
  };
15792
15981
  const c1 = index2(ref.column);
@@ -15794,10 +15983,10 @@ function a1For(ref, t) {
15794
15983
  if (c1 === -1 || c2 === -1) return "#REF!";
15795
15984
  const colLo = c1 ?? start.col;
15796
15985
  const colHi = c2 ?? end.col;
15797
- const headerRow = table2.headerRow ? start.row : void 0;
15798
- const totalsRow = table2.totalsRow ? end.row : void 0;
15799
- const dataLo = start.row + (table2.headerRow ? 1 : 0);
15800
- const dataHi = end.row - (table2.totalsRow ? 1 : 0);
15986
+ const headerRow = table3.headerRow ? start.row : void 0;
15987
+ const totalsRow = table3.totalsRow ? end.row : void 0;
15988
+ const dataLo = start.row + (table3.headerRow ? 1 : 0);
15989
+ const dataHi = end.row - (table3.totalsRow ? 1 : 0);
15801
15990
  const specials = new Set(ref.specials);
15802
15991
  let rowLo;
15803
15992
  let rowHi;
@@ -15921,14 +16110,14 @@ function descendants(root, local, ns) {
15921
16110
  }
15922
16111
 
15923
16112
  // xlsx/slicer/table-filter.ts
15924
- function tableFilterBounds(table2) {
16113
+ function tableFilterBounds(table3) {
15925
16114
  return {
15926
- start: table2.range.start,
15927
- end: { ...table2.range.end, row: table2.range.end.row - (table2.totalsRow ? 1 : 0) }
16115
+ start: table3.range.start,
16116
+ end: { ...table3.range.end, row: table3.range.end.row - (table3.totalsRow ? 1 : 0) }
15928
16117
  };
15929
16118
  }
15930
- function tableAutoFilter(table2) {
15931
- const columns = table2.columns.flatMap(
16119
+ function tableAutoFilter(table3) {
16120
+ const columns = table3.columns.flatMap(
15932
16121
  (column2, offset2) => column2.filter ? [
15933
16122
  {
15934
16123
  offset: offset2,
@@ -15938,12 +16127,12 @@ function tableAutoFilter(table2) {
15938
16127
  ] : []
15939
16128
  );
15940
16129
  if (!columns.length) return void 0;
15941
- return { range: tableFilterBounds(table2), columns };
16130
+ return { range: tableFilterBounds(table3), columns };
15942
16131
  }
15943
- function applyTableFilter(workbook, sheet, table2) {
15944
- if (!table2.headerRow) return;
15945
- const bounds = tableFilterBounds(table2);
15946
- const filter2 = tableAutoFilter(table2);
16132
+ function applyTableFilter(workbook, sheet, table3) {
16133
+ if (!table3.headerRow) return;
16134
+ const bounds = tableFilterBounds(table3);
16135
+ const filter2 = tableAutoFilter(table3);
15947
16136
  for (let row2 = bounds.start.row + 1; row2 <= bounds.end.row; row2++) {
15948
16137
  const visible = !filter2 || rowMatchesFilter(workbook, sheet, row2, filter2);
15949
16138
  setRowFiltered(sheet, row2, !visible, !!filter2);
@@ -17058,9 +17247,9 @@ function slicerTarget(workbook, cache3) {
17058
17247
  const source = cache3.source;
17059
17248
  for (const [sheetIndex2, sheet] of workbook.sheets.entries()) {
17060
17249
  if (source.kind === "table") {
17061
- const table2 = sheet.tables.find((entry) => entry.id === source.tableId);
17062
- const offset2 = table2?.columns.findIndex((column2) => column2.sourceId === source.column) ?? -1;
17063
- if (table2 && offset2 >= 0) return { kind: "table", sheet, sheetIndex: sheetIndex2, table: table2, offset: offset2 };
17250
+ const table3 = sheet.tables.find((entry) => entry.id === source.tableId);
17251
+ const offset2 = table3?.columns.findIndex((column2) => column2.sourceId === source.column) ?? -1;
17252
+ if (table3 && offset2 >= 0) return { kind: "table", sheet, sheetIndex: sheetIndex2, table: table3, offset: offset2 };
17064
17253
  } else {
17065
17254
  const first2 = source.pivots[0];
17066
17255
  const pivot = first2 && sheet.sheetId === first2.tabId ? sheet.pivotTables?.find((entry) => entry.name === first2.name) : void 0;
@@ -17286,12 +17475,12 @@ function rewriteSheetFormulas(sheet, rewrite, formulaCells) {
17286
17475
  }
17287
17476
  {
17288
17477
  const name = sheet.name;
17289
- for (const table2 of sheet.tables)
17290
- for (const [index2, column2] of table2.columns.entries())
17478
+ for (const table3 of sheet.tables)
17479
+ for (const [index2, column2] of table3.columns.entries())
17291
17480
  if (column2.calculatedColumnFormula !== void 0)
17292
17481
  column2.calculatedColumnFormula = safe(rewrite, column2.calculatedColumnFormula, name, {
17293
- row: table2.range.start.row + (table2.headerRow ? 1 : 0),
17294
- col: table2.range.start.col + index2
17482
+ row: table3.range.start.row + (table3.headerRow ? 1 : 0),
17483
+ col: table3.range.start.col + index2
17295
17484
  });
17296
17485
  if (formulaCells) {
17297
17486
  for (const at of formulaCells) {
@@ -17356,14 +17545,14 @@ function tableHeaderAt(sheet, row2, col) {
17356
17545
  );
17357
17546
  }
17358
17547
  function syncTableHeader(ctx, sheet, row2, col, formulaCells) {
17359
- const table2 = tableHeaderAt(sheet, row2, col);
17360
- if (!table2) return;
17361
- const column2 = table2.columns[col - table2.range.start.col];
17548
+ const table3 = tableHeaderAt(sheet, row2, col);
17549
+ if (!table3) return;
17550
+ const column2 = table3.columns[col - table3.range.start.col];
17362
17551
  if (!column2) return;
17363
17552
  const text2 = displayText(ctx.workbook, getCell(sheet, row2, col)).trim();
17364
17553
  if (!text2 || column2.name === text2) return;
17365
17554
  const oldName = column2.name;
17366
- const others = table2.columns.filter((entry) => entry !== column2).map((entry) => entry.name);
17555
+ const others = table3.columns.filter((entry) => entry !== column2).map((entry) => entry.name);
17367
17556
  const newName = uniqueHeaders([...others, text2]).at(-1);
17368
17557
  column2.name = newName;
17369
17558
  if (newName !== text2) writeValue(sheet, row2, col, newName);
@@ -17373,10 +17562,10 @@ function syncTableHeader(ctx, sheet, row2, col, formulaCells) {
17373
17562
  ctx.workbook,
17374
17563
  (formula, formulaSheet, at) => renameTableColumnInFormula(
17375
17564
  formula,
17376
- table2.name,
17565
+ table3.name,
17377
17566
  oldName,
17378
17567
  newName,
17379
- formulaSheet === sheet.name && !!at && rangeContains(table2.range, at)
17568
+ formulaSheet === sheet.name && !!at && rangeContains(table3.range, at)
17380
17569
  ),
17381
17570
  cells
17382
17571
  );
@@ -18500,11 +18689,11 @@ function uniqueColumnName(columns) {
18500
18689
  const taken = new Set(columns.map((c) => c.name.toLowerCase()));
18501
18690
  for (let n = 1; ; n++) if (!taken.has(`column${n}`)) return `Column${n}`;
18502
18691
  }
18503
- function shiftTable(sheet, table2, shift2, moveRange) {
18504
- const old = table2.range;
18692
+ function shiftTable(sheet, table3, shift2, moveRange) {
18693
+ const old = table3.range;
18505
18694
  const range2 = moveRange(old);
18506
18695
  if (!range2) return [];
18507
- const next = { ...table2, range: range2, columns: [...table2.columns] };
18696
+ const next = { ...table3, range: range2, columns: [...table3.columns] };
18508
18697
  const widened = range2.end.col - range2.start.col !== old.end.col - old.start.col;
18509
18698
  if (shift2.axis === "col" && widened) {
18510
18699
  if (shift2.count > 0) {
@@ -18980,8 +19169,8 @@ function cellText(inner2) {
18980
19169
  ).replace(/ /g, " ").trim();
18981
19170
  }
18982
19171
  function parseHtmlTable(html, base) {
18983
- const table2 = /<table\b[^>]*>([\s\S]*?)<\/table>/i.exec(html)?.[1];
18984
- if (table2 === void 0) return void 0;
19172
+ const table3 = /<table\b[^>]*>([\s\S]*?)<\/table>/i.exec(html)?.[1];
19173
+ if (table3 === void 0) return void 0;
18985
19174
  const classes = /* @__PURE__ */ new Map();
18986
19175
  for (const block of html.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi))
18987
19176
  for (const rule of removeAll(block[1] ?? "", ["<!--", "-->"]).matchAll(
@@ -18994,7 +19183,7 @@ function parseHtmlTable(html, base) {
18994
19183
  const hyperlinks = [];
18995
19184
  let r = 0;
18996
19185
  let spanned = 0;
18997
- for (const tr of table2.matchAll(/<tr\b[^>]*>([\s\S]*?)(?=<tr\b|<\/tbody|<\/table|$)/gi)) {
19186
+ for (const tr of table3.matchAll(/<tr\b[^>]*>([\s\S]*?)(?=<tr\b|<\/tbody|<\/table|$)/gi)) {
18998
19187
  const row2 = grid6[r] ??= [];
18999
19188
  let c = 0;
19000
19189
  for (const td of (tr[1] ?? "").matchAll(
@@ -19846,9 +20035,9 @@ function filterColumn(ctx, s, col, values2) {
19846
20035
  }
19847
20036
  function sortByColumn(ctx, s, col, descending) {
19848
20037
  const sheet = sheetAt(ctx.workbook, s);
19849
- const table2 = sheet.tables.find((t) => col >= t.range.start.col && col <= t.range.end.col);
20038
+ const table3 = sheet.tables.find((t) => col >= t.range.start.col && col <= t.range.end.col);
19850
20039
  const filter2 = sheet.autoFilter;
19851
- const target2 = table2 ? { range: table2.range, header: table2.headerRow, totals: table2.totalsRow } : filter2 && rangeContains(filter2.range, { row: filter2.range.start.row, col }) ? { range: filter2.range, header: true, totals: false } : void 0;
20040
+ const target2 = table3 ? { range: table3.range, header: table3.headerRow, totals: table3.totalsRow } : filter2 && rangeContains(filter2.range, { row: filter2.range.start.row, col }) ? { range: filter2.range, header: true, totals: false } : void 0;
19852
20041
  if (!target2) throw new Error("The column is not inside a table or an auto-filter range.");
19853
20042
  const range2 = target2.totals ? { start: target2.range.start, end: { ...target2.range.end, row: target2.range.end.row - 1 } } : target2.range;
19854
20043
  ctx.run(
@@ -19908,12 +20097,12 @@ function restore(sheet, saved) {
19908
20097
  Object.assign(cell, saved.fields);
19909
20098
  }
19910
20099
  var valueAt = (sheet, row2, col) => getCell(sheet, row2, col)?.value ?? null;
19911
- function computeDataTable(workbook, calc, sheetIndex2, table2) {
20100
+ function computeDataTable(workbook, calc, sheetIndex2, table3) {
19912
20101
  const sheet = sheetAt(workbook, sheetIndex2);
19913
- const { ref } = table2;
19914
- const first2 = parseInputCell(sheet, table2.r1);
19915
- const second = table2.dt2D && table2.r2 ? parseInputCell(sheet, table2.r2) : void 0;
19916
- if (!first2 || table2.dt2D && !second || table2.del1 || table2.del2) return [];
20102
+ const { ref } = table3;
20103
+ const first2 = parseInputCell(sheet, table3.r1);
20104
+ const second = table3.dt2D && table3.r2 ? parseInputCell(sheet, table3.r2) : void 0;
20105
+ if (!first2 || table3.dt2D && !second || table3.del1 || table3.del2) return [];
19917
20106
  const inputs = [first2, ...second ? [second] : []];
19918
20107
  const saved = inputs.map((p) => save(sheet, p.row, p.col));
19919
20108
  const top = ref.start.row - 1;
@@ -19932,11 +20121,11 @@ function computeDataTable(workbook, calc, sheetIndex2, table2) {
19932
20121
  for (let row2 = ref.start.row; row2 <= ref.end.row; row2++) {
19933
20122
  for (let col = ref.start.col; col <= ref.end.col; col++) {
19934
20123
  let formulaAt;
19935
- if (table2.dt2D) {
20124
+ if (table3.dt2D) {
19936
20125
  set(first2, valueAt(sheet, top, col));
19937
20126
  if (second) set(second, valueAt(sheet, row2, left2));
19938
20127
  formulaAt = { row: top, col: left2 };
19939
- } else if (table2.dtr) {
20128
+ } else if (table3.dtr) {
19940
20129
  set(first2, valueAt(sheet, top, col));
19941
20130
  formulaAt = { row: row2, col: left2 };
19942
20131
  } else {
@@ -19961,8 +20150,8 @@ function computeDataTable(workbook, calc, sheetIndex2, table2) {
19961
20150
  function refreshDataTables(workbook, calc) {
19962
20151
  const changed = [];
19963
20152
  workbook.sheets.forEach((sheet, index2) => {
19964
- for (const table2 of sheet.dataTables ?? [])
19965
- changed.push(...computeDataTable(workbook, calc, index2, table2));
20153
+ for (const table3 of sheet.dataTables ?? [])
20154
+ changed.push(...computeDataTable(workbook, calc, index2, table3));
19966
20155
  });
19967
20156
  if (changed.length) calc.recalculateFrom(changed);
19968
20157
  }
@@ -19985,23 +20174,23 @@ function resolve2(sheet, request) {
19985
20174
  const ref = cellRange(range2.start.row + 1, range2.start.col + 1, range2.end.row, range2.end.col);
19986
20175
  if ([row2, col].some((p) => p && rangeContains(ref, p))) return { problem: "input-inside" };
19987
20176
  const name = (p) => formatAddress(p);
19988
- const table2 = { ref, r1: "" };
20177
+ const table3 = { ref, r1: "" };
19989
20178
  if (row2 && col) {
19990
- table2.dt2D = true;
19991
- table2.dtr = true;
19992
- table2.r1 = name(row2);
19993
- table2.r2 = name(col);
20179
+ table3.dt2D = true;
20180
+ table3.dtr = true;
20181
+ table3.r1 = name(row2);
20182
+ table3.r2 = name(col);
19994
20183
  } else if (row2) {
19995
- table2.dtr = true;
19996
- table2.r1 = name(row2);
19997
- } else if (col) table2.r1 = name(col);
19998
- return { table: table2 };
20184
+ table3.dtr = true;
20185
+ table3.r1 = name(row2);
20186
+ } else if (col) table3.r1 = name(col);
20187
+ return { table: table3 };
19999
20188
  }
20000
20189
  function createDataTable(ctx, s, request) {
20001
20190
  const sheet = sheetAt(ctx.workbook, s);
20002
20191
  const result2 = resolve2(sheet, request);
20003
20192
  if ("problem" in result2) throw new Error(MESSAGES[result2.problem]);
20004
- const { table: table2 } = result2;
20193
+ const { table: table3 } = result2;
20005
20194
  const range2 = normalizeRange(request.range);
20006
20195
  ctx.run(
20007
20196
  "Data Table",
@@ -20012,16 +20201,16 @@ function createDataTable(ctx, s, request) {
20012
20201
  ],
20013
20202
  () => {
20014
20203
  sheet.dataTables = (sheet.dataTables ?? []).filter((t) => !rangesIntersect(t.ref, range2));
20015
- sheet.dataTables.push(table2);
20016
- for (let row2 = table2.ref.start.row; row2 <= table2.ref.end.row; row2++)
20017
- for (let col = table2.ref.start.col; col <= table2.ref.end.col; col++) {
20204
+ sheet.dataTables.push(table3);
20205
+ for (let row2 = table3.ref.start.row; row2 <= table3.ref.end.row; row2++)
20206
+ for (let col = table3.ref.start.col; col <= table3.ref.end.col; col++) {
20018
20207
  const cell = ensureCell(sheet, row2, col);
20019
20208
  delete cell.formula;
20020
20209
  delete cell.arrayRange;
20021
20210
  delete cell.legacyFormula;
20022
20211
  delete cell.dynamicArray;
20023
20212
  }
20024
- computeDataTable(ctx.workbook, ctx.calc, s, table2);
20213
+ computeDataTable(ctx.workbook, ctx.calc, s, table3);
20025
20214
  },
20026
20215
  { sheet: s, ranges: [range2] }
20027
20216
  );
@@ -21258,7 +21447,7 @@ function pixelSizeToExtent(width, height) {
21258
21447
  }
21259
21448
 
21260
21449
  // xlsx/pivot/date-axes.ts
21261
- var dateGroupAxisNames = (group) => dateGroupUnits(group).reverse().map((unit) => dateGroupFieldName(unit, group.field));
21450
+ var dateGroupAxisNames = (group) => dateGroupUnits(group).reverse().map((unit) => dateGroupFieldName(unit, group.field, group));
21262
21451
  function replace(list, names, replacement) {
21263
21452
  const at = list.findIndex((name) => names.includes(name));
21264
21453
  if (at < 0) return list;
@@ -21294,7 +21483,9 @@ function reconcileDateAxes(next, previous) {
21294
21483
  if (columns.length > 1) next.moreColumnFields = columns.slice(1);
21295
21484
  else delete next.moreColumnFields;
21296
21485
  if (next.fieldSubtotals) {
21297
- const kept = next.fieldSubtotals.filter((entry) => rows2.includes(entry.field));
21486
+ const kept = next.fieldSubtotals.filter(
21487
+ (entry) => rows2.includes(entry.field) || columns.includes(entry.field)
21488
+ );
21298
21489
  if (kept.length) next.fieldSubtotals = kept;
21299
21490
  else delete next.fieldSubtotals;
21300
21491
  }
@@ -21336,7 +21527,7 @@ function plan(ctx, s, pivot, old) {
21336
21527
  if (![start.row, start.col].every(Number.isInteger) || start.row < 0 || start.col < 0 || location.end.row > MAX_ROW || location.end.col > MAX_COL)
21337
21528
  throw new Error("The PivotTable result does not fit on the worksheet.");
21338
21529
  const source = sparklineDataRange(ctx.workbook, s, pivot.source);
21339
- if (source.sheet === s && rangesIntersect(source.range, location) || sheet.merges.some((range2) => rangesIntersect(range2, location)) || sheet.tables.some((table2) => rangesIntersect(table2.range, location)) || sheet.pivotTables?.some((other) => other !== old && rangesIntersect(other.location, location)))
21530
+ if (source.sheet === s && rangesIntersect(source.range, location) || sheet.merges.some((range2) => rangesIntersect(range2, location)) || sheet.tables.some((table3) => rangesIntersect(table3.range, location)) || sheet.pivotTables?.some((other) => other !== old && rangesIntersect(other.location, location)))
21340
21531
  throw new Error("The PivotTable would overlap source data, another table or merged cells.");
21341
21532
  let occupied = false;
21342
21533
  forEachCellInRange(sheet, location, (cell, row2, col) => {
@@ -21346,12 +21537,12 @@ function plan(ctx, s, pivot, old) {
21346
21537
  if (occupied) throw new Error("The PivotTable would overwrite existing cell content.");
21347
21538
  return { grid: grid6, location };
21348
21539
  }
21349
- function writePivot(ctx, s, pivot, old, label5, inside) {
21540
+ function writePivot(ctx, s, pivot, old, label2, inside) {
21350
21541
  const sheet = sheetAt(ctx.workbook, s);
21351
21542
  const { grid: grid6, location } = plan(ctx, s, pivot, old);
21352
21543
  const ranges = [...old ? [old.location] : [], location];
21353
21544
  ctx.run(
21354
- label5 ?? (old ? "Refresh PivotTable" : "Create PivotTable"),
21545
+ label2 ?? (old ? "Refresh PivotTable" : "Create PivotTable"),
21355
21546
  "annotations",
21356
21547
  [
21357
21548
  { kind: "parts", sheet: s, parts: ["pivotTables"] },
@@ -21408,8 +21599,10 @@ function createPivotTable(ctx, s, destination, options6) {
21408
21599
  const name = options6.name ?? uniqueName(ctx);
21409
21600
  checkName2(ctx, name);
21410
21601
  const aggregate2 = options6.aggregate ?? "sum";
21602
+ const captions = authoredCaptions(options6);
21411
21603
  const pivot = {
21412
21604
  ...data,
21605
+ ...captions ? { captions } : {},
21413
21606
  name,
21414
21607
  rowField: options6.rowField,
21415
21608
  layout: options6.layout ?? "tabular",
@@ -21423,12 +21616,12 @@ function createPivotTable(ctx, s, destination, options6) {
21423
21616
  ...options6.repeatLabels !== void 0 ? { repeatLabels: options6.repeatLabels } : {},
21424
21617
  valueField: options6.valueField,
21425
21618
  aggregate: aggregate2,
21426
- valueCaption: pivotCaption(aggregate2, options6.valueField),
21619
+ valueCaption: pivotCaption(aggregate2, options6.valueField, { captions }),
21427
21620
  ...options6.pageFilter !== void 0 ? { pageFilter: structuredClone(options6.pageFilter) } : {},
21428
21621
  ...options6.fieldGroups?.length ? { fieldGroups: structuredClone(options6.fieldGroups) } : {},
21429
21622
  ...options6.valuesAxis !== void 0 ? { valuesAxis: options6.valuesAxis } : {},
21430
21623
  ...options6.valuesPosition !== void 0 ? { valuesPosition: options6.valuesPosition } : {},
21431
- ...options6.additionalValues ? { additionalValues: normalizedPivotMeasures(options6.additionalValues) } : {},
21624
+ ...options6.additionalValues ? { additionalValues: normalizedPivotMeasures(options6.additionalValues, { captions }) } : {},
21432
21625
  location: { start: { ...destination }, end: { ...destination } },
21433
21626
  ...options6.columnField ? { columnField: options6.columnField } : {},
21434
21627
  ...options6.columnField && options6.moreColumnFields?.length ? { moreColumnFields: [...options6.moreColumnFields] } : {}
@@ -21451,7 +21644,7 @@ function refreshPivotTable(ctx, s, name, patch2 = {}) {
21451
21644
  rowField: patch2.rowField ?? old.rowField,
21452
21645
  valueField,
21453
21646
  aggregate: aggregate2,
21454
- valueCaption: aggregate2 === old.aggregate && valueField === old.valueField ? old.valueCaption : pivotCaption(aggregate2, valueField)
21647
+ valueCaption: aggregate2 === old.aggregate && valueField === old.valueField ? old.valueCaption : pivotCaption(aggregate2, valueField, old)
21455
21648
  };
21456
21649
  if (patch2.columnField !== void 0) {
21457
21650
  if (patch2.columnField) next.columnField = patch2.columnField;
@@ -21501,7 +21694,7 @@ function refreshPivotTable(ctx, s, name, patch2 = {}) {
21501
21694
  else if (patch2.valuesAxis === "columns" || patch2.secondRowField === "")
21502
21695
  delete next.valuesPosition;
21503
21696
  if (patch2.additionalValues !== void 0) {
21504
- const measures = normalizedPivotMeasures(patch2.additionalValues);
21697
+ const measures = normalizedPivotMeasures(patch2.additionalValues, old);
21505
21698
  if (measures.length) next.additionalValues = measures;
21506
21699
  else delete next.additionalValues;
21507
21700
  }
@@ -21510,6 +21703,12 @@ function refreshPivotTable(ctx, s, name, patch2 = {}) {
21510
21703
  else delete next.dateFields;
21511
21704
  roundDateRecords(next, dates, ctx.workbook.date1904);
21512
21705
  if (next.dateFilter && !dates.includes(next.dateFilter.field)) delete next.dateFilter;
21706
+ if (patch2.fieldSubtotals === void 0 && next.fieldSubtotals) {
21707
+ const onAxes = [...pivotRowFields(next), ...pivotColumnFields(next)];
21708
+ const left2 = next.fieldSubtotals.filter((entry) => onAxes.includes(entry.field));
21709
+ if (left2.length) next.fieldSubtotals = left2;
21710
+ else delete next.fieldSubtotals;
21711
+ }
21513
21712
  const kept = pruneItemFilters(next);
21514
21713
  if (kept) next.itemFilters = kept;
21515
21714
  else delete next.itemFilters;
@@ -21965,10 +22164,10 @@ function validatePatch(group, patch2) {
21965
22164
  delete next.manualMax;
21966
22165
  validateSettings(next);
21967
22166
  }
21968
- function save2(ctx, s, next, label5, ranges) {
22167
+ function save2(ctx, s, next, label2, ranges) {
21969
22168
  const sheet = sheetAt(ctx.workbook, s);
21970
22169
  ctx.run(
21971
- label5,
22170
+ label2,
21972
22171
  "annotations",
21973
22172
  [{ kind: "parts", sheet: s, parts: ["preserved"] }],
21974
22173
  () => sheet.preserved.set("extLst", next),
@@ -22086,20 +22285,20 @@ function setSlicerSelection(ctx, cacheName, keys) {
22086
22285
  const target2 = slicerTarget(ctx.workbook, cache3);
22087
22286
  if (!target2) throw new Error("The slicer has no data source.");
22088
22287
  if (target2.kind === "table") {
22089
- const { sheet, table: table2, offset: offset2 } = target2;
22288
+ const { sheet, table: table3, offset: offset2 } = target2;
22090
22289
  ctx.run(
22091
22290
  keys === null ? "Clear slicer filter" : "Filter slicer",
22092
22291
  "view",
22093
22292
  [{ kind: "sheet", sheet: target2.sheetIndex }],
22094
22293
  () => {
22095
- const column2 = table2.columns[offset2];
22294
+ const column2 = table3.columns[offset2];
22096
22295
  if (keys === null) delete column2.filter;
22097
22296
  else
22098
22297
  column2.filter = {
22099
22298
  values: keys.filter((key) => key !== ""),
22100
22299
  ...keys.includes("") ? { blank: true } : {}
22101
22300
  };
22102
- applyTableFilter(ctx.workbook, sheet, table2);
22301
+ applyTableFilter(ctx.workbook, sheet, table3);
22103
22302
  },
22104
22303
  { sheet: target2.sheetIndex, structural: true }
22105
22304
  );
@@ -22170,17 +22369,17 @@ function unique2(base, taken) {
22170
22369
  function insertSlicer(ctx, s, ref) {
22171
22370
  const { workbook } = ctx;
22172
22371
  const sheet = sheetAt(workbook, s);
22173
- let table2;
22372
+ let table3;
22174
22373
  let pivot;
22175
22374
  let field;
22176
22375
  if (ref.kind === "table") {
22177
- table2 = sheet.tables.find(
22376
+ table3 = sheet.tables.find(
22178
22377
  (entry) => entry.name === ref.table || entry.displayName === ref.table
22179
22378
  );
22180
- if (!table2?.headerRow || table2.filterNotModeled)
22379
+ if (!table3?.headerRow || table3.filterNotModeled)
22181
22380
  throw new Error("Choose a table with a header row and value filters.");
22182
22381
  field = ref.column;
22183
- if (!table2.columns.some((column2) => column2.name === field))
22382
+ if (!table3.columns.some((column2) => column2.name === field))
22184
22383
  throw new Error("Choose a column of the table.");
22185
22384
  } else {
22186
22385
  pivot = sheet.pivotTables?.find((entry) => entry.name === ref.pivot);
@@ -22200,7 +22399,7 @@ function insertSlicer(ctx, s, ref) {
22200
22399
  (c) => names.has(c.toLowerCase())
22201
22400
  ).replace(/ /g, "_");
22202
22401
  const metrics = createGridMetrics(sheet, { zoom: 100 });
22203
- const anchorCell = table2 ? { row: table2.range.start.row, col: table2.range.end.col + 2 } : { row: pivot.location.start.row, col: pivot.location.end.col + 2 };
22402
+ const anchorCell = table3 ? { row: table3.range.start.row, col: table3.range.end.col + 2 } : { row: pivot.location.start.row, col: pivot.location.end.col + 2 };
22204
22403
  const x = Math.max(metrics.colLeft(anchorCell.col), frameBounds(sheet) + 10);
22205
22404
  const box2 = { x, y: metrics.rowTop(anchorCell.row), ...SLICER_BOX };
22206
22405
  const anchor = pixelBoxToAnchor(sheet, box2, metrics, "twoCell");
@@ -22217,13 +22416,13 @@ function insertSlicer(ctx, s, ref) {
22217
22416
  () => {
22218
22417
  const book = cloneBook(workbook);
22219
22418
  let source;
22220
- if (table2) {
22221
- if (table2.columns.some((column2) => column2.sourceId === void 0))
22222
- table2.columns.forEach((column2, index2) => column2.sourceId ??= index2 + 1);
22419
+ if (table3) {
22420
+ if (table3.columns.some((column2) => column2.sourceId === void 0))
22421
+ table3.columns.forEach((column2, index2) => column2.sourceId ??= index2 + 1);
22223
22422
  source = {
22224
22423
  kind: "table",
22225
- tableId: table2.id,
22226
- column: table2.columns.find((column2) => column2.name === field).sourceId
22424
+ tableId: table3.id,
22425
+ column: table3.columns.find((column2) => column2.name === field).sourceId
22227
22426
  };
22228
22427
  } else {
22229
22428
  const target2 = pivot;
@@ -22487,9 +22686,9 @@ var SUBTOTAL = {
22487
22686
  var: 110
22488
22687
  };
22489
22688
  var escapeColumn = (name) => name.replace(/['#[\]]/g, "'$&");
22490
- function applyTotalsRow(sheet, table2) {
22491
- const row2 = table2.range.end.row;
22492
- const { columns } = table2;
22689
+ function applyTotalsRow(sheet, table3) {
22690
+ const row2 = table3.range.end.row;
22691
+ const { columns } = table3;
22493
22692
  if (!columns.some((c) => c.totalsRowFunction || c.totalsRowLabel)) {
22494
22693
  const first2 = columns[0];
22495
22694
  const last = columns[columns.length - 1];
@@ -22497,12 +22696,12 @@ function applyTotalsRow(sheet, table2) {
22497
22696
  if (last) last.totalsRowFunction = "sum";
22498
22697
  }
22499
22698
  columns.forEach((column2, i2) => {
22500
- const col = table2.range.start.col + i2;
22699
+ const col = table3.range.start.col + i2;
22501
22700
  const code = SUBTOTAL[column2.totalsRowFunction ?? ""];
22502
22701
  if (code !== void 0) {
22503
22702
  const cell = ensureCell(sheet, row2, col);
22504
22703
  clearContents(cell);
22505
- cell.formula = `SUBTOTAL(${code},${table2.name}[${escapeColumn(column2.name)}])`;
22704
+ cell.formula = `SUBTOTAL(${code},${table3.name}[${escapeColumn(column2.name)}])`;
22506
22705
  } else if (column2.totalsRowLabel && column2.totalsRowFunction !== "custom")
22507
22706
  writeValue(sheet, row2, col, column2.totalsRowLabel);
22508
22707
  });
@@ -22526,8 +22725,8 @@ function validateTableName(workbook, name, self) {
22526
22725
  ) || workbook.definedNames.some((n) => n.name.toLowerCase() === lower3);
22527
22726
  return taken ? "That name is already used by another table or name." : void 0;
22528
22727
  }
22529
- function renameTableIn(workbook, table2, name) {
22530
- const old = table2.name;
22728
+ function renameTableIn(workbook, table3, name) {
22729
+ const old = table3.name;
22531
22730
  if (old === name) return;
22532
22731
  const rename = (f6) => renameTableInFormula(f6, old, name);
22533
22732
  rewriteFormulas(workbook, rename);
@@ -22536,73 +22735,73 @@ function renameTableIn(workbook, table2, name) {
22536
22735
  for (const column2 of t.columns)
22537
22736
  if (column2.calculatedColumnFormula)
22538
22737
  column2.calculatedColumnFormula = rename(column2.calculatedColumnFormula);
22539
- table2.name = name;
22540
- table2.displayName = name;
22738
+ table3.name = name;
22739
+ table3.displayName = name;
22541
22740
  }
22542
22741
  var byId = (sheet, id) => {
22543
- const table2 = sheet.tables.find((t) => t.id === id);
22544
- if (!table2) throw new Error("The table disappeared during the edit.");
22545
- return table2;
22742
+ const table3 = sheet.tables.find((t) => t.id === id);
22743
+ if (!table3) throw new Error("The table disappeared during the edit.");
22744
+ return table3;
22546
22745
  };
22547
- function insertBandRow(workbook, sheet, table2, row2) {
22746
+ function insertBandRow(workbook, sheet, table3, row2) {
22548
22747
  const shift2 = { axis: "row", at: row2, count: 1 };
22549
- const band = { lo: table2.range.start.col, hi: table2.range.end.col };
22748
+ const band = { lo: table3.range.start.col, hi: table3.range.end.col };
22550
22749
  assertInsertFits(sheet, shift2, band);
22551
22750
  rewriteFormulas(workbook, (f6, fs) => shiftFormulaInBand(f6, fs, sheet.name, shift2, band));
22552
22751
  shiftSheetContent(sheet, shift2, band);
22553
22752
  }
22554
22753
  function setHeaderRow(workbook, sheet, id, on) {
22555
- let table2 = byId(sheet, id);
22556
- if (table2.headerRow === on) return;
22557
- const { start, end } = table2.range;
22754
+ let table3 = byId(sheet, id);
22755
+ if (table3.headerRow === on) return;
22756
+ const { start, end } = table3.range;
22558
22757
  if (!on) {
22559
22758
  if (start.row === end.row) throw new Error("A table needs at least one row.");
22560
22759
  clearRow(sheet, start.row, start.col, end.col);
22561
- table2.range = { start: { row: start.row + 1, col: start.col }, end };
22562
- table2.headerRow = false;
22760
+ table3.range = { start: { row: start.row + 1, col: start.col }, end };
22761
+ table3.headerRow = false;
22563
22762
  return;
22564
22763
  }
22565
22764
  if (start.row === 0 || !rowIsEmpty(sheet, start.row - 1, start.col, end.col)) {
22566
- insertBandRow(workbook, sheet, table2, start.row);
22567
- table2 = byId(sheet, id);
22568
- }
22569
- const top = table2.range.start.row - 1;
22570
- const left2 = table2.range.start.col;
22571
- table2.range = { start: { row: top, col: left2 }, end: table2.range.end };
22572
- table2.headerRow = true;
22573
- uniqueHeaders(table2.columns.map((c) => c.name)).forEach((name, i2) => {
22574
- const column2 = table2.columns[i2];
22765
+ insertBandRow(workbook, sheet, table3, start.row);
22766
+ table3 = byId(sheet, id);
22767
+ }
22768
+ const top = table3.range.start.row - 1;
22769
+ const left2 = table3.range.start.col;
22770
+ table3.range = { start: { row: top, col: left2 }, end: table3.range.end };
22771
+ table3.headerRow = true;
22772
+ uniqueHeaders(table3.columns.map((c) => c.name)).forEach((name, i2) => {
22773
+ const column2 = table3.columns[i2];
22575
22774
  if (column2) column2.name = name;
22576
22775
  writeValue(sheet, top, left2 + i2, name);
22577
22776
  });
22578
22777
  }
22579
22778
  function setTotalsRow(workbook, sheet, id, on) {
22580
- let table2 = byId(sheet, id);
22581
- if (table2.totalsRow === on) return;
22582
- const { start, end } = table2.range;
22779
+ let table3 = byId(sheet, id);
22780
+ if (table3.totalsRow === on) return;
22781
+ const { start, end } = table3.range;
22583
22782
  if (!on) {
22584
22783
  clearRow(sheet, end.row, start.col, end.col);
22585
- table2.range = { start, end: { row: end.row - 1, col: end.col } };
22586
- table2.totalsRow = false;
22784
+ table3.range = { start, end: { row: end.row - 1, col: end.col } };
22785
+ table3.totalsRow = false;
22587
22786
  return;
22588
22787
  }
22589
22788
  if (end.row === MAX_ROW) throw new RangeError("The insert area extends beyond the sheet.");
22590
22789
  if (!rowIsEmpty(sheet, end.row + 1, start.col, end.col)) {
22591
- insertBandRow(workbook, sheet, table2, end.row + 1);
22592
- table2 = byId(sheet, id);
22790
+ insertBandRow(workbook, sheet, table3, end.row + 1);
22791
+ table3 = byId(sheet, id);
22593
22792
  }
22594
- table2.range = { start: table2.range.start, end: { row: table2.range.end.row + 1, col: end.col } };
22595
- table2.totalsRow = true;
22596
- applyTotalsRow(sheet, table2);
22793
+ table3.range = { start: table3.range.start, end: { row: table3.range.end.row + 1, col: end.col } };
22794
+ table3.totalsRow = true;
22795
+ applyTotalsRow(sheet, table3);
22597
22796
  }
22598
- function resizedColumns(workbook, sheet, table2, range2) {
22797
+ function resizedColumns(workbook, sheet, table3, range2) {
22599
22798
  const width = range2.end.col - range2.start.col + 1;
22600
- const oldAt = (col) => col >= table2.range.start.col && col <= table2.range.end.col ? table2.columns[col - table2.range.start.col] : void 0;
22799
+ const oldAt = (col) => col >= table3.range.start.col && col <= table3.range.end.col ? table3.columns[col - table3.range.start.col] : void 0;
22601
22800
  const texts = Array.from({ length: width }, (_v, i2) => {
22602
22801
  const col = range2.start.col + i2;
22603
22802
  const old = oldAt(col);
22604
22803
  if (old) return old.name;
22605
- return table2.headerRow ? displayText(workbook, getCell(sheet, range2.start.row, col)) : "";
22804
+ return table3.headerRow ? displayText(workbook, getCell(sheet, range2.start.row, col)) : "";
22606
22805
  });
22607
22806
  return uniqueHeaders(texts).map((name, i2) => {
22608
22807
  const old = oldAt(range2.start.col + i2);
@@ -22610,30 +22809,30 @@ function resizedColumns(workbook, sheet, table2, range2) {
22610
22809
  });
22611
22810
  }
22612
22811
  function resizeTableIn(workbook, sheet, id, range2) {
22613
- const table2 = byId(sheet, id);
22812
+ const table3 = byId(sheet, id);
22614
22813
  const r = normalizeRange(range2);
22615
- if (table2.headerRow && r.start.row !== table2.range.start.row)
22814
+ if (table3.headerRow && r.start.row !== table3.range.start.row)
22616
22815
  throw new Error("The table headers must remain in the same row.");
22617
- if (!rangesIntersect(r, table2.range)) throw new Error("The new range must overlap the table.");
22618
- if (r.end.row - r.start.row + 1 < (table2.headerRow ? 2 : 1) + (table2.totalsRow ? 1 : 0))
22816
+ if (!rangesIntersect(r, table3.range)) throw new Error("The new range must overlap the table.");
22817
+ if (r.end.row - r.start.row + 1 < (table3.headerRow ? 2 : 1) + (table3.totalsRow ? 1 : 0))
22619
22818
  throw new Error("The table range is too small.");
22620
- if (sheet.tables.some((t) => t !== table2 && rangesIntersect(t.range, r)))
22819
+ if (sheet.tables.some((t) => t !== table3 && rangesIntersect(t.range, r)))
22621
22820
  throw new Error("A table cannot overlap another table.");
22622
22821
  if (sheet.pivotTables?.some((pivot) => rangesIntersect(pivot.location, r)))
22623
22822
  throw new Error("A table cannot overlap a PivotTable.");
22624
22823
  if (sheet.merges.some((m) => rangesIntersect(m, r)))
22625
22824
  throw new Error("A table cannot contain merged cells.");
22626
- const oldEnd = table2.range.end.row;
22627
- table2.columns = resizedColumns(workbook, sheet, table2, r);
22628
- table2.range = r;
22629
- if (table2.headerRow)
22630
- table2.columns.forEach((column2, i2) => {
22825
+ const oldEnd = table3.range.end.row;
22826
+ table3.columns = resizedColumns(workbook, sheet, table3, r);
22827
+ table3.range = r;
22828
+ if (table3.headerRow)
22829
+ table3.columns.forEach((column2, i2) => {
22631
22830
  const cell = getCell(sheet, r.start.row, r.start.col + i2);
22632
22831
  if (cell?.value !== column2.name) writeValue(sheet, r.start.row, r.start.col + i2, column2.name);
22633
22832
  });
22634
- if (table2.totalsRow) {
22833
+ if (table3.totalsRow) {
22635
22834
  if (oldEnd !== r.end.row) clearRow(sheet, oldEnd, r.start.col, r.end.col);
22636
- applyTotalsRow(sheet, table2);
22835
+ applyTotalsRow(sheet, table3);
22637
22836
  }
22638
22837
  }
22639
22838
  var STYLE_KEYS = [
@@ -22661,20 +22860,20 @@ function updateTable(ctx, s, ref, patch2) {
22661
22860
  "structure",
22662
22861
  [scope],
22663
22862
  () => {
22664
- const table2 = byId(sheet, id);
22665
- if (renaming) renameTableIn(workbook, table2, name);
22863
+ const table3 = byId(sheet, id);
22864
+ if (renaming) renameTableIn(workbook, table3, name);
22666
22865
  for (const key of STYLE_KEYS) {
22667
22866
  if (!(key in patch2)) continue;
22668
22867
  const value2 = patch2[key];
22669
- if (value2 === void 0) delete table2[key];
22670
- else table2[key] = value2;
22868
+ if (value2 === void 0) delete table3[key];
22869
+ else table3[key] = value2;
22671
22870
  }
22672
22871
  if (patch2.columns) {
22673
- const width = table2.range.end.col - table2.range.start.col + 1;
22872
+ const width = table3.range.end.col - table3.range.start.col + 1;
22674
22873
  if (patch2.columns.length !== width) throw new Error("Give one column per table column.");
22675
- const before = table2.columns;
22676
- table2.columns = structuredClone(patch2.columns);
22677
- for (const [index2, column2] of table2.columns.entries()) {
22874
+ const before = table3.columns;
22875
+ table3.columns = structuredClone(patch2.columns);
22876
+ for (const [index2, column2] of table3.columns.entries()) {
22678
22877
  const sourceId = before[index2]?.sourceId;
22679
22878
  if (column2.sourceId === void 0 && sourceId !== void 0) column2.sourceId = sourceId;
22680
22879
  const filter2 = before[index2]?.filter;
@@ -22683,7 +22882,7 @@ function updateTable(ctx, s, ref, patch2) {
22683
22882
  }
22684
22883
  if (patch2.headerRow !== void 0) setHeaderRow(workbook, sheet, id, patch2.headerRow);
22685
22884
  if (patch2.totalsRow !== void 0) setTotalsRow(workbook, sheet, id, patch2.totalsRow);
22686
- else if (patch2.columns && table2.totalsRow) applyTotalsRow(sheet, byId(sheet, id));
22885
+ else if (patch2.columns && table3.totalsRow) applyTotalsRow(sheet, byId(sheet, id));
22687
22886
  if (patch2.range) resizeTableIn(workbook, sheet, id, patch2.range);
22688
22887
  },
22689
22888
  { sheet: s, ranges: [current.range], structural: true }
@@ -22703,13 +22902,13 @@ function resizeTable(ctx, s, ref, range2) {
22703
22902
  function convertTableToRange(ctx, s, ref) {
22704
22903
  const { workbook } = ctx;
22705
22904
  const sheet = sheetAt(workbook, s);
22706
- const table2 = sheet.tables[tableIndex(sheet, ref)];
22905
+ const table3 = sheet.tables[tableIndex(sheet, ref)];
22707
22906
  ctx.run(
22708
22907
  "Convert to range",
22709
22908
  "structure",
22710
22909
  [{ kind: "workbook" }],
22711
22910
  () => {
22712
- const live = byId(sheet, table2.id);
22911
+ const live = byId(sheet, table3.id);
22713
22912
  const base = { table: live, tableSheet: sheet.name };
22714
22913
  const { start, end } = live.range;
22715
22914
  for (const ws of workbook.sheets)
@@ -22734,7 +22933,7 @@ function convertTableToRange(ctx, s, ref) {
22734
22933
  });
22735
22934
  sheet.tables = sheet.tables.filter((t) => t.id !== live.id);
22736
22935
  },
22737
- { sheet: s, ranges: [table2.range], structural: true }
22936
+ { sheet: s, ranges: [table3.range], structural: true }
22738
22937
  );
22739
22938
  }
22740
22939
 
@@ -25650,7 +25849,7 @@ function createTable(ctx, s, range2, hasHeader, styleName = "TableStyleMedium2")
25650
25849
  });
25651
25850
  const name = nextTableName(workbook);
25652
25851
  const id = Math.max(0, ...workbook.sheets.flatMap((ws) => ws.tables.map((t) => t.id))) + 1;
25653
- const table2 = {
25852
+ const table3 = {
25654
25853
  id,
25655
25854
  name,
25656
25855
  displayName: name,
@@ -25664,8 +25863,8 @@ function createTable(ctx, s, range2, hasHeader, styleName = "TableStyleMedium2")
25664
25863
  showFirstColumn: false,
25665
25864
  showLastColumn: false
25666
25865
  };
25667
- sheet.tables.push(table2);
25668
- return table2;
25866
+ sheet.tables.push(table3);
25867
+ return table3;
25669
25868
  },
25670
25869
  { sheet: s, ranges: [r], structural: !hasHeader }
25671
25870
  );
@@ -25869,8 +26068,8 @@ function createEditSession(workbook, options6 = {}) {
25869
26068
  if (!workbook.warnings.includes(message)) workbook.warnings.push(message);
25870
26069
  }
25871
26070
  };
25872
- const begin = (label5, kind, info) => {
25873
- const step = { label: label5, entries: [], structural: info.structural ?? false };
26071
+ const begin = (label2, kind, info) => {
26072
+ const step = { label: label2, entries: [], structural: info.structural ?? false };
25874
26073
  if (info.calc) step.calc = info.calc;
25875
26074
  return { step, kind, sheet: info.sheet, ranges: [...info.ranges ?? []] };
25876
26075
  };
@@ -25894,7 +26093,7 @@ function createEditSession(workbook, options6 = {}) {
25894
26093
  }
25895
26094
  current.step.entries.length = from;
25896
26095
  };
25897
- const run = (label5, kind, scopes, fn, info = {}) => {
26096
+ const run = (label2, kind, scopes, fn, info = {}) => {
25898
26097
  if (kind === "cells") {
25899
26098
  for (const scope of scopes)
25900
26099
  if (scope.kind === "cells" && workbook.sheets[scope.sheet]?.pivotTables?.some(
@@ -25911,7 +26110,7 @@ function createEditSession(workbook, options6 = {}) {
25911
26110
  }))
25912
26111
  throw new Error(DATA_TABLE_PART_ERROR);
25913
26112
  const outer = !open;
25914
- const current = open ?? begin(label5, kind, info);
26113
+ const current = open ?? begin(label2, kind, info);
25915
26114
  if (!outer) {
25916
26115
  delete current.step.calc;
25917
26116
  if (info.structural) current.step.structural = true;
@@ -26042,9 +26241,9 @@ function createEditSession(workbook, options6 = {}) {
26042
26241
  removeConditionalFormat: (s, index2) => removeConditionalFormat(ctx, s, index2),
26043
26242
  setConditionalRulePriority: (s, f6, r, priority) => setConditionalRulePriority(ctx, s, f6, r, priority),
26044
26243
  moveConditionalRule: (s, f6, r, direction) => moveConditionalRule(ctx, s, f6, r, direction),
26045
- updateTable: (s, table2, patch2) => updateTable(ctx, s, table2, patch2),
26046
- resizeTable: (s, table2, range2) => resizeTable(ctx, s, table2, range2),
26047
- convertTableToRange: (s, table2) => convertTableToRange(ctx, s, table2),
26244
+ updateTable: (s, table3, patch2) => updateTable(ctx, s, table3, patch2),
26245
+ resizeTable: (s, table3, range2) => resizeTable(ctx, s, table3, range2),
26246
+ convertTableToRange: (s, table3) => convertTableToRange(ctx, s, table3),
26048
26247
  applyCellStyle: (s, ranges, name) => applyCellStyle(ctx, s, ranges, name),
26049
26248
  setPageSetup: (s, patch2) => setPageSetup(ctx, s, patch2),
26050
26249
  setPageBreak: (s, axis, before, present) => setPageBreak(ctx, s, axis, before, present),
@@ -26081,12 +26280,12 @@ function createEditSession(workbook, options6 = {}) {
26081
26280
  validate: (s, r, c, value2) => validateCellInput(workbook, s, r, c, value2, {
26082
26281
  evaluate: (formula, at) => calc.evaluate(formula, at)
26083
26282
  }),
26084
- batch(label5, fn) {
26283
+ batch(label2, fn) {
26085
26284
  if (open) {
26086
26285
  fn();
26087
26286
  return;
26088
26287
  }
26089
- const current = begin(label5, "batch", {});
26288
+ const current = begin(label2, "batch", {});
26090
26289
  open = current;
26091
26290
  try {
26092
26291
  fn();
@@ -27057,9 +27256,9 @@ function pickColor(arg) {
27057
27256
  if (arg && typeof arg === "object" && !arg.auto) return arg;
27058
27257
  return null;
27059
27258
  }
27060
- var toggle = (id, label5, glyph, shortcut, read, patch2) => editing({
27259
+ var toggle = (id, label2, glyph, shortcut, read, patch2) => editing({
27061
27260
  id,
27062
- label: label5,
27261
+ label: label2,
27063
27262
  icon: icon(glyph),
27064
27263
  shortcut,
27065
27264
  lock: "formatCells",
@@ -27244,10 +27443,10 @@ var mergedAtActive = (ctx) => {
27244
27443
  const t = target(ctx);
27245
27444
  return !!t && t.ws.merges.some((m) => rangesIntersect(m, t.range));
27246
27445
  };
27247
- function mergeCommand(id, label5, mode) {
27446
+ function mergeCommand(id, label2, mode) {
27248
27447
  return editing({
27249
27448
  id,
27250
- label: label5,
27449
+ label: label2,
27251
27450
  icon: icon("mergeCenter"),
27252
27451
  lock: "formatCells",
27253
27452
  ...mode === "center" ? { checked: mergedAtActive } : {},
@@ -27262,30 +27461,30 @@ function mergeCommand(id, label5, mode) {
27262
27461
  }
27263
27462
  if (t.ranges.some((range2) => mergeWouldDiscard(t.ws, range2, mode))) {
27264
27463
  const ok = await ctx.dialogs.open("confirm", {
27265
- heading: label5,
27464
+ heading: label2,
27266
27465
  message: "Merging cells only keeps the upper-left value and discards other values."
27267
27466
  });
27268
27467
  if (ok !== true) return;
27269
27468
  if (ctx.session() !== t.session || ctx.readOnly()) return;
27270
27469
  }
27271
- t.session.batch(label5, () => {
27470
+ t.session.batch(label2, () => {
27272
27471
  for (const range2 of t.ranges) t.session.merge(t.sheet, range2, mode);
27273
27472
  });
27274
27473
  }
27275
27474
  });
27276
27475
  }
27277
27476
  function alignmentCommands() {
27278
- const valign = (id, label5, value2, glyph) => editing({
27477
+ const valign = (id, label2, value2, glyph) => editing({
27279
27478
  id,
27280
- label: label5,
27479
+ label: label2,
27281
27480
  icon: icon(glyph),
27282
27481
  lock: "formatCells",
27283
27482
  checked: (ctx) => vertical(ctx) === value2,
27284
27483
  run: (ctx) => style(ctx, { alignment: { vertical: value2 === "bottom" ? UNSET : value2 } })
27285
27484
  });
27286
- const halign = (id, label5, value2, glyph) => editing({
27485
+ const halign = (id, label2, value2, glyph) => editing({
27287
27486
  id,
27288
- label: label5,
27487
+ label: label2,
27289
27488
  icon: icon(glyph),
27290
27489
  lock: "formatCells",
27291
27490
  checked: (ctx) => horizontal(ctx) === value2,
@@ -27367,322 +27566,6 @@ function alignmentCommands() {
27367
27566
  ];
27368
27567
  }
27369
27568
 
27370
- // i18n/locale.ts
27371
- var DEFAULT_REJECTED_SUBTAGS = ["hant", "tw", "hk", "mo"];
27372
- function normalizeLocale(input, supported, fallback, options6 = {}) {
27373
- const parts = (input ?? "").trim().toLowerCase().split(/[-_]/).filter(Boolean);
27374
- const language = parts[0];
27375
- if (!language) return fallback;
27376
- const find3 = (tag) => supported.find((item) => item.toLowerCase() === tag);
27377
- const exact = find3(parts.join("-"));
27378
- if (exact) return exact;
27379
- const base = find3(language);
27380
- if (base) return base;
27381
- const rejected = options6.rejectedSubtags ?? DEFAULT_REJECTED_SUBTAGS;
27382
- if (parts.slice(1).some((part) => rejected.includes(part))) return fallback;
27383
- return supported.find((item) => item.toLowerCase().split("-")[0] === language && item.includes("-")) ?? fallback;
27384
- }
27385
-
27386
- // i18n/dictionary.ts
27387
- function mergeMessageModules(modules) {
27388
- const merged = {};
27389
- for (const path of Object.keys(modules).sort()) {
27390
- const module = modules[path];
27391
- if (!module) continue;
27392
- for (const value2 of Object.values(module)) {
27393
- if (!value2 || typeof value2 !== "object" || Array.isArray(value2)) continue;
27394
- const entries = Object.entries(value2);
27395
- if (!entries.every(([, text2]) => typeof text2 === "string")) continue;
27396
- for (const [key, text2] of entries) merged[key] = text2;
27397
- }
27398
- }
27399
- return merged;
27400
- }
27401
-
27402
- // i18n/translator.ts
27403
- var SINGLE2 = /\{(\w+)\}/g;
27404
- var DOUBLE = /\{\{\s*(\w+)\s*\}\}/g;
27405
- function interpolate(template, params, placeholder = "single") {
27406
- if (!params) return template;
27407
- const pattern = placeholder === "double" ? DOUBLE : SINGLE2;
27408
- return template.replace(
27409
- pattern,
27410
- (match2, name) => Object.prototype.hasOwnProperty.call(params, name) && params[name] !== void 0 ? String(params[name]) : match2
27411
- );
27412
- }
27413
- function createTranslator(messages, fallbacks = [], options6 = {}) {
27414
- const placeholder = options6.placeholder ?? "single";
27415
- return (key, params) => {
27416
- let text2 = messages?.[key];
27417
- for (let i2 = 0; text2 === void 0 && i2 < fallbacks.length; i2++) text2 = fallbacks[i2]?.[key];
27418
- return interpolate(text2 ?? options6.missing?.(key) ?? key, params, placeholder);
27419
- };
27420
- }
27421
-
27422
- // i18n/option-strings.ts
27423
- var enOptionStrings = {
27424
- General: "General",
27425
- Display: "Display",
27426
- Formulas: "Formulas",
27427
- Data: "Data",
27428
- Proofing: "Proofing",
27429
- Save: "Save",
27430
- Language: "Language",
27431
- Accessibility: "Accessibility",
27432
- Advanced: "Advanced",
27433
- "Customize Ribbon": "Customize Ribbon",
27434
- "Quick Access Toolbar": "Quick Access Toolbar",
27435
- "Add-ins": "Add-ins",
27436
- "Trust Center": "Trust Center",
27437
- OK: "OK",
27438
- Cancel: "Cancel",
27439
- Close: "Close",
27440
- Categories: "Categories",
27441
- "Reset all options": "Reset all options",
27442
- "General options for working with {product}.": "General options for working with {product}.",
27443
- "Change how {product} corrects and formats your text.": "Change how {product} corrects and formats your text.",
27444
- "Customize how documents are saved.": "Customize how documents are saved.",
27445
- "Set the Office Language Preferences.": "Set the Office Language Preferences.",
27446
- "Make {product} easier to work with.": "Make {product} easier to work with.",
27447
- "Advanced options for working with {product}.": "Advanced options for working with {product}.",
27448
- "Customize the Ribbon and keyboard shortcuts.": "Customize the Ribbon and keyboard shortcuts.",
27449
- "Customize the Quick Access Toolbar.": "Customize the Quick Access Toolbar.",
27450
- "View and manage Microsoft Office Add-ins.": "View and manage Microsoft Office Add-ins.",
27451
- "Help keep your documents safe and your computer secure and healthy.": "Help keep your documents safe and your computer secure and healthy.",
27452
- "User Interface options": "User Interface options",
27453
- "Show Mini Toolbar on selection": "Show Mini Toolbar on selection",
27454
- "Enable Live Preview": "Enable Live Preview",
27455
- "ScreenTip style": "ScreenTip style",
27456
- "Show feature descriptions in ScreenTips": "Show feature descriptions in ScreenTips",
27457
- "Personalize your copy of Microsoft Office": "Personalize your copy of Microsoft Office",
27458
- "User name": "User name",
27459
- "Office Theme": "Office Theme",
27460
- "Office display language": "Office display language",
27461
- "Choose the language for menus, buttons and messages.": "Choose the language for menus, buttons and messages.",
27462
- "Not available yet. Needs rich text formatting.": "Not available yet. Needs rich text formatting.",
27463
- "Not available yet. Styles are applied on click; hover previews are not drawn yet.": "Not available yet. Styles are applied on click; hover previews are not drawn yet.",
27464
- "Not available yet. ScreenTips always describe the command.": "Not available yet. ScreenTips always describe the command.",
27465
- "Not available yet. Documents are saved to this device; AutoRecover is not kept.": "Not available yet. Documents are saved to this device; AutoRecover is not kept.",
27466
- "Not available yet. There are no accessibility settings to change.": "Not available yet. There are no accessibility settings to change.",
27467
- "Not available yet. The editing behaviour is fixed.": "Not available yet. The editing behaviour is fixed.",
27468
- "Not available yet. The Quick Access Toolbar is fixed.": "Not available yet. The Quick Access Toolbar is fixed.",
27469
- "Not available yet. The ribbon layout is fixed.": "Not available yet. The ribbon layout is fixed.",
27470
- "Not available yet. The display language is fixed.": "Not available yet. The display language is fixed.",
27471
- "Not available. Add-ins and macros are never run.": "Not available. Add-ins and macros are never run.",
27472
- "Not available. Documents stay local and active content is never run.": "Not available. Documents stay local and active content is never run."
27473
- };
27474
- var frOptionStrings = {
27475
- General: "G\xE9n\xE9ral",
27476
- Display: "Affichage",
27477
- Formulas: "Formules",
27478
- Data: "Donn\xE9es",
27479
- Proofing: "V\xE9rification",
27480
- Save: "Enregistrer",
27481
- Language: "Langue",
27482
- Accessibility: "Accessibilit\xE9",
27483
- Advanced: "Options avanc\xE9es",
27484
- "Customize Ribbon": "Personnaliser le ruban",
27485
- "Quick Access Toolbar": "Barre d\u2019outils Acc\xE8s rapide",
27486
- "Add-ins": "Compl\xE9ments",
27487
- "Trust Center": "Centre de gestion de la confidentialit\xE9",
27488
- OK: "OK",
27489
- Cancel: "Annuler",
27490
- Close: "Fermer",
27491
- Categories: "Cat\xE9gories",
27492
- "Reset all options": "R\xE9initialiser toutes les options",
27493
- "General options for working with {product}.": "Options g\xE9n\xE9rales pour l\u2019utilisation de {product}.",
27494
- "Change how {product} corrects and formats your text.": "Modifiez la fa\xE7on dont {product} corrige et met en forme votre texte.",
27495
- "Customize how documents are saved.": "Personnalisez l\u2019enregistrement des documents.",
27496
- "Set the Office Language Preferences.": "D\xE9finissez les pr\xE9f\xE9rences de langue d\u2019Office.",
27497
- "Make {product} easier to work with.": "Facilitez l\u2019utilisation de {product}.",
27498
- "Advanced options for working with {product}.": "Options avanc\xE9es pour l\u2019utilisation de {product}.",
27499
- "Customize the Ribbon and keyboard shortcuts.": "Personnalisez le ruban et les raccourcis clavier.",
27500
- "Customize the Quick Access Toolbar.": "Personnalisez la barre d\u2019outils Acc\xE8s rapide.",
27501
- "View and manage Microsoft Office Add-ins.": "Affichez et g\xE9rez les compl\xE9ments Microsoft Office.",
27502
- "Help keep your documents safe and your computer secure and healthy.": "Prot\xE9gez vos documents et assurez la s\xE9curit\xE9 et le bon \xE9tat de votre ordinateur.",
27503
- "User Interface options": "Options de l\u2019interface utilisateur",
27504
- "Show Mini Toolbar on selection": "Afficher la mini barre d\u2019outils lors de la s\xE9lection",
27505
- "Enable Live Preview": "Activer l\u2019aper\xE7u dynamique",
27506
- "ScreenTip style": "Style des info-bulles",
27507
- "Show feature descriptions in ScreenTips": "Afficher les descriptions des fonctionnalit\xE9s dans les info-bulles",
27508
- "Personalize your copy of Microsoft Office": "Personnalisez votre copie de Microsoft Office",
27509
- "User name": "Nom d\u2019utilisateur",
27510
- "Office Theme": "Th\xE8me Office",
27511
- "Office display language": "Langue d\u2019affichage d\u2019Office",
27512
- "Choose the language for menus, buttons and messages.": "Choisissez la langue des menus, des boutons et des messages.",
27513
- "Not available yet. Needs rich text formatting.": "Pas encore disponible. N\xE9cessite la mise en forme de texte enrichi.",
27514
- "Not available yet. Styles are applied on click; hover previews are not drawn yet.": "Pas encore disponible. Les styles s\u2019appliquent au clic ; les aper\xE7us au survol ne sont pas encore dessin\xE9s.",
27515
- "Not available yet. ScreenTips always describe the command.": "Pas encore disponible. Les info-bulles d\xE9crivent toujours la commande.",
27516
- "Not available yet. Documents are saved to this device; AutoRecover is not kept.": "Pas encore disponible. Les documents sont enregistr\xE9s sur cet appareil ; la r\xE9cup\xE9ration automatique n\u2019est pas conserv\xE9e.",
27517
- "Not available yet. There are no accessibility settings to change.": "Pas encore disponible. Aucun param\xE8tre d\u2019accessibilit\xE9 n\u2019est modifiable.",
27518
- "Not available yet. The editing behaviour is fixed.": "Pas encore disponible. Le comportement de modification est fixe.",
27519
- "Not available yet. The Quick Access Toolbar is fixed.": "Pas encore disponible. La barre d\u2019outils Acc\xE8s rapide est fixe.",
27520
- "Not available yet. The ribbon layout is fixed.": "Pas encore disponible. La disposition du ruban est fixe.",
27521
- "Not available yet. The display language is fixed.": "Pas encore disponible. La langue d\u2019affichage est fixe.",
27522
- "Not available. Add-ins and macros are never run.": "Non disponible. Les compl\xE9ments et les macros ne sont jamais ex\xE9cut\xE9s.",
27523
- "Not available. Documents stay local and active content is never run.": "Non disponible. Les documents restent locaux et le contenu actif n\u2019est jamais ex\xE9cut\xE9."
27524
- };
27525
- var deOptionStrings = {
27526
- General: "Allgemein",
27527
- Display: "Anzeige",
27528
- Formulas: "Formeln",
27529
- Data: "Daten",
27530
- Proofing: "Dokumentpr\xFCfung",
27531
- Save: "Speichern",
27532
- Language: "Sprache",
27533
- Accessibility: "Barrierefreiheit",
27534
- Advanced: "Erweitert",
27535
- "Customize Ribbon": "Men\xFCband anpassen",
27536
- "Quick Access Toolbar": "Symbolleiste f\xFCr den Schnellzugriff",
27537
- "Add-ins": "Add-Ins",
27538
- "Trust Center": "Trust Center",
27539
- OK: "OK",
27540
- Cancel: "Abbrechen",
27541
- Close: "Schlie\xDFen",
27542
- Categories: "Kategorien",
27543
- "Reset all options": "Alle Optionen zur\xFCcksetzen",
27544
- "General options for working with {product}.": "Allgemeine Optionen f\xFCr die Arbeit mit {product}.",
27545
- "Change how {product} corrects and formats your text.": "\xC4ndern Sie, wie {product} Ihren Text korrigiert und formatiert.",
27546
- "Customize how documents are saved.": "Passen Sie an, wie Dokumente gespeichert werden.",
27547
- "Set the Office Language Preferences.": "Legen Sie die Office-Spracheinstellungen fest.",
27548
- "Make {product} easier to work with.": "Machen Sie {product} einfacher bedienbar.",
27549
- "Advanced options for working with {product}.": "Erweiterte Optionen f\xFCr die Arbeit mit {product}.",
27550
- "Customize the Ribbon and keyboard shortcuts.": "Passen Sie das Men\xFCband und die Tastenkombinationen an.",
27551
- "Customize the Quick Access Toolbar.": "Passen Sie die Symbolleiste f\xFCr den Schnellzugriff an.",
27552
- "View and manage Microsoft Office Add-ins.": "Microsoft Office-Add-Ins anzeigen und verwalten.",
27553
- "Help keep your documents safe and your computer secure and healthy.": "Sch\xFCtzen Sie Ihre Dokumente und halten Sie Ihren Computer sicher und fehlerfrei.",
27554
- "User Interface options": "Benutzeroberfl\xE4chenoptionen",
27555
- "Show Mini Toolbar on selection": "Minisymbolleiste bei Auswahl anzeigen",
27556
- "Enable Live Preview": "Livevorschau aktivieren",
27557
- "ScreenTip style": "QuickInfo-Format",
27558
- "Show feature descriptions in ScreenTips": "Funktionsbeschreibungen in QuickInfos anzeigen",
27559
- "Personalize your copy of Microsoft Office": "Microsoft Office personalisieren",
27560
- "User name": "Benutzername",
27561
- "Office Theme": "Office-Design",
27562
- "Office display language": "Office-Anzeigesprache",
27563
- "Choose the language for menus, buttons and messages.": "W\xE4hlen Sie die Sprache f\xFCr Men\xFCs, Schaltfl\xE4chen und Meldungen.",
27564
- "Not available yet. Needs rich text formatting.": "Noch nicht verf\xFCgbar. Erfordert Formatierung von Rich-Text.",
27565
- "Not available yet. Styles are applied on click; hover previews are not drawn yet.": "Noch nicht verf\xFCgbar. Formatvorlagen werden per Klick angewendet; Vorschauen beim Dar\xFCberfahren werden noch nicht gezeichnet.",
27566
- "Not available yet. ScreenTips always describe the command.": "Noch nicht verf\xFCgbar. QuickInfos beschreiben immer den Befehl.",
27567
- "Not available yet. Documents are saved to this device; AutoRecover is not kept.": "Noch nicht verf\xFCgbar. Dokumente werden auf diesem Ger\xE4t gespeichert; AutoWiederherstellen wird nicht gef\xFChrt.",
27568
- "Not available yet. There are no accessibility settings to change.": "Noch nicht verf\xFCgbar. Es gibt keine Einstellungen zur Barrierefreiheit zu \xE4ndern.",
27569
- "Not available yet. The editing behaviour is fixed.": "Noch nicht verf\xFCgbar. Das Bearbeitungsverhalten ist festgelegt.",
27570
- "Not available yet. The Quick Access Toolbar is fixed.": "Noch nicht verf\xFCgbar. Die Symbolleiste f\xFCr den Schnellzugriff ist festgelegt.",
27571
- "Not available yet. The ribbon layout is fixed.": "Noch nicht verf\xFCgbar. Das Men\xFCband-Layout ist festgelegt.",
27572
- "Not available yet. The display language is fixed.": "Noch nicht verf\xFCgbar. Die Anzeigesprache ist festgelegt.",
27573
- "Not available. Add-ins and macros are never run.": "Nicht verf\xFCgbar. Add-Ins und Makros werden nie ausgef\xFChrt.",
27574
- "Not available. Documents stay local and active content is never run.": "Nicht verf\xFCgbar. Dokumente bleiben lokal und aktive Inhalte werden nie ausgef\xFChrt."
27575
- };
27576
- var esOptionStrings = {
27577
- General: "General",
27578
- Display: "Mostrar",
27579
- Formulas: "F\xF3rmulas",
27580
- Data: "Datos",
27581
- Proofing: "Revisi\xF3n",
27582
- Save: "Guardar",
27583
- Language: "Idioma",
27584
- Accessibility: "Accesibilidad",
27585
- Advanced: "Avanzadas",
27586
- "Customize Ribbon": "Personalizar cinta de opciones",
27587
- "Quick Access Toolbar": "Barra de herramientas de acceso r\xE1pido",
27588
- "Add-ins": "Complementos",
27589
- "Trust Center": "Centro de confianza",
27590
- OK: "Aceptar",
27591
- Cancel: "Cancelar",
27592
- Close: "Cerrar",
27593
- Categories: "Categor\xEDas",
27594
- "Reset all options": "Restablecer todas las opciones",
27595
- "General options for working with {product}.": "Opciones generales para trabajar con {product}.",
27596
- "Change how {product} corrects and formats your text.": "Cambie la forma en que {product} corrige y da formato al texto.",
27597
- "Customize how documents are saved.": "Personalice c\xF3mo se guardan los documentos.",
27598
- "Set the Office Language Preferences.": "Establezca las preferencias de idioma de Office.",
27599
- "Make {product} easier to work with.": "Haga que {product} sea m\xE1s f\xE1cil de usar.",
27600
- "Advanced options for working with {product}.": "Opciones avanzadas para trabajar con {product}.",
27601
- "Customize the Ribbon and keyboard shortcuts.": "Personalice la cinta de opciones y los m\xE9todos abreviados de teclado.",
27602
- "Customize the Quick Access Toolbar.": "Personalice la barra de herramientas de acceso r\xE1pido.",
27603
- "View and manage Microsoft Office Add-ins.": "Vea y administre los complementos de Microsoft Office.",
27604
- "Help keep your documents safe and your computer secure and healthy.": "Ayude a mantener seguros sus documentos y a proteger y mantener en buen estado su equipo.",
27605
- "User Interface options": "Opciones de la interfaz de usuario",
27606
- "Show Mini Toolbar on selection": "Mostrar minibarra de herramientas al seleccionar",
27607
- "Enable Live Preview": "Habilitar vistas previas din\xE1micas",
27608
- "ScreenTip style": "Estilo de la informaci\xF3n en pantalla",
27609
- "Show feature descriptions in ScreenTips": "Mostrar descripciones de caracter\xEDsticas en la informaci\xF3n en pantalla",
27610
- "Personalize your copy of Microsoft Office": "Personalice su copia de Microsoft Office",
27611
- "User name": "Nombre de usuario",
27612
- "Office Theme": "Tema de Office",
27613
- "Office display language": "Idioma de presentaci\xF3n de Office",
27614
- "Choose the language for menus, buttons and messages.": "Elija el idioma de los men\xFAs, los botones y los mensajes.",
27615
- "Not available yet. Needs rich text formatting.": "A\xFAn no disponible. Requiere formato de texto enriquecido.",
27616
- "Not available yet. Styles are applied on click; hover previews are not drawn yet.": "A\xFAn no disponible. Los estilos se aplican al hacer clic; las vistas previas al pasar el cursor todav\xEDa no se dibujan.",
27617
- "Not available yet. ScreenTips always describe the command.": "A\xFAn no disponible. La informaci\xF3n en pantalla siempre describe el comando.",
27618
- "Not available yet. Documents are saved to this device; AutoRecover is not kept.": "A\xFAn no disponible. Los documentos se guardan en este dispositivo; no se conserva la recuperaci\xF3n autom\xE1tica.",
27619
- "Not available yet. There are no accessibility settings to change.": "A\xFAn no disponible. No hay opciones de accesibilidad que cambiar.",
27620
- "Not available yet. The editing behaviour is fixed.": "A\xFAn no disponible. El comportamiento de edici\xF3n es fijo.",
27621
- "Not available yet. The Quick Access Toolbar is fixed.": "A\xFAn no disponible. La barra de herramientas de acceso r\xE1pido es fija.",
27622
- "Not available yet. The ribbon layout is fixed.": "A\xFAn no disponible. El dise\xF1o de la cinta de opciones es fijo.",
27623
- "Not available yet. The display language is fixed.": "A\xFAn no disponible. El idioma de presentaci\xF3n es fijo.",
27624
- "Not available. Add-ins and macros are never run.": "No disponible. Los complementos y las macros nunca se ejecutan.",
27625
- "Not available. Documents stay local and active content is never run.": "No disponible. Los documentos permanecen locales y el contenido activo nunca se ejecuta."
27626
- };
27627
- var zhOptionStrings = {
27628
- General: "\u5E38\u89C4",
27629
- Display: "\u663E\u793A",
27630
- Formulas: "\u516C\u5F0F",
27631
- Data: "\u6570\u636E",
27632
- Proofing: "\u6821\u5BF9",
27633
- Save: "\u4FDD\u5B58",
27634
- Language: "\u8BED\u8A00",
27635
- Accessibility: "\u8F85\u52A9\u529F\u80FD",
27636
- Advanced: "\u9AD8\u7EA7",
27637
- "Customize Ribbon": "\u81EA\u5B9A\u4E49\u529F\u80FD\u533A",
27638
- "Quick Access Toolbar": "\u5FEB\u901F\u8BBF\u95EE\u5DE5\u5177\u680F",
27639
- "Add-ins": "\u52A0\u8F7D\u9879",
27640
- "Trust Center": "\u4FE1\u4EFB\u4E2D\u5FC3",
27641
- OK: "\u786E\u5B9A",
27642
- Cancel: "\u53D6\u6D88",
27643
- Close: "\u5173\u95ED",
27644
- Categories: "\u7C7B\u522B",
27645
- "Reset all options": "\u91CD\u7F6E\u6240\u6709\u9009\u9879",
27646
- "General options for working with {product}.": "\u4F7F\u7528 {product} \u7684\u5E38\u89C4\u9009\u9879\u3002",
27647
- "Change how {product} corrects and formats your text.": "\u66F4\u6539 {product} \u66F4\u6B63\u548C\u8BBE\u7F6E\u6587\u672C\u683C\u5F0F\u7684\u65B9\u5F0F\u3002",
27648
- "Customize how documents are saved.": "\u81EA\u5B9A\u4E49\u4FDD\u5B58\u6587\u6863\u7684\u65B9\u5F0F\u3002",
27649
- "Set the Office Language Preferences.": "\u8BBE\u7F6E Office \u8BED\u8A00\u9996\u9009\u9879\u3002",
27650
- "Make {product} easier to work with.": "\u8BA9 {product} \u66F4\u6613\u4E8E\u4F7F\u7528\u3002",
27651
- "Advanced options for working with {product}.": "\u4F7F\u7528 {product} \u7684\u9AD8\u7EA7\u9009\u9879\u3002",
27652
- "Customize the Ribbon and keyboard shortcuts.": "\u81EA\u5B9A\u4E49\u529F\u80FD\u533A\u548C\u952E\u76D8\u5FEB\u6377\u65B9\u5F0F\u3002",
27653
- "Customize the Quick Access Toolbar.": "\u81EA\u5B9A\u4E49\u5FEB\u901F\u8BBF\u95EE\u5DE5\u5177\u680F\u3002",
27654
- "View and manage Microsoft Office Add-ins.": "\u67E5\u770B\u548C\u7BA1\u7406 Microsoft Office \u52A0\u8F7D\u9879\u3002",
27655
- "Help keep your documents safe and your computer secure and healthy.": "\u5E2E\u52A9\u4FDD\u969C\u6587\u6863\u5B89\u5168\uFF0C\u5E76\u4F7F\u8BA1\u7B97\u673A\u4FDD\u6301\u5B89\u5168\u548C\u5065\u5EB7\u3002",
27656
- "User Interface options": "\u7528\u6237\u754C\u9762\u9009\u9879",
27657
- "Show Mini Toolbar on selection": "\u9009\u62E9\u65F6\u663E\u793A\u6D6E\u52A8\u5DE5\u5177\u680F",
27658
- "Enable Live Preview": "\u542F\u7528\u5B9E\u65F6\u9884\u89C8",
27659
- "ScreenTip style": "\u5C4F\u5E55\u63D0\u793A\u6837\u5F0F",
27660
- "Show feature descriptions in ScreenTips": "\u5728\u5C4F\u5E55\u63D0\u793A\u4E2D\u663E\u793A\u529F\u80FD\u8BF4\u660E",
27661
- "Personalize your copy of Microsoft Office": "\u5BF9 Microsoft Office \u8FDB\u884C\u4E2A\u6027\u5316\u8BBE\u7F6E",
27662
- "User name": "\u7528\u6237\u540D",
27663
- "Office Theme": "Office \u4E3B\u9898",
27664
- "Office display language": "Office \u663E\u793A\u8BED\u8A00",
27665
- "Choose the language for menus, buttons and messages.": "\u9009\u62E9\u83DC\u5355\u3001\u6309\u94AE\u548C\u6D88\u606F\u4F7F\u7528\u7684\u8BED\u8A00\u3002",
27666
- "Not available yet. Needs rich text formatting.": "\u6682\u4E0D\u53EF\u7528\u3002\u9700\u8981\u5BCC\u6587\u672C\u683C\u5F0F\u3002",
27667
- "Not available yet. Styles are applied on click; hover previews are not drawn yet.": "\u6682\u4E0D\u53EF\u7528\u3002\u6837\u5F0F\u5728\u5355\u51FB\u65F6\u5E94\u7528\uFF1B\u5C1A\u4E0D\u7ED8\u5236\u60AC\u505C\u9884\u89C8\u3002",
27668
- "Not available yet. ScreenTips always describe the command.": "\u6682\u4E0D\u53EF\u7528\u3002\u5C4F\u5E55\u63D0\u793A\u59CB\u7EC8\u63CF\u8FF0\u8BE5\u547D\u4EE4\u3002",
27669
- "Not available yet. Documents are saved to this device; AutoRecover is not kept.": "\u6682\u4E0D\u53EF\u7528\u3002\u6587\u6863\u4FDD\u5B58\u5230\u6B64\u8BBE\u5907\uFF1B\u4E0D\u4FDD\u7559\u81EA\u52A8\u6062\u590D\u3002",
27670
- "Not available yet. There are no accessibility settings to change.": "\u6682\u4E0D\u53EF\u7528\u3002\u6CA1\u6709\u53EF\u66F4\u6539\u7684\u8F85\u52A9\u529F\u80FD\u8BBE\u7F6E\u3002",
27671
- "Not available yet. The editing behaviour is fixed.": "\u6682\u4E0D\u53EF\u7528\u3002\u7F16\u8F91\u884C\u4E3A\u662F\u56FA\u5B9A\u7684\u3002",
27672
- "Not available yet. The Quick Access Toolbar is fixed.": "\u6682\u4E0D\u53EF\u7528\u3002\u5FEB\u901F\u8BBF\u95EE\u5DE5\u5177\u680F\u662F\u56FA\u5B9A\u7684\u3002",
27673
- "Not available yet. The ribbon layout is fixed.": "\u6682\u4E0D\u53EF\u7528\u3002\u529F\u80FD\u533A\u5E03\u5C40\u662F\u56FA\u5B9A\u7684\u3002",
27674
- "Not available yet. The display language is fixed.": "\u6682\u4E0D\u53EF\u7528\u3002\u663E\u793A\u8BED\u8A00\u662F\u56FA\u5B9A\u7684\u3002",
27675
- "Not available. Add-ins and macros are never run.": "\u4E0D\u53EF\u7528\u3002\u52A0\u8F7D\u9879\u548C\u5B8F\u6C38\u8FDC\u4E0D\u4F1A\u8FD0\u884C\u3002",
27676
- "Not available. Documents stay local and active content is never run.": "\u4E0D\u53EF\u7528\u3002\u6587\u6863\u4FDD\u7559\u5728\u672C\u5730\uFF0C\u6D3B\u52A8\u5185\u5BB9\u6C38\u8FDC\u4E0D\u4F1A\u8FD0\u884C\u3002"
27677
- };
27678
- var optionStrings = {
27679
- en: enOptionStrings,
27680
- fr: frOptionStrings,
27681
- de: deOptionStrings,
27682
- es: esOptionStrings,
27683
- "zh-CN": zhOptionStrings
27684
- };
27685
-
27686
27569
  // xlsx/ui/locales/merge.ts
27687
27570
  var mergeStringModules = mergeMessageModules;
27688
27571
 
@@ -28951,11 +28834,11 @@ var NAVIGATION_STRINGS = {
28951
28834
  "Dise\xF1os de tablas din\xE1micas no modelados, agrupaci\xF3n, segmentaciones y fuentes externas (conservados)",
28952
28835
  "\u672A\u5EFA\u6A21\u7684\u6570\u636E\u900F\u89C6\u8868\u5E03\u5C40\u3001\u5206\u7EC4\u3001\u5207\u7247\u5668\u548C\u5916\u90E8\u6570\u636E\u6E90\uFF08\u4FDD\u7559\uFF09"
28953
28836
  ],
28954
- "Values-on-rows report filters, multiple/dynamic filters and repeated column captions (preserved)": [
28955
- "Filtres de rapport avec valeurs en lignes, filtres multiples ou dynamiques et libell\xE9s de colonnes r\xE9p\xE9t\xE9s (conserv\xE9s)",
28956
- "Berichtsfilter mit Werten in Zeilen, mehrere/dynamische Filter und wiederholte Spaltenbeschriftungen (erhalten)",
28957
- "Filtros de informe con valores en filas, filtros m\xFAltiples o din\xE1micos y t\xEDtulos de columna repetidos (conservados)",
28958
- "\u503C\u4F4D\u4E8E\u884C\u4E0A\u7684\u62A5\u8868\u7B5B\u9009\u5668\u3001\u591A\u91CD\u6216\u52A8\u6001\u7B5B\u9009\u5668\u548C\u91CD\u590D\u5217\u6807\u9898\uFF08\u4FDD\u7559\uFF09"
28837
+ "Multiple/dynamic report filters and repeated column captions (preserved)": [
28838
+ "Filtres de rapport multiples ou dynamiques et libell\xE9s de colonnes r\xE9p\xE9t\xE9s (conserv\xE9s)",
28839
+ "Mehrere/dynamische Berichtsfilter und wiederholte Spaltenbeschriftungen (erhalten)",
28840
+ "Filtros de informe m\xFAltiples o din\xE1micos y t\xEDtulos de columna repetidos (conservados)",
28841
+ "\u591A\u91CD\u6216\u52A8\u6001\u62A5\u8868\u7B5B\u9009\u5668\u548C\u91CD\u590D\u5217\u6807\u9898\uFF08\u4FDD\u7559\uFF09"
28959
28842
  ],
28960
28843
  OK: ["OK", "OK", "Aceptar", "\u786E\u5B9A"],
28961
28844
  Cancel: ["Annuler", "Abbrechen", "Cancelar", "\u53D6\u6D88"],
@@ -32185,6 +32068,13 @@ var PIVOT_STRINGS = {
32185
32068
  "Despu\xE9s de los campos de fila",
32186
32069
  "\u884C\u5B57\u6BB5\u4E4B\u540E"
32187
32070
  ],
32071
+ "After {field}": ["Apr\xE8s {field}", "Nach {field}", "Despu\xE9s de {field}", "{field} \u4E4B\u540E"],
32072
+ "Values are listed after {field}.": [
32073
+ "Les valeurs sont affich\xE9es apr\xE8s {field}.",
32074
+ "Werte werden nach {field} aufgef\xFChrt.",
32075
+ "Los valores aparecen despu\xE9s de {field}.",
32076
+ "\u503C\u5217\u5728 {field} \u4E4B\u540E\u3002"
32077
+ ],
32188
32078
  "Between row fields": [
32189
32079
  "Entre les champs de ligne",
32190
32080
  "Zwischen den Zeilenfeldern",
@@ -32406,12 +32296,6 @@ var PIVOT_STRINGS = {
32406
32296
  "Elija campos de columna de tabla din\xE1mica v\xE1lidos.",
32407
32297
  "\u8BF7\u9009\u62E9\u6709\u6548\u7684\u6570\u636E\u900F\u89C6\u8868\u5217\u5B57\u6BB5\u3002"
32408
32298
  ],
32409
- "Values on rows support one column field.": [
32410
- "Les valeurs en lignes prennent en charge un seul champ de colonne.",
32411
- "Werte in Zeilen unterst\xFCtzen nur ein Spaltenfeld.",
32412
- "Los valores en filas admiten un solo campo de columna.",
32413
- "\u884C\u4E0A\u7684\u503C\u4EC5\u652F\u6301\u4E00\u4E2A\u5217\u5B57\u6BB5\u3002"
32414
- ],
32415
32299
  "Report filters support one column field.": [
32416
32300
  "Les filtres de rapport prennent en charge un seul champ de colonne.",
32417
32301
  "Berichtsfilter unterst\xFCtzen nur ein Spaltenfeld.",
@@ -32472,12 +32356,6 @@ var PIVOT_STRINGS = {
32472
32356
  "Solo se pueden agrupar por fecha los campos que contienen fechas.",
32473
32357
  "\u53EA\u6709\u5305\u542B\u65E5\u671F\u7684\u5B57\u6BB5\u624D\u80FD\u6309\u65E5\u671F\u7EC4\u5408\u3002"
32474
32358
  ],
32475
- "Date groups cannot be combined with report filters or timelines.": [
32476
- "Les regroupements de dates ne peuvent pas \xEAtre combin\xE9s avec des filtres de rapport ou des chronologies.",
32477
- "Datumsgruppen k\xF6nnen nicht mit Berichtsfiltern oder Zeitachsen kombiniert werden.",
32478
- "Las agrupaciones de fechas no se pueden combinar con filtros de informe ni escalas de tiempo.",
32479
- "\u65E5\u671F\u7EC4\u5408\u4E0D\u80FD\u4E0E\u62A5\u8868\u7B5B\u9009\u5668\u6216\u65E5\u7A0B\u8868\u4E00\u8D77\u4F7F\u7528\u3002"
32480
- ],
32481
32359
  "The date group must end after it starts.": [
32482
32360
  "Le regroupement de dates doit se terminer apr\xE8s son d\xE9but.",
32483
32361
  "Die Datumsgruppe muss nach ihrem Beginn enden.",
@@ -32514,23 +32392,11 @@ var PIVOT_STRINGS = {
32514
32392
  "Elija campos de fila de tabla din\xE1mica v\xE1lidos.",
32515
32393
  "\u8BF7\u9009\u62E9\u6709\u6548\u7684\u6570\u636E\u900F\u89C6\u8868\u884C\u5B57\u6BB5\u3002"
32516
32394
  ],
32517
- "Values on rows support at most two row fields.": [
32518
- "Les valeurs en lignes prennent en charge deux champs de ligne au maximum.",
32519
- "Werte in Zeilen unterst\xFCtzen h\xF6chstens zwei Zeilenfelder.",
32520
- "Los valores en filas admiten como m\xE1ximo dos campos de fila.",
32521
- "\u884C\u4E0A\u7684\u503C\u6700\u591A\u652F\u6301\u4E24\u4E2A\u884C\u5B57\u6BB5\u3002"
32522
- ],
32523
32395
  "Choose valid field subtotals.": [
32524
32396
  "Choisissez des sous-totaux de champ valides.",
32525
32397
  "W\xE4hlen Sie g\xFCltige Feldteilergebnisse.",
32526
32398
  "Elija subtotales de campo v\xE1lidos.",
32527
32399
  "\u8BF7\u9009\u62E9\u6709\u6548\u7684\u5B57\u6BB5\u5206\u7C7B\u6C47\u603B\u3002"
32528
- ],
32529
- "Field subtotals require Values on columns.": [
32530
- "Les sous-totaux de champ n\xE9cessitent des valeurs en colonnes.",
32531
- "Feldteilergebnisse erfordern Werte in Spalten.",
32532
- "Los subtotales de campo requieren valores en columnas.",
32533
- "\u5B57\u6BB5\u5206\u7C7B\u6C47\u603B\u8981\u6C42\u503C\u663E\u793A\u5728\u5217\u4E0A\u3002"
32534
32400
  ]
32535
32401
  };
32536
32402
 
@@ -33043,8 +32909,8 @@ var COLUMN = {
33043
32909
  };
33044
32910
  function flatten2(tables, locale) {
33045
32911
  const out = {};
33046
- for (const table2 of tables)
33047
- for (const [key, texts] of Object.entries(table2))
32912
+ for (const table3 of tables)
32913
+ for (const [key, texts] of Object.entries(table3))
33048
32914
  out[key] = locale === "en" ? key : texts[COLUMN[locale]] ?? key;
33049
32915
  return out;
33050
32916
  }
@@ -35321,9 +35187,9 @@ function cellCommands() {
35321
35187
  ["format.hide-columns", "Hide Columns", "col", true],
35322
35188
  ["format.unhide-columns", "Unhide Columns", "col", false]
35323
35189
  ].map(
35324
- ([id, label5, axis, hidden]) => editing({
35190
+ ([id, label2, axis, hidden]) => editing({
35325
35191
  id,
35326
- label: label5,
35192
+ label: label2,
35327
35193
  icon: icon("hide"),
35328
35194
  lock: axis === "row" ? "formatRows" : "formatColumns",
35329
35195
  run: (ctx) => {
@@ -35648,10 +35514,10 @@ var TABLE_FLAGS = [
35648
35514
  ];
35649
35515
  function setTableBand(ctx, band, on) {
35650
35516
  const t = target(ctx);
35651
- const table2 = activeTable(ctx);
35652
- if (!t || !table2 || table2[band] === on) return;
35517
+ const table3 = activeTable(ctx);
35518
+ if (!t || !table3 || table3[band] === on) return;
35653
35519
  try {
35654
- t.session.updateTable(t.sheet, table2.name, { [band]: on });
35520
+ t.session.updateTable(t.sheet, table3.name, { [band]: on });
35655
35521
  } catch (error) {
35656
35522
  ctx.toast(ctx.t(error instanceof Error ? error.message : String(error)), "warning");
35657
35523
  }
@@ -35700,14 +35566,14 @@ function contextualCommands() {
35700
35566
  icon: icon("convertRange"),
35701
35567
  run: async (ctx) => {
35702
35568
  const t = target(ctx);
35703
- const table2 = activeTable(ctx);
35704
- if (!t || !table2) return;
35569
+ const table3 = activeTable(ctx);
35570
+ if (!t || !table3) return;
35705
35571
  const ok = await ctx.dialogs.open("confirm", {
35706
35572
  heading: "Convert to Range",
35707
35573
  message: "Do you want to convert the table to a normal range?",
35708
35574
  okLabel: "Yes"
35709
35575
  });
35710
- if (ok) t.session.convertTableToRange(t.sheet, table2.name);
35576
+ if (ok) t.session.convertTableToRange(t.sheet, table3.name);
35711
35577
  }
35712
35578
  }),
35713
35579
  tableCmd({
@@ -35724,14 +35590,14 @@ function contextualCommands() {
35724
35590
  run: (ctx) => setTableBand(ctx, "totalsRow", !activeTable(ctx)?.totalsRow)
35725
35591
  }),
35726
35592
  ...TABLE_FLAGS.map(
35727
- ([flag2, id, label5]) => tableCmd({
35593
+ ([flag2, id, label2]) => tableCmd({
35728
35594
  id,
35729
- label: label5,
35595
+ label: label2,
35730
35596
  checked: (ctx) => !!activeTable(ctx)?.[flag2],
35731
35597
  run: (ctx) => {
35732
35598
  const t = target(ctx);
35733
- const table2 = activeTable(ctx);
35734
- if (t && table2) t.session.updateTable(t.sheet, table2.name, { [flag2]: !table2[flag2] });
35599
+ const table3 = activeTable(ctx);
35600
+ if (t && table3) t.session.updateTable(t.sheet, table3.name, { [flag2]: !table3[flag2] });
35735
35601
  }
35736
35602
  })
35737
35603
  ),
@@ -35741,9 +35607,9 @@ function contextualCommands() {
35741
35607
  icon: icon("formatTable"),
35742
35608
  run: (ctx, arg) => {
35743
35609
  const t = target(ctx);
35744
- const table2 = activeTable(ctx);
35745
- if (t && table2 && typeof arg === "string")
35746
- t.session.updateTable(t.sheet, table2.name, { styleName: arg });
35610
+ const table3 = activeTable(ctx);
35611
+ if (t && table3 && typeof arg === "string")
35612
+ t.session.updateTable(t.sheet, table3.name, { styleName: arg });
35747
35613
  }
35748
35614
  }),
35749
35615
  chartCmd({
@@ -36142,9 +36008,9 @@ function fillDirection(ctx, dir) {
36142
36008
  function editingCommands() {
36143
36009
  return [
36144
36010
  ...AUTOSUM_FUNCTIONS.map(
36145
- ([fn, label5]) => editing({
36011
+ ([fn, label2]) => editing({
36146
36012
  id: fn === "SUM" ? "home.autosum" : `home.autosum-${fn.toLowerCase()}`,
36147
- label: fn === "SUM" ? "AutoSum" : label5,
36013
+ label: fn === "SUM" ? "AutoSum" : label2,
36148
36014
  icon: icon("autoSum"),
36149
36015
  ...fn === "SUM" ? { shortcut: "Alt+=" } : {},
36150
36016
  run: (ctx) => autoSum(ctx, fn)
@@ -36195,16 +36061,16 @@ function editingCommands() {
36195
36061
  ["comments", "Clear Comments and Notes"],
36196
36062
  ["hyperlinks", "Clear Hyperlinks"]
36197
36063
  ].map(
36198
- ([what, label5]) => editing({
36064
+ ([what, label2]) => editing({
36199
36065
  id: `home.clear-${what}`,
36200
- label: label5,
36066
+ label: label2,
36201
36067
  icon: icon("clear"),
36202
36068
  ...what === "formats" ? { lock: "formatCells" } : {},
36203
36069
  ...what === "contents" ? { shortcut: "Delete" } : {},
36204
36070
  run: (ctx) => {
36205
36071
  const t = target(ctx);
36206
36072
  if (!t) return;
36207
- t.session.batch(label5, () => {
36073
+ t.session.batch(label2, () => {
36208
36074
  for (const range2 of t.ranges) t.session.clearRange(t.sheet, range2, what);
36209
36075
  });
36210
36076
  }
@@ -36245,9 +36111,9 @@ function editingCommands() {
36245
36111
  ["constants", "Constants"],
36246
36112
  ["validation", "Data Validation"]
36247
36113
  ].map(
36248
- ([kind, label5]) => viewing({
36114
+ ([kind, label2]) => viewing({
36249
36115
  id: `home.select-${kind}`,
36250
- label: label5,
36116
+ label: label2,
36251
36117
  icon: icon("findSelect"),
36252
36118
  run: (ctx) => {
36253
36119
  if (!selectSpecial(ctx, { kind })) ctx.toast(ctx.t("No cells were found."), "info");
@@ -36518,7 +36384,7 @@ function numberCommands() {
36518
36384
  ["home.format-date", "Date format", "d-mmm-yy", "Ctrl+Shift+#"],
36519
36385
  ["home.format-scientific", "Scientific format", "0.00E+00", "Ctrl+Shift+^"]
36520
36386
  ].map(
36521
- ([id, label5, format, shortcut]) => editing({ id, label: label5, shortcut, lock: "formatCells", run: (ctx) => setFormat(ctx, format) })
36387
+ ([id, label2, format, shortcut]) => editing({ id, label: label2, shortcut, lock: "formatCells", run: (ctx) => setFormat(ctx, format) })
36522
36388
  )
36523
36389
  ];
36524
36390
  }
@@ -36742,9 +36608,9 @@ function slicerSourceAt(ctx) {
36742
36608
  pivot,
36743
36609
  fields: pivot.fields.filter((field) => field !== pivot.pageFilter?.field)
36744
36610
  };
36745
- const table2 = activeTable(ctx);
36746
- if (table2?.headerRow && !table2.filterNotModeled)
36747
- return { kind: "table", table: table2, fields: table2.columns.map((column2) => column2.name) };
36611
+ const table3 = activeTable(ctx);
36612
+ if (table3?.headerRow && !table3.filterNotModeled)
36613
+ return { kind: "table", table: table3, fields: table3.columns.map((column2) => column2.name) };
36748
36614
  return void 0;
36749
36615
  }
36750
36616
  function activeTimeline(ctx) {
@@ -38466,13 +38332,13 @@ function searchCommands(ctx, query, isHidden) {
38466
38332
  const seen = /* @__PURE__ */ new Set();
38467
38333
  for (const command of ctx.commands.list()) {
38468
38334
  if (isHidden(command.id) || !ctx.commands.isEnabled(command.id)) continue;
38469
- const label5 = ctx.t(command.label).toLocaleLowerCase();
38335
+ const label2 = ctx.t(command.label).toLocaleLowerCase();
38470
38336
  const english = command.label.toLocaleLowerCase();
38471
- const haystack = `${label5} ${english} ${command.id.replace(/[.-]/g, " ")}`;
38337
+ const haystack = `${label2} ${english} ${command.id.replace(/[.-]/g, " ")}`;
38472
38338
  if (!words2.every((word) => haystack.includes(word))) continue;
38473
- if (seen.has(label5)) continue;
38474
- seen.add(label5);
38475
- const score = label5.startsWith(words2[0]) ? 0 : label5.includes(words2[0]) ? 1 : 2;
38339
+ if (seen.has(label2)) continue;
38340
+ seen.add(label2);
38341
+ const score = label2.startsWith(words2[0]) ? 0 : label2.includes(words2[0]) ? 1 : 2;
38476
38342
  scored.push({ command, score });
38477
38343
  }
38478
38344
  return scored.sort(