ooxml-core 1.10.0 → 1.11.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.
- package/dist/PptxHandler-DNZHAHUY.cjs +12 -0
- package/dist/PptxHandler-E44KDHMQ.mjs +3 -0
- package/dist/{PptxHandler-ADEFY476.mjs → PptxHandler-NROFYT2N.mjs} +2 -2
- package/dist/automation/index.cjs +3293 -2867
- package/dist/automation/index.mjs +3293 -2867
- package/dist/{chunk-3N6XMMTT.cjs → chunk-2UVH6RHI.cjs} +1138 -996
- package/dist/{chunk-ZOUGMAZG.mjs → chunk-7DSZI7S6.mjs} +1 -1
- package/dist/{chunk-S6DOCMQC.cjs → chunk-7QZGRB3T.cjs} +0 -10
- package/dist/chunk-ANZ4Q6I3.cjs +21 -0
- package/dist/{chunk-5NVJN4E6.mjs → chunk-EC2W2MDY.mjs} +1 -1
- package/dist/chunk-EGTRL3QJ.mjs +19 -0
- package/dist/chunk-GXHKNSZX.mjs +9 -0
- package/dist/{chunk-CCHYFCPD.mjs → chunk-HCXUI5UC.mjs} +296 -103
- package/dist/chunk-HDQXPSHY.cjs +17 -0
- package/dist/chunk-KTYBFGEY.mjs +14 -0
- package/dist/chunk-QOO36KG4.cjs +42 -0
- package/dist/chunk-R2KZXD6U.mjs +39 -0
- package/dist/{chunk-A6P7G3UK.mjs → chunk-U2DF3EGK.mjs} +1 -1
- package/dist/{chunk-R6KSBNKX.mjs → chunk-UAY26XOI.mjs} +1 -9
- package/dist/{chunk-WUE5ZHU3.mjs → chunk-W5ARCUJB.mjs} +3 -3
- package/dist/chunk-XZPZHXV4.cjs +12 -0
- package/dist/{chunk-ZE53K7DH.mjs → chunk-YB5SRNFS.mjs} +244 -102
- package/dist/docx/layout/flow-table.d.ts.map +1 -1
- package/dist/docx/layout/index.cjs +125 -56
- package/dist/docx/layout/index.mjs +125 -56
- package/dist/docx/layout/nested-fragment-edges.d.ts +9 -0
- package/dist/docx/layout/nested-fragment-edges.d.ts.map +1 -0
- package/dist/docx/layout/result.d.ts +7 -0
- package/dist/docx/layout/result.d.ts.map +1 -1
- package/dist/docx/layout/table-border-layout.d.ts +1 -1
- package/dist/docx/layout/table-border-layout.d.ts.map +1 -1
- package/dist/docx/layout/table-cell-layout.d.ts +1 -1
- package/dist/docx/layout/table-cell-layout.d.ts.map +1 -1
- package/dist/docx/layout/table-frames.d.ts.map +1 -1
- package/dist/docx/layout/table-layout.d.ts +1 -1
- package/dist/docx/layout/table-layout.d.ts.map +1 -1
- package/dist/pptx/automation/index.cjs +266 -114
- package/dist/pptx/automation/index.d.ts +5 -4
- package/dist/pptx/automation/index.d.ts.map +1 -1
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{text-operations-BqHmLaLA.d.ts → elements-DD3UGOMd.d.ts} +17 -3262
- package/dist/pptx/chunks/elements-DD3UGOMd.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-DUCGeZh7.d.ts → index-BZrFyNtU.d.ts} +53 -5
- package/dist/pptx/chunks/index-BZrFyNtU.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-Cuxtr76Y.d.ts → index-DdX02BSm.d.ts} +5 -3
- package/dist/pptx/chunks/index-DdX02BSm.d.ts.map +1 -0
- package/dist/pptx/chunks/smart-art-ENMMEbmW.d.ts +1512 -0
- package/dist/pptx/chunks/smart-art-ENMMEbmW.d.ts.map +1 -0
- package/dist/pptx/chunks/text-D49FKllA.d.ts +1473 -0
- package/dist/pptx/chunks/text-D49FKllA.d.ts.map +1 -0
- package/dist/pptx/chunks/text-operations-CyMTMfID.d.ts +3261 -0
- package/dist/pptx/chunks/text-operations-CyMTMfID.d.ts.map +1 -0
- package/dist/pptx/cli/index.cjs +266 -114
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/find-replace.cjs +17 -16
- package/dist/pptx/editor/render/find-replace.d.ts +2 -2
- package/dist/pptx/editor/render/find-replace.mjs +2 -1
- package/dist/pptx/editor/render/font-family-update.cjs +14 -0
- package/dist/pptx/editor/render/font-family-update.d.ts +17 -0
- package/dist/pptx/editor/render/font-family-update.d.ts.map +1 -0
- package/dist/pptx/editor/render/font-family-update.mjs +1 -0
- package/dist/pptx/editor/render/paragraph-geometry-overrides.cjs +14 -0
- package/dist/pptx/editor/render/paragraph-geometry-overrides.d.ts +17 -0
- package/dist/pptx/editor/render/paragraph-geometry-overrides.d.ts.map +1 -0
- package/dist/pptx/editor/render/paragraph-geometry-overrides.mjs +12 -0
- package/dist/pptx/editor/render/slide-operations.cjs +9 -8
- package/dist/pptx/editor/render/slide-operations.mjs +3 -2
- package/dist/pptx/editor/render/table-data-grid-ops.cjs +1 -1
- package/dist/pptx/editor/render/table-data-grid-ops.mjs +1 -1
- package/dist/pptx/editor/render/text-content-style.cjs +18 -0
- package/dist/pptx/editor/render/text-content-style.d.ts +9 -0
- package/dist/pptx/editor/render/text-content-style.d.ts.map +1 -0
- package/dist/pptx/editor/render/text-content-style.mjs +5 -0
- package/dist/pptx/editor/render/text-runs-style-patch.cjs +17 -0
- package/dist/pptx/editor/render/text-runs-style-patch.d.ts +7 -0
- package/dist/pptx/editor/render/text-runs-style-patch.d.ts.map +1 -0
- package/dist/pptx/editor/render/text-runs-style-patch.mjs +15 -0
- package/dist/pptx/editor/render/text-style-scope.cjs +173 -0
- package/dist/pptx/editor/render/text-style-scope.d.ts +76 -0
- package/dist/pptx/editor/render/text-style-scope.d.ts.map +1 -0
- package/dist/pptx/editor/render/text-style-scope.mjs +164 -0
- package/dist/pptx/editor/render/theme-editor-model.cjs +1 -1
- package/dist/pptx/editor/render/theme-editor-model.mjs +1 -1
- package/dist/pptx/editor/render/update-text-segment-style.cjs +11 -0
- package/dist/pptx/editor/render/update-text-segment-style.d.ts +14 -0
- package/dist/pptx/editor/render/update-text-segment-style.d.ts.map +1 -0
- package/dist/pptx/editor/render/update-text-segment-style.mjs +2 -0
- package/dist/pptx/index.cjs +329 -114
- package/dist/pptx/index.d.ts +7 -5
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/smartart-layouts/index.d.ts +1 -1
- package/dist/teams/index.cjs +112 -16
- package/dist/teams/index.mjs +112 -16
- package/dist/visio/edit-commands.d.ts +3 -3
- package/dist/visio/edit-commands.d.ts.map +1 -1
- package/dist/visio/edit-formatting-scope.d.ts.map +1 -1
- package/dist/visio/edit-recalculate-index.d.ts.map +1 -1
- package/dist/visio/edit-text-field-commands.d.ts +15 -0
- package/dist/visio/edit-text-field-commands.d.ts.map +1 -1
- package/dist/visio/edit-text-field.d.ts +2 -2
- package/dist/visio/edit-text-field.d.ts.map +1 -1
- package/dist/visio/edit.d.ts +1 -1
- package/dist/visio/edit.d.ts.map +1 -1
- package/dist/visio/index.cjs +382 -210
- package/dist/visio/index.d.ts +1 -1
- package/dist/visio/index.d.ts.map +1 -1
- package/dist/visio/index.mjs +382 -210
- package/dist/visio/model.d.ts +6 -0
- package/dist/visio/model.d.ts.map +1 -1
- package/dist/visio/shapes.d.ts.map +1 -1
- package/dist/visio/style.d.ts +1 -1
- package/dist/visio/style.d.ts.map +1 -1
- package/dist/visio/text-field-display.d.ts +3 -0
- package/dist/visio/text-field-display.d.ts.map +1 -1
- package/dist/visio/text-field-editability.d.ts +6 -0
- package/dist/visio/text-field-editability.d.ts.map +1 -0
- package/dist/visio/text-field-independent.d.ts +4 -0
- package/dist/visio/text-field-independent.d.ts.map +1 -0
- package/dist/visio/text-field-source.d.ts +6 -0
- package/dist/visio/text-field-source.d.ts.map +1 -0
- package/dist/visio/ui/edit-commands.d.ts.map +1 -1
- package/dist/visio/ui/index.cjs +394 -211
- package/dist/visio/ui/index.mjs +394 -211
- package/dist/visio/ui/snapshot-scene.d.ts.map +1 -1
- package/dist/xlsx/edit/pivots.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +773 -514
- package/dist/xlsx/index.mjs +772 -515
- package/dist/xlsx/load/index.cjs +541 -292
- package/dist/xlsx/load/index.mjs +541 -292
- package/dist/xlsx/model-pivots.d.ts +8 -0
- package/dist/xlsx/model-pivots.d.ts.map +1 -1
- package/dist/xlsx/pivot/admission.d.ts.map +1 -1
- package/dist/xlsx/pivot/aggregate.d.ts.map +1 -1
- package/dist/xlsx/pivot/data.d.ts +2 -2
- package/dist/xlsx/pivot/data.d.ts.map +1 -1
- package/dist/xlsx/pivot/index.d.ts +2 -0
- package/dist/xlsx/pivot/index.d.ts.map +1 -1
- package/dist/xlsx/pivot/measures.d.ts +1 -1
- package/dist/xlsx/pivot/measures.d.ts.map +1 -1
- package/dist/xlsx/pivot/page-filter-admission.d.ts +5 -0
- package/dist/xlsx/pivot/page-filter-admission.d.ts.map +1 -0
- package/dist/xlsx/pivot/page-filter.d.ts +11 -0
- package/dist/xlsx/pivot/page-filter.d.ts.map +1 -0
- package/dist/xlsx/pivot/read.d.ts.map +1 -1
- package/dist/xlsx/pivot/table-xml.d.ts.map +1 -1
- package/dist/xlsx/pivot/values-axis.d.ts +4 -1
- package/dist/xlsx/pivot/values-axis.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/navigation.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/pivots.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +95 -12
- package/dist/xlsx/ui/index.mjs +95 -12
- package/package.json +2 -2
- package/dist/PptxHandler-5UURGJEV.mjs +0 -2
- package/dist/PptxHandler-U5XB2HUE.cjs +0 -11
- package/dist/pptx/chunks/index-Cuxtr76Y.d.ts.map +0 -1
- package/dist/pptx/chunks/index-DUCGeZh7.d.ts.map +0 -1
- package/dist/pptx/chunks/smart-art-D-sXa_Nb.d.ts +0 -2980
- package/dist/pptx/chunks/smart-art-D-sXa_Nb.d.ts.map +0 -1
- package/dist/pptx/chunks/text-operations-BqHmLaLA.d.ts.map +0 -1
package/dist/xlsx/load/index.mjs
CHANGED
|
@@ -1003,7 +1003,7 @@ function i(x, y, z) {
|
|
|
1003
1003
|
}
|
|
1004
1004
|
var T = Array.from(
|
|
1005
1005
|
{ length: 64 },
|
|
1006
|
-
(_,
|
|
1006
|
+
(_, index3) => Math.floor(Math.abs(Math.sin(index3 + 1)) * 2 ** 32)
|
|
1007
1007
|
);
|
|
1008
1008
|
var SHIFTS = [
|
|
1009
1009
|
[7, 12, 17, 22],
|
|
@@ -2531,7 +2531,7 @@ function toArrayBuffer(bytes) {
|
|
|
2531
2531
|
}
|
|
2532
2532
|
function isCompoundFile(input) {
|
|
2533
2533
|
const bytes = toBytes(input);
|
|
2534
|
-
return bytes.length >= 8 && OLE_MAGIC2.every((value2,
|
|
2534
|
+
return bytes.length >= 8 && OLE_MAGIC2.every((value2, index3) => bytes[index3] === value2);
|
|
2535
2535
|
}
|
|
2536
2536
|
function openEncryptedPackage(input) {
|
|
2537
2537
|
const bytes = toBytes(input);
|
|
@@ -3712,7 +3712,7 @@ var PartPatch = class {
|
|
|
3712
3712
|
const { root, children: children2 } = scan(xml);
|
|
3713
3713
|
const kids2 = elements(rootElement);
|
|
3714
3714
|
if (kids2.length !== children2.length) throw new Error("Property part markup is not supported");
|
|
3715
|
-
kids2.forEach((kid,
|
|
3715
|
+
kids2.forEach((kid, index3) => this.spans.set(kid, children2[index3]));
|
|
3716
3716
|
this.root = root;
|
|
3717
3717
|
for (const attribute2 of Array.from(rootElement.attributes)) {
|
|
3718
3718
|
if (attribute2.name === "xmlns") this.defaultNs = attribute2.value;
|
|
@@ -3962,7 +3962,7 @@ function writeAppProperties(props, sourceXml) {
|
|
|
3962
3962
|
const patch = new PartPatch(xml, root);
|
|
3963
3963
|
const prior = readKnown(root, ns);
|
|
3964
3964
|
const ownPrefix = root.prefix ? `${root.prefix}:` : "";
|
|
3965
|
-
FIELDS2.forEach(([field, local, kind],
|
|
3965
|
+
FIELDS2.forEach(([field, local, kind], index3) => {
|
|
3966
3966
|
const value2 = props[field];
|
|
3967
3967
|
const existing = first(root, local, ns.app);
|
|
3968
3968
|
if (value2 === void 0 || kind === "text" && value2 === "") {
|
|
@@ -3976,7 +3976,7 @@ function writeAppProperties(props, sourceXml) {
|
|
|
3976
3976
|
patch.setContent(existing, body);
|
|
3977
3977
|
return;
|
|
3978
3978
|
}
|
|
3979
|
-
const next = FIELDS2.slice(
|
|
3979
|
+
const next = FIELDS2.slice(index3 + 1).map(([, name]) => first(root, name, ns.app)).find((node) => node !== void 0);
|
|
3980
3980
|
patch.insert(`<${ownPrefix}${local}>${body}</${ownPrefix}${local}>`, next);
|
|
3981
3981
|
});
|
|
3982
3982
|
return patch.toString();
|
|
@@ -4071,9 +4071,9 @@ function writeCustomProperties(properties2) {
|
|
|
4071
4071
|
});
|
|
4072
4072
|
if (!unique2.length) return void 0;
|
|
4073
4073
|
const pids = allocateCustomPropertyIds(unique2);
|
|
4074
|
-
const body = unique2.map((property,
|
|
4074
|
+
const body = unique2.map((property, index3) => {
|
|
4075
4075
|
const link = property.linkTarget ? ` linkTarget="${escape(property.linkTarget, true)}"` : "";
|
|
4076
|
-
return `<property fmtid="${CUSTOM_PROPERTIES_FMTID}" pid="${pids[
|
|
4076
|
+
return `<property fmtid="${CUSTOM_PROPERTIES_FMTID}" pid="${pids[index3] ?? index3 + 2}" name="${escape(property.name, true)}"${link}>${variantXml(property)}</property>`;
|
|
4077
4077
|
}).join("");
|
|
4078
4078
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
4079
4079
|
<Properties xmlns="${NS.customProperties}" xmlns:vt="${NS.vt}">${body}</Properties>`;
|
|
@@ -5298,10 +5298,10 @@ var MONTH_NAMES = [
|
|
|
5298
5298
|
function monthFromName(name) {
|
|
5299
5299
|
const lower2 = name.toLowerCase();
|
|
5300
5300
|
if (lower2.length < 3) return void 0;
|
|
5301
|
-
const
|
|
5301
|
+
const index3 = MONTH_NAMES.findIndex(
|
|
5302
5302
|
(m) => m.startsWith(lower2) || lower2.length > 3 && lower2 === m
|
|
5303
5303
|
);
|
|
5304
|
-
return
|
|
5304
|
+
return index3 < 0 ? void 0 : index3 + 1;
|
|
5305
5305
|
}
|
|
5306
5306
|
function fullYear(text) {
|
|
5307
5307
|
const y = Number(text);
|
|
@@ -5528,10 +5528,10 @@ function internStyle(workbook, style2) {
|
|
|
5528
5528
|
const known = cache2.get(key);
|
|
5529
5529
|
if (known !== void 0 && workbook.styles[known] && styleKey(workbook.styles[known]) === key)
|
|
5530
5530
|
return known;
|
|
5531
|
-
const
|
|
5532
|
-
if (
|
|
5533
|
-
cache2.set(key,
|
|
5534
|
-
return
|
|
5531
|
+
const index3 = workbook.styles.findIndex((candidate) => styleKey(candidate) === key);
|
|
5532
|
+
if (index3 >= 0) {
|
|
5533
|
+
cache2.set(key, index3);
|
|
5534
|
+
return index3;
|
|
5535
5535
|
}
|
|
5536
5536
|
workbook.styles.push(style2);
|
|
5537
5537
|
cache2.set(key, workbook.styles.length - 1);
|
|
@@ -5638,7 +5638,7 @@ function createWorksheet(name, sheetId) {
|
|
|
5638
5638
|
function createWorkbook(options = {}) {
|
|
5639
5639
|
const names = options.sheets?.length ? options.sheets : ["Sheet1"];
|
|
5640
5640
|
return {
|
|
5641
|
-
sheets: names.map((name,
|
|
5641
|
+
sheets: names.map((name, index3) => createWorksheet(name, index3 + 1)),
|
|
5642
5642
|
styles: [defaultCellStyle()],
|
|
5643
5643
|
namedStyles: [{ name: "Normal", style: defaultCellStyle(), builtinId: 0 }],
|
|
5644
5644
|
definedNames: [],
|
|
@@ -6413,9 +6413,99 @@ function sparklineDataRange(workbook, sheet, source2) {
|
|
|
6413
6413
|
}
|
|
6414
6414
|
if (ast.type !== "ref" || !ast.ref || !["cell", "area"].includes(ast.ref.kind) || ast.prefix?.book || ast.prefix?.sheet2 || ast.spill)
|
|
6415
6415
|
throw new Error("The reference is not valid.");
|
|
6416
|
-
const
|
|
6417
|
-
if (!workbook.sheets[
|
|
6418
|
-
return { sheet:
|
|
6416
|
+
const index3 = ast.prefix ? workbook.sheets.findIndex((ws) => ws.name.toLowerCase() === ast.prefix.sheet.toLowerCase()) : sheet;
|
|
6417
|
+
if (!workbook.sheets[index3]) throw new Error("The reference is not valid.");
|
|
6418
|
+
return { sheet: index3, range: checkedSparklineRange({ start: ast.ref.start, end: ast.ref.end }) };
|
|
6419
|
+
}
|
|
6420
|
+
|
|
6421
|
+
// xlsx/pivot/page-filter.ts
|
|
6422
|
+
function validatePivotPageFilter(pivot) {
|
|
6423
|
+
const filter2 = pivot.pageFilter;
|
|
6424
|
+
const extras = Array.isArray(pivot.additionalValues) ? pivot.additionalValues : [];
|
|
6425
|
+
if (filter2 === void 0) return;
|
|
6426
|
+
if (!filter2 || typeof filter2 !== "object" || Array.isArray(filter2) || Object.keys(filter2).some((key) => key !== "field" && key !== "item") || typeof filter2.field !== "string" || !pivot.fields.includes(filter2.field) || [
|
|
6427
|
+
pivot.rowField,
|
|
6428
|
+
pivot.secondRowField,
|
|
6429
|
+
pivot.columnField,
|
|
6430
|
+
pivot.valueField,
|
|
6431
|
+
...extras.map((v) => v?.field)
|
|
6432
|
+
].includes(filter2.field) || pivot.valuesAxis === "rows")
|
|
6433
|
+
throw new Error("Report filters require Values on columns and a separate source field.");
|
|
6434
|
+
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))
|
|
6435
|
+
throw new Error("Choose a cached literal report filter item.");
|
|
6436
|
+
}
|
|
6437
|
+
function pivotPageProjection(pivot) {
|
|
6438
|
+
const filter2 = pivot.pageFilter;
|
|
6439
|
+
if (!filter2) return pivot;
|
|
6440
|
+
const labels = /* @__PURE__ */ new Map();
|
|
6441
|
+
for (const item of pivotItems(pivot, filter2.field)) {
|
|
6442
|
+
const label3 = String(pivotItemLabel(item)).toLowerCase(), key2 = pivotValueKey(item);
|
|
6443
|
+
if (label3 === "(all)" || labels.has(label3) && labels.get(label3) !== key2)
|
|
6444
|
+
throw new Error("Ambiguous report filter item captions are preserved.");
|
|
6445
|
+
labels.set(label3, key2);
|
|
6446
|
+
}
|
|
6447
|
+
if (filter2.item === void 0) return pivot;
|
|
6448
|
+
const index3 = pivot.fields.indexOf(filter2.field), key = pivotValueKey(filter2.item);
|
|
6449
|
+
const records = pivot.records.filter((record) => pivotValueKey(record[index3] ?? null) === key);
|
|
6450
|
+
if (!records.length) throw new Error("The report filter item is missing from the source.");
|
|
6451
|
+
if (JSON.stringify(records[0][index3] ?? null) !== JSON.stringify(filter2.item))
|
|
6452
|
+
throw new Error("Choose an exact cached literal report filter item.");
|
|
6453
|
+
return { ...pivot, records };
|
|
6454
|
+
}
|
|
6455
|
+
function prependPivotPage(grid, pivot) {
|
|
6456
|
+
if (!pivot.pageFilter) return grid;
|
|
6457
|
+
const width = grid.values[0].length;
|
|
6458
|
+
return {
|
|
6459
|
+
...grid,
|
|
6460
|
+
values: [
|
|
6461
|
+
[
|
|
6462
|
+
pivot.pageFilter.field,
|
|
6463
|
+
pivot.pageFilter.item === void 0 ? "(All)" : pivotItemLabel(pivot.pageFilter.item),
|
|
6464
|
+
...Array(width - 2).fill(null)
|
|
6465
|
+
],
|
|
6466
|
+
Array(width).fill(null),
|
|
6467
|
+
...grid.values
|
|
6468
|
+
],
|
|
6469
|
+
firstDataRow: grid.firstDataRow + 2,
|
|
6470
|
+
...grid.firstHeaderRow !== void 0 ? { firstHeaderRow: grid.firstHeaderRow + 2 } : {},
|
|
6471
|
+
...grid.indents ? { indents: [0, 0, ...grid.indents] } : {}
|
|
6472
|
+
};
|
|
6473
|
+
}
|
|
6474
|
+
var index = (raw2) => raw2 !== null && /^\d+$/.test(raw2.trim()) && Number.isSafeInteger(Number(raw2)) ? Number(raw2) : NaN;
|
|
6475
|
+
function readPivotPageFilter(root, fields, shared) {
|
|
6476
|
+
const list = first(root, "pageFields", NS.x), location = first(root, "location", NS.x);
|
|
6477
|
+
const definitions = children(first(root, "pivotFields", NS.x), "pivotField", NS.x);
|
|
6478
|
+
if (!list) {
|
|
6479
|
+
if (definitions.some((n) => n.getAttribute("axis") === "axisPage") || location?.hasAttribute("rowPageCount") || location?.hasAttribute("colPageCount"))
|
|
6480
|
+
throw new Error("Unmodeled report filter metadata");
|
|
6481
|
+
return;
|
|
6482
|
+
}
|
|
6483
|
+
if (root.getAttribute("multipleFieldFilters") === "1")
|
|
6484
|
+
throw new Error("Multiple report filters are preserved");
|
|
6485
|
+
const pages = children(list, "pageField", NS.x);
|
|
6486
|
+
if (pages.length !== 1 || list.getAttribute("count") !== "1" || location?.getAttribute("rowPageCount") !== "1" || location.getAttribute("colPageCount") !== "1")
|
|
6487
|
+
throw new Error("Only one report filter is modeled");
|
|
6488
|
+
const page = pages[0], field = index(page.getAttribute("fld"));
|
|
6489
|
+
if (page.getAttribute("hier") !== "-1" || !fields[field] || definitions[field]?.getAttribute("axis") !== "axisPage" || definitions.filter((n) => n.getAttribute("axis") === "axisPage").length !== 1)
|
|
6490
|
+
throw new Error("Unsupported report field");
|
|
6491
|
+
const container2 = first(definitions[field], "items", NS.x);
|
|
6492
|
+
const items = children(container2, "item", NS.x);
|
|
6493
|
+
if (!container2 || index(container2.getAttribute("count")) !== items.length || items.filter((n) => n.getAttribute("t") === "default").length !== 1 || items.at(-1)?.getAttribute("t") !== "default" || items.at(-1)?.hasAttribute("x"))
|
|
6494
|
+
throw new Error("Unsupported report field items");
|
|
6495
|
+
const data = items.slice(0, -1).map((item2) => {
|
|
6496
|
+
const i2 = index(item2.getAttribute("x"));
|
|
6497
|
+
if (item2.hasAttribute("t") || !Number.isInteger(i2) || i2 >= shared[field].length)
|
|
6498
|
+
throw new Error("Invalid report cache item");
|
|
6499
|
+
return i2;
|
|
6500
|
+
});
|
|
6501
|
+
if (new Set(data).size !== data.length || data.length !== shared[field].length)
|
|
6502
|
+
throw new Error("Incomplete report cache items");
|
|
6503
|
+
const item = page.getAttribute("item");
|
|
6504
|
+
if (item === null) return { field: fields[field] };
|
|
6505
|
+
const selected2 = index(item);
|
|
6506
|
+
if (!Number.isInteger(selected2) || selected2 >= data.length)
|
|
6507
|
+
throw new Error("Invalid report item selection");
|
|
6508
|
+
return { field: fields[field], item: shared[field][data[selected2]] };
|
|
6419
6509
|
}
|
|
6420
6510
|
|
|
6421
6511
|
// xlsx/pivot/data.ts
|
|
@@ -6424,10 +6514,10 @@ function pivotValueKey(value2) {
|
|
|
6424
6514
|
return value2 === null || value2 === "" ? "blank" : isCellError(value2) ? `error:${value2.error}` : `${typeof value2}:${String(value2).toLowerCase()}`;
|
|
6425
6515
|
}
|
|
6426
6516
|
function pivotItems(pivot, field) {
|
|
6427
|
-
const
|
|
6517
|
+
const index3 = pivot.fields.indexOf(field);
|
|
6428
6518
|
const items = /* @__PURE__ */ new Map();
|
|
6429
6519
|
for (const record of pivot.records) {
|
|
6430
|
-
const value2 = record[
|
|
6520
|
+
const value2 = record[index3] ?? null;
|
|
6431
6521
|
const key = pivotValueKey(value2);
|
|
6432
6522
|
if (!items.has(key)) items.set(key, value2);
|
|
6433
6523
|
}
|
|
@@ -6445,6 +6535,7 @@ function pivotItemLabel(value2) {
|
|
|
6445
6535
|
return isCellError(value2) ? value2.error : value2;
|
|
6446
6536
|
}
|
|
6447
6537
|
function validatePivotFields(pivot) {
|
|
6538
|
+
validatePivotPageFilter(pivot);
|
|
6448
6539
|
const used = [
|
|
6449
6540
|
pivot.rowField,
|
|
6450
6541
|
...pivot.secondRowField ? [pivot.secondRowField] : [],
|
|
@@ -6498,11 +6589,11 @@ function pivotHeaderDimensions(pivot, columnItems, rowLabels) {
|
|
|
6498
6589
|
const measures = 1 + (pivot.additionalValues?.length ?? 0);
|
|
6499
6590
|
if (pivot.valuesAxis === "rows")
|
|
6500
6591
|
return {
|
|
6501
|
-
rows: pivot.columnField ? 2 : 1,
|
|
6592
|
+
rows: (pivot.columnField ? 2 : 1) + (pivot.pageFilter ? 2 : 0),
|
|
6502
6593
|
width: rowLabels + (pivot.columnField ? columnItems + 1 : 1)
|
|
6503
6594
|
};
|
|
6504
6595
|
return {
|
|
6505
|
-
rows: pivot.columnField ? measures > 1 ? 3 : 2 : 1,
|
|
6596
|
+
rows: (pivot.columnField ? measures > 1 ? 3 : 2 : 1) + (pivot.pageFilter ? 2 : 0),
|
|
6506
6597
|
width: rowLabels + (pivot.columnField ? measures === 1 ? Math.max(1, columnItems) + 1 : (columnItems + 1) * measures : measures)
|
|
6507
6598
|
};
|
|
6508
6599
|
}
|
|
@@ -6646,7 +6737,7 @@ function hierarchicalPivotGrid(pivot) {
|
|
|
6646
6737
|
const groups = /* @__PURE__ */ new Map();
|
|
6647
6738
|
const details = /* @__PURE__ */ new Map();
|
|
6648
6739
|
const children2 = /* @__PURE__ */ new Map();
|
|
6649
|
-
const innerIndices = new Map(secondRowItems.map((item,
|
|
6740
|
+
const innerIndices = new Map(secondRowItems.map((item, index3) => [pivotValueKey(item), index3]));
|
|
6650
6741
|
const buckets = /* @__PURE__ */ new Map();
|
|
6651
6742
|
const collect = (map, key, record) => {
|
|
6652
6743
|
const list = map.get(key);
|
|
@@ -6838,6 +6929,9 @@ function hierarchicalPivotGrid(pivot) {
|
|
|
6838
6929
|
// xlsx/pivot/aggregate.ts
|
|
6839
6930
|
function pivotGrid(pivot) {
|
|
6840
6931
|
validatePivotFields(pivot);
|
|
6932
|
+
return prependPivotPage(pivotDataGrid(pivotPageProjection(pivot)), pivot);
|
|
6933
|
+
}
|
|
6934
|
+
function pivotDataGrid(pivot) {
|
|
6841
6935
|
if (pivot.secondRowField) return hierarchicalPivotGrid(pivot);
|
|
6842
6936
|
const rowItems = pivotItems(pivot, pivot.rowField);
|
|
6843
6937
|
const columnItems = pivot.columnField ? pivotItems(pivot, pivot.columnField) : [];
|
|
@@ -6879,7 +6973,7 @@ function pivotGrid(pivot) {
|
|
|
6879
6973
|
const measures = pivotMeasures(pivot);
|
|
6880
6974
|
const rowEntries = [];
|
|
6881
6975
|
const indents = values2.map(() => 0);
|
|
6882
|
-
const append = (caption, bands,
|
|
6976
|
+
const append = (caption, bands, index3, grand = false) => {
|
|
6883
6977
|
measures.forEach((measure, m) => {
|
|
6884
6978
|
values2.push([
|
|
6885
6979
|
...compact ? [grand ? `Total ${measure.caption}` : measure.caption] : [
|
|
@@ -6890,17 +6984,17 @@ function pivotGrid(pivot) {
|
|
|
6890
6984
|
]);
|
|
6891
6985
|
indents.push(compact && !grand ? 1 : 0);
|
|
6892
6986
|
rowEntries.push({
|
|
6893
|
-
indices: grand ? [0] : [
|
|
6987
|
+
indices: grand ? [0] : [index3, m],
|
|
6894
6988
|
measure: m,
|
|
6895
6989
|
...grand ? { type: "grand" } : {}
|
|
6896
6990
|
});
|
|
6897
6991
|
});
|
|
6898
6992
|
};
|
|
6899
|
-
rowItems.forEach((item,
|
|
6993
|
+
rowItems.forEach((item, index3) => {
|
|
6900
6994
|
const key = pivotValueKey(item);
|
|
6901
6995
|
if (headings) {
|
|
6902
6996
|
values2.push([label3(item), ...Array(dimensions.width - 1).fill(null)]);
|
|
6903
|
-
rowEntries.push({ indices: [
|
|
6997
|
+
rowEntries.push({ indices: [index3] });
|
|
6904
6998
|
indents.push(0);
|
|
6905
6999
|
}
|
|
6906
7000
|
append(
|
|
@@ -6911,7 +7005,7 @@ function pivotGrid(pivot) {
|
|
|
6911
7005
|
),
|
|
6912
7006
|
pivotNumbers(pivot, groups.get(key) ?? [])
|
|
6913
7007
|
],
|
|
6914
|
-
|
|
7008
|
+
index3
|
|
6915
7009
|
);
|
|
6916
7010
|
});
|
|
6917
7011
|
append(
|
|
@@ -6960,7 +7054,9 @@ var X14 = "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main";
|
|
|
6960
7054
|
var LAYOUT = "http://schemas.microsoft.com/office/spreadsheetml/2016/pivotdefaultlayout";
|
|
6961
7055
|
var TABLE = {
|
|
6962
7056
|
pivotTableDefinition: "name cacheId dataCaption dataOnRows dataPosition updatedVersion minRefreshableVersion createdVersion applyNumberFormats applyBorderFormats applyFontFormats applyPatternFormats applyAlignmentFormats applyWidthHeightFormats useAutoFormatting itemPrintTitles indent compact compactData outline outlineData multipleFieldFilters rowGrandTotals colGrandTotals",
|
|
6963
|
-
location: "ref firstHeaderRow firstDataRow firstDataCol",
|
|
7057
|
+
location: "ref firstHeaderRow firstDataRow firstDataCol rowPageCount colPageCount",
|
|
7058
|
+
pageFields: "count",
|
|
7059
|
+
pageField: "fld item hier",
|
|
6964
7060
|
pivotFields: "count",
|
|
6965
7061
|
pivotField: "axis dataField compact outline showAll subtotalTop defaultSubtotal",
|
|
6966
7062
|
items: "count",
|
|
@@ -7095,6 +7191,18 @@ function inlineFragment(xml) {
|
|
|
7095
7191
|
}
|
|
7096
7192
|
|
|
7097
7193
|
// xlsx/pivot/values-axis.ts
|
|
7194
|
+
function remapPivotRowEntries(entries, axes2) {
|
|
7195
|
+
return entries.map(
|
|
7196
|
+
(entry3) => entry3.type === "grand" ? entry3 : {
|
|
7197
|
+
...entry3,
|
|
7198
|
+
indices: entry3.indices.map((item, axis) => {
|
|
7199
|
+
const index3 = axes2[axis]?.[item];
|
|
7200
|
+
if (index3 === void 0) throw new Error("Invalid report row axis item");
|
|
7201
|
+
return index3;
|
|
7202
|
+
})
|
|
7203
|
+
}
|
|
7204
|
+
);
|
|
7205
|
+
}
|
|
7098
7206
|
function pivotFieldIndex(field) {
|
|
7099
7207
|
const raw2 = field?.getAttribute("x");
|
|
7100
7208
|
if (raw2 === null || raw2 === void 0 || !/^-?\d+$/.test(raw2.trim())) return NaN;
|
|
@@ -7102,15 +7210,15 @@ function pivotFieldIndex(field) {
|
|
|
7102
7210
|
return Number.isSafeInteger(value2) ? value2 : NaN;
|
|
7103
7211
|
}
|
|
7104
7212
|
function pivotValueIndex(root, axis) {
|
|
7105
|
-
const
|
|
7213
|
+
const index3 = axis.findIndex((field) => pivotFieldIndex(field) === -2);
|
|
7106
7214
|
const position = root.getAttribute("dataPosition");
|
|
7107
|
-
if (position !== null && (!/^\d+$/.test(position.trim()) || Number(position) !==
|
|
7215
|
+
if (position !== null && (!/^\d+$/.test(position.trim()) || Number(position) !== index3))
|
|
7108
7216
|
throw new Error("Inconsistent Values axis position");
|
|
7109
|
-
if (axis.length === 3 &&
|
|
7217
|
+
if (axis.length === 3 && index3 < 2 && position === null)
|
|
7110
7218
|
throw new Error("Missing leading or between-field Values position");
|
|
7111
|
-
return
|
|
7219
|
+
return index3;
|
|
7112
7220
|
}
|
|
7113
|
-
function pivotValueAxisItems(measures, columns) {
|
|
7221
|
+
function pivotValueAxisItems(measures, columns, columnIndices) {
|
|
7114
7222
|
const entries = [];
|
|
7115
7223
|
if (columns === void 0) {
|
|
7116
7224
|
for (let measure = 0; measure < measures; measure++)
|
|
@@ -7121,7 +7229,7 @@ function pivotValueAxisItems(measures, columns) {
|
|
|
7121
7229
|
for (let column = 0; column < columns; column++)
|
|
7122
7230
|
for (let measure = 0; measure < measures; measure++) {
|
|
7123
7231
|
entries.push(
|
|
7124
|
-
`<i${attrs({ r: measure ? 1 : void 0, i: measure || void 0 })}>${measure ? "" : `<x${attrs({ v: column || void 0 })}/>`}<x${attrs({ v: measure || void 0 })}/></i>`
|
|
7232
|
+
`<i${attrs({ r: measure ? 1 : void 0, i: measure || void 0 })}>${measure ? "" : `<x${attrs({ v: (columnIndices?.[column] ?? column) || void 0 })}/>`}<x${attrs({ v: measure || void 0 })}/></i>`
|
|
7125
7233
|
);
|
|
7126
7234
|
}
|
|
7127
7235
|
for (let measure = 0; measure < measures; measure++)
|
|
@@ -7130,11 +7238,169 @@ function pivotValueAxisItems(measures, columns) {
|
|
|
7130
7238
|
return `<colItems count="${entries.length}">${entries.join("")}</colItems>`;
|
|
7131
7239
|
}
|
|
7132
7240
|
function supportedPivotAxes(rows, columns, measures, valuesOnRows) {
|
|
7133
|
-
const
|
|
7241
|
+
const index3 = pivotFieldIndex;
|
|
7134
7242
|
if (valuesOnRows)
|
|
7135
|
-
return measures > 1 && (rows.length === 2 || rows.length === 3) && (
|
|
7136
|
-
if (rows.some((field) => !Number.isInteger(
|
|
7137
|
-
return measures === 1 ? columns.length <= 1 : columns.length >= 1 && columns.length <= 2 &&
|
|
7243
|
+
return measures > 1 && (rows.length === 2 || rows.length === 3) && (index3(rows[0]) >= 0 || rows.length === 3) && rows.filter((field) => index3(field) === -2).length === 1 && rows.filter((field) => index3(field) !== -2).every((field) => index3(field) >= 0) && columns.length <= 1 && (!columns.length || index3(columns[0]) >= 0);
|
|
7244
|
+
if (rows.some((field) => !Number.isInteger(index3(field)) || index3(field) < 0)) return false;
|
|
7245
|
+
return measures === 1 ? columns.length <= 1 : columns.length >= 1 && columns.length <= 2 && index3(columns.at(-1)) === -2 && (columns.length !== 2 || index3(columns[0]) >= 0);
|
|
7246
|
+
}
|
|
7247
|
+
|
|
7248
|
+
// drawingml/dom.ts
|
|
7249
|
+
function attributeReader(element2) {
|
|
7250
|
+
return (name) => {
|
|
7251
|
+
if (!element2) return void 0;
|
|
7252
|
+
const direct = element2.getAttribute(name);
|
|
7253
|
+
if (direct !== null) return direct;
|
|
7254
|
+
const attributes = element2.attributes;
|
|
7255
|
+
for (let index3 = 0; index3 < attributes.length; index3++) {
|
|
7256
|
+
const candidate = attributes.item(index3);
|
|
7257
|
+
if (candidate && candidate.localName === name) return candidate.value;
|
|
7258
|
+
}
|
|
7259
|
+
return void 0;
|
|
7260
|
+
};
|
|
7261
|
+
}
|
|
7262
|
+
function stringAttribute(element2, name) {
|
|
7263
|
+
const value2 = attributeReader(element2)(name)?.trim();
|
|
7264
|
+
return value2 ? value2 : void 0;
|
|
7265
|
+
}
|
|
7266
|
+
function integerAttribute(element2, name) {
|
|
7267
|
+
const parsed = Number.parseInt(attributeReader(element2)(name) ?? "", 10);
|
|
7268
|
+
return Number.isFinite(parsed) ? parsed : void 0;
|
|
7269
|
+
}
|
|
7270
|
+
function booleanAttribute(element2, name) {
|
|
7271
|
+
const value2 = attributeReader(element2)(name)?.trim().toLowerCase();
|
|
7272
|
+
if (value2 === "1" || value2 === "true") return true;
|
|
7273
|
+
if (value2 === "0" || value2 === "false") return false;
|
|
7274
|
+
return void 0;
|
|
7275
|
+
}
|
|
7276
|
+
function descendants2(root, local) {
|
|
7277
|
+
const result2 = [];
|
|
7278
|
+
const visit = (node) => {
|
|
7279
|
+
for (const child4 of Array.from(node.childNodes)) {
|
|
7280
|
+
if (!isElement(child4)) continue;
|
|
7281
|
+
if (child4.localName === local) result2.push(child4);
|
|
7282
|
+
visit(child4);
|
|
7283
|
+
}
|
|
7284
|
+
};
|
|
7285
|
+
visit(root);
|
|
7286
|
+
return result2;
|
|
7287
|
+
}
|
|
7288
|
+
|
|
7289
|
+
// xlsx/pivot/page-filter-admission.ts
|
|
7290
|
+
var integer = (value2, fallback) => value2 === null ? fallback ?? NaN : /^\d+$/.test(value2.trim()) && Number.isSafeInteger(Number(value2)) ? Number(value2) : NaN;
|
|
7291
|
+
function assertPageAxisItems(root, pivot, shared, cache2, recordRoot) {
|
|
7292
|
+
if (!pivot.pageFilter) return;
|
|
7293
|
+
const literals = (node) => {
|
|
7294
|
+
const raw2 = node.getAttribute("v");
|
|
7295
|
+
if (node.localName === "x" && (raw2 === null || !/^\d+$/.test(raw2.trim())) || node.localName === "b" && !["0", "1"].includes(raw2 ?? "") || node.localName === "n" && (raw2 === null || !/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/.test(raw2.trim())))
|
|
7296
|
+
throw new Error("Unmodeled report cache literal");
|
|
7297
|
+
for (const child4 of elements(node)) literals(child4);
|
|
7298
|
+
};
|
|
7299
|
+
literals(cache2);
|
|
7300
|
+
literals(recordRoot);
|
|
7301
|
+
const cacheFields = children(first(cache2, "cacheFields", NS.x), "cacheField", NS.x);
|
|
7302
|
+
if (pivot.columnField) {
|
|
7303
|
+
const column = children(first(root, "pivotFields", NS.x), "pivotField", NS.x)[pivot.fields.indexOf(pivot.columnField)];
|
|
7304
|
+
const list = first(column, "extLst", NS.x);
|
|
7305
|
+
const extensions = list ? children(list, "ext", NS.x) : [];
|
|
7306
|
+
if (extensions.some(
|
|
7307
|
+
(extension) => children(
|
|
7308
|
+
extension,
|
|
7309
|
+
"pivotField",
|
|
7310
|
+
"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"
|
|
7311
|
+
).some((field) => {
|
|
7312
|
+
const raw2 = field.getAttribute("fillDownLabels");
|
|
7313
|
+
if (raw2 !== null && !["0", "1", "false", "true"].includes(raw2.trim()))
|
|
7314
|
+
throw new Error("Invalid report column label repetition");
|
|
7315
|
+
return booleanAttribute(field, "fillDownLabels") === true;
|
|
7316
|
+
})
|
|
7317
|
+
))
|
|
7318
|
+
throw new Error("Repeated report column labels are preserved");
|
|
7319
|
+
}
|
|
7320
|
+
if (integer(first(cache2, "cacheFields", NS.x)?.getAttribute("count") ?? null) !== pivot.fields.length || integer(cache2.getAttribute("recordCount")) !== pivot.records.length || integer(recordRoot.getAttribute("count")) !== pivot.records.length)
|
|
7321
|
+
throw new Error("Inconsistent report cache counts");
|
|
7322
|
+
for (const name of [
|
|
7323
|
+
pivot.rowField,
|
|
7324
|
+
pivot.secondRowField,
|
|
7325
|
+
pivot.columnField,
|
|
7326
|
+
pivot.pageFilter.field
|
|
7327
|
+
].filter(Boolean)) {
|
|
7328
|
+
const field = pivot.fields.indexOf(name);
|
|
7329
|
+
if (integer(first(cacheFields[field], "sharedItems", NS.x)?.getAttribute("count") ?? null) !== shared[field].length)
|
|
7330
|
+
throw new Error("Inconsistent report shared-item counts");
|
|
7331
|
+
}
|
|
7332
|
+
for (const name of ["rowFields", "colFields"]) {
|
|
7333
|
+
const list = first(root, name, NS.x);
|
|
7334
|
+
if (list && integer(list.getAttribute("count")) !== children(list, "field", NS.x).length)
|
|
7335
|
+
throw new Error("Inconsistent report axis counts");
|
|
7336
|
+
}
|
|
7337
|
+
const projected = pivotPageProjection(pivot), fields = children(first(root, "pivotFields", NS.x), "pivotField", NS.x);
|
|
7338
|
+
const axisValues = (name, axis) => {
|
|
7339
|
+
const f6 = pivot.fields.indexOf(name), node = fields[f6], list = first(node, "items", NS.x), items = children(list, "item", NS.x), count2 = shared[f6].length;
|
|
7340
|
+
if (node.getAttribute("axis") !== axis) throw new Error("Inconsistent report axis field");
|
|
7341
|
+
const defaults = node.getAttribute("defaultSubtotal") !== "0";
|
|
7342
|
+
if (!list || integer(list.getAttribute("count")) !== items.length || items.length !== count2 + Number(defaults))
|
|
7343
|
+
throw new Error("Incomplete page-axis field items");
|
|
7344
|
+
const data = items.slice(0, count2).map((item) => {
|
|
7345
|
+
const i2 = integer(item.getAttribute("x"));
|
|
7346
|
+
if (item.hasAttribute("t") || !Number.isInteger(i2) || i2 >= count2)
|
|
7347
|
+
throw new Error("Invalid page-axis cache item");
|
|
7348
|
+
return shared[f6][i2];
|
|
7349
|
+
});
|
|
7350
|
+
if (new Set(data.map(pivotValueKey)).size !== count2 || defaults && (items.at(-1)?.getAttribute("t") !== "default" || items.at(-1)?.hasAttribute("x")))
|
|
7351
|
+
throw new Error("Invalid page-axis default item");
|
|
7352
|
+
const indices = new Map(data.map((v, i2) => [pivotValueKey(v), i2]));
|
|
7353
|
+
return pivotItems(projected, name).map((v) => indices.get(pivotValueKey(v)));
|
|
7354
|
+
};
|
|
7355
|
+
const read = (name) => {
|
|
7356
|
+
const list = first(root, name, NS.x), items = children(list, "i", NS.x);
|
|
7357
|
+
if (!list || integer(list.getAttribute("count")) !== items.length)
|
|
7358
|
+
throw new Error("Invalid page-axis item count");
|
|
7359
|
+
return items;
|
|
7360
|
+
};
|
|
7361
|
+
const rows = axisValues(pivot.rowField, "axisRow"), rowItems = read("rowItems");
|
|
7362
|
+
const grid = pivotGrid(pivot);
|
|
7363
|
+
const entries = grid.rowEntries ? remapPivotRowEntries(grid.rowEntries, [
|
|
7364
|
+
rows,
|
|
7365
|
+
pivot.secondRowField ? axisValues(pivot.secondRowField, "axisRow") : []
|
|
7366
|
+
]) : [
|
|
7367
|
+
...rows.map((index3) => ({ indices: [index3], type: void 0 })),
|
|
7368
|
+
{ indices: [0], type: "grand" }
|
|
7369
|
+
];
|
|
7370
|
+
if (rowItems.length !== entries.length) throw new Error("Invalid page row items");
|
|
7371
|
+
let previousRow = [];
|
|
7372
|
+
rowItems.forEach((item, i2) => {
|
|
7373
|
+
const expected2 = entries[i2];
|
|
7374
|
+
const xs = children(item, "x", NS.x).map((x) => integer(x.getAttribute("v"), 0)), prefix = integer(item.getAttribute("r"), 0);
|
|
7375
|
+
if (item.getAttribute("t") !== (expected2.type ?? null) || !Number.isInteger(prefix) || prefix < 0 || prefix > previousRow.length || prefix >= expected2.indices.length || expected2.type && prefix !== 0 || integer(item.getAttribute("i"), 0) !== 0 || JSON.stringify([...previousRow.slice(0, prefix), ...xs]) !== JSON.stringify(expected2.indices))
|
|
7376
|
+
throw new Error("Unmodeled page row item");
|
|
7377
|
+
previousRow = expected2.type ? [] : expected2.indices;
|
|
7378
|
+
});
|
|
7379
|
+
const measures = 1 + (pivot.additionalValues?.length ?? 0), columns = pivot.columnField ? axisValues(pivot.columnField, "axisCol") : void 0, expected = [];
|
|
7380
|
+
if (columns)
|
|
7381
|
+
for (const col of columns)
|
|
7382
|
+
for (let m = 0; m < measures; m++) expected.push(measures > 1 ? [col, m] : [col]);
|
|
7383
|
+
else for (let m = 0; m < measures; m++) expected.push([m]);
|
|
7384
|
+
const colItems = read("colItems");
|
|
7385
|
+
if (colItems.length !== expected.length + (columns ? measures : 0))
|
|
7386
|
+
throw new Error("Invalid page column items");
|
|
7387
|
+
let previous = [];
|
|
7388
|
+
colItems.forEach((item, i2) => {
|
|
7389
|
+
const grand = i2 >= expected.length, measure = grand ? i2 - expected.length : i2 % measures;
|
|
7390
|
+
const xs = children(item, "x", NS.x).map((x) => integer(x.getAttribute("v"), 0)), prefix = integer(item.getAttribute("r"), 0);
|
|
7391
|
+
if (integer(item.getAttribute("i"), 0) !== measure || !Number.isInteger(prefix) || prefix < 0 || prefix > Math.max(0, previous.length - 1))
|
|
7392
|
+
throw new Error("Invalid page column prefix");
|
|
7393
|
+
if (grand) {
|
|
7394
|
+
if (item.getAttribute("t") !== "grand" || prefix !== 0 || xs.length !== 1 || xs[0] !== 0)
|
|
7395
|
+
throw new Error("Unmodeled page grand item");
|
|
7396
|
+
previous = [];
|
|
7397
|
+
return;
|
|
7398
|
+
}
|
|
7399
|
+
const values2 = !columns && measures === 1 && xs.length === 0 && prefix === 0 ? [0] : [...previous.slice(0, prefix), ...xs];
|
|
7400
|
+
if (item.hasAttribute("t") || JSON.stringify(values2) !== JSON.stringify(expected[i2]))
|
|
7401
|
+
throw new Error("Unmodeled page column item");
|
|
7402
|
+
previous = values2;
|
|
7403
|
+
});
|
|
7138
7404
|
}
|
|
7139
7405
|
|
|
7140
7406
|
// xlsx/pivot/read.ts
|
|
@@ -7174,20 +7440,21 @@ function readOne(workbook, source2, part) {
|
|
|
7174
7440
|
const rowsAxis = att(root, "dataOnRows") === "1";
|
|
7175
7441
|
if (!dataSheet || !dataRange || !recordPart || !workbook.sheets.some((sheet) => sheet.name === dataSheet))
|
|
7176
7442
|
throw new Error("Unsupported pivot source");
|
|
7177
|
-
|
|
7443
|
+
const recordRoot = parseXml(source2.text(recordPart)).documentElement;
|
|
7444
|
+
assertPivotRecords(recordRoot);
|
|
7178
7445
|
const fields = children(first(cache2, "cacheFields", NS.x), "cacheField", NS.x);
|
|
7179
7446
|
if (fields.some((field) => first(field, "fieldGroup", NS.x) || field.hasAttribute("formula")))
|
|
7180
7447
|
throw new Error("Grouped or calculated cache field");
|
|
7181
7448
|
const shared = fields.map(
|
|
7182
7449
|
(field) => elements(first(field, "sharedItems", NS.x) ?? parseXml("<root/>").documentElement).map(value)
|
|
7183
7450
|
);
|
|
7184
|
-
const records = children(
|
|
7451
|
+
const records = children(recordRoot, "r", NS.x).map(
|
|
7185
7452
|
(record) => elements(record).map((node, field) => {
|
|
7186
7453
|
if (node.localName !== "x") return value(node);
|
|
7187
|
-
const
|
|
7188
|
-
if (!Number.isInteger(
|
|
7454
|
+
const index3 = Number(att(node, "v"));
|
|
7455
|
+
if (!Number.isInteger(index3) || index3 < 0 || index3 >= (shared[field]?.length ?? 0))
|
|
7189
7456
|
throw new Error("Invalid pivot cache index");
|
|
7190
|
-
return shared[field][
|
|
7457
|
+
return shared[field][index3];
|
|
7191
7458
|
})
|
|
7192
7459
|
);
|
|
7193
7460
|
if (records.some((record) => record.length !== fields.length) || records.length * fields.length > 1e6)
|
|
@@ -7207,7 +7474,7 @@ function readOne(workbook, source2, part) {
|
|
|
7207
7474
|
"dataField",
|
|
7208
7475
|
NS.x
|
|
7209
7476
|
);
|
|
7210
|
-
if (rowFields.length < 1 || rowFields.length > (rowsAxis ? 3 : 2) || dataFields.length < 1 || dataFields.length > 16 || !supportedPivotAxes(rowFields, colFields, dataFields.length, rowsAxis) || first(root, "
|
|
7477
|
+
if (rowFields.length < 1 || rowFields.length > (rowsAxis ? 3 : 2) || dataFields.length < 1 || dataFields.length > 16 || !supportedPivotAxes(rowFields, colFields, dataFields.length, rowsAxis) || first(root, "filters", NS.x) || root.getAttribute("rowGrandTotals") === "0" || root.getAttribute("colGrandTotals") === "0")
|
|
7211
7478
|
throw new Error("Unsupported pivot layout");
|
|
7212
7479
|
const valueIndex = pivotValueIndex(root, rowsAxis ? rowFields : colFields);
|
|
7213
7480
|
const measure = dataFields[0];
|
|
@@ -7229,8 +7496,8 @@ function readOne(workbook, source2, part) {
|
|
|
7229
7496
|
"i",
|
|
7230
7497
|
NS.x
|
|
7231
7498
|
)) {
|
|
7232
|
-
const
|
|
7233
|
-
if (!Number.isInteger(
|
|
7499
|
+
const index3 = Number(att(item, "i") ?? "0");
|
|
7500
|
+
if (!Number.isInteger(index3) || index3 < 0 || index3 >= count2)
|
|
7234
7501
|
throw new Error("Unsupported Values axis item");
|
|
7235
7502
|
}
|
|
7236
7503
|
}
|
|
@@ -7241,6 +7508,7 @@ function readOne(workbook, source2, part) {
|
|
|
7241
7508
|
const realRows = rowsAxis ? rowFields.filter((field) => pivotFieldIndex(field) !== -2) : rowFields;
|
|
7242
7509
|
const row2 = names[pivotFieldIndex(realRows[0])];
|
|
7243
7510
|
const second = realRows[1] ? names[Number(att(realRows[1], "x"))] : void 0;
|
|
7511
|
+
const pageFilter = readPivotPageFilter(root, names, shared);
|
|
7244
7512
|
const tableFields = children(first(root, "pivotFields", NS.x), "pivotField", NS.x);
|
|
7245
7513
|
const outer = tableFields[pivotFieldIndex(realRows[0])];
|
|
7246
7514
|
const compact = att(outer, "compact") !== "0";
|
|
@@ -7270,7 +7538,12 @@ function readOne(workbook, source2, part) {
|
|
|
7270
7538
|
const location = parseRange(att(first(root, "location", NS.x), "ref") ?? "");
|
|
7271
7539
|
if (!row2 || !data || !location || hasColumn && !col || realRows.length === 2 && !second)
|
|
7272
7540
|
throw new Error("Invalid pivot fields");
|
|
7541
|
+
if (pageFilter) {
|
|
7542
|
+
if (location.start.row < 2) throw new Error("Invalid report filter location");
|
|
7543
|
+
location.start.row -= 2;
|
|
7544
|
+
}
|
|
7273
7545
|
const pivot = {
|
|
7546
|
+
...pageFilter ? { pageFilter } : {},
|
|
7274
7547
|
name: att(root, "name") ?? "PivotTable",
|
|
7275
7548
|
source: `${quoteSheetName(dataSheet)}!${formatRange(dataRange)}`,
|
|
7276
7549
|
rowField: row2,
|
|
@@ -7302,6 +7575,7 @@ function readOne(workbook, source2, part) {
|
|
|
7302
7575
|
sourceXml: xml,
|
|
7303
7576
|
...col ? { columnField: col } : {}
|
|
7304
7577
|
};
|
|
7578
|
+
assertPageAxisItems(root, pivot, shared, cache2, recordRoot);
|
|
7305
7579
|
return pivot;
|
|
7306
7580
|
}
|
|
7307
7581
|
function readPivotTables(workbook, source2, warn) {
|
|
@@ -7627,10 +7901,10 @@ function parseDynamicArrayMetadata(xml) {
|
|
|
7627
7901
|
const flag2 = props?.getAttribute("fDynamic");
|
|
7628
7902
|
return flag2 === "1" || flag2 === "true";
|
|
7629
7903
|
});
|
|
7630
|
-
childrenNamed(top.get("cellMetadata")?.[0], "bk").forEach((bk,
|
|
7904
|
+
childrenNamed(top.get("cellMetadata")?.[0], "bk").forEach((bk, index3) => {
|
|
7631
7905
|
for (const rc of childrenNamed(bk, "rc")) {
|
|
7632
7906
|
const type = types[Number(att(rc, "t")) - 1];
|
|
7633
|
-
if (type === DYNAMIC_ARRAY_TYPE && dynamic[Number(att(rc, "v"))]) out.add(
|
|
7907
|
+
if (type === DYNAMIC_ARRAY_TYPE && dynamic[Number(att(rc, "v"))]) out.add(index3 + 1);
|
|
7634
7908
|
}
|
|
7635
7909
|
});
|
|
7636
7910
|
return out;
|
|
@@ -7908,13 +8182,13 @@ function parseStyles(xml, warnings) {
|
|
|
7908
8182
|
const named2 = namesByXf.get(xfId);
|
|
7909
8183
|
if (named2 && xfId !== 0 && named2 !== "Normal") style2.cellStyleName = named2;
|
|
7910
8184
|
const key = styleKey(style2);
|
|
7911
|
-
let
|
|
7912
|
-
if (
|
|
7913
|
-
|
|
8185
|
+
let index3 = keys.get(key);
|
|
8186
|
+
if (index3 === void 0) {
|
|
8187
|
+
index3 = styles.length;
|
|
7914
8188
|
styles.push(style2);
|
|
7915
|
-
keys.set(key,
|
|
8189
|
+
keys.set(key, index3);
|
|
7916
8190
|
}
|
|
7917
|
-
xfMap.push(
|
|
8191
|
+
xfMap.push(index3);
|
|
7918
8192
|
}
|
|
7919
8193
|
if (!styles.length) {
|
|
7920
8194
|
styles.push(fallback);
|
|
@@ -7928,47 +8202,6 @@ function parseStyles(xml, warnings) {
|
|
|
7928
8202
|
return result2;
|
|
7929
8203
|
}
|
|
7930
8204
|
|
|
7931
|
-
// drawingml/dom.ts
|
|
7932
|
-
function attributeReader(element2) {
|
|
7933
|
-
return (name) => {
|
|
7934
|
-
if (!element2) return void 0;
|
|
7935
|
-
const direct = element2.getAttribute(name);
|
|
7936
|
-
if (direct !== null) return direct;
|
|
7937
|
-
const attributes = element2.attributes;
|
|
7938
|
-
for (let index2 = 0; index2 < attributes.length; index2++) {
|
|
7939
|
-
const candidate = attributes.item(index2);
|
|
7940
|
-
if (candidate && candidate.localName === name) return candidate.value;
|
|
7941
|
-
}
|
|
7942
|
-
return void 0;
|
|
7943
|
-
};
|
|
7944
|
-
}
|
|
7945
|
-
function stringAttribute(element2, name) {
|
|
7946
|
-
const value2 = attributeReader(element2)(name)?.trim();
|
|
7947
|
-
return value2 ? value2 : void 0;
|
|
7948
|
-
}
|
|
7949
|
-
function integerAttribute(element2, name) {
|
|
7950
|
-
const parsed = Number.parseInt(attributeReader(element2)(name) ?? "", 10);
|
|
7951
|
-
return Number.isFinite(parsed) ? parsed : void 0;
|
|
7952
|
-
}
|
|
7953
|
-
function booleanAttribute(element2, name) {
|
|
7954
|
-
const value2 = attributeReader(element2)(name)?.trim().toLowerCase();
|
|
7955
|
-
if (value2 === "1" || value2 === "true") return true;
|
|
7956
|
-
if (value2 === "0" || value2 === "false") return false;
|
|
7957
|
-
return void 0;
|
|
7958
|
-
}
|
|
7959
|
-
function descendants2(root, local) {
|
|
7960
|
-
const result2 = [];
|
|
7961
|
-
const visit = (node) => {
|
|
7962
|
-
for (const child4 of Array.from(node.childNodes)) {
|
|
7963
|
-
if (!isElement(child4)) continue;
|
|
7964
|
-
if (child4.localName === local) result2.push(child4);
|
|
7965
|
-
visit(child4);
|
|
7966
|
-
}
|
|
7967
|
-
};
|
|
7968
|
-
visit(root);
|
|
7969
|
-
return result2;
|
|
7970
|
-
}
|
|
7971
|
-
|
|
7972
8205
|
// drawingml/drawing-color.ts
|
|
7973
8206
|
var COLOR_ELEMENTS = {
|
|
7974
8207
|
srgbClr: "srgb",
|
|
@@ -8114,7 +8347,7 @@ function parseTheme2(xml) {
|
|
|
8114
8347
|
if (!xml) return palette;
|
|
8115
8348
|
const theme = parseTheme(parseXml(xml, { label: "XLSX theme" }));
|
|
8116
8349
|
palette.colors = PALETTE_SLOTS.map(
|
|
8117
|
-
(slot2,
|
|
8350
|
+
(slot2, index3) => paletteHex(theme.colorScheme.colors[slot2]) ?? DEFAULT_THEME.colors[index3] ?? "000000"
|
|
8118
8351
|
);
|
|
8119
8352
|
palette.majorFont = theme.fontScheme.major.latin ?? palette.majorFont;
|
|
8120
8353
|
palette.minorFont = theme.fontScheme.minor.latin ?? palette.minorFont;
|
|
@@ -8502,11 +8735,11 @@ function readModernHash(node, prefix = "") {
|
|
|
8502
8735
|
function parseWorkbookPart(xml) {
|
|
8503
8736
|
const root = parseXml(xml, { label: "XLSX workbook" }).documentElement;
|
|
8504
8737
|
const sheets = [];
|
|
8505
|
-
xChildren(xFirst(root, "sheets") ?? root, "sheet").forEach((node,
|
|
8738
|
+
xChildren(xFirst(root, "sheets") ?? root, "sheet").forEach((node, index3) => {
|
|
8506
8739
|
const state = att(node, "state");
|
|
8507
8740
|
sheets.push({
|
|
8508
|
-
name: att(node, "name") ?? `Sheet${
|
|
8509
|
-
sheetId: numAttr(node, "sheetId") ??
|
|
8741
|
+
name: att(node, "name") ?? `Sheet${index3 + 1}`,
|
|
8742
|
+
sheetId: numAttr(node, "sheetId") ?? index3 + 1,
|
|
8510
8743
|
state: state === "hidden" || state === "veryHidden" ? state : "visible",
|
|
8511
8744
|
relId: relAttr(node, "id") ?? ""
|
|
8512
8745
|
});
|
|
@@ -8856,8 +9089,8 @@ function styleRef(element2) {
|
|
|
8856
9089
|
if (element2.localName === "fontRef") {
|
|
8857
9090
|
if (raw2) ref.fontIndex = raw2;
|
|
8858
9091
|
} else {
|
|
8859
|
-
const
|
|
8860
|
-
if (Number.isFinite(
|
|
9092
|
+
const index3 = Number.parseInt(raw2 ?? "", 10);
|
|
9093
|
+
if (Number.isFinite(index3)) ref.index = index3;
|
|
8861
9094
|
}
|
|
8862
9095
|
const color = parseDrawingColorIn(element2);
|
|
8863
9096
|
if (color) ref.color = color;
|
|
@@ -9236,11 +9469,11 @@ function groupTransform(group, parent) {
|
|
|
9236
9469
|
scaleY: parent.scaleY * local.scaleY
|
|
9237
9470
|
};
|
|
9238
9471
|
}
|
|
9239
|
-
function parseShape(sp,
|
|
9472
|
+
function parseShape(sp, index3, group, issues) {
|
|
9240
9473
|
const spPr = first(sp, "spPr", NS.dsp);
|
|
9241
9474
|
const transform6 = parseTransform(first(spPr, "xfrm", NS.a));
|
|
9242
9475
|
if (!transform6) return void 0;
|
|
9243
|
-
const modelId = stringAttribute(sp, "modelId") ?? stringAttribute(first(first(sp, "nvSpPr", NS.dsp), "cNvPr", NS.dsp), "id") ?? `dsp-${
|
|
9476
|
+
const modelId = stringAttribute(sp, "modelId") ?? stringAttribute(first(first(sp, "nvSpPr", NS.dsp), "cNvPr", NS.dsp), "id") ?? `dsp-${index3}`;
|
|
9244
9477
|
const { geometry, adjustments, paths, issue } = parseDrawingGeometry(spPr);
|
|
9245
9478
|
if (issue) issues.push({ code: issue, message: `Shape ${modelId}: ${issue}.` });
|
|
9246
9479
|
const frame = applyGroup(transform6.frame, group);
|
|
@@ -9458,8 +9691,8 @@ function drawingFillXml(fill) {
|
|
|
9458
9691
|
const stops = children(list, "gs", NS.a).filter(
|
|
9459
9692
|
(node) => parseDrawingColorIn(node) && Number.isFinite(Number.parseInt(node.getAttribute("pos") ?? "", 10))
|
|
9460
9693
|
);
|
|
9461
|
-
fill.stops.forEach((stop,
|
|
9462
|
-
const node = stops[
|
|
9694
|
+
fill.stops.forEach((stop, index3) => {
|
|
9695
|
+
const node = stops[index3] ?? doc.createElementNS(NS.a, "a:gs");
|
|
9463
9696
|
if (!node.parentNode) list.appendChild(node);
|
|
9464
9697
|
node.setAttribute("pos", String(Math.round(stop.position * 1e3)));
|
|
9465
9698
|
for (const old of elements(node))
|
|
@@ -9977,8 +10210,8 @@ function writeSettings(node, rule) {
|
|
|
9977
10210
|
if (rule.minLength !== void 0) bar.setAttribute("minLength", String(rule.minLength));
|
|
9978
10211
|
if (rule.maxLength !== void 0) bar.setAttribute("maxLength", String(rule.maxLength));
|
|
9979
10212
|
const thresholds = children(bar, "cfvo", NS.x14);
|
|
9980
|
-
for (const [
|
|
9981
|
-
const target = thresholds[
|
|
10213
|
+
for (const [index3, threshold] of [rule.min, rule.max].entries()) {
|
|
10214
|
+
const target = thresholds[index3];
|
|
9982
10215
|
if (!target) continue;
|
|
9983
10216
|
const oldType = target.getAttribute("type");
|
|
9984
10217
|
if (oldType === "autoMin" && threshold.type === "min" || oldType === "autoMax" && threshold.type === "max")
|
|
@@ -10242,7 +10475,7 @@ function chartCacheValues(cache2) {
|
|
|
10242
10475
|
out[point.index ?? out.length] = numeric2 && text.trim() !== "" && Number.isFinite(Number(text)) ? Number(text) : text;
|
|
10243
10476
|
}
|
|
10244
10477
|
const size = Math.max(cache2.pointCount ?? 0, out.length);
|
|
10245
|
-
for (let
|
|
10478
|
+
for (let index3 = 0; index3 < size; index3++) if (out[index3] === void 0) out[index3] = "";
|
|
10246
10479
|
return out;
|
|
10247
10480
|
}
|
|
10248
10481
|
var chartSourceValues = (source2) => chartCacheValues(source2?.cache ?? source2?.levels?.[0]);
|
|
@@ -10377,8 +10610,8 @@ function parseCache(node) {
|
|
|
10377
10610
|
type: node.localName === "numCache" || node.localName === "numLit" ? "number" : "string",
|
|
10378
10611
|
points: children(node, "pt", NS.c).map((pt) => {
|
|
10379
10612
|
const point = { value: cChild(pt, "v")?.textContent ?? "" };
|
|
10380
|
-
const
|
|
10381
|
-
if (Number.isInteger(
|
|
10613
|
+
const index3 = Number(attribute(pt, "idx") ?? Number.NaN);
|
|
10614
|
+
if (Number.isInteger(index3) && index3 >= 0) point.index = index3;
|
|
10382
10615
|
const formatCode2 = attribute(pt, "formatCode");
|
|
10383
10616
|
if (formatCode2 !== void 0) point.formatCode = formatCode2;
|
|
10384
10617
|
return point;
|
|
@@ -10604,11 +10837,11 @@ var POINT = /* @__PURE__ */ new Set([
|
|
|
10604
10837
|
]);
|
|
10605
10838
|
function parseDataPoint(context, element2) {
|
|
10606
10839
|
reportUnmodelled(context, element2, POINT);
|
|
10607
|
-
const
|
|
10840
|
+
const index3 = cNumber(context, element2, "idx");
|
|
10608
10841
|
return assignDefined(
|
|
10609
10842
|
{},
|
|
10610
10843
|
{
|
|
10611
|
-
index:
|
|
10844
|
+
index: index3 !== void 0 && Number.isInteger(index3) && index3 >= 0 ? index3 : void 0,
|
|
10612
10845
|
invertIfNegative: cBool(context, element2, "invertIfNegative"),
|
|
10613
10846
|
bubble3D: cBool(context, element2, "bubble3D"),
|
|
10614
10847
|
explosion: cNumber(context, element2, "explosion"),
|
|
@@ -11145,8 +11378,8 @@ var SCHEME_INDEX = {
|
|
|
11145
11378
|
function legacyColor(color) {
|
|
11146
11379
|
if (color?.kind === "srgb") return color.value ? { rgb: color.value.toUpperCase() } : void 0;
|
|
11147
11380
|
if (color?.kind === "scheme") {
|
|
11148
|
-
const
|
|
11149
|
-
return
|
|
11381
|
+
const index3 = SCHEME_INDEX[color.value];
|
|
11382
|
+
return index3 === void 0 ? void 0 : { theme: index3 };
|
|
11150
11383
|
}
|
|
11151
11384
|
return void 0;
|
|
11152
11385
|
}
|
|
@@ -11997,14 +12230,14 @@ var PersonRegistry = class {
|
|
|
11997
12230
|
return `${XML_HEADER}<personList xmlns="${NS.tc}" xmlns:x="${NS.x}">${people}</personList>`;
|
|
11998
12231
|
}
|
|
11999
12232
|
};
|
|
12000
|
-
function vmlShape(comment,
|
|
12233
|
+
function vmlShape(comment, index3, id) {
|
|
12001
12234
|
const { row: row2, col } = comment.address;
|
|
12002
12235
|
const anchor = `${col + 1}, 15, ${Math.max(0, row2 - 1)}, 10, ${col + 3}, 15, ${row2 + 3}, 4`;
|
|
12003
|
-
return `<v:shape id="_x0000_s${id}" type="#_x0000_t202" style="position:absolute;margin-left:59.25pt;margin-top:1.5pt;width:108pt;height:59.25pt;z-index:${
|
|
12236
|
+
return `<v:shape id="_x0000_s${id}" type="#_x0000_t202" style="position:absolute;margin-left:59.25pt;margin-top:1.5pt;width:108pt;height:59.25pt;z-index:${index3 + 1};visibility:hidden" fillcolor="#ffffe1" o:insetmode="auto"><v:fill color2="#ffffe1"/><v:shadow on="t" color="black" obscured="t"/><v:path o:connecttype="none"/><v:textbox style="mso-direction-alt:auto"><div style="text-align:left"></div></v:textbox><x:ClientData ObjectType="Note"><x:MoveWithCells/><x:SizeWithCells/><x:Anchor>${anchor}</x:Anchor><x:AutoFill>False</x:AutoFill><x:Row>${row2}</x:Row><x:Column>${col}</x:Column></x:ClientData></v:shape>`;
|
|
12004
12237
|
}
|
|
12005
12238
|
var NOTE_SHAPETYPE = '<v:shapetype id="_x0000_t202" coordsize="21600,21600" o:spt="202" path="m,l,21600r21600,l21600,xe"><v:stroke joinstyle="miter"/><v:path gradientshapeok="t" o:connecttype="rect"/></v:shapetype>';
|
|
12006
12239
|
function vmlXml(comments, layout3) {
|
|
12007
|
-
const shapes = comments.map((comment,
|
|
12240
|
+
const shapes = comments.map((comment, index3) => vmlShape(comment, index3, layout3.ids[index3] ?? 0)).join("");
|
|
12008
12241
|
const data = layout3.blocks.join(",");
|
|
12009
12242
|
const base = layout3.base;
|
|
12010
12243
|
if (base && /<\/xml>\s*$/.test(base)) {
|
|
@@ -12035,8 +12268,8 @@ function commentParts(comments, sheetNumber, persons, sheetName, layout3) {
|
|
|
12035
12268
|
const id = guidFrom(`${sheetName}!${ref}:${comment.text}`);
|
|
12036
12269
|
const personId = persons.id(comment.author);
|
|
12037
12270
|
threaded += `<threadedComment ref="${ref}" personId="${personId}" id="${id}"><text>${escapeText2(comment.text)}</text></threadedComment>`;
|
|
12038
|
-
comment.replies.forEach((reply,
|
|
12039
|
-
const replyId = guidFrom(`${id}:reply:${
|
|
12271
|
+
comment.replies.forEach((reply, index3) => {
|
|
12272
|
+
const replyId = guidFrom(`${id}:reply:${index3}:${reply.text}`);
|
|
12040
12273
|
const dT = reply.date ? ` dT="${escapeAttr3(reply.date)}"` : "";
|
|
12041
12274
|
threaded += `<threadedComment ref="${ref}"${dT} personId="${persons.id(reply.author)}" id="${replyId}" parentId="${id}"><text>${escapeText2(reply.text)}</text></threadedComment>`;
|
|
12042
12275
|
});
|
|
@@ -12053,7 +12286,7 @@ Reply:
|
|
|
12053
12286
|
sorted2,
|
|
12054
12287
|
layout3 ?? {
|
|
12055
12288
|
blocks: [sheetNumber],
|
|
12056
|
-
ids: sorted2.map((_,
|
|
12289
|
+
ids: sorted2.map((_, index3) => 1024 * sheetNumber + index3 + 1)
|
|
12057
12290
|
}
|
|
12058
12291
|
);
|
|
12059
12292
|
const parts = { comments: commentsXml, vml };
|
|
@@ -12756,11 +12989,11 @@ var GRAY_VARIATIONS = [
|
|
|
12756
12989
|
{ tint: 8e4 }
|
|
12757
12990
|
];
|
|
12758
12991
|
var ACCENTS = ["accent1", "accent2", "accent3", "accent4", "accent5", "accent6"];
|
|
12759
|
-
function colorful(id,
|
|
12760
|
-
return { id, group: "colorful", index:
|
|
12992
|
+
function colorful(id, index3, base) {
|
|
12993
|
+
return { id, group: "colorful", index: index3, meth: "cycle", base, variations: COLORFUL_VARIATIONS };
|
|
12761
12994
|
}
|
|
12762
|
-
function mono(id,
|
|
12763
|
-
return { id, group: "monochromatic", index:
|
|
12995
|
+
function mono(id, index3, accent, meth) {
|
|
12996
|
+
return { id, group: "monochromatic", index: index3, meth, base: [accent], variations: [] };
|
|
12764
12997
|
}
|
|
12765
12998
|
var CHART_COLOR_PALETTES = [
|
|
12766
12999
|
colorful(10, 1, ACCENTS),
|
|
@@ -12804,9 +13037,9 @@ function chartPaletteSeriesColorChoice(palette, i2, n) {
|
|
|
12804
13037
|
const round2 = Math.floor(i2 / palette.base.length);
|
|
12805
13038
|
transform6 = (palette.variations.length ? palette.variations[round2 % palette.variations.length] : {}) ?? {};
|
|
12806
13039
|
} else {
|
|
12807
|
-
const
|
|
13040
|
+
const index3 = palette.meth === "withinLinearReversed" ? n - 1 - i2 : i2;
|
|
12808
13041
|
base = palette.base[0];
|
|
12809
|
-
transform6 = withinLinearTransform(
|
|
13042
|
+
transform6 = withinLinearTransform(index3, n);
|
|
12810
13043
|
}
|
|
12811
13044
|
if (!base) throw new RangeError("A chart palette must have a base color");
|
|
12812
13045
|
return {
|
|
@@ -12987,18 +13220,18 @@ var PackageWriter = class {
|
|
|
12987
13220
|
var rank = (name) => name === "_rels/.rels" ? 0 : name.startsWith("docProps/") ? 1 : name === "xl/workbook.xml" ? 2 : 3;
|
|
12988
13221
|
|
|
12989
13222
|
// xlsx/write/chart-colors.ts
|
|
12990
|
-
function chartSeriesFill(chart, series,
|
|
13223
|
+
function chartSeriesFill(chart, series, index3) {
|
|
12991
13224
|
const imported = series.fill && drawingFillXml(series.fill);
|
|
12992
13225
|
if (imported) return imported;
|
|
12993
|
-
return `<a:solidFill>${drawingColorXml(chartSeriesColor(chart, series,
|
|
13226
|
+
return `<a:solidFill>${drawingColorXml(chartSeriesColor(chart, series, index3))}</a:solidFill>`;
|
|
12994
13227
|
}
|
|
12995
|
-
function chartSeriesDrawingFill(chart, series,
|
|
13228
|
+
function chartSeriesDrawingFill(chart, series, index3) {
|
|
12996
13229
|
if (series.fill && drawingFillXml(series.fill)) return series.fill;
|
|
12997
|
-
return { kind: "solid", color: chartSeriesColor(chart, series,
|
|
13230
|
+
return { kind: "solid", color: chartSeriesColor(chart, series, index3) };
|
|
12998
13231
|
}
|
|
12999
|
-
function chartSeriesColor(chart, series,
|
|
13232
|
+
function chartSeriesColor(chart, series, index3) {
|
|
13000
13233
|
const palette = findChartColorPalette(chart.colorPalette ?? 10);
|
|
13001
|
-
return series.drawingColor ?? chartDrawingColor(series.color) ?? chartPaletteSeriesColorChoice(palette ?? findChartColorPalette(10),
|
|
13234
|
+
return series.drawingColor ?? chartDrawingColor(series.color) ?? chartPaletteSeriesColorChoice(palette ?? findChartColorPalette(10), index3, chart.series.length);
|
|
13002
13235
|
}
|
|
13003
13236
|
function recolorMarker(marker3, previous, next) {
|
|
13004
13237
|
for (const paint of [marker3, first(marker3, "ln", NS.a)]) {
|
|
@@ -13016,10 +13249,10 @@ function patchChartColors(doc, chartNode, model, before) {
|
|
|
13016
13249
|
const palette = findChartColorPalette(model.colorPalette ?? 10);
|
|
13017
13250
|
const lineLike = ["line", "scatter", "radar"].includes(model.chartType);
|
|
13018
13251
|
const markerOnly = model.chartType === "scatter" && first(plot2, "scatterStyle", NS.c)?.getAttribute("val") === "marker";
|
|
13019
|
-
children(plot2, "ser", NS.c).forEach((ser,
|
|
13020
|
-
const series = model.series[
|
|
13252
|
+
children(plot2, "ser", NS.c).forEach((ser, index3) => {
|
|
13253
|
+
const series = model.series[index3];
|
|
13021
13254
|
if (!series) return;
|
|
13022
|
-
const old = before.series[
|
|
13255
|
+
const old = before.series[index3];
|
|
13023
13256
|
if (old?.effectsXml !== series.effectsXml) {
|
|
13024
13257
|
let shape2 = first(ser, "spPr", NS.c);
|
|
13025
13258
|
if (!shape2 && series.effectsXml) {
|
|
@@ -13065,12 +13298,12 @@ function patchChartColors(doc, chartNode, model, before) {
|
|
|
13065
13298
|
paint = doc.createElementNS(NS.a, "a:ln");
|
|
13066
13299
|
spPr.appendChild(paint);
|
|
13067
13300
|
}
|
|
13068
|
-
setDrawingFillXml(paint, chartSeriesFill(model, series,
|
|
13301
|
+
setDrawingFillXml(paint, chartSeriesFill(model, series, index3));
|
|
13069
13302
|
}
|
|
13070
13303
|
if (previousPalette && palette && before.colorPalette !== model.colorPalette) {
|
|
13071
13304
|
const marker3 = first(first(ser, "marker", NS.c), "spPr", NS.c);
|
|
13072
|
-
const previous = chartPaletteSeriesColorChoice(previousPalette,
|
|
13073
|
-
const next = chartPaletteSeriesColorChoice(palette,
|
|
13305
|
+
const previous = chartPaletteSeriesColorChoice(previousPalette, index3, model.series.length);
|
|
13306
|
+
const next = chartPaletteSeriesColorChoice(palette, index3, model.series.length);
|
|
13074
13307
|
recolorMarker(marker3, previous, next);
|
|
13075
13308
|
for (const point of children(ser, "dPt", NS.c))
|
|
13076
13309
|
recolorMarker(first(first(point, "marker", NS.c), "spPr", NS.c), previous, next);
|
|
@@ -13165,7 +13398,7 @@ var FIRST_AXIS = 500000001;
|
|
|
13165
13398
|
var SECOND_AXIS = 500000002;
|
|
13166
13399
|
function source(kind, formula, values2) {
|
|
13167
13400
|
const points = values2.flatMap(
|
|
13168
|
-
(value2,
|
|
13401
|
+
(value2, index3) => value2 === null || value2 === "" ? [] : [{ index: index3, value: String(value2) }]
|
|
13169
13402
|
);
|
|
13170
13403
|
return {
|
|
13171
13404
|
kind: formula ? kind === "str" ? "strRef" : "numRef" : kind === "str" ? "strLit" : "numLit",
|
|
@@ -13198,9 +13431,9 @@ function dataPoints(series) {
|
|
|
13198
13431
|
return /^\d+$/.test(key) && paint ? [{ index: Number(key), spPr: { fill: paint } }] : [];
|
|
13199
13432
|
});
|
|
13200
13433
|
}
|
|
13201
|
-
function seriesModel(chart, series,
|
|
13434
|
+
function seriesModel(chart, series, index3) {
|
|
13202
13435
|
const type = chart.chartType;
|
|
13203
|
-
const out = { index:
|
|
13436
|
+
const out = { index: index3, order: index3, dataPoints: dataPoints(series) };
|
|
13204
13437
|
if (series.nameRef)
|
|
13205
13438
|
out.tx = {
|
|
13206
13439
|
reference: source("str", series.nameRef, series.name === void 0 ? [] : [series.name])
|
|
@@ -13209,7 +13442,7 @@ function seriesModel(chart, series, index2) {
|
|
|
13209
13442
|
const lineLike = type === "line" || type === "scatter" || type === "radar";
|
|
13210
13443
|
const effectsXml = effects(series);
|
|
13211
13444
|
if (type !== "pie" && type !== "doughnut" || series.fill || series.color || series.drawingColor || effectsXml) {
|
|
13212
|
-
const fill = chartSeriesDrawingFill(chart, series,
|
|
13445
|
+
const fill = chartSeriesDrawingFill(chart, series, index3);
|
|
13213
13446
|
const shape2 = lineLike ? { line: { widthEmu: 28575, cap: "rnd", fill } } : { fill };
|
|
13214
13447
|
if (effectsXml) shape2.effectsXml = effectsXml;
|
|
13215
13448
|
out.spPr = shape2;
|
|
@@ -13333,7 +13566,7 @@ function style(chart) {
|
|
|
13333
13566
|
return id > 100 ? { c14Style: id, style: id - 100 } : { style: id };
|
|
13334
13567
|
}
|
|
13335
13568
|
function chartSpaceFromObject(chart) {
|
|
13336
|
-
const series = chart.series.map((entry3,
|
|
13569
|
+
const series = chart.series.map((entry3, index3) => seriesModel(chart, entry3, index3));
|
|
13337
13570
|
const [group, chartAxes] = plot(chart, series);
|
|
13338
13571
|
const space = {
|
|
13339
13572
|
roundedCorners: false,
|
|
@@ -13374,8 +13607,8 @@ function patchChartReferences(xml, chart) {
|
|
|
13374
13607
|
changed = true;
|
|
13375
13608
|
}
|
|
13376
13609
|
};
|
|
13377
|
-
children(plot2, "ser", NS.c).forEach((ser,
|
|
13378
|
-
const model = chart.series[
|
|
13610
|
+
children(plot2, "ser", NS.c).forEach((ser, index3) => {
|
|
13611
|
+
const model = chart.series[index3];
|
|
13379
13612
|
if (!model) return;
|
|
13380
13613
|
setRef(first(ser, "tx", NS.c), model.nameRef);
|
|
13381
13614
|
setRef(first(ser, "cat", NS.c) ?? first(ser, "xVal", NS.c), model.categoriesRef);
|
|
@@ -13743,10 +13976,10 @@ var MONTHS2 = [
|
|
|
13743
13976
|
function monthFromName2(name) {
|
|
13744
13977
|
const lower2 = name.toLowerCase();
|
|
13745
13978
|
if (lower2.length < 3) return void 0;
|
|
13746
|
-
const
|
|
13747
|
-
if (
|
|
13748
|
-
const full = new Date(Date.UTC(2e3,
|
|
13749
|
-
return lower2.length === 3 || full.startsWith(lower2) || lower2 === "sept" ?
|
|
13979
|
+
const index3 = MONTHS2.findIndex((m) => lower2.startsWith(m));
|
|
13980
|
+
if (index3 < 0) return void 0;
|
|
13981
|
+
const full = new Date(Date.UTC(2e3, index3, 1)).toLocaleString("en-US", { month: "long", timeZone: "UTC" }).toLowerCase();
|
|
13982
|
+
return lower2.length === 3 || full.startsWith(lower2) || lower2 === "sept" ? index3 + 1 : void 0;
|
|
13750
13983
|
}
|
|
13751
13984
|
var NUMBER_RE3 = /^(\d+(?:,\d{3,})+|\d*)(\.\d*)?(?:e([+-]?\d+))?$/i;
|
|
13752
13985
|
var TIME_RE2 = /^(\d{1,4})(?::(\d+))?(?::(\d+(?:\.\d*)?))?(?:\s+(am|pm|a|p))?$/i;
|
|
@@ -14514,11 +14747,11 @@ function sort(args, ctx) {
|
|
|
14514
14747
|
if (byCol) m = transpose(m);
|
|
14515
14748
|
const indexes2 = args.length > 1 && args[1] !== null ? ctx.toMatrix(args[1] ?? null).flat().map((v) => Math.trunc(num2(v))) : [1];
|
|
14516
14749
|
const orders = args.length > 2 && args[2] !== null ? ctx.toMatrix(args[2] ?? null).flat().map((v) => num2(v)) : [1];
|
|
14517
|
-
const keys = indexes2.map((
|
|
14518
|
-
if (
|
|
14750
|
+
const keys = indexes2.map((index3, k) => {
|
|
14751
|
+
if (index3 < 1 || index3 > m.cols) fail(ERR.VALUE);
|
|
14519
14752
|
const order = orders[Math.min(k, orders.length - 1)] ?? 1;
|
|
14520
14753
|
if (order !== 1 && order !== -1) fail(ERR.VALUE);
|
|
14521
|
-
return { values: m.data.map((row2) => row2[
|
|
14754
|
+
return { values: m.data.map((row2) => row2[index3 - 1] ?? null), descending: order === -1 };
|
|
14522
14755
|
});
|
|
14523
14756
|
const sorted2 = new Matrix(sortRows(m.data, keys));
|
|
14524
14757
|
return byCol ? transpose(sorted2) : sorted2;
|
|
@@ -14646,14 +14879,14 @@ var ARRAY_FUNCTIONS = [
|
|
|
14646
14879
|
const cols = optInt(ctx, args, 1, 1);
|
|
14647
14880
|
const min = args.length > 2 && args[2] !== null ? num2(ctx.toScalar(args[2] ?? null)) : 0;
|
|
14648
14881
|
const max = args.length > 3 && args[3] !== null ? num2(ctx.toScalar(args[3] ?? null)) : 1;
|
|
14649
|
-
const
|
|
14882
|
+
const integer2 = args.length > 4 && args[4] !== null && toBool(ctx.toScalar(args[4] ?? null));
|
|
14650
14883
|
if (rows < 1 || cols < 1) return ERR.CALC;
|
|
14651
14884
|
if (min > max) fail(ERR.VALUE);
|
|
14652
14885
|
const random = () => ctx.frame.host.random();
|
|
14653
14886
|
return Matrix.build(
|
|
14654
14887
|
rows,
|
|
14655
14888
|
cols,
|
|
14656
|
-
() =>
|
|
14889
|
+
() => integer2 ? Math.ceil(min) + Math.floor(random() * (Math.floor(max) - Math.ceil(min) + 1)) : min + random() * (max - min)
|
|
14657
14890
|
);
|
|
14658
14891
|
},
|
|
14659
14892
|
["any"],
|
|
@@ -14708,8 +14941,8 @@ function modes(values2) {
|
|
|
14708
14941
|
function kth(values2, k, largest) {
|
|
14709
14942
|
const n = values2.length;
|
|
14710
14943
|
if (n === 0 || !(k >= 1) || k > n) fail(ERR.NUM);
|
|
14711
|
-
const
|
|
14712
|
-
return sorted(values2)[
|
|
14944
|
+
const index3 = Math.floor(largest ? n + 1 - k : k) - 1;
|
|
14945
|
+
return sorted(values2)[index3];
|
|
14713
14946
|
}
|
|
14714
14947
|
function extreme(values2, max) {
|
|
14715
14948
|
if (values2.length === 0) return 0;
|
|
@@ -14849,13 +15082,13 @@ function fieldIndex(table2, field) {
|
|
|
14849
15082
|
const value2 = scalar(field);
|
|
14850
15083
|
if (isError(value2)) fail(value2);
|
|
14851
15084
|
if (typeof value2 === "number") {
|
|
14852
|
-
const
|
|
14853
|
-
if (
|
|
14854
|
-
return
|
|
15085
|
+
const index4 = Math.trunc(value2) - 1;
|
|
15086
|
+
if (index4 < 0 || index4 >= table2.headers.length) fail(ERR.VALUE);
|
|
15087
|
+
return index4;
|
|
14855
15088
|
}
|
|
14856
|
-
const
|
|
14857
|
-
if (
|
|
14858
|
-
return
|
|
15089
|
+
const index3 = table2.headers.indexOf(label2(value2).toLowerCase());
|
|
15090
|
+
if (index3 < 0) fail(ERR.VALUE);
|
|
15091
|
+
return index3;
|
|
14859
15092
|
}
|
|
14860
15093
|
function recordFilter(table2, criteria) {
|
|
14861
15094
|
const [head, ...rows] = criteria;
|
|
@@ -16141,8 +16374,8 @@ function cumulative(args, principal) {
|
|
|
16141
16374
|
|
|
16142
16375
|
// xlsx/formula/functions/bonds.ts
|
|
16143
16376
|
var C9 = "Financial";
|
|
16144
|
-
var basisOf = (args,
|
|
16145
|
-
const basis = args.length >
|
|
16377
|
+
var basisOf = (args, index3) => {
|
|
16378
|
+
const basis = args.length > index3 && args[index3] !== null ? int3(args[index3]) : 0;
|
|
16146
16379
|
if (basis < 0 || basis > 4) fail(ERR.NUM);
|
|
16147
16380
|
return basis;
|
|
16148
16381
|
};
|
|
@@ -16324,9 +16557,9 @@ var AMORLINC = {
|
|
|
16324
16557
|
}
|
|
16325
16558
|
const fraction = purchase === firstPeriod ? 1 : basis === 1 ? (firstPeriod - purchase) / (isLeapYear(serialToYmd(purchase, ctx.date1904).year) ? 366 : 365) : yearFrac(purchase, firstPeriod, basis, ctx);
|
|
16326
16559
|
const first2 = Math.min(cost - salvage, annual * fraction);
|
|
16327
|
-
const
|
|
16328
|
-
if (
|
|
16329
|
-
return Math.max(0, Math.min(annual, cost - salvage - first2 - (
|
|
16560
|
+
const index3 = Math.trunc(period);
|
|
16561
|
+
if (index3 === 0) return first2;
|
|
16562
|
+
return Math.max(0, Math.min(annual, cost - salvage - first2 - (index3 - 1) * annual));
|
|
16330
16563
|
}
|
|
16331
16564
|
),
|
|
16332
16565
|
missingRequiredError: "#N/A"
|
|
@@ -16553,8 +16786,8 @@ var DEPRECIATION_FUNCTIONS = [
|
|
|
16553
16786
|
|
|
16554
16787
|
// xlsx/formula/functions/securities.ts
|
|
16555
16788
|
var C11 = "Financial";
|
|
16556
|
-
var basisOf2 = (args,
|
|
16557
|
-
const basis = args.length >
|
|
16789
|
+
var basisOf2 = (args, index3) => {
|
|
16790
|
+
const basis = args.length > index3 && args[index3] !== null ? int3(args[index3]) : 0;
|
|
16558
16791
|
if (basis < 0 || basis > 4) fail(ERR.NUM);
|
|
16559
16792
|
return basis;
|
|
16560
16793
|
};
|
|
@@ -16977,8 +17210,8 @@ var INFO_FUNCTIONS = [
|
|
|
16977
17210
|
const v = args[0];
|
|
16978
17211
|
if (v === void 0) return ctx.sheet + 1;
|
|
16979
17212
|
if (v instanceof RefValue) return (v.areas[0]?.sheet ?? ctx.sheet) + 1;
|
|
16980
|
-
const
|
|
16981
|
-
return
|
|
17213
|
+
const index3 = sheetIndex(ctx.frame.host, str(v));
|
|
17214
|
+
return index3 < 0 ? ERR.NA : index3 + 1;
|
|
16982
17215
|
},
|
|
16983
17216
|
["any"]
|
|
16984
17217
|
),
|
|
@@ -17447,14 +17680,14 @@ function shape(value2) {
|
|
|
17447
17680
|
if (value2 instanceof Matrix) return { rows: value2.rows, cols: value2.cols };
|
|
17448
17681
|
return { rows: 1, cols: 1 };
|
|
17449
17682
|
}
|
|
17450
|
-
function line(ctx, value2, axis,
|
|
17683
|
+
function line(ctx, value2, axis, index3) {
|
|
17451
17684
|
if (value2 instanceof RefValue) {
|
|
17452
17685
|
const area = value2.areas[0];
|
|
17453
17686
|
if (!area || value2.areas.length !== 1) fail(ERR.VALUE);
|
|
17454
17687
|
const { start, end } = area.range;
|
|
17455
17688
|
const bounds = ctx.frame.host.bounds(area.sheet);
|
|
17456
17689
|
if (axis === "col") {
|
|
17457
|
-
const col = start.col +
|
|
17690
|
+
const col = start.col + index3;
|
|
17458
17691
|
const length2 = Math.max(0, Math.min(end.row, bounds.rows - 1) - start.row + 1);
|
|
17459
17692
|
return {
|
|
17460
17693
|
length: length2,
|
|
@@ -17462,7 +17695,7 @@ function line(ctx, value2, axis, index2) {
|
|
|
17462
17695
|
get: (i2) => ctx.readCell(area.sheet, start.row + i2, col)
|
|
17463
17696
|
};
|
|
17464
17697
|
}
|
|
17465
|
-
const row2 = start.row +
|
|
17698
|
+
const row2 = start.row + index3;
|
|
17466
17699
|
const length = Math.max(0, Math.min(end.col, bounds.cols - 1) - start.col + 1);
|
|
17467
17700
|
return {
|
|
17468
17701
|
length,
|
|
@@ -17471,8 +17704,8 @@ function line(ctx, value2, axis, index2) {
|
|
|
17471
17704
|
};
|
|
17472
17705
|
}
|
|
17473
17706
|
const m = value2 instanceof Matrix ? value2 : new Matrix([[value2]]);
|
|
17474
|
-
if (axis === "col") return { length: m.rows, get: (i2) => m.get(i2,
|
|
17475
|
-
return { length: m.cols, get: (i2) => m.get(
|
|
17707
|
+
if (axis === "col") return { length: m.rows, get: (i2) => m.get(i2, index3) };
|
|
17708
|
+
return { length: m.cols, get: (i2) => m.get(index3, i2) };
|
|
17476
17709
|
}
|
|
17477
17710
|
function vectorOf(ctx, value2) {
|
|
17478
17711
|
const { rows, cols } = shape(value2);
|
|
@@ -17910,24 +18143,24 @@ function cellOf(value2, row2, col) {
|
|
|
17910
18143
|
if (value2 instanceof Matrix) return value2.get(row2, col);
|
|
17911
18144
|
return value2;
|
|
17912
18145
|
}
|
|
17913
|
-
function sliceOf(value2, axis,
|
|
18146
|
+
function sliceOf(value2, axis, index3) {
|
|
17914
18147
|
const { rows } = shape(value2);
|
|
17915
18148
|
if (value2 instanceof RefValue) {
|
|
17916
18149
|
const area = value2.areas[0];
|
|
17917
18150
|
if (!area) fail(ERR.REF);
|
|
17918
18151
|
const { start, end } = area.range;
|
|
17919
18152
|
const range = axis === "row" ? {
|
|
17920
|
-
start: { row: start.row +
|
|
17921
|
-
end: { row: start.row +
|
|
18153
|
+
start: { row: start.row + index3, col: start.col },
|
|
18154
|
+
end: { row: start.row + index3, col: end.col }
|
|
17922
18155
|
} : {
|
|
17923
|
-
start: { row: start.row, col: start.col +
|
|
17924
|
-
end: { row: end.row, col: start.col +
|
|
18156
|
+
start: { row: start.row, col: start.col + index3 },
|
|
18157
|
+
end: { row: end.row, col: start.col + index3 }
|
|
17925
18158
|
};
|
|
17926
18159
|
return new RefValue([{ sheet: area.sheet, range }]);
|
|
17927
18160
|
}
|
|
17928
18161
|
const m = value2 instanceof Matrix ? value2 : new Matrix([[value2]]);
|
|
17929
|
-
if (axis === "row") return new Matrix([m.data[
|
|
17930
|
-
return new Matrix(Array.from({ length: rows }, (_, r) => [m.get(r,
|
|
18162
|
+
if (axis === "row") return new Matrix([m.data[index3] ?? []]);
|
|
18163
|
+
return new Matrix(Array.from({ length: rows }, (_, r) => [m.get(r, index3)]));
|
|
17931
18164
|
}
|
|
17932
18165
|
function lookupValue(args) {
|
|
17933
18166
|
const v = scalar(args[0]);
|
|
@@ -17943,15 +18176,15 @@ function lookupArray(value2) {
|
|
|
17943
18176
|
function vhlookup(args, ctx, vertical) {
|
|
17944
18177
|
const lookup2 = blankAsZero(args);
|
|
17945
18178
|
const table2 = lookupArray(args[1] ?? null);
|
|
17946
|
-
const
|
|
18179
|
+
const index3 = int3(args[2]);
|
|
17947
18180
|
const approximate2 = args.length < 4 ? true : bool(args[3]);
|
|
17948
18181
|
const { rows, cols } = shape(table2);
|
|
17949
|
-
if (
|
|
17950
|
-
if (
|
|
18182
|
+
if (index3 < 1) fail(ERR.VALUE);
|
|
18183
|
+
if (index3 > (vertical ? cols : rows)) fail(ERR.REF);
|
|
17951
18184
|
const keys = line(ctx, table2, vertical ? "col" : "row", 0);
|
|
17952
18185
|
const at = approximate2 ? findAscending(keys, lookup2) : findExact(keys, lookup2, true);
|
|
17953
18186
|
if (at < 0) fail(ERR.NA);
|
|
17954
|
-
return vertical ? cellOf(table2, at,
|
|
18187
|
+
return vertical ? cellOf(table2, at, index3 - 1) : cellOf(table2, index3 - 1, at);
|
|
17955
18188
|
}
|
|
17956
18189
|
function match(args, ctx) {
|
|
17957
18190
|
const lookup2 = blankAsZero(args);
|
|
@@ -17978,13 +18211,13 @@ function lookup(args, ctx) {
|
|
|
17978
18211
|
if (at < 0) fail(ERR.NA);
|
|
17979
18212
|
return vertical ? cellOf(source2, at, cols - 1) : cellOf(source2, rows - 1, at);
|
|
17980
18213
|
}
|
|
17981
|
-
function
|
|
18214
|
+
function index2(args) {
|
|
17982
18215
|
const source2 = args[0] ?? null;
|
|
17983
18216
|
if (source2 instanceof RefValue && source2.areas.length > 1) {
|
|
17984
18217
|
const area = Math.trunc(optNum(args, 3, 1));
|
|
17985
18218
|
const chosen = source2.areas[area - 1];
|
|
17986
18219
|
if (!chosen) fail(ERR.REF);
|
|
17987
|
-
return
|
|
18220
|
+
return index2([new RefValue([chosen]), ...args.slice(1, 3)]);
|
|
17988
18221
|
}
|
|
17989
18222
|
const { rows, cols } = shape(source2);
|
|
17990
18223
|
let r = args.length > 1 && args[1] !== null ? int3(args[1]) : 0;
|
|
@@ -18106,7 +18339,7 @@ var LOOKUP_FUNCTIONS = [
|
|
|
18106
18339
|
"The value or reference at a position.",
|
|
18107
18340
|
1,
|
|
18108
18341
|
4,
|
|
18109
|
-
(args) =>
|
|
18342
|
+
(args) => index2(args),
|
|
18110
18343
|
["any", "value", "value", "value"]
|
|
18111
18344
|
),
|
|
18112
18345
|
spec(
|
|
@@ -18150,27 +18383,27 @@ function valueKeys(value2, out) {
|
|
|
18150
18383
|
}
|
|
18151
18384
|
}
|
|
18152
18385
|
function positionsOf(block, key) {
|
|
18153
|
-
let
|
|
18154
|
-
if (!
|
|
18386
|
+
let index3 = indexes.get(block);
|
|
18387
|
+
if (!index3) {
|
|
18155
18388
|
const count2 = (uses.get(block) ?? 0) + 1;
|
|
18156
18389
|
uses.set(block, count2);
|
|
18157
18390
|
if (count2 < 2 || block.isPadded) return void 0;
|
|
18158
|
-
|
|
18391
|
+
index3 = /* @__PURE__ */ new Map();
|
|
18159
18392
|
const keys = [];
|
|
18160
18393
|
const cols = block.cols;
|
|
18161
18394
|
for (let r = 0; r < block.rows; r++) {
|
|
18162
18395
|
for (let c2 = 0; c2 < cols; c2++) {
|
|
18163
18396
|
valueKeys(block.get(r, c2), keys);
|
|
18164
18397
|
for (const k of keys) {
|
|
18165
|
-
const list =
|
|
18398
|
+
const list = index3.get(k);
|
|
18166
18399
|
if (list) list.push(r * cols + c2);
|
|
18167
|
-
else
|
|
18400
|
+
else index3.set(k, [r * cols + c2]);
|
|
18168
18401
|
}
|
|
18169
18402
|
}
|
|
18170
18403
|
}
|
|
18171
|
-
indexes.set(block,
|
|
18404
|
+
indexes.set(block, index3);
|
|
18172
18405
|
}
|
|
18173
|
-
return
|
|
18406
|
+
return index3.get(key) ?? [];
|
|
18174
18407
|
}
|
|
18175
18408
|
|
|
18176
18409
|
// xlsx/formula/functions/criteria.ts
|
|
@@ -19330,7 +19563,7 @@ function layout(ctx, args) {
|
|
|
19330
19563
|
}
|
|
19331
19564
|
return { y, x, column };
|
|
19332
19565
|
}
|
|
19333
|
-
var withConst = (args,
|
|
19566
|
+
var withConst = (args, index3) => omitted(args, index3) ? true : bool(args[index3]);
|
|
19334
19567
|
var row = (values2, width) => [
|
|
19335
19568
|
...values2,
|
|
19336
19569
|
...new Array(Math.max(0, width - values2.length)).fill(ERR.NA)
|
|
@@ -21644,7 +21877,7 @@ function compile(pattern, caseMode2, global) {
|
|
|
21644
21877
|
return fail(ERR.VALUE);
|
|
21645
21878
|
}
|
|
21646
21879
|
}
|
|
21647
|
-
var caseMode = (args,
|
|
21880
|
+
var caseMode = (args, index3) => optNum(args, index3, 0);
|
|
21648
21881
|
function encodeUrl(text) {
|
|
21649
21882
|
return encodeURIComponent(text).replace(
|
|
21650
21883
|
/[!'()*]/g,
|
|
@@ -21763,9 +21996,9 @@ function textAround(args, ctx, before) {
|
|
|
21763
21996
|
if (instance > 0) found.push({ at: text.length, length: 0 });
|
|
21764
21997
|
else found.unshift({ at: 0, length: 0 });
|
|
21765
21998
|
}
|
|
21766
|
-
const
|
|
21767
|
-
const hit = found[
|
|
21768
|
-
if (!hit ||
|
|
21999
|
+
const index3 = instance > 0 ? instance - 1 : found.length + instance;
|
|
22000
|
+
const hit = found[index3];
|
|
22001
|
+
if (!hit || index3 < 0) return notFound;
|
|
21769
22002
|
return before ? text.slice(0, hit.at) : text.slice(hit.at + hit.length);
|
|
21770
22003
|
}
|
|
21771
22004
|
function splitText(text, delimiters, insensitive, ignoreEmpty) {
|
|
@@ -21881,10 +22114,10 @@ Object.freeze(
|
|
|
21881
22114
|
);
|
|
21882
22115
|
|
|
21883
22116
|
// xlsx/formula/functions/types.ts
|
|
21884
|
-
var paramKind = (spec2,
|
|
22117
|
+
var paramKind = (spec2, index3) => {
|
|
21885
22118
|
const params = spec2.params;
|
|
21886
22119
|
if (!params || params.length === 0) return "value";
|
|
21887
|
-
return params[Math.min(
|
|
22120
|
+
return params[Math.min(index3, params.length - 1)] ?? "value";
|
|
21888
22121
|
};
|
|
21889
22122
|
|
|
21890
22123
|
// xlsx/formula/spill.ts
|
|
@@ -22464,9 +22697,9 @@ function readSourceStyles(xml) {
|
|
|
22464
22697
|
(node) => inlineFragment(outerXml(node))
|
|
22465
22698
|
);
|
|
22466
22699
|
const dxfKeys = /* @__PURE__ */ new Map();
|
|
22467
|
-
parseStyles(xml, []).dxfs.forEach((dxf,
|
|
22700
|
+
parseStyles(xml, []).dxfs.forEach((dxf, index3) => {
|
|
22468
22701
|
const key = styleKey(dxf);
|
|
22469
|
-
if (!dxfKeys.has(key)) dxfKeys.set(key,
|
|
22702
|
+
if (!dxfKeys.has(key)) dxfKeys.set(key, index3);
|
|
22470
22703
|
});
|
|
22471
22704
|
const result2 = { numFmts, dxfXml, dxfKeys };
|
|
22472
22705
|
const tableStyles = xFirst(root, "tableStyles");
|
|
@@ -22574,7 +22807,7 @@ var StyleWriter = class {
|
|
|
22574
22807
|
});
|
|
22575
22808
|
const seen = /* @__PURE__ */ new Set();
|
|
22576
22809
|
const unique2 = named2.filter((entry3) => !seen.has(entry3.name) && seen.add(entry3.name));
|
|
22577
|
-
const xfIdOf = new Map(unique2.map((entry3,
|
|
22810
|
+
const xfIdOf = new Map(unique2.map((entry3, index3) => [entry3.name, index3]));
|
|
22578
22811
|
const base = this.workbook.styles[0] ?? defaultCellStyle();
|
|
22579
22812
|
this.fonts.id(fontXml(base.font));
|
|
22580
22813
|
this.borders.id(borderXml({}));
|
|
@@ -22583,7 +22816,7 @@ var StyleWriter = class {
|
|
|
22583
22816
|
(style2) => this.xf(style2, xfIdOf.get(style2.cellStyleName ?? "Normal") ?? 0)
|
|
22584
22817
|
);
|
|
22585
22818
|
const cellStyles = unique2.map(
|
|
22586
|
-
(entry3,
|
|
22819
|
+
(entry3, index3) => el("cellStyle", { name: entry3.name, xfId: index3, builtinId: entry3.builtinId })
|
|
22587
22820
|
);
|
|
22588
22821
|
const custom = [...this.numFmts].filter(([code]) => builtinFormatIdOf(code) === void 0).sort((a2, b) => a2[1] - b[1]);
|
|
22589
22822
|
let out = `${XML_HEADER}<styleSheet xmlns="${NS.x}" xmlns:mc="${NS.mc}" mc:Ignorable="x14ac" xmlns:x14ac="${NS.x14ac}">`;
|
|
@@ -22748,13 +22981,13 @@ function definedNamesOf(workbook) {
|
|
|
22748
22981
|
const names = workbook.definedNames.filter(
|
|
22749
22982
|
(name) => name.name && (name.localSheet === void 0 || name.localSheet >= 0 && name.localSheet < workbook.sheets.length)
|
|
22750
22983
|
);
|
|
22751
|
-
workbook.sheets.forEach((sheet,
|
|
22984
|
+
workbook.sheets.forEach((sheet, index3) => {
|
|
22752
22985
|
const area = sheet.pageSetup?.printArea;
|
|
22753
|
-
if (!area || names.some((n) => n.name === "_xlnm.Print_Area" && n.localSheet ===
|
|
22986
|
+
if (!area || names.some((n) => n.name === "_xlnm.Print_Area" && n.localSheet === index3)) return;
|
|
22754
22987
|
names.push({
|
|
22755
22988
|
name: "_xlnm.Print_Area",
|
|
22756
22989
|
formula: `${quoteSheetName(sheet.name)}!${absoluteRange(area)}`,
|
|
22757
|
-
localSheet:
|
|
22990
|
+
localSheet: index3
|
|
22758
22991
|
});
|
|
22759
22992
|
});
|
|
22760
22993
|
return names;
|
|
@@ -23373,9 +23606,9 @@ function sourceColumnsForPatch(root, table2, names) {
|
|
|
23373
23606
|
const byName = new Map(source2.map((c2) => [(c2.getAttribute("name") ?? "").toLowerCase(), c2]));
|
|
23374
23607
|
const tracked = table2.partName !== void 0 || table2.columns.some((c2) => c2.sourceId !== void 0);
|
|
23375
23608
|
const used = /* @__PURE__ */ new Set();
|
|
23376
|
-
return names.map((name,
|
|
23377
|
-
const id = table2.columns[
|
|
23378
|
-
const match2 = id !== void 0 ? byId.get(id) : tracked ? void 0 : source2.length === names.length ? source2[
|
|
23609
|
+
return names.map((name, index3) => {
|
|
23610
|
+
const id = table2.columns[index3]?.sourceId;
|
|
23611
|
+
const match2 = id !== void 0 ? byId.get(id) : tracked ? void 0 : source2.length === names.length ? source2[index3] : byName.get(name.toLowerCase());
|
|
23379
23612
|
if (!match2 || used.has(match2)) return void 0;
|
|
23380
23613
|
used.add(match2);
|
|
23381
23614
|
return match2;
|
|
@@ -23392,12 +23625,12 @@ function patchAutoFilter(doc, root, table2, before, names) {
|
|
|
23392
23625
|
filter2.setAttribute("ref", formatRange(range));
|
|
23393
23626
|
const list = xKid(root, "tableColumns");
|
|
23394
23627
|
const original = list ? xKids(list, "tableColumn") : [];
|
|
23395
|
-
const current = new Map(sourceColumnsForPatch(root, table2, names).map((c2,
|
|
23628
|
+
const current = new Map(sourceColumnsForPatch(root, table2, names).map((c2, index3) => [c2, index3]));
|
|
23396
23629
|
for (const column of xKids(filter2, "filterColumn")) {
|
|
23397
23630
|
const old = original[Number(column.getAttribute("colId") ?? "0")];
|
|
23398
|
-
const
|
|
23399
|
-
if (
|
|
23400
|
-
else column.setAttribute("colId", num(
|
|
23631
|
+
const index3 = old ? current.get(old) : void 0;
|
|
23632
|
+
if (index3 === void 0) filter2.removeChild(column);
|
|
23633
|
+
else column.setAttribute("colId", num(index3));
|
|
23401
23634
|
}
|
|
23402
23635
|
if (!existing) insertBefore(root, filter2, ["sortState", "tableColumns"]);
|
|
23403
23636
|
const sort2 = xKid(filter2, "sortState") ?? xKid(root, "sortState");
|
|
@@ -23442,11 +23675,11 @@ function patchColumns(doc, root, sheet, table2, names) {
|
|
|
23442
23675
|
for (const column of sourceColumns) list.removeChild(column);
|
|
23443
23676
|
let nextId = Math.max(0, ...ids) + 1;
|
|
23444
23677
|
const totalsRow = table2.range.end.row;
|
|
23445
|
-
names.forEach((name,
|
|
23446
|
-
const column = picked[
|
|
23678
|
+
names.forEach((name, index3) => {
|
|
23679
|
+
const column = picked[index3] ?? doc.createElementNS(NS.x, "tableColumn");
|
|
23447
23680
|
if (!column.getAttribute("id")) column.setAttribute("id", num(nextId++));
|
|
23448
23681
|
column.setAttribute("name", name);
|
|
23449
|
-
const model = table2.columns[
|
|
23682
|
+
const model = table2.columns[index3];
|
|
23450
23683
|
const fn = table2.totalsRow ? model?.totalsRowFunction : void 0;
|
|
23451
23684
|
setOrRemove(column, "totalsRowFunction", fn);
|
|
23452
23685
|
setOrRemove(column, "totalsRowLabel", table2.totalsRow ? model?.totalsRowLabel : void 0);
|
|
@@ -23460,7 +23693,7 @@ function patchColumns(doc, root, sheet, table2, names) {
|
|
|
23460
23693
|
);
|
|
23461
23694
|
if (fn !== "custom") setChildText(doc, column, "totalsRowFormula", void 0, []);
|
|
23462
23695
|
else {
|
|
23463
|
-
const cellFormula = sheet.rows.get(totalsRow)?.get(table2.range.start.col +
|
|
23696
|
+
const cellFormula = sheet.rows.get(totalsRow)?.get(table2.range.start.col + index3)?.formula;
|
|
23464
23697
|
if (cellFormula)
|
|
23465
23698
|
setChildText(
|
|
23466
23699
|
doc,
|
|
@@ -23541,11 +23774,11 @@ function tableXml(table2, id, names) {
|
|
|
23541
23774
|
const range = formatRange(table2.range);
|
|
23542
23775
|
const filterEnd = { ...table2.range.end, row: table2.range.end.row - (table2.totalsRow ? 1 : 0) };
|
|
23543
23776
|
const filter2 = table2.headerRow && !table2.totalsRow ? `<autoFilter ref="${range}"/>` : table2.headerRow ? `<autoFilter ref="${formatRange({ start: table2.range.start, end: filterEnd })}"/>` : "";
|
|
23544
|
-
const columns = names.map((name,
|
|
23545
|
-
const column = table2.columns[
|
|
23777
|
+
const columns = names.map((name, index3) => {
|
|
23778
|
+
const column = table2.columns[index3];
|
|
23546
23779
|
const calculated = column?.calculatedColumnFormula ? `<calculatedColumnFormula>${escapeText2(addFuturePrefixes(column.calculatedColumnFormula))}</calculatedColumnFormula>` : "";
|
|
23547
23780
|
const values2 = attrs({
|
|
23548
|
-
id:
|
|
23781
|
+
id: index3 + 1,
|
|
23549
23782
|
name,
|
|
23550
23783
|
totalsRowFunction: table2.totalsRow ? column?.totalsRowFunction : void 0,
|
|
23551
23784
|
totalsRowLabel: table2.totalsRow ? column?.totalsRowLabel : void 0
|
|
@@ -23584,27 +23817,27 @@ function totalsRowFormulas(sheet, table2, names) {
|
|
|
23584
23817
|
const out = /* @__PURE__ */ new Map();
|
|
23585
23818
|
if (!table2.totalsRow) return out;
|
|
23586
23819
|
const row2 = table2.range.end.row;
|
|
23587
|
-
names.forEach((name,
|
|
23588
|
-
const code = SUBTOTAL_CODES[table2.columns[
|
|
23820
|
+
names.forEach((name, index3) => {
|
|
23821
|
+
const code = SUBTOTAL_CODES[table2.columns[index3]?.totalsRowFunction ?? ""];
|
|
23589
23822
|
if (code === void 0) return;
|
|
23590
|
-
const col = table2.range.start.col +
|
|
23823
|
+
const col = table2.range.start.col + index3;
|
|
23591
23824
|
const escaped = name.replace(/['#[\]]/g, "'$&");
|
|
23592
23825
|
const formula = `SUBTOTAL(${code},${table2.displayName || table2.name}[${escaped}])`;
|
|
23593
23826
|
if (sheet.rows.get(row2)?.get(col)?.formula !== formula) out.set(`${row2}:${col}`, formula);
|
|
23594
23827
|
});
|
|
23595
23828
|
return out;
|
|
23596
23829
|
}
|
|
23597
|
-
function resolveTableNames(table2, before,
|
|
23830
|
+
function resolveTableNames(table2, before, index3) {
|
|
23598
23831
|
const display = table2.displayName || table2.name;
|
|
23599
|
-
const displayName = before && before.displayName === display ? display : safeTableName(display,
|
|
23600
|
-
const name = before && before.name === table2.name ? table2.name : table2.name === display ? displayName : safeTableName(table2.name,
|
|
23832
|
+
const displayName = before && before.displayName === display ? display : safeTableName(display, index3);
|
|
23833
|
+
const name = before && before.name === table2.name ? table2.name : table2.name === display ? displayName : safeTableName(table2.name, index3);
|
|
23601
23834
|
return { name, displayName };
|
|
23602
23835
|
}
|
|
23603
|
-
function safeTableName(name,
|
|
23836
|
+
function safeTableName(name, index3) {
|
|
23604
23837
|
const valid = /^[A-Za-z_\\][A-Za-z0-9_.\\]*$/.test(name) && !/^[A-Za-z]{1,3}\d+$/.test(name) && !/^[RrCc]$/.test(name) && !/^[Rr]\d*[Cc]\d*$/.test(name) && name.length <= 255;
|
|
23605
23838
|
if (valid) return name;
|
|
23606
23839
|
const cleaned = name.replace(/[^A-Za-z0-9_.]/g, "_");
|
|
23607
|
-
return `Table_${cleaned ||
|
|
23840
|
+
return `Table_${cleaned || index3}`;
|
|
23608
23841
|
}
|
|
23609
23842
|
|
|
23610
23843
|
// xlsx/write/sheet-parts.ts
|
|
@@ -23617,7 +23850,7 @@ function sourceRelIds(source2, partName) {
|
|
|
23617
23850
|
if (legacy) out.legacy = legacy;
|
|
23618
23851
|
return out;
|
|
23619
23852
|
}
|
|
23620
|
-
function writeComments(ctx, sheet,
|
|
23853
|
+
function writeComments(ctx, sheet, index3, partName, rels) {
|
|
23621
23854
|
const { writer, source: source2 } = ctx;
|
|
23622
23855
|
const name = (pattern) => writer.uniqueName(pattern, ctx.reserved);
|
|
23623
23856
|
const fromSource = source2 && sheet.partName && source2.has(sheet.partName);
|
|
@@ -23662,8 +23895,8 @@ function writeComments(ctx, sheet, index2, partName, rels) {
|
|
|
23662
23895
|
}
|
|
23663
23896
|
}
|
|
23664
23897
|
const own = base ? vmlIdmapBlocks(base) : [];
|
|
23665
|
-
const layout3 = vmlAllocatorFor(ctx, source2).allocate(sheet.comments.length,
|
|
23666
|
-
const parts = commentParts(sheet.comments,
|
|
23898
|
+
const layout3 = vmlAllocatorFor(ctx, source2).allocate(sheet.comments.length, index3 + 1, own);
|
|
23899
|
+
const parts = commentParts(sheet.comments, index3 + 1, ctx.persons, sheet.name, {
|
|
23667
23900
|
...layout3,
|
|
23668
23901
|
...base ? { base } : {}
|
|
23669
23902
|
});
|
|
@@ -23685,11 +23918,11 @@ function sourceVmlPart(source2, sheetPart) {
|
|
|
23685
23918
|
}
|
|
23686
23919
|
function writeTables(ctx, sheet, partName, rels, headerText, formulas) {
|
|
23687
23920
|
const ids = [];
|
|
23688
|
-
for (const [
|
|
23921
|
+
for (const [index3, original] of sheet.tables.entries()) {
|
|
23689
23922
|
const { writer, source: source2 } = ctx;
|
|
23690
23923
|
const sourceXml = original.partName ? source2?.text(original.partName) : void 0;
|
|
23691
23924
|
const before = sourceXml && original.partName ? parseTable(sourceXml, original.partName) : void 0;
|
|
23692
|
-
const { name, displayName } = resolveTableNames(original, before,
|
|
23925
|
+
const { name, displayName } = resolveTableNames(original, before, index3 + 1);
|
|
23693
23926
|
const table2 = name === original.name && displayName === original.displayName ? original : { ...original, name, displayName };
|
|
23694
23927
|
const { names, headerText: forced } = resolveTableColumns(sheet, table2);
|
|
23695
23928
|
for (const [key, text] of forced) headerText.set(key, text);
|
|
@@ -23971,7 +24204,7 @@ var REGENERATED = /* @__PURE__ */ new Set([
|
|
|
23971
24204
|
]);
|
|
23972
24205
|
var NS_XR2 = "http://schemas.microsoft.com/office/spreadsheetml/2015/revision2";
|
|
23973
24206
|
var NS_XR3 = "http://schemas.microsoft.com/office/spreadsheetml/2016/revision3";
|
|
23974
|
-
function writeWorksheet(ctx, sheet,
|
|
24207
|
+
function writeWorksheet(ctx, sheet, index3, partName) {
|
|
23975
24208
|
const { writer, source: source2 } = ctx;
|
|
23976
24209
|
const rels = new RelationshipSet();
|
|
23977
24210
|
let sourceDrawing;
|
|
@@ -23994,7 +24227,7 @@ function writeWorksheet(ctx, sheet, index2, partName) {
|
|
|
23994
24227
|
const tableParts = writeTables(ctx, sheet, partName, rels, headerText, formulas);
|
|
23995
24228
|
blocks.set("sheetPr", sheetPrXml(sheet));
|
|
23996
24229
|
blocks.set("dimension", dimensionXml(sheet));
|
|
23997
|
-
blocks.set("sheetViews", sheetViewsXml(sheet,
|
|
24230
|
+
blocks.set("sheetViews", sheetViewsXml(sheet, index3 === ctx.workbook.activeSheet));
|
|
23998
24231
|
blocks.set("sheetFormatPr", sheetFormatXml(sheet));
|
|
23999
24232
|
blocks.set("cols", colsXml(sheet, ctx.workbook.styles.length));
|
|
24000
24233
|
blocks.set(
|
|
@@ -24033,7 +24266,7 @@ function writeWorksheet(ctx, sheet, index2, partName) {
|
|
|
24033
24266
|
);
|
|
24034
24267
|
blocks.set("headerFooter", page.headerFooter);
|
|
24035
24268
|
blocks.set("drawing", writeSheetDrawing(ctx, sheet, partName, rels, sourceDrawing));
|
|
24036
|
-
blocks.set("legacyDrawing", writeComments(ctx, sheet,
|
|
24269
|
+
blocks.set("legacyDrawing", writeComments(ctx, sheet, index3, partName, rels));
|
|
24037
24270
|
blocks.set("tableParts", tableParts);
|
|
24038
24271
|
ctx.pivots?.writeSheet(writer, sheet, partName, rels);
|
|
24039
24272
|
blocks.set("extLst", conditionalExtensionsXml(sheet));
|
|
@@ -24058,12 +24291,12 @@ function pivotCacheData(pivot) {
|
|
|
24058
24291
|
const items = pivot.fields.map(() => []);
|
|
24059
24292
|
const indices = pivot.fields.map(() => /* @__PURE__ */ new Map());
|
|
24060
24293
|
for (const record of pivot.records)
|
|
24061
|
-
pivot.fields.forEach((_field,
|
|
24062
|
-
const value2 = record[
|
|
24294
|
+
pivot.fields.forEach((_field, index3) => {
|
|
24295
|
+
const value2 = record[index3] ?? null;
|
|
24063
24296
|
const key = pivotValueKey(value2);
|
|
24064
|
-
if (!indices[
|
|
24065
|
-
indices[
|
|
24066
|
-
items[
|
|
24297
|
+
if (!indices[index3].has(key)) {
|
|
24298
|
+
indices[index3].set(key, items[index3].length);
|
|
24299
|
+
items[index3].push(value2);
|
|
24067
24300
|
}
|
|
24068
24301
|
});
|
|
24069
24302
|
return { items, indices };
|
|
@@ -24078,8 +24311,8 @@ function valueXml(value2) {
|
|
|
24078
24311
|
}
|
|
24079
24312
|
function pivotCacheDefinitionXml(pivot, workbook, data, recordRel) {
|
|
24080
24313
|
const source2 = sparklineDataRange(workbook, 0, pivot.source);
|
|
24081
|
-
const fields = pivot.fields.map((name,
|
|
24082
|
-
const items = data.items[
|
|
24314
|
+
const fields = pivot.fields.map((name, index3) => {
|
|
24315
|
+
const items = data.items[index3];
|
|
24083
24316
|
const types = new Set(
|
|
24084
24317
|
items.map((value2) => value2 === null || value2 === "" ? "blank" : typeof value2)
|
|
24085
24318
|
);
|
|
@@ -24091,7 +24324,7 @@ function pivotCacheDefinitionXml(pivot, workbook, data, recordRel) {
|
|
|
24091
24324
|
}
|
|
24092
24325
|
function pivotCacheRecordsXml(pivot, data) {
|
|
24093
24326
|
const records = pivot.records.map(
|
|
24094
|
-
(record) => `<r>${pivot.fields.map((_field,
|
|
24327
|
+
(record) => `<r>${pivot.fields.map((_field, index3) => `<x v="${data.indices[index3].get(pivotValueKey(record[index3] ?? null))}"/>`).join("")}</r>`
|
|
24095
24328
|
).join("");
|
|
24096
24329
|
return `${XML_HEADER}<pivotCacheRecords xmlns="${NS.x}" count="${pivot.records.length}">${records}</pivotCacheRecords>`;
|
|
24097
24330
|
}
|
|
@@ -24101,6 +24334,19 @@ function pivotTableXml(pivot, cacheId, cache2) {
|
|
|
24101
24334
|
const grid = pivotGrid(pivot);
|
|
24102
24335
|
const row2 = pivot.fields.indexOf(pivot.rowField);
|
|
24103
24336
|
const second = pivot.secondRowField ? pivot.fields.indexOf(pivot.secondRowField) : -1;
|
|
24337
|
+
const page = pivot.pageFilter ? pivot.fields.indexOf(pivot.pageFilter.field) : -1;
|
|
24338
|
+
const pageItems = page >= 0 ? pivotItems(pivot, pivot.pageFilter.field) : [];
|
|
24339
|
+
const axisItems = (field, visible) => page >= 0 ? pivotItems(pivot, field) : visible;
|
|
24340
|
+
const rowItemsFull = axisItems(pivot.rowField, grid.rowItems);
|
|
24341
|
+
const secondRowItemsFull = pivot.secondRowField ? axisItems(pivot.secondRowField, grid.secondRowItems) : [];
|
|
24342
|
+
const columnItemsFull = pivot.columnField ? axisItems(pivot.columnField, grid.columnItems) : [];
|
|
24343
|
+
const itemIndices = (visible, full) => {
|
|
24344
|
+
const indices = new Map(full.map((item, index3) => [pivotValueKey(item), index3]));
|
|
24345
|
+
return visible.map((v) => indices.get(pivotValueKey(v)));
|
|
24346
|
+
};
|
|
24347
|
+
const rowIndicesFull = itemIndices(grid.rowItems, rowItemsFull), secondRowIndicesFull = itemIndices(grid.secondRowItems ?? [], secondRowItemsFull), columnIndicesFull = itemIndices(grid.columnItems, columnItemsFull);
|
|
24348
|
+
const rowEntries = page >= 0 && grid.rowEntries ? remapPivotRowEntries(grid.rowEntries, [rowIndicesFull, secondRowIndicesFull]) : grid.rowEntries;
|
|
24349
|
+
const pageOffset = page >= 0 ? 2 : 0;
|
|
24104
24350
|
const col = pivot.columnField ? pivot.fields.indexOf(pivot.columnField) : -1;
|
|
24105
24351
|
const measures = pivotMeasures(pivot);
|
|
24106
24352
|
const multiple = measures.length > 1;
|
|
@@ -24108,32 +24354,34 @@ function pivotTableXml(pivot, cacheId, cache2) {
|
|
|
24108
24354
|
const compact = pivot.layout === "compact";
|
|
24109
24355
|
const outline = pivot.layout === "compact" || pivot.layout === "outline";
|
|
24110
24356
|
const top = (pivot.subtotalPosition ?? (outline ? "top" : "bottom")) === "top";
|
|
24111
|
-
const fields = pivot.fields.map((_field,
|
|
24112
|
-
const items2 =
|
|
24113
|
-
const subtotal = !(
|
|
24114
|
-
const repeated = pivot.repeatLabels && (
|
|
24115
|
-
return `<pivotField${attrs({ axis:
|
|
24357
|
+
const fields = pivot.fields.map((_field, index3) => {
|
|
24358
|
+
const items2 = index3 === page ? pageItems : index3 === row2 ? rowItemsFull : index3 === second ? secondRowItemsFull : index3 === col ? columnItemsFull : void 0;
|
|
24359
|
+
const subtotal = !(index3 === row2 && pivot.subtotals === false);
|
|
24360
|
+
const repeated = pivot.repeatLabels && (index3 === row2 || index3 === second) ? '<extLst><ext uri="{2946ED86-A175-432a-8AC1-64E0C546D7DE}"><x14:pivotField xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main" fillDownLabels="1"/></ext></extLst>' : "";
|
|
24361
|
+
return `<pivotField${attrs({ axis: index3 === page ? "axisPage" : index3 === row2 || index3 === second ? "axisRow" : index3 === col ? "axisCol" : void 0, dataField: measures.some((measure) => pivot.fields.indexOf(measure.field) === index3) ? true : void 0, compact, outline, showAll: false, subtotalTop: index3 === row2 ? top : void 0, defaultSubtotal: subtotal ? void 0 : false })}>${items2 ? `<items count="${items2.length + Number(subtotal)}">${items2.map((item) => `<item x="${cache2.indices[index3].get(pivotValueKey(item))}"/>`).join("")}${subtotal ? '<item t="default"/>' : ""}</items>` : ""}${repeated}</pivotField>`;
|
|
24116
24362
|
}).join("");
|
|
24117
|
-
const items = (count2) => Array.from({ length: count2 }, (_v, i2) => `<i><x v="${i2}"/></i>`).join("") + '<i t="grand"><x/></i>';
|
|
24118
|
-
const header = grid.firstHeaderRow
|
|
24363
|
+
const items = (count2, indices) => Array.from({ length: count2 }, (_v, i2) => `<i><x v="${indices?.[i2] ?? i2}"/></i>`).join("") + '<i t="grand"><x/></i>';
|
|
24364
|
+
const header = grid.firstHeaderRow !== void 0 ? grid.firstHeaderRow - pageOffset : multiple && col >= 0 ? 1 : grid.firstDataRow - pageOffset - 1;
|
|
24119
24365
|
const rowIndices = rowsAxis && pivot.valuesPosition === "first" ? [-2, row2, second] : rowsAxis && pivot.valuesPosition === "between" ? [row2, -2, second] : [row2, ...second >= 0 ? [second] : [], ...rowsAxis ? [-2] : []];
|
|
24120
24366
|
let previous = [];
|
|
24121
|
-
const rowItems =
|
|
24367
|
+
const rowItems = rowEntries?.map((entry3) => {
|
|
24122
24368
|
let prefix = 0;
|
|
24123
24369
|
if (entry3.type === "default" && rowsAxis && pivot.valuesPosition === "first") prefix = 1;
|
|
24124
24370
|
else if (!entry3.type)
|
|
24125
24371
|
while (prefix < entry3.indices.length - 1 && entry3.indices[prefix] === previous[prefix])
|
|
24126
24372
|
prefix++;
|
|
24127
24373
|
previous = entry3.type && !(entry3.type === "default" && pivot.valuesPosition === "first") ? [] : entry3.indices;
|
|
24128
|
-
return `<i${attrs({ t: entry3.type, r: prefix || void 0, i: entry3.measure || void 0 })}>${entry3.indices.slice(prefix).map((
|
|
24129
|
-
}).join("") ?? items(grid.rowItems.length);
|
|
24130
|
-
let body = `<location${attrs({ ref: formatRange(pivot.location), firstHeaderRow: header, firstDataRow: grid.firstDataRow, firstDataCol: grid.rowLabelColumns ?? 1 })}/><pivotFields count="${pivot.fields.length}">${fields}</pivotFields><rowFields count="${rowIndices.length}">${rowIndices.map((
|
|
24374
|
+
return `<i${attrs({ t: entry3.type, r: prefix || void 0, i: entry3.measure || void 0 })}>${entry3.indices.slice(prefix).map((index3) => `<x${attrs({ v: index3 || void 0 })}/>`).join("")}</i>`;
|
|
24375
|
+
}).join("") ?? items(grid.rowItems.length, rowIndicesFull);
|
|
24376
|
+
let body = `<location${attrs({ ref: formatRange({ ...pivot.location, start: { ...pivot.location.start, row: pivot.location.start.row + pageOffset } }), firstHeaderRow: header, firstDataRow: grid.firstDataRow - pageOffset, rowPageCount: page >= 0 ? 1 : void 0, colPageCount: page >= 0 ? 1 : void 0, firstDataCol: grid.rowLabelColumns ?? 1 })}/><pivotFields count="${pivot.fields.length}">${fields}</pivotFields><rowFields count="${rowIndices.length}">${rowIndices.map((index3) => `<field x="${index3}"/>`).join("")}</rowFields><rowItems count="${grid.rowEntries?.length ?? grid.rowItems.length + 1}">${rowItems}</rowItems>`;
|
|
24131
24377
|
if (multiple && !rowsAxis)
|
|
24132
|
-
body += `<colFields count="${col >= 0 ? 2 : 1}">${col >= 0 ? `<field x="${col}"/>` : ""}<field x="-2"/></colFields>${pivotValueAxisItems(measures.length, col >= 0 ? grid.columnItems.length : void 0)}`;
|
|
24378
|
+
body += `<colFields count="${col >= 0 ? 2 : 1}">${col >= 0 ? `<field x="${col}"/>` : ""}<field x="-2"/></colFields>${pivotValueAxisItems(measures.length, col >= 0 ? grid.columnItems.length : void 0, columnIndicesFull)}`;
|
|
24133
24379
|
else if (col >= 0)
|
|
24134
|
-
body += `<colFields count="1"><field x="${col}"/></colFields><colItems count="${grid.columnItems.length + 1}">${items(grid.columnItems.length)}</colItems>`;
|
|
24380
|
+
body += `<colFields count="1"><field x="${col}"/></colFields><colItems count="${grid.columnItems.length + 1}">${items(grid.columnItems.length, columnIndicesFull)}</colItems>`;
|
|
24135
24381
|
else
|
|
24136
|
-
body += rowsAxis ? '<colItems count="1"><i/></colItems>' : '<colItems count="1"><i><x/></i></colItems>';
|
|
24382
|
+
body += rowsAxis ? '<colItems count="1"><i/></colItems>' : page >= 0 ? '<colItems count="1"><i/></colItems>' : '<colItems count="1"><i><x/></i></colItems>';
|
|
24383
|
+
if (page >= 0)
|
|
24384
|
+
body += `<pageFields count="1"><pageField${attrs({ fld: page, hier: -1, item: pivot.pageFilter.item !== void 0 ? pageItems.findIndex((item) => pivotValueKey(item) === pivotValueKey(pivot.pageFilter.item)) : void 0 })}/></pageFields>`;
|
|
24137
24385
|
body += `<dataFields count="${measures.length}">${measures.map((measure) => `<dataField${attrs({ name: encodeEscapes(measure.caption), fld: pivot.fields.indexOf(measure.field), subtotal: measure.aggregate, baseField: 0, baseItem: 0 })}/>`).join("")}</dataFields>`;
|
|
24138
24386
|
const doc = parseXml(
|
|
24139
24387
|
pivot.sourceXml ?? `<pivotTableDefinition xmlns="${NS.x}" dataCaption="Values" updatedVersion="6" minRefreshableVersion="3" createdVersion="6"><pivotTableStyleInfo name="PivotStyleLight16" showRowHeaders="1" showColHeaders="1" showRowStripes="0" showColStripes="0" showLastColumn="1"/></pivotTableDefinition>`
|
|
@@ -24188,7 +24436,8 @@ function pivotTableXml(pivot, cacheId, cache2) {
|
|
|
24188
24436
|
"rowItems",
|
|
24189
24437
|
"colFields",
|
|
24190
24438
|
"colItems",
|
|
24191
|
-
"dataFields"
|
|
24439
|
+
"dataFields",
|
|
24440
|
+
"pageFields"
|
|
24192
24441
|
]);
|
|
24193
24442
|
for (const child4 of elements(root)) if (replaced.has(child4.localName)) root.removeChild(child4);
|
|
24194
24443
|
const replacement = parseXml(`<root xmlns="${NS.x}">${body}</root>`).documentElement;
|
|
@@ -24373,8 +24622,8 @@ async function saveXlsx(workbook) {
|
|
|
24373
24622
|
return void 0;
|
|
24374
24623
|
});
|
|
24375
24624
|
const sheetRefs = [];
|
|
24376
|
-
workbook.sheets.forEach((sheet,
|
|
24377
|
-
let partName = partNames[
|
|
24625
|
+
workbook.sheets.forEach((sheet, index3) => {
|
|
24626
|
+
let partName = partNames[index3];
|
|
24378
24627
|
const sourceType = partName && source2?.has(partName) ? source2.contentType(partName) : void 0;
|
|
24379
24628
|
const special = sourceType ? SHEET_TYPES[sourceType] : void 0;
|
|
24380
24629
|
if (!partName) {
|
|
@@ -24385,11 +24634,11 @@ async function saveXlsx(workbook) {
|
|
|
24385
24634
|
claimed.add(partName);
|
|
24386
24635
|
}
|
|
24387
24636
|
if (special) writer.carry(partName);
|
|
24388
|
-
else writeWorksheet(ctx, sheet,
|
|
24637
|
+
else writeWorksheet(ctx, sheet, index3, partName);
|
|
24389
24638
|
sheetRefs.push({
|
|
24390
24639
|
name: sheet.name,
|
|
24391
24640
|
sheetId: sheet.sheetId,
|
|
24392
|
-
state: states[
|
|
24641
|
+
state: states[index3] ?? "visible",
|
|
24393
24642
|
relId: rels.add(special ?? RELATIONSHIP_TYPES.worksheet, relativeTarget(bookPart, partName))
|
|
24394
24643
|
});
|
|
24395
24644
|
});
|
|
@@ -25011,10 +25260,10 @@ function hasFlatUniqueStreamLayout(entries, workbookCount) {
|
|
|
25011
25260
|
return new Set(names).size === names.length;
|
|
25012
25261
|
}
|
|
25013
25262
|
function equalBytes(left2, right2) {
|
|
25014
|
-
return left2.length === right2.length && left2.every((value2,
|
|
25263
|
+
return left2.length === right2.length && left2.every((value2, index3) => value2 === right2[index3]);
|
|
25015
25264
|
}
|
|
25016
25265
|
function isCfb(bytes) {
|
|
25017
|
-
return OLE_MAGIC.every((value2,
|
|
25266
|
+
return OLE_MAGIC.every((value2, index3) => bytes[index3] === value2);
|
|
25018
25267
|
}
|
|
25019
25268
|
|
|
25020
25269
|
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-functions.js
|
|
@@ -25455,9 +25704,9 @@ function decode2(rgce, extra, context, options) {
|
|
|
25455
25704
|
break;
|
|
25456
25705
|
case 25: {
|
|
25457
25706
|
const ixti = reader.u16();
|
|
25458
|
-
const
|
|
25707
|
+
const index3 = reader.u16();
|
|
25459
25708
|
reader.skip(2);
|
|
25460
|
-
const name = context.externName(ixti,
|
|
25709
|
+
const name = context.externName(ixti, index3);
|
|
25461
25710
|
if (name === void 0)
|
|
25462
25711
|
return void 0;
|
|
25463
25712
|
push(name);
|
|
@@ -25574,9 +25823,9 @@ var XLS_BUILTIN_FORMATS = {
|
|
|
25574
25823
|
48: "##0.0E+0",
|
|
25575
25824
|
49: "@"
|
|
25576
25825
|
};
|
|
25577
|
-
function paletteColor(
|
|
25578
|
-
const rgb =
|
|
25579
|
-
return rgb ? { index:
|
|
25826
|
+
function paletteColor(index3, palette) {
|
|
25827
|
+
const rgb = index3 < 64 ? palette[index3] : void 0;
|
|
25828
|
+
return rgb ? { index: index3, rgb } : { index: index3, auto: true };
|
|
25580
25829
|
}
|
|
25581
25830
|
var UNDERLINE = {
|
|
25582
25831
|
1: "single",
|
|
@@ -26016,18 +26265,18 @@ function parseGlobals(records) {
|
|
|
26016
26265
|
}
|
|
26017
26266
|
return void 0;
|
|
26018
26267
|
},
|
|
26019
|
-
name(
|
|
26020
|
-
const raw2 = rawNames[
|
|
26268
|
+
name(index3) {
|
|
26269
|
+
const raw2 = rawNames[index3 - 1];
|
|
26021
26270
|
return raw2?.name.name;
|
|
26022
26271
|
},
|
|
26023
|
-
externName(ixti,
|
|
26272
|
+
externName(ixti, index3) {
|
|
26024
26273
|
const xti = xtis[ixti];
|
|
26025
26274
|
const book = xti ? supbooks[xti.book] : void 0;
|
|
26026
26275
|
if (!book)
|
|
26027
26276
|
return void 0;
|
|
26028
26277
|
if (book.kind === "self")
|
|
26029
|
-
return this.name(
|
|
26030
|
-
return book.externNames[
|
|
26278
|
+
return this.name(index3);
|
|
26279
|
+
return book.externNames[index3 - 1];
|
|
26031
26280
|
}
|
|
26032
26281
|
};
|
|
26033
26282
|
for (const raw2 of rawNames) {
|
|
@@ -26358,8 +26607,8 @@ function parseSheet(bound, records, start, globals) {
|
|
|
26358
26607
|
sheet.cells.push(result2);
|
|
26359
26608
|
return result2;
|
|
26360
26609
|
};
|
|
26361
|
-
for (let
|
|
26362
|
-
const record = records[
|
|
26610
|
+
for (let index3 = start; index3 < records.length; index3++) {
|
|
26611
|
+
const record = records[index3];
|
|
26363
26612
|
const { opcode, data } = record;
|
|
26364
26613
|
if (opcode === 2057) {
|
|
26365
26614
|
depth++;
|
|
@@ -26567,7 +26816,7 @@ function parseSheet(bound, records, start, globals) {
|
|
|
26567
26816
|
|
|
26568
26817
|
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook.js
|
|
26569
26818
|
function compoundStreamNames(bytes) {
|
|
26570
|
-
if (!OLE_MAGIC.every((value2,
|
|
26819
|
+
if (!OLE_MAGIC.every((value2, index3) => bytes[index3] === value2))
|
|
26571
26820
|
return [];
|
|
26572
26821
|
try {
|
|
26573
26822
|
const buffer = bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
|
|
@@ -26579,10 +26828,10 @@ function compoundStreamNames(bytes) {
|
|
|
26579
26828
|
function topLevelSubstreams(records) {
|
|
26580
26829
|
const starts = [];
|
|
26581
26830
|
let depth = 0;
|
|
26582
|
-
records.forEach((record,
|
|
26831
|
+
records.forEach((record, index3) => {
|
|
26583
26832
|
if (record.opcode === 2057) {
|
|
26584
|
-
if (depth === 0 &&
|
|
26585
|
-
starts.push(
|
|
26833
|
+
if (depth === 0 && index3 > 0)
|
|
26834
|
+
starts.push(index3);
|
|
26586
26835
|
depth++;
|
|
26587
26836
|
} else if (record.opcode === 10)
|
|
26588
26837
|
depth = Math.max(0, depth - 1);
|
|
@@ -26607,7 +26856,7 @@ function readXlsWorkbook(bytes) {
|
|
|
26607
26856
|
unsupported.push("VBA macros");
|
|
26608
26857
|
if (streams2.some((name) => name === "_SX_DB_CUR") && !unsupported.includes("pivot caches"))
|
|
26609
26858
|
unsupported.push("pivot caches");
|
|
26610
|
-
const byOffset = new Map(records.map((record,
|
|
26859
|
+
const byOffset = new Map(records.map((record, index3) => [record.offset, index3]));
|
|
26611
26860
|
const substreams = topLevelSubstreams(records);
|
|
26612
26861
|
const sheets = globals.sheets.map((bound, position) => {
|
|
26613
26862
|
const start = byOffset.get(bound.offset) ?? substreams[position];
|
|
@@ -26731,7 +26980,7 @@ function layout2(bytes) {
|
|
|
26731
26980
|
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
26732
26981
|
if (view.getUint16(0, true) !== 65534 || view.getUint16(2, true) > 1 || view.getUint32(24, true) !== 1)
|
|
26733
26982
|
return;
|
|
26734
|
-
if (!FMTID.every((value2,
|
|
26983
|
+
if (!FMTID.every((value2, index3) => bytes[28 + index3] === value2))
|
|
26735
26984
|
return;
|
|
26736
26985
|
const start = view.getUint32(44, true);
|
|
26737
26986
|
if (start < 48 || start % 4 || start + 8 > bytes.length)
|
|
@@ -26889,8 +27138,8 @@ function xfToCellStyle(xls, xf) {
|
|
|
26889
27138
|
}
|
|
26890
27139
|
function defaultXfIndex(xls) {
|
|
26891
27140
|
if (xls.xfs[15] && !xls.xfs[15].isStyle) return 15;
|
|
26892
|
-
const
|
|
26893
|
-
return
|
|
27141
|
+
const index3 = xls.xfs.findIndex((xf) => !xf.isStyle);
|
|
27142
|
+
return index3 >= 0 ? index3 : 0;
|
|
26894
27143
|
}
|
|
26895
27144
|
|
|
26896
27145
|
// xlsx/load/legacy-xls-sheet.ts
|
|
@@ -27084,7 +27333,7 @@ async function loadLegacyXls(input) {
|
|
|
27084
27333
|
workbook.sheets = [];
|
|
27085
27334
|
let undecoded = 0;
|
|
27086
27335
|
let external = false;
|
|
27087
|
-
xls.sheets.forEach((source2,
|
|
27336
|
+
xls.sheets.forEach((source2, index3) => {
|
|
27088
27337
|
if (source2.kind !== "worksheet") {
|
|
27089
27338
|
const kind = source2.kind === "chart" ? "chart sheet" : `${source2.kind} sheet`;
|
|
27090
27339
|
warnings.push(
|
|
@@ -27093,7 +27342,7 @@ async function loadLegacyXls(input) {
|
|
|
27093
27342
|
return;
|
|
27094
27343
|
}
|
|
27095
27344
|
const mapped = mapSheet(source2, workbook.sheets.length + 1, resolve2);
|
|
27096
|
-
sheetIndex2.set(
|
|
27345
|
+
sheetIndex2.set(index3, workbook.sheets.length);
|
|
27097
27346
|
workbook.sheets.push(mapped.sheet);
|
|
27098
27347
|
undecoded += mapped.undecodedFormulas;
|
|
27099
27348
|
external ||= mapped.externalReferences;
|
|
@@ -27202,7 +27451,7 @@ function decodeSpreadsheetText(bytes) {
|
|
|
27202
27451
|
var CFB_MAGIC = [208, 207, 17, 224, 161, 177, 26, 225];
|
|
27203
27452
|
var ZIP_MAGIC = [80, 75, 3, 4];
|
|
27204
27453
|
var toBytes3 = (input) => input instanceof Uint8Array ? input : new Uint8Array(input);
|
|
27205
|
-
var startsWith = (bytes, magic) => magic.every((value2,
|
|
27454
|
+
var startsWith = (bytes, magic) => magic.every((value2, index3) => bytes[index3] === value2);
|
|
27206
27455
|
function zipEntryNames(bytes) {
|
|
27207
27456
|
const names = /* @__PURE__ */ new Set();
|
|
27208
27457
|
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|